summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Kirk <askirk@umich.edu>2018-06-25 16:23:27 -0400
committerAustin Kirk <askirk@umich.edu>2018-06-25 16:23:27 -0400
commitd0070fb491fa9cc0302226539eb0cbbe6b6fc77f (patch)
tree8aa8f1e39daae9a521fd6ba59b722eb1d6ba8c20
parent63459fad84d226a34d2f8214361da0f92c662d33 (diff)
parent9d7345d7c724ef82f5cdfe571dc22efb5c634989 (diff)
downloadsdl_android-d0070fb491fa9cc0302226539eb0cbbe6b6fc77f.tar.gz
Merge branch 'develop' of https://github.com/smartdevicelink/sdl_android into issue_419issue_419
-rw-r--r--.travis.yml20
-rw-r--r--CHANGELOG.md49
-rw-r--r--LICENSE2
-rw-r--r--README.md32
-rw-r--r--build.gradle8
-rw-r--r--gradle/wrapper/gradle-wrapper.properties4
-rw-r--r--sdl_android/bintray.gradle2
-rw-r--r--sdl_android/build.gradle30
-rw-r--r--sdl_android/src/androidTest/assets/json/ButtonPress.json15
-rw-r--r--sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json38
-rw-r--r--sdl_android/src/androidTest/assets/json/GetSystemCapability.json18
-rw-r--r--sdl_android/src/androidTest/assets/json/SendHapticData.json22
-rw-r--r--sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json56
-rw-r--r--sdl_android/src/androidTest/assets/xml/MOBILE_API_4.5.0.xml6052
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java75
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/protocol/WiProProtocolTests.java63
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java2
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlConnection/SdlSessionTests.java50
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java236
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java629
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/encoder/EncoderUtilsTest.java116
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java80
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java48
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java175
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java173
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java328
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java160
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java130
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java12
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java110
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java95
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java69
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java64
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java112
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java124
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java101
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java79
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java131
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java108
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java72
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java96
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java70
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java14
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java77
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DefrostZoneTests.java79
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LanguageTests.java62
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java114
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ModuleTypeTests.java71
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioBandTests.java75
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioStateTests.java79
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java10
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java119
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TouchTypeTests.java17
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VentilationModeTests.java79
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingCodecTests.java79
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingProtocolTests.java82
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java69
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java113
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java105
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java95
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java86
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java102
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java35
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java74
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java110
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java97
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java17
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java104
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java2
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java2
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java86
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java61
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java33
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockStreamListener.java13
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java461
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java5
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/RTPH264PacketizerTest.java882
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/SdlRemoteDisplayTest.java139
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DeviceUtil.java3
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java169
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java31
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java37
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java246
-rw-r--r--sdl_android/src/main/AndroidManifest.xml1
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java4
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java11
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java191
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java107
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java63
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java400
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java131
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/AbstractProtocol.java7
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/IProtocolListener.java5
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/ProtocolMessage.java8
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java34
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java241
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java85
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java8
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java5
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java5
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java4
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCResponse.java6
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java4
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java1671
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java3184
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java291
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java169
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/Version.java4
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IAudioStreamListener.java71
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java20
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java116
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdlServiceListener.java11
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IVideoStreamListener.java90
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/OnSystemCapabilityListener.java6
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddCommand.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddCommandResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java23
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AirbagStatus.java31
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AlertResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java22
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/BeltStatus.java53
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java15
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java24
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java107
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java41
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistration.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Choice.java22
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java290
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java106
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Coordinate.java12
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DIDResult.java11
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommand.java12
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFile.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeviceStatus.java56
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java20
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DialNumber.java8
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DialNumberResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java24
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ECallInfo.java28
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/EmergencyEvent.java37
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java68
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GenericResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCs.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java19
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java89
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java88
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java59
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java64
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPoints.java9
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPointsResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java31
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMIPermissions.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java89
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HeadLampStatus.java27
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Image.java19
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ImageField.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ListFilesResponse.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MenuParams.java12
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java116
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java84
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MyKey.java36
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationCapability.java35
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java12
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonEvent.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonPress.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnCommand.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java12
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java20
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHashChange.java12
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java58
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java12
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnLanguageChange.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java12
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java20
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnTBTClientState.java10
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnTouchEvent.java23
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnWayPointChange.java9
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ParameterPermissions.java19
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java31
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java27
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java34
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PhoneCapability.java27
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java23
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PutFile.java24
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PutFileResponse.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java248
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java223
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java180
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ReadDID.java27
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java119
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java53
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java45
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java82
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java21
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScreenParams.java15
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java19
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java86
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java67
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendLocationResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIcon.java19
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java15
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java62
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java63
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java22
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Show.java26
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java21
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java15
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java32
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java25
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java15
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java21
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java78
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java13
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java19
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java69
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java26
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java52
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java29
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java28
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java21
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java207
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java30
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java22
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java26
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java52
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java54
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java27
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java11
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java23
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java89
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java96
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java15
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java20
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java11
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java429
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TouchType.java6
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java50
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java44
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java52
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java4
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java155
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingCodec.java49
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingLPCMParams.java64
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingParams.java55
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java507
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java208
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java218
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/BTTransport.java36
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java200
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java21
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java289
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/SdlPsm.java2
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java956
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java2
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java8
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java4
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/TransportConstants.java12
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java10
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java14
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java142
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java175
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java142
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/util/Version.java47
-rw-r--r--sdl_android/src/main/res/values/sdl.xml7
-rw-r--r--sdl_android/src/main/res/xml/accessory_filter.xml7
-rw-r--r--sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java169
310 files changed, 27233 insertions, 3487 deletions
diff --git a/.travis.yml b/.travis.yml
index c51216585..f138933a0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,18 +5,20 @@ android:
components:
# use the latest revision of Android SDK Tools
- tools
- - platform-tools
- tools
+ - platform-tools
+ - ndk-bundle
# The BuildTools version used by your project
- - build-tools-25.0.2
+ - build-tools-27.0.3
# The SDK version used to compile your project
- - android-19
+ - android-26
+ - android-22 #For emulator
# Specify at least one system image,
# if you need to run emulator(s) during your tests
- - sys-img-armeabi-v7a-android-21
- # - sys-img-x86-android-17
+ - sys-img-armeabi-v7a-android-22
+ # - sys-img-x86-android-26
# Android Support Repos
- extra-android-m2repository
@@ -34,17 +36,17 @@ env:
# Emulator Management: Create, Start and Wait
before_script:
- - echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
+ - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- android list target
- - ./gradlew connectedAndroidTest
+ - ./gradlew connectedCheck
before_install:
- - pip install --user codecov #Install codecov
+ - echo yes | sdkmanager "build-tools;27.0.3"
after_success:
- - codecov #Run codecov
+ - bash <(curl -s https://codecov.io/bash)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe1aee747..6246b922d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,37 +1,24 @@
-# 4.3.0 Release Notes
+# 4.6.0 Release Notes
### API New Features & Breaking Changes
-* The library has now moved to Android Studio as its default IDE. All files and folders have been moved to align with proper Android Studio project structure.
-* The target API level is now `19` instead of `18`. Apps will also need to target this version or higher to continue using this library.
-* `Java 7` is now used to compile the library and its features can be used moving forward.
+- `RPCRequestFactory` has been deprecated. Please use the desired RPC's constructor instead.
+- The Android Annotations Library has been added to the project to better help and inform developers about the SDK.
### Enhancements
-* Multiplexing bluetooth, legacy bluetooth, and TCP transport has been improved in performance by switching to buffer reads vs single byte read from transport.
-* Trusted router service checking feature is now adjustable by developers.
-* More unit tests were created.
-* Router service will now check to make sure the app that propagated it has permissions to use bluetooth.
-* Packet streaming classes will now use the agreed upon MTU instead of the hardcoded 1024 when the stream is not encrypted.
-* App IDs sent between the client apps and the router service are now Strings instead of Longs to support longer IDs.
+- The router service foreground lifecycle is improved. The notification should no longer be seen when connecting to non-SDL devices.
+- The SDL notification now links to a webpage to explain what the notification is and how to hide it.
+- The required `intent-filter` entires for the `SdlBroadcastReceiver` has been reduced. It is now only listening for the SDL custom intent, ACL connect, and USB connection if using AOA.
+- RPC classes now contain constructors with the required parameters for that RPC.
+- Moved project to newer version of Gradle. Updated configurations including from `compile` to `api` and `implementation`.
+- `SdlProxyBuilder` was cleaned up to remove redundant variables between the `SdlProxyBuilder.Builder` object and the `SdlProxyBuilder` class.
### Bug Fixes
-* Fixed issue with AOA transport not clearing old accessory reference after disconnect
-* Fixed missing setting of error state in multiplexing bluetooth transport
-* Fixed potential OOMs when corrupted packets are recieved in:
- * `SdlPsm`
- * `WiProProtocol`
- * `BinaryFrameHeader`
-* Fixed possible NPEs in:
- * `SdlRouterService` when checking for correct process
- * `MultiplexingBluetoothTransport` during reads and writes
- * `SdlConnection` during session registration
- * `SdlProxyBase` when clearing RPC response and notification listeners during close
- * `TransportBroker` when sending a message to router service
- * `SdlBroadcastReceiver` during check for running router service
- * `HttpRequestTask` that happens when a server can't be reached
- * `SdlSecurityBase` when a security lib would become initialized after the base has been reset.
-* Added synchronization to a cancel call in the `MultiplexTransport`
-* Refactor code in `SdlBroadcastReceiver` to protect against a potential SecurityException
-* Added try/catch around bluetooth system calls that can fail in Android classes
-* Added try/catch when attempting to build `LocalRouterService` object from parcel when parcel could be corrupt
-* Fixed version checking flow in the router service to be cleaner and correctly synched
-
+- Fixed touch issues with the video streaming feature. A new module was added to handle touch events much more aligned with Android native views.
+- Fixed JavaDoc issue in `UnregisterAppInterface`.
+- Fixed JavaDoc issue in `AddCommand`.
+- Added tags to the string resource xml file to ignore translation
+- Temporary fix to the TCP transport to catch `NetworkOnTheMainThread` exceptions when the connection is closing.
+- Fix issue where the `SdlBroadcastReceiver` was attempting to send implicit intents to ping the `SdlRouterService`. They are now explicit.
+- Fix a potential NPE in the `SdlBroadcastReceiver` while an app is only using USB and does not include an instance of an `SdlRouterService`.
+- Removed reflection usage in bluetooth transports when operating on systems that are newer than Android Oreo in anticipation of Android P.
+- Fix an issue where the `SdlBroadcastReceiver` would throw a false positive regarding whether or not an app had included the correct `intent-filter` in their `SdlRouterService` manifest declaration. \ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 1ec9b0d79..ddda209c2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2017, SmartDeviceLink Consortium, Inc.
+Copyright (c) 2017 - 2018, SmartDeviceLink Consortium, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/README.md b/README.md
index 6e5203846..40af30779 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,36 @@ The mobile library component of SDL is meant to run on the end user’s smart-de
## SmartDeviceLink Android
-We're still working on creating documentation for each of these individual repositories, but in the meantime, you can find more information about SmartDeviceLink [here](https://github.com/smartdevicelink/sdl_core/blob/master/README.md) and [here](http://projects.genivi.org/smartdevicelink/about).
+We're still working on creating documentation for each of these individual repositories, but in the meantime, you can find more information about SmartDeviceLink [here](https://smartdevicelink.com)
You can also find some branches that have yet to be merged into this GitHub project on the GENIVI page [here](http://git.projects.genivi.org/?p=smartdevicelink_android.git;a=summary).
+
+### Installation
+
+#### Dependency Managers
+
+To compile with the latest release of SDL Android, include the following in your app's `build.gradle` file,
+
+```
+repositories {
+ jcenter()
+}
+dependencies {
+ implementation 'com.smartdevicelink:sdl_android:4.+'
+}
+```
+
+For Maven or Ivy snippets please look at [Bintray](https://bintray.com/smartdevicelink/sdl_android/sdl_android)
+
+#### Manually
+
+If you prefer not to use any of the aforementioned dependency managers, you can integrate SDL Android into your project manually.
+
+### Proguard Rules
+
+Developers using Proguard to shrink and obfuscate their code should be sure to include the following lines in their proguard-rules.pro file:
+
+```
+-keep class com.smartdevicelink.** { *; }
+-keep class com.livio.** { *; }
+``` \ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 1ea4bd055..800d3be0e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,11 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
+
repositories {
+ google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.0'
+ classpath 'com.android.tools.build:gradle:3.1.3'
+
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -14,10 +17,11 @@ buildscript {
allprojects {
repositories {
+ google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
-}
+} \ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 00e84878c..9fe523a5c 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Mar 22 15:16:37 EDT 2017
+#Sun Apr 8 12:14:33 EDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
diff --git a/sdl_android/bintray.gradle b/sdl_android/bintray.gradle
index ebbf65599..f4969df2c 100644
--- a/sdl_android/bintray.gradle
+++ b/sdl_android/bintray.gradle
@@ -51,7 +51,7 @@ bintray {
// Authorization
user = props.getProperty("bintray.user")
key = props.getProperty("bintray.key")
-
+ version = props.getProperty("bintray.version")
configurations = ['archives']
pkg {
repo = props.getProperty("bintray.repo")
diff --git a/sdl_android/build.gradle b/sdl_android/build.gradle
index b9dc7cac8..e4e5a44e1 100644
--- a/sdl_android/build.gradle
+++ b/sdl_android/build.gradle
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 19
- buildToolsVersion "25.0.2"
+ compileSdkVersion 26
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
- versionCode 1
- versionName "4.3"
+ versionCode 4
+ versionName "RC_4.6.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ resValue "string", "SDL_LIB_VERSION", '\"' + versionName + '\"'
}
buildTypes {
release {
@@ -26,15 +26,21 @@ android {
lintOptions {
abortOnError false
}
+
+ testOptions {
+ unitTests.returnDefaultValues = true
+ }
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ api fileTree(dir: 'libs', include: ['*.jar'])
+ api 'com.smartdevicelink:bson_java_port:1.1.1'
+ androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- testCompile 'junit:junit:4.12'
-
+ testImplementation 'junit:junit:4.12'
+ testImplementation 'org.mockito:mockito-core:2.9.0'
+ api 'com.android.support:support-annotations:27.1.1'
}
buildscript {
@@ -43,11 +49,9 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
- classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
- classpath 'com.trickyandroid:jacoco-everywhere:0.2.1'
+ classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.1'
+ classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}
-apply from: 'bintray.gradle'
-apply plugin: 'jacoco-everywhere' \ No newline at end of file
+apply from: 'bintray.gradle' \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/ButtonPress.json b/sdl_android/src/androidTest/assets/json/ButtonPress.json
new file mode 100644
index 000000000..e74e857be
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/ButtonPress.json
@@ -0,0 +1,15 @@
+{
+ "request":{
+ "name":"ButtonPress",
+ "correlationID":215,
+ "parameters":{
+ "buttonName":"OK",
+ "buttonPressMode":"LONG",
+ "moduleType":"CLIMATE"
+ }
+ },
+ "response":{
+ "name":"ButtonPressResponse",
+ "correlationID":216
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json b/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json
new file mode 100644
index 000000000..7000d2918
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/GetInteriorVehicleData.json
@@ -0,0 +1,38 @@
+{
+ "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
+ },
+ "acMaxEnable":true,
+ "desiredTemperature":{
+ "unit":"CELSIUS",
+ "value":100.0
+ },
+ "dualModeEnable":true,
+ "autoModeEnable":true,
+ "fanSpeed":100,
+ "defrostZone":"FRONT"
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/GetSystemCapability.json b/sdl_android/src/androidTest/assets/json/GetSystemCapability.json
new file mode 100644
index 000000000..c96bf6013
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/GetSystemCapability.json
@@ -0,0 +1,18 @@
+{
+ "request":{
+ "name":"GetSystemCapability",
+ "correlationID":203,
+ "parameters":{
+ "systemCapabilityType":"NAVIGATION"
+ }
+ },
+ "response":{
+ "name":"GetSystemCapabilityResponse",
+ "correlationID":204,
+ "parameters":{
+ "systemCapability":{
+ "systemCapabilityType":"NAVIGATION"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/SendHapticData.json b/sdl_android/src/androidTest/assets/json/SendHapticData.json
new file mode 100644
index 000000000..42b863aae
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/SendHapticData.json
@@ -0,0 +1,22 @@
+{
+ "request":{
+ "name":"SendHapticData",
+ "correlationID":1234,
+ "parameters":{
+ "hapticRectData":[
+ {"id":123,
+ "rect":{
+ "height":1,
+ "width":1,
+ "x":1,
+ "y":1
+ }
+ }
+ ]
+ }
+ },
+ "response":{
+ "name":"SendHapticData",
+ "correlationID":1234
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json b/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json
new file mode 100644
index 000000000..9bcdc01dc
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/SetInteriorVehicleData.json
@@ -0,0 +1,56 @@
+{
+ "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
+ },
+ "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
+ },
+ "acMaxEnable":true,
+ "desiredTemperature":{
+ "unit":"CELSIUS",
+ "value":100.0
+ },
+ "dualModeEnable":true,
+ "autoModeEnable":true,
+ "fanSpeed":100,
+ "defrostZone":"ALL"
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/assets/xml/MOBILE_API_4.5.0.xml b/sdl_android/src/androidTest/assets/xml/MOBILE_API_4.5.0.xml
new file mode 100644
index 000000000..ffb005ec6
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/xml/MOBILE_API_4.5.0.xml
@@ -0,0 +1,6052 @@
+<?xml version="1.0" standalone="no"?>
+<?xml-stylesheet type="text/xml" href="protocol2html.xsl"?>
+
+<interface name="SmartDeviceLink RAPI" version="4.5.0" date="2017-09-22">
+ <enum name="Result" internal_scope="base">
+ <element name="SUCCESS">
+ <description>The request succeeded</description>
+ </element>
+ <element name="UNSUPPORTED_REQUEST">
+ <description>The request is not supported by the headunit</description>
+ </element>
+ <element name="UNSUPPORTED_RESOURCE">
+ <description>
+ A button that was requested for subscription is not supported under the current system.
+ </description>
+ </element>
+ <element name="DISALLOWED">
+ <description>RPC is not authorized in local policy table.</description>
+ </element>
+ <element name="REJECTED">
+ <description>
+ The requested command was rejected, e.g. because mobile app is in background and cannot perform any HMI commands.
+ Or an HMI command (e.g. Speak) is rejected because a higher priority HMI command (e.g. Alert) is playing.
+ </description>
+ </element>
+ <element name="ABORTED">
+ <description>
+ A command was aborted, for example due to user interaction (e.g. user pressed button).
+ Or an HMI command (e.g. Speak) is aborted because a higher priority HMI command (e.g. Alert) was requested.
+ </description>
+ </element>
+ <element name="IGNORED">
+ <description>
+ A command was ignored, because the intended result is already in effect.
+ For example, SetMediaClockTimer was used to pause the media clock although the clock is paused already.
+ NOTE: potentially replaces SUBSCRIBED_ALREADY
+ </description>
+ </element>
+ <element name="RETRY">
+ <description>The user interrupted the RPC (e.g. PerformAudioPassThru) and indicated to start over. Note, the app must issue the new RPC.</description>
+ </element>
+ <element name="IN_USE">
+ <description>
+ The data may not be changed, because it is currently in use.
+ For example when trying to delete a command set that is currently involved in an interaction.
+ </description>
+ </element>
+ <element name="VEHICLE_DATA_NOT_AVAILABLE">
+ <description>The requested vehicle data is not available on this vehicle or is not published.</description>
+ </element>
+ <element name="TIMED_OUT">
+ <description>Overlay reached the maximum timeout and closed.</description>
+ </element>
+ <element name="INVALID_DATA">
+ <description>
+ The data sent is invalid. For example:
+ Invalid Json syntax
+ Parameters out of bounds (number or enum range)
+ Mandatory parameters not provided
+ Parameter provided with wrong type
+ Invalid characters
+ Empty string
+ </description>
+ </element>
+ <element name="CHAR_LIMIT_EXCEEDED"></element>
+ <element name="INVALID_ID">
+ <description>
+ One of the provided IDs is not valid. For example
+ This applies to CorrelationID, SubscriptionID, CommandID, MenuID, etc.
+ </description>
+ </element>
+ <element name="DUPLICATE_NAME">
+ <description>There was a conflict with an registered name (application or menu item) or vr command</description>
+ </element>
+ <element name="APPLICATION_NOT_REGISTERED">
+ <description>An command can not be executed because no application has been registered with RegisterApplication.</description>
+ </element>
+ <element name="WRONG_LANGUAGE">
+ <description>
+ The requested language is currently not supported.
+ Might be because of a mismatch of the currently active language on the headunit and the requested language
+ </description>
+ </element>
+ <element name="OUT_OF_MEMORY">
+ <description>The system could not process the request because the necessary memory couldn't be allocated</description>
+ </element>
+ <element name="TOO_MANY_PENDING_REQUESTS">
+ <description>There are too many requests pending (means, that the response has not been delivered, yet).There may be a maximum of 1000 pending requests at a time.</description>
+ </element>
+ <element name="TOO_MANY_APPLICATIONS">
+ <description>There are already too many registered applications</description>
+ </element>
+ <element name="APPLICATION_REGISTERED_ALREADY">
+ <description>RegisterApplication has been called again, after a RegisterApplication was successful before.</description>
+ </element>
+ <element name="WARNINGS">
+ <description>The RPC (e.g. SubscribeVehicleData) executed successfully but one or more items have a warning or failure.</description>
+ </element>
+ <element name="GENERIC_ERROR">
+ <description>Provided data is valid but something went wrong in the lower layers.</description>
+ </element>
+ <element name="USER_DISALLOWED">
+ <description>RPC is included in a functional group explicitly blocked by the user.</description>
+ </element>
+ <element name="TRUNCATED_DATA">
+ <description>The RPC (e.g. ReadDID) executed successfully but the data exceeded the platform maximum threshold and thus, only part of the data is available.</description>
+ </element>
+ <element name="UNSUPPORTED_VERSION">
+ <description>Sync doesn't support the protocol that is requested by the mobile application</description>
+ </element>
+ <element name="VEHICLE_DATA_NOT_ALLOWED">
+ <description>The user has turned off access to vehicle data, and it is globally unavailable to mobile applications.</description>
+ </element>
+ <element name="FILE_NOT_FOUND">
+ <description>A specified file could not be found on the headunit.</description>
+ </element>
+ <element name="CANCEL_ROUTE">
+ <description>User selected to Cancel Route.</description>
+ </element>
+ <element name="SAVED">
+ <description>The RPC (e.g. Slider) executed successfully and the user elected to save the current position / value.</description>
+ </element>
+ <element name="INVALID_CERT">
+ <description>The certificate provided during authentication is invalid.</description>
+ </element>
+ <element name="EXPIRED_CERT">
+ <description>The certificate provided during authentication is expired.</description>
+ </element>
+ <element name="RESUME_FAILED">
+ <description>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.</description>
+ </element>
+ <element name="DATA_NOT_AVAILABLE">
+ <description>The requested information is currently not available. This is different than UNSUPPORTED_RESOURCE because it implies the data is at some point available. </description>
+ </element>
+ <element name="READ_ONLY">
+ <description>The value being set is read only</description>
+ </element>
+ </enum>
+
+ <enum name="ButtonPressMode">
+ <element name="LONG">
+ <description>
+ A button was released, after it was pressed for a long time
+ Actual timing is defined by the headunit and may vary
+ </description>
+ </element>
+ <element name="SHORT">
+ <description>
+ A button was released, after it was pressed for a short time
+ Actual timing is defined by the headunit and may vary
+ </description>
+ </element>
+ </enum>
+
+ <enum name="ButtonEventMode">
+ <element name="BUTTONUP">
+ <description>A button has been released up</description>
+ </element>
+ <element name="BUTTONDOWN">
+ <description>A button has been pressed down</description>
+ </element>
+ </enum>
+
+ <enum name="Language">
+ <element name="EN-US" internal_name="EN_US">
+ <description>English - US</description>
+ </element>
+ <element name="ES-MX" internal_name="ES_MX">
+ <description>Spanish - Mexico</description>
+ </element>
+ <element name="FR-CA" internal_name="FR_CA">
+ <description>French - Canada</description>
+ </element>
+ <element name="DE-DE" internal_name="DE_DE">
+ <description>German - Germany</description>
+ </element>
+ <element name="ES-ES" internal_name="ES_ES">
+ <description>Spanish - Spain</description>
+ </element>
+ <element name="EN-GB" internal_name="EN_GB">
+ <description>English - GB</description>
+ </element>
+ <element name="RU-RU" internal_name="RU_RU">
+ <description>Russian - Russia</description>
+ </element>
+ <element name="TR-TR" internal_name="TR_TR">
+ <description>Turkish - Turkey</description>
+ </element>
+ <element name="PL-PL" internal_name="PL_PL">
+ <description>Polish - Poland</description>
+ </element>
+ <element name="FR-FR" internal_name="FR_FR">
+ <description>French - France</description>
+ </element>
+ <element name="IT-IT" internal_name="IT_IT">
+ <description>Italian - Italy</description>
+ </element>
+ <element name="SV-SE" internal_name="SV_SE">
+ <description>Swedish - Sweden</description>
+ </element>
+ <element name="PT-PT" internal_name="PT_PT">
+ <description>Portuguese - Portugal</description>
+ </element>
+ <element name="NL-NL" internal_name="NL_NL">
+ <description>Dutch (Standard) - Netherlands</description>
+ </element>
+ <element name="EN-AU" internal_name="EN_AU">
+ <description>English - Australia</description>
+ </element>
+ <element name="ZH-CN" internal_name="ZH_CN">
+ <description>Mandarin - China</description>
+ </element>
+ <element name="ZH-TW" internal_name="ZH_TW">
+ <description>Mandarin - Taiwan</description>
+ </element>
+ <element name="JA-JP" internal_name="JA_JP">
+ <description>Japanese - Japan</description>
+ </element>
+ <element name="AR-SA" internal_name="AR_SA">
+ <description>Arabic - Saudi Arabia</description>
+ </element>
+ <element name="KO-KR" internal_name="KO_KR">
+ <description>Korean - South Korea</description>
+ </element>
+ <element name="PT-BR" internal_name="PT_BR">
+ <description>Portuguese - Brazil</description>
+ </element>
+ <element name="CS-CZ" internal_name="CS_CZ">
+ <description>Czech - Czech Republic</description>
+ </element>
+ <element name="DA-DK" internal_name="DA_DK">
+ <description>Danish - Denmark</description>
+ </element>
+ <element name="NO-NO" internal_name="NO_NO">
+ <description>Norwegian - Norway</description>
+ </element>
+ <element name="NL-BE" internal_name="NL_BE">
+ <description>Dutch (Flemish) - Belgium</description>
+ </element>
+ <element name="EL-GR" internal_name="EL_GR">
+ <description>Greek - Greece</description>
+ </element>
+ <element name="HU-HU" internal_name="HU_HU">
+ <description>Hungarian - Hungary</description>
+ </element>
+ <element name="FI-FI" internal_name="FI_FI">
+ <description>Finnish - Finland</description>
+ </element>
+ <element name="SK-SK" internal_name="SK_SK">
+ <description>Slovak - Slovakia</description>
+ </element>
+ <element name="EN-IN" internal_name="EN_IN">
+ <description>English - India</description>
+ </element>
+ <element name="TH-TH" internal_name="TH_TH">
+ <description>Thai - Thailand</description>
+ </element>
+ <element name="EN-SA" internal_name="EN_SA">
+ <description>English - Middle East</description>
+ </element>
+ <element name="HE-IL" internal_name="HE_IL">
+ <description>Hebrew - Israel</description>
+ </element>
+ <element name="RO-RO" internal_name="RO_RO">
+ <description>Romanian - Romania</description>
+ </element>
+ <element name="UK-UA" internal_name="UK_UA">
+ <description>Ukrainian - Ukraine</description>
+ </element>
+ <element name="ID-ID" internal_name="ID_ID">
+ <description>Indonesian - Indonesia</description>
+ </element>
+ <element name="VI-VN" internal_name="VI_VN">
+ <description>Vietnamese - Vietnam</description>
+ </element>
+ <element name="MS-MY" internal_name="MS_MY">
+ <description>Malay - Malaysia</description>
+ </element>
+ <element name="HI-IN" internal_name="HI_IN">
+ <description>Hindi - India</description>
+ </element>
+ </enum>
+
+ <enum name="UpdateMode">
+ <description>Describes how the media clock timer should behave on the platform</description>
+ <element name="COUNTUP" >
+ <description>Starts the media clock timer counting upwards, as in time elapsed.</description>
+ </element>
+ <element name="COUNTDOWN" >
+ <description>Starts the media clock timer counting downwards, as in time remaining.</description>
+ </element>
+ <element name="PAUSE" >
+ <description>Pauses the media clock timer</description>
+ </element>
+ <element name="RESUME" >
+ <description>Resume the media clock timer</description>
+ </element>
+ <element name="CLEAR" >
+ <description>Clears the media clock timer (previously done through Show->mediaClock)</description>
+ </element>
+ </enum>
+
+ <enum name="TimerMode">
+ <element name="UP" >
+ <description>Causes the media clock timer to update from 0:00 to a specified time</description>
+ </element>
+ <element name="DOWN" >
+ <description>Causes the media clock timer to update from a specified time to 0:00</description>
+ </element>
+ <element name="NONE" >
+ <description>Indicates to not use the media clock timer</description>
+ </element>
+ </enum>
+
+ <enum name="InteractionMode">
+ <description>For application-requested interactions, this mode indicates the method in which the user is notified and uses the interaction.</description>
+ <element name="MANUAL_ONLY" >
+ <description>This mode causes the interaction to only occur on the display, meaning the choices are provided only via the display. No Voice Interaction.</description>
+ </element>
+ <element name="VR_ONLY" >
+ <description>This mode causes the interaction to only occur using the headunits VR system. Selections are made by saying the command.</description>
+ </element>
+ <element name="BOTH" >
+ <description>This mode causes both a VR and display selection option for an interaction. The user will first be asked via Voice Interaction (if available). If this is unsuccessful, the system will switch to manual input.</description>
+ </element>
+ </enum>
+
+ <enum name="LayoutMode">
+ <description>For touchscreen interactions, the mode of how the choices are presented.</description>
+ <element name="ICON_ONLY" >
+ <description>This mode causes the interaction to display the previous set of choices as icons.</description>
+ </element>
+ <element name="ICON_WITH_SEARCH" >
+ <description>This mode causes the interaction to display the previous set of choices as icons along with a search field in the HMI.</description>
+ </element>
+ <element name="LIST_ONLY" >
+ <description>This mode causes the interaction to display the previous set of choices as a list.</description>
+ </element>
+ <element name="LIST_WITH_SEARCH" >
+ <description>This mode causes the interaction to display the previous set of choices as a list along with a search field in the HMI.</description>
+ </element>
+ <element name="KEYBOARD" >
+ <description>This mode causes the interaction to immediately display a keyboard entry through the HMI.</description>
+ </element>
+ </enum>
+
+ <enum name="HMILevel">
+ <description>Enumeration that describes current levels of HMI.</description>
+ <element name="FULL" internal_name="HMI_FULL" />
+ <element name="LIMITED" internal_name="HMI_LIMITED" />
+ <element name="BACKGROUND" internal_name="HMI_BACKGROUND" />
+ <element name="NONE" internal_name="HMI_NONE" />
+ </enum>
+
+ <enum name="AudioStreamingState">
+ <description>Enumeration that describes possible states of audio streaming.</description>
+ <element name="AUDIBLE" />
+ <element name="ATTENUATED" />
+ <element name="NOT_AUDIBLE" />
+ </enum>
+
+ <enum name="SystemAction">
+ <description>Enumeration that describes system actions that can be triggered.</description>
+ <element name="DEFAULT_ACTION">
+ <description>Default action occurs. Standard behavior (e.g. SoftButton clears overlay).</description>
+ </element>
+ <element name="STEAL_FOCUS">
+ <description>App is brought into HMI_FULL.</description>
+ </element>
+ <element name="KEEP_CONTEXT">
+ <description>Current system context is maintained. An overlay is persisted even though a SoftButton has been pressed and the notification sent.</description>
+ </element>
+ </enum>
+
+ <enum name="SystemContext">
+ <description>Enumeration that describes possible contexts an app's HMI might be in. Communicated to whichever app is in HMI FULL, except Alert.</description>
+ <element name="MAIN" internal_name="SYSCTXT_MAIN">
+ <description>The app's persistent display (whether media/non-media/navigation) is fully visible onscreen.</description>
+ </element>
+ <element name="VRSESSION" internal_name="SYSCTXT_VRSESSION">
+ <description>The system is currently in a VR session (with whatever dedicated VR screen being overlaid onscreen).</description>
+ </element>
+ <element name="MENU" internal_name="SYSCTXT_MENU">
+ <description>The system is currently displaying an in-App menu onscreen.</description>
+ </element>
+ <element name="HMI_OBSCURED" internal_name="SYSCTXT_HMI_OBSCURED">
+ <description>The app's display HMI is currently being obscured by either a system or other app's overlay.</description>
+ </element>
+ <element name="ALERT" internal_name="SYSCTXT_ALERT">
+ <description>Broadcast only to whichever app has an alert currently being displayed.</description>
+ </element>
+ </enum>
+
+ <enum name="SoftButtonType">
+ <description>Contains information about the SoftButton capabilities.</description>
+ <element name="TEXT" internal_name="SBT_TEXT"/>
+ <element name="IMAGE" internal_name="SBT_IMAGE"/>
+ <element name="BOTH" internal_name="SBT_BOTH"/>
+ </enum>
+
+ <enum name="AppInterfaceUnregisteredReason">
+ <description>Error code, which comes from the module side.</description>
+ <!-- Deprecate
+ <element name="USER_EXIT" />
+ -->
+ <element name="IGNITION_OFF" />
+ <element name="BLUETOOTH_OFF" />
+ <element name="USB_DISCONNECTED" />
+ <element name="REQUEST_WHILE_IN_NONE_HMI_LEVEL" />
+ <element name="TOO_MANY_REQUESTS" />
+ <element name="DRIVER_DISTRACTION_VIOLATION" />
+ <element name="LANGUAGE_CHANGE" />
+ <element name="MASTER_RESET" />
+ <element name="FACTORY_DEFAULTS" />
+ <element name="APP_UNAUTHORIZED" />
+ <element name="PROTOCOL_VIOLATION" />
+ <element name="UNSUPPORTED_HMI_RESOURCE" />
+ </enum>
+
+ <enum name="TriggerSource">
+ <description>Indicates the source from where the command was triggered.</description>
+ <element name="MENU" internal_name="TS_MENU" />
+ <element name="VR" internal_name="TS_VR" />
+ <element name="KEYBOARD" internal_name="TS_KEYBOARD" />
+ </enum>
+
+ <enum name="HmiZoneCapabilities">
+ <description>Contains information about the HMI zone capabilities.</description>
+ <description>For future use.</description>
+ <element name="FRONT" />
+ <element name="BACK" />
+ </enum>
+
+ <enum name="SpeechCapabilities">
+ <description>Contains information about the TTS capabilities.</description>
+ <element name="TEXT" internal_name="SC_TEXT"/>
+ <element name="SAPI_PHONEMES" />
+ <element name="LHPLUS_PHONEMES" />
+ <element name="PRE_RECORDED" />
+ <element name="SILENCE" />
+ </enum>
+
+ <enum name="VrCapabilities">
+ <description>Contains information about the VR capabilities.</description>
+ <element name="TEXT" internal_name="VR_TEXT"/>
+ </enum>
+
+ <enum name="PrerecordedSpeech">
+ <description>Contains a list of prerecorded speech items present on the platform.</description>
+ <element name="HELP_JINGLE" />
+ <element name="INITIAL_JINGLE" />
+ <element name="LISTEN_JINGLE" />
+ <element name="POSITIVE_JINGLE" />
+ <element name="NEGATIVE_JINGLE" />
+ </enum>
+
+ <enum name="SamplingRate">
+ <description>Describes different sampling options for PerformAudioPassThru.</description>
+ <element name="8KHZ" internal_name="SamplingRate_8KHZ"/>
+ <element name="16KHZ" internal_name="SamplingRate_16KHZ"/>
+ <element name="22KHZ" internal_name="SamplingRate_22KHZ"/>
+ <element name="44KHZ" internal_name="SamplingRate_44KHZ"/>
+ </enum>
+
+ <enum name="BitsPerSample">
+ <description>Describes different quality options for PerformAudioPassThru.</description>
+ <element name="8_BIT" internal_name="BitsPerSample_8_BIT"/>
+ <element name="16_BIT" internal_name="BitsPerSample_16_BIT"/>
+ </enum>
+
+ <enum name="AudioType">
+ <description>Describes different audio type options for PerformAudioPassThru.</description>
+ <element name="PCM" />
+ </enum>
+
+ <struct name="AudioPassThruCapabilities">
+ <description>
+ Describes different audio type configurations for PerformAudioPassThru.
+ e.g. {8kHz,8-bit,PCM}
+ </description>
+ <param name="samplingRate" type="SamplingRate" mandatory="true"/>
+ <param name="bitsPerSample" type="BitsPerSample" mandatory="true"/>
+ <param name="audioType" type="AudioType" mandatory="true"/>
+ </struct>
+
+ <enum name="VehicleDataType">
+ <description>Defines the data types that can be published and subscribed to.</description>
+ <element name="VEHICLEDATA_GPS">
+ <description>Notifies GPSData may be subscribed</description>
+ </element>
+ <element name="VEHICLEDATA_SPEED" />
+ <element name="VEHICLEDATA_RPM" />
+ <element name="VEHICLEDATA_FUELLEVEL" />
+ <element name="VEHICLEDATA_FUELLEVEL_STATE" />
+ <element name="VEHICLEDATA_FUELCONSUMPTION" />
+ <element name="VEHICLEDATA_EXTERNTEMP" />
+ <element name="VEHICLEDATA_VIN" />
+ <element name="VEHICLEDATA_PRNDL" />
+ <element name="VEHICLEDATA_TIREPRESSURE" />
+ <element name="VEHICLEDATA_ODOMETER" />
+ <element name="VEHICLEDATA_BELTSTATUS" />
+ <element name="VEHICLEDATA_BODYINFO" />
+ <element name="VEHICLEDATA_DEVICESTATUS" />
+ <element name="VEHICLEDATA_ECALLINFO" />
+ <element name="VEHICLEDATA_AIRBAGSTATUS" />
+ <element name="VEHICLEDATA_EMERGENCYEVENT" />
+ <element name="VEHICLEDATA_CLUSTERMODESTATUS" />
+ <element name="VEHICLEDATA_MYKEY" />
+ <element name="VEHICLEDATA_BRAKING" />
+ <element name="VEHICLEDATA_WIPERSTATUS" />
+ <element name="VEHICLEDATA_HEADLAMPSTATUS" />
+ <element name="VEHICLEDATA_BATTVOLTAGE" />
+ <element name="VEHICLEDATA_ENGINETORQUE" />
+ <element name="VEHICLEDATA_ACCPEDAL" />
+ <element name="VEHICLEDATA_STEERINGWHEEL" />
+ </enum>
+
+ <enum name="ButtonName">
+ <description>Defines the hard (physical) and soft (touchscreen) buttons available from the module</description>
+ <element name="OK" />
+ <element name="SEEKLEFT" />
+ <element name="SEEKRIGHT" />
+ <element name="TUNEUP" />
+ <element name="TUNEDOWN" />
+ <element name="PRESET_0" />
+ <element name="PRESET_1" />
+ <element name="PRESET_2" />
+ <element name="PRESET_3" />
+ <element name="PRESET_4" />
+ <element name="PRESET_5" />
+ <element name="PRESET_6" />
+ <element name="PRESET_7" />
+ <element name="PRESET_8" />
+ <element name="PRESET_9" />
+ <element name="CUSTOM_BUTTON" />
+ <element name="SEARCH" />
+ <!-- Climate Buttons -->
+ <element name="AC_MAX" />
+ <element name="AC" />
+ <element name="RECIRCULATE" />
+ <element name="FAN_UP" />
+ <element name="FAN_DOWN" />
+ <element name="TEMP_UP" />
+ <element name="TEMP_DOWN" />
+ <element name="DEFROST_MAX" />
+ <element name="DEFROST" />
+ <element name="DEFROST_REAR" />
+ <element name="UPPER_VENT" />
+ <element name="LOWER_VENT" />
+ <!-- Radio Buttons -->
+ <element name="VOLUME_UP" />
+ <element name="VOLUME_DOWN" />
+ <element name="EJECT" />
+ <element name="SOURCE" />
+ <element name="SHUFFLE" />
+ <element name="REPEAT" />
+ </enum>
+
+ <enum name="MediaClockFormat">
+ <element name="CLOCK1">
+ <description>
+ minutesFieldWidth = 2;minutesFieldMax = 19;secondsFieldWidth = 2;secondsFieldMax = 99;maxHours = 19;maxMinutes = 59;maxSeconds = 59;
+ used for Type II and CID headunits
+ </description>
+ </element>
+ <element name="CLOCK2">
+ <description>
+ minutesFieldWidth = 3;minutesFieldMax = 199;secondsFieldWidth = 2;secondsFieldMax = 99;maxHours = 59;maxMinutes = 59;maxSeconds = 59;
+ used for Type V headunit
+ </description>
+ </element>
+ <element name="CLOCK3">
+ <description>
+ minutesFieldWidth = 2;minutesFieldMax = 59;secondsFieldWidth = 2;secondsFieldMax = 59;maxHours = 9;maxMinutes = 59;maxSeconds = 59;
+ used for GEN1.1 MFD3/4/5 headunits
+ </description>
+ </element>
+ <element name="CLOCKTEXT1">
+ <description>
+ 5 characters possible
+ Format: 1|sp c :|sp c c
+ 1|sp : digit "1" or space
+ c : character out of following character set: sp|0-9|[letters, see TypeII column in XLS. See [@TODO: create file ref]]
+ :|sp : colon or space
+ used for Type II headunit
+ </description>
+ </element>
+ <element name="CLOCKTEXT2">
+ <description>
+ 5 chars possible
+ Format: 1|sp c :|sp c c
+ 1|sp : digit "1" or space
+ c : character out of following character set: sp|0-9|[letters, see CID column in XLS. See [@TODO: create file ref]]
+ :|sp : colon or space
+ used for CID headunit
+ NOTE: difference between CLOCKTEXT1 and CLOCKTEXT2 is the supported character set
+ </description>
+ </element>
+ <element name="CLOCKTEXT3">
+ <description>
+ 6 chars possible
+ Format: 1|sp c c :|sp c c
+ 1|sp : digit "1" or space
+ c : character out of following character set: sp|0-9|[letters, see Type 5 column in XLS]. See [@TODO: create file ref]
+ :|sp : colon or space
+ used for Type V headunit
+ </description>
+ </element>
+ <element name="CLOCKTEXT4">
+ <description>
+ 6 chars possible
+ Format: c :|sp c c : c c
+ :|sp : colon or space
+ c : character out of following character set: sp|0-9|[letters].
+ used for GEN1.1 MFD3/4/5 headunits
+ </description>
+ </element>
+ </enum>
+
+ <enum name="DisplayType">
+ <description>See DAES for further infos regarding the displays</description>
+ <element name="CID"/>
+ <element name="TYPE2" />
+ <element name="TYPE5" />
+ <element name="NGN" />
+ <element name="GEN2_8_DMA" />
+ <element name="GEN2_6_DMA" />
+ <element name="MFD3" />
+ <element name="MFD4" />
+ <element name="MFD5" />
+ <element name="GEN3_8-INCH" internal_name="GEN3_8_INCH" />
+ <element name="SDL_GENERIC" />
+ </enum>
+
+ <enum name="TextFieldName">
+ <element name="mainField1">
+ <description>The first line of first set of main fields of the persistent display; applies to "Show"</description>
+ </element>
+
+ <element name="mainField2">
+ <description>The second line of first set of main fields of the persistent display; applies to "Show"</description>
+ </element>
+
+ <element name="mainField3">
+ <description>The first line of second set of main fields of persistent display; applies to "Show"</description>
+ </element>
+
+ <element name="mainField4">
+ <description>The second line of second set of main fields of the persistent display; applies to "Show"</description>
+ </element>
+
+ <element name="statusBar">
+ <description>The status bar on NGN; applies to "Show"</description>
+ </element>
+
+ <element name="mediaClock">
+ <description>Text value for MediaClock field; applies to "Show"</description>
+ </element>
+
+ <element name="mediaTrack">
+ <description>The track field of NGN and GEN1.1 MFD displays. This field is only available for media applications; applies to "Show"</description>
+ </element>
+
+ <element name="alertText1">
+ <description>The first line of the alert text field; applies to "Alert"</description>
+ </element>
+
+ <element name="alertText2">
+ <description>The second line of the alert text field; applies to "Alert"</description>
+ </element>
+
+ <element name="alertText3">
+ <description>The third line of the alert text field; applies to "Alert"</description>
+ </element>
+
+ <element name="scrollableMessageBody">
+ <description>Long form body of text that can include newlines and tabs; applies to "ScrollableMessage"</description>
+ </element>
+
+ <element name="initialInteractionText">
+ <description> First line suggestion for a user response (in the case of VR enabled interaction)</description>
+ </element>
+
+ <element name="navigationText1">
+ <description> First line of navigation text</description>
+ </element>
+
+ <element name="navigationText2">
+ <description> Second line of navigation text</description>
+ </element>
+
+ <element name="ETA">
+ <description> Estimated Time of Arrival time for navigation</description>
+ </element>
+
+ <element name="totalDistance">
+ <description> Total distance to destination for navigation</description>
+ </element>
+
+ <element name="audioPassThruDisplayText1">
+ <description> First line of text for audio pass thru</description>
+ </element>
+
+ <element name="audioPassThruDisplayText2">
+ <description> Second line of text for audio pass thru</description>
+ </element>
+
+ <element name="sliderHeader">
+ <description> Header text for slider</description>
+ </element>
+
+ <element name="sliderFooter">
+ <description> Footer text for slider</description>
+ </element>
+
+ <element name="menuName">
+ <description> Primary text for Choice</description>
+ </element>
+
+ <element name="secondaryText">
+ <description> Secondary text for Choice</description>
+ </element>
+
+ <element name="tertiaryText">
+ <description> Tertiary text for Choice</description>
+ </element>
+
+ <element name="menuTitle">
+ <description> Optional text to label an app menu button (for certain touchscreen platforms).</description>
+ </element>
+
+ <element name="locationName">
+ <description> Optional name / title of intended location for SendLocation.</description>
+ </element>
+
+ <element name="locationDescription">
+ <description> Optional description of intended location / establishment (if applicable) for SendLocation.</description>
+ </element>
+
+ <element name="addressLines">
+ <description> Optional location address (if applicable) for SendLocation.</description>
+ </element>
+
+ <element name="phoneNumber">
+ <description> Optional hone number of intended location / establishment (if applicable) for SendLocation.</description>
+ </element>
+
+ </enum>
+
+ <enum name="ImageFieldName">
+ <element name="softButtonImage">
+ <description>The image field for SoftButton</description>
+ </element>
+
+ <element name="choiceImage">
+ <description>The first image field for Choice</description>
+ </element>
+
+ <element name="choiceSecondaryImage">
+ <description>The secondary image field for Choice</description>
+ </element>
+
+ <element name="vrHelpItem">
+ <description>The image field for vrHelpItem</description>
+ </element>
+
+ <element name="turnIcon">
+ <description>The image field for Turn</description>
+ </element>
+
+ <element name="menuIcon">
+ <description>The image field for the menu icon in SetGlobalProperties</description>
+ </element>
+
+ <element name="cmdIcon">
+ <description>The image field for AddCommand</description>
+ </element>
+
+ <element name="appIcon">
+ <description>The image field for the app icon (set by setAppIcon)</description>
+ </element>
+
+ <element name="graphic">
+ <description>The image field for Show</description>
+ </element>
+
+ <element name="showConstantTBTIcon">
+ <description>The primary image field for ShowConstantTBT</description>
+ </element>
+
+ <element name="showConstantTBTNextTurnIcon">
+ <description>The secondary image field for ShowConstantTBT</description>
+ </element>
+
+ <element name="locationImage">
+ <description>The optional image of a destination / location</description>
+ </element>
+
+ </enum>
+
+ <enum name="CharacterSet">
+ <description>The list of potential character sets</description>
+ <element name="TYPE2SET">
+ <description>See [@TODO: create file ref]</description>
+ </element>
+ <element name="TYPE5SET">
+ <description>See [@TODO: create file ref]</description>
+ </element>
+ <element name="CID1SET">
+ <description>See [@TODO: create file ref]</description>
+ </element>
+ <element name="CID2SET">
+ <description>See [@TODO: create file ref]</description>
+ </element>
+ </enum>
+
+ <enum name="TextAlignment">
+ <description>The list of possible alignments, left, right, or centered</description>
+ <element name="LEFT_ALIGNED" />
+ <element name="RIGHT_ALIGNED" />
+ <element name="CENTERED" />
+ </enum>
+
+ <enum name="TBTState">
+ <description>Enumeration that describes possible states of turn-by-turn client or AppLink app.</description>
+ <element name="ROUTE_UPDATE_REQUEST" />
+ <element name="ROUTE_ACCEPTED" />
+ <element name="ROUTE_REFUSED" />
+ <element name="ROUTE_CANCELLED" />
+ <element name="ETA_REQUEST" />
+ <element name="NEXT_TURN_REQUEST" />
+ <element name="ROUTE_STATUS_REQUEST" />
+ <element name="ROUTE_SUMMARY_REQUEST" />
+ <element name="TRIP_STATUS_REQUEST" />
+ <element name="ROUTE_UPDATE_REQUEST_TIMEOUT" />
+ </enum>
+
+ <enum name="DriverDistractionState">
+ <description>Enumeration that describes possible states of driver distraction.</description>
+ <element name="DD_ON" />
+ <element name="DD_OFF" />
+ </enum>
+
+ <enum name="ImageType">
+ <description>Contains information about the type of image.</description>
+ <element name="STATIC" />
+ <element name="DYNAMIC" />
+ </enum>
+
+ <enum name="DeliveryMode">
+ <description>The mode in which the SendLocation request is sent</description>
+ <element name="PROMPT" />
+ <element name="DESTINATION" />
+ <element name="QUEUE" />
+ </enum>
+
+ <enum name="VideoStreamingProtocol">
+ <description>Enum for each type of video streaming protocol type.</description>
+ <element name="RAW">
+ <description>Raw stream bytes that contains no timestamp data and is the lowest supported video streaming</description>
+ </element>
+ <element name="RTP">
+ <description>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.</description>
+ </element>
+ <element name="RTSP">
+ <description>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. </description>
+ </element>
+ <element name="RTMP">
+ <description> 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.</description>
+ </element>
+ <element name="WEBM">
+ <description>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.</description>
+ </element>
+ </enum>
+
+ <enum name="VideoStreamingCodec">
+ <description>Enum for each type of video streaming codec.</description>
+ <element name="H264">
+ <description>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.</description>
+ </element>
+ <element name="H265">
+ <description>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.</description>
+ </element>
+ <element name="Theora">
+ <description>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.</description>
+ </element>
+ <element name="VP8">
+ <description>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.</description>
+ </element>
+ <element name="VP9">
+ <description>Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video (UHD) and also enables lossless compression.</description>
+ </element>
+ </enum>
+
+ <struct name="Image">
+ <param name="value" minlength="0" maxlength="65535" type="String" mandatory="true">
+ <description>Either the static hex icon value or the binary image file name identifier (sent by PutFile).</description>
+ </param>
+ <param name="imageType" type="ImageType" mandatory="true">
+ <description>Describes, whether it is a static or dynamic image.</description>
+ </param>
+ </struct>
+
+ <struct name="SoftButton">
+ <param name="type" type="SoftButtonType" mandatory="true">
+ <description>Describes, whether it is text, highlighted text, icon, or dynamic image. See softButtonType</description>
+ </param>
+ <param name="text" minlength="0" maxlength="500" type="String" mandatory="false">
+ <description>Optional text to display (if defined as TEXT or BOTH)</description>
+ </param>
+ <param name="image" type="Image" mandatory="false">
+ <description>Optional image struct for SoftButton (if defined as IMAGE or BOTH)</description>
+ </param>
+ <param name="isHighlighted" type="Boolean" defvalue="false" mandatory="false">
+ <description>
+ True, if highlighted
+ False, if not highlighted
+ </description>
+ </param>
+ <param name="softButtonID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Value which is returned via OnButtonPress / OnButtonEvent</description>
+ </param>
+ <param name="systemAction" type="SystemAction" defvalue="DEFAULT_ACTION" mandatory="false">
+ <description>Parameter indicating whether selecting a SoftButton shall call a specific system action. This is intended to allow Notifications to bring the callee into full / focus; or in the case of persistent overlays, the overlay can persist when a SoftButton is pressed.</description>
+ </param>
+ </struct>
+
+ <struct name="Choice">
+ <description>A choice is an option given to the user, which can be selected either by menu, or through voice recognition system.</description>
+ <param name="choiceID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true"/>
+ <param name="menuName" type="String" maxlength="500" mandatory="true"/>
+ <param name="vrCommands" type="String" minsize="1" maxsize="100" maxlength="99" array="true" mandatory="true"/>
+ <param name="image" type="Image" mandatory="false"/>
+ <param name="secondaryText" maxlength="500" type="String" mandatory="false">
+ <description>Optional secondary text to display; e.g. address of POI in a search result entry</description>
+ </param>
+ <param name="tertiaryText" maxlength="500" type="String" mandatory="false">
+ <description>Optional tertiary text to display; e.g. distance to POI for a search result entry</description>
+ </param>
+ <param name="secondaryImage" type="Image" mandatory="false">
+ <description>Optional secondary image struct for choice</description>
+ </param>
+ </struct>
+
+ <struct name="VrHelpItem">
+ <param name="text" maxlength="500" type="String" mandatory="true">
+ <description>Text to display for VR Help item</description>
+ </param>
+ <param name="image" type="Image" mandatory="false">
+ <description>Image struct for VR Help item</description>
+ </param>
+ <param name="position" type="Integer" minvalue="1" maxvalue="100" mandatory="true">
+ <description>Position to display item in VR Help list</description>
+ </param>
+ </struct>
+
+ <struct name="SyncMsgVersion">
+ <description>Specifies the version number of the SmartDeviceLink protocol that is supported by the mobile application</description>
+
+ <param name="majorVersion" type="Integer" minvalue="1" maxvalue="10" mandatory="true">
+ <description>The major version indicates versions that is not-compatible to previous versions.</description>
+ </param>
+ <param name="minorVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="true">
+ <description>The minor version indicates a change to a previous version that should still allow to be run on an older version (with limited functionality)</description>
+ </param>
+ <param name="patchVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
+ <description>The patch version indicates a fix to existing functionality in a previous version that should still be able to be run on an older version </description>
+ </param>
+ </struct>
+
+ <enum name="GlobalProperty">
+ <description>The different global properties.</description>
+ <element name="HELPPROMPT">
+ <description>The property helpPrompt of setGlobalProperties</description>
+ </element>
+ <element name="TIMEOUTPROMPT">
+ <description>The property timeoutPrompt of setGlobalProperties</description>
+ </element>
+ <element name="VRHELPTITLE">
+ <description>The property vrHelpTitle of setGlobalProperties</description>
+ </element>
+ <element name="VRHELPITEMS">
+ <description>The property array of vrHelp of setGlobalProperties</description>
+ </element>
+ <element name="MENUNAME">
+ <description>The property in-app menu name of setGlobalProperties</description>
+ </element>
+ <element name="MENUICON">
+ <description>The property in-app menu icon of setGlobalProperties</description>
+ </element>
+ <element name="KEYBOARDPROPERTIES">
+ <description>The on-screen keyboard configuration of setGlobalProperties</description>
+ </element>
+ </enum>
+
+ <enum name="CompassDirection">
+ <description>The list of potential compass directions</description>
+ <element name="NORTH">
+ </element>
+ <element name="NORTHWEST">
+ </element>
+ <element name="WEST">
+ </element>
+ <element name="SOUTHWEST">
+ </element>
+ <element name="SOUTH">
+ </element>
+ <element name="SOUTHEAST">
+ </element>
+ <element name="EAST">
+ </element>
+ <element name="NORTHEAST">
+ </element>
+ </enum>
+
+ <enum name="Dimension">
+ <description>The supported dimensions of the GPS</description>
+ <element name="NO_FIX" internal_name="Dimension_NO_FIX">
+ <description>No GPS at all</description>
+ </element>
+ <element name="2D" internal_name="Dimension_2D">
+ <description>Longitude and latitude</description>
+ </element>
+ <element name="3D" internal_name="Dimension_3D">
+ <description>Longitude and latitude and altitude</description>
+ </element>
+ </enum>
+
+ <enum name="PRNDL">
+ <description>The selected gear.</description>
+ <element name="PARK">
+ <description>Parking</description>
+ </element>
+ <element name="REVERSE">
+ <description>Reverse gear</description>
+ </element>
+ <element name="NEUTRAL">
+ <description>No gear</description>
+ </element>
+ <element name="DRIVE">
+ </element>
+ <element name="SPORT">
+ <description>Drive Sport mode</description>
+ </element>
+ <element name="LOWGEAR">
+ <description>1st gear hold</description>
+ </element>
+ <element name="FIRST">
+ </element>
+ <element name="SECOND">
+ </element>
+ <element name="THIRD">
+ </element>
+ <element name="FOURTH">
+ </element>
+ <element name="FIFTH">
+ </element>
+ <element name="SIXTH">
+ </element>
+ <element name="SEVENTH">
+ </element>
+ <element name="EIGHTH">
+ </element>
+ <element name="UNKNOWN">
+ </element>
+ <element name="FAULT">
+ </element>
+ </enum>
+
+ <enum name="ComponentVolumeStatus">
+ <description>The volume status of a vehicle component.</description>
+ <element name="UNKNOWN" internal_name="CVS_UNKNOWN">
+ </element>
+ <element name="NORMAL" internal_name="CVS_NORMAL">
+ </element>
+ <element name="LOW" internal_name="CVS_LOW">
+ </element>
+ <element name="FAULT" internal_name="CVS_FAULT">
+ </element>
+ <element name="ALERT" internal_name="CVS_ALERT">
+ </element>
+ <element name="NOT_SUPPORTED" internal_name="CVS_NOT_SUPPORTED">
+ </element>
+ </enum>
+
+ <struct name="SingleTireStatus">
+ <param name="status" type="ComponentVolumeStatus" mandatory="true">
+ <description>See ComponentVolumeStatus.</description>
+ </param>
+ </struct>
+
+ <enum name="WarningLightStatus">
+ <description>Reflects the status of a cluster instrument warning light.</description>
+ <element name="OFF" internal_name="WLS_OFF">
+ </element>
+ <element name="ON" internal_name="WLS_ON">
+ </element>
+ <element name="FLASH" internal_name="WLS_FLASH">
+ </element>
+ <element name="NOT_USED" internal_name="WLS_NOT_USED">
+ </element>
+ </enum>
+
+ <enum name="VehicleDataNotificationStatus">
+ <description>Reflects the status of a vehicle data notification.</description>
+ <element name="NOT_SUPPORTED" internal_name="VDNS_NOT_SUPPORTED">
+ </element>
+ <element name="NORMAL" internal_name="VDNS_NORMAL">
+ </element>
+ <element name="ACTIVE" internal_name="VDNS_ACTIVE">
+ </element>
+ <element name="NOT_USED" internal_name="VDNS_NOT_USED">
+ </element>
+ </enum>
+
+ <enum name="IgnitionStableStatus">
+ <description>Reflects the ignition switch stability.</description>
+ <element name="IGNITION_SWITCH_NOT_STABLE">
+ </element>
+ <element name="IGNITION_SWITCH_STABLE">
+ </element>
+ <element name="MISSING_FROM_TRANSMITTER">
+ </element>
+ </enum>
+
+ <enum name="IgnitionStatus">
+ <description>Reflects the status of ignition.</description>
+ <element name="UNKNOWN" internal_name="IS_UNKNOWN">
+ </element>
+ <element name="OFF" internal_name="IS_OFF">
+ </element>
+ <element name="ACCESSORY" internal_name="IS_ACCESSORY">
+ </element>
+ <element name="RUN" internal_name="IS_RUN">
+ </element>
+ <element name="START" internal_name="IS_START">
+ </element>
+ <element name="INVALID" internal_name="IS_INVALID">
+ </element>
+ </enum>
+
+ <enum name="VehicleDataEventStatus">
+ <description>Reflects the status of a vehicle data event; e.g. a seat belt event status.</description>
+ <element name="NO_EVENT" internal_name="VDES_NO_EVENT">
+ </element>
+ <element name="NO" internal_name="VDES_NO">
+ </element>
+ <element name="YES" internal_name="VDES_YES">
+ </element>
+ <element name="NOT_SUPPORTED" internal_name="VDES_NOT_SUPPORTED">
+ </element>
+ <element name="FAULT" internal_name="VDES_FAULT">
+ </element>
+ </enum>
+
+ <enum name="DeviceLevelStatus">
+ <description>Reflects the reported battery status of the connected device, if reported.</description>
+ <element name="ZERO_LEVEL_BARS">
+ </element>
+ <element name="ONE_LEVEL_BARS">
+ </element>
+ <element name="TWO_LEVEL_BARS">
+ </element>
+ <element name="THREE_LEVEL_BARS">
+ </element>
+ <element name="FOUR_LEVEL_BARS">
+ </element>
+ <element name="NOT_PROVIDED">
+ </element>
+ </enum>
+
+ <enum name="PrimaryAudioSource">
+ <description>Reflects the current primary audio source (if selected).</description>
+ <element name="NO_SOURCE_SELECTED">
+ </element>
+ <element name="USB">
+ </element>
+ <element name="USB2">
+ </element>
+ <element name="BLUETOOTH_STEREO_BTST">
+ </element>
+ <element name="LINE_IN">
+ </element>
+ <element name="IPOD">
+ </element>
+ <element name="MOBILE_APP">
+ </element>
+ </enum>
+
+ <enum name="WiperStatus">
+ <description>Reflects the status of the wipers.</description>
+ <element name="OFF" />
+ <element name="AUTO_OFF" />
+ <element name="OFF_MOVING" />
+ <element name="MAN_INT_OFF" />
+ <element name="MAN_INT_ON" />
+ <element name="MAN_LOW" />
+ <element name="MAN_HIGH" />
+ <element name="MAN_FLICK" />
+ <element name="WASH" />
+ <element name="AUTO_LOW" />
+ <element name="AUTO_HIGH" />
+ <element name="COURTESYWIPE" />
+ <element name="AUTO_ADJUST" />
+ <element name="STALLED" />
+ <element name="NO_DATA_EXISTS" />
+ </enum>
+
+ <enum name="VehicleDataStatus">
+ <description>Reflects the status of a binary vehicle data item.</description>
+ <element name="NO_DATA_EXISTS" internal_name="VDS_NO_DATA_EXISTS">
+ </element>
+ <element name="OFF" internal_name="VDS_OFF">
+ </element>
+ <element name="ON" internal_name="VDS_ON">
+ </element>
+ </enum>
+
+ <enum name="MaintenanceModeStatus">
+ <description>Reflects the status of a vehicle maintenance mode.</description>
+ <element name="NORMAL" internal_name="MMS_NORMAL">
+ </element>
+ <element name="NEAR" internal_name="MMS_NEAR">
+ </element>
+ <element name="ACTIVE" internal_name="MMS_ACTIVE">
+ </element>
+ <element name="FEATURE_NOT_PRESENT" internal_name="MMS_FEATURE_NOT_PRESENT">
+ </element>
+ </enum>
+
+ <enum name="VehicleDataActiveStatus">
+ <description>Reflects the status of given vehicle component.</description>
+ <element name="INACTIVE_NOT_CONFIRMED" internal_name="VDAS_INACTIVE_NOT_CONFIRMED">
+ </element>
+ <element name="INACTIVE_CONFIRMED" internal_name="VDAS_INACTIVE_CONFIRMED">
+ </element>
+ <element name="ACTIVE_NOT_CONFIRMED" internal_name="VDAS_ACTIVE_NOT_CONFIRMED">
+ </element>
+ <element name="ACTIVE_CONFIRMED" internal_name="VDAS_ACTIVE_CONFIRMED">
+ </element>
+ <element name="FAULT" internal_name="VDAS_FAULT">
+ </element>
+ </enum>
+
+ <enum name="AmbientLightStatus">
+ <description>Reflects the status of the ambient light sensor.</description>
+ <element name="NIGHT" />
+ <element name="TWILIGHT_1" />
+ <element name="TWILIGHT_2" />
+ <element name="TWILIGHT_3" />
+ <element name="TWILIGHT_4" />
+ <element name="DAY" />
+ <element name="UNKNOWN" internal_name="ALS_UNKNOWN" />
+ <element name="INVALID" />
+ </enum>
+
+ <enum name="ModuleType">
+ <element name="CLIMATE"/>
+ <element name="RADIO"/>
+ </enum>
+
+ <enum name="DefrostZone">
+ <element name="FRONT"/>
+ <element name="REAR"/>
+ <element name="ALL"/>
+ <element name="NONE"/>
+ </enum>
+
+ <enum name="VentilationMode">
+ <element name="UPPER"/>
+ <element name="LOWER"/>
+ <element name="BOTH"/>
+ <element name="NONE"/>
+ </enum>
+
+ <enum name="RadioBand">
+ <element name="AM"/>
+ <element name="FM"/>
+ <element name="XM"/>
+ </enum>
+
+ <enum name="RadioState">
+ <element name="ACQUIRING"/>
+ <element name="ACQUIRED"/>
+ <element name="MULTICAST"/>
+ <element name="NOT_FOUND"/>
+ </enum>
+
+ <enum name="TemperatureUnit">
+ <element name="FAHRENHEIT"/>
+ <element name="CELSIUS"/>
+ </enum>
+
+ <struct name="BeltStatus">
+ <param name="driverBeltDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsDrvBelt_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerBeltDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsPasBelt_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerBuckleBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw1PasBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="driverBuckleBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw1DrvBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="leftRow2BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw2lBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerChildDetected" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw1PasChld_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="rightRow2BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw2rBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="middleRow2BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw2mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="middleRow3BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw3mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="leftRow3BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw3lBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="rightRow3BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw3rBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="leftRearInflatableBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw2lRib_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="rightRearInflatableBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw2rRib_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="middleRow1BeltDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw1mBelt_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="middleRow1BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsRw1mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ </struct>
+
+ <struct name="BodyInformation">
+ <param name="parkBrakeActive" type="Boolean" mandatory="true">
+ <description>References signal "PrkBrkActv_B_Actl".</description>
+ </param>
+ <param name="ignitionStableStatus" type="IgnitionStableStatus" mandatory="true">
+ <description>References signal "Ignition_Switch_Stable". See IgnitionStableStatus.</description>
+ </param>
+ <param name="ignitionStatus" type="IgnitionStatus" mandatory="true">
+ <description>References signal "Ignition_status". See IgnitionStatus.</description>
+ </param>
+ <param name="driverDoorAjar" type="Boolean" mandatory="false">
+ <description>References signal "DrStatDrv_B_Actl".</description>
+ </param>
+ <param name="passengerDoorAjar" type="Boolean" mandatory="false">
+ <description>References signal "DrStatPsngr_B_Actl".</description>
+ </param>
+ <param name="rearLeftDoorAjar" type="Boolean" mandatory="false">
+ <description>References signal "DrStatRl_B_Actl".</description>
+ </param>
+ <param name="rearRightDoorAjar" type="Boolean" mandatory="false">
+ <description>References signal "DrStatRr_B_Actl".</description>
+ </param>
+ </struct>
+
+ <struct name="DeviceStatus">
+ <param name="voiceRecOn" type="Boolean" mandatory="true">
+ <description>References signal "CPM_VoiceRec_STAT".</description>
+ </param>
+ <param name="btIconOn" type="Boolean" mandatory="true">
+ <description>References signal "BT_ICON".</description>
+ </param>
+ <param name="callActive" type="Boolean" mandatory="true">
+ <description>References signal "CPM_Call_Active_STAT".</description>
+ </param>
+ <param name="phoneRoaming" type="Boolean" mandatory="true">
+ <description>References signal "CPM_Phone_Roaming_STAT".</description>
+ </param>
+ <param name="textMsgAvailable" type="Boolean" mandatory="true">
+ <description>References signal "CPM_TextMsg_AVAL".</description>
+ </param>
+ <param name="battLevelStatus" type="DeviceLevelStatus" mandatory="true">
+ <description>Device battery level status. References signal "CPM_Batt_Level_STAT". See DeviceLevelStatus.</description>
+ </param>
+ <param name="stereoAudioOutputMuted" type="Boolean" mandatory="true">
+ <description>References signal "CPM_Stereo_Audio_Output".</description>
+ </param>
+ <param name="monoAudioOutputMuted" type="Boolean" mandatory="true">
+ <description>References signal "CPM_Mono_Audio_Output".</description>
+ </param>
+ <param name="signalLevelStatus" type="DeviceLevelStatus" mandatory="true">
+ <description>Device signal level status. References signal "CPM_Signal_Strength_STAT". See DeviceLevelStatus.</description>
+ </param>
+ <param name="primaryAudioSource" type="PrimaryAudioSource" mandatory="true">
+ <description>References signal "CPM_Stereo_PAS_Source". See PrimaryAudioSource.</description>
+ </param>
+ <param name="eCallEventActive" type="Boolean" mandatory="true">
+ <description>References signal "eCall_Event".</description>
+ </param>
+ </struct>
+
+ <struct name="HeadLampStatus">
+ <param name="lowBeamsOn" type="Boolean" mandatory="true">
+ <description>Status of the low beam lamps. References signal "HeadLampLoActv_B_Stat".</description>
+ </param>
+ <param name="highBeamsOn" type="Boolean" mandatory="true">
+ <description>Status of the high beam lamps. References signal "HeadLghtHiOn_B_Stat".</description>
+ </param>
+ <param name="ambientLightSensorStatus" type="AmbientLightStatus" mandatory="false">
+ <description>Status of the ambient light sensor.</description>
+ </param>
+ </struct>
+
+ <struct name="AppInfo">
+ <description>Contains detailed information about the registered application.</description>
+
+ <param name="appDisplayName" type="String" maxlength="100" mandatory="true">
+ <description>The name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request).</description>
+ </param>
+
+ <param name="appBundleID" type="String" maxlength="256" mandatory="true">
+ <description>The AppBundleID of an iOS application or package name of the Android application. This supports App Launch strategies for each platform.</description>
+ </param>
+
+ <param name="appVersion" type="String" maxlength="256" mandatory="true">
+ <description>Represents the build version number of this particular mobile app.</description>
+ </param>
+
+ <param name="appIcon" type="String" maxlength="500" mandatory="false">
+ <description>A file reference to the icon utilized by this app (simplifies the process of setting an app icon during app registration).</description>
+ </param>
+ </struct>
+
+ <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <!-- Ford Specific Data Items -->
+ <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <enum name="FileType">
+ <description>Enumeration listing possible file types.</description>
+ <element name="GRAPHIC_BMP" />
+ <element name="GRAPHIC_JPEG" />
+ <element name="GRAPHIC_PNG" />
+ <element name="AUDIO_WAVE" />
+ <element name="AUDIO_MP3" />
+ <element name="AUDIO_AAC" />
+ <element name="BINARY" />
+ <element name="JSON" />
+ </enum>
+
+ <enum name="FuelCutoffStatus" >
+ <description>Reflects the status of the RCM fuel cutoff.</description>
+ <element name="TERMINATE_FUEL" internal_name="FCS_TERMINATE_FUEL">
+ </element>
+ <element name="NORMAL_OPERATION" internal_name="FCS_NORMAL_OPERATION">
+ </element>
+ <element name="FAULT" internal_name="FCS_FAULT">
+ </element>
+ </enum>
+
+ <enum name="EmergencyEventType">
+ <description>Reflects the emergency event status of the vehicle.</description>
+ <element name="NO_EVENT" internal_name="EET_NO_EVENT">
+ </element>
+ <element name="FRONTAL" internal_name="EET_FRONTAL">
+ </element>
+ <element name="SIDE" internal_name="EET_SIDE">
+ </element>
+ <element name="REAR" internal_name="EET_REAR">
+ </element>
+ <element name="ROLLOVER" internal_name="EET_ROLLOVER">
+ </element>
+ <element name="NOT_SUPPORTED" internal_name="EET_NOT_SUPPORTED">
+ </element>
+ <element name="FAULT" internal_name="EET_FAULT">
+ </element>
+ </enum>
+
+ <enum name="ECallConfirmationStatus">
+ <description>Reflects the status of the eCall Notification.</description>
+ <element name="NORMAL" internal_name="ECCS_NORMAL">
+ </element>
+ <element name="CALL_IN_PROGRESS" internal_name="ECCS_CALL_IN_PROGRESS">
+ </element>
+ <element name="CALL_CANCELLED" internal_name="ECCS_CALL_CANCELLED">
+ </element>
+ <element name="CALL_COMPLETED">
+ </element>
+ <element name="CALL_UNSUCCESSFUL" internal_name="ECCS_CALL_UNSUCCESSFUL">
+ </element>
+ <element name="ECALL_CONFIGURED_OFF" internal_name="ECCS_ECALL_CONFIGURED_OFF">
+ </element>
+ <element name="CALL_COMPLETE_DTMF_TIMEOUT" internal_name="ECCS_CALL_COMPLETE_DTMF_TIMEOUT">
+ </element>
+ </enum>
+
+ <enum name="PowerModeQualificationStatus" >
+ <description>Reflects the status of the current power mode qualification.</description>
+ <element name="POWER_MODE_UNDEFINED">
+ </element>
+ <element name="POWER_MODE_EVALUATION_IN_PROGRESS">
+ </element>
+ <element name="NOT_DEFINED">
+ </element>
+ <element name="POWER_MODE_OK">
+ </element>
+ </enum>
+
+ <enum name="PowerModeStatus">
+ <description>Reflects the status of the current power mode.</description>
+ <element name="KEY_OUT">
+ </element>
+ <element name="KEY_RECENTLY_OUT">
+ </element>
+ <element name="KEY_APPROVED_0">
+ </element>
+ <element name="POST_ACCESORY_0">
+ </element>
+ <element name="ACCESORY_1">
+ </element>
+ <element name="POST_IGNITION_1">
+ </element>
+ <element name="IGNITION_ON_2">
+ </element>
+ <element name="RUNNING_2">
+ </element>
+ <element name="CRANK_3">
+ </element>
+ </enum>
+
+ <enum name="CarModeStatus">
+ <description>Reflects the status of the current car mode.</description>
+ <element name="NORMAL" internal_name="CMS_NORMAL">
+ </element>
+ <element name="FACTORY" internal_name="CMS_FACTORY">
+ </element>
+ <element name="TRANSPORT" internal_name="CMS_TRANSPORT">
+ </element>
+ <element name="CRASH" internal_name="CMS_CRASH">
+ </element>
+ </enum>
+
+ <struct name="ECallInfo">
+ <param name="eCallNotificationStatus" type="VehicleDataNotificationStatus" mandatory="true">
+ <description>References signal "eCallNotification_4A". See VehicleDataNotificationStatus.</description>
+ </param>
+ <param name="auxECallNotificationStatus" type="VehicleDataNotificationStatus" mandatory="true">
+ <description>References signal "eCallNotification". See VehicleDataNotificationStatus.</description>
+ </param>
+ <param name="eCallConfirmationStatus" type="ECallConfirmationStatus" mandatory="true">
+ <description>References signal "eCallConfirmation". See ECallConfirmationStatus.</description>
+ </param>
+ </struct>
+
+ <struct name="AirbagStatus">
+ <param name="driverAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsDrvBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="driverSideAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsDrvSideBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="driverCurtainAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsDrvCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsPasBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerCurtainAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsPasCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="driverKneeAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsKneeDrvBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerSideAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsPasSideBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerKneeAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsKneePasBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ </struct>
+
+ <struct name="EmergencyEvent">
+ <param name="emergencyEventType" type="EmergencyEventType" mandatory="true">
+ <description>References signal "VedsEvntType_D_Ltchd". See EmergencyEventType.</description>
+ </param>
+ <param name="fuelCutoffStatus" type="FuelCutoffStatus" mandatory="true">
+ <description>References signal "RCM_FuelCutoff". See FuelCutoffStatus.</description>
+ </param>
+ <param name="rolloverEvent" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsEvntRoll_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+
+ <param name="maximumChangeVelocity" type="Integer" minvalue="0" maxvalue="255" mandatory="true">
+ <description>References signal "VedsMaxDeltaV_D_Ltchd". Change in velocity in KPH. Additional reserved values:
+ 0x00 No event
+ 0xFE Not supported
+ 0xFF Fault
+ </description>
+ </param>
+ <param name="multipleEvents" type="VehicleDataEventStatus" mandatory="true">
+ <description>References signal "VedsMultiEvnt_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ </struct>
+
+ <struct name="ClusterModeStatus">
+ <param name="powerModeActive" type="Boolean" mandatory="true">
+ <description>References signal "PowerMode_UB".</description>
+ </param>
+ <param name="powerModeQualificationStatus" type="PowerModeQualificationStatus" mandatory="true">
+ <description>References signal "PowerModeQF". See PowerModeQualificationStatus.</description>
+ </param>
+ <param name="carModeStatus" type="CarModeStatus" mandatory="true">
+ <description>References signal "CarMode". See CarMode.</description>
+ </param>
+ <param name="powerModeStatus" type="PowerModeStatus" mandatory="true">
+ <description>References signal "PowerMode". See PowerMode.</description>
+ </param>
+ </struct>
+
+ <struct name="MyKey">
+ <param name="e911Override" type="VehicleDataStatus" mandatory="true">
+ <description>Indicates whether e911 override is on. References signal "MyKey_e911Override_St". See VehicleDataStatus.</description>
+ </param>
+ </struct>
+
+ <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <!-- / Ford Specific Data Items -->
+ <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <enum name="VehicleDataResultCode">
+ <description>Enumeration that describes possible result codes of a vehicle data entry request.</description>
+ <element name="SUCCESS" internal_name="VDRC_SUCCESS">
+ <description>Individual vehicle data item / DTC / DID request or subscription successful</description>
+ </element>
+ <element name="TRUNCATED_DATA" internal_name="VDRC_TRUNCATED_DATA">
+ <description>DTC / DID request successful, however, not all active DTCs or full contents of DID location available</description>
+ </element>
+ <element name="DISALLOWED" internal_name="VDRC_DISALLOWED">
+ <description>This vehicle data item is not allowed for this app by Ford.</description>
+ </element>
+ <element name="USER_DISALLOWED" internal_name="VDRC_USER_DISALLOWED">
+ <description>The user has not granted access to this type of vehicle data item at this time.</description>
+ </element>
+ <element name="INVALID_ID" internal_name="VDRC_INVALID_ID">
+ <description>The ECU ID referenced is not a valid ID on the bus / system.</description>
+ </element>
+ <element name="VEHICLE_DATA_NOT_AVAILABLE" internal_name="VDRC_DATA_NOT_AVAILABLE">
+ <description>The requested vehicle data item / DTC / DID is not currently available or responding on the bus / system.</description>
+ </element>
+ <element name="DATA_ALREADY_SUBSCRIBED" internal_name="VDRC_DATA_ALREADY_SUBSCRIBED">
+ <description>The vehicle data item is already subscribed.</description>
+ </element>
+ <element name="DATA_NOT_SUBSCRIBED" internal_name="VDRC_DATA_NOT_SUBSCRIBED">
+ <description>The vehicle data item cannot be unsubscribed because it is not currently subscribed.</description>
+ </element>
+ <element name="IGNORED" internal_name="VDRC_IGNORED">
+ <description>The request for this item is ignored because it is already in progress.</description>
+ </element>
+ </enum>
+
+ <struct name="TireStatus">
+ <description>The status and pressure of the tires.</description>
+
+ <param name="pressureTelltale" type="WarningLightStatus" mandatory="true">
+ <description>Status of the Tire Pressure Telltale. See WarningLightStatus.</description>
+ </param>
+ <param name="leftFront" type="SingleTireStatus" mandatory="true">
+ <description>The status of the left front tire.</description>
+ </param>
+ <param name="rightFront" type="SingleTireStatus" mandatory="true">
+ <description>The status of the right front tire.</description>
+ </param>
+ <param name="leftRear" type="SingleTireStatus" mandatory="true">
+ <description>The status of the left rear tire.</description>
+ </param>
+ <param name="rightRear" type="SingleTireStatus" mandatory="true">
+ <description>The status of the right rear tire.</description>
+ </param>
+ <param name="innerLeftRear" type="SingleTireStatus" mandatory="true">
+ <description>The status of the inner left rear.</description>
+ </param>
+ <param name="innerRightRear" type="SingleTireStatus" mandatory="true">
+ <description>The status of the inner right rear.</description>
+ </param>
+ </struct>
+
+ <struct name="GPSData">
+ <description>Struct with the GPS data.</description>
+ <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="true">
+ </param>
+ <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="true">
+ </param>
+ <param name="utcYear" type="Integer" minvalue="2010" maxvalue="2100" mandatory="true">
+ <description>The current UTC year.</description>
+ </param>
+ <param name="utcMonth" type="Integer" minvalue="1" maxvalue="12" mandatory="true">
+ <description>The current UTC month.</description>
+ </param>
+ <param name="utcDay" type="Integer" minvalue="1" maxvalue="31" mandatory="true">
+ <description>The current UTC day.</description>
+ </param>
+ <param name="utcHours" type="Integer" minvalue="0" maxvalue="23" mandatory="true">
+ <description>The current UTC hour.</description>
+ </param>
+ <param name="utcMinutes" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
+ <description>The current UTC minute.</description>
+ </param>
+ <param name="utcSeconds" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
+ <description>The current UTC second.</description>
+ </param>
+ <param name="compassDirection" type="CompassDirection" mandatory="true">
+ <description>See CompassDirection.</description>
+ </param>
+ <param name="pdop" type="Float" minvalue="0" maxvalue="10" defvalue="0" mandatory="true">
+ <description>PDOP. If undefined or unavailable, then value shall be set to 0.</description>
+ </param>
+ <param name="hdop" type="Float" minvalue="0" maxvalue="10" defvalue="0" mandatory="true">
+ <description>HDOP. If value is unknown, value shall be set to 0.</description>
+ </param>
+ <param name="vdop" type="Float" minvalue="0" maxvalue="10" defvalue="0" mandatory="true">
+ <description>VDOP. If value is unknown, value shall be set to 0.</description>
+ </param>
+ <param name="actual" type="Boolean" mandatory="true">
+ <description>
+ True, if actual.
+ False, if inferred.
+ </description>
+ </param>
+ <param name="satellites" type="Integer" minvalue="0" maxvalue="31" mandatory="true">
+ <description>Number of satellites in view</description>
+ </param>
+ <param name="dimension" type="Dimension" mandatory="true">
+ <description>See Dimension</description>
+ </param>
+ <param name="altitude" type="Float" minvalue="-10000" maxvalue="10000" mandatory="true">
+ <description>Altitude in meters</description>
+ </param>
+ <param name="heading" type="Float" minvalue="0" maxvalue="359.99" mandatory="true">
+ <description>The heading. North is 0. Resolution is 0.01</description>
+ </param>
+ <param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="true">
+ <description>The speed in KPH</description>
+ </param>
+ </struct>
+
+ <struct name="VehicleDataResult">
+ <description>Individual published data request result</description>
+ <param name="dataType" type="VehicleDataType" mandatory="true">
+ <description>Defined published data element type.</description>
+ </param>
+ <param name="resultCode" type="VehicleDataResultCode" mandatory="true">
+ <description>Published data result code.</description>
+ </param>
+ </struct>
+
+ <struct name="DIDResult">
+ <description>Individual requested DID result and data</description>
+ <param name="resultCode" type="VehicleDataResultCode" mandatory="true">
+ <description>Individual DID result code.</description>
+ </param>
+ <param name="didLocation" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Location of raw data from vehicle data DID</description>
+ </param>
+ <param name="data" type="String" maxlength="5000" mandatory="false">
+ <description>Raw DID-based data returned for requested element.</description>
+ </param>
+ </struct>
+
+ <struct name="StartTime">
+ <param name="hours" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
+ <description>
+ The hour of the media clock.
+ Some radios only support a max of 19 hours. If out of range, it will be rejected.
+ </description>
+ </param>
+ <param name="minutes" type="Integer" minvalue="0" maxvalue="59" mandatory="true"/>
+ <param name="seconds" type="Integer" minvalue="0" maxvalue="59" mandatory="true"/>
+ </struct>
+
+ <struct name="TextField">
+ <param name="name" type="TextFieldName" mandatory="true">
+ <description>The name that identifies the field. See TextFieldName.</description>
+ </param>
+ <param name="characterSet" type="CharacterSet" mandatory="true">
+ <description>The character set that is supported in this field. See CharacterSet.</description>
+ </param>
+ <param name="width" type="Integer" minvalue="1" maxvalue="500" mandatory="true">
+ <description>The number of characters in one row of this field.</description>
+ </param>
+ <param name="rows" type="Integer" minvalue="1" maxvalue="8" mandatory="true">
+ <description>The number of rows of this field.</description>
+ </param>
+ </struct>
+
+ <struct name="ImageResolution">
+ <param name="resolutionWidth" type="Integer" minvalue="1" maxvalue="10000" mandatory="true">
+ <description>The image resolution width.</description>
+ </param>
+ <param name="resolutionHeight" type="Integer" minvalue="1" maxvalue="10000" mandatory="true">
+ <description>The image resolution height.</description>
+ </param>
+ </struct>
+
+ <struct name="ImageField">
+ <param name="name" type="ImageFieldName" mandatory="true">
+ <description>The name that identifies the field. See ImageFieldName.</description>
+ </param>
+ <param name="imageTypeSupported" type="FileType" minsize="1" maxsize="100" array="true" mandatory="true">
+ <description>The image types that are supported in this field. See FileType.</description>
+ </param>
+ <param name="imageResolution" type="ImageResolution" mandatory="false">
+ <description>The image resolution of this field.</description>
+ </param>
+ </struct>
+
+ <struct name="TouchCoord">
+ <param name="x" type="Integer" mandatory="true" minvalue="0" maxvalue="10000">
+ <description>The x coordinate of the touch.</description>
+ </param>
+ <param name="y" type="Integer" mandatory="true" minvalue="0" maxvalue="10000">
+ <description>The y coordinate of the touch.</description>
+ </param>
+ </struct>
+
+ <enum name="TouchType">
+ <element name="BEGIN"/>
+ <element name="MOVE"/>
+ <element name="END"/>
+ <element name="CANCEL"/>
+ </enum>
+
+ <struct name="TouchEvent">
+ <param name="id" type="Integer" mandatory="true" minvalue="0" maxvalue="9">
+ <description>
+ A touch's unique identifier. The application can track the current touch events by id.
+ If a touch event has type begin, the id should be added to the set of touches.
+ If a touch event has type end, the id should be removed from the set of touches.
+ </description>
+ </param>
+ <param name="ts" type="Integer" mandatory="true" array="true" minvalue="0" maxvalue="2000000000" minsize="1" maxsize="1000">
+ <description>
+ The time that the touch was recorded. This number can the time since the beginning of the session or something else as long as the units are in milliseconds.
+ The timestamp is used to determined the rate of change of position of a touch.
+ The application also uses the time to verify whether two touches, with different ids, are part of a single action by the user.
+ If there is only a single timestamp in this array, it is the same for every coordinate in the coordinates array.
+ </description>
+ </param>
+ <param name="c" type="TouchCoord" mandatory="true" array="true" minsize="1" maxsize="1000">
+ </param>
+ </struct>
+
+ <struct name="TouchEventCapabilities">
+ <param name="pressAvailable" type="Boolean" mandatory="true">
+ </param>
+ <param name="multiTouchAvailable" type="Boolean" mandatory="true">
+ </param>
+ <param name="doublePressAvailable" type="Boolean" mandatory="true">
+ </param>
+ </struct>
+
+ <struct name="ScreenParams">
+ <param name="resolution" type="ImageResolution" mandatory="true">
+ <description>The resolution of the prescribed screen area.</description>
+ </param>
+ <param name="touchEventAvailable" type="TouchEventCapabilities" mandatory="false">
+ <description>Types of screen touch events available in screen area.</description>
+ </param>
+ </struct>
+
+ <enum name="PermissionStatus">
+ <description>Enumeration that describes possible permission states of a policy table entry.</description>
+ <element name="ALLOWED" internal_name="PS_ALLOWED"/>
+ <element name="DISALLOWED" internal_name="PS_DISALLOWED"/>
+ <element name="USER_DISALLOWED" internal_name="PS_USER_DISALLOWED"/>
+ <element name="USER_CONSENT_PENDING" internal_name="PS_USER_CONSENT_PENDING"/>
+ </enum>
+
+ <struct name="HMIPermissions">
+ <param name="allowed" type="HMILevel" minsize="0" maxsize="100" array="true" mandatory="true">
+ <description>A set of all HMI levels that are permitted for this given RPC.</description>
+ </param>
+ <param name="userDisallowed" type="HMILevel" minsize="0" maxsize="100" array="true" mandatory="true">
+ <description>A set of all HMI levels that are prohibited for this given RPC.</description>
+ </param>
+ </struct>
+
+ <struct name="ParameterPermissions">
+ <param name="allowed" type="String" minsize="0" maxsize="100" maxlength = "100" array="true" mandatory="true">
+ <description>A set of all parameters that are permitted for this given RPC.</description>
+ </param>
+ <param name="userDisallowed" type="String" minsize="0" maxsize="100" maxlength = "100" array="true" mandatory="true">
+ <description>A set of all parameters that are prohibited for this given RPC.</description>
+ </param>
+ </struct>
+
+ <struct name="PermissionItem">
+ <param name="rpcName" type="String" maxlength="100" mandatory="true">
+ <description>Name of the individual RPC in the policy table.</description>
+ </param>
+ <param name="hmiPermissions" type="HMIPermissions" mandatory="true"/>
+ <param name="parameterPermissions" type="ParameterPermissions" mandatory="true"/>
+ </struct>
+
+ <struct name="DisplayCapabilities">
+ <description>Contains information about the display capabilities.</description>
+ <param name="displayType" type="DisplayType" mandatory="true">
+ <description>The type of the display. See DisplayType</description>
+ </param>
+ <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true" mandatory="true">
+ <description>A set of all fields that support text data. See TextField</description>
+ </param>
+ <param name="imageFields" type="ImageField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>A set of all fields that support images. See ImageField</description>
+ </param>
+ <param name="mediaClockFormats" type="MediaClockFormat" minsize="0" maxsize="100" array="true" mandatory="true">
+ <description>A set of all supported formats of the media clock. See MediaClockFormat</description>
+ </param>
+ <param name="graphicSupported" type="Boolean" mandatory="true">
+ <description>The display's persistent screen supports referencing a static or dynamic image.</description>
+ </param>
+ <param name="templatesAvailable" type="String" minsize="0" maxsize="100" maxlength="100" array="true" mandatory="false">
+ <description>A set of all predefined persistent display templates available on headunit. To be referenced in SetDisplayLayout.</description>
+ </param>
+ <param name="screenParams" type="ScreenParams" mandatory="false">
+ <description>A set of all parameters related to a prescribed screen area (e.g. for video / touch input).</description>
+ </param>
+ <param name="numCustomPresetsAvailable" type="Integer" minvalue="1" maxvalue="100" mandatory="false">
+ <description>The number of on-screen custom presets available (if any); otherwise omitted.</description>
+ </param>
+
+ <!-- TODO: Add pixel density? -->
+ </struct>
+ <struct name="ButtonCapabilities">
+ <description>Contains information about a button's capabilities.</description>
+ <param name="name" type="ButtonName" mandatory="true">
+ <description>The name of the button. See ButtonName.</description>
+ </param>
+ <param name="shortPressAvailable" type="Boolean" mandatory="true">
+ <description>
+ The button supports a short press.
+ Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.
+ </description>
+ </param>
+ <param name="longPressAvailable" type="Boolean" mandatory="true">
+ <description>
+ The button supports a LONG press.
+ Whenever the button is pressed long, onButtonPressed( LONG) will be invoked.
+ </description>
+ </param>
+ <param name="upDownAvailable" type="Boolean" mandatory="true">
+ <description>
+ 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.
+ </description>
+ </param>
+ </struct>
+ <struct name="SoftButtonCapabilities">
+ <description>Contains information about a SoftButton's capabilities.</description>
+ <param name="shortPressAvailable" type="Boolean" mandatory="true">
+ <description>
+ The button supports a short press.
+ Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.
+ </description>
+ </param>
+ <param name="longPressAvailable" type="Boolean" mandatory="true">
+ <description>
+ The button supports a LONG press.
+ Whenever the button is pressed long, onButtonPressed( LONG) will be invoked.
+ </description>
+ </param>
+ <param name="upDownAvailable" type="Boolean" mandatory="true">
+ <description>
+ 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.
+ </description>
+ </param>
+ <param name="imageSupported" type="Boolean" mandatory="true">
+ <description>The button supports referencing a static or dynamic image.</description>
+ </param>
+ </struct>
+ <struct name="PresetBankCapabilities">
+ <description>Contains information about on-screen preset capabilities.</description>
+ <param name="onScreenPresetsAvailable" type="Boolean" mandatory="true">
+ <description>Onscreen custom presets are available.</description>
+ </param>
+ </struct>
+ <struct name="HMICapabilities">
+ <param name="navigation" type="Boolean" mandatory="false">
+ <description>Availability of build in Nav. True: Available, False: Not Available</description>
+ </param>
+ <param name="phoneCall" type="Boolean" mandatory="false">
+ <description>Availability of build in phone. True: Available, False: Not Available </description>
+ </param>
+ <param name="videoStreaming" type="Boolean" mandatory="false">
+ <description>Availability of video streaming. </description>
+ </param>
+ <param name="remoteControl" type="Boolean" mandatory="false">
+ <description>Availability of remote control feature. True: Available, False: Not Available</description>
+ </param>
+ </struct>
+ <struct name="MenuParams">
+ <param name="parentID" type="Integer" minvalue="0" maxvalue="2000000000" defvalue="0" mandatory="false">
+ <description>
+ unique ID of the sub menu, the command will be added to.
+ If not provided, it will be provided to the top level of the in application menu.
+ </description>
+ </param>
+ <param name="position" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
+ <description>
+ Position within the items that are are at top level of the in application menu.
+ 0 will insert at the front.
+ 1 will insert at the second position.
+ if position is greater or equal than the number of items on top level, the sub menu will be appended to the end.
+ If this param was omitted the entry will be added at the end.
+ </description>
+ </param>
+ <param name="menuName" type="String" maxlength="500" mandatory="true">
+ <description>Text to show in the menu for this sub menu.</description>
+ </param>
+ </struct>
+ <struct name="TTSChunk">
+ <description>A TTS chunk, that consists of the text/phonemes to speak and the type (like text or SAPI)</description>
+ <param name="text" minlength="0" maxlength="500" type="String" mandatory="true">
+ <description>
+ The text or phonemes to speak.
+ May not be empty.
+ </description>
+ </param>
+ <param name="type" type="SpeechCapabilities" mandatory="true">
+ <description>Describes, whether it is text or a specific phoneme set. See SpeechCapabilities</description>
+ </param>
+ </struct>
+ <struct name="Turn">
+ <param name="navigationText" type="String" maxlength="500" mandatory="false">
+ <description>Individual turn text. Must provide at least text or icon for a given turn.</description>
+ </param>
+ <param name="turnIcon" type="Image" mandatory="false">
+ <description>Individual turn icon. Must provide at least text or icon for a given turn.</description>
+ </param>
+ </struct>
+ <struct name="VehicleType">
+ <param name="make" type="String" maxlength="500" mandatory="false">
+ <description>Make of the vehicle, e.g. Ford</description>
+ </param>
+ <param name="model" type="String" maxlength="500" mandatory="false">
+ <description>Model of the vehicle, e.g. Fiesta</description>
+ </param>
+ <param name="modelYear" type="String" maxlength="500" mandatory="false">
+ <description>Model Year of the vehicle, e.g. 2013</description>
+ </param>
+ <param name="trim" type="String" maxlength="500" mandatory="false">
+ <description>Trim of the vehicle, e.g. SE</description>
+ </param>
+ </struct>
+ <enum name="KeyboardLayout">
+ <description>Enumeration listing possible keyboard layouts.</description>
+ <element name="QWERTY" />
+ <element name="QWERTZ" />
+ <element name="AZERTY" />
+ </enum>
+ <enum name="KeyboardEvent" >
+ <description>Enumeration listing possible keyboard events.</description>
+ <element name="KEYPRESS" />
+ <element name="ENTRY_SUBMITTED" />
+ <element name="ENTRY_VOICE" />
+ <element name="ENTRY_CANCELLED" />
+ <element name="ENTRY_ABORTED" />
+ </enum>
+ <enum name="KeypressMode">
+ <description>Enumeration listing possible keyboard events.</description>
+ <element name="SINGLE_KEYPRESS">
+ <description>Each keypress is individually sent as the user presses the keyboard keys.</description>
+ </element>
+ <element name="QUEUE_KEYPRESSES">
+ <description>The keypresses are queued and a string is eventually sent once the user chooses to submit their entry.</description>
+ </element>
+ <element name="RESEND_CURRENT_ENTRY">
+ <description>The keypresses are queue and a string is sent each time the user presses a keyboard key; the string contains the entire current entry.</description>
+ </element>
+ </enum>
+ <struct name="KeyboardProperties">
+ <description>Configuration of on-screen keyboard (if available).</description>
+ <param name="language" type="Language" mandatory="false">
+ <description>The keyboard language.</description>
+ </param>
+ <param name="keyboardLayout" type="KeyboardLayout" mandatory="false" >
+ <description>Desired keyboard layout.</description>
+ </param>
+ <param name="keypressMode" type="KeypressMode" mandatory="false" >
+ <description>
+ Desired keypress mode.
+ If omitted, this value will be set to RESEND_CURRENT_ENTRY.
+ </description>
+ </param>
+ <param name="limitedCharacterList" type="String" maxlength="1" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>Array of keyboard characters to enable.</description>
+ <description>All omitted characters will be greyed out (disabled) on the keyboard.</description>
+ <description>If omitted, the entire keyboard will be enabled.</description>
+ </param>
+ <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false">
+ <description>Allows an app to prepopulate the text field with a suggested or completed entry as the user types</description>
+ </param>
+ </struct>
+ <struct name="DeviceInfo">
+ <description>Various information about connecting device.</description>
+ <param name="hardware" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Device model</description>
+ </param>
+ <param name="firmwareRev" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Device firmware revision</description>
+ </param>
+ <param name="os" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Device OS</description>
+ </param>
+ <param name="osVersion" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Device OS version</description>
+ </param>
+ <param name="carrier" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Device mobile carrier (if applicable)</description>
+ </param>
+ <param name="maxNumberRFCOMMPorts" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
+ <description>Omitted if connected not via BT.</description>
+ </param>
+ </struct>
+ <enum name="RequestType">
+ <description>Enumeration listing possible asynchronous requests.</description>
+ <element name="HTTP" />
+ <element name="FILE_RESUME" />
+ <element name="AUTH_REQUEST" />
+ <element name="AUTH_CHALLENGE" />
+ <element name="AUTH_ACK" />
+ <element name="PROPRIETARY" />
+ <element name="QUERY_APPS" />
+ <element name="LAUNCH_APP" />
+ <element name="LOCK_SCREEN_ICON_URL" />
+ <element name="TRAFFIC_MESSAGE_CHANNEL" />
+ <element name="DRIVER_PROFILE" />
+ <element name="VOICE_SEARCH" />
+ <element name="NAVIGATION" />
+ <element name="PHONE" />
+ <element name="CLIMATE" />
+ <element name="SETTINGS" />
+ <element name="VEHICLE_DIAGNOSTICS" />
+ <element name="EMERGENCY" />
+ <element name="MEDIA" />
+ <element name="FOTA" />
+ </enum>
+ <enum name="AppHMIType">
+ <description>Enumeration listing possible app types.</description>
+ <element name="DEFAULT" />
+ <element name="COMMUNICATION" />
+ <element name="MEDIA" />
+ <element name="MESSAGING" />
+ <element name="NAVIGATION" />
+ <element name="INFORMATION" />
+ <element name="SOCIAL" />
+ <element name="BACKGROUND_PROCESS" />
+ <element name="TESTING" />
+ <element name="SYSTEM" />
+ <element name="PROJECTION" />
+ <element name="REMOTE_CONTROL" />
+ </enum>
+ <enum name="PredefinedLayout" platform="documentation">
+ <description>Predefined screen layout.</description>
+ <element name="DEFAULT" rootscreen="true">
+ <description>
+ Default media / non-media screen.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="MEDIA" rootscreen="true">
+ <description>
+ Default Media screen.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="NON-MEDIA" internal_name="NON_MEDIA" rootscreen="true">
+ <description>
+ Default Non-media screen.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="ONSCREEN_PRESETS" rootscreen="true">
+ <description>
+ Custom root media screen containing app-defined onscreen presets.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="NAV_FULLSCREEN_MAP" rootscreen="true" >
+ <description>
+ Custom root template screen containing full screen map with navigation controls.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="NAV_LIST" rootscreen="true" >
+ <description>
+ Custom root template screen containing video represented list.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="NAV_KEYBOARD" rootscreen="true" >
+ <description>
+ Custom root template screen containing video represented keyboard.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="GRAPHIC_WITH_TEXT" rootscreen="true">
+ <description>
+ Custom root template screen containing half-screen graphic with lines of text.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TEXT_WITH_GRAPHIC" rootscreen="true">
+ <description>
+ Custom root template screen containing lines of text with half-screen graphic.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TILES_ONLY" rootscreen="true">
+ <description>
+ Custom root template screen containing only tiled SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TEXTBUTTONS_ONLY" rootscreen="true">
+ <description>
+ Custom root template screen containing only text SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="GRAPHIC_WITH_TILES" rootscreen="true">
+ <description>
+ Custom root template screen containing half-screen graphic with tiled SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TILES_WITH_GRAPHIC" rootscreen="true">
+ <description>
+ Custom root template screen containing tiled SoftButtons with half-screen graphic.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS" rootscreen="true">
+ <description>
+ Custom root template screen containing half-screen graphic with text and SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC" rootscreen="true">
+ <description>
+ Custom root template screen containing text and SoftButtons with half-screen graphic.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="GRAPHIC_WITH_TEXTBUTTONS" rootscreen="true">
+ <description>
+ Custom root template screen containing half-screen graphic with text only SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TEXTBUTTONS_WITH_GRAPHIC" rootscreen="true">
+ <description>
+ Custom root template screen containing text only SoftButtons with half-screen graphic.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="LARGE_GRAPHIC_WITH_SOFTBUTTONS" rootscreen="true">
+ <description>
+ Custom root template screen containing a large graphic and SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="DOUBLE_GRAPHIC_WITH_SOFTBUTTONS" rootscreen="true">
+ <description>
+ Custom root template screen containing two graphics and SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="LARGE_GRAPHIC_ONLY" rootscreen="true">
+ <description>
+ Custom root template screen containing only a large graphic.
+ Can be set as a root screen.
+ </description>
+ </element>
+ </enum>
+ <enum name="FunctionID" internal_scope="base">
+ <description>Enumeration linking function names with function IDs in AppLink protocol. Assumes enumeration starts at value 0.</description>
+ <element name="RESERVED" value="0" />
+ <!--
+ Base Request / Response RPCs
+ Range = 0x 0000 0001 - 0x 0000 7FFF
+ -->
+ <element name="RegisterAppInterfaceID" value="1" hexvalue="1" />
+ <element name="UnregisterAppInterfaceID" value="2" hexvalue="2" />
+ <element name="SetGlobalPropertiesID" value="3" hexvalue="3" />
+ <element name="ResetGlobalPropertiesID" value="4" hexvalue="4" />
+ <element name="AddCommandID" value="5" hexvalue="5" />
+ <element name="DeleteCommandID" value="6" hexvalue="6" />
+ <element name="AddSubMenuID" value="7" hexvalue="7" />
+ <element name="DeleteSubMenuID" value="8" hexvalue="8" />
+ <element name="CreateInteractionChoiceSetID" value="9" hexvalue="9" />
+ <element name="PerformInteractionID" value="10" hexvalue="A" />
+ <element name="DeleteInteractionChoiceSetID" value="11" hexvalue="B" />
+ <element name="AlertID" value="12" hexvalue="C" />
+ <element name="ShowID" value="13" hexvalue="D" />
+ <element name="SpeakID" value="14" hexvalue="E" />
+ <element name="SetMediaClockTimerID" value="15" hexvalue="F" />
+ <element name="PerformAudioPassThruID" value="16" hexvalue="10" />
+ <element name="EndAudioPassThruID" value="17" hexvalue="11" />
+ <element name="SubscribeButtonID" value="18" hexvalue="12" />
+ <element name="UnsubscribeButtonID" value="19" hexvalue="13" />
+ <element name="SubscribeVehicleDataID" value="20" hexvalue="14" />
+ <element name="UnsubscribeVehicleDataID" value="21" hexvalue="15" />
+ <element name="GetVehicleDataID" value="22" hexvalue="16" />
+ <element name="ReadDIDID" value="23" hexvalue="17" />
+ <element name="GetDTCsID" value="24" hexvalue="18" />
+ <element name="ScrollableMessageID" value="25" hexvalue="19" />
+ <element name="SliderID" value="26" hexvalue="1A" />
+ <element name="ShowConstantTBTID" value="27" hexvalue="1B" />
+ <element name="AlertManeuverID" value="28" hexvalue="1C" />
+ <element name="UpdateTurnListID" value="29" hexvalue="1D" />
+ <element name="ChangeRegistrationID" value="30" hexvalue="1E" />
+ <element name="GenericResponseID" value="31" hexvalue="1F" />
+ <element name="PutFileID" value="32" hexvalue="20" />
+ <element name="DeleteFileID" value="33" hexvalue="21" />
+ <element name="ListFilesID" value="34" hexvalue="22" />
+ <element name="SetAppIconID" value="35" hexvalue="23" />
+ <element name="SetDisplayLayoutID" value="36" hexvalue="24" />
+ <element name="DiagnosticMessageID" value="37" hexvalue="25" />
+ <element name="SystemRequestID" value="38" hexvalue="26" />
+ <element name="SendLocationID" value="39" hexvalue="27" />
+ <element name="DialNumberID" value="40" hexvalue="28" />
+ <element name="ButtonPressID" value="41" hexvalue="29" />
+ <element name="GetInteriorVehicleDataID" value="43" hexvalue="2B" />
+ <element name="SetInteriorVehicleDataID" value="44" hexvalue="2C" />
+ <element name="GetWayPointsID" value="45" hexvalue="2D" />
+ <element name="SubscribeWayPointsID" value="46" hexvalue="2E" />
+ <element name="UnsubscribeWayPointsID" value="47" hexvalue="2F" />
+ <element name="GetSystemCapabilityID" value="48" hexvalue="30" />
+ <element name="SendHapticDataID" value="49" hexvalue="31" />
+
+ <!--
+ Base Notifications
+ Range = 0x 0000 8000 - 0x 0000 FFFF
+ -->
+
+ <element name="OnHMIStatusID" value="32768" hexvalue="8000" />
+ <element name="OnAppInterfaceUnregisteredID" value="32769" hexvalue="8001" />
+ <element name="OnButtonEventID" value="32770" hexvalue="8002" />
+ <element name="OnButtonPressID" value="32771" hexvalue="8003" />
+ <element name="OnVehicleDataID" value="32772" hexvalue="8004" />
+ <element name="OnCommandID" value="32773" hexvalue="8005" />
+ <element name="OnTBTClientStateID" value="32774" hexvalue="8006" />
+ <element name="OnDriverDistractionID" value="32775" hexvalue="8007" />
+ <element name="OnPermissionsChangeID" value="32776" hexvalue="8008" />
+ <element name="OnAudioPassThruID" value="32777" hexvalue="8009" />
+ <element name="OnLanguageChangeID" value="32778" hexvalue="800A" />
+ <element name="OnKeyboardInputID" value="32779" hexvalue="800B" />
+ <element name="OnTouchEventID" value="32780" hexvalue="800C" />
+ <element name="OnSystemRequestID" value="32781" hexvalue="800D" />
+ <element name="OnHashChangeID" value="32782" hexvalue="800E" />
+ <element name="OnInteriorVehicleDataID" value="32783" hexvalue="800F" />
+ <element name="OnWayPointChangeID" value="32784" hexvalue="8010" />
+
+ <!--
+ Ford Specific Request / Response RPCs
+ Range = 0x 0001 0000 - 0x 0001 7FFF
+ -->
+
+ <element name="EncodedSyncPDataID" value="65536" hexvalue="10000" />
+ <element name="SyncPDataID" value="65537" hexvalue="10001" />
+
+ <!--
+ Ford Specific Notifications
+ Range = 0x 0001 8000 - 0x 0001 FFFF
+ -->
+
+ <element name="OnEncodedSyncPDataID" value="98304" hexvalue="18000" />
+ <element name="OnSyncPDataID" value="98305" hexvalue="18001" />
+ </enum>
+
+ <enum name="messageType">
+ <description>
+ Enumeration linking message types with function types in WiPro protocol.
+ Assumes enumeration starts at value 0.
+ </description>
+ <element name="request" value="0" />
+ <element name="response" value="1" />
+ <element name="notification" value="2" />
+ </enum>
+
+ <struct name="DateTime">
+ <param name="millisecond" type="Integer" minvalue="0" maxvalue="999" mandatory="false">
+ <description>Milliseconds </description>
+ </param>
+ <param name="second" type="Integer" minvalue="0" maxvalue="60" mandatory="false">
+ <description>Seconds part of time</description>
+ </param>
+ <param name="minute" type="Integer" minvalue="0" maxvalue="59" mandatory="false">
+ <description>Minutes part of time</description>
+ </param>
+ <param name="hour" type="Integer" minvalue="0" maxvalue="23" mandatory="false">
+ <description>Hours part of time. Note that this structure accepts time only in 24 Hr format</description>
+ </param>
+ <param name="day" type="Integer" minvalue="1" maxvalue="31" mandatory="false">
+ <description>Day of the month</description>
+ </param>
+ <param name="month" type="Integer" minvalue="1" maxvalue="12" mandatory="false">
+ <description>Month of the year</description>
+ </param>
+ <param name="year" type="Integer" maxvalue="4095" mandatory="false">
+ <description>The year in YYYY format</description>
+ </param>
+ <param name="tz_hour" type="Integer" minvalue="-12" maxvalue="14" defvalue="0" mandatory="false">
+ <description>Time zone offset in Hours wrt UTC.</description>
+ </param>
+ <param name="tz_minute" type="Integer" minvalue="0" maxvalue="59" defvalue="0" mandatory="false">
+ <description>Time zone offset in Min wrt UTC.</description>
+ </param>
+ </struct>
+
+ <enum name="WayPointType">
+ <description>Describes what kind of waypoint is requested/provided.</description>
+ <element name="ALL" />
+ <element name="DESTINATION" />
+ </enum>
+
+ <struct name="Coordinate">
+ <param name="latitudeDegrees" minvalue="-90" maxvalue="90" type="Float" mandatory="true">
+ <description>Latitude of the location.</description>
+ </param>
+ <param name="longitudeDegrees" minvalue="-180" maxvalue="180" type="Float" mandatory="true">
+ <description>Longitude of the location.</description>
+ </param>
+ </struct>
+
+ <struct name="OASISAddress">
+ <param name="countryName" minlength="0" maxlength="200" type="String" mandatory="false">
+ <description>Name of the country (localized)</description>
+ </param>
+ <param name="countryCode" minlength="0" maxlength="50" type="String" mandatory="false">
+ <description>Name of country (ISO 3166-2)</description>
+ </param>
+ <param name="postalCode" minlength="0" maxlength="16" type="String" mandatory="false">
+ <description>(PLZ, ZIP, PIN, CAP etc.)</description>
+ </param>
+ <param name="administrativeArea" minlength="0" maxlength="200" type="String" mandatory="false">
+ <description>Portion of country (e.g. state)</description>
+ </param>
+ <param name="subAdministrativeArea" minlength="0" maxlength="200" type="String" mandatory="false">
+ <description>Portion of e.g. state (e.g. county)</description>
+ </param>
+ <param name="locality" minlength="0" maxlength="200" type="String" mandatory="false">
+ <description>Hypernym for e.g. city/village</description>
+ </param>
+ <param name="subLocality" minlength="0" maxlength="200" type="String" mandatory="false">
+ <description>Hypernym for e.g. district</description>
+ </param>
+ <param name="thoroughfare" minlength="0" maxlength="200" type="String" mandatory="false">
+ <description>Hypernym for street, road etc.</description>
+ </param>
+ <param name="subThoroughfare" minlength="0" maxlength="200" type="String" mandatory="false">
+ <description>Portion of thoroughfare e.g. house number</description>
+ </param>
+ </struct>
+
+ <struct name="LocationDetails">
+ <param name="coordinate" type="Coordinate" mandatory="false">
+ <description>Latitude/Longitude of the location.</description>
+ </param>
+ <param name="locationName" type="String" maxlength="500" mandatory="false">
+ <description>Name of location.</description>
+ </param>
+ <param name="addressLines" type="String" maxlength="500" minsize="0" maxsize="4" array="true" mandatory="false">
+ <description>Location address for display purposes only</description>
+ </param>
+ <param name="locationDescription" type="String" maxlength="500" mandatory="false">
+ <description>Description intended location / establishment (if applicable)</description>
+ </param>
+ <param name="phoneNumber" type="String" maxlength="500" mandatory="false">
+ <description>Phone number of location / establishment.</description>
+ </param>
+ <param name="locationImage" type="Image" mandatory="false">
+ <description>Image / icon of intended location.</description>
+ </param>
+ <param name="searchAddress" type="OASISAddress" mandatory="false">
+ <description>Address to be used by navigation engines for search</description>
+ </param>
+ </struct>
+
+ <enum name="SystemCapabilityType">
+ <description>Enumerations of all available system capability types</description>
+ <element name="NAVIGATION"/>
+ <element name="PHONE_CALL"/>
+ <element name="VIDEO_STREAMING"/>
+ <element name="REMOTE_CONTROL"/>
+ </enum>
+
+ <struct name="NavigationCapability">
+ <description>Extended capabilities for an onboard navigation system</description>
+ <param name="sendLocationEnabled" type="Boolean" mandatory="false">
+ <description>If the module has the ability to add locations to the onboard nav</description>
+ </param>
+ <param name="getWayPointsEnabled" type="Boolean" mandatory="false">
+ <description>If the module has the ability to return way points from onboard nav</description>
+ </param>
+ </struct>
+
+ <struct name="PhoneCapability">
+ <description>Extended capabilities of the module's phone feature</description>
+ <param name="dialNumberEnabled" type="Boolean" mandatory="false">
+ <description>If the module has the ability to perform dial number</description>
+ </param>
+ </struct>
+
+ <struct name="VideoStreamingFormat">
+ <description>Video streaming formats and their specifications.</description>
+ <param name="protocol" type="VideoStreamingProtocol" mandatory="true">
+ <description>Protocol type, see VideoStreamingProtocol</description>
+ </param>
+ <param name="codec" type="VideoStreamingCodec" mandatory="true">
+ <description>Codec type, see VideoStreamingCodec</description>
+ </param>
+ </struct>
+
+ <struct name="VideoStreamingCapability">
+ <description>Contains information about this system's video streaming capabilities.</description>
+ <param name="preferredResolution" type="ImageResolution" mandatory="false">
+ <description>The preferred resolution of a video stream for decoding and rendering on HMI.</description>
+ </param>
+ <param name="maxBitrate" type="Integer" minvalue="0" maxvalue="2147483647" mandatory="false">
+ <description>The maximum bitrate of video stream that is supported, in kbps.</description>
+ </param>
+ <param name="supportedFormats" type="VideoStreamingFormat" array="true" mandatory="false">
+ <description>Detailed information on each format supported by this system, in its preferred order (i.e. the first element in the array is most preferable to the system). Each object will contain a VideoStreamingFormat that describes what can be expected.</description>
+ </param>
+ <param name="hapticSpatialDataSupported" type="Boolean" mandatory="false">
+ <description>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'. </description>
+ </param>
+ </struct>
+
+ <!---Remote control -->
+
+ <struct name="Temperature">
+ <param name="unit" type="TemperatureUnit" mandatory="true">
+ <description>Temperature Unit</description>
+ </param>
+ <param name="value" type="Float" mandatory="true">
+ <description>Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL.</description>
+ </param>
+ </struct>
+
+ <struct name="RdsData">
+ <param name="PS" type="String" minlength="0" maxlength="8" mandatory="false">
+ <description>Program Service Name</description>
+ </param>
+ <param name="RT" type="String" minlength="0" maxlength="64" mandatory="false">
+ <description>Radio Text</description>
+ </param>
+ <param name="CT" type="String" minlength="24" maxlength="24" mandatory="false">
+ <description>The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD</description>
+ </param>
+ <param name="PI" type="String" minlength="0" maxlength="6" mandatory="false">
+ <description>Program Identification - the call sign for the radio station</description>
+ </param>
+ <param name="PTY" type="Integer" minvalue="0" maxvalue="31" mandatory="false">
+ <description>The program type - The region should be used to differentiate between EU and North America program types</description>
+ </param>
+ <param name="TP" type="Boolean" mandatory="false">
+ <description>Traffic Program Identification - Identifies a station that offers traffic</description>
+ </param>
+ <param name="TA" type="Boolean" mandatory="false">
+ <description>Traffic Announcement Identification - Indicates an ongoing traffic announcement</description>
+ </param>
+ <param name="REG" type="String" mandatory="false">
+ <description>Region</description>
+ </param>
+ </struct>
+
+ <struct name="RadioControlData">
+ <param name="frequencyInteger" type="Integer" minvalue="0" maxvalue="1710" mandatory="false">
+ <description>The integer part of the frequency ie for 101.7 this value should be 101</description>
+ </param>
+ <param name="frequencyFraction" type="Integer" minvalue="0" maxvalue="9" mandatory="false">
+ <description>The fractional part of the frequency for 101.7 is 7</description>
+ </param>
+ <param name="band" type="RadioBand" mandatory="false">
+ </param>
+ <param name="rdsData" type="RdsData" mandatory="false">
+ </param>
+ <param name="availableHDs" type="Integer" minvalue="1" maxvalue="3" mandatory="false">
+ <description>number of HD sub-channels if available</description>
+ </param>
+ <param name="hdChannel" type="Integer" minvalue="1" maxvalue="3" mandatory="false">
+ <description>Current HD sub-channel if available</description>
+ </param>
+ <param name="signalStrength" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
+ </param>
+ <param name="signalChangeThreshold" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
+ <description>If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency</description>
+ </param>
+ <param name="radioEnable" type="Boolean" mandatory="false">
+ <description> True if the radio is on, false is the radio is off. If set to false, no other data will be included.</description>
+ </param>
+ <param name="state" type="RadioState" mandatory="false">
+ </param>
+ </struct>
+
+ <struct name="ClimateControlData">
+ <param name="fanSpeed" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
+ </param>
+ <param name="currentTemperature" type="Temperature" mandatory="false">
+ </param>
+ <param name="desiredTemperature" type="Temperature" mandatory="false">
+ </param>
+ <param name="acEnable" type="Boolean" mandatory="false">
+ </param>
+ <param name="circulateAirEnable" type="Boolean" mandatory="false">
+ </param>
+ <param name="autoModeEnable" type="Boolean" mandatory="false">
+ </param>
+ <param name="defrostZone" type="DefrostZone" mandatory="false">
+ </param>
+ <param name="dualModeEnable" type="Boolean" mandatory="false">
+ </param>
+ <param name="acMaxEnable" type="Boolean" mandatory="false">
+ </param>
+ <param name="ventilationMode" type="VentilationMode" mandatory="false">
+ </param>
+ </struct>
+
+ <struct name="ModuleData">
+ <description>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</description>
+ <param name="moduleType" type="ModuleType" mandatory="true">
+ </param>
+ <param name="radioControlData" type="RadioControlData" mandatory="false">
+ </param>
+ <param name="climateControlData" type="ClimateControlData" mandatory="false">
+ </param>
+ </struct>
+
+ <struct name="RadioControlCapabilities">
+ <description>Contains information about a radio control module's capabilities.</description>
+ <!-- need an ID in the future -->
+ <param name="moduleName" type="String" maxlength="100" mandatory="true">
+ <description>
+ The short friendly name of the climate control module.
+ It should not be used to identify a module by mobile application.
+ </description>
+ </param>
+ <param name="radioEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable radio.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="radioBandAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of radio band.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="radioFrequencyAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of radio frequency.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="hdChannelAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of HD radio channel.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="rdsDataAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the getting Radio Data System (RDS) data.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="availableHDsAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the getting the number of available HD channels.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="stateAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the getting the Radio state.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="signalStrengthAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the getting the signal strength.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="signalChangeThresholdAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the getting the signal Change Threshold.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ </struct>
+
+ <struct name="ClimateControlCapabilities">
+ <description>Contains information about a climate control module's capabilities.</description>
+ <!-- need an ID in the future -->
+ <param name="moduleName" type="String" maxlength="100" mandatory="true">
+ <description>The short friendly name of the climate control module.
+ It should not be used to identify a module by mobile application.</description>
+ </param>
+ <param name="fanSpeedAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of fan speed.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="desiredTemperatureAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of desired temperature.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="acEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of turn on/off AC.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="acMaxEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable air conditioning is ON on the maximum level.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="circulateAirEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable circulate Air mode.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="autoModeEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable auto mode.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="dualModeEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable dual mode.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="defrostZoneAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of defrost zones.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="defrostZone" type="DefrostZone" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ A set of all defrost zones that are controllable.
+ </description>
+ </param>
+ <param name="ventilationModeAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of air ventilation mode.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="ventilationMode" type="VentilationMode" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ A set of all ventilation modes that are controllable.
+ </description>
+ </param>
+ </struct>
+
+ <struct name="RemoteControlCapabilities">
+ <param name="climateControlCapabilities" type="ClimateControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
+ <description>If included, the platform supports RC climate controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description >
+ </param>
+ <param name="radioControlCapabilities" type="RadioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
+ <description>If included, the platform supports RC radio controls.For this baseline version, maxsize=1. i.e. only one radio control module is supported.</description >
+ </param>
+ <param name="buttonCapabilities" type="ButtonCapabilities" mandatory="false" minsize="1" maxsize="100" array="true" >
+ <description>If included, the platform supports RC button controls with the included button names.</description >
+ </param>
+ </struct>
+
+ <!-- End of RC -->
+ <struct name="SystemCapability">
+ <description>The systemCapabilityType 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</description>
+ <param name="systemCapabilityType" type="SystemCapabilityType" mandatory="true">
+ <description>Used as a descriptor of what data to expect in this struct. The corresponding param to this enum should be included and the only other para included.</description>
+ </param>
+ <param name="navigationCapability" type="NavigationCapability" mandatory="false">
+ <description>Describes extended capabilities for onboard navigation system </description>
+ </param>
+ <param name="phoneCapability" type="PhoneCapability" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="videoStreamingCapability" type="VideoStreamingCapability" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="remoteControlCapability" type="RemoteControlCapabilities" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ </struct>
+
+ <enum name="MetadataType">
+ <element name="mediaTitle">
+ <description>The data in this field contains the title of the currently playing audio track.</description>
+ </element>
+ <element name="mediaArtist">
+ <description>The data in this field contains the artist or creator of the currently playing audio track.</description>
+ </element>
+ <element name="mediaAlbum">
+ <description>The data in this field contains the album title of the currently playing audio track.</description>
+ </element>
+ <element name="mediaYear">
+ <description>The data in this field contains the creation year of the currently playing audio track.</description>
+ </element>
+ <element name="mediaGenre">
+ <description>The data in this field contains the genre of the currently playing audio track.</description>
+ </element>
+ <element name="mediaStation">
+ <description>The data in this field contains the name of the current source for the media.</description>
+ </element>
+ <element name="rating">
+ <description>The data in this field is a rating.</description>
+ </element>
+ <element name="currentTemperature">
+ <description>The data in this field is the current temperature.</description>
+ </element>
+ <element name="maximumTemperature">
+ <description>The data in this field is the maximum temperature for the day.</description>
+ </element>
+ <element name="minimumTemperature">
+ <description>The data in this field is the minimum temperature for the day.</description>
+ </element>
+ <element name="weatherTerm">
+ <description>The data in this field describes the current weather (ex. cloudy, clear, etc.).</description>
+ </element>
+ <element name="humidity">
+ <description>The data in this field describes the current humidity value.</description>
+ </element>
+ </enum>
+
+ <struct name="MetadataTags">
+ <param name="mainField1" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
+ <description>The type of data contained in the "mainField1" text field.</description>
+ </param>
+ <param name="mainField2" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
+ <description>The type of data contained in the "mainField2" text field.</description>
+ </param>
+ <param name="mainField3" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
+ <description>The type of data contained in the "mainField3" text field.</description>
+ </param>
+ <param name="mainField4" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
+ <description>The type of data contained in the "mainField4" text field.</description>
+ </param>
+ </struct>
+
+ <struct name="Rectangle">
+ <param name="x" type="Float" mandatory="true">
+ <description>The upper left X-coordinate of the rectangle</description>
+ </param>
+ <param name="y" type="Float" mandatory="true">
+ <description>The upper left Y-coordinate of the rectangle</description>
+ </param>
+ <param name="width" type="Float" mandatory="true">
+ <description>The width of the rectangle</description>
+ </param>
+ <param name="height" type="Float" mandatory="true">
+ <description>The height of the rectangle</description>
+ </param>
+ </struct>
+
+ <struct name="HapticRect">
+ <description>Defines haptic data for each user control object for video streaming application</description>
+ <param name="id" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>A user control spatial identifier</description>
+ </param>
+ <param name="rect" type="Rectangle" mandatory="true">
+ <description>The position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.</description>
+ </param>
+ </struct>
+
+ <!-- Requests/Responses -->
+
+ <function name="RegisterAppInterface" functionID="RegisterAppInterfaceID" messagetype="request">
+ <description>
+ Establishes an interface with a mobile application.
+ Before registerAppInterface no other commands will be accepted/executed.
+ </description>
+
+ <param name="syncMsgVersion" type="SyncMsgVersion" mandatory="true">
+ <description>See SyncMsgVersion</description>
+ </param>
+
+ <param name="appName" type="String" maxlength="100" mandatory="true">
+ <description>
+ The mobile application name, e.g. "Ford Drive Green".
+ Needs to be unique over all applications.
+ May not be empty.
+ May not start with a new line character.
+ May not interfere with any name or synonym of previously registered applications and any predefined blacklist of words (global commands)
+ Needs to be unique over all applications. Applications with the same name will be rejected.
+ Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
+ </description>
+ </param>
+
+ <param name="ttsName" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
+ <description>
+ TTS string for VR recognition of the mobile application name, e.g. "Ford Drive Green".
+ Meant to overcome any failing on speech engine in properly pronouncing / understanding app name.
+ Needs to be unique over all applications.
+ May not be empty.
+ May not start with a new line character.
+ Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
+ </description>
+ </param>
+
+ <param name="ngnMediaScreenAppName" type="String" maxlength="100" mandatory="false">
+ <description>
+ Provides an abbreviated version of the app name (if needed), that will be displayed on the NGN media screen.
+ If not provided, the appName is used instead (and will be truncated if too long)
+ Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
+ </description>
+ </param>
+
+ <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ Defines an additional voice recognition command.
+ May not interfere with any app name of previously registered applications and any predefined blacklist of words (global commands)
+ Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
+ </description>
+ </param>
+
+ <param name="isMediaApplication" type="Boolean" mandatory="true">
+ <description>
+ Indicates if the application is a media or a non-media application.
+ Only media applications will be able to stream audio to the module that is audible outside of the BT media source.
+ </description>
+ </param>
+ <param name="languageDesired" type="Language" mandatory="true">
+ <description>
+ See Language
+ Current app's expected VR+TTS language
+ If there is a mismatch with the module, the app will be able to change this registration with changeRegistration prior to app being brought into focus.
+ </description>
+ </param>
+ <param name="hmiDisplayLanguageDesired" type="Language" mandatory="true">
+ <description>
+ See Language
+ Current app's expected display language
+ If there is a mismatch with the module, the app will be able to change this registration with changeRegistration prior to app being brought into focus.
+ </description>
+ </param>
+
+ <param name="appHMIType" type="AppHMIType" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ See AppHMIType
+ List of all applicable app HMI types stating which HMI classifications to be given to the app.
+ </description>
+ </param>
+
+ <param name="hashID" type="String" maxlength="100" mandatory="false">
+ <description>
+ ID used to uniquely identify current state of all app data that can persist through connection cycles (e.g. ignition cycles).
+ This registered data (commands, submenus, choice sets, etc.) can be reestablished without needing to explicitly reregister each piece.
+ If omitted, then the previous state of an app's commands, etc. will not be restored.
+ When sending hashID, all RegisterAppInterface parameters should still be provided (e.g. ttsName, etc.).
+ </description>
+ </param>
+ <param name="deviceInfo" type="DeviceInfo" mandatory="false">
+ <description>
+ See DeviceInfo.
+ </description>
+ </param>
+ <param name="appID" type="String" maxlength="100" mandatory="true">
+ <description>ID used to validate app with policy table entries</description>
+ </param>
+ <param name="appInfo" type="AppInfo" mandatory="false">
+ <description>
+ See AppInfo.
+ </description>
+ </param>
+ </function>
+
+ <function name="RegisterAppInterface" functionID="RegisterAppInterfaceID" messagetype="response">
+ <description>The response to registerAppInterface</description>
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="TOO_MANY_APPLICATIONS"/>
+ <element name="APPLICATION_REGISTERED_ALREADY"/>
+ <element name="UNSUPPORTED_VERSION"/>
+ <element name="WRONG_LANGUAGE"/>
+ <element name="DISALLOWED"/>
+ <element name="WARNINGS"/>
+ <element name="RESUME_FAILED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="syncMsgVersion" type="SyncMsgVersion" mandatory="false">
+ <description>See SyncMsgVersion</description>
+ </param>
+
+ <param name="language" type="Language" mandatory="false">
+ <description>The currently active VR+TTS language on the module. See "Language" for options.</description>
+ </param>
+
+ <param name="hmiDisplayLanguage" type="Language" mandatory="false">
+ <description>The currently active display language on the module. See "Language" for options.</description>
+ </param>
+
+ <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false">
+ <description>See DisplayCapabilities</description>
+ </param>
+
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See ButtonCapabilities</description >
+ </param>
+
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
+ </param>
+
+ <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false">
+ <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
+ </param>
+ <param name="hmiZoneCapabilities" type="HmiZoneCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See HmiZoneCapabilities</description>
+ </param>
+ <param name="speechCapabilities" type="SpeechCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See SpeechCapabilities</description>
+ </param>
+
+ <param name="prerecordedSpeech" type="PrerecordedSpeech" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See PrerecordedSpeech</description>
+ </param>
+
+ <param name="vrCapabilities" type="VrCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See VrCapabilities</description>
+ </param>
+
+ <param name="audioPassThruCapabilities" type="AudioPassThruCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See AudioPassThruCapability</description>
+ </param>
+
+ <param name="pcmStreamCapabilities" type="AudioPassThruCapabilities" array="false" mandatory="false">
+ <description>See AudioPassThruCapability</description>
+ </param>
+
+ <param name="vehicleType" type="VehicleType" mandatory="false">
+ <description>Specifies the vehicle's type. See VehicleType.</description>
+ </param>
+
+ <param name="supportedDiagModes" type="Integer" minvalue="0" maxvalue="255" array="true" minsize="1" maxsize="100" mandatory="false" >
+ <description>
+ Specifies the white-list of supported diagnostic modes (0x00-0xFF) capable for DiagnosticMessage requests.
+ If a mode outside this list is requested, it will be rejected.
+ </description>
+ </param>
+
+ <param name="hmiCapabilities" type="HMICapabilities" mandatory="false">
+ <description>Specifies the HMI’s capabilities. See HMICapabilities.</description>
+ </param>
+
+ <param name="sdlVersion" type="String" maxlength="100" mandatory="false" platform="documentation">
+ <description>The SmartDeviceLink version.</description>
+ </param>
+
+ <param name="systemSoftwareVersion" type="String" maxlength="100" mandatory="false" platform="documentation">
+ <description>The software version of the system that implements the SmartDeviceLink core.</description>
+ </param>
+ </function>
+
+ <function name="UnregisterAppInterface" functionID="UnregisterAppInterfaceID" messagetype="request">
+ <description>
+ Closes an interface from a mobile application.
+ After unregisterAppInterface, no commands other than registerAppInterface will be accepted/executed.
+ Will fail, if no registerAppInterface was completed successfully before.
+ </description>
+ </function>
+
+ <function name="UnregisterAppInterface" functionID="UnregisterAppInterfaceID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="SetGlobalProperties" functionID="SetGlobalPropertiesID" messagetype="request">
+ <description>Allows setting global properties.</description>
+
+ <param name="helpPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
+ <description>
+ The help prompt.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="timeoutPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
+ <description>
+ Help text for a wait timeout.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="vrHelpTitle" type="String" maxlength="500" mandatory="false">
+ <description>
+ VR Help Title text.
+ If omitted on supported displays, the default module help title shall be used.
+ If omitted and one or more vrHelp items are provided, the request will be rejected.
+ </description>
+ </param>
+
+ <param name="vrHelp" type="VrHelpItem" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ VR Help Items.
+ If omitted on supported displays, the default AppLink VR help / What Can I Say? screen shall be used.
+ If the list of VR Help Items contains nonsequential positions (e.g. [1,2,4]), the RPC shall be rejected.
+ If omitted and a vrHelpTitle is provided, the request will be rejected.
+ </description>
+ </param>
+ <param name="menuTitle" maxlength="500" type="String" mandatory="false">
+ <description>Optional text to label an app menu button (for certain touchscreen platforms).</description>
+ </param>
+
+ <param name="menuIcon" type="Image" mandatory="false">
+ <description>>Optional icon to draw on an app menu button (for certain touchscreen platforms).</description>
+ </param>
+
+ <param name="keyboardProperties" type="KeyboardProperties" mandatory="false">
+ <description>On-screen keyboard configuration (if available).</description>
+ </param>
+ </function>
+
+ <function name="SetGlobalProperties" functionID="SetGlobalPropertiesID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="WARNINGS"/>
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="ResetGlobalProperties" functionID="ResetGlobalPropertiesID" messagetype="request">
+ <description>Allows resetting global properties.</description>
+
+ <param name="properties" type="GlobalProperty" minsize="1" maxsize="100" array="true" mandatory="true">
+ <description>Contains the names of all global properties (like timeoutPrompt) that should be unset. Resetting means, that they have the same value as at start up (default)</description>
+ </param>
+ </function>
+
+ <function name="ResetGlobalProperties" functionID="ResetGlobalPropertiesID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="AddCommand" functionID="AddCommandID" messagetype="request">
+ <description>
+ Adds a command to the in application menu.
+ Either menuParams or vrCommands must be provided.
+ </description>
+
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>unique ID of the command to add.</description>
+ </param>
+
+ <param name="menuParams" type="MenuParams" mandatory="false">
+ <description>Optional sub value containing menu parameters</description>
+ </param>
+
+ <param name="vrCommands" type="String" minsize="1" maxsize="100" maxlength="99" array="true" mandatory="false">
+ <description>
+ An array of strings to be used as VR synonyms for this command.
+ If this array is provided, it may not be empty.
+ </description>
+ </param>
+
+ <param name="cmdIcon" type="Image" mandatory="false">
+ <description>
+ Image struct determining whether static or dynamic icon.
+ If omitted on supported displays, no (or the default if applicable) icon shall be displayed.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="AddCommand" functionID="AddCommandID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="DISALLOWED"/>
+ <element name="WARNINGS"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="DeleteCommand" functionID="DeleteCommandID" messagetype="request">
+ <description>Deletes all commands from the in-application menu with the specified command id.</description>
+
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>ID of the command(s) to delete.</description>
+ </param>
+
+ </function>
+
+ <function name="DeleteCommand" functionID="DeleteCommandID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="IN_USE"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="AddSubMenu" functionID="AddSubMenuID" messagetype="request">
+ <description>Adds a sub menu to the in-application menu.</description>
+
+ <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="true">
+ <description>unique ID of the sub menu to add.</description>
+ </param>
+
+ <param name="position" type="Integer" minvalue="0" maxvalue="1000" defvalue="1000" mandatory="false">
+ <description>
+ Position within the items that are are at top level of the in application menu.
+ 0 will insert at the front.
+ 1 will insert at the second position.
+ If position is greater or equal than the number of items on top level, the sub menu will be appended to the end.
+ Position of any submenu will always be located before the return and exit options
+ If this param was omitted the entry will be added at the end.
+ </description>
+ </param>
+
+ <param name="menuName" maxlength="500" type="String" mandatory="true">
+ <description>Text to show in the menu for this sub menu.</description>
+ </param>
+ </function>
+
+ <function name="AddSubMenu" functionID="AddSubMenuID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="DeleteSubMenu" functionID="DeleteSubMenuID" messagetype="request">
+ <description>Deletes a submenu from the in-application menu.</description>
+
+ <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="true">
+ <description>The "menuID" of the submenu to delete. (See addSubMenu.menuID)</description>
+ </param>
+
+ </function>
+
+ <function name="DeleteSubMenu" functionID="DeleteSubMenuID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="IN_USE"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="CreateInteractionChoiceSet" functionID="CreateInteractionChoiceSetID" messagetype="request">
+ <description>creates interaction choice set to be used later by performInteraction</description>
+
+ <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>Unique ID used for this interaction choice set.</description>
+ </param>
+
+ <param name="choiceSet" type="Choice" minsize="1" maxsize="100" array="true" mandatory="true"/>
+ </function>
+
+ <function name="CreateInteractionChoiceSet" functionID="CreateInteractionChoiceSetID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="PerformInteraction" functionID="PerformInteractionID" messagetype="request">
+ <description>Triggers an interaction (e.g. "Permit GPS?" - Yes, no, Always Allow).</description>
+
+ <param name="initialText" type="String" maxlength="500" mandatory="true">
+ <description>
+ Text to be displayed first.
+ </description>
+ </param>
+
+ <param name="initialPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ This is the initial prompt spoken to the user at the start of an interaction.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="interactionMode" type="InteractionMode" mandatory="true">
+ <description>See InteractionMode.</description>
+ </param>
+
+ <param name="interactionChoiceSetIDList" type="Integer" minsize="0" maxsize="100" minvalue="0" maxvalue="2000000000" array="true" mandatory="true">
+ <description>List of interaction choice set IDs to use with an interaction.</description>
+ </param>
+
+ <param name="helpPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ Help text. This is the spoken string when a user speaks "help" when the interaction is occurring.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="timeoutPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ Timeout text. This text is spoken when a VR interaction times out.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="timeout" type="Integer" minvalue="5000" maxvalue="100000" defvalue="10000" mandatory="false">
+ <description>
+ Timeout in milliseconds.
+ If omitted a standard value of 10000 milliseconds is used.
+ Applies only to the menu portion of the interaction. The VR timeout will be handled by the platform.
+ </description>
+ </param>
+
+ <param name="vrHelp" type="VrHelpItem" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ Ability to send suggested VR Help Items to display on-screen during Perform Interaction.
+ If omitted on supported displays, the default generated list of suggested choices shall be displayed.
+ </description>
+ </param>
+
+ <param name="interactionLayout" type="LayoutMode" mandatory="false">
+ <description>See LayoutMode.</description>
+ </param>
+
+ </function>
+
+ <function name="PerformInteraction" functionID="PerformInteractionID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="TIMED_OUT"/>
+ <element name="ABORTED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="WARNINGS"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="choiceID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>
+ ID of the choice that was selected in response to PerformInteraction.
+ Only is valid if general result is "success:true".
+ </description>
+ </param>
+
+ <param name="manualTextEntry" type="String" maxlength="500" mandatory="false">
+ <description>
+ Manually entered text selection, e.g. through keyboard
+ Can be returned in lieu of choiceID, depending on trigger source
+ </description>
+ </param>
+
+ <param name="triggerSource" type="TriggerSource" mandatory="false">
+ <description>
+ See TriggerSource
+ Only is valid if resultCode is SUCCESS.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="DeleteInteractionChoiceSet" functionID="DeleteInteractionChoiceSetID" messagetype="request">
+ <description>Deletes interaction choice set that has been created with "CreateInteractionChoiceSet".</description>
+ <description>The interaction may only be deleted when not currently in use by a "performInteraction".</description>
+
+ <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>ID of the interaction choice set to delete.</description>
+ </param>
+ </function>
+
+ <function name="DeleteInteractionChoiceSet" functionID="DeleteInteractionChoiceSetID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="IN_USE"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="Alert" functionID="AlertID" messagetype="request">
+ <description>Shows an alert which typically consists of text-to-speech message and text on the display. At least either alertText1, alertText2 or TTSChunks need to be provided.</description>
+
+ <param name="alertText1" type="String" maxlength="500" mandatory="false">
+ <description>The first line of the alert text field</description>
+ </param>
+
+ <param name="alertText2" type="String" maxlength="500" mandatory="false">
+ <description>The second line of the alert text field</description>
+ </param>
+
+ <param name="alertText3" type="String" maxlength="500" mandatory="false">
+ <description>The optional third line of the alert text field</description>
+ </param>
+
+ <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="duration" type="Integer" minvalue="3000" maxvalue="10000" defvalue="5000" mandatory="false">
+ <description>
+ Timeout in milliseconds.
+ Typical timeouts are 3-5 seconds.
+ If omitted, timeout is set to 5s.
+ </description>
+ </param>
+
+ <param name="playTone" type="Boolean" mandatory="false">
+ <description>
+ Defines if tone should be played. Tone is played before TTS.
+ If omitted, no tone is played.
+ </description>
+ </param>
+
+ <param name="progressIndicator" type="Boolean" mandatory="false">
+ <description>
+ If supported on the given platform, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
+ </description>
+ </param>
+
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="4" array="true" mandatory="false">
+ <description>
+ App defined SoftButtons.
+ If omitted on supported displays, the displayed alert shall not have any SoftButtons.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="Alert" functionID="AlertID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="ABORTED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="WARNINGS"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="tryAgainTime" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>
+ Amount of time (in seconds) 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.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="Show" functionID="ShowID" messagetype="request">
+ <description>Updates the persistent display. Supported fields depend on display capabilities.</description>
+
+ <param name="mainField1" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ The text that should be displayed in a single or upper display line.
+ If this text is not set, the text of mainField1 stays unchanged.
+ If this text is empty "", the field will be cleared.
+ </description>
+ </param>
+
+ <param name="mainField2" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ The text that should be displayed on the second display line.
+ If this text is not set, the text of mainField2 stays unchanged.
+ If this text is empty "", the field will be cleared.
+ </description>
+ </param>
+
+ <param name="mainField3" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ The text that should be displayed on the second "page" first display line.
+ If this text is not set, the text of mainField3 stays unchanged.
+ If this text is empty "", the field will be cleared.
+ </description>
+ </param>
+
+ <param name="mainField4" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ The text that should be displayed on the second "page" second display line.
+ If this text is not set, the text of mainField4 stays unchanged.
+ If this text is empty "", the field will be cleared.
+ </description>
+ </param>
+
+ <param name="alignment" type="TextAlignment" mandatory="false">
+ <description>
+ Specifies how mainField1 and mainField2 texts should be aligned on display.
+ If omitted, texts will be centered.
+ </description>
+ </param>
+
+ <param name="statusBar" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Requires investigation regarding the nav display capabilities. Potentially lower lowerStatusBar, upperStatusBar, titleBar, etc.</description>
+ </param>
+
+ <param name="mediaClock" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ Text value for MediaClock field. Has to be properly formatted by Mobile App according to the module's capabilities.
+ If this text is set, any automatic media clock updates previously set with SetMediaClockTimer will be stopped.
+ </description>
+ </param>
+
+ <param name="mediaTrack" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ The text that should be displayed in the track field.
+ If this text is not set, the text of mediaTrack stays unchanged.
+ If this text is empty "", the field will be cleared.
+ </description>
+ </param>
+
+ <param name="graphic" type="Image" mandatory="false">
+ <description>
+ Image struct determining whether static or dynamic image to display in app.
+ If omitted on supported displays, the displayed graphic shall not change.
+ </description>
+ </param>
+
+ <param name="secondaryGraphic" type="Image" mandatory="false">
+ <description>
+ Image struct determining whether static or dynamic secondary image to display in app.
+ If omitted on supported displays, the displayed secondary graphic shall not change.
+ </description>
+ </param>
+
+
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="8" array="true" mandatory="false">
+ <description>
+ App defined SoftButtons.
+ If omitted on supported displays, the currently displayed SoftButton values will not change.
+ </description>
+ </param>
+
+ <param name="customPresets" type="String" maxlength="500" minsize="0" maxsize="10" array="true" mandatory="false">
+ <description>
+ App labeled on-screen presets (i.e. on-screen media presets or dynamic search suggestions).
+ If omitted on supported displays, the presets will be shown as not defined.
+ </description>
+ </param>
+
+ <param name="metadataTags" type="MetadataTags" mandatory="false">
+ <description>App defined metadata information. See MetadataStruct. 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.</description>
+ </param>
+ </function>
+
+ <function name="Show" functionID="ShowID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="WARNINGS"/>
+ <element name="ABORTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="Speak" functionID="SpeakID" messagetype="request">
+ <description>Speaks a text.</description>
+
+ <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="true">
+ <description>
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="Speak" functionID="SpeakID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="ABORTED"/>
+ <element name="WARNINGS"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="SetMediaClockTimer" functionID="SetMediaClockTimerID" messagetype="request">
+ <description>Sets the initial media clock value and automatic update method.</description>
+
+ <param name="startTime" type="StartTime" mandatory="false">
+ <description>
+ See StartTime.
+ startTime must be provided for "COUNTUP" and "COUNTDOWN".
+ startTime will be ignored for "RESUME", and "CLEAR"
+ startTime can be sent for "PAUSE", in which case it will update the paused startTime
+ </description>
+ </param>
+
+ <param name="endTime" type="StartTime" mandatory="false">
+ <description>
+ See StartTime.
+ endTime can be provided for "COUNTUP" and "COUNTDOWN"; to be used to calculate any visual progress bar (if not provided, this feature is ignored)
+ If endTime is greater then startTime for COUNTDOWN or less than startTime for COUNTUP, then the request will return an INVALID_DATA.
+ endTime will be ignored for "RESUME", and "CLEAR"
+ endTime can be sent for "PAUSE", in which case it will update the paused endTime
+ </description>
+ </param>
+
+ <param name="updateMode" type="UpdateMode" mandatory="true">
+ <description>
+ Enumeration to control the media clock.
+ In case of pause, resume, or clear, the start time value is ignored and shall be left out. For resume, the time continues with the same value as it was when paused.
+ </description>
+ </param>
+ </function>
+
+ <function name="SetMediaClockTimer" functionID="SetMediaClockTimerID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="PerformAudioPassThru" functionID="PerformAudioPassThruID" messagetype="request">
+ <description>Starts audio pass thru session </description>
+ <param name="initialPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ The module will speak this prompt before opening the audio pass thru session.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ If omitted, then no initial prompt is spoken.
+ </description>
+ </param>
+ <param name="audioPassThruDisplayText1" type="String" mandatory="false" maxlength="500">
+ <description>First line of text displayed during audio capture.</description>
+ </param>
+ <param name="audioPassThruDisplayText2" type="String" mandatory="false" maxlength="500">
+ <description>Second line of text displayed during audio capture.</description>
+ </param>
+ <param name="samplingRate" type="SamplingRate" mandatory="true">
+ <description> This value shall be allowed at 8 kHz or 16 or 22 or 44 kHz.</description>
+ </param>
+ <param name="maxDuration" type="Integer" minvalue="1" maxvalue="1000000" mandatory="true">
+ <description>The maximum duration of audio recording in milliseconds. </description>
+ </param>
+ <param name="bitsPerSample" type="BitsPerSample" mandatory="true">
+ <description>Specifies the quality the audio is recorded. Currently 8 bit or 16 bit.</description>
+ </param>
+ <param name="audioType" type="AudioType" mandatory="true">
+ <description>Specifies the type of audio data being requested.</description>
+ </param>
+ <param name="muteAudio" type="Boolean" mandatory="false">
+ <description>
+ Defines 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.
+ </description>
+ </param>
+ </function>
+
+ <function name="PerformAudioPassThru" functionID="PerformAudioPassThruID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DISALLOWED"/>
+ <element name="REJECTED"/>
+ <element name="ABORTED"/>
+ <element name="RETRY"/>
+ <element name="WARNINGS"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="EndAudioPassThru" functionID="EndAudioPassThruID" messagetype="request">
+ <description>When this request is invoked, the audio capture stops.</description>
+ </function>
+
+ <function name="EndAudioPassThru" functionID="EndAudioPassThruID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="SubscribeButton" functionID="SubscribeButtonID" messagetype="request">
+ <description>
+ Subscribes to built-in HMI buttons.
+ The application will be notified by the OnButtonEvent and OnButtonPress.
+ To unsubscribe the notifications, use unsubscribeButton.
+ </description>
+
+ <param name="buttonName" type="ButtonName" mandatory="true">
+ <description>Name of the button to subscribe.</description>
+ </param>
+ </function>
+
+ <function name="SubscribeButton" functionID="SubscribeButtonID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="UNSUPPORTED_RESOURCE" />
+ <element name="IGNORED" />
+ <element name="REJECTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="UnsubscribeButton" functionID="UnsubscribeButtonID" messagetype="request">
+ <description>Unsubscribes from built-in HMI buttons.</description>
+
+ <param name="buttonName" type="ButtonName" mandatory="true">
+ <description>Name of the button to unsubscribe.</description>
+ </param>
+ </function>
+
+ <function name="UnsubscribeButton" functionID="UnsubscribeButtonID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="UNSUPPORTED_RESOURCE" />
+ <element name="IGNORED" />
+ <element name="REJECTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="SubscribeVehicleData" functionID="SubscribeVehicleDataID" messagetype="request">
+ <description>
+ Subscribes for specific published data items.
+ The data will be only sent if it has changed.
+ The application will be notified by the onVehicleData notification whenever new data is available.
+ To unsubscribe the notifications, use unsubscribe with the same subscriptionType.
+ </description>
+
+ <param name="gps" type="Boolean" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="Boolean" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="Boolean" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="Boolean" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="Boolean" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Boolean" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Boolean" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="prndl" type="Boolean" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="Boolean" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Boolean" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="Boolean" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="Boolean" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="Boolean" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="Boolean" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="Boolean" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="Boolean" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Boolean" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Boolean" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Boolean" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="Boolean" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="Boolean" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="Boolean" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="Boolean" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="Boolean" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="SubscribeVehicleData" functionID="SubscribeVehicleDataID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="WARNINGS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED" />
+ <element name="IGNORED" />
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="gps" type="VehicleDataResult" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="VehicleDataResult" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="VehicleDataResult" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="VehicleDataResult" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="VehicleDataResult" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="VehicleDataResult" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="VehicleDataResult" mandatory="false">
+ <description>The external temperature in degrees celsius.</description>
+ </param>
+ <param name="prndl" type="VehicleDataResult" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="VehicleDataResult" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="VehicleDataResult" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="VehicleDataResult" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="VehicleDataResult" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="VehicleDataResult" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="VehicleDataResult" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="VehicleDataResult" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="VehicleDataResult" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="VehicleDataResult" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="VehicleDataResult" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="VehicleDataResult" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModes" type="VehicleDataResult" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="VehicleDataResult" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="UnsubscribeVehicleData" functionID="UnsubscribeVehicleDataID" messagetype="request">
+ <description>This function is used to unsubscribe the notifications from the subscribeVehicleData function.</description>
+
+ <param name="gps" type="Boolean" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="Boolean" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="Boolean" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="Boolean" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="Boolean" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Boolean" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Boolean" mandatory="false">
+ <description>The external temperature in degrees celsius.</description>
+ </param>
+ <param name="prndl" type="Boolean" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="Boolean" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Boolean" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="Boolean" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="Boolean" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="Boolean" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="Boolean" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="Boolean" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="Boolean" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Boolean" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Boolean" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Boolean" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="Boolean" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="Boolean" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="Boolean" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="Boolean" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="Boolean" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="UnsubscribeVehicleData" functionID="UnsubscribeVehicleDataID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="WARNINGS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED" />
+ <element name="IGNORED" />
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="gps" type="VehicleDataResult" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="VehicleDataResult" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="VehicleDataResult" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="VehicleDataResult" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="VehicleDataResult" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="VehicleDataResult" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="VehicleDataResult" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="prndl" type="VehicleDataResult" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="VehicleDataResult" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="VehicleDataResult" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="VehicleDataResult" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="VehicleDataResult" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="VehicleDataResult" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="VehicleDataResult" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="VehicleDataResult" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="VehicleDataResult" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="VehicleDataResult" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="VehicleDataResult" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="VehicleDataResult" mandatory="false" >
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="VehicleDataResult" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModes" type="VehicleDataResult" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="VehicleDataResult" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="GetVehicleData" functionID="GetVehicleDataID" messagetype="request">
+ <description>Non periodic vehicle data read request.</description>
+
+ <param name="gps" type="Boolean" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="Boolean" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="Boolean" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="Boolean" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="Boolean" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Boolean" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Boolean" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="vin" type="Boolean" mandatory="false">
+ <description>Vehicle identification number</description>
+ </param>
+ <param name="prndl" type="Boolean" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="Boolean" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Boolean" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="Boolean" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="Boolean" mandatory="false">
+ <description>The body information including ignition status and internal temp</description>
+ </param>
+ <param name="deviceStatus" type="Boolean" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="Boolean" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="Boolean" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="Boolean" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Boolean" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Boolean" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Boolean" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="Boolean" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="Boolean" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="Boolean" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="Boolean" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="Boolean" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="GetVehicleData" functionID="GetVehicleDataID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="VEHICLE_DATA_NOT_ALLOWED"/>
+ <element name="VEHICLE_DATA_NOT_AVAILABLE"/>
+ <element name="USER_DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="gps" type="GPSData" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="ComponentVolumeStatus" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="vin" type="String" maxlength="17" mandatory="false">
+ <description>Vehicle identification number</description>
+ </param>
+ <param name="prndl" type="PRNDL" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="TireStatus" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="BeltStatus" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="BodyInformation" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="DeviceStatus" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="VehicleDataEventStatus" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="WiperStatus" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="HeadLampStatus" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="ECallInfo" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="AirbagStatus" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="EmergencyEvent" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="ClusterModeStatus" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="MyKey" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="ReadDID" functionID="ReadDIDID" messagetype="request">
+ <description>Non periodic vehicle data read request</description>
+
+ <param name="ecuName" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Name of ECU.</description>
+ </param>
+ <param name="didLocation" type="Integer" minvalue="0" maxvalue="65535" minsize="1" maxsize="1000" array="true" mandatory="true">
+ <description>Get raw data from vehicle data DID location(s)</description>
+ </param>
+ </function>
+
+ <function name="ReadDID" functionID="ReadDIDID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="TRUNCATED_DATA"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="didResult" type="DIDResult" minsize="0" maxsize="1000" array="true" mandatory="false">
+ <description>Array of requested DID results (with data if available).</description>
+ </param>
+
+ </function>
+
+ <function name="GetDTCs" functionID="GetDTCsID" messagetype="request">
+ <description>Vehicle module diagnostic trouble code request.</description>
+
+ <param name="ecuName" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Name of ECU.</description>
+ </param>
+
+ <param name="dtcMask" type="Integer" minvalue="0" maxvalue="255" mandatory="false">
+ <description>DTC Mask Byte to be sent in diagnostic request to module .</description>
+ </param>
+
+ </function>
+
+ <function name="GetDTCs" functionID="GetDTCsID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="TRUNCATED_DATA"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="ecuHeader" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>2 byte ECU Header for DTC response (as defined in VHR_Layout_Specification_DTCs.pdf)</description>
+ </param>
+
+ <param name="dtc" type="String" mandatory="false" minsize="1" maxsize="15" maxlength="10" array="true">
+ <description>
+ Array of all reported DTCs on module (ecuHeader contains information if list is truncated).
+ Each DTC is represented by 4 bytes (3 bytes of data and 1 byte status as defined in VHR_Layout_Specification_DTCs.pdf).
+ </description>
+ </param>
+
+ </function>
+
+ <function name="DiagnosticMessage" functionID="DiagnosticMessageID" messagetype="request">
+ <description>Non periodic vehicle diagnostic request</description>
+
+ <param name="targetID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Name of target ECU.</description>
+ </param>
+
+ <param name="messageLength" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Length of message (in bytes).</description>
+ </param>
+
+ <param name="messageData" type="Integer" minvalue="0" maxvalue="255" minsize="1" maxsize="65535" array="true" mandatory="true">
+ <description>
+ Array of bytes comprising CAN message.
+ </description>
+ </param>
+ </function>
+
+ <function name="DiagnosticMessage" functionID="DiagnosticMessageID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="TRUNCATED_DATA"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="messageDataResult" type="Integer" minvalue="0" maxvalue="255" minsize="1" maxsize="65535" array="true" mandatory="true">
+ <description>
+ Array of bytes comprising CAN message result.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="ScrollableMessage" functionID="ScrollableMessageID" messagetype="request">
+ <description>Creates a full screen overlay containing a large block of formatted text that can be scrolled with up to 8 SoftButtons defined</description>
+ <param name="scrollableMessageBody" type="String" maxlength="500" mandatory="true">
+ <description>Body of text that can include newlines and tabs.</description>
+ </param>
+ <param name="timeout" type="Integer" minvalue="1000" maxvalue="65535" defvalue="30000" mandatory="false">
+ <description>App defined timeout. Indicates how long of a timeout from the last action (i.e. scrolling message resets timeout).</description>
+ </param>
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="8" array="true" mandatory="false">
+ <description>
+ App defined SoftButtons.
+ If omitted on supported displays, only the system defined "Close" SoftButton will be displayed.
+ </description>
+ </param>
+ </function>
+
+ <function name="ScrollableMessage" functionID="ScrollableMessageID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="CHAR_LIMIT_EXCEEDED"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="REJECTED"/>
+ <element name="ABORTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="Slider" functionID="SliderID" messagetype="request">
+ <description>Creates a full screen or pop-up overlay (depending on platform) with a single user controlled slider.</description>
+ <param name="numTicks" type="Integer" minvalue="2" maxvalue="26" mandatory="true">
+ <description>Number of selectable items on a horizontal axis</description>
+ </param>
+ <param name="position" type="Integer" minvalue="1" maxvalue="26" mandatory="true">
+ <description>Initial position of slider control (cannot exceed numTicks)</description>
+ </param>
+ <param name="sliderHeader" type="String" maxlength="500" mandatory="true">
+ <description>Text header to display</description>
+ </param>
+ <param name="sliderFooter" type="String" maxlength="500" minsize="1" maxsize="26" array="true" mandatory="false">
+ <description>
+ Text footer to display (meant to display min/max threshold descriptors).
+ For a static text footer, only one footer string shall be provided in the array.
+ For a dynamic text footer, the number of footer text string in the array must match the numTicks value.
+ For a dynamic text footer, text array string should correlate with potential slider position index.
+ If omitted on supported displays, no footer text shall be displayed.
+ </description>
+ </param>
+ <param name="timeout" type="Integer" minvalue="1000" maxvalue="65535" defvalue="10000" mandatory="false">
+ <description>
+ App defined timeout. Indicates how long of a timeout from the last action (i.e. sliding control resets timeout).
+ If omitted, the value is set to 10000.
+ </description>
+ </param>
+ </function>
+
+ <function name="Slider" functionID="SliderID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="SAVED"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="REJECTED"/>
+ <element name="ABORTED"/>
+ <element name="TIMED_OUT"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="sliderPosition" type="Integer" minvalue="1" maxvalue="26" mandatory="false">
+ <description>
+ Current slider value returned when saved or canceled (aborted)
+ This value is only returned for resultCodes "SAVED" or "ABORTED"
+ </description>
+ </param>
+ </function>
+
+ <function name="ShowConstantTBT" functionID="ShowConstantTBTID" messagetype="request">
+ <param name="navigationText1" type="String" minlength="0" maxlength="500" mandatory="false">
+ </param>
+ <param name="navigationText2" type="String" minlength="0" maxlength="500" mandatory="false">
+ </param>
+ <param name="eta" type="String" minlength="0" maxlength="500" mandatory="false">
+ </param>
+ <param name="timeToDestination" type="String" minlength="0" maxlength="500" mandatory="false">
+ </param>
+ <param name="totalDistance" type="String" minlength="0" maxlength="500" mandatory="false">
+ </param>
+ <param name="turnIcon" type="Image" mandatory="false">
+ </param>
+ <param name="nextTurnIcon" type="Image" mandatory="false">
+ </param>
+ <param name="distanceToManeuver" type="Float" minvalue="0" maxvalue="1000000000" mandatory="false">
+ <description>
+ Fraction of distance till next maneuver (starting from when AlertManeuver is triggered).
+ Used to calculate progress bar.
+ </description>
+ </param>
+ <param name="distanceToManeuverScale" type="Float" minvalue="0" maxvalue="1000000000" mandatory="false">
+ <description>
+ Distance till next maneuver (starting from) from previous maneuver.
+ Used to calculate progress bar.
+ </description>
+ </param>
+ <param name="maneuverComplete" type="Boolean" mandatory="false">
+ <description>
+ If and when a maneuver has completed while an AlertManeuver is active, the app must send this value set to TRUE in order to clear the AlertManeuver overlay.
+ If omitted the value will be assumed as FALSE.
+ </description>
+ </param>
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="3" array="true" mandatory="false">
+ <description>
+ Three dynamic SoftButtons available (first SoftButton is fixed to "Turns").
+ If omitted on supported displays, the currently displayed SoftButton values will not change.
+ </description>
+ </param>
+ </function>
+
+ <function name="ShowConstantTBT" functionID="ShowConstantTBTID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="AlertManeuver" functionID="AlertManeuverID" messagetype="request">
+ <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>An array of text chunks of type TTSChunk. See TTSChunk</description>
+ </param>
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="3" array="true" mandatory="false">
+ <description>If omitted on supported displays, only the system defined "Close" SoftButton shall be displayed.</description>
+ </param>
+ </function>
+
+ <function name="AlertManeuver" functionID="AlertManeuverID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="ABORTED"/>
+ <element name="WARNINGS"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="UpdateTurnList" functionID="UpdateTurnListID" messagetype="request">
+ <param name="turnList" type="Turn" minsize="1" maxsize="100" array="true" mandatory="false">
+ </param>
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="1" array="true" mandatory="false">
+ <description>If omitted on supported displays, app-defined SoftButton will be left blank.</description>
+ </param>
+ </function>
+
+ <function name="UpdateTurnList" functionID="UpdateTurnListID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="ChangeRegistration" functionID="ChangeRegistrationID" messagetype="request">
+ <param name="language" type="Language" mandatory="true">
+ <description>Requested voice engine (VR+TTS) language registration</description>
+ </param>
+ <param name="hmiDisplayLanguage" type="Language" mandatory="true">
+ <description>Request display language registration</description>
+ </param>
+ <param name="appName" type="String" maxlength="100" mandatory="false">
+ <description>Request new app name registration</description>
+ </param>
+ <param name="ttsName" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
+ <description>Request new ttsName registration</description>
+ </param>
+ <param name="ngnMediaScreenAppName" type="String" maxlength="100" mandatory="false">
+ <description>Request new app short name registration</description>
+ </param>
+ <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>Request new VR synonyms registration</description>
+ </param>
+
+ </function>
+
+
+
+ <function name="ChangeRegistration" functionID="ChangeRegistrationID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description>
+ true, if successful
+ false, if failed
+ </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="GenericResponse" functionID="GenericResponseID" messagetype="response">
+ <description>
+ Generic Response is sent, when the name of a received msg cannot be retrieved. Only used in case of an error.
+ Currently, only resultCode INVALID_DATA is used.
+ </description>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="INVALID_DATA"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="PutFile" functionID="PutFileID" messagetype="request">
+ <description>
+ Used to push a binary data onto the module from a mobile device, such as icons and album art
+ Not supported on first generation of SDL enabled modules.
+ Binary data is in binary part of hybrid msg.
+ </description>
+
+ <param name="syncFileName" type="String" maxlength="255" mandatory="true">
+ <description>File reference name.</description>
+ </param>
+
+ <param name="fileType" type="FileType" mandatory="true">
+ <description>Selected file type.</description>
+ </param>
+
+ <param name="persistentFile" type="Boolean" defvalue="false" mandatory="false">
+ <description>
+ 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.
+ </description>
+ </param>
+
+ <param name="systemFile" type="Boolean" defvalue="false" mandatory="false" >
+ <description>
+ Indicates if the file is meant to be passed thru core to elsewhere on the system.
+ If set to TRUE, then the system will instead pass the data thru as it arrives to a predetermined area outside of core.
+ If omitted, the value will be set to false.
+ </description>
+ </param>
+
+ <param name="offset" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>Optional offset in bytes for resuming partial data chunks</description>
+ </param>
+ <param name="length" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>
+ 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
+ </description>
+ </param>
+ </function>
+
+ <function name="PutFile" functionID="PutFileID" messagetype="response">
+ <description>Response is sent, when the file data was copied (success case). Or when an error occurred.</description>
+ <description>Not supported on first generation SDL enabled vehicles. </description>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ </param>
+
+ <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>
+ Provides the total local space available in SDL Core for the registered app.
+ If the transfer has systemFile enabled, then the value will be set to 0 automatically.
+ </description>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="DeleteFile" functionID="DeleteFileID" messagetype="request">
+ <description>
+ Used to delete a file resident on the module in the app's local cache.
+ Not supported on first generation SDL enabled vehicles.
+ </description>
+
+ <param name="syncFileName" type="String" maxlength="500" mandatory="true">
+ <description>File reference name.</description>
+ </param>
+
+ </function>
+
+ <function name="DeleteFile" functionID="DeleteFileID" messagetype="response">
+ <description>
+ Response is sent, when the file data was deleted (success case). Or when an error occurred.
+ Not supported on First generation SDL enabled vehicles.
+ </description>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ </param>
+
+ <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>Provides the total local space available on the module for the registered app.</description>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="ListFiles" functionID="ListFilesID" messagetype="request">
+ <description>
+ Requests the current list of resident filenames for the registered app.
+ Not supported on first generation SDL enabled vehicles.
+ </description>
+ </function>
+
+ <function name="ListFiles" functionID="ListFilesID" messagetype="response">
+ <description>
+ Returns the current list of resident filenames for the registered app along with the current space available
+ Not supported on First generation SDL enabled vehicles.
+ </description>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ </param>
+
+ <param name="filenames" type="String" maxlength="500" minsize="0" maxsize="1000" array="true" mandatory="false">
+ <description>
+ An array of all filenames resident on the module for the given registered app.
+ If omitted, then no files currently reside on the system.
+ </description>
+ </param>
+
+ <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>Provides the total local space available on the module for the registered app.</description>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="SetAppIcon" functionID="SetAppIconID" messagetype="request">
+ <description>
+ Used to set existing local file on the module as the app's icon
+ Not supported on first generation SDL enabled vehicles.
+ </description>
+
+ <param name="syncFileName" type="String" maxlength="500" mandatory="true">
+ <description>File reference name.</description>
+ </param>
+
+ </function>
+
+ <function name="SetAppIcon" functionID="SetAppIconID" messagetype="response">
+ <description>
+ Response is sent, when the file data was copied (success case). Or when an error occurred.
+ Not supported on First generation SDL enabled vehicles.
+ </description>
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="request">
+ <description>
+ Used to set an alternate display layout.
+ If not sent, default screen for given platform will be shown
+ </description>
+
+ <param name="displayLayout" type="String" maxlength="500" mandatory="true">
+ <description>
+ Predefined or dynamically created screen layout.
+ Currently only predefined screen layouts are defined.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ </param>
+
+ <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false">
+ <description>See DisplayCapabilities</description>
+ </param>
+
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See ButtonCapabilities</description >
+ </param>
+
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
+ </param>
+
+ <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false">
+ <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="SystemRequest" functionID="SystemRequestID" messagetype="request" >
+ <description>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)</description>
+ <param name="requestType" type="RequestType" mandatory="true">
+ <description>
+ The type of system request.
+ Note that Proprietary requests should forward the binary data to the known proprietary module on the system.
+ </description>
+ </param>
+ <param name="fileName" type="String" maxlength="255" mandatory="false">
+ <description>
+ Filename of HTTP data to store in predefined system staging area.
+ Mandatory if requestType is HTTP.
+ PROPRIETARY requestType should ignore this parameter.
+ </description>
+ </param>
+ </function>
+
+ <function name="SystemRequest" functionID="SystemRequestID" messagetype="response" >
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_CERT"/>
+ <element name="EXPIRED_CERT"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="DISALLOWED"/>
+ <element name="ABORTED"/>
+ <element name="WARNINGS"/>
+ <element name="TIMED_OUT"/>
+ <element name="IGNORED"/>
+ </param>
+ </function>
+
+ <function name="SendLocation" functionID="SendLocationID" messagetype="request">
+ <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="false">
+ </param>
+ <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="false">
+ </param>
+ <param name="locationName" type="String" maxlength="500" mandatory="false">
+ <description>
+ Name / title of intended location
+ </description>
+ </param>
+ <param name="locationDescription" type="String" maxlength="500" mandatory="false">
+ <description>
+ Description intended location / establishment (if applicable)
+ </description>
+ </param>
+ <param name="addressLines" type="String" maxlength="500" minsize="0" maxsize="4" array="true" mandatory="false">
+ <description>
+ Location address (if applicable)
+ </description>
+ </param>
+ <param name="phoneNumber" type="String" maxlength="500" mandatory="false">
+ <description>
+ Phone number of intended location / establishment (if applicable)
+ </description>
+ </param>
+ <param name="locationImage" type="Image" mandatory="false">
+ <description>
+ Image / icon of intended location (if applicable and supported)
+ </description>
+ </param>
+
+ <param name="timeStamp" type="DateTime" mandatory="false">
+ <description>
+ timestamp in ISO 8601 format
+ </description>
+ </param>
+
+ <param name="address" type="OASISAddress" mandatory="false">
+ <description>Address to be used for setting destination</description>
+ </param>
+ <param name="deliveryMode" type="DeliveryMode" mandatory="false">
+ <description>Defines the mode of prompt for user</description>
+ </param>
+ </function>
+
+ <function name="SendLocation" functionID="SendLocationID" messagetype="response" >
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="DialNumber" functionID="DialNumberID" messagetype="request">
+ <description>Dials a phone number and switches to phone application.</description>
+
+ <param name="number" type="String" maxlength="40" mandatory="true">
+ <description>
+ Phone number is a string, which can be up to 40 chars.
+ All characters shall be stripped from string except digits 0-9 and * # , ; +
+ </description>
+ </param>
+ </function>
+
+ <function name="DialNumber" functionID="DialNumberID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description>true, if successful</description>
+ <description>false, if failed</description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="ButtonPress" functionID="ButtonPressID" messagetype="request">
+ <param name="moduleType" type="ModuleType" mandatory="true">
+ <description>The module where the button should be pressed</description>
+ </param>
+ <param name="buttonName" type="ButtonName" mandatory="true">
+ <description>The name of supported RC climate or radio button.</description>
+ </param>
+ <param name="buttonPressMode" type="ButtonPressMode" mandatory="true">
+ <description>Indicates whether this is a LONG or SHORT button press event.</description>
+ </param>
+ </function>
+
+ <function name="ButtonPress" functionID="ButtonPressID" messagetype="response">
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="IN_USE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ </param>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+ </function>
+
+ <function name="GetInteriorVehicleData" functionID="GetInteriorVehicleDataID" messagetype="request">
+ <param name="moduleType" type="ModuleType" mandatory="true">
+ <description>
+ The type of a RC module to retrieve module data from the vehicle.
+ In the future, this should be the Identification of a module.
+ </description>
+ </param>
+ <param name="subscribe" type="Boolean" mandatory="false" defvalue="false">
+ <description>
+ If subscribe is true, the head unit will register onInteriorVehicleData notifications for the requested moduelType.
+ If subscribe is false, the head unit will unregister onInteriorVehicleData notifications for the requested moduelType.
+ </description>
+ </param>
+ </function>
+
+ <function name="GetInteriorVehicleData" functionID="GetInteriorVehicleDataID" messagetype="response">
+ <param name="moduleData" type="ModuleData" mandatory="true">
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ </param>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+ <param name="isSubscribed" type="Boolean" mandatory="false" >
+ <description>
+ 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.
+ </description>
+ </param>
+ </function>
+
+ <function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="request">
+ <param name="moduleData" type="ModuleData" mandatory="true">
+ <description>The module data to set for the requested RC module.</description>
+ </param>
+ </function>
+
+ <function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="response">
+ <description>Used to set the values of one remote control module </description>
+ <param name="moduleData" type="ModuleData" mandatory="true">
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="READ_ONLY"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="IN_USE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ </param>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+ </function>
+
+ <function name="SubscribeWayPoints" functionID="SubscribeWayPointsID" messagetype="request">
+ <description>To subscribe in getting changes for Waypoints/destinations</description>
+ </function>
+
+ <function name="SubscribeWayPoints" functionID="SubscribeWayPointsID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="GetWayPoints" functionID="GetWayPointsID" messagetype="request">
+ <description>Request for getting waypoint/destination data.</description>
+ <param name="wayPointType" type="WayPointType" mandatory="true">
+ <description>To request for either the destination only or for all waypoints including destination</description>
+ </param>
+ </function>
+
+ <function name="GetWayPoints" functionID="GetWayPointsID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="TIMED_OUT"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="IGNORED"/>
+ <element name="IN_USE"/>
+ <element name="DISALLOWED"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ <param name="wayPoints" type="LocationDetails" mandatory="false" array="true" minsize="1" maxsize="10">
+ <description>See LocationDetails</description>
+ </param>
+ </function>
+
+ <function name="UnsubscribeWayPoints" functionID="UnsubscribeWayPointsID" messagetype="request">
+ <description>Request to unsubscribe from WayPoints and Destination</description>
+ </function>
+
+ <function name="UnsubscribeWayPoints" functionID="UnsubscribeWayPointsID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ <param name="wayPoints" type="LocationDetails" mandatory="false" array="true" minsize="1" maxsize="10">
+ <description>See LocationDetails</description>
+ </param>
+ </function>
+
+ <function name="GetSystemCapability" functionID="GetSystemCapabilityID" messagetype="request">
+ <description>Request for expanded information about a supported system/HMI capability</description>
+ <param name="systemCapabilityType" type="SystemCapabilityType" mandatory="true">
+ <description>The type of system capability to get more information on</description>
+ </param>
+ </function>
+
+ <function name="GetSystemCapability" functionID="GetSystemCapabilityID" messagetype="response">
+ <param name="systemCapability" type="SystemCapability" mandatory="true">
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE">
+ <description>The capability does not exist on the module</description>
+ </element>
+ <element name="DATA_NOT_AVAILABLE">
+ <description>The capability should exist on the module but there was an error retrieving the data.</description>
+ </element>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+ </function>
+
+ <function name="SendHapticData" functionID="SendHapticDataID" messagetype="request">
+ <description>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</description>
+ <param name="hapticRectData" type="HapticRect" minsize="0" maxsize="1000" mandatory="false" array="true">
+ <description>Array of spatial data structures that represent the locations of all user controls present on the HMI. 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</description>
+ </param>
+ </function>
+
+ <function name="SendHapticData" functionID="SendHapticDataID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false if failed </description>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="GENERIC_ERROR"/>
+ </param>
+ </function>
+
+ <!-- Notifications -->
+
+ <function name="OnHMIStatus" functionID="OnHMIStatusID" messagetype="notification">
+ <param name="hmiLevel" type="HMILevel" mandatory="true">
+ <description>See HMILevel</description>
+ </param>
+
+ <param name="audioStreamingState" type="AudioStreamingState" mandatory="true">
+ <description>See AudioStreamingState</description>
+ </param>
+
+ <param name="systemContext" type="SystemContext" mandatory="true">
+ <description>See SystemContext</description>
+ </param>
+ </function>
+
+ <function name="OnAppInterfaceUnregistered" functionID="OnAppInterfaceUnregisteredID" messagetype="notification">
+ <param name="reason" type="AppInterfaceUnregisteredReason" mandatory="true">
+ <description>See AppInterfaceUnregisteredReason</description>
+ </param>
+ </function>
+
+ <function name="OnButtonEvent" functionID="OnButtonEventID" messagetype="notification">
+ <description>Notifies application of UP/DOWN events for buttons to which the application is subscribed.</description>
+ <param name="buttonName" type="ButtonName" mandatory="true"/>
+ <param name="buttonEventMode" type="ButtonEventMode" mandatory="true">
+ <description>Indicates whether this is an UP or DOWN event.</description>
+ </param>
+ <param name="customButtonID" type="Integer" minvalue="0" maxvalue="65536" mandatory="false">
+ <description>If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID)</description>
+ </param>
+ </function>
+
+ <function name="OnButtonPress" functionID="OnButtonPressID" messagetype="notification">
+ <description>Notifies application of LONG/SHORT press events for buttons to which the application is subscribed.</description>
+ <param name="buttonName" type="ButtonName" mandatory="true"/>
+ <param name="buttonPressMode" type="ButtonPressMode" mandatory="true">
+ <description>Indicates whether this is a LONG or SHORT button press event.</description>
+ </param>
+ <param name="customButtonID" type="Integer" minvalue="0" maxvalue="65536" mandatory="false">
+ <description>If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID)</description>
+ </param>
+ </function>
+
+ <function name="OnVehicleData" functionID="OnVehicleDataID" messagetype="notification">
+ <description>Callback for the periodic and non periodic vehicle data read function.</description>
+ <param name="gps" type="GPSData" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="ComponentVolumeStatus" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="vin" type="String" maxlength="17" mandatory="false">
+ <description>Vehicle identification number.</description>
+ </param>
+ <param name="prndl" type="PRNDL" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="TireStatus" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="BeltStatus" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="BodyInformation" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="DeviceStatus" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="VehicleDataEventStatus" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="WiperStatus" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="HeadLampStatus" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Vehicle Data -->
+ <param name="eCallInfo" type="ECallInfo" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="AirbagStatus" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="EmergencyEvent" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="ClusterModeStatus" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="MyKey" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Vehicle Data -->
+
+ </function>
+
+ <function name="OnCommand" functionID="OnCommandID" messagetype="notification">
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>Command ID, which is related to a specific menu entry</description>
+ </param>
+
+ <param name="triggerSource" type="TriggerSource" mandatory="true">
+ <description>See TriggerSource</description>
+ </param>
+ </function>
+
+ <function name="OnTBTClientState" functionID="OnTBTClientStateID" messagetype="notification" >
+ <description>Provides applications with notifications specific to the current TBT client status on the module</description>
+ <param name="state" type="TBTState" mandatory="true">
+ <description>Current State of TBT client</description>
+ </param>
+ </function>
+
+ <function name="OnDriverDistraction" functionID="OnDriverDistractionID" messagetype="notification" >
+ <description>Provides driver distraction state to mobile applications</description>
+ <param name="state" type="DriverDistractionState" mandatory="true">
+ <description>Current State of Driver Distraction</description>
+ </param>
+ </function>
+
+ <function name="OnPermissionsChange" functionID="OnPermissionsChangeID" messagetype="notification" >
+ <description>Provides update to app of which policy-table-enabled functions are available</description>
+ <param name="permissionItem" type="PermissionItem" minsize="0" maxsize="500" array="true" mandatory="true">
+ <description>Change in permissions for a given set of RPCs</description>
+ </param>
+ </function>
+
+ <function name="OnAudioPassThru" functionID="OnAudioPassThruID" messagetype="notification">
+ <description>Binary data is in binary part of hybrid msg</description>
+ </function>
+
+ <function name="OnLanguageChange" functionID="OnLanguageChangeID" messagetype="notification">
+ <param name="language" type="Language" mandatory="true">
+ <description>Current SDL voice engine (VR+TTS) language</description>
+ </param>
+ <param name="hmiDisplayLanguage" type="Language" mandatory="true">
+ <description>Current display language</description>
+ </param>
+ </function>
+
+ <function name="OnKeyboardInput" functionID="OnKeyboardInputID" messagetype="notification" >
+
+ <description>On-screen keyboard event.</description>
+ <description>Can be full string or individual keypresses depending on keyboard mode.</description>
+
+ <param name="event" type="KeyboardEvent" mandatory="true">
+ <description>On-screen keyboard input data.</description>
+ </param>
+
+ <param name="data" type="String" maxlength="500" mandatory="false">
+ <description>On-screen keyboard input data.</description>
+ <description>For dynamic keypress events, this will be the current compounded string of entry text.</description>
+ <description>For entry submission events, this will be the full text entry (this will always return regardless of the mode).</description>
+ <description>For entry cancelled and entry aborted events, this data param will be omitted.</description>
+ </param>
+
+ </function>
+
+ <function name="OnTouchEvent" functionID="OnTouchEventID" messagetype="notification" >
+ <description>Notifies about touch events on the screen's prescribed area</description>
+ <param name="type" type="TouchType" mandatory="true">
+ <description>The type of touch event.</description>
+ </param>
+ <param name="event" type="TouchEvent" mandatory="true" minsize="1" maxsize="10" array="true">
+ <description>List of all individual touches involved in this event.</description>
+ </param>
+ </function>
+
+ <function name="OnSystemRequest" functionID="OnSystemRequestID" messagetype="notification" >
+ <description>
+ 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)
+ </description>
+ <param name="requestType" type="RequestType" mandatory="true">
+ <description>The type of system request.</description>
+ </param>
+ <param name="url" type="String" maxlength="1000" mandatory="false">
+ <description>
+ Optional URL for HTTP requests.
+ If blank, the binary data shall be forwarded to the app.
+ If not blank, the binary data shall be forwarded to the url with a provided timeout in seconds.
+ </description>
+ </param>
+ <param name="timeout" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>
+ Optional timeout for HTTP requests
+ Required if a URL is provided
+ </description>
+ </param>
+ <param name="fileType" type="FileType" mandatory="false">
+ <description>Optional file type (meant for HTTP file requests).</description>
+ </param>
+ <param name="offset" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
+ <description>Optional offset in bytes for resuming partial data chunks</description>
+ </param>
+ <param name="length" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
+ <description>Optional length in bytes for resuming partial data chunks</description>
+ </param>
+ </function>
+
+ <function name="OnHashChange" functionID="OnHashChangeID" messagetype="notification">
+ <description>
+ 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.
+ </description>
+ <param name="hashID" type="String" maxlength="100" mandatory="true">
+ <description>Calculated hash ID to be referenced during RegisterAppInterface.</description>
+ </param>
+ </function>
+
+ <function name="OnWayPointChange" functionID="OnWayPointChangeID" messagetype="notification">
+ <description>Notification which provides the entire LocationDetails when there is a change to any waypoints or destination.</description>
+ <param name="wayPoints" type="LocationDetails" mandatory="true" array="true" minsize="1" maxsize="10">
+ <description>See LocationDetails</description>
+ </param>
+ </function>
+
+ <function name="OnInteriorVehicleData" functionID="OnInteriorVehicleDataID" messagetype="notification">
+ <param name="moduleData" type="ModuleData" mandatory="true">
+ </param>
+ </function>
+
+ <!-- ~~~~~~~~~~~~~~~~~~ -->
+ <!-- Ford Specific APIs -->
+ <!-- ~~~~~~~~~~~~~~~~~~ -->
+
+ <function name="EncodedSyncPData" functionID="EncodedSyncPDataID" messagetype="request" >
+ <description>
+ Allows encoded data in the form of SyncP packets to be sent to the SYNC module.
+ Legacy / v1 Protocol implementation; use SyncPData instead.
+ *** DEPRECATED ***
+ </description>
+
+ <param name="data" type="String" maxlength="1000000" minsize="1" maxsize="100" array="true" mandatory="true">
+ <description>Contains base64 encoded string of SyncP packets.</description>
+ <todo>What is the maxlength?</todo>
+ </param>
+ </function>
+
+ <function name="EncodedSyncPData" functionID="EncodedSyncPDataID" messagetype="response" >
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <!-- Deprecating - covered by SystemRequest
+ <function name="SyncPData" functionID="SyncPDataID" messagetype="request" >
+ <description>
+ Allows binary data in the form of SyncP packets to be sent to the SYNC module.
+ Binary data is in binary part of hybrid msg.
+ </description>
+ </function>
+
+ <function name="SyncPData" functionID="SyncPDataID" messagetype="response" >
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+ -->
+
+ <function name="OnEncodedSyncPData" functionID="OnEncodedSyncPDataID" messagetype="notification" >
+ <description>
+ Callback including encoded data of any SyncP packets that SYNC needs to send back to the mobile device.
+ Legacy / v1 Protocol implementation; responds to EncodedSyncPData.
+ *** DEPRECATED ***
+ </description>
+ <param name="data" type="String" maxlength="1000000" minsize="1" maxsize="100" mandatory="true" array="true">
+ <description>Contains base64 encoded string of SyncP packets.</description>
+ </param>
+ <param name="URL" type="String" maxlength="1000" mandatory="false">
+ <description>
+ If blank, the SyncP data shall be forwarded to the app.
+ If not blank, the SyncP data shall be forwarded to the provided URL.
+ </description>
+ </param>
+ <param name="Timeout" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>
+ If blank, the SyncP data shall be forwarded to the app.
+ If not blank, the SyncP data shall be forwarded with the provided timeout in seconds.
+ </description>
+ </param>
+ </function>
+
+
+ <!-- Deprecating - covered by OnSystemRequest
+ <function name="OnSyncPData" functionID="OnSyncPDataID" messagetype="notification" >
+ <description>
+ Callback including binary data of any SyncP packets that SYNC needs to send back to the mobile device.
+ Responds to SyncPData.
+ Binary data is in binary part of hybrid msg.
+ </description>
+
+ <param name="URL" type="String" maxlength="1000" mandatory="false">
+ <description>
+ If blank, the SyncP data shall be forwarded to the app.
+ If not blank, the SyncP data shall be forwarded to the provided URL.
+ </description>
+ </param>
+ <param name="Timeout" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>
+ If blank, the SyncP data shall be forwarded to the app.
+ If not blank, the SyncP data shall be forwarded with the provided timeout in seconds.
+ </description>
+ </param>
+
+ </function>
+ -->
+</interface> \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
new file mode 100644
index 000000000..c3e39ce5a
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlPacketTests.java
@@ -0,0 +1,75 @@
+package com.smartdevicelink.protocol;
+
+import android.test.AndroidTestCase;
+
+import com.livio.BSON.BsonEncoder;
+import com.smartdevicelink.protocol.enums.ControlFrameTags;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SdlPacketTests extends AndroidTestCase {
+ //TODO: Add tests to cover other parts of SdlPacket class
+
+ // 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");
+
+ 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");
+ }
+
+ 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);
+ }
+
+ 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/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/WiProProtocolTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/WiProProtocolTests.java
index 5eb04ca81..1055f5deb 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/WiProProtocolTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/WiProProtocolTests.java
@@ -1,29 +1,22 @@
package com.smartdevicelink.protocol;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import junit.framework.Assert;
+import android.test.AndroidTestCase;
+import android.util.Log;
-import com.smartdevicelink.protocol.IProtocolListener;
-import com.smartdevicelink.protocol.ProtocolMessage;
-import com.smartdevicelink.protocol.SdlPacket;
-import com.smartdevicelink.protocol.WiProProtocol;
+import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.protocol.WiProProtocol.MessageFrameAssembler;
-import com.smartdevicelink.protocol.enums.MessageType;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.test.SampleRpc;
-import com.smartdevicelink.util.DebugTool;
-import java.io.ByteArrayOutputStream;
-
-import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.test.SdlUnitTestContants;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
import com.smartdevicelink.transport.RouterServiceValidator;
-import android.test.AndroidTestCase;
-import android.util.Log;
+import junit.framework.Assert;
+
+import java.io.ByteArrayOutputStream;
+import java.lang.reflect.Method;
+import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -45,7 +38,7 @@ public class WiProProtocolTests extends AndroidTestCase {
@Override
public void onProtocolSessionStarted(SessionType sessionType,byte sessionID, byte version, String correlationID, int hashID,boolean isEncrypted){}
@Override
- public void onProtocolSessionNACKed(SessionType sessionType,byte sessionID, byte version, String correlationID) {}
+ public void onProtocolSessionNACKed(SessionType sessionType,byte sessionID, byte version, String correlationID, List<String> rejectedParams) {}
@Override
public void onProtocolSessionEnded(SessionType sessionType,byte sessionID, String correlationID) {}
@Override
@@ -84,7 +77,7 @@ public class WiProProtocolTests extends AndroidTestCase {
@Override
public void onProtocolSessionStarted(SessionType sessionType,byte sessionID, byte version, String correlationID, int hashID,boolean isEncrypted){}
@Override
- public void onProtocolSessionNACKed(SessionType sessionType,byte sessionID, byte version, String correlationID) {}
+ public void onProtocolSessionNACKed(SessionType sessionType,byte sessionID, byte version, String correlationID, List<String> rejectedParams) {}
@Override
public void onProtocolSessionEnded(SessionType sessionType,byte sessionID, String correlationID) {}
@Override
@@ -126,11 +119,15 @@ public class WiProProtocolTests extends AndroidTestCase {
wiProProtocol = new WiProProtocol(defaultListener);
wiProProtocol.setVersion((byte)0x04);
assertEquals((byte)0x04,wiProProtocol.getVersion());
-
- //If we get newer than 4, it should fall back to 4
+
wiProProtocol = new WiProProtocol(defaultListener);
wiProProtocol.setVersion((byte)0x05);
- assertEquals((byte)0x04,wiProProtocol.getVersion());
+ assertEquals((byte)0x05,wiProProtocol.getVersion());
+
+ //If we get newer than 5, it should fall back to 5
+ wiProProtocol = new WiProProtocol(defaultListener);
+ wiProProtocol.setVersion((byte)0x06);
+ assertEquals((byte)0x05,wiProProtocol.getVersion());
//Is this right?
wiProProtocol = new WiProProtocol(defaultListener);
@@ -144,31 +141,27 @@ public class WiProProtocolTests extends AndroidTestCase {
wiProProtocol.setVersion((byte)0x01);
try{
- Field field = wiProProtocol.getClass().getDeclaredField("MAX_DATA_SIZE");
- field.setAccessible(true);
- int mtu = (Integer) field.get(wiProProtocol);
- assertEquals(mtu, 1500-8);
- //Ok our reflection works we can test the rest of the cases
-
+ assertEquals(wiProProtocol.getMtu(), 1500-8);
+
//Version 2
wiProProtocol.setVersion((byte)0x02);
- mtu = (Integer) field.get(wiProProtocol);
- assertEquals(mtu, 1500-12);
+ assertEquals(wiProProtocol.getMtu(), 1500-12);
//Version 3
wiProProtocol.setVersion((byte)0x03);
- mtu = (Integer) field.get(wiProProtocol);
- assertEquals(mtu, 131072);
+ assertEquals(wiProProtocol.getMtu(), 131072);
//Version 4
wiProProtocol.setVersion((byte)0x04);
- mtu = (Integer) field.get(wiProProtocol);
- assertEquals(mtu, 131072);
+ assertEquals(wiProProtocol.getMtu(), 131072);
- //Version 4+
+ //Version 5
wiProProtocol.setVersion((byte)0x05);
- mtu = (Integer) field.get(wiProProtocol);
- assertEquals(mtu, 1500-12);
+ assertEquals(wiProProtocol.getMtu(), 131072);
+
+ //Version 5+
+ wiProProtocol.setVersion((byte)0x06);
+ assertEquals(wiProProtocol.getMtu(), 131072);
}catch(Exception e){
Assert.fail("Exceptin during reflection");
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
index 9670492b0..c30f26a7f 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
@@ -168,7 +168,7 @@ public abstract class BaseRpcTests extends AndroidTestCase {
Integer correlationId;
if (msg instanceof RPCRequest) {
correlationId = ((RPCRequest) msg).getCorrelationID();
- assertNull("Correlation ID of the RPC message was not null.", correlationId);
+ 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) {
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlConnection/SdlSessionTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlConnection/SdlSessionTests.java
new file mode 100644
index 000000000..ec7bf710a
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/SdlConnection/SdlSessionTests.java
@@ -0,0 +1,50 @@
+package com.smartdevicelink.test.SdlConnection;
+
+import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.TTSChunkFactory;
+import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
+import com.smartdevicelink.proxy.rpc.TTSChunk;
+import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.transport.TCPTransportConfig;
+
+import junit.framework.TestCase;
+
+import java.util.Vector;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.SdlConnection.SdlSession}
+ */
+public class SdlSessionTests extends TestCase {
+
+ public void testServiceListeners(){
+ SdlSession session = SdlSession.createSession((byte)5,null, new TCPTransportConfig(8080,"",false));
+ 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 onServiceError(SdlSession session, SessionType type, String reason) {
+
+ }
+ };
+
+ session.addServiceListener(SessionType.RPC, test);
+
+ assertTrue(session.removeServiceListener(SessionType.RPC, test));
+
+ assertFalse(session.removeServiceListener(SessionType.RPC, test));
+
+ }
+
+
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
index 01cc2d6a6..68869c6a1 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
@@ -6,27 +6,43 @@ import com.smartdevicelink.proxy.TTSChunkFactory;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
import com.smartdevicelink.proxy.rpc.Choice;
+import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ClimateControlData;
import com.smartdevicelink.proxy.rpc.Coordinate;
import com.smartdevicelink.proxy.rpc.DIDResult;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
+import com.smartdevicelink.proxy.rpc.HapticRect;
import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.ImageField;
import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.proxy.rpc.MenuParams;
+import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.proxy.rpc.NavigationCapability;
+import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
+import com.smartdevicelink.proxy.rpc.PhoneCapability;
import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
+import com.smartdevicelink.proxy.rpc.RadioControlCapabilities;
+import com.smartdevicelink.proxy.rpc.RadioControlData;
+import com.smartdevicelink.proxy.rpc.RdsData;
+import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
+import com.smartdevicelink.proxy.rpc.Rectangle;
import com.smartdevicelink.proxy.rpc.ScreenParams;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.SingleTireStatus;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
import com.smartdevicelink.proxy.rpc.StartTime;
+import com.smartdevicelink.proxy.rpc.SystemCapability;
import com.smartdevicelink.proxy.rpc.TTSChunk;
+import com.smartdevicelink.proxy.rpc.Temperature;
import com.smartdevicelink.proxy.rpc.TextField;
import com.smartdevicelink.proxy.rpc.TouchCoord;
import com.smartdevicelink.proxy.rpc.TouchEvent;
@@ -34,6 +50,8 @@ import com.smartdevicelink.proxy.rpc.TouchEventCapabilities;
import com.smartdevicelink.proxy.rpc.Turn;
import com.smartdevicelink.proxy.rpc.VehicleDataResult;
import com.smartdevicelink.proxy.rpc.VehicleType;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.VrHelpItem;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
@@ -48,9 +66,11 @@ import com.smartdevicelink.proxy.rpc.enums.CarModeStatus;
import com.smartdevicelink.proxy.rpc.enums.CharacterSet;
import com.smartdevicelink.proxy.rpc.enums.CompassDirection;
import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
+import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.DeviceLevelStatus;
import com.smartdevicelink.proxy.rpc.enums.Dimension;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
+import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
import com.smartdevicelink.proxy.rpc.enums.ECallConfirmationStatus;
import com.smartdevicelink.proxy.rpc.enums.EmergencyEventType;
import com.smartdevicelink.proxy.rpc.enums.FileType;
@@ -70,19 +90,26 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus;
import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
import com.smartdevicelink.proxy.rpc.enums.PowerModeQualificationStatus;
import com.smartdevicelink.proxy.rpc.enums.PowerModeStatus;
import com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech;
import com.smartdevicelink.proxy.rpc.enums.PrimaryAudioSource;
+import com.smartdevicelink.proxy.rpc.enums.RadioBand;
+import com.smartdevicelink.proxy.rpc.enums.RadioState;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.proxy.rpc.enums.SystemAction;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TBTState;
+import com.smartdevicelink.proxy.rpc.enums.TemperatureUnit;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.TouchType;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
@@ -91,8 +118,12 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataNotificationStatus;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataResultCode;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataType;
+import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
import com.smartdevicelink.proxy.rpc.enums.WarningLightStatus;
+import com.smartdevicelink.proxy.rpc.enums.WayPointType;
import org.json.JSONArray;
import org.json.JSONException;
@@ -115,9 +146,10 @@ public class Test {
// 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 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";
@@ -195,6 +227,7 @@ public class Test {
public static final ComponentVolumeStatus GENERAL_COMPONENTVOLUMESTATUS = ComponentVolumeStatus.LOW;
public static final PresetBankCapabilities GENERAL_PRESETBANKCAPABILITIES = new PresetBankCapabilities();
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 SoftButtonCapabilities GENERAL_SOFTBUTTONCAPABILITIES = new SoftButtonCapabilities();
public static final ECallConfirmationStatus GENERAL_ECALLCONFIRMATIONSTATUS = ECallConfirmationStatus.CALL_IN_PROGRESS;
@@ -202,7 +235,41 @@ public class Test {
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 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 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[] { Test.GENERAL_LOCATIONDETAILS, Test.GENERAL_LOCATIONDETAILS});
+
+ 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 RadioBand GENERAL_RADIOBAND = RadioBand.AM;
+ public static final ClimateControlData GENERAL_CLIMATECONTROLDATA = new ClimateControlData();
+ public static final RdsData GENERAL_RDSDATA = new RdsData();
+ 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 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 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>();
@@ -230,7 +297,12 @@ public class Test {
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 JSONArray JSON_TURNS = new JSONArray();
public static final JSONArray JSON_CHOICES = new JSONArray();
public static final JSONArray JSON_HMILEVELS = new JSONArray();
@@ -246,7 +318,9 @@ public class Test {
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 JSONObject JSON_TURN = new JSONObject();
public static final JSONObject JSON_IMAGE = new JSONObject();
public static final JSONObject JSON_CHOICE = new JSONObject();
@@ -270,15 +344,53 @@ public class Test {
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();
+
static {
GENERAL_TOUCHEVENTCAPABILITIES.setDoublePressAvailable(GENERAL_BOOLEAN);
GENERAL_TOUCHEVENTCAPABILITIES.setMultiTouchAvailable(GENERAL_BOOLEAN);
GENERAL_TOUCHEVENTCAPABILITIES.setPressAvailable(GENERAL_BOOLEAN);
GENERAL_IMAGERESOLUTION.setResolutionHeight(GENERAL_INT);
- GENERAL_IMAGERESOLUTION.setResolutionWidth(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_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);
@@ -457,10 +569,84 @@ public class Test {
GENERAL_PERMISSIONITEM.setHMIPermissions(GENERAL_HMIPERMISSIONS);
GENERAL_PERMISSIONITEM.setParameterPermissions(GENERAL_PARAMETERPERMISSIONS);
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_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_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);
+
- try {
+ 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);
@@ -559,7 +745,35 @@ public class Test {
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);
@@ -609,6 +823,10 @@ public class Test {
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);
} catch (JSONException e) {
Log.e("Test", "Static Json Construction Failed.", e);
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
index d19bc225b..8ab861a0a 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
@@ -13,6 +13,8 @@ import com.smartdevicelink.proxy.rpc.BeltStatus;
import com.smartdevicelink.proxy.rpc.BodyInformation;
import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
import com.smartdevicelink.proxy.rpc.Choice;
+import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ClimateControlData;
import com.smartdevicelink.proxy.rpc.ClusterModeStatus;
import com.smartdevicelink.proxy.rpc.Coordinate;
import com.smartdevicelink.proxy.rpc.DIDResult;
@@ -22,6 +24,7 @@ import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
import com.smartdevicelink.proxy.rpc.ECallInfo;
import com.smartdevicelink.proxy.rpc.EmergencyEvent;
import com.smartdevicelink.proxy.rpc.GPSData;
+import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
import com.smartdevicelink.proxy.rpc.HeadLampStatus;
import com.smartdevicelink.proxy.rpc.Headers;
@@ -30,11 +33,19 @@ import com.smartdevicelink.proxy.rpc.ImageField;
import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.MenuParams;
+import com.smartdevicelink.proxy.rpc.ModuleData;
import com.smartdevicelink.proxy.rpc.MyKey;
+import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
+import com.smartdevicelink.proxy.rpc.PhoneCapability;
import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
+import com.smartdevicelink.proxy.rpc.RadioControlCapabilities;
+import com.smartdevicelink.proxy.rpc.RadioControlData;
+import com.smartdevicelink.proxy.rpc.RdsData;
+import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
+import com.smartdevicelink.proxy.rpc.Rectangle;
import com.smartdevicelink.proxy.rpc.ScreenParams;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
@@ -42,6 +53,7 @@ import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
import com.smartdevicelink.proxy.rpc.StartTime;
import com.smartdevicelink.proxy.rpc.TTSChunk;
+import com.smartdevicelink.proxy.rpc.Temperature;
import com.smartdevicelink.proxy.rpc.TextField;
import com.smartdevicelink.proxy.rpc.TireStatus;
import com.smartdevicelink.proxy.rpc.TouchCoord;
@@ -50,9 +62,15 @@ import com.smartdevicelink.proxy.rpc.TouchEventCapabilities;
import com.smartdevicelink.proxy.rpc.Turn;
import com.smartdevicelink.proxy.rpc.VehicleDataResult;
import com.smartdevicelink.proxy.rpc.VehicleType;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.VrHelpItem;
+import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
+import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
public class Validator{
@@ -319,6 +337,33 @@ public class Validator{
return true;
}
+ 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.getY() != c2.getY()){
+ return false;
+ }
+
+ if(c1.getWidth() != c2.getWidth()){
+ return false;
+ }
+
+ if(c1.getHeight() != c2.getHeight()){
+ return false;
+ }
+
+ return true;
+ }
+
public static boolean validateOasisAddress(OasisAddress a1, OasisAddress a2){
if(a1 == null){
return ( a2 == null );
@@ -493,6 +538,342 @@ public class Validator{
return true;
}
+ public static boolean validateTemperature(Temperature temperature1, Temperature temperature2){
+ if(temperature1 == null){
+ return ( temperature2 == null );
+ }
+ if(temperature2 == null){
+ return ( temperature1 == null );
+ }
+
+ 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()){
+ log("validateTemperature",
+ "Unit " + temperature1.getUnit() + " didn't match unit " + temperature2.getUnit() + ".");
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateRdsData(RdsData rdsData1, RdsData rdsData2){
+ if(rdsData1 == null){
+ return ( rdsData2 == null );
+ }
+ if(rdsData2 == null){
+ return ( rdsData1 == null );
+ }
+
+ if(rdsData1.getProgramService() != rdsData2.getProgramService()){
+ log("validateRdsData",
+ "Ps " + rdsData1.getProgramService() + " didn't match Ps " + rdsData2.getProgramService()
+ + ".");
+ return false;
+ }
+
+ if(rdsData1.getRadioText() != rdsData2.getRadioText()){
+ log("validateRdsData",
+ "Rt " + rdsData1.getRadioText() + " didn't match Rt " + rdsData2.getRadioText()
+ + ".");
+ return false;
+ }
+
+ if(rdsData1.getClockText() != rdsData2.getClockText()){
+ log("validateRdsData",
+ "Ct " + rdsData1.getClockText() + " didn't match Ct " + rdsData2.getClockText()
+ + ".");
+ return false;
+ }
+
+ if(rdsData1.getProgramIdentification() != rdsData2.getProgramIdentification()){
+ log("validateRdsData",
+ "Pi " + rdsData1.getProgramIdentification() + " didn't match Pi " + rdsData2.getProgramIdentification()
+ + ".");
+ return false;
+ }
+
+ if(rdsData1.getRegion() != rdsData2.getRegion()){
+ log("validateRdsData",
+ "Reg " + rdsData1.getRegion() + " didn't match Reg " + rdsData2.getRegion()
+ + ".");
+ return false;
+ }
+
+ if(rdsData1.getTrafficProgram() != rdsData2.getTrafficProgram()){
+ log("validateRdsData",
+ "Tp " + rdsData1.getTrafficProgram() + " didn't match Tp " + rdsData2.getTrafficProgram()
+ + ".");
+ return false;
+ }
+
+ if(rdsData1.getTrafficAnnouncement() != rdsData2.getTrafficAnnouncement()){
+ log("validateRdsData",
+ "Ta " + rdsData1.getTrafficAnnouncement() + " didn't match Ta " + rdsData2.getTrafficAnnouncement()
+ + ".");
+ return false;
+ }
+
+ if(rdsData1.getProgramType() != rdsData2.getProgramType()){
+ log("validateRdsData",
+ "Pty " + rdsData1.getProgramType() + " didn't match Pty " + rdsData2.getProgramType()
+ + ".");
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateClimateControlData(ClimateControlData climateControlData1, ClimateControlData climateControlData2){
+ if(climateControlData1 == null){
+ return ( climateControlData2 == null );
+ }
+ if(climateControlData2 == null){
+ return ( climateControlData1 == null );
+ }
+
+ if(climateControlData1.getFanSpeed() != climateControlData2.getFanSpeed()){
+ log("validateClimateControlData",
+ "FanSpeed " + climateControlData1.getFanSpeed() + " didn't match fanSpeed " + climateControlData2.getFanSpeed()
+ + ".");
+ return false;
+ }
+
+ if(!( validateTemperature(climateControlData1.getCurrentTemperature(), climateControlData2.getCurrentTemperature()) )){
+ return false;
+ }
+
+ if(!( validateTemperature(climateControlData1.getDesiredTemperature(), climateControlData2.getDesiredTemperature()) )){
+ return false;
+ }
+
+ if(climateControlData1.getAcEnable() != climateControlData2.getAcEnable()){
+ log("validateClimateControlData",
+ "AcEnable " + climateControlData1.getAcEnable() + " didn't match AcEnable " + climateControlData2.getAcEnable()
+ + ".");
+ return false;
+ }
+
+ if(climateControlData1.getCirculateAirEnable() != climateControlData2.getCirculateAirEnable()){
+ log("validateClimateControlData",
+ "CirculateAirEnable " + climateControlData1.getCirculateAirEnable() + " didn't match CirculateAirEnable " + climateControlData2.getCirculateAirEnable()
+ + ".");
+ return false;
+ }
+
+ if(climateControlData1.getAutoModeEnable() != climateControlData2.getAutoModeEnable()){
+ log("validateClimateControlData",
+ "AutoModeEnable " + climateControlData1.getAutoModeEnable() + " didn't match AutoModeEnable " + climateControlData2.getAutoModeEnable()
+ + ".");
+ return false;
+ }
+
+ if(climateControlData1.getDefrostZone() != climateControlData2.getDefrostZone()){
+ log("validateClimateControlData",
+ "DefrostZone " + climateControlData1.getDefrostZone() + " didn't match DefrostZone " + climateControlData2.getDefrostZone()
+ + ".");
+ return false;
+ }
+
+ if(climateControlData1.getDualModeEnable() != climateControlData2.getDualModeEnable()){
+ log("validateClimateControlData",
+ "DualModeEnable " + climateControlData1.getDualModeEnable() + " didn't match DualModeEnable " + climateControlData2.getDualModeEnable()
+ + ".");
+ return false;
+ }
+
+ if(climateControlData1.getAcMaxEnable() != climateControlData2.getAcMaxEnable()){
+ log("validateClimateControlData",
+ "AcMaxEnable " + climateControlData1.getAcMaxEnable() + " didn't match AcMaxEnable " + climateControlData2.getAcMaxEnable()
+ + ".");
+ return false;
+ }
+
+ if(climateControlData1.getVentilationMode() != climateControlData2.getVentilationMode()){
+ log("validateClimateControlData",
+ "VentilationMode " + climateControlData1.getVentilationMode() + " didn't match VentilationMode " + climateControlData2.getVentilationMode()
+ + ".");
+ 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()) )){
+ return false;
+ }
+
+ if(!( validateClimateControlData(moduleData1.getClimateControlData(), moduleData2.getClimateControlData()) )){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateRemoteControlCapabilities(RemoteControlCapabilities remoteControlCapabilities1, RemoteControlCapabilities remoteControlCapabilities2){
+ if(remoteControlCapabilities1 == null){
+ return ( remoteControlCapabilities2 == null );
+ }
+ if(remoteControlCapabilities2 == null){
+ return ( remoteControlCapabilities1 == null );
+ }
+
+ if(!( validateButtonCapabilities(remoteControlCapabilities1.getButtonCapabilities(), remoteControlCapabilities2.getButtonCapabilities()) )){
+ return false;
+ }
+
+ if(!( validateRadioControlCapabilities(remoteControlCapabilities1.getRadioControlCapabilities(), remoteControlCapabilities2.getRadioControlCapabilities()) )){
+ return false;
+ }
+
+ if(!( validateClimateControlCapabilities(remoteControlCapabilities1.getClimateControlCapabilities(), remoteControlCapabilities2.getClimateControlCapabilities()) )){
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateRadioControlData(RadioControlData radioControlData1, RadioControlData radioControlData2){
+ if(radioControlData1 == null){
+ return ( radioControlData2 == null );
+ }
+ if(radioControlData2 == null){
+ return ( radioControlData1 == null );
+ }
+
+ if(radioControlData1.getFrequencyInteger() != radioControlData2.getFrequencyInteger()){
+ log("validateRadioControlData",
+ "FrequencyInteger " + radioControlData1.getFrequencyInteger() + " didn't match FrequencyInteger " + radioControlData2.getFrequencyInteger()
+ + ".");
+ return false;
+ }
+
+ if(radioControlData1.getFrequencyFraction() != radioControlData2.getFrequencyFraction()){
+ log("validateRadioControlData",
+ "FrequencyFraction " + radioControlData1.getFrequencyFraction() + " didn't match FrequencyFraction " + radioControlData2.getFrequencyFraction()
+ + ".");
+ return false;
+ }
+
+ if(radioControlData1.getBand() != radioControlData2.getBand()){
+ log("validateRadioControlData",
+ "Band " + radioControlData1.getBand() + " didn't match Band " + radioControlData2.getBand()
+ + ".");
+ return false;
+ }
+
+ if(!( validateRdsData(radioControlData1.getRdsData(), radioControlData2.getRdsData()) )){
+ return false;
+ }
+
+ if(radioControlData1.getAvailableHDs() != radioControlData2.getAvailableHDs()){
+ log("validateRadioControlData",
+ "AvailableHDs " + radioControlData1.getAvailableHDs() + " didn't match AvailableHDs " + radioControlData2.getAvailableHDs()
+ + ".");
+ return false;
+ }
+
+ if(radioControlData1.getHdChannel() != radioControlData2.getHdChannel()){
+ log("validateRadioControlData",
+ "HdChannel " + radioControlData1.getHdChannel() + " didn't match HdChannel " + radioControlData2.getHdChannel()
+ + ".");
+ return false;
+ }
+
+ if(radioControlData1.getSignalStrength() != radioControlData2.getSignalStrength()){
+ log("validateRadioControlData",
+ "SignalStrength " + radioControlData1.getSignalStrength() + " didn't match SignalStrength " + radioControlData2.getSignalStrength()
+ + ".");
+ return false;
+ }
+
+ if(radioControlData1.getSignalChangeThreshold() != radioControlData2.getSignalChangeThreshold()){
+ log("validateRadioControlData",
+ "SignalChangeThreshold " + radioControlData1.getSignalChangeThreshold() + " didn't match SignalChangeThreshold " + radioControlData2.getSignalChangeThreshold()
+ + ".");
+ return false;
+ }
+
+ if(radioControlData1.getRadioEnable() != radioControlData2.getRadioEnable()){
+ log("validateRadioControlData",
+ "RadioEnable " + radioControlData1.getRadioEnable() + " didn't match RadioEnable " + radioControlData2.getRadioEnable()
+ + ".");
+ return false;
+ }
+
+ if(radioControlData1.getState() != radioControlData2.getState()){
+ log("validateRadioControlData",
+ "State " + radioControlData1.getState() + " didn't match State " + radioControlData2.getState()
+ + ".");
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateNavigationCapability(NavigationCapability navigationCapability1, NavigationCapability navigationCapability2){
+ if(navigationCapability1 == null){
+ return ( navigationCapability2 == null );
+ }
+ if(navigationCapability2 == null){
+ return ( navigationCapability1 == null );
+ }
+
+ if(navigationCapability1.getSendLocationEnabled() != navigationCapability2.getSendLocationEnabled()){
+ log("validateNavigationCapability",
+ "SendLocationEnabled " + navigationCapability1.getSendLocationEnabled() + " didn't match SendLocationEnabled " + navigationCapability2.getSendLocationEnabled()
+ + ".");
+ return false;
+ }
+
+ if(navigationCapability1.getWayPointsEnabled() != navigationCapability2.getWayPointsEnabled()){
+ log("validateNavigationCapability",
+ "WayPointsEnabled " + navigationCapability1.getWayPointsEnabled() + " didn't match WayPointsEnabled " + navigationCapability2.getWayPointsEnabled() + ".");
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validatePhoneCapability(PhoneCapability phoneCapability1, PhoneCapability phoneCapability2){
+ if(phoneCapability1 == null){
+ return ( phoneCapability2 == null );
+ }
+ if(phoneCapability2 == null){
+ return ( phoneCapability1 == null );
+ }
+
+ if(phoneCapability1.getDialNumberEnabled() != phoneCapability2.getDialNumberEnabled()){
+ log("validatePhoneCapability",
+ "DialNumberEnabled " + phoneCapability1.getDialNumberEnabled() + " didn't match DialNumberEnabled " + phoneCapability1.getDialNumberEnabled()
+ + ".");
+ return false;
+ }
+
+ return true;
+ }
+
public static boolean validateTouchEventCapabilities(TouchEventCapabilities item1, TouchEventCapabilities item2){
if(item1 == null){
return ( item2 == null );
@@ -1172,6 +1553,18 @@ public class Validator{
return true;
}
+
+ public static boolean validateSupportedFormats (VideoStreamingFormat vsf1, VideoStreamingFormat vsf2) {
+ if(vsf1.getProtocol() != vsf2.getProtocol()){
+ return false;
+ }
+
+ if(vsf1.getCodec() != vsf2.getCodec()){
+ return false;
+ }
+
+ return true;
+ }
public static boolean validateDisplayCapabilities (DisplayCapabilities item1, DisplayCapabilities item2) {
if (item1 == null) {
@@ -1324,7 +1717,154 @@ public class Validator{
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()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (item1.get(i).getModuleName() != item2.get(i).getModuleName()) {
+ return false;
+ }
+ if (item1.get(i).getRadioEnableAvailable() != item2.get(i).getRadioEnableAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getRadioBandAvailable() != item2.get(i).getRadioBandAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getRadioFrequencyAvailable() != item2.get(i).getRadioFrequencyAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getHdChannelAvailable() != item2.get(i).getHdChannelAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getRdsDataAvailable() != item2.get(i).getRdsDataAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getAvailableHDsAvailable() != item2.get(i).getAvailableHDsAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getStateAvailable() != item2.get(i).getStateAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getSignalStrengthAvailable() != item2.get(i).getSignalStrengthAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getSignalChangeThresholdAvailable() != item2.get(i).getSignalChangeThresholdAvailable()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateClimateControlCapabilities (List<ClimateControlCapabilities> item1, List<ClimateControlCapabilities> 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).getModuleName() != item2.get(i).getModuleName()) {
+ return false;
+ }
+ if (item1.get(i).getFanSpeedAvailable() != item2.get(i).getFanSpeedAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getDesiredTemperatureAvailable() != item2.get(i).getDesiredTemperatureAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getAcEnableAvailable() != item2.get(i).getAcEnableAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getAcMaxEnableAvailable() != item2.get(i).getAcMaxEnableAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getCirculateAirEnableAvailable() != item2.get(i).getCirculateAirEnableAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getAutoModeEnableAvailable() != item2.get(i).getAutoModeEnableAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getDualModeEnableAvailable() != item2.get(i).getDualModeEnableAvailable()) {
+ return false;
+ }
+ if (item1.get(i).getDefrostZoneAvailable() != item2.get(i).getDefrostZoneAvailable()) {
+ return false;
+ }
+
+ if(! (validateDefrostZones(item1.get(i).getDefrostZone(), item2.get(i).getDefrostZone()) )){
+ return false;
+ }
+
+ if (item1.get(i).getVentilationModeAvailable() != item2.get(i).getVentilationModeAvailable()) {
+ return false;
+ }
+
+ if(! (validateVentilationModes(item1.get(i).getVentilationMode(), item2.get(i).getVentilationMode()) )){
+ 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()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.size(); i++) {
+ if (item1.get(i) != item2.get(i)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateVentilationModes (List<VentilationMode> item1, List<VentilationMode> 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 validateTurnList (List<Turn> item1, List<Turn> item2) {
if (item1 == null) {
return (item2 == null);
@@ -1375,6 +1915,29 @@ public class Validator{
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) {
@@ -1565,4 +2128,68 @@ public class Validator{
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 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;
+ }
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/encoder/EncoderUtilsTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/encoder/EncoderUtilsTest.java
new file mode 100644
index 000000000..083a5dd3f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/encoder/EncoderUtilsTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2017, Xevo 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 copyright holder 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.test.encoder;
+
+import android.annotation.TargetApi;
+import android.media.MediaFormat;
+import android.os.Build;
+
+import com.smartdevicelink.encoder.EncoderUtils;
+
+import junit.framework.TestCase;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.encoder.EncoderUtils}
+ */
+@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+public class EncoderUtilsTest extends TestCase {
+ public void testGetCodecSpecificDataWithNull() {
+ byte[] result = EncoderUtils.getCodecSpecificData(null);
+ assertNull(result);
+ }
+
+ public void testGetCodecSpecificDataForAVC() {
+ // example of SPS NAL unit with 4-byte start code
+ 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
+ };
+ // example of PPS NAL unit with 4-byte start code
+ byte[] pps = new byte[] {
+ 0x00, 0x00, 0x00, 0x01,
+ 0x68, (byte)0xC8, 0x42, 0x0F, 0x13, 0x20
+ };
+
+ ByteBuffer spsByteBuffer = ByteBuffer.allocate(sps.length);
+ spsByteBuffer.put(sps);
+ spsByteBuffer.flip();
+
+ ByteBuffer ppsByteBuffer = ByteBuffer.allocate(pps.length);
+ ppsByteBuffer.put(pps);
+ ppsByteBuffer.flip();
+
+ MediaFormat format = MediaFormat.createVideoFormat("video/avc", 16, 16);
+ format.setByteBuffer("csd-0", spsByteBuffer);
+ format.setByteBuffer("csd-1", ppsByteBuffer);
+
+ byte[] result = EncoderUtils.getCodecSpecificData(format);
+ assertNotNull(result);
+
+ byte[] expected = new byte[sps.length + pps.length];
+ System.arraycopy(sps, 0, expected, 0, sps.length);
+ System.arraycopy(pps, 0, expected, sps.length, pps.length);
+ assertTrue("Output codec specific data doesn't match", Arrays.equals(expected, result));
+ }
+
+ public void testGetCodecSpecificDataWithInvalidAVCData() {
+ // testing an error case when the encoder emits SPS only (which should not happen)
+ 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
+ };
+
+ ByteBuffer spsByteBuffer = ByteBuffer.allocate(sps.length);
+ spsByteBuffer.put(sps);
+ spsByteBuffer.flip();
+
+ MediaFormat format = MediaFormat.createVideoFormat("video/avc", 16, 16);
+ format.setByteBuffer("csd-0", spsByteBuffer);
+ // no PPS
+
+ byte[] result = EncoderUtils.getCodecSpecificData(format);
+ assertNull(result);
+ }
+
+ public void testGetCodecSpecificDataForUnknownCodec() {
+ MediaFormat format = MediaFormat.createVideoFormat("video/raw", 16, 16);
+ byte[] result = EncoderUtils.getCodecSpecificData(format);
+ assertNull("For unsupported codec, getCodecSpecificData should return null", result);
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
index b334058ea..e31aedbe7 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
@@ -80,7 +80,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testInt, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequest(testData, null);
- assertNull(Test.NULL, testBSR.getCorrelationID());
+ assertNotNull(Test.NULL, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequest(null, testInt);
assertNull(Test.NULL, testBSR);
@@ -95,7 +95,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testInt, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequestLegacy(testVData, null);
- assertNull(Test.NULL, testBSR.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequestLegacy(null, testInt);
assertNull(Test.NULL, testBSR);
@@ -145,7 +145,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testBAC.getMenuParams());
assertNull(Test.NULL, testBAC.getVrCommands());
assertNull(Test.NULL, testBAC.getCmdIcon());
- assertNull(Test.NULL, testBAC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, String menuText, Integer parentID, Integer position, Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
testIconValue = "icon";
@@ -167,7 +167,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testBAC.getMenuParams());
assertNull(Test.NULL, testBAC.getVrCommands());
assertNull(Test.NULL, testBAC.getCmdIcon());
- assertNull(Test.NULL, testBAC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, String menuText, Integer parentID, Integer position, Vector<String> vrCommands, Integer correlationID)
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testParentID, testPosition, testVrCommands, testCorrelationID);
@@ -182,7 +182,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testBAC.getCmdID());
assertNull(Test.NULL, testBAC.getMenuParams());
assertNull(Test.NULL, testBAC.getVrCommands());
- assertNull(Test.NULL, testBAC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, String menuText, Vector<String> vrCommands, Integer correlationID)
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testVrCommands, testCorrelationID);
@@ -195,7 +195,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testBAC.getCmdID());
assertNull(Test.NULL, testBAC.getMenuParams());
assertNull(Test.NULL, testBAC.getVrCommands());
- assertNull(Test.NULL, testBAC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, Vector<String> vrCommands, Integer correlationID)
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testVrCommands, testCorrelationID);
@@ -206,7 +206,7 @@ public class RPCRequestFactoryTests extends TestCase {
testBAC = RPCRequestFactory.buildAddCommand(null, null, null);
assertNull(Test.NULL, testBAC.getCmdID());
assertNull(Test.NULL, testBAC.getVrCommands());
- assertNull(Test.NULL, testBAC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
}
public void testBuildAddSubMenu () {
@@ -232,7 +232,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testBASM.getMenuID());
assertNull(Test.NULL, testBASM.getMenuName());
assertNull(Test.NULL, testBASM.getPosition());
- assertNull(Test.NULL, testBASM.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBASM.getCorrelationID());
}
public void testBuildAlert () {
@@ -294,7 +294,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testAlert.getPlayTone());
assertNull(Test.NULL, testAlert.getDuration());
assertNull(Test.NULL, testAlert.getSoftButtons());
- assertNull(Test.NULL, testAlert.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testAlert.getCorrelationID());
// Test -- buildAlert(String ttsText, Boolean playTone, Integer correlationID)
// ^ Calls another build method.
@@ -323,7 +323,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testAlert.getAlertText2());
assertNull(Test.NULL, testAlert.getPlayTone());
assertNull(Test.NULL, testAlert.getDuration());
- assertNull(Test.NULL, testAlert.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testAlert.getCorrelationID());
}
public void testBuildCreateInteractionChoiceSet () {
@@ -346,7 +346,7 @@ public class RPCRequestFactoryTests extends TestCase {
testBCICS = RPCRequestFactory.buildCreateInteractionChoiceSet(null, null, null);
assertNull(Test.NULL, testBCICS.getChoiceSet());
assertNull(Test.NULL, testBCICS.getInteractionChoiceSetID());
- assertNull(Test.NULL, testBCICS.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBCICS.getCorrelationID());
}
public void testBuildDeleteCommand () {
@@ -363,7 +363,7 @@ public class RPCRequestFactoryTests extends TestCase {
testDC = RPCRequestFactory.buildDeleteCommand(null, null);
assertNull(Test.NULL, testDC.getCmdID());
- assertNull(Test.NULL, testDC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testDC.getCorrelationID());
}
@@ -381,7 +381,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testFileName, testDF.getSdlFileName());
testDF = RPCRequestFactory.buildDeleteFile(null, null);
- assertNull(Test.NULL, testDF.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testDF.getCorrelationID());
assertNull(Test.NULL, testDF.getSdlFileName());
}
@@ -400,7 +400,7 @@ public class RPCRequestFactoryTests extends TestCase {
testDICS = RPCRequestFactory.buildDeleteInteractionChoiceSet(null, null);
assertNull(Test.NULL, testDICS.getInteractionChoiceSetID());
- assertNull(Test.NULL, testDICS.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testDICS.getCorrelationID());
}
public void testBuildDeleteSubMenu () {
@@ -417,7 +417,7 @@ public class RPCRequestFactoryTests extends TestCase {
testDSM = RPCRequestFactory.buildDeleteSubMenu(null, null);
assertNull(Test.NULL, testDSM.getMenuID());
- assertNull(Test.NULL, testDSM.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testDSM.getCorrelationID());
}
public void testBuildListFiles () {
@@ -430,7 +430,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testLF.getCorrelationID());
testLF = RPCRequestFactory.buildListFiles(null);
- assertNull(Test.NULL, testLF.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testLF.getCorrelationID());
}
@SuppressWarnings("deprecation")
@@ -480,7 +480,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testPI.getInteractionMode());
assertNull(Test.NULL, testPI.getTimeout());
assertNull(Test.NULL, testPI.getVrHelp());
- assertNull(Test.NULL, testPI.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testPI.getCorrelationID());
// Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, String timeoutPrompt, InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp, Integer correlationID)
// ^ Calls another build method.
@@ -510,7 +510,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testPI.getTimeoutPrompt());
assertNull(Test.NULL, testPI.getInteractionMode());
assertNull(Test.NULL, testPI.getTimeout());
- assertNull(Test.NULL, testPI.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testPI.getCorrelationID());
// Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, String timeoutPrompt, InteractionMode interactionMode, Integer timeout, Integer correlationID)
// ^ Calls another build method.
@@ -538,7 +538,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testPI.getHelpPrompt());
assertNull(Test.NULL, testPI.getInteractionMode());
assertNull(Test.NULL, testPI.getTimeout());
- assertNull(Test.NULL, testPI.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testPI.getCorrelationID());
// Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, InteractionMode interactionMode, Integer timeout, Integer correlationID)
// ^ Calls another build method.
@@ -567,7 +567,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testPF.getFileType());
assertNull(Test.NULL, testPF.getPersistentFile());
assertNull(Test.NULL, testPF.getFileData());
- assertNull(Test.NULL, testPF.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testPF.getCorrelationID());
// Test -- buildPutFile(String sdlFileName, Integer iOffset, Integer iLength)
testPF = RPCRequestFactory.buildPutFile(testFileName, testOffset, testLength);
@@ -665,7 +665,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSAI = RPCRequestFactory.buildSetAppIcon(null, null);
assertNull(Test.NULL, testSAI.getSdlFileName());
- assertNull(Test.NULL, testSAI.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSAI.getCorrelationID());
}
@@ -698,7 +698,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSBP = RPCRequestFactory.buildSetGlobalProperties((Vector<TTSChunk>) null, null, null);
assertNull(Test.NULL, testSBP.getHelpPrompt());
assertNull(Test.NULL, testSBP.getTimeoutPrompt());
- assertNull(Test.NULL, testSBP.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSBP.getCorrelationID());
// Test -- buildSetGlobalProperties(String helpPrompt, String timeoutPrompt, String vrHelpTitle, Vector<VrHelpItem> vrHelp, Integer correlationID)
// ^ Calls another build method.
@@ -716,7 +716,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testSBP.getTimeoutPrompt());
assertNull(Test.NULL, testSBP.getVrHelpTitle());
assertNull(Test.NULL, testSBP.getVrHelp());
- assertNull(Test.NULL, testSBP.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSBP.getCorrelationID());
}
public void testBuildSetMediaClockTimer () {
@@ -736,7 +736,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSMCT = RPCRequestFactory.buildSetMediaClockTimer(null, null, null, null, null);
assertNull(Test.NULL, testSMCT.getStartTime());
assertNull(Test.NULL, testSMCT.getUpdateMode());
- assertNull(Test.NULL, testSMCT.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSMCT.getCorrelationID());
// Test -- buildSetMediaClockTimer(UpdateMode updateMode, Integer correlationID)
// ^ Calls another build method.
@@ -784,7 +784,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testShow.getSoftButtons());
assertNull(Test.NULL, testShow.getCustomPresets());
assertNull(Test.NULL, testShow.getAlignment());
- assertNull(Test.NULL, testShow.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testShow.getCorrelationID());
// Test -- buildShow(String mainText1, String mainText2, String mainText3, String mainText4, TextAlignment alignment, Integer correlationID)
// ^ Calls another build method.
@@ -805,7 +805,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testShow.getMediaClock());
assertNull(Test.NULL, testShow.getMediaTrack());
assertNull(Test.NULL, testShow.getAlignment());
- assertNull(Test.NULL, testShow.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testShow.getCorrelationID());
// Test -- buildShow(String mainText1, String mainText2, TextAlignment alignment, Integer correlationID)
// ^ Calls another build method.
@@ -825,7 +825,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSpeak = RPCRequestFactory.buildSpeak((String) null, null);
assertNull(Test.NULL, testSpeak.getTtsChunks());
- assertNull(Test.NULL, testSpeak.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSpeak.getCorrelationID());
// Test -- buildSpeak(Vector<TTSChunk> ttsChunks, Integer correlationID)
testSpeak = RPCRequestFactory.buildSpeak(testTTSChunks, testCorrelationID);
@@ -834,7 +834,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSpeak = RPCRequestFactory.buildSpeak((Vector<TTSChunk>) null, null);
assertNull(Test.NULL, testSpeak.getTtsChunks());
- assertNull(Test.NULL, testSpeak.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSpeak.getCorrelationID());
}
public void testBuildSubscribeButton () {
@@ -850,7 +850,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSB = RPCRequestFactory.buildSubscribeButton(null, null);
assertNull(Test.NULL, testSB.getButtonName());
- assertNull(Test.NULL, testSB.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSB.getCorrelationID());
}
@@ -864,7 +864,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testUAI.getCorrelationID());
testUAI = RPCRequestFactory.buildUnregisterAppInterface(null);
- assertNull(Test.NULL, testUAI.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testUAI.getCorrelationID());
}
public void testBuildUnsubscribeButton () {
@@ -880,7 +880,7 @@ public class RPCRequestFactoryTests extends TestCase {
testUB = RPCRequestFactory.buildUnsubscribeButton(null, null);
assertNull(Test.NULL, testUB.getButtonName());
- assertNull(Test.NULL, testUB.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testUB.getCorrelationID());
}
@@ -909,7 +909,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testSVD.getCorrelationID());
testSVD = RPCRequestFactory.BuildSubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNull(Test.NULL, testSVD.getCorrelationID());
+ assertNotNull(Test.NULL, testSVD.getCorrelationID());
}
public void testBuildUnsubscribeVehicleData () {
@@ -937,7 +937,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testUVD.getCorrelationID());
testUVD = RPCRequestFactory.BuildUnsubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNull(Test.NULL, testUVD.getCorrelationID());
+ assertNotNull(Test.NULL, testUVD.getCorrelationID());
}
public void testBuildGetVehicleData () {
@@ -966,7 +966,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testGVD.getCorrelationID());
testGVD = RPCRequestFactory.BuildGetVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testVIN, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNull(Test.NULL, testGVD.getCorrelationID());
+ assertNotNull(Test.NULL, testGVD.getCorrelationID());
}
public void testBuildScrollableMessage () {
@@ -988,7 +988,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testSM.getScrollableMessageBody());
assertNull(Test.NULL, testSM.getTimeout());
assertNull(Test.NULL, testSM.getSoftButtons());
- assertNull(Test.NULL, testSM.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSM.getCorrelationID());
}
public void testBuildSlider () {
@@ -1013,7 +1013,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testSlider.getSliderHeader());
assertNull(Test.NULL, testSlider.getSliderFooter());
assertNull(Test.NULL, testSlider.getTimeout());
- assertNull(Test.NULL, testSlider.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSlider.getCorrelationID());
}
public void testBuildChangeRegistration () {
@@ -1031,7 +1031,7 @@ public class RPCRequestFactoryTests extends TestCase {
testCR = RPCRequestFactory.BuildChangeRegistration(null, null, null);
assertNull(Test.NULL, testCR.getLanguage());
assertNull(Test.NULL, testCR.getHmiDisplayLanguage());
- assertNull(Test.NULL, testCR.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testCR.getCorrelationID());
}
public void testBuildSetDisplayLayout () {
@@ -1047,7 +1047,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSDL = RPCRequestFactory.BuildSetDisplayLayout(null, null);
assertNull(Test.NULL, testSDL.getDisplayLayout());
- assertNull(Test.NULL, testSDL.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSDL.getCorrelationID());
}
public void testBuildPerformAudioPassThru () {
@@ -1085,7 +1085,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testPAPT.getBitsPerSample());
assertNull(Test.NULL, testPAPT.getAudioType());
assertNull(Test.NULL, testPAPT.getMuteAudio());
- assertNull(Test.NULL, testPAPT.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testPAPT.getCorrelationID());
}
public void testBuildEndAudioPassThru () {
@@ -1098,6 +1098,6 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testEAPT.getCorrelationID());
testEAPT = RPCRequestFactory.BuildEndAudioPassThru(null);
- assertNull(Test.NULL, testEAPT.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testEAPT.getCorrelationID());
}
} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java
new file mode 100644
index 000000000..5c1b9436d
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java
@@ -0,0 +1,48 @@
+package com.smartdevicelink.test.proxy;
+
+import android.test.AndroidTestCase;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.GetSystemCapability;
+import com.smartdevicelink.test.Config;
+import com.smartdevicelink.test.JsonUtils;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+public class RPCRequestTest extends AndroidTestCase {
+
+ public static final int SDL_VERSION_UNDER_TEST = Config.SDL_VERSION_UNDER_TEST;
+
+ private static final int CORR_ID = 402;
+
+ protected RPCRequest msg;
+
+ @Override
+ public void setUp(){
+ this.msg = new GetSystemCapability();
+
+ }
+
+ public void testCreation(){
+ assertNotNull("Object creation failed.", msg);
+ }
+
+ public void testGetCorrelationId(){
+ assertNotNull(this.msg.getCorrelationID());
+ }
+ public void testSettingCorrelationId(){
+ assertNotNull(this.msg.getCorrelationID());
+ msg.setCorrelationID(CORR_ID);
+ assertEquals("Correlation ID doesn't match expected ID.", CORR_ID, (int)msg.getCorrelationID());
+
+ }
+
+
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
index 8ed8a6fe7..b50f6f48d 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
@@ -1,13 +1,17 @@
package com.smartdevicelink.test.proxy;
import android.content.Context;
+import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.test.AndroidTestCase;
import android.util.Log;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.SdlProxyALM;
+import com.smartdevicelink.proxy.SdlProxyBase;
import com.smartdevicelink.proxy.SdlProxyBuilder;
import com.smartdevicelink.proxy.SdlProxyConfigurationResources;
import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
@@ -17,6 +21,7 @@ import com.smartdevicelink.proxy.rpc.AddCommandResponse;
import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.proxy.rpc.AlertResponse;
+import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
import com.smartdevicelink.proxy.rpc.DeleteCommandResponse;
@@ -28,6 +33,8 @@ import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
+import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
import com.smartdevicelink.proxy.rpc.ListFilesResponse;
@@ -38,6 +45,7 @@ import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnHashChange;
+import com.smartdevicelink.proxy.rpc.OnInteriorVehicleData;
import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
import com.smartdevicelink.proxy.rpc.OnLanguageChange;
import com.smartdevicelink.proxy.rpc.OnLockScreenStatus;
@@ -54,11 +62,14 @@ import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
+import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
import com.smartdevicelink.proxy.rpc.SendLocationResponse;
import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
+import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
+import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.proxy.rpc.SliderResponse;
@@ -72,10 +83,19 @@ import com.smartdevicelink.proxy.rpc.UnsubscribeButtonResponse;
import com.smartdevicelink.proxy.rpc.UnsubscribeVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.UnsubscribeWayPointsResponse;
import com.smartdevicelink.proxy.rpc.UpdateTurnListResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
+import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
+import com.smartdevicelink.streaming.video.SdlRemoteDisplay;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
+import com.smartdevicelink.test.streaming.video.SdlRemoteDisplayTest;
import junit.framework.Assert;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
public class SdlProxyBaseTests extends AndroidTestCase{
public static final String TAG = "SdlProxyBaseTests";
@@ -133,6 +153,131 @@ public class SdlProxyBaseTests extends AndroidTestCase{
}
}
+ public void testRemoteDisplayStreaming(){
+ SdlProxyALM proxy = null;
+ SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(new ProxyListenerTest(), "appId", "appName", true, getContext());
+ try{
+ proxy = builder.build();
+ // public void startRemoteDisplayStream(Context context, final Class<? extends SdlRemoteDisplay> remoteDisplay, final VideoStreamingParameters parameters, final boolean encrypted){
+ Method m = SdlProxyALM.class.getDeclaredMethod("startRemoteDisplayStream", Context.class, SdlRemoteDisplay.class, VideoStreamingParameters.class, boolean.class);
+ assertNotNull(m);
+ m.setAccessible(true);
+ m.invoke(proxy,getContext(), SdlRemoteDisplayTest.MockRemoteDisplay.class, (VideoStreamingParameters)null, false);
+ assert true;
+
+ }catch (Exception e){
+ assert false;
+ }
+ }
+
+ public void testMultipleRPCSendSynchronous() {
+
+ List<RPCRequest> rpcs = new ArrayList<>();
+
+ // rpc 1
+ Show show = new Show();
+ show.setMainField1("hey y'all");
+ show.setMainField2("");
+ show.setMainField3("");
+ show.setMainField4("");
+ rpcs.add(show);
+
+ // rpc 2
+ Show show2 = new Show();
+ show2.setMainField1("");
+ show2.setMainField2("It is Wednesday My Dudes");
+ show2.setMainField3("");
+ show2.setMainField4("");
+ rpcs.add(show2);
+
+ OnMultipleRequestListener mrl = new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+
+ }
+
+ @Override
+ public void onFinished() {
+
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ assert false;
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+
+ }
+ };
+ try{
+ // public void sendRequests(List<RPCRequest> rpcs, final OnMultipleRequestListener listener) throws SdlException {
+ Method m = SdlProxyBase.class.getDeclaredMethod("sendRequests", SdlProxyBase.class);
+ assertNotNull(m);
+ m.setAccessible(true);
+ m.invoke(rpcs,mrl);
+ assert true;
+
+ }catch (Exception e){
+ assert false;
+ }
+ }
+
+ public void testMultipleRPCSendAsynchronous() {
+
+ List<RPCRequest> rpcs = new ArrayList<>();
+
+ // rpc 1
+ Show show = new Show();
+ show.setMainField1("hey y'all");
+ show.setMainField2("");
+ show.setMainField3("");
+ show.setMainField4("");
+ rpcs.add(show);
+
+ // rpc 2
+ Show show2 = new Show();
+ show2.setMainField1("");
+ show2.setMainField2("It is Wednesday My Dudes");
+ show2.setMainField3("");
+ show2.setMainField4("");
+ rpcs.add(show2);
+
+ OnMultipleRequestListener mrl = new OnMultipleRequestListener() {
+ @Override
+ public void onUpdate(int remainingRequests) {
+
+ }
+
+ @Override
+ public void onFinished() {
+
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ assert false;
+ }
+
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+
+ }
+ };
+ try{
+ // public void sendSequentialRequests(List<RPCRequest> rpcs, final OnMultipleRequestListener listener) throws SdlException {
+ Method m = SdlProxyBase.class.getDeclaredMethod("sendSequentialRequests", SdlProxyBase.class);
+ assertNotNull(m);
+ m.setAccessible(true);
+ m.invoke(rpcs,mrl);
+ assert true;
+
+ }catch (Exception e){
+ assert false;
+ }
+ }
+
public class ProxyListenerTest implements IProxyListenerALM {
@Override
@@ -432,6 +577,31 @@ public class SdlProxyBaseTests extends AndroidTestCase{
}
@Override
+ public void onGetSystemCapabilityResponse(GetSystemCapabilityResponse response) {
+ Log.i(TAG, "GetSystemCapability response from SDL: " + response);
+ }
+
+ @Override
+ public void onGetInteriorVehicleDataResponse(GetInteriorVehicleDataResponse response) {
+ Log.i(TAG, "GetInteriorVehicleData response from SDL: " + response);
+ }
+
+ @Override
+ public void onButtonPressResponse(ButtonPressResponse response) {
+ Log.i(TAG, "ButtonPress response from SDL: " + response);
+ }
+
+ @Override
+ public void onSetInteriorVehicleDataResponse(SetInteriorVehicleDataResponse response) {
+ Log.i(TAG, "SetInteriorVehicleData response from SDL: " + response);
+ }
+
+ @Override
+ public void onOnInteriorVehicleData(OnInteriorVehicleData notification) {
+
+ }
+
+ @Override
public void onOnDriverDistraction(OnDriverDistraction notification) {
// Some RPCs (depending on region) cannot be sent when driver distraction is active.
}
@@ -444,5 +614,10 @@ public class SdlProxyBaseTests extends AndroidTestCase{
public void onGenericResponse(GenericResponse response) {
Log.i(TAG, "Generic response from SDL: " + response.getResultCode().name() + " Info: " + response.getInfo());
}
+
+ @Override
+ public void onSendHapticDataResponse(SendHapticDataResponse response) {
+ Log.i(TAG, "SendHapticDataResponse response from SDL: " + response);
+ }
}
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
new file mode 100644
index 000000000..8d2ef8d20
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
@@ -0,0 +1,173 @@
+package com.smartdevicelink.test.proxy;
+
+import android.test.AndroidTestCase;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.SystemCapabilityManager;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
+import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
+import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
+import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
+import com.smartdevicelink.proxy.rpc.HMICapabilities;
+import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
+import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
+import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.SystemCapability;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+import com.smartdevicelink.util.CorrelationIdGenerator;
+
+import java.util.List;
+
+public class SystemCapabilityManagerTests extends AndroidTestCase {
+ public static final String TAG = "SystemCapabilityManagerTests";
+ public static SystemCapabilityManager systemCapabilityManager;
+
+ @Override
+ protected void setUp() throws Exception{
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public SystemCapabilityManager createSampleManager(){
+ SystemCapabilityManager systemCapabilityManager = new SystemCapabilityManager(new InternalSDLInterface());
+
+ RegisterAppInterfaceResponse raiResponse = new RegisterAppInterfaceResponse();
+
+ raiResponse.setHmiCapabilities(Test.GENERAL_HMICAPABILITIES);
+ raiResponse.setDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES);
+ raiResponse.setAudioPassThruCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST);
+ raiResponse.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
+ raiResponse.setHmiZoneCapabilities(Test.GENERAL_HMIZONECAPABILITIES_LIST);
+ raiResponse.setPresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES);
+ raiResponse.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ raiResponse.setSpeechCapabilities(Test.GENERAL_SPEECHCAPABILITIES_LIST);
+ raiResponse.setSuccess(true);
+
+ systemCapabilityManager.parseRAIResponse(raiResponse);
+ return systemCapabilityManager;
+ }
+
+ public void testParseRAI() {
+ systemCapabilityManager = createSampleManager();
+
+ assertTrue(Test.TRUE,
+ Validator.validateHMICapabilities(Test.GENERAL_HMICAPABILITIES, (HMICapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.HMI)));
+ assertTrue(Test.TRUE,
+ Validator.validateDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES, (DisplayCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY)));
+ assertTrue(Test.TRUE,
+ Validator.validateAudioPassThruCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, (List<AudioPassThruCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.AUDIO_PASSTHROUGH)));
+ assertTrue(Test.TRUE,
+ Validator.validateButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST, (List<ButtonCapabilities> )systemCapabilityManager.getCapability(SystemCapabilityType.BUTTON)));
+ assertTrue(Test.TRUE,
+ Validator.validateHMIZoneCapabilities(Test.GENERAL_HMIZONECAPABILITIES_LIST, (List<HmiZoneCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.HMI_ZONE)));
+ assertTrue(Test.TRUE,
+ Validator.validatePresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES, (PresetBankCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.PRESET_BANK)));
+ assertTrue(Test.TRUE,
+ Validator.validateSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST, (List<SoftButtonCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON)));
+ assertTrue(Test.TRUE,
+ Validator.validateSpeechCapabilities(Test.GENERAL_SPEECHCAPABILITIES_LIST, (List<SpeechCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SPEECH)));
+ }
+
+ public void testGetVSCapability(){
+ VideoStreamingCapability vsCapability = new VideoStreamingCapability();
+ vsCapability.setMaxBitrate(Test.GENERAL_INT);
+ vsCapability.setPreferredResolution(Test.GENERAL_IMAGERESOLUTION);
+ vsCapability.setSupportedFormats(Test.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 sendRPCRequest(RPCRequest message) {
+ GetSystemCapabilityResponse response = new GetSystemCapabilityResponse();
+ response.setSystemCapability(referenceCapability);
+ response.setSuccess(true);
+ message.getOnRPCResponseListener().onResponse(CorrelationIdGenerator.generateId(), response);
+ }
+ });
+
+ systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
+ @Override
+ public void onCapabilityRetrieved(Object capability) {
+ assertTrue(Test.TRUE,
+ Validator.validateVideoStreamingCapability(
+ (VideoStreamingCapability) referenceCapability.getCapabilityForType(SystemCapabilityType.VIDEO_STREAMING),
+ (VideoStreamingCapability) capability));
+ }
+
+ @Override
+ public void onError(String info) {
+ assertTrue(false);
+ }
+ });
+ }
+
+ public void testListConversion(){
+ SystemCapabilityManager systemCapabilityManager = createSampleManager();
+ Object capability = systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON);
+ assertNotNull(capability);
+ List<SoftButtonCapabilities> list = SystemCapabilityManager.convertToList(capability, SoftButtonCapabilities.class);
+ assertNotNull(list);
+
+ }
+
+ private class InternalSDLInterface implements ISdl{
+ @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 stopVideoService() {}
+
+ @Override
+ public void startAudioService(boolean encrypted) {}
+
+ @Override
+ public void stopAudioService() {}
+
+ @Override
+ public void sendRPCRequest(RPCRequest message) {}
+
+ @Override
+ public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {}
+
+ @Override
+ public boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {return false;}
+ }
+
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java
new file mode 100644
index 000000000..028f5dd30
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java
@@ -0,0 +1,328 @@
+package com.smartdevicelink.test.rpc;
+
+import android.test.AndroidTestCase;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project
+ * It makes sure that for each RPC, all mandatory parameters are set in a constructor
+ */
+
+public class RPCConstructorsTests extends AndroidTestCase {
+
+ private final String XML_FILE_NAME = "xml/MOBILE_API_4.5.0.xml";
+ private final String RPC_PACKAGE_PREFIX = "com.smartdevicelink.proxy.rpc.";
+ private Map<String, List<Parameter>> rpcMandatoryParamsMapFromXml;
+
+ private class Parameter {
+ private String name;
+ private String type;
+ private boolean isArray;
+
+ public Parameter(String name, String type, boolean isArray) {
+ this.name = name;
+ this.type = type;
+ this.isArray = isArray;
+ }
+ }
+
+ @Override
+ public void setUp(){
+ try {
+ super.setUp();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ // Map that has keys correspond to the RPC names and values correspond to the
+ // mandatory params for that RPC. All info are loaded from the RPC spec xml file
+ rpcMandatoryParamsMapFromXml = getRPCMandatoryParamsMap(XML_FILE_NAME);
+
+ }
+
+ // This method parses the RPC spec xml file and returns a map that has
+ // keys correspond to the RPC names and values correspond to the mandatory params for that RPC
+ private Map<String, List<Parameter>> getRPCMandatoryParamsMap(String fileName) {
+ Map<String, List<Parameter>> rpcMandatoryParamsMap = new HashMap<>();
+ try {
+ InputStream stream = this.mContext.getAssets().open(fileName);
+ XmlPullParserFactory xmlFactoryObject = XmlPullParserFactory.newInstance();
+ XmlPullParser myParser = xmlFactoryObject.newPullParser();
+ myParser.setInput(stream, null);
+ int event = myParser.getEventType();
+ String rpcName = null;
+ boolean ignoreRPC = false;
+ while (event != XmlPullParser.END_DOCUMENT) {
+ String name = myParser.getName();
+ 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");
+ ignoreRPC = false;
+ 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") || rpcName.equals("AppInfo")){
+ ignoreRPC = true;
+ }
+ // -------------------------------------------------------------------------------------------------------------
+
+ if (!ignoreRPC) {
+ rpcMandatoryParamsMap.put(rpcName, new ArrayList<Parameter>());
+ }
+ }
+ // Store the mandatory params for the current RPC in the map
+ if(name.equals("param") && !ignoreRPC){
+ boolean mandatory = Boolean.valueOf(myParser.getAttributeValue(null,"mandatory"));
+ if (mandatory) {
+ String paramName = myParser.getAttributeValue(null, "name");
+ String paramType = myParser.getAttributeValue(null, "type");
+ boolean paramIsArray = Boolean.valueOf(myParser.getAttributeValue(null, "array"));
+
+ // -------------- Exceptional cases because of mismatch between the RPC spec and the Android code --------------
+ if (paramType.equals("SyncMsgVersion")){
+ paramType = "SdlMsgVersion";
+ } else if (rpcName.equals("GPSData") && paramType.equals("Float")){
+ paramType = "Double";
+ } else if (rpcName.equals("TouchEvent") && paramType.equals("Integer") && paramIsArray){
+ paramType = "Long";
+ }
+
+ if (paramName.equals("syncFileName")){
+ paramName = "sdlFileName";
+ } else if (paramName.equals("syncMsgVersion")){
+ paramName = "sdlMsgVersion";
+ } else if (paramName.equals("hmiPermissions")){
+ paramName = "hMIPermissions";
+ } else if (paramName.equals("resolution")){
+ paramName = "imageResolution";
+ } else if (paramName.equals("pressureTelltale")){
+ paramName = "pressureTellTale";
+ }
+ // -------------------------------------------------------------------------------------------------------------
+
+ Parameter param = new Parameter(paramName, paramType, paramIsArray);
+ rpcMandatoryParamsMap.get(rpcName).add(param);
+ }
+ }
+ break;
+ }
+ event = myParser.next();
+ }
+ stream.close();
+ } catch (IOException | XmlPullParserException e) {
+ e.printStackTrace();
+ }
+ return rpcMandatoryParamsMap;
+ }
+
+ // This method makes sure that for every RPC, there is a constructor that has all the mandatory params
+ // It also checks if there are RPC in the XML file that don't exist in the code
+ public void testMandatoryParamsMatch() {
+ // List of RPC names that don't have a constructor that has all mandatory params
+ List<String> rpcsWithInvalidConstructor = new ArrayList<>();
+
+ // List of the RPC names that couldn't be found in code
+ // potentially because of a mismatch between name in the RPC spec xml file and name in code
+ List<String> rpcsFromXmlNotFoundInCode = new ArrayList<>();
+
+ // Loop through all RPCs that were loaded from RPC spec XML file
+ // and make sure that every RPC has a constructor that has all mandatory params
+ for (String rpcName : rpcMandatoryParamsMapFromXml.keySet()) {
+ Class aClass;
+ try {
+ aClass = Class.forName(RPC_PACKAGE_PREFIX + rpcName);
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ rpcsFromXmlNotFoundInCode.add(rpcName);
+ continue;
+ }
+ List<String> mandatoryParamsListFromXML = new ArrayList<>();
+ 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){
+ type = String.format("List<%s>", type);
+ }
+ mandatoryParamsListFromXML.add(type);
+ }
+ List<String> mandatoryParamsListFromCode = new ArrayList<>();
+ boolean rpcHasValidConstructor = false;
+ for (Constructor constructor : aClass.getConstructors()){
+ mandatoryParamsListFromCode.clear();
+ for (Type paramType : constructor.getGenericParameterTypes()){
+ String paramFullType = paramType.toString();
+ String paramSimpleType;
+
+ // If the param is a list of objects, the type should be like "List<Object>"
+ if (paramFullType.matches("java.util.List<.+>")) {
+ 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(">")){
+ paramSimpleType = paramFullType.substring(paramFullType.lastIndexOf('.') + 1, paramFullType.length());
+ }
+ else {
+ paramSimpleType = paramFullType;
+ }
+ mandatoryParamsListFromCode.add(paramSimpleType);
+ }
+ if (mandatoryParamsListFromCode.containsAll(mandatoryParamsListFromXML) && mandatoryParamsListFromXML.containsAll(mandatoryParamsListFromCode)){
+ rpcHasValidConstructor = true;
+ break;
+ }
+ }
+ if (!rpcHasValidConstructor){
+ rpcsWithInvalidConstructor.add(rpcName);
+ }
+ }
+ assertTrue("The following RPCs were not found in the code: " + rpcsFromXmlNotFoundInCode, rpcsFromXmlNotFoundInCode.isEmpty());
+ assertTrue("The following RPCs don't have a constructor that has all the mandatory params: " + rpcsWithInvalidConstructor, rpcsWithInvalidConstructor.isEmpty());
+ }
+
+ // This method makes sure that for every RPC, the constructor that has the mandatory params is setting the values correctly
+ public void testMandatoryParamsValues() {
+ // List of RPC names that have a constructor which is not settings the values for the mandatory params correctly
+ List<String> rpcsWithInvalidConstructor = new ArrayList<>();
+
+ // List of types that exist in java.lang.*
+ List<String> javaLangBuiltInTypes = Arrays.asList("String", "Integer", "Float", "Double", "Boolean");
+
+ // Loop through all RPCs that were loaded from RPC spec XML file
+ // and make sure that the constructor that has the mandatory params is setting the values correctly
+ for (String rpcName : rpcMandatoryParamsMapFromXml.keySet()) {
+ Class aClass;
+ try {
+ aClass = Class.forName(RPC_PACKAGE_PREFIX + rpcName);
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ continue;
+ }
+
+ List<Parameter> parameters = rpcMandatoryParamsMapFromXml.get(rpcName);
+ List<Class<?>> mandatoryParamsTypes = new ArrayList<>();
+ List<Object> mandatoryParamsValues = new ArrayList<>();
+
+ // Loop through all mandatory params for the current RPC
+ // and try to find the full Java type for each param
+ // also assign a value for each param from com.smartdevicelink.test.Test class
+ for (Parameter param : parameters) {
+ String typeString = null;
+ Class<?> type = null;
+ String valueString = null;
+ Object value = null;
+
+ // Find the full Java type for the current param
+ try {
+ if (param.isArray) {
+ type = List.class;
+ } else {
+ if (javaLangBuiltInTypes.contains(param.type)){
+ typeString = "java.lang." + param.type;
+ } else {
+ typeString = RPC_PACKAGE_PREFIX + param.type;
+ }
+ type = Class.forName(typeString);
+ }
+
+ } catch (ClassNotFoundException e) {
+ // If the class was not found in the com.smartdevicelink.proxy.rpc package
+ // try to see if it can be found in com.smartdevicelink.proxy.rpc.enums package
+ typeString = RPC_PACKAGE_PREFIX + "enums." + param.type;
+ try {
+ type = Class.forName(typeString);
+ } catch (ClassNotFoundException e1) {
+ e1.printStackTrace();
+ assertTrue("Type: " + typeString + " cannot be found for RPC: " + rpcName , false);
+ }
+ }
+
+
+ // Assign a value for the current param from com.smartdevicelink.test.Test based of the param type
+ 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")){
+ value = "5558675309";
+ }
+ // -------------------------------------------------------------------------------------------------------------
+
+ if (value == null) {
+ valueString = "GENERAL_" + param.type.toUpperCase();
+ if (param.isArray){
+ valueString += "_LIST";
+ }
+ value = Class.forName("com.smartdevicelink.test.Test").getDeclaredField(valueString).get(null);
+ }
+
+ } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
+ e.printStackTrace();
+ assertTrue("Value: " + valueString + " cannot be found for RPC: " + rpcName + ". Make sure that you declared that value in com.smartdevicelink.test.Test" , false);
+ }
+
+ mandatoryParamsTypes.add(type);
+ mandatoryParamsValues.add(value);
+ }
+
+
+ // Create an instance of the RPC object using the constructor that has all the mandatory params
+ Object instance = null;
+ 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) {
+ e.printStackTrace();
+ assertTrue("Constructor for RPC " + rpcName + " cannot be invoked. Make sure that the constructor parameters order and types are identical to the RPC specs", false);
+ }
+
+
+ // Loop through all getter methods for the instance and make sure that they are returning the expected values
+ if (instance != null) {
+ for (int i = 0; i < parameters.size(); i++) {
+ // Find the getter method name by taking the param name, capitalize the first letter, then add thw word "get" to the beginning
+ // for example if the param name is "buttonName" the method name will be "getButtonName"
+ String getterMethodName = "get" + parameters.get(i).name.substring(0, 1).toUpperCase() + parameters.get(i).name.substring(1);
+ try {
+ Method getterMethod = aClass.getMethod(getterMethodName);
+ Object val = getterMethod.invoke(instance);
+ if (val == null || !val.equals(mandatoryParamsValues.get(i))) {
+ rpcsWithInvalidConstructor.add(rpcName);
+ break;
+ }
+ } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+ e.printStackTrace();
+ assertTrue("Method: " + getterMethodName + " cannot be found for RPC: " + rpcName + ". Make sure that the method exists and that the parameters order and types are identical to the RPC specs", false);
+
+ }
+ }
+ }
+ }
+
+ assertTrue("The following RPCs have a constructor that is not setting the mandatory params correctly: " + rpcsWithInvalidConstructor, rpcsWithInvalidConstructor.isEmpty());
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
new file mode 100644
index 000000000..33f9d2631
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
@@ -0,0 +1,160 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
+import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.ClimateControlCapabilities}
+ */
+public class ClimateControlCapabilitiesTests extends TestCase{
+
+ private ClimateControlCapabilities msg;
+
+ @Override
+ public void setUp(){
+ msg = new ClimateControlCapabilities();
+
+ msg.setModuleName(Test.GENERAL_STRING);
+ msg.setFanSpeedAvailable(Test.GENERAL_BOOLEAN);
+ msg.setDesiredTemperatureAvailable(Test.GENERAL_BOOLEAN);
+ msg.setAcEnableAvailable(Test.GENERAL_BOOLEAN);
+ msg.setAcMaxEnableAvailable(Test.GENERAL_BOOLEAN);
+ msg.setCirculateAirEnableAvailable(Test.GENERAL_BOOLEAN);
+ msg.setAutoModeEnableAvailable(Test.GENERAL_BOOLEAN);
+ msg.setDualModeEnableAvailable(Test.GENERAL_BOOLEAN);
+ msg.setDefrostZoneAvailable(Test.GENERAL_BOOLEAN);
+ msg.setDefrostZone(Test.GENERAL_DEFROSTZONE_LIST);
+ msg.setVentilationModeAvailable(Test.GENERAL_BOOLEAN);
+ msg.setVentilationMode(Test.GENERAL_VENTILATIONMODE_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String moduleName = msg.getModuleName();
+ boolean fanSpeedAvailable = msg.getFanSpeedAvailable();
+ boolean desiredTemperatureAvailable = msg.getDesiredTemperatureAvailable();
+ boolean acEnableAvailable = msg.getAcEnableAvailable();
+ boolean acMaxEnableAvailable = msg.getAcMaxEnableAvailable();
+ boolean circulateAirEnableAvailable = msg.getCirculateAirEnableAvailable();
+ boolean autoModeEnableAvailable = msg.getAutoModeEnableAvailable();
+ boolean dualModeEnableAvailable = msg.getDualModeEnableAvailable();
+ boolean defrostZoneAvailable = msg.getDefrostZoneAvailable();
+ List<DefrostZone> defrostZone = msg.getDefrostZone();
+ boolean ventilationModeAvailable = msg.getVentilationModeAvailable();
+ List<VentilationMode> ventilationMode = msg.getVentilationMode();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, fanSpeedAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, desiredTemperatureAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acEnableAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acMaxEnableAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, circulateAirEnableAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, autoModeEnableAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dualModeEnableAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, defrostZoneAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ventilationModeAvailable);
+
+ assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE_LIST.size(), defrostZone.size());
+ assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE_LIST.size(), ventilationMode.size());
+
+ for(int i = 0; i < Test.GENERAL_DEFROSTZONE_LIST.size(); i++){
+ assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE_LIST.get(i), defrostZone.get(i));
+ }
+ for(int i = 0; i < Test.GENERAL_VENTILATIONMODE_LIST.size(); i++){
+ assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE_LIST.get(i), ventilationMode.get(i));
+ }
+
+ // Invalid/Null Tests
+ ClimateControlCapabilities msg = new ClimateControlCapabilities();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getModuleName());
+ assertNull(Test.NULL, msg.getFanSpeedAvailable());
+ assertNull(Test.NULL, msg.getDesiredTemperatureAvailable());
+ assertNull(Test.NULL, msg.getAcEnableAvailable());
+ assertNull(Test.NULL, msg.getAcMaxEnableAvailable());
+ assertNull(Test.NULL, msg.getAutoModeEnableAvailable());
+ assertNull(Test.NULL, msg.getDualModeEnableAvailable());
+ assertNull(Test.NULL, msg.getDefrostZoneAvailable());
+ assertNull(Test.NULL, msg.getDefrostZone());
+ assertNull(Test.NULL, msg.getVentilationModeAvailable());
+ assertNull(Test.NULL, msg.getVentilationMode());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(ClimateControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
+ reference.put(ClimateControlCapabilities.KEY_FAN_SPEED_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_DESIRED_TEMPERATURE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_AC_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_AC_MAX_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_AUTO_MODE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_DUAL_MODE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_DEFROST_ZONE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_VENTILATION_MODE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_DEFROST_ZONE, JsonUtils.createJsonArray(Test.GENERAL_DEFROSTZONE_LIST));
+ reference.put(ClimateControlCapabilities.KEY_VENTILATION_MODE, JsonUtils.createJsonArray(Test.GENERAL_VENTILATIONMODE_LIST));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(ClimateControlCapabilities.KEY_DEFROST_ZONE)) {
+ JSONArray defrostZoneArrayReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray defrostZoneArrayTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ List<DefrostZone> defrostZoneListReference = new ArrayList<DefrostZone>();
+ List<DefrostZone> defrostZoneListTest = new ArrayList<DefrostZone>();
+
+ assertEquals(Test.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) );
+ }
+ assertTrue(Test.TRUE, defrostZoneListReference.containsAll(defrostZoneListTest) && defrostZoneListTest.containsAll(defrostZoneListReference));
+ } 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>();
+ List<VentilationMode> ventilationModeListTest = new ArrayList<VentilationMode>();
+
+ assertEquals(Test.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) );
+ }
+ assertTrue(Test.TRUE, ventilationModeListReference.containsAll(ventilationModeListTest) && ventilationModeListTest.containsAll(ventilationModeListReference));
+ } else{
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
new file mode 100644
index 000000000..5b0eefa9f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
@@ -0,0 +1,130 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.ClimateControlData;
+import com.smartdevicelink.proxy.rpc.Temperature;
+import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
+import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.ClimateControlData}
+ */
+public class ClimateControlDataTests extends TestCase{
+
+ private ClimateControlData msg;
+
+ @Override
+ public void setUp(){
+ msg = new ClimateControlData();
+
+ msg.setFanSpeed(Test.GENERAL_INT);
+ msg.setCurrentTemperature(Test.GENERAL_TEMPERATURE);
+ msg.setDesiredTemperature(Test.GENERAL_TEMPERATURE);
+ msg.setAcEnable(Test.GENERAL_BOOLEAN);
+ msg.setCirculateAirEnable(Test.GENERAL_BOOLEAN);
+ msg.setAutoModeEnable(Test.GENERAL_BOOLEAN);
+ msg.setDefrostZone(Test.GENERAL_DEFROSTZONE);
+ msg.setDualModeEnable(Test.GENERAL_BOOLEAN);
+ msg.setAcMaxEnable(Test.GENERAL_BOOLEAN);
+ msg.setVentilationMode(Test.GENERAL_VENTILATIONMODE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ int fanSpeed = msg.getFanSpeed();
+ Temperature currentTemperature = msg.getCurrentTemperature();
+ Temperature desiredTemperature = msg.getDesiredTemperature();
+ boolean acEnable = msg.getAcEnable();
+ boolean circulateAirEnable = msg.getCirculateAirEnable();
+ boolean autoModeEnable = msg.getAutoModeEnable();
+ DefrostZone defrostZone = msg.getDefrostZone();
+ boolean dualModeEnable = msg.getDualModeEnable();
+ boolean acMaxEnable = msg.getAcMaxEnable();
+ VentilationMode ventilationMode = msg.getVentilationMode();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INT, fanSpeed);
+ assertTrue(Test.TRUE, Validator.validateTemperature(Test.GENERAL_TEMPERATURE, currentTemperature));
+ assertTrue(Test.TRUE, Validator.validateTemperature(Test.GENERAL_TEMPERATURE, desiredTemperature));
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acEnable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, circulateAirEnable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, autoModeEnable);
+ assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE, defrostZone);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dualModeEnable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, acMaxEnable);
+ assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE, ventilationMode);
+
+ // Invalid/Null Tests
+ ClimateControlData msg = new ClimateControlData();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getFanSpeed());
+ assertNull(Test.NULL, msg.getCurrentTemperature());
+ assertNull(Test.NULL, msg.getDesiredTemperature());
+ assertNull(Test.NULL, msg.getAcEnable());
+ assertNull(Test.NULL, msg.getCirculateAirEnable());
+ assertNull(Test.NULL, msg.getAutoModeEnable());
+ assertNull(Test.NULL, msg.getDefrostZone());
+ assertNull(Test.NULL, msg.getDualModeEnable());
+ assertNull(Test.NULL, msg.getAcMaxEnable());
+ assertNull(Test.NULL, msg.getVentilationMode());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(ClimateControlData.KEY_FAN_SPEED, Test.GENERAL_INT);
+ reference.put(ClimateControlData.KEY_CURRENT_TEMPERATURE, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_TEMPERATURE.getStore()));
+ reference.put(ClimateControlData.KEY_DESIRED_TEMPERATURE, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_TEMPERATURE.getStore()));
+ reference.put(ClimateControlData.KEY_AC_ENABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_CIRCULATE_AIR_ENABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_AUTO_MODE_ENABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_DUAL_MODE_ENABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_AC_MAX_ENABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_DEFROST_ZONE, Test.GENERAL_DEFROSTZONE);
+ reference.put(ClimateControlData.KEY_VENTILATION_MODE, Test.GENERAL_VENTILATIONMODE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(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(Test.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(Test.TRUE, Validator.validateTemperature( new Temperature(hashReference), new Temperature(hashTest)));
+ } else{
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
index e548685ad..cc4813caa 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMICapabilitiesTests.java
@@ -11,10 +11,7 @@ import org.json.JSONObject;
import static com.smartdevicelink.proxy.rpc.HMICapabilities.KEY_NAVIGATION;
import static com.smartdevicelink.proxy.rpc.HMICapabilities.KEY_PHONE_CALL;
-
-/**
- * Created by austinkirk on 6/7/17.
- */
+import static com.smartdevicelink.proxy.rpc.HMICapabilities.KEY_VIDEO_STREAMING;
public class HMICapabilitiesTests extends TestCase {
private HMICapabilities msg;
@@ -25,6 +22,7 @@ public class HMICapabilitiesTests extends TestCase {
msg.setNavigationAvilable(Test.GENERAL_BOOLEAN);
msg.setPhoneCallAvilable(Test.GENERAL_BOOLEAN);
+ msg.setVideoStreamingAvailable(Test.GENERAL_BOOLEAN);
}
/**
@@ -34,10 +32,12 @@ public class HMICapabilitiesTests extends TestCase {
// Test Values
Boolean navAvail = msg.isNavigationAvailable();
Boolean phoneAvail = msg.isPhoneCallAvailable();
+ Boolean vidStreamAvail = msg.isVideoStreamingAvailable();
// Valid Tests
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, navAvail);
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, phoneAvail);
+ assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, vidStreamAvail);
// Invalid/Null Tests
HMICapabilities msg = new HMICapabilities();
@@ -45,6 +45,7 @@ public class HMICapabilitiesTests extends TestCase {
assertFalse(msg.isNavigationAvailable());
assertFalse(msg.isPhoneCallAvailable());
+ assertFalse(msg.isVideoStreamingAvailable());
}
public void testJson(){
@@ -53,6 +54,7 @@ public class HMICapabilitiesTests extends TestCase {
try{
reference.put(KEY_NAVIGATION, Test.GENERAL_BOOLEAN);
reference.put(HMICapabilities.KEY_PHONE_CALL, Test.GENERAL_BOOLEAN);
+ reference.put(HMICapabilities.KEY_VIDEO_STREAMING, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -63,6 +65,8 @@ public class HMICapabilitiesTests extends TestCase {
assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_PHONE_CALL),
JsonUtils.readStringListFromJsonObject(underTest, KEY_PHONE_CALL));
+ assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(reference, KEY_VIDEO_STREAMING),
+ JsonUtils.readStringListFromJsonObject(underTest, KEY_VIDEO_STREAMING));
} catch(JSONException e){
fail(Test.JSON_FAIL);
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java
new file mode 100644
index 000000000..c72204640
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.HapticRect;
+import com.smartdevicelink.proxy.rpc.Rectangle;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * Created by brettywhite on 8/24/17.
+ */
+
+public class HapticRectTests extends TestCase {
+
+ private HapticRect msg;
+
+ @Override
+ public void setUp() {
+ msg = new HapticRect();
+
+ msg.setId(Test.GENERAL_INTEGER);
+ msg.setRect(Test.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(Test.MATCH, Test.GENERAL_INTEGER, id);
+ assertEquals(Test.MATCH, Test.GENERAL_RECTANGLE, rect);
+
+ // Invalid/Null Tests
+ HapticRect msg = new HapticRect();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getId());
+ assertNull(Test.NULL, msg.getRect());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(HapticRect.KEY_ID, Test.GENERAL_INTEGER);
+ reference.put(HapticRect.KEY_RECT, Test.GENERAL_RECTANGLE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ assertEquals(Test.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(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java
new file mode 100644
index 000000000..5f27cc132
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java
@@ -0,0 +1,110 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.MetadataTags;
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class:
+ * {@link MetadataTags}
+ */
+
+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(Test.MATCH, exampleList, mainField1Types);
+ assertEquals(Test.MATCH, exampleList, mainField2Types);
+ assertEquals(Test.MATCH, exampleList, mainField3Types);
+ assertEquals(Test.MATCH, exampleList, mainField4Types);
+
+ // Test metadata set without a list
+ mainField1Types = msg2.getMainField1();
+ mainField2Types = msg2.getMainField2();
+ mainField3Types = msg2.getMainField3();
+ mainField4Types = msg2.getMainField4();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, MetadataType.CURRENT_TEMPERATURE, mainField1Types.get(0));
+ assertEquals(Test.MATCH, MetadataType.HUMIDITY, mainField2Types.get(0));
+ assertEquals(Test.MATCH, MetadataType.MAXIMUM_TEMPERATURE, mainField3Types.get(0));
+ assertEquals(Test.MATCH, MetadataType.MEDIA_ALBUM, mainField4Types.get(0));
+
+ // Invalid/Null Tests
+ MetadataTags msg = new MetadataTags();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getMainField1());
+ assertNull(Test.NULL, msg.getMainField2());
+ assertNull(Test.NULL, msg.getMainField3());
+ assertNull(Test.NULL, msg.getMainField4());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(MetadataTags.KEY_MAIN_FIELD_1_TYPE, Test.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_2_TYPE, Test.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_3_TYPE, Test.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_4_TYPE, Test.JSON_TEXTFIELDTYPES);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
new file mode 100644
index 000000000..ea71dfc8a
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
@@ -0,0 +1,95 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.ClimateControlData;
+import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.proxy.rpc.RadioControlData;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.ModuleData}
+ */
+public class ModuleDataTests extends TestCase{
+
+ private ModuleData msg;
+
+ @Override
+ public void setUp(){
+ msg = new ModuleData();
+
+ msg.setModuleType(Test.GENERAL_MODULETYPE);
+ msg.setRadioControlData(Test.GENERAL_RADIOCONTROLDATA);
+ msg.setClimateControlData(Test.GENERAL_CLIMATECONTROLDATA);
+ }
+
+ /**
+ * 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();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, moduleType);
+ assertTrue(Test.TRUE, Validator.validateRadioControlData(Test.GENERAL_RADIOCONTROLDATA, radioControlData));
+ assertTrue(Test.TRUE, Validator.validateClimateControlData(Test.GENERAL_CLIMATECONTROLDATA, climateControlData));
+
+ // Invalid/Null Tests
+ ModuleData msg = new ModuleData();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getModuleType());
+ assertNull(Test.NULL, msg.getRadioControlData());
+ assertNull(Test.NULL, msg.getClimateControlData());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(ModuleData.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
+ reference.put(ModuleData.KEY_RADIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_RADIOCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_CLIMATE_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_CLIMATECONTROLDATA.getStore()));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(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(Test.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(Test.TRUE, Validator.validateClimateControlData( new ClimateControlData(hashReference), new ClimateControlData(hashTest)));
+ } else{
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java
new file mode 100644
index 000000000..efbf7e30d
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/NavigationCapabilityTests.java
@@ -0,0 +1,69 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.NavigationCapability;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.NavigationCapability}
+ */
+public class NavigationCapabilityTests extends TestCase{
+
+ private NavigationCapability msg;
+
+ @Override
+ public void setUp(){
+ msg = new NavigationCapability();
+
+ msg.setSendLocationEnabled(Test.GENERAL_BOOLEAN);
+ msg.setWayPointsEnabled(Test.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ boolean sendLocationEnabled = msg.getSendLocationEnabled();
+ boolean getWayPointsEnabled = msg.getWayPointsEnabled();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, sendLocationEnabled);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, getWayPointsEnabled);
+
+ // Invalid/Null Tests
+ NavigationCapability msg = new NavigationCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getSendLocationEnabled());
+ assertNull(Test.NULL, msg.getWayPointsEnabled());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(NavigationCapability.KEY_GETWAYPOINTS_ENABLED, Test.GENERAL_BOOLEAN);
+ reference.put(NavigationCapability.KEY_LOCATION_ENABLED, Test.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java
new file mode 100644
index 000000000..2614db0fd
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PhoneCapabilityTests.java
@@ -0,0 +1,64 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.PhoneCapability;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.PhoneCapability}
+ */
+public class PhoneCapabilityTests extends TestCase{
+
+ private PhoneCapability msg;
+
+ @Override
+ public void setUp(){
+ msg = new PhoneCapability();
+
+ msg.setDialNumberEnabled(Test.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ boolean dialNumberEnabled = msg.getDialNumberEnabled();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dialNumberEnabled);
+
+ // Invalid/Null Tests
+ PhoneCapability msg = new PhoneCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getDialNumberEnabled());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(PhoneCapability.KEY_DIALNUMBER_ENABLED, Test.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
new file mode 100644
index 000000000..28c1d2c5b
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
@@ -0,0 +1,112 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.RadioControlCapabilities;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.RadioControlCapabilities}
+ */
+public class RadioControlCapabilitiesTests extends TestCase{
+
+ private RadioControlCapabilities msg;
+
+ @Override
+ public void setUp(){
+ msg = new RadioControlCapabilities();
+
+ msg.setModuleName(Test.GENERAL_STRING);
+ msg.setRadioEnableAvailable(Test.GENERAL_BOOLEAN);
+ msg.setRadioBandAvailable(Test.GENERAL_BOOLEAN);
+ msg.setRadioFrequencyAvailable(Test.GENERAL_BOOLEAN);
+ msg.setHdChannelAvailable(Test.GENERAL_BOOLEAN);
+ msg.setRdsDataAvailable(Test.GENERAL_BOOLEAN);
+ msg.setAvailableHDsAvailable(Test.GENERAL_BOOLEAN);
+ msg.setStateAvailable(Test.GENERAL_BOOLEAN);
+ msg.setSignalStrengthAvailable(Test.GENERAL_BOOLEAN);
+ msg.setSignalChangeThresholdAvailable(Test.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String moduleName = msg.getModuleName();
+ boolean radioEnableAvailable = msg.getRadioEnableAvailable();
+ boolean radioBandAvailable = msg.getRadioBandAvailable();
+ boolean radioFrequencyAvailable = msg.getRadioFrequencyAvailable();
+ boolean hdChannelAvailable = msg.getHdChannelAvailable();
+ boolean rdsDataAvailable = msg.getRdsDataAvailable();
+ boolean availableHDsAvailable = msg.getAvailableHDsAvailable();
+ boolean stateAvailable = msg.getStateAvailable();
+ boolean signalStrengthAvailable = msg.getSignalStrengthAvailable();
+ boolean signalChangeThresholdAvailable = msg.getSignalChangeThresholdAvailable();
+
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioEnableAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioBandAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioFrequencyAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, hdChannelAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, rdsDataAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, availableHDsAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, stateAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, signalStrengthAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, signalChangeThresholdAvailable);
+
+ // Invalid/Null Tests
+ RadioControlCapabilities msg = new RadioControlCapabilities();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getModuleName());
+ assertNull(Test.NULL, msg.getRadioEnableAvailable());
+ assertNull(Test.NULL, msg.getRadioBandAvailable());
+ assertNull(Test.NULL, msg.getRadioFrequencyAvailable());
+ assertNull(Test.NULL, msg.getHdChannelAvailable());
+ assertNull(Test.NULL, msg.getRdsDataAvailable());
+ assertNull(Test.NULL, msg.getAvailableHDsAvailable());
+ assertNull(Test.NULL, msg.getStateAvailable());
+ assertNull(Test.NULL, msg.getSignalStrengthAvailable());
+ assertNull(Test.NULL, msg.getSignalChangeThresholdAvailable());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(RadioControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
+ reference.put(RadioControlCapabilities.KEY_RADIO_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_RADIO_BAND_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_RADIO_FREQUENCY_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_HD_CHANNEL_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_RDS_DATA_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_AVAILABLE_HDS_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_STATE_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_SIGNAL_STRENGTH_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE, Test.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
new file mode 100644
index 000000000..b42145e8f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
@@ -0,0 +1,124 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.RadioControlData;
+import com.smartdevicelink.proxy.rpc.RdsData;
+import com.smartdevicelink.proxy.rpc.enums.RadioBand;
+import com.smartdevicelink.proxy.rpc.enums.RadioState;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.RadioControlData}
+ */
+public class RadioControlDataTests extends TestCase{
+
+ private RadioControlData msg;
+
+ @Override
+ public void setUp(){
+ msg = new RadioControlData();
+
+ msg.setFrequencyInteger(Test.GENERAL_INT);
+ msg.setFrequencyFraction(Test.GENERAL_INT);
+ msg.setBand(Test.GENERAL_RADIOBAND);
+ msg.setRdsData(Test.GENERAL_RDSDATA);
+ msg.setAvailableHDs(Test.GENERAL_INT);
+ msg.setHdChannel(Test.GENERAL_INT);
+ msg.setSignalStrength(Test.GENERAL_INT);
+ msg.setSignalChangeThreshold(Test.GENERAL_INT);
+ msg.setRadioEnable(Test.GENERAL_BOOLEAN);
+ msg.setState(Test.GENERAL_RADIOSTATE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ int frequencyInteger = msg.getFrequencyInteger();
+ int frequencyFraction = msg.getFrequencyFraction();
+ RadioBand band = msg.getBand();
+ RdsData rdsData = msg.getRdsData();
+ int availableHDs = msg.getAvailableHDs();
+ int hdChannel = msg.getHdChannel();
+ int signalStrength = msg.getSignalStrength();
+ int signalChangeThreshold = msg.getSignalChangeThreshold();
+ boolean radioEnable = msg.getRadioEnable();
+ RadioState state = msg.getState();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INT, frequencyInteger);
+ assertEquals(Test.MATCH, Test.GENERAL_INT, frequencyFraction);
+ assertEquals(Test.MATCH, Test.GENERAL_RADIOBAND, band);
+ assertTrue(Test.TRUE, Validator.validateRdsData(Test.GENERAL_RDSDATA, rdsData));
+ assertEquals(Test.MATCH, Test.GENERAL_INT, availableHDs);
+ assertEquals(Test.MATCH, Test.GENERAL_INT, hdChannel);
+ assertEquals(Test.MATCH, Test.GENERAL_INT, signalStrength);
+ assertEquals(Test.MATCH, Test.GENERAL_INT, signalChangeThreshold);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, radioEnable);
+ assertEquals(Test.MATCH, Test.GENERAL_RADIOSTATE, state);
+
+ // Invalid/Null Tests
+ RadioControlData msg = new RadioControlData();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getFrequencyInteger());
+ assertNull(Test.NULL, msg.getFrequencyFraction());
+ assertNull(Test.NULL, msg.getBand());
+ assertNull(Test.NULL, msg.getRdsData());
+ assertNull(Test.NULL, msg.getAvailableHDs());
+ assertNull(Test.NULL, msg.getHdChannel());
+ assertNull(Test.NULL, msg.getSignalStrength());
+ assertNull(Test.NULL, msg.getSignalChangeThreshold());
+ assertNull(Test.NULL, msg.getRadioEnable());
+ assertNull(Test.NULL, msg.getState());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(RadioControlData.KEY_FREQUENCY_INTEGER, Test.GENERAL_INT);
+ reference.put(RadioControlData.KEY_FREQUENCY_FRACTION, Test.GENERAL_INT);
+ reference.put(RadioControlData.KEY_BAND, Test.GENERAL_RADIOBAND);
+ reference.put(RadioControlData.KEY_RDS_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_RDSDATA.getStore()));
+ reference.put(RadioControlData.KEY_AVAILABLE_HDS, Test.GENERAL_INT);
+ reference.put(RadioControlData.KEY_HD_CHANNEL, Test.GENERAL_INT);
+ reference.put(RadioControlData.KEY_SIGNAL_STRENGTH, Test.GENERAL_INT);
+ reference.put(RadioControlData.KEY_SIGNAL_CHANGE_THRESHOLD, Test.GENERAL_INT);
+ reference.put(RadioControlData.KEY_RADIO_ENABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlData.KEY_STATE, Test.GENERAL_RADIOSTATE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(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(Test.TRUE, Validator.validateRadioControlData( new RadioControlData(hashReference), new RadioControlData(hashTest)));
+ } else{
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java
new file mode 100644
index 000000000..7414304b0
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RdsDataTests.java
@@ -0,0 +1,101 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.RdsData;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.RdsData}
+ */
+public class RdsDataTests extends TestCase{
+
+ private RdsData msg;
+
+ @Override
+ public void setUp(){
+ msg = new RdsData();
+
+ msg.setProgramService(Test.GENERAL_STRING);
+ msg.setRadioText(Test.GENERAL_STRING);
+ msg.setClockText(Test.GENERAL_STRING);
+ msg.setProgramIdentification(Test.GENERAL_STRING);
+ msg.setRegion(Test.GENERAL_STRING);
+ msg.setTrafficProgram(Test.GENERAL_BOOLEAN);
+ msg.setTrafficAnnouncement(Test.GENERAL_BOOLEAN);
+ msg.setProgramType(Test.GENERAL_INT);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String ps = msg.getProgramService();
+ String rt = msg.getRadioText();
+ String ct = msg.getClockText();
+ String pi = msg.getProgramIdentification();
+ int pty = msg.getProgramType();
+ boolean tp = msg.getTrafficProgram();
+ boolean ta = msg.getTrafficAnnouncement();
+ String reg = msg.getRegion();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, ps);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, rt);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, ct);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, pi);
+ assertEquals(Test.MATCH, Test.GENERAL_INT, pty);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, tp);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ta);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, reg);
+
+ // Invalid/Null Tests
+ RdsData msg = new RdsData();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getProgramService());
+ assertNull(Test.NULL, msg.getRadioText());
+ assertNull(Test.NULL, msg.getClockText());
+ assertNull(Test.NULL, msg.getProgramIdentification());
+ assertNull(Test.NULL, msg.getRegion());
+ assertNull(Test.NULL, msg.getTrafficProgram());
+ assertNull(Test.NULL, msg.getTrafficAnnouncement());
+ assertNull(Test.NULL, msg.getProgramType());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(RdsData.KEY_PS, Test.GENERAL_STRING);
+ reference.put(RdsData.KEY_RT, Test.GENERAL_STRING);
+ reference.put(RdsData.KEY_CT, Test.GENERAL_STRING);
+ reference.put(RdsData.KEY_PI, Test.GENERAL_STRING);
+ reference.put(RdsData.KEY_PTY, Test.GENERAL_INT);
+ reference.put(RdsData.KEY_TP, Test.GENERAL_BOOLEAN);
+ reference.put(RdsData.KEY_TA, Test.GENERAL_BOOLEAN);
+ reference.put(RdsData.KEY_REG, Test.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java
new file mode 100644
index 000000000..569a4db83
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java
@@ -0,0 +1,79 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.Rectangle;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link Rectangle}
+ */
+public class RectangleTests extends TestCase {
+
+ private Rectangle msg;
+
+ @Override
+ public void setUp() {
+ msg = new Rectangle();
+
+ msg.setX(Test.GENERAL_FLOAT);
+ msg.setY(Test.GENERAL_FLOAT);
+ msg.setWidth(Test.GENERAL_FLOAT);
+ msg.setHeight(Test.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(Test.MATCH, Test.GENERAL_FLOAT, x);
+ assertEquals(Test.MATCH, Test.GENERAL_FLOAT, y);
+ assertEquals(Test.MATCH, Test.GENERAL_FLOAT, width);
+ assertEquals(Test.MATCH, Test.GENERAL_FLOAT, height);
+
+ // Invalid/Null Tests
+ Rectangle msg = new Rectangle();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getX());
+ assertNull(Test.NULL, msg.getY());
+ assertNull(Test.NULL, msg.getWidth());
+ assertNull(Test.NULL, msg.getHeight());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(Rectangle.KEY_X, (Test.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_Y, (Test.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_WIDTH, (Test.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_HEIGHT, (Test.GENERAL_FLOAT));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java
new file mode 100644
index 000000000..a15179b8f
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RemoteControlCapabilitiesTests.java
@@ -0,0 +1,131 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities;
+import com.smartdevicelink.proxy.rpc.RadioControlCapabilities;
+import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.RemoteControlCapabilities}
+ */
+public class RemoteControlCapabilitiesTests extends TestCase{
+
+ private RemoteControlCapabilities msg;
+
+ @Override
+ public void setUp(){
+ msg = new RemoteControlCapabilities();
+
+ msg.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
+ msg.setRadioControlCapabilities(Test.GENERAL_RADIOCONTROLCAPABILITIES_LIST);
+ msg.setClimateControlCapabilities(Test.GENERAL_CLIMATECONTROLCAPABILITIES_LIST);
+ }
+
+ /**
+ * 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();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_BUTTONCAPABILITIES_LIST.size(), buttonCapabilities.size());
+ assertEquals(Test.MATCH, Test.GENERAL_RADIOCONTROLCAPABILITIES_LIST.size(), radioControlCapabilities.size());
+ assertEquals(Test.MATCH, Test.GENERAL_CLIMATECONTROLCAPABILITIES_LIST.size(), climateControlCapabilities.size());
+
+ assertTrue(Test.TRUE, Validator.validateButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST, buttonCapabilities));
+ assertTrue(Test.TRUE, Validator.validateRadioControlCapabilities(Test.GENERAL_RADIOCONTROLCAPABILITIES_LIST, radioControlCapabilities));
+ assertTrue(Test.TRUE, Validator.validateClimateControlCapabilities(Test.GENERAL_CLIMATECONTROLCAPABILITIES_LIST, climateControlCapabilities));
+
+ // Invalid/Null Tests
+ RemoteControlCapabilities msg = new RemoteControlCapabilities();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getButtonCapabilities());
+ assertNull(Test.NULL, msg.getRadioControlCapabilities());
+ assertNull(Test.NULL, msg.getClimateControlCapabilities());
+
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES, Test.JSON_BUTTONCAPABILITIES);
+ reference.put(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES, Test.JSON_RADIOCONTROLCAPABILITIES);
+ reference.put(RemoteControlCapabilities.KEY_CLIMATE_CONTROL_CAPABILITIES, Test.JSON_CLIMATECONTROLCAPABILITIES);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if(key.equals(RemoteControlCapabilities.KEY_BUTTON_CAPABILITIES)){
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ List<ButtonCapabilities> referenceList = new ArrayList<ButtonCapabilities>();
+ List<ButtonCapabilities> testList = new ArrayList<ButtonCapabilities>();
+ for(int i = 0; i < referenceArray.length(); i++){
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ referenceList.add(new ButtonCapabilities(hashReference));
+ Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ testList.add(new ButtonCapabilities(hashTest));
+ }
+ assertTrue(Test.TRUE, Validator.validateButtonCapabilities(referenceList, testList));
+ } else if(key.equals(RemoteControlCapabilities.KEY_RADIO_CONTROL_CAPABILITIES)){
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.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(Test.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(Test.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(Test.TRUE, Validator.validateClimateControlCapabilities(referenceList, testList));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
new file mode 100644
index 000000000..aa0d75c07
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
@@ -0,0 +1,108 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.NavigationCapability;
+import com.smartdevicelink.proxy.rpc.PhoneCapability;
+import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
+import com.smartdevicelink.proxy.rpc.SystemCapability;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.SystemCapability}
+ */
+public class SystemCapabilityTests extends TestCase {
+
+ private SystemCapability msg;
+
+ @Override
+ public void setUp() {
+ msg = new SystemCapability();
+
+ msg.setSystemCapabilityType(Test.GENERAL_SYSTEMCAPABILITYTYPE);
+ msg.setCapabilityForType(SystemCapabilityType.NAVIGATION, Test.GENERAL_NAVIGATIONCAPABILITY);
+ msg.setCapabilityForType(SystemCapabilityType.PHONE_CALL, Test.GENERAL_PHONECAPABILITY);
+ msg.setCapabilityForType(SystemCapabilityType.REMOTE_CONTROL, Test.GENERAL_REMOTECONTROLCAPABILITIES);
+
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ SystemCapabilityType testType = msg.getSystemCapabilityType();
+ NavigationCapability testNavigationCapability = (NavigationCapability) msg.getCapabilityForType(SystemCapabilityType.NAVIGATION);
+ PhoneCapability testPhoneCapability = (PhoneCapability) msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL);
+ RemoteControlCapabilities testRemoteControlCapabilities = (RemoteControlCapabilities) msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL);
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITYTYPE, testType);
+ assertTrue(Test.TRUE, Validator.validateNavigationCapability(Test.GENERAL_NAVIGATIONCAPABILITY, testNavigationCapability));
+ assertTrue(Test.TRUE, Validator.validatePhoneCapability(Test.GENERAL_PHONECAPABILITY, testPhoneCapability));
+ assertTrue(Test.TRUE, Validator.validateRemoteControlCapabilities(Test.GENERAL_REMOTECONTROLCAPABILITIES, testRemoteControlCapabilities));
+
+ // Invalid/Null Tests
+ SystemCapability msg = new SystemCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getSystemCapabilityType());
+ assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.NAVIGATION));
+ assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL));
+ assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL));
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(SystemCapability.KEY_SYSTEM_CAPABILITY_TYPE, Test.GENERAL_SYSTEMCAPABILITYTYPE);
+ reference.put(SystemCapability.KEY_NAVIGATION_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_NAVIGATIONCAPABILITY.getStore()));
+ reference.put(SystemCapability.KEY_PHONE_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_PHONECAPABILITY.getStore()));
+ reference.put(SystemCapability.KEY_REMOTE_CONTROL_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_REMOTECONTROLCAPABILITIES.getStore()));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if(key.equals(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(Test.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(Test.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(Test.TRUE, Validator.validateRemoteControlCapabilities( new RemoteControlCapabilities(hashReference), new RemoteControlCapabilities(hashTest)));
+ } else{
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java
new file mode 100644
index 000000000..090f5a235
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemperatureTests.java
@@ -0,0 +1,72 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.Temperature;
+import com.smartdevicelink.proxy.rpc.enums.TemperatureUnit;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.Temperature}
+ */
+public class TemperatureTests extends TestCase{
+
+ private Temperature msg;
+
+ @Override
+ public void setUp(){
+ msg = new Temperature();
+
+ msg.setUnit(Test.GENERAL_TEMPERATUREUNIT);
+ msg.setValue(Test.GENERAL_FLOAT);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ TemperatureUnit unit = msg.getUnit();
+ float value = msg.getValue();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_FLOAT, value);
+ assertEquals(Test.MATCH, Test.GENERAL_TEMPERATUREUNIT, unit);
+
+ // Invalid/Null Tests
+ Temperature msg = new Temperature();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getUnit());
+ assertNull(Test.NULL, msg.getValue());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(Temperature.KEY_VALUE, (Float) Test.GENERAL_FLOAT);
+ reference.put(Temperature.KEY_UNIT, Test.GENERAL_TEMPERATUREUNIT);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
new file mode 100644
index 000000000..54cfc1a22
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
@@ -0,0 +1,96 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.ImageResolution;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class VideoStreamingCapabilityTests extends TestCase {
+
+ private VideoStreamingCapability msg;
+
+ @Override
+ public void setUp() {
+ msg = new VideoStreamingCapability();
+ msg.setSupportedFormats(Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ msg.setPreferredResolution(Test.GENERAL_IMAGERESOLUTION);
+ msg.setMaxBitrate(Test.GENERAL_INT);
+ msg.setIsHapticSpatialDataSupported(Test.GENERAL_BOOLEAN);
+ }
+
+ /**
+ * 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();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, (List<VideoStreamingFormat>) Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST, format);
+ assertEquals(Test.MATCH, (ImageResolution) Test.GENERAL_IMAGERESOLUTION, res);
+ assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, maxBitrate);
+ assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, isHapticSpatialDataSupported);
+
+ // Invalid/Null Tests
+ VideoStreamingCapability msg = new VideoStreamingCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getMaxBitrate());
+ assertNull(Test.NULL, msg.getPreferredResolution());
+ assertNull(Test.NULL, msg.getSupportedFormats());
+ assertNull(Test.NULL, msg.getIsHapticSpatialDataSupported());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(VideoStreamingCapability.KEY_MAX_BITRATE, Test.GENERAL_INT);
+ reference.put(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION, Test.GENERAL_IMAGERESOLUTION);
+ reference.put(VideoStreamingCapability.KEY_SUPPORTED_FORMATS, Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ reference.put(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, Test.GENERAL_BOOLEAN);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(VideoStreamingCapability.KEY_MAX_BITRATE) || key.equals(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED)) {
+ assertTrue(Test.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++)))));
+ }
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java
new file mode 100644
index 000000000..ff7cb2719
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingFormatTests.java
@@ -0,0 +1,70 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.ImageResolution;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+public class VideoStreamingFormatTests extends TestCase {
+
+ private VideoStreamingFormat msg;
+
+ @Override
+ public void setUp() {
+ msg = new VideoStreamingFormat();
+ msg.setProtocol(Test.GENERAL_VIDEOSTREAMINGPROTOCOL);
+ msg.setCodec(Test.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(Test.MATCH, (VideoStreamingProtocol) Test.GENERAL_VIDEOSTREAMINGPROTOCOL, protocol);
+ assertEquals(Test.MATCH, (VideoStreamingCodec) Test.GENERAL_VIDEOSTREAMINGCODEC, codec);
+
+ // Invalid/Null Tests
+ VideoStreamingFormat msg = new VideoStreamingFormat();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getProtocol());
+ assertNull(Test.NULL, msg.getCodec());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(VideoStreamingFormat.KEY_PROTOCOL, Test.GENERAL_VIDEOSTREAMINGPROTOCOL);
+ reference.put(VideoStreamingFormat.KEY_CODEC, Test.GENERAL_VIDEOSTREAMINGCODEC);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
+
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java
index 76d203901..6446cb914 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java
@@ -10,7 +10,7 @@ import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.enums.AppHmiType}
+ * {@link com.smartdevicelink.proxy.rpc.enums.AppHMIType}
*/
public class AppHmiTypeTests extends TestCase {
@@ -34,10 +34,14 @@ public class AppHmiTypeTests extends TestCase {
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);
assertNotNull("DEFAULT returned null", enumDefault);
assertNotNull("COMMUNICATION returned null", enumCommunication);
@@ -47,8 +51,10 @@ public class AppHmiTypeTests extends TestCase {
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);
}
/**
@@ -93,9 +99,11 @@ public class AppHmiTypeTests extends TestCase {
enumTestList.add(AppHMIType.NAVIGATION);
enumTestList.add(AppHMIType.INFORMATION);
enumTestList.add(AppHMIType.SOCIAL);
- enumTestList.add(AppHMIType.BACKGROUND_PROCESS);
+ enumTestList.add(AppHMIType.BACKGROUND_PROCESS);
+ enumTestList.add(AppHMIType.PROJECTION);
enumTestList.add(AppHMIType.TESTING);
- enumTestList.add(AppHMIType.SYSTEM);
+ enumTestList.add(AppHMIType.SYSTEM);
+ enumTestList.add(AppHMIType.REMOTE_CONTROL);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java
index 1db7c4580..e37eb2fd1 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java
@@ -52,7 +52,44 @@ public class ButtonNameTests extends TestCase {
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);
@@ -71,6 +108,24 @@ public class ButtonNameTests extends TestCase {
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);
}
/**
@@ -125,7 +180,25 @@ public class ButtonNameTests extends TestCase {
enumTestList.add(ButtonName.PRESET_8);
enumTestList.add(ButtonName.PRESET_9);
enumTestList.add(ButtonName.CUSTOM_BUTTON);
- enumTestList.add(ButtonName.SEARCH);
+ 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);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DefrostZoneTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DefrostZoneTests.java
new file mode 100644
index 000000000..f1f375623
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DefrostZoneTests.java
@@ -0,0 +1,79 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.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 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) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * 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) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * 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);
+
+ 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/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LanguageTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LanguageTests.java
index 3679a9ffc..6b87c5d26 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LanguageTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/LanguageTests.java
@@ -10,7 +10,7 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.enums.Language}
+ * {@link com.smartdevicelink.proxy.rpc.enums.Language}
*/
public class LanguageTests extends TestCase {
@@ -20,6 +20,32 @@ public class LanguageTests extends TestCase {
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";
@@ -66,8 +92,25 @@ public class LanguageTests extends TestCase {
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);
@@ -91,6 +134,8 @@ public class LanguageTests extends TestCase {
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);
}
/**
@@ -130,6 +175,19 @@ public class LanguageTests extends TestCase {
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);
@@ -153,6 +211,8 @@ public class LanguageTests extends TestCase {
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));
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java
new file mode 100644
index 000000000..c1aff1bdd
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java
@@ -0,0 +1,114 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.MetadataTags}
+ */
+
+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);
+
+
+ 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 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());
+
+ 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));
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ModuleTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ModuleTypeTests.java
new file mode 100644
index 000000000..18a47b79d
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ModuleTypeTests.java
@@ -0,0 +1,71 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.enums.ModuleType}
+ */
+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);
+
+ assertNotNull("CLIMATE returned null", enumClimate);
+ assertNotNull("RADIO returned null", enumRadio);
+ }
+
+ /**
+ * 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 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);
+
+ 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/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioBandTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioBandTests.java
new file mode 100644
index 000000000..cc5d5b700
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioBandTests.java
@@ -0,0 +1,75 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.RadioBand;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.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);
+
+ 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);
+ 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 {
+ RadioBand temp = RadioBand.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ 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());
+
+ 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));
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioStateTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioStateTests.java
new file mode 100644
index 000000000..d16f00599
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RadioStateTests.java
@@ -0,0 +1,79 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.RadioState;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.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);
+
+ 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);
+ 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 {
+ RadioState temp = RadioState.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ 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());
+
+ 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));
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java
index 3eaae9937..5156c4f44 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java
@@ -82,6 +82,10 @@ public class ResultTests extends TestCase {
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);
assertNotNull("SUCCESS returned null", enumSuccess);
assertNotNull("INVALID_DATA returned null", enumInvalidData);
@@ -115,6 +119,8 @@ public class ResultTests extends TestCase {
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);
}
/**
@@ -183,7 +189,9 @@ public class ResultTests extends TestCase {
enumTestList.add(Result.SAVED);
enumTestList.add(Result.INVALID_CERT);
enumTestList.add(Result.EXPIRED_CERT);
- enumTestList.add(Result.RESUME_FAILED);
+ enumTestList.add(Result.RESUME_FAILED);
+ enumTestList.add(Result.DATA_NOT_AVAILABLE);
+ enumTestList.add(Result.READ_ONLY);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
new file mode 100644
index 000000000..9bd68a2ad
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
@@ -0,0 +1,119 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.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);
+
+ 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);
+ }
+
+ /**
+ * 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) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * 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) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * 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);
+
+ 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/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TouchTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TouchTypeTests.java
index 06636a045..db9c417ef 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TouchTypeTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TouchTypeTests.java
@@ -1,16 +1,16 @@
package com.smartdevicelink.test.rpc.enums;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import com.smartdevicelink.proxy.rpc.enums.TouchType;
import junit.framework.TestCase;
-import com.smartdevicelink.proxy.rpc.enums.TouchType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.enums.TouchType}
+ * {@link com.smartdevicelink.proxy.rpc.enums.TouchType}
*/
public class TouchTypeTests extends TestCase {
@@ -24,10 +24,14 @@ public class TouchTypeTests extends TestCase {
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);
}
/**
@@ -69,6 +73,7 @@ public class TouchTypeTests extends TestCase {
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));
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VentilationModeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VentilationModeTests.java
new file mode 100644
index 000000000..561e66a77
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VentilationModeTests.java
@@ -0,0 +1,79 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.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);
+
+ 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);
+ 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 {
+ VentilationMode temp = VentilationMode.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ 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());
+
+ 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));
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingCodecTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingCodecTests.java
new file mode 100644
index 000000000..b4aa8fd97
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingCodecTests.java
@@ -0,0 +1,79 @@
+package com.smartdevicelink.test.rpc.enums;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+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);
+
+ 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 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());
+
+ 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));
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingProtocolTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingProtocolTests.java
new file mode 100644
index 000000000..be50d2c30
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VideoStreamingProtocolTests.java
@@ -0,0 +1,82 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+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);
+
+ 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 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());
+
+ 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));
+ }
+}
+
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java
new file mode 100644
index 000000000..4fded53fe
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnInteriorVehicleDataTests.java
@@ -0,0 +1,69 @@
+package com.smartdevicelink.test.rpc.notifications;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.proxy.rpc.OnInteriorVehicleData;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.OnInteriorVehicleData}
+ */
+public class OnInteriorVehicleDataTests extends BaseRpcTests{
+
+ @Override
+ protected RPCMessage createMessage(){
+ OnInteriorVehicleData msg = new OnInteriorVehicleData();
+ msg.setModuleData(Test.GENERAL_MODULEDATA);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_NOTIFICATION;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.ON_INTERIOR_VEHICLE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(OnInteriorVehicleData.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore()));
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ ModuleData moduleData = ( (OnInteriorVehicleData) msg ).getModuleData();
+
+ // Valid Tests
+ assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, moduleData));
+
+ // Invalid/Null Tests
+ OnInteriorVehicleData msg = new OnInteriorVehicleData();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getModuleData());
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
new file mode 100644
index 000000000..f16a3a87c
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
@@ -0,0 +1,113 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ButtonPress;
+import com.smartdevicelink.proxy.rpc.enums.ButtonName;
+import com.smartdevicelink.proxy.rpc.enums.ButtonPressMode;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.ButtonPress}
+ */
+public class ButtonPressTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ ButtonPress msg = new ButtonPress();
+
+ msg.setModuleType(Test.GENERAL_MODULETYPE);
+ msg.setButtonPressMode(Test.GENERAL_BUTTONPRESSMODE);
+ msg.setButtonName(Test.GENERAL_BUTTONNAME);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.BUTTON_PRESS.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(ButtonPress.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
+ result.put(ButtonPress.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME);
+ result.put(ButtonPress.KEY_BUTTON_PRESS_MODE, Test.GENERAL_BUTTONPRESSMODE);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ ModuleType testModuleType = ( (ButtonPress) msg ).getModuleType();
+ ButtonName testButtonName = ( (ButtonPress) msg ).getButtonName();
+ ButtonPressMode testButtonPressMode = ( (ButtonPress) msg ).getButtonPressMode();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType);
+ assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, testButtonName);
+ assertEquals(Test.MATCH, Test.GENERAL_BUTTONPRESSMODE, testButtonPressMode);
+
+ // Invalid/Null Tests
+ ButtonPress msg = new ButtonPress();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getModuleType());
+ assertNull(Test.NULL, msg.getButtonName());
+ assertNull(Test.NULL, msg.getButtonPressMode());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ButtonPress cmd = new ButtonPress(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_NAME).toString(), cmd.getButtonName().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_PRESS_MODE).toString(), cmd.getButtonPressMode().toString());
+ }catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
new file mode 100644
index 000000000..5a08d4266
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
@@ -0,0 +1,105 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleData;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.GetInteriorVehicleData}
+ */
+public class GetInteriorVehicleDataTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ GetInteriorVehicleData msg = new GetInteriorVehicleData();
+
+ msg.setModuleType(Test.GENERAL_MODULETYPE);
+ msg.setSubscribe(Test.GENERAL_BOOLEAN);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_INTERIOR_VEHICLE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(GetInteriorVehicleData.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
+ result.put(GetInteriorVehicleData.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ ModuleType testModuleType = ( (GetInteriorVehicleData) msg ).getModuleType();
+ boolean testSubscribed = ( (GetInteriorVehicleData) msg ).getSubscribe();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testSubscribed);
+
+ // Invalid/Null Tests
+ GetInteriorVehicleData msg = new GetInteriorVehicleData();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getModuleType());
+ assertNull(Test.NULL, msg.getSubscribe());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetInteriorVehicleData cmd = new GetInteriorVehicleData(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_SUBSCRIBE), cmd.getSubscribe());
+ }catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
new file mode 100644
index 000000000..78d4507da
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetSystemCapabilityTests.java
@@ -0,0 +1,95 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetSystemCapability;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class GetSystemCapabilityTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ GetSystemCapability msg = new GetSystemCapability();
+
+ msg.setSystemCapabilityType(Test.GENERAL_SYSTEMCAPABILITYTYPE);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_SYSTEM_CAPABILITY.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE, Test.GENERAL_SYSTEMCAPABILITYTYPE);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ SystemCapabilityType testType = ( (GetSystemCapability) msg ).getSystemCapabilityType();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITYTYPE, testType);
+
+ // Invalid/Null Tests
+ GetSystemCapability msg = new GetSystemCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getSystemCapabilityType());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetSystemCapability cmd = new GetSystemCapability(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapability.KEY_SYSTEM_CAPABILITY_TYPE).toString(), cmd.getSystemCapabilityType().toString());
+ }catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java
new file mode 100644
index 000000000..7c3b0ed90
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java
@@ -0,0 +1,86 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.HapticRect;
+import com.smartdevicelink.proxy.rpc.SendHapticData;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by brettywhite on 8/9/17.
+ */
+
+public class SendHapticDataTests extends BaseRpcTests {
+
+ private SendHapticData msg;
+
+ @Override
+ protected RPCMessage createMessage(){
+ msg = new SendHapticData();
+
+ List<HapticRect> list = new ArrayList<>();
+ list.add(Test.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(Test.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.
+ */
+ public void testRpcValues () {
+ // Test Values
+ List<HapticRect> list = msg.getHapticRectData();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_HAPTIC_RECT, list.get(0));
+
+ // Invalid/Null Tests
+ SendHapticData msg = new SendHapticData();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getHapticRectData());
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java
new file mode 100644
index 000000000..f5ecb0d06
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetInteriorVehicleDataTests.java
@@ -0,0 +1,102 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.proxy.rpc.SetInteriorVehicleData;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.SetInteriorVehicleData}
+ */
+public class SetInteriorVehicleDataTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ SetInteriorVehicleData msg = new SetInteriorVehicleData();
+
+ msg.setModuleData(Test.GENERAL_MODULEDATA);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.SET_INTERIOR_VEHICLE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(SetInteriorVehicleData.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore()));
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ ModuleData testModuleData = ( (SetInteriorVehicleData) msg ).getModuleData();
+
+ // Valid Tests
+ assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, testModuleData));
+
+ // Invalid/Null Tests
+ SetInteriorVehicleData msg = new SetInteriorVehicleData();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getModuleData());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SetInteriorVehicleData cmd = new SetInteriorVehicleData(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ ModuleData referenceModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, SetInteriorVehicleData.KEY_MODULE_DATA)));
+
+ assertTrue(Test.TRUE, Validator.validateModuleData(referenceModuleData, cmd.getModuleData()));
+ }catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
index 5899d9015..9c7a681df 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
@@ -12,6 +12,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.Image;
+import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
@@ -23,12 +24,12 @@ import com.smartdevicelink.test.json.rpc.JsonFileReader;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.Show}
+ * {@link com.smartdevicelink.proxy.rpc.Show}
*/
public class ShowTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage() {
+ protected RPCMessage createMessage() {
Show msg = new Show();
msg.setMainField1(Test.GENERAL_STRING);
@@ -42,6 +43,7 @@ public class ShowTests extends BaseRpcTests {
msg.setSecondaryGraphic(Test.GENERAL_IMAGE);
msg.setCustomPresets(Test.GENERAL_STRING_LIST);
msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
+ msg.setMetadataTags(Test.GENERAL_METADATASTRUCT);
return msg;
}
@@ -66,12 +68,13 @@ public class ShowTests extends BaseRpcTests {
result.put(Show.KEY_MAIN_FIELD_3, Test.GENERAL_STRING);
result.put(Show.KEY_MAIN_FIELD_4, Test.GENERAL_STRING);
result.put(Show.KEY_STATUS_BAR, Test.GENERAL_STRING);
- result.put(Show.KEY_MEDIA_TRACK, Test.GENERAL_STRING);
+ result.put(Show.KEY_MEDIA_TRACK, Test.GENERAL_STRING);
result.put(Show.KEY_GRAPHIC, Test.JSON_IMAGE);
result.put(Show.KEY_SECONDARY_GRAPHIC, Test.JSON_IMAGE);
result.put(Show.KEY_ALIGNMENT, Test.GENERAL_TEXTALIGNMENT);
- result.put(Show.KEY_CUSTOM_PRESETS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ result.put(Show.KEY_CUSTOM_PRESETS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
result.put(Show.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(Show.KEY_METADATA_TAGS, Test.GENERAL_METADATASTRUCT.serializeJSON());
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -92,6 +95,7 @@ public class ShowTests extends BaseRpcTests {
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(Test.MATCH, Test.GENERAL_STRING, testTrack);
@@ -102,6 +106,7 @@ public class ShowTests extends BaseRpcTests {
assertEquals(Test.MATCH, Test.GENERAL_STRING, testText3);
assertEquals(Test.MATCH, Test.GENERAL_STRING, testText4);
assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), testCustomPresets.size());
+ assertEquals(Test.MATCH, Test.GENERAL_METADATASTRUCT, testMetadata);
assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testGraphic2));
assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testGraphic1));
@@ -121,7 +126,8 @@ public class ShowTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getSecondaryGraphic());
assertNull(Test.NULL, msg.getCustomPresets());
assertNull(Test.NULL, msg.getMediaTrack());
- assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(Test.NULL, msg.getMetadataTags());
}
/**
@@ -130,24 +136,24 @@ public class ShowTests extends BaseRpcTests {
public void testJsonConstructor () {
JSONObject commandJson = JsonFileReader.readId(this.mContext,getCommandType(), getMessageType());
assertNotNull(Test.NOT_NULL, commandJson);
-
+
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
Show cmd = new Show(hash);
-
+
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
assertNotNull(Test.NOT_NULL, body);
-
+
// Test everything in the json body.
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
-
+
JSONObject graphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_GRAPHIC);
Image referenceGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(graphic));
assertTrue(Test.TRUE, Validator.validateImage(referenceGraphic, cmd.getGraphic()));
-
+
List<String> customPresetsList = JsonUtils.readStringListFromJsonObject(parameters, Show.KEY_CUSTOM_PRESETS);
List<String> testPresetsList = cmd.getCustomPresets();
assertEquals(Test.MATCH, customPresetsList.size(), testPresetsList.size());
@@ -160,11 +166,12 @@ public class ShowTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_STATUS_BAR), cmd.getStatusBar());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_ALIGNMENT), cmd.getAlignment().toString());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MEDIA_TRACK), cmd.getMediaTrack());
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_METADATA_TAGS), cmd.getMetadataTags());
JSONObject secondaryGraphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_SECONDARY_GRAPHIC);
Image referenceSecondaryGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(secondaryGraphic));
assertTrue(Test.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++) {
@@ -172,9 +179,9 @@ public class ShowTests extends BaseRpcTests {
softButtonList.add(chunk);
}
assertTrue(Test.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
-
+
} catch (JSONException e) {
fail(Test.JSON_FAIL);
- }
- }
+ }
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java
new file mode 100644
index 000000000..64f5b0c75
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ButtonPressResponseTest.java
@@ -0,0 +1,74 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.ButtonPressResponse}
+ */
+public class ButtonPressResponseTest extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new ButtonPressResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.BUTTON_PRESS.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ ButtonPressResponse msg = new ButtonPressResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ButtonPressResponse cmd = new ButtonPressResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java
new file mode 100644
index 000000000..c76388c69
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataResponseTests.java
@@ -0,0 +1,110 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
+import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.GetInteriorVehicleDataResponse}
+ */
+public class GetInteriorVehicleDataResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+
+ GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse();
+
+ msg.setIsSubscribed(Test.GENERAL_BOOLEAN);
+ msg.setModuleData(Test.GENERAL_MODULEDATA);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_INTERIOR_VEHICLE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(GetInteriorVehicleDataResponse.KEY_IS_SUBSCRIBED, Test.GENERAL_BOOLEAN);
+ result.put(GetInteriorVehicleDataResponse.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore()));
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ boolean testIsSubscribed = ( (GetInteriorVehicleDataResponse) msg ).getIsSubscribed();
+ ModuleData testModuleData = ( (GetInteriorVehicleDataResponse) msg ).getModuleData();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testIsSubscribed);
+ assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, testModuleData));
+
+ // Invalid/Null Tests
+ GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getIsSubscribed());
+ assertNull(Test.NULL, msg.getModuleData());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetInteriorVehicleDataResponse cmd = new GetInteriorVehicleDataResponse (hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ ModuleData testModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataResponse.KEY_MODULE_DATA)));
+ ModuleData cmdModuleData = cmd.getModuleData();
+
+ assertTrue(Test.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData) );
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataResponse.KEY_IS_SUBSCRIBED), cmd.getIsSubscribed());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java
new file mode 100644
index 000000000..b9fd85a8e
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetSystemCapabilityResponseTests.java
@@ -0,0 +1,97 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
+import com.smartdevicelink.proxy.rpc.SystemCapability;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class GetSystemCapabilityResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse();
+
+ msg.setSystemCapability(Test.GENERAL_SYSTEMCAPABILITY);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_SYSTEM_CAPABILITY.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(GetSystemCapabilityResponse.KEY_SYSTEM_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_SYSTEMCAPABILITY.getStore()));
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ SystemCapability testCapability = ( (GetSystemCapabilityResponse) msg ).getSystemCapability();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITY.getSystemCapabilityType(), testCapability.getSystemCapabilityType());
+
+ // Invalid/Null Tests
+ GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getSystemCapability());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetSystemCapabilityResponse cmd = new GetSystemCapabilityResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ SystemCapability testCapability = new SystemCapability(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, GetSystemCapabilityResponse.KEY_SYSTEM_CAPABILITY)));
+ SystemCapability cmdCapability = cmd.getSystemCapability();
+ assertEquals(Test.MATCH, testCapability.getSystemCapabilityType(), cmdCapability.getSystemCapabilityType());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java
index a88256596..a08b35d24 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/RegisterAppInterfaceResponseTest.java
@@ -32,7 +32,7 @@ import com.smartdevicelink.test.json.rpc.JsonFileReader;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.RegisterAppInterfaceResponse}
+ * {@link com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse}
*/
public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
@@ -49,6 +49,7 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
msg.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
msg.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
msg.setAudioPassThruCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST);
+ msg.setPcmStreamingCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES);
msg.setHmiZoneCapabilities(Test.GENERAL_HMIZONECAPABILITIES_LIST);
msg.setSpeechCapabilities(Test.GENERAL_SPEECHCAPABILITIES_LIST);
msg.setVrCapabilities(Test.GENERAL_VRCAPABILITIES_LIST);
@@ -84,6 +85,7 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
result.put(RegisterAppInterfaceResponse.KEY_BUTTON_CAPABILITIES, Test.JSON_BUTTONCAPABILITIES);
result.put(RegisterAppInterfaceResponse.KEY_SOFT_BUTTON_CAPABILITIES, Test.JSON_SOFTBUTTONCAPABILITIES);
result.put(RegisterAppInterfaceResponse.KEY_AUDIO_PASS_THRU_CAPABILITIES, Test.JSON_AUDIOPASSTHRUCAPABILITIES);
+ result.put(RegisterAppInterfaceResponse.KEY_PCM_STREAM_CAPABILITIES, Test.JSON_PCMSTREAMCAPABILITIES);
result.put(RegisterAppInterfaceResponse.KEY_SPEECH_CAPABILITIES, JsonUtils.createJsonArray(Test.GENERAL_SPEECHCAPABILITIES_LIST));
result.put(RegisterAppInterfaceResponse.KEY_VR_CAPABILITIES, JsonUtils.createJsonArray(Test.GENERAL_VRCAPABILITIES_LIST));
result.put(RegisterAppInterfaceResponse.KEY_HMI_ZONE_CAPABILITIES, JsonUtils.createJsonArray(Test.GENERAL_HMIZONECAPABILITIES_LIST));
@@ -114,6 +116,7 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
Language testLang = ( (RegisterAppInterfaceResponse) msg ).getLanguage();
SdlMsgVersion testMsgVersion = ( (RegisterAppInterfaceResponse) msg ).getSdlMsgVersion();
List<AudioPassThruCapabilities> testAptc = ( (RegisterAppInterfaceResponse) msg ).getAudioPassThruCapabilities();
+ AudioPassThruCapabilities testPcmStream = ( (RegisterAppInterfaceResponse) msg ).getPcmStreamingCapabilities();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_INTEGER_LIST, testSupportedDiagModes);
@@ -130,7 +133,8 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, testLang);
assertTrue(Test.TRUE, Validator.validateSdlMsgVersion(Test.GENERAL_SDLMSGVERSION, testMsgVersion));
assertTrue(Test.TRUE, Validator.validateAudioPassThruCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, testAptc));
-
+ assertTrue(Test.TRUE, Validator.validatePcmStreamCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES, testPcmStream));
+
// Invalid/Null Tests
RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse();
assertNotNull(Test.NOT_NULL, msg);
@@ -145,6 +149,7 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
assertNull(Test.NULL, msg.getButtonCapabilities());
assertNull(Test.NULL, msg.getSoftButtonCapabilities());
assertNull(Test.NULL, msg.getAudioPassThruCapabilities());
+ assertNull(Test.NULL, msg.getPcmStreamingCapabilities());
assertNull(Test.NULL, msg.getHmiZoneCapabilities());
assertNull(Test.NULL, msg.getSpeechCapabilities());
assertNull(Test.NULL, msg.getVrCapabilities());
@@ -175,7 +180,11 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
JSONObject vehicleTypeObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_VEHICLE_TYPE);
VehicleType vehicleType = new VehicleType(JsonRPCMarshaller.deserializeJSONObject(vehicleTypeObj));
assertTrue(Test.TRUE, Validator.validateVehicleType(vehicleType, cmd.getVehicleType()));
-
+
+ JSONObject pcmStreamObj = JsonUtils.readJsonObjectFromJsonObject(parameters, RegisterAppInterfaceResponse.KEY_PCM_STREAM_CAPABILITIES);
+ AudioPassThruCapabilities pcmStreamCap = new AudioPassThruCapabilities(JsonRPCMarshaller.deserializeJSONObject(pcmStreamObj));
+ assertTrue(Test.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() );
@@ -196,7 +205,7 @@ public class RegisterAppInterfaceResponseTest extends BaseRpcTests {
audioPassThruCapabilitiesList.add(audioPassThruCapability);
}
assertTrue(Test.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() );
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java
new file mode 100644
index 000000000..c25685157
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetInteriorVehicleDataResponseTests.java
@@ -0,0 +1,104 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.rpc.SetInteriorVehicleDataResponse}
+ */
+public class SetInteriorVehicleDataResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+
+ SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse();
+
+ msg.setModuleData(Test.GENERAL_MODULEDATA);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.SET_INTERIOR_VEHICLE_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(SetInteriorVehicleDataResponse.KEY_MODULE_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_MODULEDATA.getStore()));
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ ModuleData testModuleData = ( (SetInteriorVehicleDataResponse) msg ).getModuleData();
+
+ // Valid Tests
+ assertTrue(Test.TRUE, Validator.validateModuleData(Test.GENERAL_MODULEDATA, testModuleData));
+
+ // Invalid/Null Tests
+ SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getModuleData());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ SetInteriorVehicleDataResponse cmd = new SetInteriorVehicleDataResponse (hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ ModuleData testModuleData = new ModuleData(JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(parameters, SetInteriorVehicleDataResponse.KEY_MODULE_DATA)));
+ ModuleData cmdModuleData = cmd.getModuleData();
+
+ assertTrue(Test.TRUE, Validator.validateModuleData(testModuleData, cmdModuleData) );
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
index b012d1944..301e330e7 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
@@ -16,7 +16,7 @@ import com.smartdevicelink.test.json.rpc.JsonFileReader;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.ShowResponse}
+ * {@link com.smartdevicelink.proxy.rpc.ShowResponse}
*/
public class ShowResponseTest extends BaseRpcTests {
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
index 56a482804..2bf6136fa 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
@@ -74,7 +74,7 @@ public class SdlSecurityBaseTest extends AndroidTestCase {
}
@Override
public void onProtocolSessionStartedNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID) {
+ byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
}
@Override
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
index e05091c44..c74e8ab84 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
@@ -6,6 +6,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
+import java.util.List;
import junit.framework.TestCase;
@@ -89,88 +90,3 @@ public class AbstractPacketizerTests extends TestCase {
}
}
-/**
- * This is a mock class for testing the following :
- * {@link com.smartdevicelink.streaming.AbstractPacketizer}
- */
-class MockStreamListener implements IStreamListener {
- public MockStreamListener () { }
- @Override public void sendStreamPacket(ProtocolMessage pm) { }
-}
-
-/**
- * This is a mock class for testing the following :
- * {@link com.smartdevicelink.streaming.AbstractPacketizer}
- */
-class MockInterfaceBroker implements ISdlConnectionListener {
- public MockInterfaceBroker () { }
- @Override
- public void onTransportDisconnected(String info) {
-
- }
- @Override
- public void onTransportError(String info, Exception e) {
-
- }
- @Override
- public void onProtocolMessageReceived(ProtocolMessage msg) {
-
- }
- @Override
- public void onProtocolSessionStartedNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID) {
-
- }
- @Override
- public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, int hashID,
- boolean isEncrypted) {
-
- }
- @Override
- public void onProtocolSessionEnded(SessionType sessionType, byte sessionID,
- String correlationID) {
-
- }
- @Override
- public void onProtocolSessionEndedNACKed(SessionType sessionType,
- byte sessionID, String correlationID) {
-
- }
- @Override
- public void onProtocolError(String info, Exception e) {
-
- }
- @Override
- public void onHeartbeatTimedOut(byte sessionID) {
-
- }
- @Override
- public void onProtocolServiceDataACK(SessionType sessionType, int dataSize,
- byte sessionID) {
-
- }
-}
-
-/**
- * This is a mock class for testing the following :
- * {@link com.smartdevicelink.streaming.AbstractPacketizer}
- */
-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, RPCRequest r, SessionType s, byte sid, byte w, SdlSession sdlsession) throws IOException { super (l, i, r, s, sid, w, 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; }
- public SdlSession getSdlSession () { return _session; }
- public byte getSessionId () { return _rpcSessionID; }
- public RPCRequest getRPCRequest () { return _request; }
- public byte getWiproVersion () { return _wiproVersion; }
-
- @Override public void pause() { }
- @Override public void resume() { }
-}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
new file mode 100644
index 000000000..86dbd7b81
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
@@ -0,0 +1,61 @@
+package com.smartdevicelink.test.streaming;
+
+import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
+import com.smartdevicelink.protocol.ProtocolMessage;
+import com.smartdevicelink.protocol.enums.SessionType;
+
+import java.util.List;
+
+/**
+ * This is a mock class for testing the following :
+ * {@link com.smartdevicelink.streaming.AbstractPacketizer}
+ */
+public class MockInterfaceBroker implements ISdlConnectionListener {
+ public MockInterfaceBroker () { }
+ @Override
+ public void onTransportDisconnected(String info) {
+
+ }
+ @Override
+ public void onTransportError(String info, Exception e) {
+
+ }
+ @Override
+ public void onProtocolMessageReceived(ProtocolMessage msg) {
+
+ }
+ @Override
+ public void onProtocolSessionStartedNACKed(SessionType sessionType,
+ byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
+
+ }
+ @Override
+ public void onProtocolSessionStarted(SessionType sessionType,
+ byte sessionID, byte version, String correlationID, int hashID,
+ boolean isEncrypted) {
+
+ }
+ @Override
+ public void onProtocolSessionEnded(SessionType sessionType, byte sessionID,
+ String correlationID) {
+
+ }
+ @Override
+ public void onProtocolSessionEndedNACKed(SessionType sessionType,
+ byte sessionID, String correlationID) {
+
+ }
+ @Override
+ public void onProtocolError(String info, Exception e) {
+
+ }
+ @Override
+ public void onHeartbeatTimedOut(byte sessionID) {
+
+ }
+ @Override
+ public void onProtocolServiceDataACK(SessionType sessionType, int dataSize,
+ byte sessionID) {
+
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java
new file mode 100644
index 000000000..d32a204a6
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java
@@ -0,0 +1,33 @@
+package com.smartdevicelink.test.streaming;
+
+import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.streaming.AbstractPacketizer;
+import com.smartdevicelink.streaming.IStreamListener;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * This is a mock class for testing the following :
+ * {@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, RPCRequest r, SessionType s, byte sid, byte w, SdlSession sdlsession) throws IOException { super (l, i, r, s, sid, w, 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; }
+ public SdlSession getSdlSession () { return _session; }
+ public byte getSessionId () { return _rpcSessionID; }
+ public RPCRequest getRPCRequest () { return _request; }
+ public byte getWiproVersion () { return _wiproVersion; }
+
+ @Override public void pause() { }
+ @Override public void resume() { }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockStreamListener.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockStreamListener.java
new file mode 100644
index 000000000..0081c65ea
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockStreamListener.java
@@ -0,0 +1,13 @@
+package com.smartdevicelink.test.streaming;
+
+import com.smartdevicelink.protocol.ProtocolMessage;
+import com.smartdevicelink.streaming.IStreamListener;
+
+/**
+ * This is a mock class for testing the following :
+ * {@link com.smartdevicelink.streaming.AbstractPacketizer}
+ */
+public class MockStreamListener implements IStreamListener {
+ public MockStreamListener () { }
+ @Override public void sendStreamPacket(ProtocolMessage pm) { }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
index 218e904b3..5f5bd6d2b 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
@@ -2,13 +2,18 @@ package com.smartdevicelink.test.streaming;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamPacketizer;
import com.smartdevicelink.test.Test;
@@ -22,7 +27,96 @@ import junit.framework.TestCase;
* {@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)}
@@ -49,4 +143,369 @@ public class StreamPacketizerTests extends TestCase {
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));
+ }
+
+ /**
+ * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendAudio(ByteBuffer, long)}
+ */
+ 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));
+ }
+
+ /**
+ * Test for {@link com.smartdevicelink.streaming.StreamPacketizer#sendAudio(ByteBuffer, long)}
+ * with direct ByteBuffer
+ */
+ 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 SdlSession.createSession(WIPRO_VERSION, new MockInterfaceBroker(), new BTTransportConfig(true));
+ }
+
+ 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/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java
index cac3b1616..0f72eec95 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java
@@ -10,6 +10,7 @@ import java.net.URLConnection;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.SdlProxyBase;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamRPCPacketizer;
import com.smartdevicelink.test.Test;
@@ -20,13 +21,13 @@ import junit.framework.TestCase;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.streaming.StreamRpcPacketizer}
+ * {@link com.smartdevicelink.streaming.StreamRPCPacketizer}
*/
public class StreamRPCPacketizerTests extends TestCase {
/**
* This is a unit test for the following methods :
- * {@link com.smartdevicelink.streaming.StreamRPCPacketizer#StreamRPCPacketizer(IStreamListener, InputStream, RPCRequest, SessionType, byte, byte)}
+ * {@link com.smartdevicelink.streaming.StreamRPCPacketizer#StreamRPCPacketizer(SdlProxyBase, IStreamListener, InputStream, RPCRequest, SessionType, byte, byte, long, SdlSession)}
*/
public void testConstructor () {
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/RTPH264PacketizerTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/RTPH264PacketizerTest.java
new file mode 100644
index 000000000..7090ba8e8
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/RTPH264PacketizerTest.java
@@ -0,0 +1,882 @@
+/*
+ * Copyright (c) 2017, Xevo 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 copyright holder 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.test.streaming.video;
+
+import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.protocol.ProtocolMessage;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+import com.smartdevicelink.streaming.IStreamListener;
+import com.smartdevicelink.streaming.video.RTPH264Packetizer;
+import com.smartdevicelink.test.streaming.MockInterfaceBroker;
+import com.smartdevicelink.transport.BTTransportConfig;
+
+import junit.framework.TestCase;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * This class includes a unit test for {@link RTPH264Packetizer}.
+ *
+ * @author Sho Amano
+ */
+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
+ */
+ 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
+ */
+ 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
+ */
+ 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
+ */
+ 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)}
+ */
+ 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)}
+ */
+ 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()}
+ */
+ 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)}
+ */
+ 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)}
+ */
+ 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
+ */
+ 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 SdlSession.createSession(WIPRO_VERSION, new MockInterfaceBroker(), new BTTransportConfig(true));
+ }
+
+ 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/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/SdlRemoteDisplayTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/SdlRemoteDisplayTest.java
new file mode 100644
index 000000000..96e6e29cb
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/SdlRemoteDisplayTest.java
@@ -0,0 +1,139 @@
+package com.smartdevicelink.test.streaming.video;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.Looper;
+import android.test.AndroidTestCase;
+import android.view.Display;
+import android.view.MotionEvent;
+import android.widget.RelativeLayout;
+
+import com.smartdevicelink.R;
+import com.smartdevicelink.encoder.VirtualDisplayEncoder;
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+import com.smartdevicelink.streaming.video.SdlRemoteDisplay;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
+
+import junit.framework.TestCase;
+
+import java.nio.ByteBuffer;
+import java.util.concurrent.FutureTask;
+
+
+public class SdlRemoteDisplayTest extends AndroidTestCase {
+
+ MockRemoteDisplayCallback rdCallback = new MockRemoteDisplayCallback();
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ if(Looper.myLooper() == null){
+ Looper.prepare();
+ }
+ }
+
+ public void testCreator(){
+ VirtualDisplayEncoder encoder = createVDE();
+ assertNotNull(encoder);
+
+
+ SdlRemoteDisplay.Creator creator = new SdlRemoteDisplay.Creator(this.getContext(), encoder.getVirtualDisplay(), null, MockRemoteDisplay.class, rdCallback);
+ assertNotNull(creator);
+ FutureTask<Boolean> fTask = new FutureTask<Boolean>(creator);
+ Thread showPresentation = new Thread(fTask);
+ showPresentation.start();
+ assert true;
+ }
+
+ public void testConstructor(){
+ VirtualDisplayEncoder encoder = createVDE();
+ assertNotNull(encoder);
+ MockRemoteDisplay remoteDisplay = new MockRemoteDisplay(getContext(), encoder.getVirtualDisplay());
+ assertNotNull(remoteDisplay);
+
+ encoder.shutDown();
+ }
+
+
+ @TargetApi(19)
+ public void testTouchEvents(){
+ VirtualDisplayEncoder encoder = createVDE();
+ assertNotNull(encoder);
+ MockRemoteDisplay remoteDisplay = new MockRemoteDisplay(getContext(), encoder.getVirtualDisplay());
+ assertNotNull(remoteDisplay);
+ remoteDisplay.show();
+
+ assertNotNull(remoteDisplay.getMainView());
+
+ try{
+ remoteDisplay.handleMotionEvent(MotionEvent.obtain(10, System.currentTimeMillis(), MotionEvent.ACTION_DOWN, 100, 100, 0));
+ }catch (Exception e){
+ assert false;
+ }
+
+ remoteDisplay.dismiss();
+ encoder.shutDown();
+ }
+
+
+ public VirtualDisplayEncoder createVDE(){
+ try{
+ VirtualDisplayEncoder displayEncoder = new VirtualDisplayEncoder();
+ displayEncoder.init(getContext(), new MockVideoStreamListener(), new VideoStreamingParameters());
+ displayEncoder.start();
+ return displayEncoder;
+ }catch (Exception e ){
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+
+ //Mock classes
+
+ public static class MockRemoteDisplay extends SdlRemoteDisplay{
+
+ public MockRemoteDisplay(Context context, Display display) {
+ super(context, display);
+
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView( new RelativeLayout(getContext()));
+
+ }
+
+
+ }
+
+ class MockVideoStreamListener implements IVideoStreamListener{
+
+ @Override
+ public void sendFrame(byte[] data, int offset, int length, long presentationTimeUs) throws ArrayIndexOutOfBoundsException {
+
+ }
+
+ @Override
+ public void sendFrame(ByteBuffer data, long presentationTimeUs) {
+
+ }
+ }
+
+ class MockRemoteDisplayCallback implements SdlRemoteDisplay.Callback{
+
+ @Override
+ public void onCreated(SdlRemoteDisplay remoteDisplay) {
+
+ }
+
+ @Override
+ public void onInvalidated(SdlRemoteDisplay remoteDisplay) {
+
+ }
+ }
+
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DeviceUtil.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DeviceUtil.java
index 74595c337..08b5c0840 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DeviceUtil.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/DeviceUtil.java
@@ -8,7 +8,10 @@ public class DeviceUtil {
|| Build.FINGERPRINT.startsWith("unknown")
|| Build.MODEL.contains("google_sdk")
|| Build.MODEL.contains("Emulator")
+ || Build.MODEL.contains("Android SDL built for")
|| (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
+ || (Build.BRAND.startsWith("Android") && Build.DEVICE.startsWith("generic"))
+ || (Build.PRODUCT != null && Build.PRODUCT.startsWith("sdk_google_phone"))
|| "google_sdk".equals(Build.PRODUCT);
}
} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java
new file mode 100644
index 000000000..116e846d7
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/SdlAppInfoTests.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2018 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.test.util;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
+import android.os.Bundle;
+import android.test.AndroidTestCase;
+
+import com.smartdevicelink.R;
+import com.smartdevicelink.util.SdlAppInfo;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Created by Joey Grover on 2/20/18.
+ */
+
+public class SdlAppInfoTests extends AndroidTestCase {
+
+ Context context;
+ ResolveInfo defaultResolveInfo;
+ ServiceInfo defaultServiceInfo;
+ Bundle defaultBundle;
+ PackageInfo defaultPackageInfo;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ context = getContext();
+ 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;
+
+ defaultPackageInfo = new PackageInfo();
+ defaultPackageInfo.lastUpdateTime = System.currentTimeMillis() - 1000;
+ defaultPackageInfo.firstInstallTime = System.currentTimeMillis() - 1000000;
+ }
+
+ public void testConstructorWithDefaultData(){
+
+ SdlAppInfo info = new SdlAppInfo(defaultResolveInfo,defaultPackageInfo);
+
+ assertNotNull(info);
+
+ ComponentName componentName = info.getRouterServiceComponentName();
+
+ assertNotNull(componentName);
+
+ assertEquals(defaultServiceInfo.name,componentName.getClassName());
+
+ assertEquals(context.getResources().getInteger(R.integer.sdl_router_service_version_value),info.getRouterServiceVersion());
+
+ assertFalse(info.isCustomRouterService());
+ }
+
+ /**
+ * If an app is found to have a newer service the compare should put it at the top of the list
+ */
+ 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);
+
+ List<SdlAppInfo> infos = new ArrayList<>();
+ infos.add(defaultInfo);
+ infos.add(testInfo);
+ assertEquals(defaultInfo,infos.get(0));
+
+ Collections.sort(infos, new SdlAppInfo.BestRouterComparator());
+
+ assertEquals(testInfo, infos.get(0));
+
+ }
+
+ /**
+ * Regardless of version, if the router service is custom it should be towards the end of the list
+ */
+ 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);
+
+ List<SdlAppInfo> infos = new ArrayList<>();
+ infos.add(defaultInfo);
+ infos.add(testInfo);
+ assertEquals(defaultInfo,infos.get(0));
+
+ Collections.sort(infos, new SdlAppInfo.BestRouterComparator());
+
+ assertEquals(defaultInfo, infos.get(0));
+
+ }
+
+ /**
+ * If two services have the same version and are not custom, we need to check which app has been updated the most recently
+ */
+ 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);
+
+ List<SdlAppInfo> infos = new ArrayList<>();
+ infos.add(defaultInfo);
+ infos.add(testInfo);
+ assertEquals(defaultInfo,infos.get(0));
+
+ Collections.sort(infos, new SdlAppInfo.BestRouterComparator());
+
+ assertEquals(testInfo, infos.get(0));
+
+ }
+
+ 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.putBoolean(context.getString(R.string.sdl_router_service_is_custom_name), isCustom);
+ serviceInfo.metaData = defaultBundle;
+ serviceInfo.packageName = packageName;
+ serviceInfo.name = className;
+ info.serviceInfo = serviceInfo;
+
+ return info;
+ }
+
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
new file mode 100644
index 000000000..44d25ffe0
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
@@ -0,0 +1,31 @@
+package com.smartdevicelink.test.util;
+
+import android.test.AndroidTestCase;
+
+import com.smartdevicelink.util.Version;
+
+public class VersionTest extends AndroidTestCase {
+
+ private static final String TEST_VERSION = "1.2.3";
+
+ public void testConstructorCorrect(){
+ Version version = new Version(TEST_VERSION);
+ assertEquals(1, version.getMajor());
+ assertEquals(2, version.getMinor());
+ assertEquals(3, version.getPatch());
+ }
+
+ public void testConstructorIncorrect(){
+ try{
+ Version version = new Version("1.2");
+ }catch (Exception e){
+ assert true;
+ }
+ assert false;
+ }
+
+ public void testToString(){
+ Version version = new Version(TEST_VERSION);
+ assertEquals(version.toString(), TEST_VERSION);
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java b/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
index a6dfe613a..e40049afd 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/transport/RSVTestCase.java
@@ -1,5 +1,8 @@
package com.smartdevicelink.transport;
+import android.app.ActivityManager;
+import android.content.ComponentName;
+import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.test.AndroidTestCase;
@@ -392,6 +395,38 @@ public class RSVTestCase extends AndroidTestCase {
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.
+ */
+ 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(this.mContext, new ComponentName("anything", mContext.getClass().getSimpleName()));
+ rsvpFail.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ assertFalse(rsvpFail.validate());
+
+ // Success, same package name for context and service
+ RouterServiceValidatorTest rsvpPass = new RouterServiceValidatorTest(this.mContext, new ComponentName(mContext.getPackageName(), mContext.getClass().getSimpleName()));
+ rsvpPass.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_HIGH);
+ assertTrue(rsvpPass.validate());
+ }
+
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java
index 36274b99d..c23b3b624 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/transport/SdlRouterServiceTests.java
@@ -7,16 +7,34 @@ import android.os.Looper;
import android.os.Message;
import android.test.AndroidTestCase;
import android.util.Log;
+import android.util.SparseArray;
+import android.util.SparseIntArray;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.BinaryFrameHeader;
+import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.SdlPacket;
+import com.smartdevicelink.protocol.SdlPacketFactory;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.protocol.enums.MessageType;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.rpc.UnregisterAppInterface;
import junit.framework.Assert;
import java.lang.ref.WeakReference;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.HashMap;
public class SdlRouterServiceTests extends AndroidTestCase {
public static final String TAG = "SdlRouterServiceTests";
+ private final int SAMPLE_RPC_CORRELATION_ID = 630;
+ int version = 1;
+ int sessionId = 1;
+ ProtocolMessage pm = null;
+ BinaryFrameHeader binFrameHeader = null;
@Override
protected void setUp() throws Exception {
@@ -84,4 +102,230 @@ public class SdlRouterServiceTests extends AndroidTestCase {
Assert.fail("Exception in testAlTransportHandlerHandleNullBundle, " + e);
}
}
-} \ No newline at end of file
+
+ /**
+ * Test writeBytesToTransport method for handling null byte array in bundle
+ *
+ * @see SdlRouterService#writeBytesToTransport(Bundle)
+ */
+ public void testWriteBytesToTransport() {
+ if (Looper.myLooper() == null) {
+ Looper.prepare();
+ }
+ Method method;
+ Field field = null;
+ Object sdlRouterService = null;
+ try {
+ sdlRouterService = Class.forName("com.smartdevicelink.transport.SdlRouterService").newInstance();
+ //Send a null bundle
+ method = SdlRouterService.class.getDeclaredMethod("writeBytesToTransport", Bundle.class);
+ Bundle bundle = null;
+ method.invoke(sdlRouterService, bundle);
+
+ //Send a non-null bundle with a null bytes array
+ //First, set mSerialService to the correct state so we get to test packet being null
+ MultiplexBluetoothTransport transport = new MultiplexBluetoothTransport(null);
+ transport.setStateManually(MultiplexBluetoothTransport.STATE_CONNECTED);
+ field = SdlRouterService.class.getDeclaredField("mSerialService");
+ field.setAccessible(true);
+ field.set(sdlRouterService, transport);
+ bundle = new Bundle();
+ bundle.putByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME, null);
+ method.invoke(sdlRouterService, bundle);
+ } catch (Exception e) {
+ Assert.fail("Exception in testWriteBytesToTransport, " + e);
+ }
+
+ //Return mSerialService to previous state
+ if (field != null && sdlRouterService != null) {
+ try {
+ field.set(sdlRouterService, null);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 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)
+ */
+ 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",message.replyTo);
+ SdlRouterService.RegisteredApp app2 = sdlRouterService.new RegisteredApp("12344",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("sessionMap");
+ 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);
+ 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)
+ */
+ 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",message.replyTo);
+ SdlRouterService.RegisteredApp app2 = sdlRouterService.new RegisteredApp("12344",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("sessionMap");
+ 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);
+ 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);
+ }
+ }
+}
diff --git a/sdl_android/src/main/AndroidManifest.xml b/sdl_android/src/main/AndroidManifest.xml
index 2cbeacf64..a958fb2fc 100644
--- a/sdl_android/src/main/AndroidManifest.xml
+++ b/sdl_android/src/main/AndroidManifest.xml
@@ -1,4 +1,3 @@
<manifest package="com.smartdevicelink" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="8"/>
- <application android:debuggable="true"/>
</manifest>
diff --git a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
index f4b4c43d9..16350da4b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
@@ -3,6 +3,8 @@ package com.smartdevicelink.SdlConnection;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
+import java.util.List;
+
public interface ISdlConnectionListener {
public void onTransportDisconnected(String info);
@@ -12,7 +14,7 @@ public interface ISdlConnectionListener {
public void onProtocolMessageReceived(ProtocolMessage msg);
public void onProtocolSessionStartedNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID);
+ byte sessionID, byte version, String correlationID, List<String> rejectedParams);
public void onProtocolSessionStarted(SessionType sessionType,
byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted);
diff --git a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java
index 272c1878d..b346884aa 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java
@@ -1,6 +1,7 @@
package com.smartdevicelink.SdlConnection;
+import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import android.content.ComponentName;
@@ -263,8 +264,9 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
@Override
public void onProtocolSessionNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID) {
- _connectionListener.onProtocolSessionStartedNACKed(sessionType, sessionID, version, correlationID);
+ byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
+ _connectionListener.onProtocolSessionStartedNACKed(sessionType,
+ sessionID, version, correlationID, rejectedParams);
}
@Override
@@ -433,10 +435,11 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
@Override
public void onProtocolSessionStartedNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID) {
+ byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
SdlSession session = findSessionById(sessionID);
if (session != null) {
- session.onProtocolSessionStartedNACKed(sessionType, sessionID, version, correlationID);
+ session.onProtocolSessionStartedNACKed(sessionType,
+ sessionID, version, correlationID, rejectedParams);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
index 1a9d051a6..20bcc0cc8 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
@@ -5,6 +5,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
+import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -15,6 +16,7 @@ import android.util.Log;
import android.view.Surface;
import com.smartdevicelink.encoder.SdlEncoder;
+import com.smartdevicelink.encoder.VirtualDisplayEncoder;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
@@ -22,11 +24,19 @@ import com.smartdevicelink.protocol.heartbeat.IHeartbeatMonitor;
import com.smartdevicelink.protocol.heartbeat.IHeartbeatMonitorListener;
import com.smartdevicelink.proxy.LockScreenManager;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.interfaces.IAudioStreamListener;
+import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
import com.smartdevicelink.security.ISecurityInitializedListener;
import com.smartdevicelink.security.SdlSecurityBase;
+import com.smartdevicelink.streaming.AbstractPacketizer;
import com.smartdevicelink.streaming.IStreamListener;
+import com.smartdevicelink.streaming.video.RTPH264Packetizer;
import com.smartdevicelink.streaming.StreamPacketizer;
import com.smartdevicelink.streaming.StreamRPCPacketizer;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransport;
import com.smartdevicelink.transport.enums.TransportType;
@@ -46,11 +56,15 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
private LockScreenManager lockScreenMan = new LockScreenManager();
private SdlSecurityBase sdlSecurity = null;
StreamRPCPacketizer mRPCPacketizer = null;
- StreamPacketizer mVideoPacketizer = null;
+ AbstractPacketizer mVideoPacketizer = null;
StreamPacketizer mAudioPacketizer = null;
SdlEncoder mSdlEncoder = null;
+ VirtualDisplayEncoder virtualDisplayEncoder = null;
private final static int BUFF_READ_SIZE = 1024;
private int sessionHashId = 0;
+ private HashMap<SessionType, CopyOnWriteArrayList<ISdlServiceListener>> serviceListeners;
+ private VideoStreamingParameters desiredVideoParams = null;
+ private VideoStreamingParameters acceptedVideoParams = null;
public static SdlSession createSession(byte wiproVersion, ISdlConnectionListener listener, BaseTransportConfig btConfig) {
@@ -113,6 +127,14 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
}
}
+ public long getMtu(SessionType type) {
+ if (this._sdlConnection != null) {
+ return this._sdlConnection.getWiProProtocol().getMtu(type);
+ } else {
+ return 0;
+ }
+ }
+
public void close() {
if (sdlSecurity != null)
{
@@ -134,8 +156,10 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
public void startStream(InputStream is, SessionType sType, byte rpcSessionID) throws IOException {
if (sType.equals(SessionType.NAV))
{
- mVideoPacketizer = new StreamPacketizer(this, is, sType, rpcSessionID, this);
- mVideoPacketizer.sdlConnection = this.getSdlConnection();
+ // protocol is fixed to RAW
+ StreamPacketizer packetizer = new StreamPacketizer(this, is, sType, rpcSessionID, this);
+ packetizer.sdlConnection = this.getSdlConnection();
+ mVideoPacketizer = packetizer;
mVideoPacketizer.start();
}
else if (sType.equals(SessionType.PCM))
@@ -157,8 +181,10 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
}
if (sType.equals(SessionType.NAV))
{
- mVideoPacketizer = new StreamPacketizer(this, is, sType, rpcSessionID, this);
- mVideoPacketizer.sdlConnection = this.getSdlConnection();
+ // protocol is fixed to RAW
+ StreamPacketizer packetizer = new StreamPacketizer(this, is, sType, rpcSessionID, this);
+ packetizer.sdlConnection = this.getSdlConnection();
+ mVideoPacketizer = packetizer;
mVideoPacketizer.start();
}
else if (sType.equals(SessionType.PCM))
@@ -175,7 +201,47 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
}
return os;
}
-
+
+ public IVideoStreamListener startVideoStream() {
+ byte rpcSessionID = getSessionId();
+ VideoStreamingProtocol protocol = getAcceptedProtocol();
+ try {
+ switch (protocol) {
+ case RAW: {
+ StreamPacketizer packetizer = new StreamPacketizer(this, null, SessionType.NAV, rpcSessionID, this);
+ packetizer.sdlConnection = this.getSdlConnection();
+ mVideoPacketizer = packetizer;
+ mVideoPacketizer.start();
+ return packetizer;
+ }
+ case RTP: {
+ RTPH264Packetizer packetizer = new RTPH264Packetizer(this, SessionType.NAV, rpcSessionID, this);
+ mVideoPacketizer = packetizer;
+ mVideoPacketizer.start();
+ return packetizer;
+ }
+ default:
+ Log.e(TAG, "Protocol " + protocol + " is not supported.");
+ return null;
+ }
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ public IAudioStreamListener startAudioStream() {
+ byte rpcSessionID = getSessionId();
+ try {
+ StreamPacketizer packetizer = new StreamPacketizer(this, null, SessionType.PCM, rpcSessionID, this);
+ packetizer.sdlConnection = this.getSdlConnection();
+ mAudioPacketizer = packetizer;
+ mAudioPacketizer.start();
+ return packetizer;
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
public void startRPCStream(InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion) {
try {
mRPCPacketizer = new StreamRPCPacketizer(null, this, is, request, sType, rpcSessionID, wiproVersion, 0, this);
@@ -284,19 +350,18 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
public Surface createOpenGLInputSurface(int frameRate, int iFrameInterval, int width,
int height, int bitrate, SessionType sType, byte rpcSessionID) {
- try {
- PipedOutputStream stream = (PipedOutputStream) startStream(sType, rpcSessionID);
- if (stream == null) return null;
- mSdlEncoder = new SdlEncoder();
- mSdlEncoder.setFrameRate(frameRate);
- mSdlEncoder.setFrameInterval(iFrameInterval);
- mSdlEncoder.setFrameWidth(width);
- mSdlEncoder.setFrameHeight(height);
- mSdlEncoder.setBitrate(bitrate);
- mSdlEncoder.setOutputStream(stream);
- } catch (IOException e) {
+ IVideoStreamListener encoderListener = startVideoStream();
+ if (encoderListener == null) {
return null;
}
+
+ mSdlEncoder = new SdlEncoder();
+ mSdlEncoder.setFrameRate(frameRate);
+ mSdlEncoder.setFrameInterval(iFrameInterval);
+ mSdlEncoder.setFrameWidth(width);
+ mSdlEncoder.setFrameHeight(height);
+ mSdlEncoder.setBitrate(bitrate);
+ mSdlEncoder.setOutputListener(encoderListener);
return mSdlEncoder.prepareEncoder();
}
@@ -482,6 +547,12 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
if (isEncrypted)
encryptedServices.addIfAbsent(sessionType);
this.sessionListener.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, hashID, isEncrypted);
+ if(serviceListeners != null && serviceListeners.containsKey(sessionType)){
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
+ for(ISdlServiceListener listener:listeners){
+ listener.onServiceStarted(this, sessionType, isEncrypted);
+ }
+ }
//if (version == 3)
initialiseSession();
if (sessionType.eq(SessionType.RPC)){
@@ -493,6 +564,12 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
public void onProtocolSessionEnded(SessionType sessionType, byte sessionID,
String correlationID) {
this.sessionListener.onProtocolSessionEnded(sessionType, sessionID, correlationID);
+ if(serviceListeners != null && serviceListeners.containsKey(sessionType)){
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
+ for(ISdlServiceListener listener:listeners){
+ listener.onServiceEnded(this, sessionType);
+ }
+ }
encryptedServices.remove(sessionType);
}
@@ -533,15 +610,27 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
@Override
public void onProtocolSessionStartedNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID) {
- this.sessionListener.onProtocolSessionStartedNACKed(sessionType, sessionID, version, correlationID);
+ byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
+ this.sessionListener.onProtocolSessionStartedNACKed(sessionType,
+ sessionID, version, correlationID, rejectedParams);
+ if(serviceListeners != null && serviceListeners.containsKey(sessionType)){
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
+ for(ISdlServiceListener listener:listeners){
+ listener.onServiceError(this, sessionType, "Start "+ sessionType.toString() +" Service NACK'ed");
+ }
+ }
}
@Override
public void onProtocolSessionEndedNACKed(SessionType sessionType,
byte sessionID, String correlationID) {
this.sessionListener.onProtocolSessionEndedNACKed(sessionType, sessionID, correlationID);
-
+ if(serviceListeners != null && serviceListeners.containsKey(sessionType)){
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
+ for(ISdlServiceListener listener:listeners){
+ listener.onServiceError(this, sessionType, "End "+ sessionType.toString() +" Service NACK'ed");
+ }
+ }
}
@Override
@@ -596,4 +685,66 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
public static boolean removeConnection(SdlConnection connection){
return shareConnections.remove(connection);
}
+
+ 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>());
+ }
+ serviceListeners.get(serviceType).add(sdlServiceListener);
+ }
+ }
+
+ 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(){
+ return serviceListeners;
+ }
+
+ public void setDesiredVideoParams(VideoStreamingParameters params){
+ this.desiredVideoParams = params;
+ }
+
+ /**
+ * 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
+ */
+ public VideoStreamingParameters getDesiredVideoParams(){
+ if(desiredVideoParams == null){
+ desiredVideoParams = new VideoStreamingParameters();
+ }
+ return desiredVideoParams;
+ }
+
+ public void setAcceptedVideoParams(VideoStreamingParameters params){
+ this.acceptedVideoParams = params;
+ }
+
+ public VideoStreamingParameters getAcceptedVideoParams(){
+ return acceptedVideoParams;
+ }
+
+ private VideoStreamingProtocol getAcceptedProtocol() {
+ // acquire default protocol (RAW)
+ VideoStreamingProtocol protocol = new VideoStreamingParameters().getFormat().getProtocol();
+
+ if (acceptedVideoParams != null) {
+ VideoStreamingFormat format = acceptedVideoParams.getFormat();
+ if (format != null && format.getProtocol() != null) {
+ protocol = format.getProtocol();
+ }
+ }
+
+ return protocol;
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java b/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java
new file mode 100644
index 000000000..362564da8
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/encoder/EncoderUtils.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2017, Xevo 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 copyright holder 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.encoder;
+
+import android.annotation.TargetApi;
+import android.media.MediaFormat;
+import android.os.Build;
+import android.util.Log;
+
+import java.nio.ByteBuffer;
+
+@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+public final class EncoderUtils {
+ private final static String TAG = "EncoderUtils";
+
+ /**
+ * Extracts codec-specific data from MediaFormat instance
+ *
+ * Currently, only AVC is supported.
+ *
+ * @param format MediaFormat instance retrieved from MediaCodec
+ * @return byte array containing codec-specific data, or null if an error occurred
+ */
+ public static byte[] getCodecSpecificData(MediaFormat format) {
+ if (format == null) {
+ return null;
+ }
+
+ String name = format.getString(MediaFormat.KEY_MIME);
+ if (name == null) {
+ return null;
+ }
+
+ // same as MediaFormat.MIMETYPE_VIDEO_AVC but it requires API level 21
+ if (name.equals("video/avc")) {
+ return getAVCCodecSpecificData(format);
+ } else {
+ Log.w(TAG, "Retrieving codec-specific data for " + name + " is not supported");
+ return null;
+ }
+ }
+
+ /**
+ * Extracts H.264 codec-specific data (SPS and PPS) from MediaFormat instance
+ *
+ * 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.
+ *
+ * @param format MediaFormat instance retrieved from MediaCodec
+ * @return byte array containing codec-specific data, or null if an error occurred
+ */
+ private static byte[] getAVCCodecSpecificData(MediaFormat format) {
+ // For H.264, "csd-0" contains SPS and "csd-1" contains PPS. Refer to the documentation
+ // of MediaCodec.
+ if (!(format.containsKey("csd-0") && format.containsKey("csd-1"))) {
+ Log.w(TAG, "H264 codec specific data not found");
+ return null;
+ }
+
+ ByteBuffer sps = format.getByteBuffer("csd-0");
+ int spsLen = sps.remaining();
+ ByteBuffer pps = format.getByteBuffer("csd-1");
+ int ppsLen = pps.remaining();
+
+ byte[] output = new byte[spsLen + ppsLen];
+ try {
+ sps.get(output, 0, spsLen);
+ pps.get(output, spsLen, ppsLen);
+ } catch (Exception e) {
+ // should not happen
+ Log.w(TAG, "Error while copying H264 codec specific data: " + e);
+ return null;
+ }
+
+ return output;
+ }
+
+ private EncoderUtils() {}
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java b/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java
index 81e344840..bd1e0c364 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/encoder/SdlEncoder.java
@@ -9,11 +9,16 @@ import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.os.Build;
+import android.util.Log;
import android.view.Surface;
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+
@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 String MIME_TYPE = "video/mp4v-es"; //MPEG4 video
@@ -26,10 +31,13 @@ public class SdlEncoder {
// encoder state
private MediaCodec mEncoder;
private PipedOutputStream mOutputStream;
+ private IVideoStreamListener mOutputListener;
// 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 () {
}
@@ -51,6 +59,9 @@ public class SdlEncoder {
public void setOutputStream(PipedOutputStream mStream){
mOutputStream = mStream;
}
+ public void setOutputListener(IVideoStreamListener listener) {
+ mOutputListener = listener;
+ }
public Surface prepareEncoder () {
mBufferInfo = new MediaCodec.BufferInfo();
@@ -114,6 +125,7 @@ public class SdlEncoder {
}
mOutputStream = null;
}
+ mH264CodecSpecificData = null;
}
/**
@@ -127,7 +139,7 @@ public class SdlEncoder {
public void drainEncoder(boolean endOfStream) {
final int TIMEOUT_USEC = 10000;
- if(mEncoder == null || mOutputStream == null) {
+ if(mEncoder == null || (mOutputStream == null && mOutputListener == null)) {
return;
}
if (endOfStream) {
@@ -147,15 +159,52 @@ public class SdlEncoder {
// 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 {
+ Log.w(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 {
+ Log.i(TAG, "H264 codec specific data not retrieved yet.");
+ }
+ }
+
if (mBufferInfo.size != 0) {
- byte[] dataToWrite = new byte[mBufferInfo.size];
- encoderOutputBuffers[encoderStatus].get(dataToWrite,
- mBufferInfo.offset, mBufferInfo.size);
+ ByteBuffer encoderOutputBuffer = encoderOutputBuffers[encoderStatus];
+ byte[] dataToWrite = null;
+ 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 {
- mOutputStream.write(dataToWrite, 0, mBufferInfo.size);
+ encoderOutputBuffer.position(mBufferInfo.offset);
+ encoderOutputBuffer.limit(mBufferInfo.offset + mBufferInfo.size);
+
+ encoderOutputBuffer.get(dataToWrite, dataOffset, mBufferInfo.size);
+
+ if (mOutputStream != null) {
+ mOutputStream.write(dataToWrite, 0, mBufferInfo.size);
+ } else if (mOutputListener != null) {
+ mOutputListener.sendFrame(
+ dataToWrite, 0, dataToWrite.length, mBufferInfo.presentationTimeUs);
+ }
} catch (Exception e) {}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java b/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
new file mode 100644
index 000000000..0fe303c71
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java
@@ -0,0 +1,400 @@
+/*
+ * Copyright (c) 2017 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.encoder;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.hardware.display.DisplayManager;
+import android.hardware.display.VirtualDisplay;
+import android.media.MediaCodec;
+import android.media.MediaCodecInfo;
+import android.media.MediaFormat;
+import android.os.Build;
+import android.util.Log;
+import android.view.Display;
+import android.view.Surface;
+
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+import com.smartdevicelink.proxy.rpc.ImageResolution;
+import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
+
+import java.nio.ByteBuffer;
+
+@TargetApi(19)
+@SuppressWarnings("NullableProblems")
+public class VirtualDisplayEncoder {
+ private static final String TAG = "VirtualDisplayEncoder";
+ private VideoStreamingParameters streamingParams = new VideoStreamingParameters();
+ private DisplayManager mDisplayManager;
+ private volatile MediaCodec mVideoEncoder = null;
+ private volatile MediaCodec.BufferInfo mVideoBufferInfo = null;
+ private volatile Surface inputSurface = null;
+ private volatile VirtualDisplay virtualDisplay = null;
+ private IVideoStreamListener mOutputListener;
+ private Boolean initPassed = false;
+ private final Object STREAMING_LOCK = new Object();
+
+ // Codec-specific data (SPS and PPS)
+ private byte[] mH264CodecSpecificData = null;
+
+ //For older (<21) OS versions
+ private Thread encoderThread;
+
+
+ /**
+ * 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 streamingParams parameters to create the virtual display and encoder
+ * @throws Exception if the API level is <19 or supplied parameters were null
+ */
+ public void init(Context context, IVideoStreamListener outputListener, VideoStreamingParameters streamingParams) throws Exception {
+ if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
+ Log.e(TAG, "API level of 19 required for VirtualDisplayEncoder");
+ throw new Exception("API level of 19 required");
+ }
+
+ if (context == null || outputListener == null || streamingParams == null || streamingParams.getResolution() == null || streamingParams.getFormat() == null) {
+ Log.e(TAG, "init parameters cannot be null for VirtualDisplayEncoder");
+ throw new Exception("init parameters cannot be null");
+ }
+
+ this.mDisplayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
+
+ this.streamingParams.update(streamingParams);
+
+ mOutputListener = outputListener;
+
+ initPassed = true;
+ }
+
+ @SuppressWarnings("unused")
+ public VideoStreamingParameters getStreamingParams(){
+ return this.streamingParams;
+ }
+
+ @SuppressWarnings("unused")
+ public void setStreamingParams(int displayDensity, ImageResolution resolution, int frameRate, int bitrate, int interval, VideoStreamingFormat format) {
+ this.streamingParams = new VideoStreamingParameters(displayDensity, frameRate, bitrate, interval, resolution, format);
+ }
+
+ @SuppressWarnings("unused")
+ public void setStreamingParams(VideoStreamingParameters streamingParams) {
+ this.streamingParams = streamingParams;
+ }
+
+ /**
+ * NOTE: Must call init() without error before calling this method.
+ * Prepares the encoder and virtual display.
+ */
+ public void start() throws Exception {
+ if (!initPassed) {
+ Log.e(TAG, "VirtualDisplayEncoder was not properly initialized with the init() method.");
+ return;
+ }
+ if (streamingParams == null || streamingParams.getResolution() == null || streamingParams.getFormat() == null) {
+ return;
+ }
+
+ synchronized (STREAMING_LOCK) {
+
+ try {
+ inputSurface = prepareVideoEncoder();
+
+ // Create a virtual display that will output to our encoder.
+ virtualDisplay = mDisplayManager.createVirtualDisplay(TAG,
+ streamingParams.getResolution().getResolutionWidth(), streamingParams.getResolution().getResolutionHeight(),
+ streamingParams.getDisplayDensity(), inputSurface, DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION);
+
+ startEncoder();
+
+ } catch (Exception ex) {
+ Log.e(TAG, "Unable to create Virtual Display.");
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+
+ public void shutDown() {
+ if (!initPassed) {
+ Log.e(TAG, "VirtualDisplayEncoder was not properly initialized with the init() method.");
+ return;
+ }
+ try {
+ if (encoderThread != null) {
+ encoderThread.interrupt();
+ encoderThread = null;
+ }
+
+ if (mVideoEncoder != null) {
+ mVideoEncoder.stop();
+ mVideoEncoder.release();
+ mVideoEncoder = null;
+ }
+
+ if (virtualDisplay != null) {
+ virtualDisplay.release();
+ virtualDisplay = null;
+ }
+
+ if (inputSurface != null) {
+ inputSurface.release();
+ inputSurface = null;
+ }
+ } catch (Exception ex) {
+ Log.e(TAG, "shutDown() failed");
+ }
+ }
+
+ private Surface prepareVideoEncoder() {
+
+ if (streamingParams == null || streamingParams.getResolution() == null || streamingParams.getFormat() == null) {
+ return null;
+ }
+
+ if (mVideoBufferInfo == null) {
+ mVideoBufferInfo = new MediaCodec.BufferInfo();
+ }
+
+ String videoMimeType = getMimeForFormat(streamingParams.getFormat());
+
+ MediaFormat format = MediaFormat.createVideoFormat(videoMimeType, streamingParams.getResolution().getResolutionWidth(), streamingParams.getResolution().getResolutionHeight());
+
+ // Set some required properties. The media codec may fail if these aren't defined.
+ format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
+ format.setInteger(MediaFormat.KEY_BIT_RATE, streamingParams.getBitrate());
+ format.setInteger(MediaFormat.KEY_FRAME_RATE, streamingParams.getFrameRate());
+ format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, streamingParams.getInterval()); // seconds between I-frames
+
+
+ // Create a MediaCodec encoder and configure it. Get a Surface we can use for recording into.
+ try {
+ mVideoEncoder = MediaCodec.createEncoderByType(videoMimeType);
+ mVideoEncoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
+ Surface surface = mVideoEncoder.createInputSurface(); //prepared
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ mVideoEncoder.setCallback(new MediaCodec.Callback() {
+ @Override
+ public void onInputBufferAvailable(MediaCodec codec, int index) {
+ // nothing to do here
+ }
+
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+ @Override
+ public void onOutputBufferAvailable(MediaCodec codec, int index, MediaCodec.BufferInfo info) {
+ try {
+ ByteBuffer encodedData = codec.getOutputBuffer(index);
+ if (encodedData != null) {
+ if (info.size != 0) {
+ byte[] dataToWrite;// = new byte[info.size];
+ int dataOffset = 0;
+
+ // append SPS and PPS in front of every IDR NAL unit
+ if ((info.flags & MediaCodec.BUFFER_FLAG_KEY_FRAME) != 0 && mH264CodecSpecificData != null) {
+ dataToWrite = new byte[mH264CodecSpecificData.length + info.size];
+ System.arraycopy(mH264CodecSpecificData, 0, dataToWrite, 0, mH264CodecSpecificData.length);
+ dataOffset = mH264CodecSpecificData.length;
+ } else {
+ dataToWrite = new byte[info.size];
+ }
+
+ encodedData.position(info.offset);
+ encodedData.limit(info.offset + info.size);
+
+ encodedData.get(dataToWrite, dataOffset, info.size);
+ if (mOutputListener != null) {
+ mOutputListener.sendFrame(dataToWrite, 0, dataToWrite.length, info.presentationTimeUs);
+ }
+ }
+
+ codec.releaseOutputBuffer(index, false);
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onError(MediaCodec codec, MediaCodec.CodecException e) {
+ e.printStackTrace();
+ }
+
+ @Override
+ public void onOutputFormatChanged(MediaCodec codec, MediaFormat format) {
+ mH264CodecSpecificData = EncoderUtils.getCodecSpecificData(format);
+ }
+ });
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ //Implied from previous if check that this has to be older than Build.VERSION_CODES.LOLLIPOP
+ encoderThread = new Thread(new EncoderCompat());
+
+ } else {
+ Log.e(TAG, "Unable to start encoder. Android OS version " + Build.VERSION.SDK_INT + "is not supported");
+ }
+
+ return surface;
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return null;
+ }
+
+ private void startEncoder() {
+ if (mVideoEncoder != null) {
+ mVideoEncoder.start();
+ }
+ if (encoderThread != null) {
+ encoderThread.start();
+ }
+ }
+
+ public Display getVirtualDisplay() {
+ return virtualDisplay.getDisplay();
+ }
+
+ private String getMimeForFormat(VideoStreamingFormat format) {
+ if (format != null) {
+ VideoStreamingCodec codec = format.getCodec();
+ if (codec != null) {
+ switch (codec) { //MediaFormat constants are only available in Android 21+
+ case VP8:
+ return "video/x-vnd.on2.vp8"; //MediaFormat.MIMETYPE_VIDEO_VP8
+ case VP9:
+ return "video/x-vnd.on2.vp9"; //MediaFormat.MIMETYPE_VIDEO_VP9
+ case H264: //Fall through
+ default:
+ return "video/avc"; // MediaFormat.MIMETYPE_VIDEO_AVC
+ }
+ }
+ }
+ return null;
+ }
+
+ private class EncoderCompat implements Runnable {
+
+ @Override
+ public void run() {
+ try {
+ drainEncoder(false);
+ } catch (Exception e) {
+ Log.w(TAG, "Error attempting to drain encoder");
+ } finally {
+ mVideoEncoder.release();
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ void drainEncoder(boolean endOfStream) {
+ if (mVideoEncoder == null || mOutputListener == null) {
+ return;
+ }
+
+ if (endOfStream) {
+ mVideoEncoder.signalEndOfInputStream();
+ }
+
+ ByteBuffer[] encoderOutputBuffers = mVideoEncoder.getOutputBuffers();
+ Thread currentThread = Thread.currentThread();
+ while (!currentThread.isInterrupted()) {
+ int encoderStatus = mVideoEncoder.dequeueOutputBuffer(mVideoBufferInfo, -1);
+ if(encoderStatus < 0){
+ if (encoderStatus == MediaCodec.INFO_TRY_AGAIN_LATER) {
+ // no output available yet
+ if (!endOfStream) {
+ break; // out of while
+ }
+ } else if (encoderStatus == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
+ // not expected for an encoder
+ encoderOutputBuffers = mVideoEncoder.getOutputBuffers();
+ } else if (encoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
+ if (mH264CodecSpecificData == null) {
+ MediaFormat format = mVideoEncoder.getOutputFormat();
+ mH264CodecSpecificData = EncoderUtils.getCodecSpecificData(format);
+ } else {
+ Log.w(TAG, "Output format change notified more than once, ignoring.");
+ }
+ }
+ } else {
+ if ((mVideoBufferInfo.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) {
+ mVideoBufferInfo.size = 0;
+ } else {
+ Log.i(TAG, "H264 codec specific data not retrieved yet.");
+ }
+ }
+
+ if (mVideoBufferInfo.size != 0) {
+ ByteBuffer encoderOutputBuffer = encoderOutputBuffers[encoderStatus];
+ byte[] dataToWrite;
+ int dataOffset = 0;
+
+ // append SPS and PPS in front of every IDR NAL unit
+ if ((mVideoBufferInfo.flags & MediaCodec.BUFFER_FLAG_KEY_FRAME) != 0 && mH264CodecSpecificData != null) {
+ dataToWrite = new byte[mH264CodecSpecificData.length + mVideoBufferInfo.size];
+ System.arraycopy(mH264CodecSpecificData, 0, dataToWrite, 0, mH264CodecSpecificData.length);
+ dataOffset = mH264CodecSpecificData.length;
+ } else {
+ dataToWrite = new byte[mVideoBufferInfo.size];
+ }
+
+ try {
+ encoderOutputBuffer.position(mVideoBufferInfo.offset);
+ encoderOutputBuffer.limit(mVideoBufferInfo.offset + mVideoBufferInfo.size);
+
+ encoderOutputBuffer.get(dataToWrite, dataOffset, mVideoBufferInfo.size);
+
+ if (mOutputListener != null) {
+ mOutputListener.sendFrame(dataToWrite, 0, dataToWrite.length, mVideoBufferInfo.presentationTimeUs);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ mVideoEncoder.releaseOutputBuffer(encoderStatus, false);
+
+ if ((mVideoBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
+ break; // out of while
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java b/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java
new file mode 100644
index 000000000..9a6e44897
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java
@@ -0,0 +1,131 @@
+/***************************************************************************************************
+ * Copyright © 2017 Xevo Inc.
+ * Redistribution and use in source and binary forms, with or without modification, are permitted
+ * provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions
+ * and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name of the copyright holder 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.haptic;
+
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.HapticRect;
+import com.smartdevicelink.proxy.rpc.Rectangle;
+import com.smartdevicelink.proxy.rpc.SendHapticData;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created on 9/22/2017.
+ *
+ * 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)}
+ */
+public class HapticInterfaceManager {
+ private static final String TAG = "Haptic";
+
+ private WeakReference<ISdl> proxyHolder;
+ private List<HapticRect> userHapticData;
+
+ public HapticInterfaceManager(ISdl proxy) {
+ this.proxyHolder = new WeakReference<>(proxy);
+ }
+
+ /**
+ * 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
+ */
+ public void setHapticData(List<HapticRect> hapticData) {
+ userHapticData = hapticData;
+ ISdl proxy = proxyHolder.get();
+ if (proxy != null) {
+ SendHapticData msg = new SendHapticData();
+ msg.setHapticRectData(userHapticData);
+ proxy.sendRPCRequest(msg);
+ }
+ }
+
+ /**
+ * Sends haptic data found by searching for focusable and clickable Views in the view heirarchy
+ * to the HU. Should be called by Presentation's OnShowListener.
+ *
+ * @param root
+ * the root or parent View
+ */
+ public void refreshHapticData(View root) {
+ ISdl proxy = proxyHolder.get();
+ if ((userHapticData == null) && (proxy != null)) {
+ List<HapticRect> hapticRects = new ArrayList<>();
+ findHapticRects(root, hapticRects);
+
+ SendHapticData msg = new SendHapticData();
+ msg.setHapticRectData(hapticRects);
+
+ proxy.sendRPCRequest(msg);
+ }
+ }
+
+ private void findHapticRects(View root, final List<HapticRect> hapticRects) {
+ List<View> focusables = new ArrayList<>();
+ getFocusableViews(root, focusables);
+
+ int [] loc = new int[2];
+ int id = 0;
+ for (View view : focusables) {
+ int w = view.getWidth();
+ int h = view.getHeight();
+ view.getLocationOnScreen(loc);
+
+ Rectangle rect = new Rectangle();
+ rect.setWidth((float) w);
+ rect.setHeight((float) h);
+ rect.setX((float) loc[0]);
+ rect.setY((float) loc[1]);
+
+ HapticRect hapticRect = new HapticRect();
+ hapticRect.setId(id++);
+ hapticRect.setRect(rect);
+ hapticRects.add(hapticRect);
+ }
+ }
+
+ private void getFocusableViews(View view, final List<View> focusables) {
+ // Not using addFocusables() or addTouchables() because of concerns with adding ViewGroup
+ // and not getting "clickables."
+
+ if (!(view instanceof ViewGroup) && (view != null) &&
+ (view.isFocusable() || view.isClickable())) {
+ focusables.add(view);
+ }
+
+ if (view instanceof ViewGroup) {
+ ViewGroup parent = (ViewGroup) view;
+
+ for (int i = 0; i < parent.getChildCount(); i++) {
+ getFocusableViews(parent.getChildAt(i), focusables);
+ }
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/AbstractProtocol.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/AbstractProtocol.java
index 8acc709e1..bb8c7fb6c 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/AbstractProtocol.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/AbstractProtocol.java
@@ -3,6 +3,8 @@ package com.smartdevicelink.protocol;
import com.smartdevicelink.protocol.WiProProtocol.MessageFrameAssembler;
import com.smartdevicelink.protocol.enums.SessionType;
+import java.util.List;
+
public abstract class AbstractProtocol {
private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
@@ -31,6 +33,7 @@ public abstract class AbstractProtocol {
public abstract void SendMessage(ProtocolMessage msg);
public abstract int getMtu();
+ public abstract long getMtu(SessionType type);
public abstract void handlePacketReceived(SdlPacket packet);
@@ -128,8 +131,8 @@ public abstract class AbstractProtocol {
}
protected void handleProtocolSessionNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID) {
- _protocolListener.onProtocolSessionNACKed(sessionType, sessionID, version, correlationID);
+ byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
+ _protocolListener.onProtocolSessionNACKed(sessionType, sessionID, version, correlationID, rejectedParams);
}
// This method handles protocol errors. A callback is sent to the protocol
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/IProtocolListener.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/IProtocolListener.java
index b54ff66c8..04397b935 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/IProtocolListener.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/IProtocolListener.java
@@ -2,6 +2,8 @@ package com.smartdevicelink.protocol;
import com.smartdevicelink.protocol.enums.*;
+import java.util.List;
+
public interface IProtocolListener {
// Called to indicate that these bytes are to be sent as part of a message.
// This call includes the part of the message.
@@ -14,7 +16,8 @@ public interface IProtocolListener {
// Called to indicate that a protocol session has been started (from either side)
void onProtocolSessionStarted(SessionType sessionType, byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted);
- void onProtocolSessionNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID);
+ void onProtocolSessionNACKed(SessionType sessionType, byte sessionID, byte version,
+ String correlationID, List<String> rejectedParams);
// Called to indicate that a protocol session has ended (from either side)
void onProtocolSessionEnded(SessionType sessionType, byte sessionID, String correlationID /*, String info, Exception ex*/);
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/ProtocolMessage.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/ProtocolMessage.java
index 99b34aff6..cb5ad3a74 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/ProtocolMessage.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/ProtocolMessage.java
@@ -45,12 +45,16 @@ public class ProtocolMessage {
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, 0, this._data, 0, length);
+ System.arraycopy(data, offset, this._data, 0, length);
this._jsonSize = 0;
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
index 9c7a02852..cc14cdac7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
@@ -1,7 +1,9 @@
package com.smartdevicelink.protocol;
import java.nio.ByteBuffer;
+import java.util.HashMap;
+import com.livio.BSON.BsonEncoder;
import com.smartdevicelink.protocol.enums.FrameType;
import android.os.Parcel;
@@ -65,6 +67,7 @@ public class SdlPacket implements Parcelable{
int messageId;
int priorityCoefficient;
byte[] payload = null;
+ HashMap<String, Object> bsonPayload;
public SdlPacket(int version, boolean encryption, int frameType,
int serviceType, int frameInfo, int sessionId,
@@ -185,7 +188,12 @@ public class SdlPacket implements Parcelable{
return payload;
}
- public byte[] constructPacket(){
+ public byte[] constructPacket() {
+ if (bsonPayload != null && !bsonPayload.isEmpty()) {
+ byte[] bsonBytes = BsonEncoder.encodeToBytes(bsonPayload);
+ payload = bsonBytes;
+ dataSize = bsonBytes.length;
+ }
return constructPacket(version, encryption, frameType,
serviceType, frameInfo, sessionId,
dataSize, messageId, payload);
@@ -219,6 +227,7 @@ public class SdlPacket implements Parcelable{
public static byte[] constructPacket(int version, boolean encryption, int frameType,
int serviceType, int controlFrameInfo, int sessionId,
int dataSize, int messageId, byte[] payload){
+
ByteBuffer builder;
switch(version){
case 1:
@@ -344,6 +353,25 @@ public class SdlPacket implements Parcelable{
}
};
-
-
+
+ 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/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
index af6973d2e..72482d47e 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
@@ -4,27 +4,38 @@ import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
+import com.smartdevicelink.protocol.enums.ControlFrameTags;
import com.smartdevicelink.protocol.enums.FrameDataControlFrameType;
import com.smartdevicelink.protocol.enums.FrameType;
import com.smartdevicelink.protocol.enums.MessageType;
import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.rpc.ImageResolution;
+import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
import com.smartdevicelink.security.SdlSecurityBase;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.util.BitConverter;
import com.smartdevicelink.util.DebugTool;
+import com.smartdevicelink.util.Version;
import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
import java.util.Hashtable;
+import java.util.List;
public class WiProProtocol extends AbstractProtocol {
- byte _version = 1;
private final static String FailurePropagating_Msg = "Failure propagating ";
+ //If increasing MAX PROTOCOL VERSION major version, make sure to alter it in SdlPsm
+ public static final Version MAX_PROTOCOL_VERSION = new Version("5.0.0");
+ private Version protocolVersion = new Version("1.0.0");
+ byte _version = 1;
public static final int V1_V2_MTU_SIZE = 1500;
public static final int V3_V4_MTU_SIZE = 131072;
public static final int V1_HEADER_SIZE = 8;
public static final int V2_HEADER_SIZE = 12;
private static int HEADER_SIZE = 8;
- private static int MAX_DATA_SIZE = V1_V2_MTU_SIZE - HEADER_SIZE;
private static int TLS_MAX_RECORD_SIZE = 16384;
int hashID = 0;
@@ -39,6 +50,7 @@ public class WiProProtocol extends AbstractProtocol {
Hashtable<Integer, MessageFrameAssembler> _assemblerForMessageID = new Hashtable<Integer, MessageFrameAssembler>();
Hashtable<Byte, Hashtable<Integer, MessageFrameAssembler>> _assemblerForSessionID = new Hashtable<Byte, Hashtable<Integer, MessageFrameAssembler>>();
Hashtable<Byte, Object> _messageLocks = new Hashtable<Byte, Object>();
+ private HashMap<SessionType, Long> mtus = new HashMap<SessionType,Long>();
// Hide no-arg ctor
private WiProProtocol() {
@@ -52,6 +64,7 @@ public class WiProProtocol extends AbstractProtocol {
{
sdlconn = (SdlConnection) protocolListener;
}
+ mtus.put(SessionType.RPC, new Long(V1_V2_MTU_SIZE - HEADER_SIZE));
} // end-ctor
/**
@@ -59,49 +72,95 @@ public class WiProProtocol extends AbstractProtocol {
* @return the max transfer unit
*/
public int getMtu(){
- return MAX_DATA_SIZE;
+ return mtus.get(SessionType.RPC).intValue();
}
-
+
+ public long getMtu(SessionType type){
+ Long mtu = mtus.get(type);
+ if(mtu == null){
+ mtu = mtus.get(SessionType.RPC);
+ }
+ return mtu;
+ }
+
+
+ /**
+ * Use getProtocolVersion() or getMajorVersionByte instead.<br>
+ * Returns the Major version of the currently used protocol version
+ */
+ @Deprecated
public byte getVersion() {
- return this._version;
+ return getMajorVersionByte();
}
-
+
+ public Version getProtocolVersion(){
+ return this.protocolVersion;
+ }
+ public byte getMajorVersionByte(){
+ if(_version == 1){
+ _version = new Integer(this.protocolVersion.getMajor()).byteValue();
+ }
+ return _version;
+
+ }
+
+ /**
+ * This method will set the major protocol version that we should use. It will also set the default MTU based on version.
+ * @param version
+ */
public void setVersion(byte version) {
- if (version > 4) {
- this._version = 4; //protect for future, proxy only supports v4 or lower
+ if (version > 5) {
+ this.protocolVersion = new Version("5.0.0"); //protect for future, proxy only supports v5 or lower
+ HEADER_SIZE = 12;
+ mtus.put(SessionType.RPC,new Long(V3_V4_MTU_SIZE) );
+ } else if (version == 5) {
+ this.protocolVersion = new Version("5.0.0");
HEADER_SIZE = 12;
- MAX_DATA_SIZE = V1_V2_MTU_SIZE - HEADER_SIZE; //default to lowest size since capabilities of this version are unknown
- } else if (version == 4) {
- this._version = version;
+ mtus.put(SessionType.RPC,new Long(V3_V4_MTU_SIZE) );
+ }else if (version == 4) {
+ this.protocolVersion = new Version("4.0.0");
HEADER_SIZE = 12;
- MAX_DATA_SIZE = V3_V4_MTU_SIZE; //versions 4 supports 128k MTU
+ mtus.put(SessionType.RPC,new Long(V3_V4_MTU_SIZE) ); //versions 4 supports 128k MTU
} else if (version == 3) {
- this._version = version;
+ this.protocolVersion = new Version("3.0.0");
HEADER_SIZE = 12;
- MAX_DATA_SIZE = V3_V4_MTU_SIZE; //versions 3 supports 128k MTU
+ mtus.put(SessionType.RPC,new Long(V3_V4_MTU_SIZE) ); //versions 3 supports 128k MTU
} else if (version == 2) {
- this._version = version;
+ this.protocolVersion = new Version("2.0.0");
HEADER_SIZE = 12;
- MAX_DATA_SIZE = V1_V2_MTU_SIZE - HEADER_SIZE;
+ mtus.put(SessionType.RPC,new Long(V1_V2_MTU_SIZE - HEADER_SIZE) );
} else if (version == 1){
- this._version = version;
+ this.protocolVersion = new Version("1.0.0");
HEADER_SIZE = 8;
- MAX_DATA_SIZE = V1_V2_MTU_SIZE - HEADER_SIZE;
+ mtus.put(SessionType.RPC,new Long(V1_V2_MTU_SIZE - HEADER_SIZE) );
}
}
public void StartProtocolSession(SessionType sessionType) {
- SdlPacket header = SdlPacketFactory.createStartSession(sessionType, 0x00, _version, (byte) 0x00, false);
+ SdlPacket header = SdlPacketFactory.createStartSession(sessionType, 0x00, getMajorVersionByte(), (byte) 0x00, false);
+ if(sessionType.equals(SessionType.RPC)){ // check for RPC session
+ header.putTag(ControlFrameTags.RPC.StartService.PROTOCOL_VERSION, MAX_PROTOCOL_VERSION.toString());
+ }
handlePacketToSend(header);
} // end-method
private void sendStartProtocolSessionACK(SessionType sessionType, byte sessionID) {
- SdlPacket header = SdlPacketFactory.createStartSessionACK(sessionType, sessionID, 0x00, _version);
+ SdlPacket header = SdlPacketFactory.createStartSessionACK(sessionType, sessionID, 0x00, getMajorVersionByte());
handlePacketToSend(header);
} // end-method
public void EndProtocolSession(SessionType sessionType, byte sessionID, int hashId) {
- SdlPacket header = SdlPacketFactory.createEndSession(sessionType, sessionID, hashID, _version, BitConverter.intToByteArray(hashId));
+ SdlPacket header;
+ if (sessionType.equals(SessionType.RPC)) { // check for RPC session
+ if(_version < 5){
+ header = SdlPacketFactory.createEndSession(sessionType, sessionID, hashID, getMajorVersionByte(), BitConverter.intToByteArray(hashID));
+ }else{
+ header = SdlPacketFactory.createEndSession(sessionType, sessionID, hashID, getMajorVersionByte(), new byte[0]);
+ header.putTag(ControlFrameTags.RPC.EndService.HASH_ID, hashID);
+ }
+ }else{ //Any other service type we don't include the hash id
+ header = SdlPacketFactory.createEndSession(sessionType, sessionID, hashID, getMajorVersionByte(), new byte[0]);
+ }
handlePacketToSend(header);
} // end-method
@@ -112,7 +171,7 @@ public class WiProProtocol extends AbstractProtocol {
byte sessionID = protocolMsg.getSessionID();
byte[] data = null;
- if (_version > 1 && sessionType != SessionType.NAV && sessionType != SessionType.PCM) {
+ if (protocolVersion.getMajor() > 1 && sessionType != SessionType.NAV && sessionType != SessionType.PCM) {
if (sessionType.eq(SessionType.CONTROL)) {
final byte[] secureData = protocolMsg.getData().clone();
data = new byte[HEADER_SIZE + secureData.length];
@@ -172,13 +231,14 @@ public class WiProProtocol extends AbstractProtocol {
}
synchronized(messageLock) {
- if (data.length > MAX_DATA_SIZE) {
-
+ if (data.length > getMtu(sessionType)) {
+
messageID++;
// Assemble first frame.
- int frameCount = data.length / MAX_DATA_SIZE;
- if (data.length % MAX_DATA_SIZE > 0) {
+ Long mtu = getMtu(sessionType);
+ int frameCount = new Long(data.length / mtu).intValue();
+ if (data.length % mtu > 0) {
frameCount++;
}
//byte[] firstFrameData = new byte[HEADER_SIZE];
@@ -188,7 +248,7 @@ public class WiProProtocol extends AbstractProtocol {
// Second four bytes are frame count.
System.arraycopy(BitConverter.intToByteArray(frameCount), 0, firstFrameData, 4, 4);
- SdlPacket firstHeader = SdlPacketFactory.createMultiSendDataFirst(sessionType, sessionID, messageID, _version,firstFrameData,protocolMsg.getPayloadProtected());
+ SdlPacket firstHeader = SdlPacketFactory.createMultiSendDataFirst(sessionType, sessionID, messageID, getMajorVersionByte(),firstFrameData,protocolMsg.getPayloadProtected());
firstHeader.setPriorityCoefficient(1+protocolMsg.priorityCoefficient);
//Send the first frame
handlePacketToSend(firstHeader);
@@ -210,17 +270,17 @@ public class WiProProtocol extends AbstractProtocol {
} // end-if
int bytesToWrite = data.length - currentOffset;
- if (bytesToWrite > MAX_DATA_SIZE) {
- bytesToWrite = MAX_DATA_SIZE;
+ if (bytesToWrite > mtu) {
+ bytesToWrite = mtu.intValue();
}
- SdlPacket consecHeader = SdlPacketFactory.createMultiSendDataRest(sessionType, sessionID, bytesToWrite, frameSequenceNumber , messageID, _version,data, currentOffset, bytesToWrite, protocolMsg.getPayloadProtected());
+ SdlPacket consecHeader = SdlPacketFactory.createMultiSendDataRest(sessionType, sessionID, bytesToWrite, frameSequenceNumber , messageID, getMajorVersionByte(),data, currentOffset, bytesToWrite, protocolMsg.getPayloadProtected());
consecHeader.setPriorityCoefficient(i+2+protocolMsg.priorityCoefficient);
handlePacketToSend(consecHeader);
currentOffset += bytesToWrite;
}
} else {
messageID++;
- SdlPacket header = SdlPacketFactory.createSingleSendData(sessionType, sessionID, data.length, messageID, _version,data, protocolMsg.getPayloadProtected());
+ SdlPacket header = SdlPacketFactory.createSingleSendData(sessionType, sessionID, data.length, messageID, getMajorVersionByte(),data, protocolMsg.getPayloadProtected());
header.setPriorityCoefficient(protocolMsg.priorityCoefficient);
handlePacketToSend(header);
}
@@ -229,7 +289,7 @@ public class WiProProtocol extends AbstractProtocol {
public void handlePacketReceived(SdlPacket packet){
//Check for a version difference
- if (_version == 1) {
+ if (getMajorVersionByte() == 1) {
setVersion((byte)packet.version);
}
@@ -245,7 +305,7 @@ public class WiProProtocol extends AbstractProtocol {
protected MessageFrameAssembler getFrameAssemblerForFrame(SdlPacket packet) {
Integer iSessionId = Integer.valueOf(packet.getSessionId());
Byte bySessionId = iSessionId.byteValue();
-
+
Hashtable<Integer, MessageFrameAssembler> hashSessionID = _assemblerForSessionID.get(bySessionId);
if (hashSessionID == null) {
hashSessionID = new Hashtable<Integer, MessageFrameAssembler>();
@@ -294,13 +354,13 @@ public class WiProProtocol extends AbstractProtocol {
message.setSessionType(SessionType.valueOf((byte)packet.getServiceType()));
message.setSessionID((byte)packet.getSessionId());
//If it is WiPro 2.0 it must have binary header
- if (_version > 1) {
+ if (protocolVersion.getMajor() > 1) {
BinaryFrameHeader binFrameHeader = BinaryFrameHeader.
parseBinaryHeader(accumulator.toByteArray());
if(binFrameHeader == null) {
return;
}
- message.setVersion(_version);
+ message.setVersion(getMajorVersionByte());
message.setRPCType(binFrameHeader.getRPCType());
message.setFunctionID(binFrameHeader.getFunctionID());
message.setCorrID(binFrameHeader.getCorrID());
@@ -400,21 +460,69 @@ public class WiProProtocol extends AbstractProtocol {
messageLock = new Object();
_messageLocks.put((byte)packet.getSessionId(), messageLock);
}
- int hashID = 0;
- if (_version > 1){
- if (packet.payload!= null && packet.dataSize == 4){ //hashid will be 4 bytes in length
- hashID = BitConverter.intFromByteArray(packet.payload, 0);
+ if(packet.version >= 5){
+ String mtuTag = null;
+ if(serviceType.equals(SessionType.RPC)){
+ mtuTag = ControlFrameTags.RPC.StartServiceACK.MTU;
+ }else if(serviceType.equals(SessionType.PCM)){
+ mtuTag = ControlFrameTags.Audio.StartServiceACK.MTU;
+ }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));
}
- }
- handleProtocolSessionStarted(serviceType,(byte) packet.getSessionId(), _version, "", hashID, packet.isEncrypted());
+ 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){
+ //At this point we have confirmed the negotiated version between the module and the proxy
+ protocolVersion = new Version((String)version);
+ }
+ }else if(serviceType.equals(SessionType.NAV)){
+ SdlSession session = sdlconn.findSessionById((byte) packet.sessionId);
+ if(session != null) {
+ ImageResolution acceptedResolution = new ImageResolution();
+ VideoStreamingFormat acceptedFormat = new VideoStreamingFormat();
+ acceptedResolution.setResolutionHeight((Integer) packet.getTag(ControlFrameTags.Video.StartServiceACK.HEIGHT));
+ acceptedResolution.setResolutionWidth((Integer) packet.getTag(ControlFrameTags.Video.StartServiceACK.WIDTH));
+ acceptedFormat.setCodec(VideoStreamingCodec.valueForString((String) packet.getTag(ControlFrameTags.Video.StartServiceACK.VIDEO_CODEC)));
+ acceptedFormat.setProtocol(VideoStreamingProtocol.valueForString((String) packet.getTag(ControlFrameTags.Video.StartServiceACK.VIDEO_PROTOCOL)));
+ VideoStreamingParameters agreedVideoParams = session.getDesiredVideoParams();
+ agreedVideoParams.setResolution(acceptedResolution);
+ agreedVideoParams.setFormat(acceptedFormat);
+ session.setAcceptedVideoParams(agreedVideoParams);
+ }
+ }
+ }else{
+ if (protocolVersion.getMajor() > 1){
+ if (packet.payload!= null && packet.dataSize == 4){ //hashid will be 4 bytes in length
+ hashID = BitConverter.intFromByteArray(packet.payload, 0);
+ }
+ }
+ }
+ handleProtocolSessionStarted(serviceType,(byte) packet.getSessionId(), getMajorVersionByte(), "", hashID, packet.isEncrypted());
} else if (frameInfo == FrameDataControlFrameType.StartSessionNACK.getValue()) {
+ List<String> rejectedParams = null;
+ if(packet.version >= 5){
+ String rejectedTag = null;
+ if(serviceType.equals(SessionType.RPC)){
+ rejectedTag = ControlFrameTags.RPC.StartServiceNAK.REJECTED_PARAMS;
+ }else if(serviceType.equals(SessionType.PCM)){
+ rejectedTag = ControlFrameTags.Audio.StartServiceNAK.REJECTED_PARAMS;
+ }else if(serviceType.equals(SessionType.NAV)){
+ rejectedTag = ControlFrameTags.Video.StartServiceNAK.REJECTED_PARAMS;
+ }
+ rejectedParams = (List<String>) packet.getTag(rejectedTag);
+ }
if (serviceType.eq(SessionType.NAV) || serviceType.eq(SessionType.PCM)) {
- handleProtocolSessionNACKed(serviceType, (byte)packet.getSessionId(), _version, "");
+ handleProtocolSessionNACKed(serviceType, (byte)packet.getSessionId(), getMajorVersionByte(), "", rejectedParams);
} else {
handleProtocolError("Got StartSessionNACK for protocol sessionID=" + packet.getSessionId(), null);
}
} else if (frameInfo == FrameDataControlFrameType.EndSession.getValue()) {
- if (_version > 1) {
+ if (protocolVersion.getMajor() > 1) {
handleProtocolSessionEnded(serviceType, (byte)packet.getSessionId(), "");
} else {
handleProtocolSessionEnded(serviceType, (byte)packet.getSessionId(), "");
@@ -422,6 +530,18 @@ public class WiProProtocol extends AbstractProtocol {
} else if (frameInfo == FrameDataControlFrameType.EndSessionACK.getValue()) {
handleProtocolSessionEnded(serviceType, (byte)packet.getSessionId(), "");
} else if (frameInfo == FrameDataControlFrameType.EndSessionNACK.getValue()) {
+ if(packet.version >= 5){
+ String rejectedTag = null;
+ if(serviceType.equals(SessionType.RPC)){
+ rejectedTag = ControlFrameTags.RPC.EndServiceNAK.REJECTED_PARAMS;
+ }else if(serviceType.equals(SessionType.PCM)){
+ rejectedTag = ControlFrameTags.Audio.EndServiceNAK.REJECTED_PARAMS;
+ }else if(serviceType.equals(SessionType.NAV)){
+ rejectedTag = ControlFrameTags.Video.EndServiceNAK.REJECTED_PARAMS;
+ }
+ List<String> rejectedParams = (List<String>) packet.getTag(rejectedTag);
+ // TODO: Pass these back
+ }
handleProtocolSessionEndedNACK(serviceType, (byte)packet.getSessionId(), "");
} else if (frameInfo == FrameDataControlFrameType.ServiceDataACK.getValue()) {
if (packet.getPayload() != null && packet.getDataSize() == 4) //service data ack will be 4 bytes in length
@@ -446,13 +566,13 @@ public class WiProProtocol extends AbstractProtocol {
message.setSessionID((byte)packet.getSessionId());
//If it is WiPro 2.0 it must have binary header
boolean isControlService = message.getSessionType().equals(SessionType.CONTROL);
- if (_version > 1&& !isControlService) {
+ if (protocolVersion.getMajor() > 1 && !isControlService) {
BinaryFrameHeader binFrameHeader = BinaryFrameHeader.
parseBinaryHeader(packet.payload);
if(binFrameHeader == null) {
return;
}
- message.setVersion(_version);
+ message.setVersion(getMajorVersionByte());
message.setRPCType(binFrameHeader.getRPCType());
message.setFunctionID(binFrameHeader.getFunctionID());
message.setCorrID(binFrameHeader.getCorrID());
@@ -479,9 +599,23 @@ public class WiProProtocol extends AbstractProtocol {
@Override
public void StartProtocolService(SessionType sessionType, byte sessionID, boolean isEncrypted) {
- SdlPacket header = SdlPacketFactory.createStartSession(sessionType, 0x00, _version, sessionID, isEncrypted);
+ SdlPacket header = SdlPacketFactory.createStartSession(sessionType, 0x00, getMajorVersionByte(), sessionID, isEncrypted);
+ if(sessionType.equals(SessionType.NAV)){
+ SdlSession videoSession = sdlconn.findSessionById(sessionID);
+ if(videoSession != null){
+ ImageResolution desiredResolution = videoSession.getDesiredVideoParams().getResolution();
+ VideoStreamingFormat desiredFormat = videoSession.getDesiredVideoParams().getFormat();
+ if(desiredResolution != null){
+ header.putTag(ControlFrameTags.Video.StartService.WIDTH, desiredResolution.getResolutionWidth());
+ header.putTag(ControlFrameTags.Video.StartService.HEIGHT, desiredResolution.getResolutionHeight());
+ }
+ if(desiredFormat != null){
+ header.putTag(ControlFrameTags.Video.StartService.VIDEO_CODEC, desiredFormat.getCodec().toString());
+ header.putTag(ControlFrameTags.Video.StartService.VIDEO_PROTOCOL, desiredFormat.getProtocol().toString());
+ }
+ }
+ }
handlePacketToSend(header);
-
}
@Override
@@ -498,21 +632,24 @@ public class WiProProtocol extends AbstractProtocol {
@Override
public void SendHeartBeat(byte sessionID) {
- final SdlPacket heartbeat = SdlPacketFactory.createHeartbeat(SessionType.CONTROL, sessionID, _version);
+ final SdlPacket heartbeat = SdlPacketFactory.createHeartbeat(SessionType.CONTROL, sessionID, getMajorVersionByte());
handlePacketToSend(heartbeat);
}
@Override
public void SendHeartBeatACK(byte sessionID) {
- final SdlPacket heartbeat = SdlPacketFactory.createHeartbeatACK(SessionType.CONTROL, sessionID, _version);
+ final SdlPacket heartbeat = SdlPacketFactory.createHeartbeatACK(SessionType.CONTROL, sessionID, getMajorVersionByte());
handlePacketToSend(heartbeat);
}
@Override
public void EndProtocolService(SessionType serviceType, byte sessionID) {
- SdlPacket header = SdlPacketFactory.createEndSession(serviceType, sessionID, hashID, _version, new byte[4]);
- handlePacketToSend(header);
-
+ if(serviceType.equals(SessionType.RPC)){ //RPC session will close all other sessions so we want to make sure we use the correct EndProtocolSession method
+ EndProtocolSession(serviceType,sessionID,hashID);
+ }else {
+ SdlPacket header = SdlPacketFactory.createEndSession(serviceType, sessionID, hashID, getMajorVersionByte(), new byte[0]);
+ handlePacketToSend(header);
+ }
}
} // end-class
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java
new file mode 100644
index 000000000..74a001edc
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java
@@ -0,0 +1,85 @@
+package com.smartdevicelink.protocol.enums;
+
+/**
+ * Control frame payload tags that relate to the respective services. Each class represents a different service, RPC, Audio, and Video services.
+ */
+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";
+ }
+
+ /**
+ * 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";
+ }
+ 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{}
+ }
+
+ /**
+ * 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/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
index e427141cf..412d3f857 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -53,9 +53,16 @@ public enum FunctionID{
SYSTEM_REQUEST(38, "SystemRequest"),
SEND_LOCATION(39, "SendLocation"),
DIAL_NUMBER(40, "DialNumber"),
+
+ BUTTON_PRESS(41, "ButtonPress"),
+ GET_INTERIOR_VEHICLE_DATA(43, "GetInteriorVehicleData"),
+ SET_INTERIOR_VEHICLE_DATA(44, "SetInteriorVehicleData"),
+
GET_WAY_POINTS(45, "GetWayPoints"),
SUBSCRIBE_WAY_POINTS(46, "SubscribeWayPoints"),
UNSUBSCRIBE_WAY_POINTS(47, "UnsubscribeWayPoints"),
+ GET_SYSTEM_CAPABILITY(48, "GetSystemCapability"),
+ SEND_HAPTIC_DATA(49, "SendHapticData"),
// NOTIFICATIONS
ON_HMI_STATUS(32768, "OnHMIStatus"),
@@ -73,6 +80,7 @@ public enum FunctionID{
ON_TOUCH_EVENT(32780, "OnTouchEvent"),
ON_SYSTEM_REQUEST(32781, "OnSystemRequest"),
ON_HASH_CHANGE(32782, "OnHashChange"),
+ ON_INTERIOR_VEHICLE_DATA(32783, "OnInteriorVehicleData"),
ON_WAY_POINT_CHANGE(32784, "OnWayPointChange"),
// MOCKED FUNCTIONS (NOT SENT FROM HEAD-UNIT)
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
index ab4763103..e55292aad 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
@@ -104,6 +104,11 @@ public class RPCMessage extends RPCStruct {
}
@Override
+ public Float getFloat(String key) {
+ return (Float) parameters.get(key);
+ }
+
+ @Override
public Double getDouble(String key) {
return (Double) parameters.get(key);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
index 50493870d..370ffe1ec 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
@@ -6,6 +6,7 @@ package com.smartdevicelink.proxy;
import java.util.Hashtable;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.util.CorrelationIdGenerator;
public class RPCRequest extends RPCMessage {
@@ -21,6 +22,10 @@ public class RPCRequest extends RPCMessage {
}
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);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java
index e249839d5..983c496a7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java
@@ -56,6 +56,10 @@ import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
+/**
+ * @deprecated Use RPC constructors directly instead
+ */
+@Deprecated
public class RPCRequestFactory {
public static final int SDL_MSG_MAJOR_VERSION = 1;
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCResponse.java
index 0a4dc2a70..a7c0ed188 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCResponse.java
@@ -3,6 +3,8 @@
*/
package com.smartdevicelink.proxy;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.rpc.enums.Result;
@@ -121,7 +123,7 @@ public class RPCResponse extends RPCMessage {
* @param success
* whether the request is successfully processed
*/
- public void setSuccess( Boolean success ) {
+ public void setSuccess( @NonNull Boolean success ) {
if (success != null) {
parameters.put(RPCResponse.KEY_SUCCESS, success );
}
@@ -150,7 +152,7 @@ public class RPCResponse extends RPCMessage {
* @param resultCode
* whether the request is successfully processed
*/
- public void setResultCode( Result resultCode ) {
+ public void setResultCode( @NonNull Result resultCode ) {
if (resultCode != null) {
parameters.put(RPCResponse.KEY_RESULT_CODE, resultCode );
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
index f1911b121..116c491df 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
@@ -231,6 +231,10 @@ public class RPCStruct {
return (Double) store.get(key);
}
+ public Float getFloat(String key) {
+ return (Float) store.get(key);
+ }
+
public Boolean getBoolean(String key) { return (Boolean) store.get(key); }
public Long getLong(String key){
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
index 2bdbdf82e..a9cec4f10 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
@@ -16,6 +16,7 @@ import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.SystemCapability;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.VehicleType;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
@@ -24,334 +25,337 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
import com.smartdevicelink.trace.SdlTrace;
import com.smartdevicelink.transport.BTTransportConfig;
-import com.smartdevicelink.transport.BaseTransportConfig;
-import com.smartdevicelink.transport.MultiplexTransportConfig;
+import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.transport.MultiplexTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
-
+
+import static com.smartdevicelink.proxy.SystemCapabilityManager.convertToList;
+
public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
-
+
private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
@SuppressWarnings("unused")
- private static final String SDL_LIB_PRIVATE_TOKEN = "{DAE1A88C-6C16-4768-ACA5-6F1247EA01C2}";
+ private static final String SDL_LIB_PRIVATE_TOKEN = "{DAE1A88C-6C16-4768-ACA5-6F1247EA01C2}";
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL
- *
+ *
* Takes advantage of the advanced lifecycle management.
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
+ * @param listener - Reference to the object in the App listening to callbacks from SDL.
+ * @param appName - Name of the application displayed on SDL.
* @param isMediaApp - Indicates if the app is a media application.
*/
@Deprecated
- public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,
+ Language languageDesired, Language hmiDisplayLanguageDesired, String appID) throws SdlException {
+ super( listener,
+ /*sdl proxy configuration resources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
- /*ngn media app*/null,
- /*vr synonyms*/null,
- /*is media app*/isMediaApp,
- /*sdlMsgVersion*/null,
- /*language desired*/languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ false,
+ /*TTS Name*/null,
+ /*ngn media app*/null,
+ /*vr synonyms*/null,
+ /*is media app*/isMediaApp,
+ /*sdlMsgVersion*/null,
+ /*language desired*/languageDesired,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
+ /*callbackToUIThread*/ false,
new BTTransportConfig());
}
-
+
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL
- *
+ *
* Takes advantage of the advanced lifecycle management.
* @param context - Used to create a multiplexing transport config
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
+ * @param listener - Reference to the object in the App listening to callbacks from SDL.
+ * @param appName - Name of the application displayed on SDL.
* @param isMediaApp - Indicates if the app is a media application.
*/
- public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, Boolean isMediaApp,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, Boolean isMediaApp,
+ Language languageDesired, Language hmiDisplayLanguageDesired, String appID) throws SdlException {
+ super( listener,
+ /*sdl proxy configuration resources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
- /*ngn media app*/null,
- /*vr synonyms*/null,
- /*is media app*/isMediaApp,
- /*sdlMsgVersion*/null,
- /*language desired*/languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ false,
+ /*TTS Name*/null,
+ /*ngn media app*/null,
+ /*vr synonyms*/null,
+ /*is media app*/isMediaApp,
+ /*sdlMsgVersion*/null,
+ /*language desired*/languageDesired,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
+ /*callbackToUIThread*/ false,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, appName, and isMediaApp.", SDL_LIB_TRACE_KEY);
}
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
+ * @param listener - Reference to the object in the App listening to callbacks from SDL.
+ * @param appName - Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
* @param isMediaApp - Indicates if the app is a media application.
* @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired - Indicates the language desired for the SDL interface.
* @param autoActivateID - ID used to re-register previously registered application.
* @throws SdlException
*/
@Deprecated
- public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
+ Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
+ Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
+ String autoActivateID) throws SdlException {
+ super( listener,
+ /*sdl proxy configuration resources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
- /*callbackToUIThread*/ false,
+ /*callbackToUIThread*/ false,
new BTTransportConfig());
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, appName, ngnMediaScreenAppName, " +
"vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
}
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param context - Used to create a multiplexing transport config
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
+ * @param listener - Reference to the object in the App listening to callbacks from SDL.
+ * @param appName - Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
* @param isMediaApp - Indicates if the app is a media application.
* @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired - Indicates the language desired for the SDL interface.
* @param autoActivateID - ID used to re-register previously registered application.
* @throws SdlException
*/
- public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
+ Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
+ Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
+ String autoActivateID) throws SdlException {
+ super( listener,
+ /*sdl proxy configuration resources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
- /*callbackToUIThread*/ false,
+ /*callbackToUIThread*/ false,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, appName, ngnMediaScreenAppName, " +
"vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
}
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
+ * @param listener - Reference to the object in the App listening to callbacks from SDL.
+ * @param appName - Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
* @param isMediaApp - Indicates if the app is a media application.
* @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired - Indicates the language desired for the SDL interface.
* @param autoActivateID - ID used to re-register previously registered application.
* @throws SdlException
*/
@Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms,
- Boolean isMediaApp, SdlMsgVersion sdlMsgVersion, Language languageDesired,
- Language hmiDisplayLanguageDesired, String appID, String autoActivateID) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms,
+ Boolean isMediaApp, SdlMsgVersion sdlMsgVersion, Language languageDesired,
+ Language hmiDisplayLanguageDesired, String appID, String autoActivateID) throws SdlException {
+ super( listener,
+ sdlProxyConfigurationResources,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
- /*callbackToUIThread*/ false,
+ /*callbackToUIThread*/ false,
new BTTransportConfig());
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
}
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param context - Used to create a multiplexing transport config
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
+ * @param listener - Reference to the object in the App listening to callbacks from SDL.
+ * @param appName - Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
* @param isMediaApp - Indicates if the app is a media application.
* @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired - Indicates the language desired for the SDL interface.
* @param autoActivateID - ID used to re-register previously registered application.
* @throws SdlException
*/
- public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms,
- Boolean isMediaApp, SdlMsgVersion sdlMsgVersion, Language languageDesired,
- Language hmiDisplayLanguageDesired, String appID, String autoActivateID) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms,
+ Boolean isMediaApp, SdlMsgVersion sdlMsgVersion, Language languageDesired,
+ Language hmiDisplayLanguageDesired, String appID, String autoActivateID) throws SdlException {
+ super( listener,
+ sdlProxyConfigurationResources,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
- /*callbackToUIThread*/ false,
+ /*callbackToUIThread*/ false,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
}
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
+ * @param listener - Reference to the object in the App listening to callbacks from SDL.
+ * @param appName - Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
* @param isMediaApp - Indicates if the app is a media application.
* @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired - Indicates the language desired for the SDL interface.
* @param autoActivateID - ID used to re-register previously registered application.
* @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
* @throws SdlException
*/
@Deprecated
- public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID, boolean callbackToUIThread) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
+ Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
+ Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
+ String autoActivateID, boolean callbackToUIThread) throws SdlException {
+ super( listener,
+ /*sdl proxy configuration resources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
new BTTransportConfig());
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"and callbackToUIThread", SDL_LIB_TRACE_KEY);
}
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param context - Used to create a multiplexing transport config
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
+ * @param listener - Reference to the object in the App listening to callbacks from SDL.
+ * @param appName - Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
* @param isMediaApp - Indicates if the app is a media application.
* @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired - Indicates the language desired for the SDL interface.
* @param autoActivateID - ID used to re-register previously registered application.
* @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
* @throws SdlException
*/
- public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID, boolean callbackToUIThread) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
+ Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
+ Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
+ String autoActivateID, boolean callbackToUIThread) throws SdlException {
+ super( listener,
+ /*sdl proxy configuration resources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"and callbackToUIThread", SDL_LIB_TRACE_KEY);
@@ -359,360 +363,360 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
+ * @param listener - Reference to the object in the App listening to callbacks from SDL.
+ * @param appName - Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
* @param isMediaApp - Indicates if the app is a media application.
* @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired - Indicates the language desired for the SDL interface.
* @param autoActivateID - ID used to re-register previously registered application.
* @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
* @throws SdlException
*/
@Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID,
- boolean callbackToUIThread) throws SdlException {
- super( listener,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID,
+ boolean callbackToUIThread) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
new BTTransportConfig());
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"and callbackToUIThread", SDL_LIB_TRACE_KEY);
}
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param context - Used to create a multiplexing transport config
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
+ * @param listener - Reference to the object in the App listening to callbacks from SDL.
+ * @param appName - Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
* @param isMediaApp - Indicates if the app is a media application.
* @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired - Indicates the language desired for the SDL interface.
* @param autoActivateID - ID used to re-register previously registered application.
* @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
* @throws SdlException
*/
- public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID,
- boolean callbackToUIThread) throws SdlException {
- super( listener,
+ public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID,
+ boolean callbackToUIThread) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"and callbackToUIThread", SDL_LIB_TRACE_KEY);
}
-
+
@Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
new BTTransportConfig());
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
-
- public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
+
+ public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
-
+
/********************************************** TRANSPORT SWITCHING SUPPORT *****************************************/
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
+ *
* Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
+ *
+ * @param listener Reference to the object in the App listening to callbacks from SDL.
+ * @param appName Name of the application displayed on SDL.
* @param isMediaApp Indicates if the app is a media application.
* @param transportConfig Initial configuration for transport.
* @throws SdlException
*/
- public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,
+ Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
+ BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
+ /*sdl proxy configuration resources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
- /*ngn media app*/null,
- /*vr synonyms*/null,
- /*is media app*/isMediaApp,
- /*sdlMsgVersion*/null,
- /*language desired*/languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ false,
+ /*TTS Name*/null,
+ /*ngn media app*/null,
+ /*vr synonyms*/null,
+ /*is media app*/isMediaApp,
+ /*sdlMsgVersion*/null,
+ /*language desired*/languageDesired,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
+ /*callbackToUIThread*/ false,
transportConfig);
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, appName, and isMediaApp.", SDL_LIB_TRACE_KEY);
}
-
+
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands to
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
+ * @param listener Reference to the object in the App listening to callbacks from SDL.
+ * @param appName Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms A vector of strings, all of which can be used as voice commands to
* @param isMediaApp Indicates if the app is a media application.
* @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired Indicates the language desired for the SDL interface.
* @param autoActivateID ID used to re-register previously registered application.
- * @param transportConfig Initial configuration for transport.
+ * @param transportConfig Initial configuration for transport.
* @throws SdlException
*/
- public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID, TransportType transportType, BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
+ Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
+ Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
+ String autoActivateID, TransportType transportType, BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
+ /*sdl proxy configuration resources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
- /*callbackToUIThread*/ false,
+ /*callbackToUIThread*/ false,
transportConfig);
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, appName, ngnMediaScreenAppName, " +
"vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
}
-
+
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands to
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
+ * @param listener Reference to the object in the App listening to callbacks from SDL.
+ * @param appName Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms A vector of strings, all of which can be used as voice commands to
* @param isMediaApp Indicates if the app is a media application.
* @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired Indicates the language desired for the SDL interface.
* @param autoActivateID ID used to re-register previously registered application.
- * @param transportConfig Initial configuration for transport.
+ * @param transportConfig Initial configuration for transport.
* @throws SdlException
*/
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms,
- Boolean isMediaApp, SdlMsgVersion sdlMsgVersion, Language languageDesired,
- Language hmiDisplayLanguageDesired, String appID, String autoActivateID,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms,
+ Boolean isMediaApp, SdlMsgVersion sdlMsgVersion, Language languageDesired,
+ Language hmiDisplayLanguageDesired, String appID, String autoActivateID,
+ BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
+ sdlProxyConfigurationResources,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
- /*callbackToUIThread*/ false,
+ /*callbackToUIThread*/ false,
transportConfig);
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
}
-
+
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands to
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
+ * @param listener Reference to the object in the App listening to callbacks from SDL.
+ * @param appName Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * vehicles. Limited to five characters.
+ * @param vrSynonyms A vector of strings, all of which can be used as voice commands to
* @param isMediaApp Indicates if the app is a media application.
* @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired Indicates the language desired for the SDL interface.
* @param autoActivateID ID used to re-register previously registered application.
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param transportConfig Initial configuration for transport.
+ * @param transportConfig Initial configuration for transport.
* @throws SdlException
*/
- public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID, boolean callbackToUIThread,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
+ Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
+ Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
+ String autoActivateID, boolean callbackToUIThread,
+ BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
+ /*sdl proxy configuration resources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
transportConfig);
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"and callbackToUIThread", SDL_LIB_TRACE_KEY);
}
-
+
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
+ * @param listener Reference to the object in the App listening to callbacks from SDL.
+ * @param appName Name of the application displayed on SDL.
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
* vehicles. Limited to five characters.
* @param vrSynonyms A vector of strings, all of which can be used as voice commands too
* @param isMediaApp Indicates if the app is a media application.
* @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
+ * or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired Indicates the language desired for the SDL interface.
* @param autoActivateID ID used to re-register previously registered application.
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param transportConfig Initial configuration for transport.
+ * @param transportConfig Initial configuration for transport.
* @throws SdlException
*/
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID,
- boolean callbackToUIThread, BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID,
+ boolean callbackToUIThread, BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
transportConfig);
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"and callbackToUIThread", SDL_LIB_TRACE_KEY);
@@ -720,13 +724,13 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
* @param appName Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
* vehicles. Limited to five characters.
* @param vrSynonyms A vector of strings, all of which can be used as voice commands too
* @param isMediaApp Indicates if the app is a media application.
@@ -738,32 +742,32 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param autoActivateID ID used to re-register previously registered application.
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
- * @param transportConfig Initial configuration for transport.
+ * @param transportConfig Initial configuration for transport.
* @throws SdlException
*/
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
+ BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
- /*TTS Name*/null,
+ /*TTS Name*/null,
ngnMediaScreenAppName,
vrSynonyms,
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
transportConfig);
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
@@ -772,9 +776,9 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param appName Name of the application displayed on SDL.
* @param isMediaApp Indicates if the app is a media application.
@@ -784,37 +788,37 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
* @throws SdlException
- */
+ */
@Deprecated
public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, boolean callbackToUIThread, boolean preRegister) throws SdlException
+ String appID, boolean callbackToUIThread, boolean preRegister) throws SdlException
{
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- languageDesired,
- hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- callbackToUIThread,
- preRegister,
- new BTTransportConfig());
-
+ super( listener,
+ /*sdlProxyConfigurationResources*/null,
+ /*enable advanced lifecycle management*/true,
+ appName,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
+ isMediaApp,
+ /*sdlMsgVersion*/null,
+ languageDesired,
+ hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
+ callbackToUIThread,
+ preRegister,
+ new BTTransportConfig());
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, isMediaApp, languageDesired, hmiDisplayLanguageDesired" + "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
+ "appName, isMediaApp, languageDesired, hmiDisplayLanguageDesired" + "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param context - Used to create a multiplexing transport config
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param appName Name of the application displayed on SDL.
@@ -825,99 +829,99 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
* @throws SdlException
- */
+ */
public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, Boolean isMediaApp,Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, boolean callbackToUIThread, boolean preRegister) throws SdlException
+ String appID, boolean callbackToUIThread, boolean preRegister) throws SdlException
{
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- languageDesired,
- hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- callbackToUIThread,
- preRegister,
- new MultiplexTransportConfig(context,appID));
-
+ super( listener,
+ /*sdlProxyConfigurationResources*/null,
+ /*enable advanced lifecycle management*/true,
+ appName,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
+ isMediaApp,
+ /*sdlMsgVersion*/null,
+ languageDesired,
+ hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
+ callbackToUIThread,
+ preRegister,
+ new MultiplexTransportConfig(context,appID));
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, isMediaApp, languageDesired, hmiDisplayLanguageDesired" + "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
+ "appName, isMediaApp, languageDesired, hmiDisplayLanguageDesired" + "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
-
+
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param appName Name of the application displayed on SDL.
* @param isMediaApp Indicates if the app is a media application.
* @param appID Identifier of the client application.
* @throws SdlException
- */
+ */
@Deprecated
public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
+ super( listener,
+ /*sdlProxyConfigurationResources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
+ /*sdlMsgVersion*/null,
+ /*languageDesired*/null,
+ /*hmiDisplayLanguageDesired*/null,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
false,
false,
new BTTransportConfig());
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
"appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
}
-
+
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param context - Used to create a multiplexing transport config
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param appName Name of the application displayed on SDL.
* @param isMediaApp Indicates if the app is a media application.
* @param appID Identifier of the client application.
* @throws SdlException
- */
+ */
public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
+ super( listener,
+ /*sdlProxyConfigurationResources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
+ /*sdlMsgVersion*/null,
+ /*languageDesired*/null,
+ /*hmiDisplayLanguageDesired*/null,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
false,
false,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
"appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
}
@@ -925,45 +929,45 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
* @param appName Name of the application displayed on SDL.
* @param isMediaApp Indicates if the app is a media application.
* @param appID Identifier of the client application.
* @throws SdlException
- */
+ */
@Deprecated
public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources, String appName, Boolean isMediaApp,String appID) throws SdlException {
- super( listener,
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
+ /*sdlMsgVersion*/null,
+ /*languageDesired*/null,
+ /*hmiDisplayLanguageDesired*/null,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
false,
false,
new BTTransportConfig());
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
"sdlProxyConfigurationResources, appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
}
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param context - Used to create a multiplexing transport config
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
@@ -971,49 +975,49 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param isMediaApp Indicates if the app is a media application.
* @param appID Identifier of the client application.
* @throws SdlException
- */
+ */
public SdlProxyALM(Context context, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources, String appName, Boolean isMediaApp,String appID) throws SdlException {
- super( listener,
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
+ /*sdlMsgVersion*/null,
+ /*languageDesired*/null,
+ /*hmiDisplayLanguageDesired*/null,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
false,
false,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
"sdlProxyConfigurationResources, appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
}
-
+
public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID,BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
+ super( listener,
+ /*sdlProxyConfigurationResources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
+ /*sdlMsgVersion*/null,
+ /*languageDesired*/null,
+ /*hmiDisplayLanguageDesired*/null,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
false,
false,
transportConfig);
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
"appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
}
@@ -1021,9 +1025,9 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param appName Name of the application displayed on SDL.
* @param isMediaApp Indicates if the app is a media application.
@@ -1031,36 +1035,36 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
* @throws SdlException
- */
+ */
@Deprecated
- public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID,
- boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
+ public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID,
+ boolean callbackToUIThread, boolean preRegister) throws SdlException {
+ super( listener,
+ /*sdlProxyConfigurationResources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
+ /*sdlMsgVersion*/null,
+ /*languageDesired*/null,
+ /*hmiDisplayLanguageDesired*/null,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
callbackToUIThread,
preRegister,
new BTTransportConfig());
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
"appName, isMediaApp, " + "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param context - Used to create a multiplexing transport config
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param appName Name of the application displayed on SDL.
@@ -1069,41 +1073,41 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
* @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID,
- boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
+ */
+ public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID,
+ boolean callbackToUIThread, boolean preRegister) throws SdlException {
+ super( listener,
+ /*sdlProxyConfigurationResources*/null,
+ /*enable advanced lifecycle management*/true,
appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
+ /*sdlMsgVersion*/null,
+ /*languageDesired*/null,
+ /*hmiDisplayLanguageDesired*/null,
+ /*App Type*/null,
+ /*App ID*/appID,
+ /*autoActivateID*/null,
callbackToUIThread,
preRegister,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
"appName, isMediaApp, " + "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- * @param appService Reference to the apps service object.
+ *
+ * Takes advantage of the advanced lifecycle management.
+ * @param appService Reference to the apps service object.
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
* @param appName Name of the application displayed on SDL.
* @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
* vehicles. Limited to five characters.
* @param vrSynonyms A vector of strings, all of which can be used as voice commands too
* @param isMediaApp Indicates if the app is a media application.
@@ -1116,14 +1120,14 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
* @throws SdlException
- */
- public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
+ */
+ public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1131,30 +1135,30 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
new MultiplexTransportConfig(appService.getBaseContext(),appID));
-
- this.setAppService(appService);
- this.sendTransportBroadcast();
-
+
+ this.setAppService(appService);
+ this.sendTransportBroadcast();
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
-
-
- public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister, BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
+
+
+ public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister, BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1162,35 +1166,35 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
transportConfig);
-
- this.setAppService(appService);
- this.sendTransportBroadcast();
-
+
+ this.setAppService(appService);
+ this.sendTransportBroadcast();
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
-
-
-
+
+
+
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
* @param appName Name of the application displayed on SDL.
* @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
* vehicles. Limited to five characters.
* @param vrSynonyms A vector of strings, all of which can be used as voice commands too
* @param isMediaApp Indicates if the app is a media application.
@@ -1203,15 +1207,15 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
* @throws SdlException
- */
+ */
@Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1219,29 +1223,29 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
new BTTransportConfig());
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param context - Used to create a multiplexing transport config
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
* @param appName Name of the application displayed on SDL.
* @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
* vehicles. Limited to five characters.
* @param vrSynonyms A vector of strings, all of which can be used as voice commands too
* @param isMediaApp Indicates if the app is a media application.
@@ -1254,14 +1258,14 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
* @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
+ */
+ public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1269,30 +1273,30 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
-
+
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
* @param appName Name of the application displayed on SDL.
* @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
* vehicles. Limited to five characters.
* @param vrSynonyms A vector of strings, all of which can be used as voice commands too
* @param isMediaApp Indicates if the app is a media application.
@@ -1304,17 +1308,17 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param autoActivateID ID used to re-register previously registered application.
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
- * @param transportConfig Initial configuration for transport.
+ * @param transportConfig Initial configuration for transport.
* @throws SdlException
*/
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
+ BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1322,51 +1326,51 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
transportConfig);
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
+ }
/**
* @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
* @param appName Name of the application displayed on SDL.
* @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
* vehicles. Limited to five characters.
* @param vrSynonyms A vector of strings, all of which can be used as voice commands too
* @param isMediaApp Indicates if the app is a media application.
* @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
* or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appType Type of application.
+ * @param hmiDisplayLanguageDesired Desired language in HMI.
+ * @param appType Type of application.
* @param appID Identifier of the client application.
* @param autoActivateID ID used to re-register previously registered application.
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
* @throws SdlException
- */
+ */
@Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- Vector<AppHMIType> appType, String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ Vector<AppHMIType> appType, String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1374,50 +1378,50 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/appType,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
new BTTransportConfig());
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
+ }
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param context - Used to create a multiplexing transport config
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
* @param appName Name of the application displayed on SDL.
* @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
* vehicles. Limited to five characters.
* @param vrSynonyms A vector of strings, all of which can be used as voice commands too
* @param isMediaApp Indicates if the app is a media application.
* @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
* or equal to the version of SDL SmartDeviceLink running on the vehicle.
* @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appType Type of application.
+ * @param hmiDisplayLanguageDesired Desired language in HMI.
+ * @param appType Type of application.
* @param appID Identifier of the client application.
* @param autoActivateID ID used to re-register previously registered application.
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
* @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- Vector<AppHMIType> appType, String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
+ */
+ public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
+ Vector<AppHMIType> appType, String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1425,28 +1429,28 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/appType,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
new MultiplexTransportConfig(context,appID));
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
+ }
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
* @param appName Name of the application displayed on SDL.
* @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
* vehicles. Limited to five characters.
* @param vrSynonyms A vector of strings, all of which can be used as voice commands too
* @param isMediaApp Indicates if the app is a media application.
@@ -1459,17 +1463,17 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param autoActivateID ID used to re-register previously registered application.
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
- * @param transportConfig Initial configuration for transport.
+ * @param transportConfig Initial configuration for transport.
* @throws SdlException
*/
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
+ BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1477,26 +1481,26 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/appType,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
transportConfig);
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
- public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
+ public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
+ BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1504,31 +1508,31 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/appType,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
transportConfig);
-
- this.setAppService(appService);
- this.sendTransportBroadcast();
+
+ this.setAppService(appService);
+ this.sendTransportBroadcast();
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
+ }
/**
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
+ *
+ * Takes advantage of the advanced lifecycle management.
+ *
* @param listener Reference to the object in the App listening to callbacks from SDL.
* @param sdlProxyConfigurationResources Proxy configuration resources.
* @param appName Name of the application displayed on SDL.
* @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
+ * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
* vehicles. Limited to five characters.
* @param vrSynonyms A vector of strings, all of which can be used as voice commands too
* @param isMediaApp Indicates if the app is a media application.
@@ -1542,17 +1546,17 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @param callbackToUIThread If true, all callbacks will occur on the UI thread.
* @param preRegister Flag that indicates that client should be pre-registred or not
* @param sHashID HashID used for app resumption
- * @param transportConfig Initial configuration for transport.
+ * @param transportConfig Initial configuration for transport.
* @throws SdlException
*/
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister, String sHashID,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
+ public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister, String sHashID,
+ BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1560,28 +1564,28 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/appType,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
- /*sHashID*/sHashID,
+ /*sHashID*/sHashID,
true,
transportConfig);
-
+
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
}
- public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister, String sHashID,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
+ public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
+ SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister, String sHashID,
+ BaseTransportConfig transportConfig) throws SdlException {
+ super( listener,
sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
+ /*enable advanced lifecycle management*/true,
appName,
ttsName,
ngnMediaScreenAppName,
@@ -1589,25 +1593,25 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
isMediaApp,
sdlMsgVersion,
languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/appType,
+ /*App ID*/appID,
autoActivateID,
callbackToUIThread,
preRegister,
- /*sHashID*/sHashID,
- /*bEnableResume*/true,
+ /*sHashID*/sHashID,
+ /*bEnableResume*/true,
transportConfig);
- this.setAppService(appService);
- this.sendTransportBroadcast();
+ this.setAppService(appService);
+ this.sendTransportBroadcast();
SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
"appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
"callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
+ }
/***************************************** END OF TRANSPORT SWITCHING SUPPORT ***************************************/
-
+
// Allow applications using ALM to reset the proxy (dispose and reinstantiate)
/**
* Disconnects the application from SDL, then recreates the transport such that
@@ -1617,69 +1621,76 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
public void resetProxy() throws SdlException {
super.cycleProxy(SdlDisconnectedReason.APPLICATION_REQUESTED_DISCONNECT);
}
-
+
/********* Getters for values returned by RegisterAppInterfaceResponse **********/
-
+
/**
* Gets buttonCapabilities set when application interface is registered.
- *
+ *
* @return buttonCapabilities
* @throws SdlException
+ * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
*/
+ @Deprecated
public List<ButtonCapabilities> getButtonCapabilities() throws SdlException{
// Test if proxy has been disposed
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
+
+ // Test SDL availability
+ if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
throw new SdlException("SDL is unavailable. Unable to get the buttonCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
}
- return _buttonCapabilities;
+
+ return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.BUTTON), ButtonCapabilities.class);
}
-
+
/**
* Gets getSoftButtonCapabilities set when application interface is registered.
- *
- * @return softButtonCapabilities
+ *
+ * @return softButtonCapabilities
* @throws SdlException
+ * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
*/
+ @Deprecated
public List<SoftButtonCapabilities> getSoftButtonCapabilities() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
+
+ // Test SDL availability
+ if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
throw new SdlException("SDL is not connected. Unable to get the softButtonCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
}
- return _softButtonCapabilities;
+ return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON),SoftButtonCapabilities.class);
}
-
+
/**
* Gets getPresetBankCapabilities set when application interface is registered.
- *
- * @return presetBankCapabilities
+ *
+ * @return presetBankCapabilities
* @throws SdlException
+ * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
*/
+ @Deprecated
public PresetBankCapabilities getPresetBankCapabilities() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
+
+ // Test SDL availability
if (!_appInterfaceRegisterd) {
throw new SdlException("SDL is not connected. Unable to get the presetBankCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
}
- return _presetBankCapabilities;
+ return ( PresetBankCapabilities ) _systemCapabilityManager.getCapability(SystemCapabilityType.PRESET_BANK);
}
-
+
/**
* Gets the current version information of the proxy.
- *
+ *
* @return String
* @throws SdlException
*/
@@ -1687,76 +1698,82 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
// Test if proxy has been disposed
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
+ }
if (Version.VERSION != null)
- return Version.VERSION;
-
+ return Version.VERSION;
+
return null;
}
-
-
+
+
/**
* Gets displayCapabilities set when application interface is registered.
- *
+ *
* @return displayCapabilities
* @throws SdlException
+ * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
*/
+ @Deprecated
public DisplayCapabilities getDisplayCapabilities() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
+
+ // Test SDL availability
+ if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
throw new SdlException("SDL is unavailable. Unable to get the displayCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
}
- return _displayCapabilities;
+ return ( DisplayCapabilities ) _systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY);
}
-
+
/**
* Gets hmiZoneCapabilities set when application interface is registered.
- *
+ *
* @return hmiZoneCapabilities
* @throws SdlException
+ * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
*/
+ @Deprecated
public List<HmiZoneCapabilities> getHmiZoneCapabilities() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
+
+ // Test SDL availability
+ if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
throw new SdlException("SDL is unavailable. Unable to get the hmiZoneCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
}
- return _hmiZoneCapabilities;
+ return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.HMI_ZONE), HmiZoneCapabilities.class);
}
-
+
/**
* Gets speechCapabilities set when application interface is registered.
- *
+ *
* @return speechCapabilities
* @throws SdlException
+ * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
*/
+ @Deprecated
public List<SpeechCapabilities> getSpeechCapabilities() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
+
+ // Test SDL availability
+ if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
throw new SdlException("SDL is unavailable. Unable to get the speechCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
}
-
- return _speechCapabilities;
+
+ return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.SPEECH), SpeechCapabilities.class);
}
/**
* Gets PrerecordedSpeech set when application interface is registered.
- *
+ *
* @return PrerecordedSpeech
* @throws SdlException
*/
@@ -1765,17 +1782,17 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
+
+ // Test SDL availability
if (!_appInterfaceRegisterd) {
throw new SdlException("SDL is unavailable. Unable to get the PrerecordedSpeech.", SdlExceptionCause.SDL_UNAVAILABLE);
}
-
+
return _prerecordedSpeech;
}
/**
* Gets sdlLanguage set when application interface is registered.
- *
+ *
* @return sdlLanguage
* @throws SdlException
*/
@@ -1784,18 +1801,18 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
+
+ // Test SDL availability
if (!_appInterfaceRegisterd) {
throw new SdlException("SDL is unavailable. Unable to get the sdlLanguage.", SdlExceptionCause.SDL_UNAVAILABLE);
}
return _sdlLanguage;
}
-
+
/**
* Gets getHmiDisplayLanguage set when application interface is registered.
- *
- * @return hmiDisplayLanguage
+ *
+ * @return hmiDisplayLanguage
* @throws SdlException
*/
public Language getHmiDisplayLanguage() throws SdlException {
@@ -1803,17 +1820,17 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
+
+ // Test SDL availability
if (!_appInterfaceRegisterd) {
throw new SdlException("SDL is not connected. Unable to get the hmiDisplayLanguage.", SdlExceptionCause.SDL_UNAVAILABLE);
}
return _hmiDisplayLanguage;
}
-
+
/**
* Gets sdlMsgVersion set when application interface is registered.
- *
+ *
* @return sdlMsgVersion
* @throws SdlException
*/
@@ -1822,37 +1839,39 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
+
+ // Test SDL availability
if (!_appInterfaceRegisterd) {
throw new SdlException("SDL is unavailable. Unable to get the sdlMsgVersion.", SdlExceptionCause.SDL_UNAVAILABLE);
}
return _sdlMsgVersion;
}
-
+
/**
* Gets vrCapabilities set when application interface is registered.
- *
+ *
* @return vrCapabilities
* @throws SdlException
+ * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
*/
+ @Deprecated
public List<VrCapabilities> getVrCapabilities() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
+
+ // Test SDL availability
+ if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
throw new SdlException("SDL is unavailable. Unable to get the vrCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
}
- return _vrCapabilities;
+ return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.VOICE_RECOGNITION), VrCapabilities.class);
}
-
+
/**
* Gets getVehicleType set when application interface is registered.
- *
- * @return vehicleType
+ *
+ * @return vehicleType
* @throws SdlException
*/
public VehicleType getVehicleType() throws SdlException {
@@ -1860,20 +1879,22 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
+
+ // Test SDL availability
if (!_appInterfaceRegisterd) {
throw new SdlException("SDL is not connected. Unable to get the vehicleType.", SdlExceptionCause.SDL_UNAVAILABLE);
}
return _vehicleType;
}
-
+
/**
- * Gets AudioPassThruCapabilities set when application interface is registered.
- *
- * @return AudioPassThruCapabilities
- * @throws SdlException
- */
+ * Gets AudioPassThruCapabilities set when application interface is registered.
+ *
+ * @return AudioPassThruCapabilities
+ * @throws SdlException
+ * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
+ */
+ @Deprecated
public List<AudioPassThruCapabilities> getAudioPassThruCapabilities() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
@@ -1881,10 +1902,10 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
}
// Test SDL availability
- if (!_appInterfaceRegisterd) {
+ if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
throw new SdlException("SDL is not connected. Unable to get the vehicleType.", SdlExceptionCause.SDL_UNAVAILABLE);
}
- return _audioPassThruCapabilities;
+ return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.AUDIO_PASSTHROUGH), AudioPassThruCapabilities.class);
}
public List<Integer> getSupportedDiagModes() throws SdlException {
@@ -1892,14 +1913,22 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
+
+ // Test SDL availability
if (!_appInterfaceRegisterd) {
throw new SdlException("SDL is not connected. Unable to get SupportedDiagModes.", SdlExceptionCause.SDL_UNAVAILABLE);
}
return _diagModes;
- }
-
+ }
+
+ /**
+ * Gets HMICapabilities when application interface is registered.
+ *
+ * @return HMICapabilities
+ * @throws SdlException
+ * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
+ */
+ @Deprecated
public HMICapabilities getHmiCapabilities() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
@@ -1907,13 +1936,13 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
}
// Test SDL availability
- if (!_appInterfaceRegisterd) {
+ if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
throw new SdlException("SDL is not connected. Unable to get the HMICapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
}
- return _hmiCapabilities;
- }
-
-
+ return ( HMICapabilities ) _systemCapabilityManager.getCapability(SystemCapabilityType.HMI);
+ }
+
+
public String getSystemSoftwareVersion() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
@@ -1925,19 +1954,19 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
throw new SdlException("SDL is not connected. Unable to get the SystemSoftwareVersion.", SdlExceptionCause.SDL_UNAVAILABLE);
}
return _systemSoftwareVersion;
- }
-
+ }
+
public boolean isAppResumeSuccess() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
-
- // Test SDL availability
+
+ // Test SDL availability
if (!_appInterfaceRegisterd) {
throw new SdlException("SDL is not connected. Unable to get isResumeSuccess.", SdlExceptionCause.SDL_UNAVAILABLE);
}
return _bResumeSuccess;
- }
-
+ }
+
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
index 59a44a27b..ea55702bd 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -25,15 +25,24 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import android.annotation.TargetApi;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
+import android.os.Build;
import android.os.Handler;
import android.os.Looper;
+import android.os.SystemClock;
+import android.support.annotation.NonNull;
import android.telephony.TelephonyManager;
+import android.util.DisplayMetrics;
import android.util.Log;
import android.util.SparseArray;
+import android.util.SparseIntArray;
+import android.view.Display;
+import android.view.InputDevice;
+import android.view.MotionEvent;
import android.view.Surface;
import com.smartdevicelink.Dispatcher.IDispatchingStrategy;
@@ -41,8 +50,10 @@ import com.smartdevicelink.Dispatcher.ProxyMessageDispatcher;
import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.encoder.VirtualDisplayEncoder;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
+import com.smartdevicelink.haptic.HapticInterfaceManager;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -55,9 +66,13 @@ import com.smartdevicelink.proxy.callbacks.OnError;
import com.smartdevicelink.proxy.callbacks.OnProxyClosed;
import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
import com.smartdevicelink.proxy.callbacks.OnServiceNACKed;
-import com.smartdevicelink.proxy.interfaces.IProxyListenerALM;
+import com.smartdevicelink.proxy.interfaces.IAudioStreamListener;
import com.smartdevicelink.proxy.interfaces.IProxyListenerBase;
import com.smartdevicelink.proxy.interfaces.IPutFileResponseListener;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
import com.smartdevicelink.proxy.rpc.*;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.AudioStreamingState;
@@ -68,7 +83,6 @@ import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.GlobalProperty;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
-import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
import com.smartdevicelink.proxy.rpc.enums.ImageType;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
@@ -79,31 +93,40 @@ import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
import com.smartdevicelink.proxy.rpc.enums.SdlConnectionState;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
import com.smartdevicelink.proxy.rpc.enums.SdlInterfaceAvailability;
-import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
-import com.smartdevicelink.proxy.rpc.enums.SystemContext;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
+import com.smartdevicelink.proxy.rpc.enums.TouchType;
import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
-import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
+import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.security.SdlSecurityBase;
+import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
+import com.smartdevicelink.streaming.audio.AudioStreamingParams;
import com.smartdevicelink.streaming.StreamRPCPacketizer;
+import com.smartdevicelink.streaming.video.SdlRemoteDisplay;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.trace.SdlTrace;
import com.smartdevicelink.trace.TraceDeviceInfo;
import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.SiphonServer;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.util.CorrelationIdGenerator;
import com.smartdevicelink.util.DebugTool;
+
+@SuppressWarnings({"WeakerAccess", "Convert2Diamond"})
public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> {
// Used for calls to Android Log class.
public static final String TAG = "SdlProxy";
private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
private static final int PROX_PROT_VER_ONE = 1;
private static final int RESPONSE_WAIT_TIME = 2000;
-
+
+ private static final com.smartdevicelink.util.Version MAX_SUPPORTED_RPC_VERSION = new com.smartdevicelink.util.Version("4.5.0");
+
private SdlSession sdlSession = null;
private proxyListenerType _proxyListener = null;
@@ -115,7 +138,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
UNREGISTER_APP_INTERFACE_CORRELATION_ID = 65530,
POLICIES_CORRELATION_ID = 65535;
- // Sdlhronization Objects
+ // Sdl Synchronization Objects
private static final Object CONNECTION_REFERENCE_LOCK = new Object(),
INCOMING_MESSAGE_QUEUE_THREAD_LOCK = new Object(),
OUTGOING_MESSAGE_QUEUE_THREAD_LOCK = new Object(),
@@ -123,14 +146,17 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
ON_UPDATE_LISTENER_LOCK = new Object(),
ON_NOTIFICATION_LISTENER_LOCK = new Object();
- private Object APP_INTERFACE_REGISTERED_LOCK = new Object();
+ private final Object APP_INTERFACE_REGISTERED_LOCK = new Object();
private int iFileCount = 0;
private boolean navServiceStartResponseReceived = false;
private boolean navServiceStartResponse = false;
+ private List<String> navServiceStartRejectedParams = null;
private boolean pcmServiceStartResponseReceived = false;
private boolean pcmServiceStartResponse = false;
+ @SuppressWarnings("FieldCanBeLocal")
+ private List<String> pcmServiceStartRejectedParams = null;
private boolean navServiceEndResponseReceived = false;
private boolean navServiceEndResponse = false;
private boolean pcmServiceEndResponseReceived = false;
@@ -156,7 +182,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
protected Boolean _advancedLifecycleManagementEnabled = false;
// Parameters passed to the constructor from the app to register an app interface
private String _applicationName = null;
- private long instanceDateTime = System.currentTimeMillis();
+ private final long instanceDateTime = System.currentTimeMillis();
private String sConnectionDetails = "N/A";
private Vector<TTSChunk> _ttsName = null;
private String _ngnMediaScreenAppName = null;
@@ -165,8 +191,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private Language _hmiDisplayLanguageDesired = null;
private Vector<AppHMIType> _appType = null;
private String _appID = null;
+ @SuppressWarnings({"FieldCanBeLocal", "unused"}) //Need to understand what this is used for
private String _autoActivateIdDesired = null;
- private String _lastHashID = null;
+ private String _lastHashID = null;
private SdlMsgVersion _sdlMsgVersionRequest = null;
private Vector<String> _vrSynonyms = null;
private boolean _bAppResumeEnabled = false;
@@ -182,7 +209,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// Proxy State Variables
protected Boolean _appInterfaceRegisterd = false;
protected Boolean _preRegisterd = false;
- @SuppressWarnings("unused")
+ @SuppressWarnings({"unused", "FieldCanBeLocal"})
private Boolean _haveReceivedFirstNonNoneHMILevel = false;
protected Boolean _haveReceivedFirstFocusLevel = false;
protected Boolean _haveReceivedFirstFocusLevelFull = false;
@@ -190,42 +217,116 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
protected SdlConnectionState _sdlConnectionState = null;
protected SdlInterfaceAvailability _sdlIntefaceAvailablity = null;
protected HMILevel _hmiLevel = null;
- private HMILevel _priorHmiLevel = null;
protected AudioStreamingState _audioStreamingState = null;
- private AudioStreamingState _priorAudioStreamingState = null;
- protected SystemContext _systemContext = null;
// Variables set by RegisterAppInterfaceResponse
protected SdlMsgVersion _sdlMsgVersion = null;
protected String _autoActivateIdReturned = null;
protected Language _sdlLanguage = null;
protected Language _hmiDisplayLanguage = null;
- protected DisplayCapabilities _displayCapabilities = null;
- protected List<ButtonCapabilities> _buttonCapabilities = null;
- protected List<SoftButtonCapabilities> _softButtonCapabilities = null;
- protected PresetBankCapabilities _presetBankCapabilities = null;
- protected List<HmiZoneCapabilities> _hmiZoneCapabilities = null;
- protected List<SpeechCapabilities> _speechCapabilities = null;
protected List<PrerecordedSpeech> _prerecordedSpeech = null;
- protected List<VrCapabilities> _vrCapabilities = null;
protected VehicleType _vehicleType = null;
- protected List<AudioPassThruCapabilities> _audioPassThruCapabilities = null;
- protected HMICapabilities _hmiCapabilities = null;
protected String _systemSoftwareVersion = null;
protected List<Integer> _diagModes = null;
protected Boolean firstTimeFull = true;
protected String _proxyVersionInfo = null;
protected Boolean _bResumeSuccess = false;
protected List<Class<? extends SdlSecurityBase>> _secList = null;
+ protected SystemCapabilityManager _systemCapabilityManager;
- private CopyOnWriteArrayList<IPutFileResponseListener> _putFileListenerList = new CopyOnWriteArrayList<IPutFileResponseListener>();
+ private final CopyOnWriteArrayList<IPutFileResponseListener> _putFileListenerList = new CopyOnWriteArrayList<IPutFileResponseListener>();
protected byte _wiproVersion = 1;
protected SparseArray<OnRPCResponseListener> rpcResponseListeners = null;
- protected SparseArray<OnRPCNotificationListener> rpcNotificationListeners = null;
-
+ protected SparseArray<CopyOnWriteArrayList<OnRPCNotificationListener>> rpcNotificationListeners = null;
+
+ protected VideoStreamingManager manager; //Will move to SdlSession once the class becomes public
+
// Interface broker
private SdlInterfaceBroker _interfaceBroker = null;
+ //We create an easily passable anonymous class of the interface so that we don't expose the internal interface to developers
+ private ISdl _internalInterface = new ISdl() {
+ @Override
+ public void start() {
+ try{
+ initializeProxy();
+ }catch (SdlException e){
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void stop() {
+ try{
+ dispose();
+ }catch (SdlException e){
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public boolean isConnected() {
+ return getIsConnected();
+ }
+
+ @Override
+ public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
+ SdlProxyBase.this.addServiceListener(serviceType,sdlServiceListener);
+ }
+
+ @Override
+ public void removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
+ SdlProxyBase.this.removeServiceListener(serviceType,sdlServiceListener);
+ }
+
+ @Override
+ public void startVideoService(VideoStreamingParameters parameters, boolean encrypted) {
+ if(isConnected()){
+ sdlSession.setDesiredVideoParams(parameters);
+ sdlSession.startService(SessionType.NAV,sdlSession.getSessionId(),encrypted);
+ }
+ }
+
+ @Override
+ public void stopVideoService() {
+ if(isConnected()){
+ sdlSession.endService(SessionType.NAV,sdlSession.getSessionId());
+ }
+ }
+
+ @Override
+ public void startAudioService(boolean encrypted) {
+ if(isConnected()){
+ sdlSession.startService(SessionType.PCM,sdlSession.getSessionId(),encrypted);
+ }
+ }
+
+ @Override
+ public void stopAudioService() {
+ if(isConnected()){
+ sdlSession.endService(SessionType.PCM,sdlSession.getSessionId());
+ }
+ }
+
+ @Override
+ public void sendRPCRequest(RPCRequest message){
+ try {
+ SdlProxyBase.this.sendRPCRequest(message);
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
+ SdlProxyBase.this.addOnRPCNotificationListener(notificationId,listener);
+ }
+
+ @Override
+ public boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
+ return SdlProxyBase.this.removeOnRPCNotificationListener(notificationId,listener);
+ }
+ };
private void notifyPutFileStreamError(Exception e, String info)
{
@@ -260,12 +361,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// disconnect has completed
notifyPutFileStreamError(null, info);
- if (_advancedLifecycleManagementEnabled) {
- // If ALM, nothing is required to be done here
- } else {
+ if (!_advancedLifecycleManagementEnabled) {
// If original model, notify app the proxy is closed so it will delete and reinstanciate
notifyProxyClosed(info, new SdlException("Transport disconnected.", SdlExceptionCause.SDL_UNAVAILABLE), SdlDisconnectedReason.TRANSPORT_DISCONNECT);
- }
+ }// else If ALM, nothing is required to be done here
+
}
@Override
@@ -326,7 +426,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sdlSession.setIncomingHeartbeatMonitor(incomingHeartbeatMonitor);
}
- startRPCProtocolSession(sessionID, correlationID);
+ startRPCProtocolSession();
}
else
{
@@ -341,15 +441,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
else if (_wiproVersion > 1) {
//If version is 2 or above then don't need to specify a Session Type
- startRPCProtocolSession(sessionID, correlationID);
- } else {
- // Handle other protocol session types here
- }
+ startRPCProtocolSession();
+ } //else{} Handle other protocol session types here
+
}
@Override
public void onProtocolSessionStartedNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID) {
+ byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
OnServiceNACKed message = new OnServiceNACKed(sessionType);
queueInternalMessage(message);
@@ -361,7 +460,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
updateBroadcastIntent(sendIntent, "COMMENT2", " NACK ServiceType: " + sessionType.getName());
sendBroadcastIntent(sendIntent);
- NavServiceStartedNACK();
+ NavServiceStartedNACK(rejectedParams);
}
else if (sessionType.eq(SessionType.PCM)) {
Intent sendIntent = createBroadcastIntent();
@@ -370,7 +469,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
updateBroadcastIntent(sendIntent, "COMMENT2", " NACK ServiceType: " + sessionType.getName());
sendBroadcastIntent(sendIntent);
- AudioServiceStartedNACK();
+ AudioServiceStartedNACK(rejectedParams);
}
}
@@ -480,7 +579,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param autoActivateID Auto activation identifier.
* @param callbackToUIThread Flag that indicates that this proxy should send callback to UI thread or not.
* @param transportConfig Configuration of transport to be used by underlying connection.
- * @throws SdlException
+ * @throws SdlException if there is an unrecoverable error class might throw an exception.
*/
protected SdlProxyBase(proxyListenerType listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
boolean enableAdvancedLifecycleManagement, String appName, Vector<TTSChunk> ttsName,
@@ -493,13 +592,15 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sdlMsgVersion, languageDesired, hmiDisplayLanguageDesired, appType, appID, autoActivateID, callbackToUIThread, null, null, null, transportConfig);
}
- private void performBaseCommon(proxyListenerType listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- boolean enableAdvancedLifecycleManagement, String appName, Vector<TTSChunk> ttsName,
- String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID,
- String autoActivateID, boolean callbackToUIThread, Boolean preRegister, String sHashID, Boolean bAppResumeEnab,
- BaseTransportConfig transportConfig) throws SdlException
+ @SuppressWarnings("ConstantConditions")
+ private void performBaseCommon(proxyListenerType listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
+ boolean enableAdvancedLifecycleManagement, String appName, Vector<TTSChunk> ttsName,
+ String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
+ Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID,
+ String autoActivateID, boolean callbackToUIThread, Boolean preRegister, String sHashID, Boolean bAppResumeEnab,
+ BaseTransportConfig transportConfig) throws SdlException
{
+ Log.i(TAG, "SDL_LIB_VERSION: " + Version.VERSION);
setWiProVersion((byte)PROX_PROT_VER_ONE);
if (preRegister != null && preRegister)
@@ -582,7 +683,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void dispatch(InternalProxyMessage message) {
- dispatchInternalMessage((InternalProxyMessage)message);
+ dispatchInternalMessage(message);
}
@Override
@@ -608,7 +709,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_incomingProxyMessageDispatcher = new ProxyMessageDispatcher<ProtocolMessage>("INCOMING_MESSAGE_DISPATCHER",new IDispatchingStrategy<ProtocolMessage>() {
@Override
public void dispatch(ProtocolMessage message) {
- dispatchIncomingMessage((ProtocolMessage)message);
+ dispatchIncomingMessage(message);
}
@Override
@@ -634,7 +735,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_outgoingProxyMessageDispatcher = new ProxyMessageDispatcher<ProtocolMessage>("OUTGOING_MESSAGE_DISPATCHER",new IDispatchingStrategy<ProtocolMessage>() {
@Override
public void dispatch(ProtocolMessage message) {
- dispatchOutgoingMessage((ProtocolMessage)message);
+ dispatchOutgoingMessage(message);
}
@Override
@@ -650,8 +751,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
rpcResponseListeners = new SparseArray<OnRPCResponseListener>();
- rpcNotificationListeners = new SparseArray<OnRPCNotificationListener>();
-
+ rpcNotificationListeners = new SparseArray<CopyOnWriteArrayList<OnRPCNotificationListener>>();
+
// Initialize the proxy
try {
initializeProxy();
@@ -711,7 +812,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param callbackToUIThread Flag that indicates that this proxy should send callback to UI thread or not.
* @param preRegister Flag that indicates that this proxy should be pre-registerd or not.
* @param transportConfig Configuration of transport to be used by underlying connection.
- * @throws SdlException
+ * @throws SdlException if there is an unrecoverable error class might throw an exception.
*/
protected SdlProxyBase(proxyListenerType listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
boolean enableAdvancedLifecycleManagement, String appName, Vector<TTSChunk> ttsName,
@@ -791,7 +892,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private void sendBroadcastIntent(Intent sendIntent)
{
- Service myService = null;
+ Service myService;
if (_proxyListener != null && _proxyListener instanceof Service)
{
myService = (Service) _proxyListener;
@@ -829,8 +930,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
String sCharSet = "utf-8";
int iContentLength = iContentLen;
- URL url = null;
- HttpURLConnection urlConnection = null;
+ URL url;
+ HttpURLConnection urlConnection;
Intent sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "getURLConnection");
@@ -904,7 +1005,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
Headers myHeader = msg.getHeader();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "sendOnSystemRequestToUrl");
+ updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "sendOnSystemRequestToUrl");
updateBroadcastIntent(sendIntent, "COMMENT5", "\r\nCloud URL: " + sURLString);
try
@@ -967,9 +1068,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
wr.close();
- long BeforeTime = System.currentTimeMillis();
- @SuppressWarnings("unused")
- String sResponseMsg = urlConnection.getResponseMessage();
+ long BeforeTime = System.currentTimeMillis();
long AfterTime = System.currentTimeMillis();
final long roundtriptime = AfterTime - BeforeTime;
@@ -1006,7 +1105,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
updateBroadcastIntent(sendIntent, "DATA", "Data from cloud response: " + response.toString());
sendRPCRequestPrivate(putFile);
- Log.i("sendOnSystemRequestToUrl", "sent to sdl");
+ Log.i("sendSystemRequestToUrl", "sent to sdl");
updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.PUT_FILE.toString());
updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
@@ -1026,20 +1125,20 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (jsonArray.get(i) instanceof String)
{
cloudDataReceived.add(jsonArray.getString(i));
- //Log.i("sendOnSystemRequestToUrl", "jsonArray.getString(i): " + jsonArray.getString(i));
+ //Log.i("sendSystemRequestToUrl", "jsonArray.getString(i): " + jsonArray.getString(i));
}
}
}
else if (jsonResponse.get(dataKey) instanceof String)
{
cloudDataReceived.add(jsonResponse.getString(dataKey));
- //Log.i("sendOnSystemRequestToUrl", "jsonResponse.getString(data): " + jsonResponse.getString("data"));
+ //Log.i("sendSystemRequestToUrl", "jsonResponse.getString(data): " + jsonResponse.getString("data"));
}
}
else
{
- DebugTool.logError("sendOnSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
- //Log.i("sendOnSystemRequestToUrl", "sendOnSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
+ DebugTool.logError("sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
+ //Log.i("sendSystemRequestToUrl", "sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
return;
}
@@ -1053,18 +1152,27 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
updateBroadcastIntent(sendIntent, "DATA", "Data from cloud response: " + sResponse);
// Send new SystemRequest to SDL
- SystemRequest mySystemRequest;
+ SystemRequest mySystemRequest = null;
if (bLegacy){
- mySystemRequest = RPCRequestFactory.buildSystemRequestLegacy(cloudDataReceived, getPoliciesReservedCorrelationID());
+ if(cloudDataReceived != null) {
+ mySystemRequest = new SystemRequest(true);
+ mySystemRequest.setCorrelationID(getPoliciesReservedCorrelationID());
+ mySystemRequest.setLegacyData(cloudDataReceived);
+ }
}else{
- mySystemRequest = RPCRequestFactory.buildSystemRequest(response.toString(), getPoliciesReservedCorrelationID());
+ if (response != null) {
+ mySystemRequest = new SystemRequest();
+ mySystemRequest.setRequestType(RequestType.PROPRIETARY);
+ mySystemRequest.setCorrelationID(getPoliciesReservedCorrelationID());
+ mySystemRequest.setBulkData(response.toString().getBytes());
+ }
}
- if (getIsConnected())
+ if (getIsConnected())
{
sendRPCRequestPrivate(mySystemRequest);
- Log.i("sendOnSystemRequestToUrl", "sent to sdl");
+ Log.i("sendSystemRequestToUrl", "sent to sdl");
updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
@@ -1074,45 +1182,45 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
catch (SdlException e)
{
- DebugTool.logError("sendOnSystemRequestToUrl: Could not get data from JSONObject received.", e);
+ DebugTool.logError("sendSystemRequestToUrl: Could not get data from JSONObject received.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " SdlException encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendOnSystemRequestToUrl: Could not get data from JSONObject received."+ e);
+ //Log.i("pt", "sendSystemRequestToUrl: Could not get data from JSONObject received."+ e);
}
catch (JSONException e)
{
- DebugTool.logError("sendOnSystemRequestToUrl: JSONException: ", e);
+ DebugTool.logError("sendSystemRequestToUrl: JSONException: ", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " JSONException encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendOnSystemRequestToUrl: JSONException: "+ e);
+ //Log.i("pt", "sendSystemRequestToUrl: JSONException: "+ e);
}
catch (UnsupportedEncodingException e)
{
- DebugTool.logError("sendOnSystemRequestToUrl: Could not encode string.", e);
+ DebugTool.logError("sendSystemRequestToUrl: Could not encode string.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " UnsupportedEncodingException encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendOnSystemRequestToUrl: Could not encode string."+ e);
+ //Log.i("pt", "sendSystemRequestToUrl: Could not encode string."+ e);
}
catch (ProtocolException e)
{
- DebugTool.logError("sendOnSystemRequestToUrl: Could not set request method to post.", e);
+ DebugTool.logError("sendSystemRequestToUrl: Could not set request method to post.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " ProtocolException encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendOnSystemRequestToUrl: Could not set request method to post."+ e);
+ //Log.i("pt", "sendSystemRequestToUrl: Could not set request method to post."+ e);
}
catch (MalformedURLException e)
{
- DebugTool.logError("sendOnSystemRequestToUrl: URL Exception when sending SystemRequest to an external server.", e);
+ DebugTool.logError("sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " MalformedURLException encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendOnSystemRequestToUrl: URL Exception when sending SystemRequest to an external server."+ e);
+ //Log.i("pt", "sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server."+ e);
}
catch (IOException e)
{
- DebugTool.logError("sendOnSystemRequestToUrl: IOException: ", e);
+ DebugTool.logError("sendSystemRequestToUrl: IOException: ", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " IOException while sending to cloud: IOException: "+ e);
- //Log.i("pt", "sendOnSystemRequestToUrl: IOException: "+ e);
+ //Log.i("pt", "sendSystemRequestToUrl: IOException: "+ e);
}
catch (Exception e)
{
- DebugTool.logError("sendOnSystemRequestToUrl: Unexpected Exception: ", e);
+ DebugTool.logError("sendSystemRequestToUrl: Unexpected Exception: ", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " Exception encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendOnSystemRequestToUrl: Unexpected Exception: " + e);
+ //Log.i("pt", "sendSystemRequestToUrl: Unexpected Exception: " + e);
}
finally
{
@@ -1137,23 +1245,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// Test correlationID
private boolean isCorrelationIDProtected(Integer correlationID) {
- if (correlationID != null &&
- (HEARTBEAT_CORRELATION_ID == correlationID
+ return correlationID != null &&
+ (HEARTBEAT_CORRELATION_ID == correlationID
|| REGISTER_APP_INTERFACE_CORRELATION_ID == correlationID
|| UNREGISTER_APP_INTERFACE_CORRELATION_ID == correlationID
- || POLICIES_CORRELATION_ID == correlationID)) {
- return true;
- }
-
- return false;
+ || POLICIES_CORRELATION_ID == correlationID);
+
}
// Protected isConnected method to allow legacy proxy to poll isConnected state
public Boolean getIsConnected() {
- if (sdlSession == null) return false;
-
- return sdlSession.getIsConnected();
+ return sdlSession != null && sdlSession.getIsConnected();
}
+
/**
* Returns whether the application is registered in SDL. Note: for testing
@@ -1172,15 +1276,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_haveReceivedFirstNonNoneHMILevel = false;
_haveReceivedFirstFocusLevel = false;
_haveReceivedFirstFocusLevelFull = false;
- if (_preRegisterd)
- _appInterfaceRegisterd = true;
- else
- _appInterfaceRegisterd = false;
+ _appInterfaceRegisterd = _preRegisterd;
_putFileListenerList.clear();
_sdlIntefaceAvailablity = SdlInterfaceAvailability.SDL_INTERFACE_UNAVAILABLE;
-
+
+ //Initialize _systemCapabilityManager here.
+ _systemCapabilityManager = new SystemCapabilityManager(_internalInterface);
// Setup SdlConnection
synchronized(CONNECTION_REFERENCE_LOCK) {
this.sdlSession = SdlSession.createSession(_wiproVersion,_interfaceBroker, _transportConfig);
@@ -1193,8 +1296,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
/**
* This method will fake the multiplex connection event
- * @param action
*/
+ @SuppressWarnings("unused")
public void forceOnConnected(){
synchronized(CONNECTION_REFERENCE_LOCK) {
if (sdlSession != null) {
@@ -1229,6 +1332,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Public method to enable the siphon transport
*/
+ @SuppressWarnings("unused")
public void enableSiphonDebug() {
short enabledPortNumber = SiphonServer.enableSiphonServer();
@@ -1244,6 +1348,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Public method to disable the Siphon Trace Server
*/
+ @SuppressWarnings("unused")
public void disableSiphonDebug() {
short disabledPortNumber = SiphonServer.disableSiphonServer();
@@ -1275,16 +1380,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Public method to determine Debug Tool enabled
*/
+ @SuppressWarnings("BooleanMethodIsAlwaysInverted")
public static boolean isDebugEnabled() {
return DebugTool.isDebugEnabled();
}
+ @SuppressWarnings("unused")
@Deprecated
public void close() throws SdlException {
dispose();
}
+ @SuppressWarnings("UnusedParameters")
private void cleanProxy(SdlDisconnectedReason disconnectedReason) throws SdlException {
try {
@@ -1298,7 +1406,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
Boolean waitForInterfaceUnregistered = false;
// Unregister app interface
synchronized(CONNECTION_REFERENCE_LOCK) {
- if (sdlSession != null && sdlSession.getIsConnected() && getAppInterfaceRegistered()) {
+ if (getIsConnected() && getAppInterfaceRegistered()) {
waitForInterfaceUnregistered = true;
unregisterAppInterfacePrivate(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
}
@@ -1320,15 +1428,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
rpcResponseListeners.clear();
}
if(rpcNotificationListeners != null){
- rpcNotificationListeners.clear(); //TODO make sure we want to clear this
+ rpcNotificationListeners.clear();
}
// Clean up SDL Connection
synchronized(CONNECTION_REFERENCE_LOCK) {
if (sdlSession != null) sdlSession.close();
}
- } catch (SdlException e) {
- throw e;
} finally {
SdlTrace.logProxyEvent("SdlProxy cleaned.", SDL_LIB_TRACE_KEY);
}
@@ -1379,15 +1485,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
rpcResponseListeners = null;
- } catch (SdlException e) {
- throw e;
} finally {
SdlTrace.logProxyEvent("SdlProxy disposed.", SDL_LIB_TRACE_KEY);
}
} // end-method
- private static Object CYCLE_LOCK = new Object();
+ private final static Object CYCLE_LOCK = new Object();
private boolean _cycling = false;
@@ -1451,7 +1555,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (message.getJsonSize() > 0) {
final Hashtable<String, Object> mhash = JsonRPCMarshaller.unmarshall(message.getData());
//hashTemp.put(Names.parameters, mhash.get(Names.parameters));
- hashTemp.put(RPCMessage.KEY_PARAMETERS, mhash);
+ if (mhash != null) {
+ hashTemp.put(RPCMessage.KEY_PARAMETERS, mhash);
+ }
}
String functionName = FunctionID.getFunctionName(message.getFunctionID());
@@ -1471,17 +1577,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (message.getBulkData() != null) hash.put(RPCStruct.KEY_BULK_DATA, message.getBulkData());
if (message.getPayloadProtected()) hash.put(RPCStruct.KEY_PROTECTED, true);
} else {
- final Hashtable<String, Object> mhash = JsonRPCMarshaller.unmarshall(message.getData());
- hash = mhash;
+ hash = JsonRPCMarshaller.unmarshall(message.getData());
}
handleRPCMessage(hash);
} catch (final Exception excp) {
DebugTool.logError("Failure handling protocol message: " + excp.toString(), excp);
passErrorToProxyListener("Error handing incoming protocol message.", excp);
} // end-catch
- } else {
- // Handle other protocol message types here
- }
+ } //else { Handle other protocol message types here}
} catch (final Exception e) {
// Pass error to application through listener
DebugTool.logError("Error handing proxy event.", e);
@@ -1499,7 +1602,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public String serializeJSON(RPCMessage msg)
{
- String sReturn = null;
+ String sReturn;
try
{
sReturn = msg.serializeJSON(getWiProVersion()).toString(2);
@@ -1532,77 +1635,88 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
void dispatchInternalMessage(final InternalProxyMessage message) {
try{
- if (message.getFunctionName().equals(InternalProxyMessage.OnProxyError)) {
- final OnError msg = (OnError)message;
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onError(msg.getInfo(), msg.getException());
- }
- });
- } else {
- _proxyListener.onError(msg.getInfo(), msg.getException());
- }
- } else if (message.getFunctionName().equals(InternalProxyMessage.OnServiceEnded)) {
- final OnServiceEnded msg = (OnServiceEnded)message;
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onServiceEnded(msg);
- }
- });
- } else {
- _proxyListener.onServiceEnded(msg);
+ switch (message.getFunctionName()) {
+ case InternalProxyMessage.OnProxyError: {
+ final OnError msg = (OnError) message;
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onError(msg.getInfo(), msg.getException());
+ }
+ });
+ } else {
+ _proxyListener.onError(msg.getInfo(), msg.getException());
+ }
+ break;
}
- } else if (message.getFunctionName().equals(InternalProxyMessage.OnServiceNACKed)) {
- final OnServiceNACKed msg = (OnServiceNACKed)message;
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onServiceNACKed(msg);
- }
- });
- } else {
- _proxyListener.onServiceNACKed(msg);
+ case InternalProxyMessage.OnServiceEnded: {
+ final OnServiceEnded msg = (OnServiceEnded) message;
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onServiceEnded(msg);
+ }
+ });
+ } else {
+ _proxyListener.onServiceEnded(msg);
+ }
+ break;
}
+ case InternalProxyMessage.OnServiceNACKed: {
+ final OnServiceNACKed msg = (OnServiceNACKed) message;
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onServiceNACKed(msg);
+ }
+ });
+ } else {
+ _proxyListener.onServiceNACKed(msg);
+ }
- /**************Start Legacy Specific Call-backs************/
- } else if (message.getFunctionName().equals(InternalProxyMessage.OnProxyOpened)) {
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- ((IProxyListener)_proxyListener).onProxyOpened();
- }
- });
- } else {
- ((IProxyListener)_proxyListener).onProxyOpened();
+ /* *************Start Legacy Specific Call-backs************/
+ break;
}
- } else if (message.getFunctionName().equals(InternalProxyMessage.OnProxyClosed)) {
- final OnProxyClosed msg = (OnProxyClosed)message;
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onProxyClosed(msg.getInfo(), msg.getException(), msg.getReason());
- }
- });
- } else {
- _proxyListener.onProxyClosed(msg.getInfo(), msg.getException(), msg.getReason());
+ case InternalProxyMessage.OnProxyOpened:
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ ((IProxyListener) _proxyListener).onProxyOpened();
+ }
+ });
+ } else {
+ ((IProxyListener) _proxyListener).onProxyOpened();
+ }
+ break;
+ case InternalProxyMessage.OnProxyClosed: {
+ final OnProxyClosed msg = (OnProxyClosed) message;
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onProxyClosed(msg.getInfo(), msg.getException(), msg.getReason());
+ }
+ });
+ } else {
+ _proxyListener.onProxyClosed(msg.getInfo(), msg.getException(), msg.getReason());
+ }
+ /* ***************End Legacy Specific Call-backs************/
+ break;
}
- /****************End Legacy Specific Call-backs************/
- } else {
- // Diagnostics
- SdlTrace.logProxyEvent("Unknown RPC Message encountered. Check for an updated version of the SDL Proxy.", SDL_LIB_TRACE_KEY);
- DebugTool.logError("Unknown RPC Message encountered. Check for an updated version of the SDL Proxy.");
+ default:
+ // Diagnostics
+ SdlTrace.logProxyEvent("Unknown RPC Message encountered. Check for an updated version of the SDL Proxy.", SDL_LIB_TRACE_KEY);
+ DebugTool.logError("Unknown RPC Message encountered. Check for an updated version of the SDL Proxy.");
+ break;
}
SdlTrace.logProxyEvent("Proxy fired callback: " + message.getFunctionName(), SDL_LIB_TRACE_KEY);
@@ -1686,10 +1800,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Only call this method for a PutFile response. It will cause a class cast exception if not.
- * @param correlationId
- * @param bytesWritten
- * @param totalSize
+ * @param correlationId correlation id of the packet being updated
+ * @param bytesWritten how many bytes were written
+ * @param totalSize the total size in bytes
*/
+ @SuppressWarnings("unused")
public void onPacketProgress(int correlationId, long bytesWritten, long totalSize){
synchronized(ON_UPDATE_LISTENER_LOCK){
if(rpcResponseListeners !=null
@@ -1703,9 +1818,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Will provide callback to the listener either onFinish or onError depending on the RPCResponses result code,
* <p>Will automatically remove the listener for the list of listeners on completion.
- * @param msg
+ * @param msg The RPCResponse message that was received
* @return if a listener was called or not
*/
+ @SuppressWarnings("UnusedReturnValue")
private boolean onRPCResponseReceived(RPCResponse msg){
synchronized(ON_UPDATE_LISTENER_LOCK){
int correlationId = msg.getCorrelationID();
@@ -1725,9 +1841,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
/**
- *
- * @param listener
- * @param correlationId
+ * Add a listener that will receive the response to the specific RPCRequest sent with the corresponding correlation id
+ * @param listener that will get called back when a response is received
+ * @param correlationId of the RPCRequest that was sent
* @param totalSize only include if this is an OnPutFileUpdateListener. Otherwise it will be ignored.
*/
public void addOnRPCResponseListener(OnRPCResponseListener listener,int correlationId, int totalSize){
@@ -1743,17 +1859,21 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
+ @SuppressWarnings("unused")
public SparseArray<OnRPCResponseListener> getResponseListeners(){
synchronized(ON_UPDATE_LISTENER_LOCK){
return this.rpcResponseListeners;
}
}
+ @SuppressWarnings("UnusedReturnValue")
public boolean onRPCNotificationReceived(RPCNotification notification){
synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- OnRPCNotificationListener listener = rpcNotificationListeners.get(FunctionID.getFunctionId(notification.getFunctionName()));
- if(listener!=null){
- listener.onNotified(notification);
+ CopyOnWriteArrayList<OnRPCNotificationListener> listeners = rpcNotificationListeners.get(FunctionID.getFunctionId(notification.getFunctionName()));
+ if(listeners!=null && listeners.size()>0) {
+ for (OnRPCNotificationListener listener : listeners) {
+ listener.onNotified(notification);
+ }
return true;
}
return false;
@@ -1763,19 +1883,44 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* This will ad a listener for the specific type of notification. As of now it will only allow
* a single listener per notification function id
- * @param notification The notification type that this listener is designated for
+ * @param notificationId The notification type that this listener is designated for
* @param listener The listener that will be called when a notification of the provided type is received
*/
- public void addOnRPCNotificationListener(FunctionID notificationId,OnRPCNotificationListener listener){
+ @SuppressWarnings("unused")
+ public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener){
synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- rpcNotificationListeners.put(notificationId.getId(), listener);
+ if(notificationId != null && listener != null){
+ if(rpcNotificationListeners.indexOfKey(notificationId.getId()) < 0 ){
+ rpcNotificationListeners.put(notificationId.getId(),new CopyOnWriteArrayList<OnRPCNotificationListener>());
+ }
+ rpcNotificationListeners.get(notificationId.getId()).add(listener);
+ }
}
}
-
+
+ /**
+ * This method is no longer valid and will not remove the listener for the supplied notificaiton id
+ * @param notificationId n/a
+ * @see #removeOnRPCNotificationListener(FunctionID, OnRPCNotificationListener)
+ */
+ @SuppressWarnings("unused")
+ @Deprecated
public void removeOnRPCNotificationListener(FunctionID notificationId){
synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- rpcNotificationListeners.delete(notificationId.getId());
+ //rpcNotificationListeners.delete(notificationId.getId());
+ }
+ }
+
+ public boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener){
+ synchronized(ON_NOTIFICATION_LISTENER_LOCK){
+ if(rpcNotificationListeners!= null
+ && notificationId != null
+ && listener != null
+ && rpcNotificationListeners.indexOfKey(notificationId.getId()) >= 0){
+ return rpcNotificationListeners.get(notificationId.getId()).remove(listener);
+ }
}
+ return false;
}
private void processRaiResponse(RegisterAppInterfaceResponse rai)
@@ -1790,7 +1935,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (_secList == null) return;
- SdlSecurityBase sec = null;
+ SdlSecurityBase sec;
Service svc = getService();
SdlSecurityBase.setAppService(svc);
@@ -1810,16 +1955,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (sec.getMakeList().contains(make))
{
setSdlSecurity(sec);
- if (sec != null)
- {
sec.setAppId(_appID);
if (sdlSession != null)
sec.handleSdlSession(sdlSession);
- }
return;
}
}
- }
+ }
}
private void handleRPCMessage(Hashtable<String, Object> hash) {
@@ -1842,6 +1984,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_appInterfaceRegisterd = true;
}
processRaiResponse(msg);
+
+ //Populate the system capability manager with the RAI response
+ _systemCapabilityManager.parseRAIResponse(msg);
Intent sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.REGISTER_APP_INTERFACE.toString());
@@ -1855,20 +2000,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
//_autoActivateIdReturned = msg.getAutoActivateID();
/*Place holder for legacy support*/ _autoActivateIdReturned = "8675309";
- _buttonCapabilities = msg.getButtonCapabilities();
- _displayCapabilities = msg.getDisplayCapabilities();
- _softButtonCapabilities = msg.getSoftButtonCapabilities();
- _presetBankCapabilities = msg.getPresetBankCapabilities();
- _hmiZoneCapabilities = msg.getHmiZoneCapabilities();
- _speechCapabilities = msg.getSpeechCapabilities();
_prerecordedSpeech = msg.getPrerecordedSpeech();
_sdlLanguage = msg.getLanguage();
_hmiDisplayLanguage = msg.getHmiDisplayLanguage();
_sdlMsgVersion = msg.getSdlMsgVersion();
- _vrCapabilities = msg.getVrCapabilities();
_vehicleType = msg.getVehicleType();
- _audioPassThruCapabilities = msg.getAudioPassThruCapabilities();
- _hmiCapabilities = msg.getHmiCapabilities();
_systemSoftwareVersion = msg.getSystemSoftwareVersion();
_proxyVersionInfo = msg.getProxyVersionInfo();
@@ -1918,8 +2054,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public void run() {
if (_proxyListener instanceof IProxyListener) {
((IProxyListener)_proxyListener).onRegisterAppInterfaceResponse(msg);
- } else if (_proxyListener instanceof IProxyListenerALM) {
- //((IProxyListenerALM)_proxyListener).onRegisterAppInterfaceResponse(msg);
}
onRPCResponseReceived(msg);
}
@@ -1927,8 +2061,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
if (_proxyListener instanceof IProxyListener) {
((IProxyListener)_proxyListener).onRegisterAppInterfaceResponse(msg);
- } else if (_proxyListener instanceof IProxyListenerALM) {
- //((IProxyListenerALM)_proxyListener).onRegisterAppInterfaceResponse(msg);
}
onRPCResponseReceived(msg);
}
@@ -2008,23 +2140,16 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_appInterfaceRegisterd = true;
}
processRaiResponse(msg);
-
+ //Populate the system capability manager with the RAI response
+ _systemCapabilityManager.parseRAIResponse(msg);
+
//_autoActivateIdReturned = msg.getAutoActivateID();
/*Place holder for legacy support*/ _autoActivateIdReturned = "8675309";
- _buttonCapabilities = msg.getButtonCapabilities();
- _displayCapabilities = msg.getDisplayCapabilities();
- _softButtonCapabilities = msg.getSoftButtonCapabilities();
- _presetBankCapabilities = msg.getPresetBankCapabilities();
- _hmiZoneCapabilities = msg.getHmiZoneCapabilities();
- _speechCapabilities = msg.getSpeechCapabilities();
_prerecordedSpeech = msg.getPrerecordedSpeech();
_sdlLanguage = msg.getLanguage();
_hmiDisplayLanguage = msg.getHmiDisplayLanguage();
_sdlMsgVersion = msg.getSdlMsgVersion();
- _vrCapabilities = msg.getVrCapabilities();
_vehicleType = msg.getVehicleType();
- _audioPassThruCapabilities = msg.getAudioPassThruCapabilities();
- _hmiCapabilities = msg.getHmiCapabilities();
_systemSoftwareVersion = msg.getSystemSoftwareVersion();
_proxyVersionInfo = msg.getProxyVersionInfo();
@@ -2069,8 +2194,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public void run() {
if (_proxyListener instanceof IProxyListener) {
((IProxyListener)_proxyListener).onRegisterAppInterfaceResponse(msg);
- } else if (_proxyListener instanceof IProxyListenerALM) {
- //((IProxyListenerALM)_proxyListener).onRegisterAppInterfaceResponse(msg);
}
onRPCResponseReceived(msg);
}
@@ -2078,8 +2201,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
if (_proxyListener instanceof IProxyListener) {
((IProxyListener)_proxyListener).onRegisterAppInterfaceResponse(msg);
- } else if (_proxyListener instanceof IProxyListenerALM) {
- //((IProxyListenerALM)_proxyListener).onRegisterAppInterfaceResponse(msg);
}
onRPCResponseReceived(msg);
}
@@ -2127,12 +2248,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onShowResponse((ShowResponse)msg);
+ _proxyListener.onShowResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onShowResponse((ShowResponse)msg);
+ _proxyListener.onShowResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.ADD_COMMAND.toString())) {
@@ -2144,12 +2265,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onAddCommandResponse((AddCommandResponse)msg);
+ _proxyListener.onAddCommandResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onAddCommandResponse((AddCommandResponse)msg);
+ _proxyListener.onAddCommandResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.DELETE_COMMAND.toString())) {
@@ -2161,12 +2282,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onDeleteCommandResponse((DeleteCommandResponse)msg);
+ _proxyListener.onDeleteCommandResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDeleteCommandResponse((DeleteCommandResponse)msg);
+ _proxyListener.onDeleteCommandResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.ADD_SUB_MENU.toString())) {
@@ -2178,12 +2299,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onAddSubMenuResponse((AddSubMenuResponse)msg);
+ _proxyListener.onAddSubMenuResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onAddSubMenuResponse((AddSubMenuResponse)msg);
+ _proxyListener.onAddSubMenuResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.DELETE_SUB_MENU.toString())) {
@@ -2195,12 +2316,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onDeleteSubMenuResponse((DeleteSubMenuResponse)msg);
+ _proxyListener.onDeleteSubMenuResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDeleteSubMenuResponse((DeleteSubMenuResponse)msg);
+ _proxyListener.onDeleteSubMenuResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SUBSCRIBE_BUTTON.toString())) {
@@ -2212,12 +2333,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onSubscribeButtonResponse((SubscribeButtonResponse)msg);
+ _proxyListener.onSubscribeButtonResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSubscribeButtonResponse((SubscribeButtonResponse)msg);
+ _proxyListener.onSubscribeButtonResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.UNSUBSCRIBE_BUTTON.toString())) {
@@ -2229,12 +2350,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onUnsubscribeButtonResponse((UnsubscribeButtonResponse)msg);
+ _proxyListener.onUnsubscribeButtonResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onUnsubscribeButtonResponse((UnsubscribeButtonResponse)msg);
+ _proxyListener.onUnsubscribeButtonResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SET_MEDIA_CLOCK_TIMER.toString())) {
@@ -2246,12 +2367,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onSetMediaClockTimerResponse((SetMediaClockTimerResponse)msg);
+ _proxyListener.onSetMediaClockTimerResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSetMediaClockTimerResponse((SetMediaClockTimerResponse)msg);
+ _proxyListener.onSetMediaClockTimerResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.ENCODED_SYNC_P_DATA.toString())) {
@@ -2289,12 +2410,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onCreateInteractionChoiceSetResponse((CreateInteractionChoiceSetResponse)msg);
+ _proxyListener.onCreateInteractionChoiceSetResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onCreateInteractionChoiceSetResponse((CreateInteractionChoiceSetResponse)msg);
+ _proxyListener.onCreateInteractionChoiceSetResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.DELETE_INTERACTION_CHOICE_SET.toString())) {
@@ -2306,12 +2427,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onDeleteInteractionChoiceSetResponse((DeleteInteractionChoiceSetResponse)msg);
+ _proxyListener.onDeleteInteractionChoiceSetResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDeleteInteractionChoiceSetResponse((DeleteInteractionChoiceSetResponse)msg);
+ _proxyListener.onDeleteInteractionChoiceSetResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.PERFORM_INTERACTION.toString())) {
@@ -2323,12 +2444,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onPerformInteractionResponse((PerformInteractionResponse)msg);
+ _proxyListener.onPerformInteractionResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onPerformInteractionResponse((PerformInteractionResponse)msg);
+ _proxyListener.onPerformInteractionResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SET_GLOBAL_PROPERTIES.toString())) {
@@ -2340,12 +2461,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onSetGlobalPropertiesResponse((SetGlobalPropertiesResponse)msg);
+ _proxyListener.onSetGlobalPropertiesResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSetGlobalPropertiesResponse((SetGlobalPropertiesResponse)msg);
+ _proxyListener.onSetGlobalPropertiesResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.RESET_GLOBAL_PROPERTIES.toString())) {
@@ -2357,12 +2478,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onResetGlobalPropertiesResponse((ResetGlobalPropertiesResponse)msg);
+ _proxyListener.onResetGlobalPropertiesResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onResetGlobalPropertiesResponse((ResetGlobalPropertiesResponse)msg);
+ _proxyListener.onResetGlobalPropertiesResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
@@ -2392,8 +2513,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public void run() {
if (_proxyListener instanceof IProxyListener) {
((IProxyListener)_proxyListener).onUnregisterAppInterfaceResponse(msg);
- } else if (_proxyListener instanceof IProxyListenerALM) {
- //((IProxyListenerALM)_proxyListener).onUnregisterAppInterfaceResponse(msg);
}
onRPCResponseReceived(msg);
}
@@ -2401,8 +2520,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
if (_proxyListener instanceof IProxyListener) {
((IProxyListener)_proxyListener).onUnregisterAppInterfaceResponse(msg);
- } else if (_proxyListener instanceof IProxyListenerALM) {
- //((IProxyListenerALM)_proxyListener).onUnregisterAppInterfaceResponse(msg);
}
onRPCResponseReceived(msg);
}
@@ -2416,12 +2533,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onGenericResponse((GenericResponse)msg);
+ _proxyListener.onGenericResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onGenericResponse((GenericResponse)msg);
+ _proxyListener.onGenericResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SLIDER.toString())) {
@@ -2432,12 +2549,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onSliderResponse((SliderResponse)msg);
+ _proxyListener.onSliderResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSliderResponse((SliderResponse)msg);
+ _proxyListener.onSliderResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.PUT_FILE.toString())) {
@@ -2448,13 +2565,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onPutFileResponse((PutFileResponse)msg);
+ _proxyListener.onPutFileResponse(msg);
onRPCResponseReceived(msg);
notifyPutFileStreamResponse(msg);
}
});
} else {
- _proxyListener.onPutFileResponse((PutFileResponse)msg);
+ _proxyListener.onPutFileResponse(msg);
onRPCResponseReceived(msg);
notifyPutFileStreamResponse(msg);
}
@@ -2466,12 +2583,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onDeleteFileResponse((DeleteFileResponse)msg);
+ _proxyListener.onDeleteFileResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDeleteFileResponse((DeleteFileResponse)msg);
+ _proxyListener.onDeleteFileResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.LIST_FILES.toString())) {
@@ -2482,12 +2599,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onListFilesResponse((ListFilesResponse)msg);
+ _proxyListener.onListFilesResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onListFilesResponse((ListFilesResponse)msg);
+ _proxyListener.onListFilesResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SET_APP_ICON.toString())) {
@@ -2498,12 +2615,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onSetAppIconResponse((SetAppIconResponse)msg);
+ _proxyListener.onSetAppIconResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSetAppIconResponse((SetAppIconResponse)msg);
+ _proxyListener.onSetAppIconResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SCROLLABLE_MESSAGE.toString())) {
@@ -2514,12 +2631,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onScrollableMessageResponse((ScrollableMessageResponse)msg);
+ _proxyListener.onScrollableMessageResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onScrollableMessageResponse((ScrollableMessageResponse)msg);
+ _proxyListener.onScrollableMessageResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.CHANGE_REGISTRATION.toString())) {
@@ -2530,12 +2647,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onChangeRegistrationResponse((ChangeRegistrationResponse)msg);
+ _proxyListener.onChangeRegistrationResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onChangeRegistrationResponse((ChangeRegistrationResponse)msg);
+ _proxyListener.onChangeRegistrationResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SET_DISPLAY_LAYOUT.toString())) {
@@ -2543,11 +2660,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
final SetDisplayLayoutResponse msg = new SetDisplayLayoutResponse(hash);
// successfully changed display layout - update layout capabilities
- if(msg.getSuccess()){
- _displayCapabilities = msg.getDisplayCapabilities();
- _buttonCapabilities = msg.getButtonCapabilities();
- _presetBankCapabilities = msg.getPresetBankCapabilities();
- _softButtonCapabilities = msg.getSoftButtonCapabilities();
+ if(msg.getSuccess() && _systemCapabilityManager!=null){
+ _systemCapabilityManager.setCapability(SystemCapabilityType.DISPLAY, msg.getDisplayCapabilities());
+ _systemCapabilityManager.setCapability(SystemCapabilityType.BUTTON, msg.getButtonCapabilities());
+ _systemCapabilityManager.setCapability(SystemCapabilityType.PRESET_BANK, msg.getPresetBankCapabilities());
+ _systemCapabilityManager.setCapability(SystemCapabilityType.SOFTBUTTON, msg.getSoftButtonCapabilities());
}
if (_callbackToUIThread) {
@@ -2555,12 +2672,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onSetDisplayLayoutResponse((SetDisplayLayoutResponse)msg);
+ _proxyListener.onSetDisplayLayoutResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSetDisplayLayoutResponse((SetDisplayLayoutResponse)msg);
+ _proxyListener.onSetDisplayLayoutResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.PERFORM_AUDIO_PASS_THRU.toString())) {
@@ -2571,12 +2688,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onPerformAudioPassThruResponse((PerformAudioPassThruResponse)msg);
+ _proxyListener.onPerformAudioPassThruResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onPerformAudioPassThruResponse((PerformAudioPassThruResponse)msg);
+ _proxyListener.onPerformAudioPassThruResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.END_AUDIO_PASS_THRU.toString())) {
@@ -2587,12 +2704,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onEndAudioPassThruResponse((EndAudioPassThruResponse)msg);
+ _proxyListener.onEndAudioPassThruResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onEndAudioPassThruResponse((EndAudioPassThruResponse)msg);
+ _proxyListener.onEndAudioPassThruResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SUBSCRIBE_VEHICLE_DATA.toString())) {
@@ -2603,12 +2720,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onSubscribeVehicleDataResponse((SubscribeVehicleDataResponse)msg);
+ _proxyListener.onSubscribeVehicleDataResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSubscribeVehicleDataResponse((SubscribeVehicleDataResponse)msg);
+ _proxyListener.onSubscribeVehicleDataResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString())) {
@@ -2619,12 +2736,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onUnsubscribeVehicleDataResponse((UnsubscribeVehicleDataResponse)msg);
+ _proxyListener.onUnsubscribeVehicleDataResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onUnsubscribeVehicleDataResponse((UnsubscribeVehicleDataResponse)msg);
+ _proxyListener.onUnsubscribeVehicleDataResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.GET_VEHICLE_DATA.toString())) {
@@ -2635,12 +2752,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onGetVehicleDataResponse((GetVehicleDataResponse)msg);
+ _proxyListener.onGetVehicleDataResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onGetVehicleDataResponse((GetVehicleDataResponse)msg);
+ _proxyListener.onGetVehicleDataResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.SUBSCRIBE_WAY_POINTS.toString())) {
@@ -2651,12 +2768,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onSubscribeWayPointsResponse((SubscribeWayPointsResponse)msg);
+ _proxyListener.onSubscribeWayPointsResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSubscribeWayPointsResponse((SubscribeWayPointsResponse)msg);
+ _proxyListener.onSubscribeWayPointsResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.UNSUBSCRIBE_WAY_POINTS.toString())) {
@@ -2667,12 +2784,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onUnsubscribeWayPointsResponse((UnsubscribeWayPointsResponse)msg);
+ _proxyListener.onUnsubscribeWayPointsResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onUnsubscribeWayPointsResponse((UnsubscribeWayPointsResponse)msg);
+ _proxyListener.onUnsubscribeWayPointsResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.GET_WAY_POINTS.toString())) {
@@ -2683,12 +2800,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onGetWayPointsResponse((GetWayPointsResponse)msg);
+ _proxyListener.onGetWayPointsResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onGetWayPointsResponse((GetWayPointsResponse)msg);
+ _proxyListener.onGetWayPointsResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.READ_DID.toString())) {
@@ -2698,12 +2815,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onReadDIDResponse((ReadDIDResponse)msg);
+ _proxyListener.onReadDIDResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onReadDIDResponse((ReadDIDResponse)msg);
+ _proxyListener.onReadDIDResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.GET_DTCS.toString())) {
@@ -2713,12 +2830,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onGetDTCsResponse((GetDTCsResponse)msg);
+ _proxyListener.onGetDTCsResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onGetDTCsResponse((GetDTCsResponse)msg);
+ _proxyListener.onGetDTCsResponse(msg);
onRPCResponseReceived(msg);
}
} else if (functionName.equals(FunctionID.DIAGNOSTIC_MESSAGE.toString())) {
@@ -2728,12 +2845,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onDiagnosticMessageResponse((DiagnosticMessageResponse)msg);
+ _proxyListener.onDiagnosticMessageResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onDiagnosticMessageResponse((DiagnosticMessageResponse)msg);
+ _proxyListener.onDiagnosticMessageResponse(msg);
onRPCResponseReceived(msg);
}
}
@@ -2745,12 +2862,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onSystemRequestResponse((SystemRequestResponse)msg);
+ _proxyListener.onSystemRequestResponse(msg);
onRPCResponseReceived(msg);
}
});
} else {
- _proxyListener.onSystemRequestResponse((SystemRequestResponse)msg);
+ _proxyListener.onSystemRequestResponse(msg);
onRPCResponseReceived(msg);
}
}
@@ -2831,13 +2948,85 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onUpdateTurnListResponse(msg);
onRPCResponseReceived(msg);
}
+ } else if (functionName.equals(FunctionID.SET_INTERIOR_VEHICLE_DATA.toString())) {
+ final SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse(hash);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onSetInteriorVehicleDataResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onSetInteriorVehicleDataResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.GET_INTERIOR_VEHICLE_DATA.toString())) {
+ final GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse(hash);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onGetInteriorVehicleDataResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onGetInteriorVehicleDataResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.GET_SYSTEM_CAPABILITY.toString())) {
+ // GetSystemCapabilityResponse
+ final GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse(hash);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onGetSystemCapabilityResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onGetSystemCapabilityResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.BUTTON_PRESS.toString())) {
+ final ButtonPressResponse msg = new ButtonPressResponse(hash);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onButtonPressResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onButtonPressResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.SEND_HAPTIC_DATA.toString())) {
+ final SendHapticDataResponse msg = new SendHapticDataResponse(hash);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onSendHapticDataResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onSendHapticDataResponse( msg);
+ onRPCResponseReceived(msg);
+ }
}
else {
if (_sdlMsgVersion != null) {
- DebugTool.logError("Unrecognized response Message: " + functionName.toString() +
- "SDL Message Version = " + _sdlMsgVersion);
+ DebugTool.logError("Unrecognized response Message: " + functionName +
+ " SDL Message Version = " + _sdlMsgVersion);
} else {
- DebugTool.logError("Unrecognized response Message: " + functionName.toString());
+ DebugTool.logError("Unrecognized response Message: " + functionName);
}
} // end-if
@@ -2854,26 +3043,27 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sdlSession.getLockScreenMan().setHMILevel(msg.getHmiLevel());
}
- msg.setFirstRun(Boolean.valueOf(firstTimeFull));
+ msg.setFirstRun(firstTimeFull);
if (msg.getHmiLevel() == HMILevel.HMI_FULL) firstTimeFull = false;
-
- if (msg.getHmiLevel() != _priorHmiLevel && msg.getAudioStreamingState() != _priorAudioStreamingState) {
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnHMIStatus((OnHMIStatus)msg);
- _proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
- onRPCNotificationReceived(msg);
+
+ _hmiLevel = msg.getHmiLevel();
+ _audioStreamingState = msg.getAudioStreamingState();
+
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onOnHMIStatus(msg);
+ _proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
+ onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnHMIStatus((OnHMIStatus)msg);
+ _proxyListener.onOnHMIStatus(msg);
_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
onRPCNotificationReceived(msg);
}
- }
} else if (functionName.equals(FunctionID.ON_COMMAND.toString())) {
// OnCommand
@@ -2883,12 +3073,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnCommand((OnCommand)msg);
+ _proxyListener.onOnCommand(msg);
onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnCommand((OnCommand)msg);
+ _proxyListener.onOnCommand(msg);
onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_DRIVER_DISTRACTION.toString())) {
@@ -2900,12 +3090,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (sdlSession != null)
{
DriverDistractionState drDist = msg.getState();
- boolean bVal = false;
- if (drDist == DriverDistractionState.DD_ON)
- bVal = true;
- else
- bVal = false;
- sdlSession.getLockScreenMan().setDriverDistStatus(bVal);
+ sdlSession.getLockScreenMan().setDriverDistStatus(drDist == DriverDistractionState.DD_ON);
}
if (_callbackToUIThread) {
@@ -3009,12 +3194,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnButtonPress((OnButtonPress)msg);
+ _proxyListener.onOnButtonPress(msg);
onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnButtonPress((OnButtonPress)msg);
+ _proxyListener.onOnButtonPress(msg);
onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_BUTTON_EVENT.toString())) {
@@ -3026,12 +3211,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnButtonEvent((OnButtonEvent)msg);
+ _proxyListener.onOnButtonEvent(msg);
onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnButtonEvent((OnButtonEvent)msg);
+ _proxyListener.onOnButtonEvent(msg);
onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_LANGUAGE_CHANGE.toString())) {
@@ -3043,12 +3228,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnLanguageChange((OnLanguageChange)msg);
+ _proxyListener.onOnLanguageChange(msg);
onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnLanguageChange((OnLanguageChange)msg);
+ _proxyListener.onOnLanguageChange(msg);
onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_HASH_CHANGE.toString())) {
@@ -3060,7 +3245,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnHashChange((OnHashChange)msg);
+ _proxyListener.onOnHashChange(msg);
onRPCNotificationReceived(msg);
if (_bAppResumeEnabled)
{
@@ -3069,7 +3254,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
});
} else {
- _proxyListener.onOnHashChange((OnHashChange)msg);
+ _proxyListener.onOnHashChange(msg);
onRPCNotificationReceived(msg);
if (_bAppResumeEnabled)
{
@@ -3105,12 +3290,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnSystemRequest((OnSystemRequest)msg);
+ _proxyListener.onOnSystemRequest(msg);
onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnSystemRequest((OnSystemRequest)msg);
+ _proxyListener.onOnSystemRequest(msg);
onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_AUDIO_PASS_THRU.toString())) {
@@ -3121,12 +3306,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnAudioPassThru((OnAudioPassThru)msg);
+ _proxyListener.onOnAudioPassThru(msg);
onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnAudioPassThru((OnAudioPassThru)msg);
+ _proxyListener.onOnAudioPassThru(msg);
onRPCNotificationReceived(msg);
}
} else if (functionName.equals(FunctionID.ON_VEHICLE_DATA.toString())) {
@@ -3137,12 +3322,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnVehicleData((OnVehicleData)msg);
+ _proxyListener.onOnVehicleData(msg);
onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnVehicleData((OnVehicleData)msg);
+ _proxyListener.onOnVehicleData(msg);
onRPCNotificationReceived(msg);
}
}
@@ -3189,12 +3374,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnKeyboardInput((OnKeyboardInput)msg);
+ _proxyListener.onOnKeyboardInput(msg);
onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnKeyboardInput((OnKeyboardInput)msg);
+ _proxyListener.onOnKeyboardInput(msg);
onRPCNotificationReceived(msg);
}
}
@@ -3205,12 +3390,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnTouchEvent((OnTouchEvent)msg);
+ _proxyListener.onOnTouchEvent(msg);
onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnTouchEvent((OnTouchEvent)msg);
+ _proxyListener.onOnTouchEvent(msg);
onRPCNotificationReceived(msg);
}
}
@@ -3221,33 +3406,171 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_mainUIHandler.post(new Runnable() {
@Override
public void run() {
- _proxyListener.onOnWayPointChange((OnWayPointChange)msg);
+ _proxyListener.onOnWayPointChange(msg);
onRPCNotificationReceived(msg);
}
});
} else {
- _proxyListener.onOnWayPointChange((OnWayPointChange)msg);
+ _proxyListener.onOnWayPointChange(msg);
+ onRPCNotificationReceived(msg);
+ }
+ }
+ else if (functionName.equals(FunctionID.ON_INTERIOR_VEHICLE_DATA.toString())) {
+ final OnInteriorVehicleData msg = new OnInteriorVehicleData(hash);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onOnInteriorVehicleData(msg);
+ onRPCNotificationReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onOnInteriorVehicleData(msg);
onRPCNotificationReceived(msg);
}
}
else {
if (_sdlMsgVersion != null) {
- DebugTool.logInfo("Unrecognized notification Message: " + functionName.toString() +
+ DebugTool.logInfo("Unrecognized notification Message: " + functionName +
" connected to SDL using message version: " + _sdlMsgVersion.getMajorVersion() + "." + _sdlMsgVersion.getMinorVersion());
} else {
- DebugTool.logInfo("Unrecognized notification Message: " + functionName.toString());
+ DebugTool.logInfo("Unrecognized notification Message: " + functionName);
}
} // end-if
} // end-if notification
SdlTrace.logProxyEvent("Proxy received RPC Message: " + functionName, SDL_LIB_TRACE_KEY);
}
+
+ /**
+ * Takes a list of RPCRequests and sends it to SDL in a synchronous fashion. Responses are captured through callback on OnMultipleRequestListener.
+ * For sending requests asynchronously, use sendRequests <br>
+ *
+ * <strong>NOTE: This will override any listeners on individual RPCs</strong>
+ *
+ * @param rpcs is the list of RPCRequests being sent
+ * @param listener listener for updates and completions
+ * @throws SdlException if an unrecoverable error is encountered
+ */
+ @SuppressWarnings("unused")
+ public void sendSequentialRequests(final List<? extends RPCRequest> rpcs, final OnMultipleRequestListener listener) throws SdlException {
+ if (_proxyDisposed) {
+ throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
+ }
+
+ SdlTrace.logProxyEvent("Application called sendSequentialRequests", SDL_LIB_TRACE_KEY);
+
+ synchronized(CONNECTION_REFERENCE_LOCK) {
+ if (!getIsConnected()) {
+ SdlTrace.logProxyEvent("Application attempted to call sendSequentialRequests without a connected transport.", SDL_LIB_TRACE_KEY);
+ throw new SdlException("There is no valid connection to SDL. sendSequentialRequests cannot be called until SDL has been connected.", SdlExceptionCause.SDL_UNAVAILABLE);
+ }
+ }
+
+ if (rpcs == null){
+ //Log error here
+ throw new SdlException("You must send some RPCs", SdlExceptionCause.INVALID_ARGUMENT);
+ }
+
+ int requestCount = rpcs.size();
+
+ // Break out of recursion, we have finished the requests
+ if (requestCount == 0) {
+ if(listener != null){
+ listener.onFinished();
+ }
+ return;
+ }
+
+ RPCRequest rpc = rpcs.remove(0);
+ rpc.setCorrelationID(CorrelationIdGenerator.generateId());
+
+ rpc.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ // success
+ if(listener!=null){
+ listener.onUpdate(rpcs.size());
+ }
+ try {
+ // recurse after successful response of RPC
+ sendSequentialRequests(rpcs, listener);
+ } catch (SdlException e) {
+ e.printStackTrace();
+ if(listener != null){
+ listener.onError(correlationId, Result.GENERIC_ERROR, e.toString());
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ if(listener != null){
+ listener.onError(correlationId, resultCode, info);
+ }
+ }
+ });
+
+ sendRPCRequestPrivate(rpc);
+ }
+
+ /**
+ * Takes a list of RPCRequests and sends it to SDL. Responses are captured through callback on OnMultipleRequestListener.
+ * For sending requests synchronously, use sendSequentialRequests <br>
+ *
+ * <strong>NOTE: This will override any listeners on individual RPCs</strong>
+ *
+ * @param rpcs is the list of RPCRequests being sent
+ * @param listener listener for updates and completions
+ * @throws SdlException if an unrecoverable error is encountered
+ */
+ @SuppressWarnings("unused")
+ public void sendRequests(List<? extends RPCRequest> rpcs, final OnMultipleRequestListener listener) throws SdlException {
+
+ if (_proxyDisposed) {
+ throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
+ }
+
+ SdlTrace.logProxyEvent("Application called sendRequests", SDL_LIB_TRACE_KEY);
+
+ synchronized(CONNECTION_REFERENCE_LOCK) {
+ if (!getIsConnected()) {
+ SdlTrace.logProxyEvent("Application attempted to call sendRequests without a connected transport.", SDL_LIB_TRACE_KEY);
+ throw new SdlException("There is no valid connection to SDL. sendRequests cannot be called until SDL has been connected.", SdlExceptionCause.SDL_UNAVAILABLE);
+ }
+ }
+
+ if (rpcs == null){
+ //Log error here
+ throw new SdlException("You must send some RPCs, the array is null", SdlExceptionCause.INVALID_ARGUMENT);
+ }
+
+ int arraySize = rpcs.size();
+
+ if (arraySize == 0) {
+ throw new SdlException("You must send some RPCs, the array is empty", SdlExceptionCause.INVALID_ARGUMENT);
+ }
+
+ for (int i = 0; i < arraySize; i++) {
+ RPCRequest rpc = rpcs.get(i);
+ rpc.setCorrelationID(CorrelationIdGenerator.generateId());
+ if(listener != null) {
+ listener.addCorrelationId(rpc.getCorrelationID());
+ rpc.setOnRPCResponseListener(listener.getSingleRpcResponseListener());
+ }
+ sendRPCRequestPrivate(rpc);
+ }
+ }
/**
* Takes an RPCRequest and sends it to SDL. Responses are captured through callback on IProxyListener.
*
- * @param request
- * @throws SdlException
+ * @param request is the RPCRequest being sent
+ * @throws SdlException if an unrecoverable error is encountered
*/
public void sendRPCRequest(RPCRequest request) throws SdlException {
if (_proxyDisposed) {
@@ -3264,7 +3587,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// Test if SdlConnection is null
synchronized(CONNECTION_REFERENCE_LOCK) {
- if (sdlSession == null || !sdlSession.getIsConnected()) {
+ if (!getIsConnected()) {
SdlTrace.logProxyEvent("Application attempted to send and RPCRequest without a connected transport.", SDL_LIB_TRACE_KEY);
throw new SdlException("There is no valid connection to SDL. sendRPCRequest cannot be called until SDL has been connected.", SdlExceptionCause.SDL_UNAVAILABLE);
}
@@ -3291,7 +3614,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
SdlTrace.logProxyEvent("Application attempted to send a RegisterAppInterface or UnregisterAppInterface while using ALM.", SDL_LIB_TRACE_KEY);
throw new SdlException("The RPCRequest, " + request.getFunctionName() +
- ", is unallowed using the Advanced Lifecycle Management Model.", SdlExceptionCause.INCORRECT_LIFECYCLE_MODEL);
+ ", is un-allowed using the Advanced Lifecycle Management Model.", SdlExceptionCause.INCORRECT_LIFECYCLE_MODEL);
}
}
@@ -3310,7 +3633,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
queueInternalMessage(message);
}
- private void startRPCProtocolSession(byte sessionID, String correlationID) {
+ private void startRPCProtocolSession() {
// Set Proxy Lifecyclek Available
if (_advancedLifecycleManagementEnabled) {
@@ -3327,7 +3650,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_hmiDisplayLanguageDesired,
_appType,
_appID,
- _autoActivateIdDesired,
REGISTER_APP_INTERFACE_CORRELATION_ID);
} catch (Exception e) {
@@ -3416,15 +3738,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
try {
StreamRPCPacketizer rpcPacketizer = new StreamRPCPacketizer((SdlProxyBase<IProxyListenerBase>) this, sdlSession, is, request, sType, rpcSessionID, wiproVersion, lSize, sdlSession);
rpcPacketizer.start();
- RPCStreamController streamController = new RPCStreamController(rpcPacketizer, request.getCorrelationID());
- return streamController;
+ return new RPCStreamController(rpcPacketizer, request.getCorrelationID());
} catch (Exception e) {
Log.e("SyncConnection", "Unable to start streaming:" + e.toString());
return null;
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"unchecked", "UnusedReturnValue"})
private RPCStreamController startRPCStream(InputStream is, PutFile request, SessionType sType, byte rpcSessionID, byte wiproVersion)
{
if (sdlSession == null) return null;
@@ -3438,8 +3759,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
try {
StreamRPCPacketizer rpcPacketizer = new StreamRPCPacketizer((SdlProxyBase<IProxyListenerBase>) this, sdlSession, is, request, sType, rpcSessionID, wiproVersion, lSize, sdlSession);
rpcPacketizer.start();
- RPCStreamController streamController = new RPCStreamController(rpcPacketizer, request.getCorrelationID());
- return streamController;
+ return new RPCStreamController(rpcPacketizer, request.getCorrelationID());
} catch (Exception e) {
Log.e("SyncConnection", "Unable to start streaming:" + e.toString());
return null;
@@ -3454,10 +3774,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private RPCStreamController startPutFileStream(InputStream is, PutFile msg) {
if (sdlSession == null) return null;
if (is == null) return null;
- startRPCStream(is, msg, SessionType.RPC, sdlSession.getSessionId(), _wiproVersion);
- return null;
+ return startRPCStream(is, msg, SessionType.RPC, sdlSession.getSessionId(), _wiproVersion);
}
+ @SuppressWarnings("UnusedReturnValue")
public boolean startRPCStream(InputStream is, RPCRequest msg) {
if (sdlSession == null) return false;
sdlSession.startRPCStream(is, msg, SessionType.RPC, sdlSession.getSessionId(), _wiproVersion);
@@ -3475,38 +3795,68 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
private class CallableMethod implements Callable<Void> {
- private long waitTime;
- public CallableMethod(int timeInMillis){
+ private final long waitTime;
+
+ public CallableMethod(int timeInMillis){
this.waitTime=timeInMillis;
- }
- @Override
- public Void call() {
- try {
- Thread.sleep(waitTime);
- } catch (InterruptedException e) {
- e.printStackTrace();
}
- return null;
- }
+ @Override
+ public Void call() {
+ try {
+ Thread.sleep(waitTime);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
}
+
public FutureTask<Void> createFutureTask(CallableMethod callMethod){
return new FutureTask<Void>(callMethod);
}
+
public ScheduledExecutorService createScheduler(){
return Executors.newSingleThreadScheduledExecutor();
- }
+ }
+
+ @SuppressWarnings("unused")
+ public void startService(SessionType serviceType, boolean isEncrypted){
+ sdlSession.startService(serviceType, sdlSession.getSessionId(), isEncrypted);
+ }
+
+ @SuppressWarnings("unused")
+ public void endService(SessionType serviceType){
+ sdlSession.endService(serviceType, sdlSession.getSessionId());
+ }
+
+
/**
+ * @deprecated
*Opens the video service (serviceType 11) and subsequently streams raw H264 video from an InputStream provided by the app
*@return true if service is opened successfully and stream is started, return false otherwise
+ * @see #startRemoteDisplayStream(Context, Class, VideoStreamingParameters, boolean) startRemoteDisplayStream
+ * @see #startVideoStream(boolean, VideoStreamingParameters) startVideoStream
+ * @see #createOpenGLInputSurface(int, int, int, int, int, boolean) createOpenGLInputSurface
*/
+ @SuppressWarnings("unused")
+ @Deprecated
public boolean startH264(InputStream is, boolean isEncrypted) {
if (sdlSession == null) return false;
navServiceStartResponseReceived = false;
navServiceStartResponse = false;
+ navServiceStartRejectedParams = null;
+
+ // When startH264() API is used, we will not send video format / width / height information
+ // with StartService. (Reasons: InputStream does not provide timestamp information so RTP
+ // cannot be used. startH264() does not provide with/height information.)
+ VideoStreamingParameters emptyParam = new VideoStreamingParameters();
+ emptyParam.setResolution(null);
+ emptyParam.setFormat(null);
+ sdlSession.setDesiredVideoParams(emptyParam);
sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
@@ -3514,10 +3864,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
+ //noinspection StatementWithEmptyBody
while (!navServiceStartResponseReceived && !fTask.isDone());
scheduler.shutdown();
- scheduler = null;
- fTask = null;
if (navServiceStartResponse) {
try {
@@ -3532,25 +3881,40 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
/**
+ * @deprecated
*Opens the video service (serviceType 11) and subsequently provides an OutputStream to the app to use for a raw H264 video stream
- *@return OutputStream if service is opened successfully and stream is started, return null otherwise
+ *@return OutputStream if service is opened successfully and stream is started, return null otherwise
+ * @see #startRemoteDisplayStream(Context, Class, VideoStreamingParameters, boolean) startRemoteDisplayStream
+ * @see #startVideoStream(boolean, VideoStreamingParameters) startVideoStream
+ * @see #createOpenGLInputSurface(int, int, int, int, int, boolean) createOpenGLInputSurface
*/
+ @SuppressWarnings("unused")
+ @Deprecated
public OutputStream startH264(boolean isEncrypted) {
if (sdlSession == null) return null;
navServiceStartResponseReceived = false;
navServiceStartResponse = false;
+ navServiceStartRejectedParams = null;
+
+ // When startH264() API is used, we will not send video format / width / height information
+ // with StartService. (Reasons: OutputStream does not provide timestamp information so RTP
+ // cannot be used. startH264() does not provide with/height information.)
+ VideoStreamingParameters emptyParam = new VideoStreamingParameters();
+ emptyParam.setResolution(null);
+ emptyParam.setFormat(null);
+ sdlSession.setDesiredVideoParams(emptyParam);
+
sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
+ //noinspection StatementWithEmptyBody
while (!navServiceStartResponseReceived && !fTask.isDone());
scheduler.shutdown();
- scheduler = null;
- fTask = null;
if (navServiceStartResponse) {
try {
@@ -3567,66 +3931,49 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*Closes the opened video service (serviceType 11)
*@return true if the video service is closed successfully, return false otherwise
*/
+ @SuppressWarnings("unused")
+ @Deprecated
public boolean endH264() {
- if (sdlSession == null) return false;
-
- navServiceEndResponseReceived = false;
- navServiceEndResponse = false;
- sdlSession.stopVideoStream();
-
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- while (!navServiceEndResponseReceived && !fTask.isDone());
- scheduler.shutdown();
- scheduler = null;
- fTask = null;
-
- if (navServiceEndResponse) {
- return true;
- } else {
- return false;
- }
+ return endVideoStream();
}
/**
*Pauses the stream for the opened audio service (serviceType 10)
*@return true if the audio service stream is paused successfully, return false otherwise
*/
- public boolean pausePCM()
- {
- if (sdlSession == null) return false;
- return sdlSession.pauseAudioStream();
+ @SuppressWarnings("unused")
+ @Deprecated
+ public boolean pausePCM() {
+ return pauseAudioStream();
}
/**
*Pauses the stream for the opened video service (serviceType 11)
*@return true if the video service stream is paused successfully, return false otherwise
*/
- public boolean pauseH264()
- {
- if (sdlSession == null) return false;
- return sdlSession.pauseVideoStream();
+ @SuppressWarnings("unused")
+ @Deprecated
+ public boolean pauseH264() {
+ return pauseVideoStream();
}
/**
*Resumes the stream for the opened audio service (serviceType 10)
*@return true if the audio service stream is resumed successfully, return false otherwise
*/
- public boolean resumePCM()
- {
- if (sdlSession == null) return false;
- return sdlSession.resumeAudioStream();
+ @SuppressWarnings("unused")
+ @Deprecated
+ public boolean resumePCM() {
+ return resumeAudioStream();
}
/**
*Resumes the stream for the opened video service (serviceType 11)
*@return true if the video service is resumed successfully, return false otherwise
*/
- public boolean resumeH264()
- {
- if (sdlSession == null) return false;
- return sdlSession.resumeVideoStream();
+ @SuppressWarnings("unused")
+ @Deprecated
+ public boolean resumeH264() {
+ return resumeVideoStream();
}
@@ -3634,6 +3981,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*Opens the audio service (serviceType 10) and subsequently streams raw PCM audio from an InputStream provided by the app
*@return true if service is opened successfully and stream is started, return false otherwise
*/
+ @SuppressWarnings("unused")
+ @Deprecated
public boolean startPCM(InputStream is, boolean isEncrypted) {
if (sdlSession == null) return false;
@@ -3645,10 +3994,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
+ //noinspection StatementWithEmptyBody
while (!pcmServiceStartResponseReceived && !fTask.isDone());
scheduler.shutdown();
- scheduler = null;
- fTask = null;
if (pcmServiceStartResponse) {
try {
@@ -3666,6 +4014,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*Opens the audio service (serviceType 10) and subsequently provides an OutputStream to the app
*@return OutputStream if service is opened successfully and stream is started, return null otherwise
*/
+ @SuppressWarnings("unused")
+ @Deprecated
public OutputStream startPCM(boolean isEncrypted) {
if (sdlSession == null) return null;
@@ -3677,10 +4027,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
+ //noinspection StatementWithEmptyBody
while (!pcmServiceStartResponseReceived && !fTask.isDone());
scheduler.shutdown();
- scheduler = null;
- fTask = null;
if (pcmServiceStartResponse) {
try {
@@ -3689,6 +4038,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
return null;
}
} else {
+ if (pcmServiceStartRejectedParams != null) {
+ StringBuilder builder = new StringBuilder();
+ for (String paramName : pcmServiceStartRejectedParams) {
+ if (builder.length() > 0) {
+ builder.append(", ");
+ }
+ builder.append(paramName);
+ }
+ DebugTool.logWarning("StartService for nav failed. Rejected params: " + builder.toString());
+
+ } else {
+ DebugTool.logWarning("StartService for nav failed (rejected params not supplied)");
+ }
return null;
}
}
@@ -3697,31 +4059,86 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*Closes the opened audio service (serviceType 10)
*@return true if the audio service is closed successfully, return false otherwise
*/
+ @SuppressWarnings("unused")
+ @Deprecated
public boolean endPCM() {
- if (sdlSession == null) return false;
- SdlConnection sdlConn = sdlSession.getSdlConnection();
- if (sdlConn == null) return false;
-
- pcmServiceEndResponseReceived = false;
- pcmServiceEndResponse = false;
- sdlSession.stopAudioStream();
-
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
+ return endAudioStream();
+ }
+
+ /**
+ * Opens a video service (service type 11) and subsequently provides an IVideoStreamListener
+ * to the app to send video data. The supplied VideoStreamingParameters will be set as desired paramaters
+ * that will be used to negotiate
+ *
+ * @param isEncrypted Specify true if packets on this service have to be encrypted
+ * @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.
+ *
+ * @return IVideoStreamListener interface if service is opened successfully and streaming is
+ * started, null otherwise
+ */
+ @SuppressWarnings("unused")
+ public IVideoStreamListener startVideoStream(boolean isEncrypted, VideoStreamingParameters parameters) {
+ if (sdlSession == null) {
+ DebugTool.logWarning("SdlSession is not created yet.");
+ return null;
+ }
+ if (sdlSession.getSdlConnection() == null) {
+ DebugTool.logWarning("SdlConnection is not available.");
+ return null;
+ }
- while (!pcmServiceEndResponseReceived && !fTask.isDone());
- scheduler.shutdown();
- scheduler = null;
- fTask = null;
+ sdlSession.setDesiredVideoParams(parameters);
+
+ VideoStreamingParameters acceptedParams = tryStartVideoStream(isEncrypted, parameters);
+ if (acceptedParams != null) {
+ return sdlSession.startVideoStream();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ *Closes the opened video service (serviceType 11)
+ *@return true if the video service is closed successfully, return false otherwise
+ */
+ @SuppressWarnings("unused")
+ public boolean endVideoStream() {
+ if (sdlSession == null){ return false; }
+
+ navServiceEndResponseReceived = false;
+ navServiceEndResponse = false;
+ sdlSession.stopVideoStream();
+
+ FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
+ ScheduledExecutorService scheduler = createScheduler();
+ scheduler.execute(fTask);
+
+ //noinspection StatementWithEmptyBody
+ while (!navServiceEndResponseReceived && !fTask.isDone());
+ scheduler.shutdown();
+
+ return navServiceEndResponse;
+ }
+
+ /**
+ *Pauses the stream for the opened video service (serviceType 11)
+ *@return true if the video service stream is paused successfully, return false otherwise
+ */
+ @SuppressWarnings("unused")
+ public boolean pauseVideoStream() {
+ return sdlSession != null && sdlSession.pauseVideoStream();
+ }
+
+ /**
+ *Resumes the stream for the opened video service (serviceType 11)
+ *@return true if the video service is resumed successfully, return false otherwise
+ */
+ @SuppressWarnings("unused")
+ public boolean resumeVideoStream() {
+ return sdlSession != null && sdlSession.resumeVideoStream();
+ }
- if (pcmServiceEndResponse) {
- return true;
- } else {
- return false;
- }
- }
-
/**
* Opens the video service (serviceType 11) and creates a Surface (used for streaming video) with input parameters provided by the app
* @param frameRate - specified rate of frames to utilize for creation of Surface
@@ -3731,38 +4148,170 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param bitrate - specified bitrate to utilize for creation of Surface
*@return Surface if service is opened successfully and stream is started, return null otherwise
*/
- public Surface createOpenGLInputSurface(int frameRate, int iFrameInterval, int width,
- int height, int bitrate, boolean isEncrypted) {
-
- if (sdlSession == null) return null;
- SdlConnection sdlConn = sdlSession.getSdlConnection();
- if (sdlConn == null) return null;
+ @SuppressWarnings("unused")
+ public Surface createOpenGLInputSurface(int frameRate, int iFrameInterval, int width,
+ int height, int bitrate, boolean isEncrypted) {
- navServiceStartResponseReceived = false;
- navServiceStartResponse = false;
- sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
-
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- while (!navServiceStartResponseReceived && !fTask.isDone());
- scheduler.shutdown();
- scheduler = null;
- fTask = null;
-
- if (navServiceStartResponse) {
+ if (sdlSession == null || sdlSession.getSdlConnection() == null){
+ return null;
+ }
+
+ VideoStreamingParameters desired = new VideoStreamingParameters();
+ desired.setFrameRate(frameRate);
+ desired.setInterval(iFrameInterval);
+ ImageResolution resolution = new ImageResolution();
+ resolution.setResolutionWidth(width);
+ resolution.setResolutionHeight(height);
+ desired.setResolution(resolution);
+ desired.setBitrate(bitrate);
+
+ VideoStreamingParameters acceptedParams = tryStartVideoStream(isEncrypted, desired);
+ if (acceptedParams != null) {
return sdlSession.createOpenGLInputSurface(frameRate, iFrameInterval, width,
- height, bitrate, SessionType.NAV, sdlSession.getSessionId());
+ height, bitrate, SessionType.NAV, sdlSession.getSessionId());
} else {
return null;
}
}
-
+
+ /**
+ * 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 remoteDisplay 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.
+ */
+ @TargetApi(19)
+ public void startRemoteDisplayStream(Context context, final Class<? extends SdlRemoteDisplay> remoteDisplay, final VideoStreamingParameters parameters, final boolean encrypted){
+ if(getWiProVersion() >= 5 && !_systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
+ Log.e(TAG, "Video streaming not supported on this module");
+ return;
+ }
+ //Create streaming manager
+ if(manager == null){
+ manager = new VideoStreamingManager(context,this._internalInterface);
+ }
+
+ if(parameters == null){
+ if(getWiProVersion() >= 5) {
+ _systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
+ @Override
+ public void onCapabilityRetrieved(Object capability) {
+ VideoStreamingParameters params = new VideoStreamingParameters();
+ params.update((VideoStreamingCapability)capability); //Streaming parameters are ready time to stream
+ sdlSession.setDesiredVideoParams(params);
+ manager.startVideoStreaming(remoteDisplay, params, encrypted);
+ }
+
+ @Override
+ public void onError(String info) {
+ Log.e(TAG, "Error retrieving video streaming capability: " + info);
+
+ }
+ });
+ }else{
+ //We just use default video streaming params
+ VideoStreamingParameters params = new VideoStreamingParameters();
+ DisplayCapabilities dispCap = (DisplayCapabilities)_systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY);
+ if(dispCap !=null){
+ params.setResolution(dispCap.getScreenParams().getImageResolution());
+ }
+ sdlSession.setDesiredVideoParams(params);
+ manager.startVideoStreaming(remoteDisplay,params, encrypted);
+ }
+ }else{
+ sdlSession.setDesiredVideoParams(parameters);
+ manager.startVideoStreaming(remoteDisplay,parameters, encrypted);
+ }
+ }
+
+ /**
+ * Stops the remote display stream if one has been started
+ */
+ public void stopRemoteDisplayStream(){
+ if(manager!=null){
+ manager.dispose();
+ }
+ manager = null;
+ }
+
+ /**
+ * Try to open a video service by using the video streaming parameters supplied.
+ *
+ * Only information from codecs, width and height are used during video format negotiation.
+ *
+ * @param isEncrypted Specify true if packets on this service have to be encrypted
+ * @param parameters VideoStreamingParameters that are desired. Does not guarantee this is what will be accepted.
+ *
+ * @return If the service is opened successfully, an instance of VideoStreamingParams is
+ * returned which contains accepted video format. If the service is opened with legacy
+ * mode (i.e. without any negotiation) then an instance of VideoStreamingParams is
+ * returned. If the service was not opened then null is returned.
+ */
+ @SuppressWarnings("unused")
+ private VideoStreamingParameters tryStartVideoStream(boolean isEncrypted, VideoStreamingParameters parameters) {
+ if (sdlSession == null) {
+ DebugTool.logWarning("SdlSession is not created yet.");
+ return null;
+ }
+ if(getWiProVersion() >= 5 && !_systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
+ DebugTool.logWarning("Module doesn't support video streaming.");
+ return null;
+ }
+ if (parameters == null) {
+ DebugTool.logWarning("Video parameters were not supplied.");
+ return null;
+ }
+
+ sdlSession.setDesiredVideoParams(parameters);
+
+ navServiceStartResponseReceived = false;
+ navServiceStartResponse = false;
+ navServiceStartRejectedParams = null;
+
+ sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
+
+ FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
+ ScheduledExecutorService scheduler = createScheduler();
+ scheduler.execute(fTask);
+
+ //noinspection StatementWithEmptyBody
+ while (!navServiceStartResponseReceived && !fTask.isDone());
+ scheduler.shutdown();
+
+ if (navServiceStartResponse) {
+ if(getWiProVersion() < 5){ //Versions 1-4 do not support streaming parameter negotiations
+ sdlSession.setAcceptedVideoParams(parameters);
+ }
+ return sdlSession.getAcceptedVideoParams();
+ }
+
+ if (navServiceStartRejectedParams != null) {
+ StringBuilder builder = new StringBuilder();
+ for (String paramName : navServiceStartRejectedParams) {
+ if (builder.length() > 0) {
+ builder.append(", ");
+ }
+ builder.append(paramName);
+ }
+
+ DebugTool.logWarning("StartService for nav failed. Rejected params: " + builder.toString());
+
+ } else {
+ DebugTool.logWarning("StartService for nav failed (rejected params not supplied)");
+ }
+
+ return null;
+ }
+
/**
*Starts the MediaCodec encoder utilized in conjunction with the Surface returned via the createOpenGLInputSurface method
*/
- public void startEncoder () {
+ @SuppressWarnings("unused")
+ public void startEncoder () {
if (sdlSession == null) return;
SdlConnection sdlConn = sdlSession.getSdlConnection();
if (sdlConn == null) return;
@@ -3773,7 +4322,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
*Releases the MediaCodec encoder utilized in conjunction with the Surface returned via the createOpenGLInputSurface method
*/
- public void releaseEncoder() {
+ @SuppressWarnings("unused")
+ public void releaseEncoder() {
if (sdlSession == null) return;
SdlConnection sdlConn = sdlSession.getSdlConnection();
if (sdlConn == null) return;
@@ -3784,22 +4334,134 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
*Releases the MediaCodec encoder utilized in conjunction with the Surface returned via the createOpenGLInputSurface method
*/
- public void drainEncoder(boolean endOfStream) {
+ @SuppressWarnings("unused")
+ public void drainEncoder(boolean endOfStream) {
if (sdlSession == null) return;
SdlConnection sdlConn = sdlSession.getSdlConnection();
if (sdlConn == null) return;
sdlSession.drainEncoder(endOfStream);
}
-
+
+ /**
+ * Opens a audio service (service type 10) and subsequently provides an IAudioStreamListener
+ * to the app to send audio data.
+ *
+ * Currently information passed by "params" are ignored, since Audio Streaming feature lacks
+ * capability negotiation mechanism. App should configure audio stream data to align with
+ * head unit's capability by checking (upcoming) pcmCapabilities. The default format is in
+ * 16kHz and 16 bits.
+ *
+ * @param isEncrypted Specify true if packets on this service have to be encrypted
+ * @param codec Audio codec which will be used for streaming. Currently, only
+ * AudioStreamingCodec.LPCM is accepted.
+ * @param params (Reserved for future use) Additional configuration information for each
+ * codec. If "codec" is AudioStreamingCodec.LPCM, "params" must be an
+ * instance of LPCMParams class.
+ *
+ * @return IAudioStreamListener interface if service is opened successfully and streaming is
+ * started, null otherwise
+ */
+ @SuppressWarnings("unused")
+ public IAudioStreamListener startAudioStream(boolean isEncrypted, AudioStreamingCodec codec,
+ AudioStreamingParams params) {
+ if (sdlSession == null) {
+ DebugTool.logWarning("SdlSession is not created yet.");
+ return null;
+ }
+ if (sdlSession.getSdlConnection() == null) {
+ DebugTool.logWarning("SdlConnection is not available.");
+ return null;
+ }
+ if (codec != AudioStreamingCodec.LPCM) {
+ DebugTool.logWarning("Audio codec " + codec + " is not supported.");
+ return null;
+ }
+
+ pcmServiceStartResponseReceived = false;
+ pcmServiceStartResponse = false;
+ sdlSession.startService(SessionType.PCM, sdlSession.getSessionId(), isEncrypted);
+
+ FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
+ ScheduledExecutorService scheduler = createScheduler();
+ scheduler.execute(fTask);
+
+ //noinspection StatementWithEmptyBody
+ while (!pcmServiceStartResponseReceived && !fTask.isDone());
+ scheduler.shutdown();
+
+ if (pcmServiceStartResponse) {
+ DebugTool.logInfo("StartService for audio succeeded");
+ return sdlSession.startAudioStream();
+ } else {
+ if (pcmServiceStartRejectedParams != null) {
+ StringBuilder builder = new StringBuilder();
+ for (String paramName : pcmServiceStartRejectedParams) {
+ if (builder.length() > 0) {
+ builder.append(", ");
+ }
+ builder.append(paramName);
+ }
+ DebugTool.logWarning("StartService for audio failed. Rejected params: " + builder.toString());
+ } else {
+ DebugTool.logWarning("StartService for audio failed (rejected params not supplied)");
+ }
+ return null;
+ }
+ }
+
+ /**
+ *Closes the opened audio service (serviceType 10)
+ *@return true if the audio service is closed successfully, return false otherwise
+ */
+ @SuppressWarnings("unused")
+ public boolean endAudioStream() {
+ if (sdlSession == null) return false;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return false;
+
+ pcmServiceEndResponseReceived = false;
+ pcmServiceEndResponse = false;
+ sdlSession.stopAudioStream();
+
+ FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
+ ScheduledExecutorService scheduler = createScheduler();
+ scheduler.execute(fTask);
+
+ //noinspection StatementWithEmptyBody
+ while (!pcmServiceEndResponseReceived && !fTask.isDone());
+ scheduler.shutdown();
+
+ return pcmServiceEndResponse;
+ }
+
+ /**
+ *Pauses the stream for the opened audio service (serviceType 10)
+ *@return true if the audio service stream is paused successfully, return false otherwise
+ */
+ @SuppressWarnings("unused")
+ public boolean pauseAudioStream() {
+ return sdlSession != null && sdlSession.pauseAudioStream();
+ }
+
+ /**
+ *Resumes the stream for the opened audio service (serviceType 10)
+ *@return true if the audio service stream is resumed successfully, return false otherwise
+ */
+ @SuppressWarnings("unused")
+ public boolean resumeAudioStream() {
+ return sdlSession != null && sdlSession.resumeAudioStream();
+ }
+
private void NavServiceStarted() {
navServiceStartResponseReceived = true;
navServiceStartResponse = true;
}
- private void NavServiceStartedNACK() {
+ private void NavServiceStartedNACK(List<String> rejectedParams) {
navServiceStartResponseReceived = true;
navServiceStartResponse = false;
+ navServiceStartRejectedParams = rejectedParams;
}
private void AudioServiceStarted() {
@@ -3811,9 +4473,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
rpcProtectedResponseReceived = true;
rpcProtectedStartResponse = true;
}
- private void AudioServiceStartedNACK() {
+ private void AudioServiceStartedNACK(List<String> rejectedParams) {
pcmServiceStartResponseReceived = true;
pcmServiceStartResponse = false;
+ pcmServiceStartRejectedParams = rejectedParams;
}
private void NavServiceEnded() {
@@ -3841,6 +4504,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_appService = mService;
}
+ @SuppressWarnings("unused")
public boolean startProtectedRPCService() {
rpcProtectedResponseReceived = false;
rpcProtectedStartResponse = false;
@@ -3850,18 +4514,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
+ //noinspection StatementWithEmptyBody
while (!rpcProtectedResponseReceived && !fTask.isDone());
scheduler.shutdown();
- scheduler = null;
- fTask = null;
- if (rpcProtectedStartResponse) {
- return true;
- } else {
- return false;
- }
- }
-
+ return rpcProtectedStartResponse;
+ }
+
+ @SuppressWarnings("unused")
public void getLockScreenIcon(final OnLockScreenIconDownloadedListener l){
if(lockScreenIconRequest == null){
l.onLockScreenIconDownloadError(new SdlException("This version of SDL core may not support lock screen icons.",
@@ -3882,7 +4542,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
- /******************** Public Helper Methods *************************/
+ /* ******************* Public Helper Methods *************************/
/*Begin V1 Enhanced helper*/
@@ -3897,15 +4557,38 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*@param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
*@param IconType -Describes whether the image is static or dynamic
*@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- *@throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void addCommand(Integer commandID,
- String menuText, Integer parentID, Integer position,
- Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
+ @SuppressWarnings("SameParameterValue")
+ public void addCommand(@NonNull Integer commandID,
+ String menuText, Integer parentID, Integer position,
+ Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
throws SdlException {
-
- AddCommand msg = RPCRequestFactory.buildAddCommand(commandID, menuText, parentID, position,
- vrCommands, IconValue, IconType, correlationID);
+
+
+ AddCommand msg = new AddCommand(commandID);
+ msg.setCorrelationID(correlationID);
+
+ if (vrCommands != null) msg.setVrCommands(vrCommands);
+
+ Image cmdIcon = null;
+
+ if (IconValue != null && IconType != null)
+ {
+ cmdIcon = new Image();
+ cmdIcon.setValue(IconValue);
+ cmdIcon.setImageType(IconType);
+ }
+
+ if (cmdIcon != null) msg.setCmdIcon(cmdIcon);
+
+ if(menuText != null || parentID != null || position != null) {
+ MenuParams menuParams = new MenuParams();
+ menuParams.setMenuName(menuText);
+ menuParams.setPosition(position);
+ menuParams.setParentID(parentID);
+ msg.setMenuParams(menuParams);
+ }
sendRPCRequest(msg);
}
@@ -3920,11 +4603,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*@param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
*@param IconType -Describes whether the image is static or dynamic
*@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- *@throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addCommand(Integer commandID,
- String menuText, Integer position,
- Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
+ String menuText, Integer position,
+ Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
throws SdlException {
addCommand(commandID, menuText, null, position, vrCommands, IconValue, IconType, correlationID);
@@ -3939,11 +4623,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*@param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
*@param IconType -Describes whether the image is static or dynamic
*@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- *@throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addCommand(Integer commandID,
- String menuText, Integer position, String IconValue, ImageType IconType,
- Integer correlationID)
+ String menuText, Integer position, String IconValue, ImageType IconType,
+ Integer correlationID)
throws SdlException {
addCommand(commandID, menuText, null, position, null, IconValue, IconType, correlationID);
@@ -3957,10 +4642,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*@param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
*@param IconType -Describes whether the image is static or dynamic
*@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- *@throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addCommand(Integer commandID,
- String menuText, String IconValue, ImageType IconType, Integer correlationID)
+ String menuText, String IconValue, ImageType IconType, Integer correlationID)
throws SdlException {
addCommand(commandID, menuText, null, null, null, IconValue, IconType, correlationID);
@@ -3975,10 +4661,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
* @param IconType -Describes whether the image is static or dynamic
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addCommand(Integer commandID,
- String menuText, Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
+ String menuText, Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
throws SdlException {
addCommand(commandID, menuText, null, null, vrCommands, IconValue, IconType, correlationID);
@@ -3992,10 +4679,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
* @param IconType -Describes whether the image is static or dynamic
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addCommand(Integer commandID,
- Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
+ Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
throws SdlException {
addCommand(commandID, null, null, null, vrCommands, IconValue, IconType, correlationID);
@@ -4012,15 +4700,24 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*@param position -Menu position for optional sub value containing menu parameters.
*@param vrCommands -VR synonyms for this AddCommand.
*@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- *@throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void addCommand(Integer commandID,
- String menuText, Integer parentID, Integer position,
- Vector<String> vrCommands, Integer correlationID)
+ @SuppressWarnings("SameParameterValue")
+ public void addCommand(@NonNull Integer commandID,
+ String menuText, Integer parentID, Integer position,
+ Vector<String> vrCommands, Integer correlationID)
throws SdlException {
-
- AddCommand msg = RPCRequestFactory.buildAddCommand(commandID, menuText, parentID, position,
- vrCommands, correlationID);
+
+ AddCommand msg = new AddCommand(commandID);
+ msg.setCorrelationID(correlationID);
+ msg.setVrCommands(vrCommands);
+ if(menuText != null || parentID != null || position != null) {
+ MenuParams menuParams = new MenuParams();
+ menuParams.setMenuName(menuText);
+ menuParams.setPosition(position);
+ menuParams.setParentID(parentID);
+ msg.setMenuParams(menuParams);
+ }
sendRPCRequest(msg);
}
@@ -4033,11 +4730,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*@param position -Menu position for optional sub value containing menu parameters.
*@param vrCommands -VR synonyms for this AddCommand.
*@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- *@throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addCommand(Integer commandID,
- String menuText, Integer position,
- Vector<String> vrCommands, Integer correlationID)
+ String menuText, Integer position,
+ Vector<String> vrCommands, Integer correlationID)
throws SdlException {
addCommand(commandID, menuText, null, position, vrCommands, correlationID);
@@ -4050,11 +4748,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*@param menuText -Menu text for optional sub value containing menu parameters.
*@param position -Menu position for optional sub value containing menu parameters.
*@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- *@throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addCommand(Integer commandID,
- String menuText, Integer position,
- Integer correlationID)
+ String menuText, Integer position,
+ Integer correlationID)
throws SdlException {
addCommand(commandID, menuText, null, position, null, correlationID);
@@ -4066,14 +4765,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*@param commandID -Unique command ID of the command to add.
*@param menuText -Menu text for optional sub value containing menu parameters.
*@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- *@throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addCommand(Integer commandID,
- String menuText, Integer correlationID)
+ String menuText, Integer correlationID)
throws SdlException {
- Vector<String> vrCommands = null;
-
- addCommand(commandID, menuText, null, null, vrCommands, correlationID);
+ addCommand(commandID, menuText, null, null, (Vector<String>)null, correlationID);
}
/**
@@ -4083,10 +4781,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*@param menuText -Menu text for optional sub value containing menu parameters.
*@param vrCommands -VR synonyms for this AddCommand.
*@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- *@throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addCommand(Integer commandID,
- String menuText, Vector<String> vrCommands, Integer correlationID)
+ String menuText, Vector<String> vrCommands, Integer correlationID)
throws SdlException {
addCommand(commandID, menuText, null, null, vrCommands, correlationID);
@@ -4098,10 +4797,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*@param commandID -Unique command ID of the command to add.
*@param vrCommands -VR synonyms for this AddCommand.
*@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- *@throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addCommand(Integer commandID,
- Vector<String> vrCommands, Integer correlationID)
+ Vector<String> vrCommands, Integer correlationID)
throws SdlException {
addCommand(commandID, null, null, null, vrCommands, correlationID);
@@ -4115,14 +4815,16 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param menuName -Text to show in the menu for this sub menu.
* @param position -Position within the items that are are at top level of the in application menu.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void addSubMenu(Integer menuID, String menuName,
- Integer position, Integer correlationID)
+ @SuppressWarnings("SameParameterValue")
+ public void addSubMenu(@NonNull Integer menuID, @NonNull String menuName,
+ Integer position, Integer correlationID)
throws SdlException {
-
- AddSubMenu msg = RPCRequestFactory.buildAddSubMenu(menuID, menuName,
- position, correlationID);
+
+ AddSubMenu msg = new AddSubMenu(menuID, menuName);
+ msg.setCorrelationID(correlationID);
+ msg.setPosition(position);
sendRPCRequest(msg);
}
@@ -4133,10 +4835,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param menuID -Unique ID of the sub menu to add.
* @param menuName -Text to show in the menu for this sub menu.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void addSubMenu(Integer menuID, String menuName,
- Integer correlationID) throws SdlException {
+ Integer correlationID) throws SdlException {
addSubMenu(menuID, menuName, null, correlationID);
}
@@ -4153,13 +4856,23 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param duration -Timeout in milliseconds.
* @param softButtons -A list of App defined SoftButtons.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("SameParameterValue")
public void alert(String ttsText, String alertText1,
- String alertText2, String alertText3, Boolean playTone, Integer duration, Vector<SoftButton> softButtons,
- Integer correlationID) throws SdlException {
-
- Alert msg = RPCRequestFactory.buildAlert(ttsText, alertText1, alertText2, alertText3, playTone, duration, softButtons, correlationID);
+ String alertText2, String alertText3, Boolean playTone, Integer duration, Vector<SoftButton> softButtons,
+ Integer correlationID) throws SdlException {
+
+ Vector<TTSChunk> chunks = TTSChunkFactory.createSimpleTTSChunks(ttsText);
+ Alert msg = new Alert();
+ msg.setCorrelationID(correlationID);
+ msg.setAlertText1(alertText1);
+ msg.setAlertText2(alertText2);
+ msg.setAlertText3(alertText3);
+ msg.setDuration(duration);
+ msg.setPlayTone(playTone);
+ msg.setTtsChunks(chunks);
+ msg.setSoftButtons(softButtons);
sendRPCRequest(msg);
}
@@ -4175,13 +4888,21 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param duration -Timeout in milliseconds.
* @param softButtons -A list of App defined SoftButtons.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
public void alert(Vector<TTSChunk> ttsChunks,
String alertText1, String alertText2, String alertText3, Boolean playTone,
Integer duration, Vector<SoftButton> softButtons, Integer correlationID) throws SdlException {
-
- Alert msg = RPCRequestFactory.buildAlert(ttsChunks, alertText1, alertText2, alertText3, playTone, duration, softButtons, correlationID);
+
+ Alert msg = new Alert();
+ msg.setCorrelationID(correlationID);
+ msg.setAlertText1(alertText1);
+ msg.setAlertText2(alertText2);
+ msg.setAlertText3(alertText3);
+ msg.setDuration(duration);
+ msg.setPlayTone(playTone);
+ msg.setTtsChunks(ttsChunks);
+ msg.setSoftButtons(softButtons);
sendRPCRequest(msg);
}
@@ -4193,10 +4914,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param playTone -Defines if tone should be played.
* @param softButtons -A list of App defined SoftButtons.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void alert(String ttsText, Boolean playTone, Vector<SoftButton> softButtons,
- Integer correlationID) throws SdlException {
+ Integer correlationID) throws SdlException {
alert(ttsText, null, null, null, playTone, null, softButtons, correlationID);
}
@@ -4208,10 +4930,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param playTone -Defines if tone should be played.
* @param softButtons -A list of App defined SoftButtons.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void alert(Vector<TTSChunk> chunks, Boolean playTone, Vector<SoftButton> softButtons,
- Integer correlationID) throws SdlException {
+ Integer correlationID) throws SdlException {
alert(chunks, null, null, null, playTone, null, softButtons, correlationID);
}
@@ -4226,10 +4949,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param duration -Timeout in milliseconds.
* @param softButtons -A list of App defined SoftButtons.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void alert(String alertText1, String alertText2, String alertText3,
- Boolean playTone, Integer duration, Vector<SoftButton> softButtons, Integer correlationID)
+ Boolean playTone, Integer duration, Vector<SoftButton> softButtons, Integer correlationID)
throws SdlException {
alert((Vector<TTSChunk>)null, alertText1, alertText2, alertText3, playTone, duration, softButtons, correlationID);
@@ -4246,14 +4970,21 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param playTone -Defines if tone should be played.
* @param duration -Timeout in milliseconds.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("SameParameterValue")
public void alert(String ttsText, String alertText1,
- String alertText2, Boolean playTone, Integer duration,
- Integer correlationID) throws SdlException {
-
- Alert msg = RPCRequestFactory.buildAlert(ttsText, alertText1, alertText2,
- playTone, duration, correlationID);
+ String alertText2, Boolean playTone, Integer duration,
+ Integer correlationID) throws SdlException {
+
+ Vector<TTSChunk> chunks = TTSChunkFactory.createSimpleTTSChunks(ttsText);
+ Alert msg = new Alert();
+ msg.setCorrelationID(correlationID);
+ msg.setAlertText1(alertText1);
+ msg.setAlertText2(alertText2);
+ msg.setDuration(duration);
+ msg.setPlayTone(playTone);
+ msg.setTtsChunks(chunks);
sendRPCRequest(msg);
}
@@ -4267,14 +4998,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param playTone -Defines if tone should be played.
* @param duration -Timeout in milliseconds.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
public void alert(Vector<TTSChunk> ttsChunks,
String alertText1, String alertText2, Boolean playTone,
Integer duration, Integer correlationID) throws SdlException {
-
- Alert msg = RPCRequestFactory.buildAlert(ttsChunks, alertText1, alertText2, playTone,
- duration, correlationID);
+
+ Alert msg = new Alert();
+ msg.setCorrelationID(correlationID);
+ msg.setAlertText1(alertText1);
+ msg.setAlertText2(alertText2);
+ msg.setDuration(duration);
+ msg.setPlayTone(playTone);
+ msg.setTtsChunks(ttsChunks);
sendRPCRequest(msg);
}
@@ -4285,10 +5021,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param ttsText -The text to speech message in the form of a string.
* @param playTone -Defines if tone should be played.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void alert(String ttsText, Boolean playTone,
- Integer correlationID) throws SdlException {
+ Integer correlationID) throws SdlException {
alert(ttsText, null, null, playTone, null, correlationID);
}
@@ -4299,10 +5036,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param chunks -A list of text/phonemes to speak in the form of ttsChunks.
* @param playTone -Defines if tone should be played.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void alert(Vector<TTSChunk> chunks, Boolean playTone,
- Integer correlationID) throws SdlException {
+ Integer correlationID) throws SdlException {
alert(chunks, null, null, playTone, null, correlationID);
}
@@ -4315,10 +5053,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param playTone -Defines if tone should be played.
* @param duration -Timeout in milliseconds.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void alert(String alertText1, String alertText2,
- Boolean playTone, Integer duration, Integer correlationID)
+ Boolean playTone, Integer duration, Integer correlationID)
throws SdlException {
alert((Vector<TTSChunk>)null, alertText1, alertText2, playTone, duration, correlationID);
@@ -4327,17 +5066,18 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Sends a CreateInteractionChoiceSet RPCRequest to SDL. Responses are captured through callback on IProxyListener.
*
- * @param choiceSet
- * @param interactionChoiceSetID
- * @param correlationID
- * @throws SdlException
+ * @param choiceSet to be sent to the module
+ * @param interactionChoiceSetID to be used in reference to the supplied choiceSet
+ * @param correlationID to be set to the RPCRequest
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void createInteractionChoiceSet(
- Vector<Choice> choiceSet, Integer interactionChoiceSetID,
+ @NonNull Vector<Choice> choiceSet, @NonNull Integer interactionChoiceSetID,
Integer correlationID) throws SdlException {
-
- CreateInteractionChoiceSet msg = RPCRequestFactory.buildCreateInteractionChoiceSet(
- choiceSet, interactionChoiceSetID, correlationID);
+
+ CreateInteractionChoiceSet msg = new CreateInteractionChoiceSet(interactionChoiceSetID, choiceSet);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4347,12 +5087,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @param commandID -ID of the command(s) to delete.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void deleteCommand(Integer commandID,
- Integer correlationID) throws SdlException {
-
- DeleteCommand msg = RPCRequestFactory.buildDeleteCommand(commandID, correlationID);
+ @SuppressWarnings("unused")
+ public void deleteCommand(@NonNull Integer commandID,
+ Integer correlationID) throws SdlException {
+
+ DeleteCommand msg = new DeleteCommand(commandID);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4362,14 +5104,15 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @param interactionChoiceSetID -ID of the interaction choice set to delete.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void deleteInteractionChoiceSet(
- Integer interactionChoiceSetID, Integer correlationID)
+ @NonNull Integer interactionChoiceSetID, Integer correlationID)
throws SdlException {
-
- DeleteInteractionChoiceSet msg = RPCRequestFactory.buildDeleteInteractionChoiceSet(
- interactionChoiceSetID, correlationID);
+
+ DeleteInteractionChoiceSet msg = new DeleteInteractionChoiceSet(interactionChoiceSetID);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4379,12 +5122,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @param menuID -The menuID of the submenu to delete.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void deleteSubMenu(Integer menuID,
- Integer correlationID) throws SdlException {
-
- DeleteSubMenu msg = RPCRequestFactory.buildDeleteSubMenu(menuID, correlationID);
+ Integer correlationID) throws SdlException {
+
+ DeleteSubMenu msg = new DeleteSubMenu(menuID);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4401,14 +5146,20 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param interactionChoiceSetID -Interaction choice set IDs to use with an interaction.
* @param vrHelp -Suggested VR Help Items to display on-screen during Perform Interaction.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void performInteraction(String initPrompt,
- String displayText, Integer interactionChoiceSetID, Vector<VrHelpItem> vrHelp,
- Integer correlationID) throws SdlException {
-
- PerformInteraction msg = RPCRequestFactory.buildPerformInteraction(initPrompt,
- displayText, interactionChoiceSetID, vrHelp, correlationID);
+ @NonNull String displayText, @NonNull Integer interactionChoiceSetID, Vector<VrHelpItem> vrHelp,
+ Integer correlationID) throws SdlException {
+
+ Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
+ interactionChoiceSetIDs.add(interactionChoiceSetID);
+ Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
+ PerformInteraction msg = new PerformInteraction(displayText, InteractionMode.BOTH, interactionChoiceSetIDs);
+ msg.setInitialPrompt(initChunks);
+ msg.setVrHelp(vrHelp);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4425,18 +5176,27 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param timeout -Timeout in milliseconds.
* @param vrHelp -Suggested VR Help Items to display on-screen during Perform Interaction.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void performInteraction(String initPrompt,
- String displayText, Integer interactionChoiceSetID,
- String helpPrompt, String timeoutPrompt,
- InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
- Integer correlationID) throws SdlException {
-
- PerformInteraction msg = RPCRequestFactory.buildPerformInteraction(
- initPrompt, displayText, interactionChoiceSetID,
- helpPrompt, timeoutPrompt, interactionMode,
- timeout, vrHelp, correlationID);
+ @NonNull String displayText, @NonNull Integer interactionChoiceSetID,
+ String helpPrompt, String timeoutPrompt,
+ @NonNull InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
+ Integer correlationID) throws SdlException {
+
+ Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
+ interactionChoiceSetIDs.add(interactionChoiceSetID);
+ Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
+ Vector<TTSChunk> helpChunks = TTSChunkFactory.createSimpleTTSChunks(helpPrompt);
+ Vector<TTSChunk> timeoutChunks = TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt);
+ PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDs);
+ msg.setInitialPrompt(initChunks);
+ msg.setTimeout(timeout);
+ msg.setHelpPrompt(helpChunks);
+ msg.setTimeoutPrompt(timeoutChunks);
+ msg.setVrHelp(vrHelp);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4453,18 +5213,25 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param timeout -Timeout in milliseconds.
* @param vrHelp -Suggested VR Help Items to display on-screen during Perform Interaction.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void performInteraction(String initPrompt,
- String displayText, Vector<Integer> interactionChoiceSetIDList,
- String helpPrompt, String timeoutPrompt,
- InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
- Integer correlationID) throws SdlException {
-
- PerformInteraction msg = RPCRequestFactory.buildPerformInteraction(initPrompt,
- displayText, interactionChoiceSetIDList,
- helpPrompt, timeoutPrompt, interactionMode, timeout, vrHelp,
- correlationID);
+ @NonNull String displayText, @NonNull Vector<Integer> interactionChoiceSetIDList,
+ String helpPrompt, String timeoutPrompt,
+ @NonNull InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
+ Integer correlationID) throws SdlException {
+
+ Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
+ Vector<TTSChunk> helpChunks = TTSChunkFactory.createSimpleTTSChunks(helpPrompt);
+ Vector<TTSChunk> timeoutChunks = TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt);
+ PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDList);
+ msg.setInitialPrompt(initChunks);
+ msg.setTimeout(timeout);
+ msg.setHelpPrompt(helpChunks);
+ msg.setTimeoutPrompt(timeoutChunks);
+ msg.setVrHelp(vrHelp);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4481,19 +5248,23 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param timeout -Timeout in milliseconds.
* @param vrHelp -Suggested VR Help Items to display on-screen during Perform Interaction.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void performInteraction(
- Vector<TTSChunk> initChunks, String displayText,
- Vector<Integer> interactionChoiceSetIDList,
+ Vector<TTSChunk> initChunks, @NonNull String displayText,
+ @NonNull Vector<Integer> interactionChoiceSetIDList,
Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks,
- InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
+ @NonNull InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
Integer correlationID) throws SdlException {
-
- PerformInteraction msg = RPCRequestFactory.buildPerformInteraction(
- initChunks, displayText, interactionChoiceSetIDList,
- helpChunks, timeoutChunks, interactionMode, timeout,vrHelp,
- correlationID);
+
+ PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDList);
+ msg.setInitialPrompt(initChunks);
+ msg.setTimeout(timeout);
+ msg.setHelpPrompt(helpChunks);
+ msg.setTimeoutPrompt(timeoutChunks);
+ msg.setVrHelp(vrHelp);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4507,14 +5278,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param displayText -Text to be displayed first.
* @param interactionChoiceSetID -Interaction choice set IDs to use with an interaction.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void performInteraction(String initPrompt,
- String displayText, Integer interactionChoiceSetID,
- Integer correlationID) throws SdlException {
-
- PerformInteraction msg = RPCRequestFactory.buildPerformInteraction(initPrompt,
- displayText, interactionChoiceSetID, correlationID);
+ @NonNull String displayText, @NonNull Integer interactionChoiceSetID,
+ Integer correlationID) throws SdlException {
+
+ Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
+ interactionChoiceSetIDs.add(interactionChoiceSetID);
+ Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
+ PerformInteraction msg = new PerformInteraction(displayText, InteractionMode.BOTH, interactionChoiceSetIDs);
+ msg.setInitialPrompt(initChunks);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4530,19 +5306,27 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param interactionMode - The method in which the user is notified and uses the interaction (Manual,VR,Both).
* @param timeout -Timeout in milliseconds.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void performInteraction(String initPrompt,
- String displayText, Integer interactionChoiceSetID,
- String helpPrompt, String timeoutPrompt,
- InteractionMode interactionMode, Integer timeout,
- Integer correlationID) throws SdlException {
-
- PerformInteraction msg = RPCRequestFactory.buildPerformInteraction(
- initPrompt, displayText, interactionChoiceSetID,
- helpPrompt, timeoutPrompt, interactionMode,
- timeout, correlationID);
-
+ @NonNull String displayText, @NonNull Integer interactionChoiceSetID,
+ String helpPrompt, String timeoutPrompt,
+ @NonNull InteractionMode interactionMode, Integer timeout,
+ Integer correlationID) throws SdlException {
+
+ Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
+ interactionChoiceSetIDs.add(interactionChoiceSetID);
+ Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
+ Vector<TTSChunk> helpChunks = TTSChunkFactory.createSimpleTTSChunks(helpPrompt);
+ Vector<TTSChunk> timeoutChunks = TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt);
+ PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDs);
+ msg.setInitialPrompt(initChunks);
+ msg.setTimeout(timeout);
+ msg.setHelpPrompt(helpChunks);
+ msg.setTimeoutPrompt(timeoutChunks);
+ msg.setCorrelationID(correlationID);
+
sendRPCRequest(msg);
}
@@ -4557,18 +5341,24 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param interactionMode - The method in which the user is notified and uses the interaction (Manual,VR,Both).
* @param timeout -Timeout in milliseconds.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void performInteraction(String initPrompt,
- String displayText, Vector<Integer> interactionChoiceSetIDList,
- String helpPrompt, String timeoutPrompt,
- InteractionMode interactionMode, Integer timeout,
- Integer correlationID) throws SdlException {
-
- PerformInteraction msg = RPCRequestFactory.buildPerformInteraction(initPrompt,
- displayText, interactionChoiceSetIDList,
- helpPrompt, timeoutPrompt, interactionMode, timeout,
- correlationID);
+ @NonNull String displayText, @NonNull Vector<Integer> interactionChoiceSetIDList,
+ String helpPrompt, String timeoutPrompt,
+ @NonNull InteractionMode interactionMode, Integer timeout,
+ Integer correlationID) throws SdlException {
+
+ Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
+ Vector<TTSChunk> helpChunks = TTSChunkFactory.createSimpleTTSChunks(helpPrompt);
+ Vector<TTSChunk> timeoutChunks = TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt);
+ PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDList);
+ msg.setInitialPrompt(initChunks);
+ msg.setTimeout(timeout);
+ msg.setHelpPrompt(helpChunks);
+ msg.setTimeoutPrompt(timeoutChunks);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4584,19 +5374,22 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param interactionMode - The method in which the user is notified and uses the interaction (Manual,VR,Both).
* @param timeout -Timeout in milliseconds.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void performInteraction(
- Vector<TTSChunk> initChunks, String displayText,
- Vector<Integer> interactionChoiceSetIDList,
+ Vector<TTSChunk> initChunks, @NonNull String displayText,
+ @NonNull Vector<Integer> interactionChoiceSetIDList,
Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks,
- InteractionMode interactionMode, Integer timeout,
+ @NonNull InteractionMode interactionMode, Integer timeout,
Integer correlationID) throws SdlException {
-
- PerformInteraction msg = RPCRequestFactory.buildPerformInteraction(
- initChunks, displayText, interactionChoiceSetIDList,
- helpChunks, timeoutChunks, interactionMode, timeout,
- correlationID);
+
+ PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDList);
+ msg.setInitialPrompt(initChunks);
+ msg.setTimeout(timeout);
+ msg.setHelpPrompt(helpChunks);
+ msg.setTimeoutPrompt(timeoutChunks);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4604,20 +5397,58 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// Protected registerAppInterface used to ensure only non-ALM applications call
// reqisterAppInterface
protected void registerAppInterfacePrivate(
- SdlMsgVersion sdlMsgVersion, String appName, Vector<TTSChunk> ttsName,
- String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, String autoActivateID, Integer correlationID)
+ @NonNull SdlMsgVersion sdlMsgVersion, @NonNull String appName, Vector<TTSChunk> ttsName,
+ String ngnMediaScreenAppName, Vector<String> vrSynonyms, @NonNull Boolean isMediaApp,
+ @NonNull Language languageDesired, @NonNull Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
+ @NonNull String appID, Integer correlationID)
throws SdlException {
String carrierName = null;
if(telephonyManager != null){
carrierName = telephonyManager.getNetworkOperatorName();
}
- deviceInfo = RPCRequestFactory.BuildDeviceInfo(carrierName);
- RegisterAppInterface msg = RPCRequestFactory.buildRegisterAppInterface(
- sdlMsgVersion, appName, ttsName, ngnMediaScreenAppName, vrSynonyms, isMediaApp,
- languageDesired, hmiDisplayLanguageDesired, appType, appID, correlationID, deviceInfo);
-
+
+ DeviceInfo deviceInfo = new DeviceInfo();
+ deviceInfo.setHardware(android.os.Build.MODEL);
+ deviceInfo.setOs(DeviceInfo.DEVICE_OS);
+ deviceInfo.setOsVersion(Build.VERSION.RELEASE);
+ deviceInfo.setCarrier(carrierName);
+
+ if (sdlMsgVersion == null) {
+ sdlMsgVersion = new SdlMsgVersion();
+ sdlMsgVersion.setMajorVersion(MAX_SUPPORTED_RPC_VERSION.getMajor());
+ sdlMsgVersion.setMinorVersion(MAX_SUPPORTED_RPC_VERSION.getMinor());
+ }
+ if (languageDesired == null) {
+ languageDesired = Language.EN_US;
+ }
+ if (hmiDisplayLanguageDesired == null) {
+ hmiDisplayLanguageDesired = Language.EN_US;
+ }
+
+ RegisterAppInterface msg = new RegisterAppInterface(sdlMsgVersion, appName, isMediaApp, languageDesired, hmiDisplayLanguageDesired, appID);
+
+ if (correlationID != null) {
+ msg.setCorrelationID(correlationID);
+ }
+
+ msg.setDeviceInfo(deviceInfo);
+
+ msg.setTtsName(ttsName);
+
+ if (ngnMediaScreenAppName == null) {
+ ngnMediaScreenAppName = appName;
+ }
+
+ msg.setNgnMediaScreenAppName(ngnMediaScreenAppName);
+
+ if (vrSynonyms == null) {
+ vrSynonyms = new Vector<String>();
+ vrSynonyms.add(appName);
+ }
+ msg.setVrSynonyms(vrSynonyms);
+
+ msg.setAppHMIType(appType);
+
if (_bAppResumeEnabled)
{
if (_lastHashID != null)
@@ -4639,19 +5470,24 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Sends a SetGlobalProperties RPCRequest to SDL. Responses are captured through callback on IProxyListener.
*
- * @param helpPrompt
- * @param timeoutPrompt
- * @param vrHelpTitle
- * @param vrHelp
- * @param correlationID
- * @throws SdlException
+ * @param helpPrompt that will be used for the VR screen
+ * @param timeoutPrompt string to be displayed after timeout
+ * @param vrHelpTitle string that may be displayed on VR prompt dialog
+ * @param vrHelp a list of VR synonyms that may be displayed to user
+ * @param correlationID to be attached to the request
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void setGlobalProperties(
String helpPrompt, String timeoutPrompt, String vrHelpTitle, Vector<VrHelpItem> vrHelp, Integer correlationID)
throws SdlException {
-
- SetGlobalProperties req = RPCRequestFactory.buildSetGlobalProperties(helpPrompt,
- timeoutPrompt, vrHelpTitle, vrHelp, correlationID);
+
+ SetGlobalProperties req = new SetGlobalProperties();
+ req.setCorrelationID(correlationID);
+ req.setHelpPrompt(TTSChunkFactory.createSimpleTTSChunks(helpPrompt));
+ req.setTimeoutPrompt(TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt));
+ req.setVrHelpTitle(vrHelpTitle);
+ req.setVrHelp(vrHelp);
sendRPCRequest(req);
}
@@ -4659,19 +5495,24 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Sends a SetGlobalProperties RPCRequest to SDL. Responses are captured through callback on IProxyListener.
*
- * @param helpChunks
- * @param timeoutChunks
- * @param vrHelpTitle
- * @param vrHelp
- * @param correlationID
- * @throws SdlException
+ * @param helpChunks tts chunks that should be used when prompting the user
+ * @param timeoutChunks tts chunks that will be used when a timeout occurs
+ * @param vrHelpTitle string that may be displayed on VR prompt dialog
+ * @param vrHelp a list of VR synonyms that may be displayed to user
+ * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void setGlobalProperties(
Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, String vrHelpTitle, Vector<VrHelpItem> vrHelp,
Integer correlationID) throws SdlException {
-
- SetGlobalProperties req = RPCRequestFactory.buildSetGlobalProperties(
- helpChunks, timeoutChunks, vrHelpTitle, vrHelp, correlationID);
+
+ SetGlobalProperties req = new SetGlobalProperties();
+ req.setCorrelationID(correlationID);
+ req.setHelpPrompt(helpChunks);
+ req.setTimeoutPrompt(timeoutChunks);
+ req.setVrHelpTitle(vrHelpTitle);
+ req.setVrHelp(vrHelp);
sendRPCRequest(req);
}
@@ -4680,42 +5521,49 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Sends a SetGlobalProperties RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param helpPrompt
- * @param timeoutPrompt
- * @param correlationID
- * @throws SdlException
+ *
+ * @param helpPrompt that will be used for the VR screen
+ * @param timeoutPrompt string to be displayed after timeout
+ * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void setGlobalProperties(
String helpPrompt, String timeoutPrompt, Integer correlationID)
throws SdlException {
-
- SetGlobalProperties req = RPCRequestFactory.buildSetGlobalProperties(helpPrompt,
- timeoutPrompt, correlationID);
+
+ SetGlobalProperties req = new SetGlobalProperties();
+ req.setCorrelationID(correlationID);
+ req.setHelpPrompt(TTSChunkFactory.createSimpleTTSChunks(helpPrompt));
+ req.setTimeoutPrompt(TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt));
sendRPCRequest(req);
}
/**
* Sends a SetGlobalProperties RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param helpChunks
- * @param timeoutChunks
- * @param correlationID
- * @throws SdlException
+ *
+ * @param helpChunks tts chunks that should be used when prompting the user
+ * @param timeoutChunks tts chunks that will be used when a timeout occurs
+ * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void setGlobalProperties(
Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks,
Integer correlationID) throws SdlException {
-
- SetGlobalProperties req = RPCRequestFactory.buildSetGlobalProperties(
- helpChunks, timeoutChunks, correlationID);
+
+ SetGlobalProperties req = new SetGlobalProperties();
+ req.setCorrelationID(correlationID);
+ req.setHelpPrompt(helpChunks);
+ req.setTimeoutPrompt(timeoutChunks);
sendRPCRequest(req);
}
+ @SuppressWarnings("unused")
public void resetGlobalProperties(Vector<GlobalProperty> properties,
- Integer correlationID) throws SdlException {
+ Integer correlationID) throws SdlException {
ResetGlobalProperties req = new ResetGlobalProperties();
@@ -4729,19 +5577,24 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Sends a SetMediaClockTimer RPCRequest to SDL. Responses are captured through callback on IProxyListener.
*
- * @param hours
- * @param minutes
- * @param seconds
- * @param updateMode
- * @param correlationID
- * @throws SdlException
+ * @param hours integer for hours
+ * @param minutes integer for minutes
+ * @param seconds integer for seconds
+ * @param updateMode mode in which the media clock timer should be updated
+ * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void setMediaClockTimer(Integer hours,
- Integer minutes, Integer seconds, UpdateMode updateMode,
- Integer correlationID) throws SdlException {
+ Integer minutes, Integer seconds, @NonNull UpdateMode updateMode,
+ Integer correlationID) throws SdlException {
- SetMediaClockTimer msg = RPCRequestFactory.buildSetMediaClockTimer(hours,
- minutes, seconds, updateMode, correlationID);
+ SetMediaClockTimer msg = new SetMediaClockTimer(updateMode);
+ if (hours != null || minutes != null || seconds != null) {
+ StartTime startTime = new StartTime(hours, minutes, seconds);
+ msg.setStartTime(startTime);
+ }
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4749,14 +5602,17 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Pauses the media clock. Responses are captured through callback on IProxyListener.
*
- * @param correlationID
- * @throws SdlException
+ * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void pauseMediaClockTimer(Integer correlationID)
+ @SuppressWarnings("unused")
+ public void pauseMediaClockTimer(Integer correlationID)
throws SdlException {
- SetMediaClockTimer msg = RPCRequestFactory.buildSetMediaClockTimer(0,
- 0, 0, UpdateMode.PAUSE, correlationID);
+ SetMediaClockTimer msg = new SetMediaClockTimer(UpdateMode.PAUSE);
+ StartTime startTime = new StartTime(0, 0, 0);
+ msg.setStartTime(startTime);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4764,14 +5620,17 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Resumes the media clock. Responses are captured through callback on IProxyListener.
*
- * @param correlationID
- * @throws SdlException
+ * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void resumeMediaClockTimer(Integer correlationID)
+ @SuppressWarnings("unused")
+ public void resumeMediaClockTimer(Integer correlationID)
throws SdlException {
- SetMediaClockTimer msg = RPCRequestFactory.buildSetMediaClockTimer(0,
- 0, 0, UpdateMode.RESUME, correlationID);
+ SetMediaClockTimer msg = new SetMediaClockTimer(UpdateMode.RESUME);
+ StartTime startTime = new StartTime(0, 0, 0);
+ msg.setStartTime(startTime);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4779,13 +5638,16 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Clears the media clock. Responses are captured through callback on IProxyListener.
*
- * @param correlationID
- * @throws SdlException
+ * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void clearMediaClockTimer(Integer correlationID)
+ @SuppressWarnings("unused")
+ public void clearMediaClockTimer(Integer correlationID)
throws SdlException {
- Show msg = RPCRequestFactory.buildShow(null, null, null, " ", null, null, correlationID);
+ Show msg = new Show();
+ msg.setCorrelationID(correlationID);
+ msg.setMediaClock(" ");
sendRPCRequest(msg);
}
@@ -4794,29 +5656,40 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Sends a Show RPCRequest to SDL. Responses are captured through callback on IProxyListener.
*
- * @param mainText1 -Text displayed in a single or upper display line.
- * @param mainText2 -Text displayed on the second display line.
- * @param mainText3 -Text displayed on the second "page" first display line.
- * @param mainText4 -Text displayed on the second "page" second display line.
- * @param statusBar
- * @param mediaClock -Text value for MediaClock field.
- * @param mediaTrack -Text displayed in the track field.
- * @param graphic -Image struct determining whether static or dynamic image to display in app.
- * @param softButtons -App defined SoftButtons.
- * @param customPresets -App labeled on-screen presets.
- * @param alignment -Specifies how mainText1 and mainText2s texts should be aligned on display.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @param mainText1 text displayed in a single or upper display line.
+ * @param mainText2 text displayed on the second display line.
+ * @param mainText3 text displayed on the second "page" first display line.
+ * @param mainText4 text displayed on the second "page" second display line.
+ * @param statusBar text is placed in the status bar area (Only valid for NAVIGATION apps)
+ * @param mediaClock text value for MediaClock field.
+ * @param mediaTrack text displayed in the track field.
+ * @param graphic image struct determining whether static or dynamic image to display in app.
+ * @param softButtons app defined SoftButtons.
+ * @param customPresets app labeled on-screen presets.
+ * @param alignment specifies how mainText1 and mainText2s texts should be aligned on display.
+ * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse -A unique ID that correlates each RPCRequest and RPCResponse.
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("SameParameterValue")
public void show(String mainText1, String mainText2, String mainText3, String mainText4,
- String statusBar, String mediaClock, String mediaTrack,
- Image graphic, Vector<SoftButton> softButtons, Vector <String> customPresets,
- TextAlignment alignment, Integer correlationID)
+ String statusBar, String mediaClock, String mediaTrack,
+ Image graphic, Vector<SoftButton> softButtons, Vector <String> customPresets,
+ TextAlignment alignment, Integer correlationID)
throws SdlException {
-
- Show msg = RPCRequestFactory.buildShow(mainText1, mainText2, mainText3, mainText4,
- statusBar, mediaClock, mediaTrack, graphic, softButtons, customPresets,
- alignment, correlationID);
+
+ Show msg = new Show();
+ msg.setCorrelationID(correlationID);
+ msg.setMainField1(mainText1);
+ msg.setMainField2(mainText2);
+ msg.setStatusBar(statusBar);
+ msg.setMediaClock(mediaClock);
+ msg.setMediaTrack(mediaTrack);
+ msg.setAlignment(alignment);
+ msg.setMainField3(mainText3);
+ msg.setMainField4(mainText4);
+ msg.setGraphic(graphic);
+ msg.setSoftButtons(softButtons);
+ msg.setCustomPresets(customPresets);
sendRPCRequest(msg);
}
@@ -4833,11 +5706,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param customPresets -App labeled on-screen presets.
* @param alignment -Specifies how mainText1 and mainText2s texts should be aligned on display.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void show(String mainText1, String mainText2, String mainText3, String mainText4,
- Image graphic, Vector<SoftButton> softButtons, Vector <String> customPresets,
- TextAlignment alignment, Integer correlationID)
+ Image graphic, Vector<SoftButton> softButtons, Vector <String> customPresets,
+ TextAlignment alignment, Integer correlationID)
throws SdlException {
show(mainText1, mainText2, mainText3, mainText4, null, null, null, graphic, softButtons, customPresets, alignment, correlationID);
@@ -4847,23 +5721,29 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
/**
* Sends a Show RPCRequest to SDL. Responses are captured through callback on IProxyListener.
*
- * @param mainText1 -Text displayed in a single or upper display line.
- * @param mainText2 -Text displayed on the second display line.
- * @param statusBar
- * @param mediaClock -Text value for MediaClock field.
- * @param mediaTrack -Text displayed in the track field.
- * @param alignment -Specifies how mainText1 and mainText2s texts should be aligned on display.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @param mainText1 text displayed in a single or upper display line.
+ * @param mainText2 text displayed on the second display line.
+ * @param statusBar text is placed in the status bar area (Only valid for NAVIGATION apps)
+ * @param mediaClock text value for MediaClock field.
+ * @param mediaTrack text displayed in the track field.
+ * @param alignment specifies how mainText1 and mainText2s texts should be aligned on display.
+ * @param correlationID unique ID that correlates each RPCRequest and RPCResponse.
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("SameParameterValue")
public void show(String mainText1, String mainText2,
- String statusBar, String mediaClock, String mediaTrack,
- TextAlignment alignment, Integer correlationID)
+ String statusBar, String mediaClock, String mediaTrack,
+ TextAlignment alignment, Integer correlationID)
throws SdlException {
-
- Show msg = RPCRequestFactory.buildShow(mainText1, mainText2,
- statusBar, mediaClock, mediaTrack,
- alignment, correlationID);
+
+ Show msg = new Show();
+ msg.setCorrelationID(correlationID);
+ msg.setMainField1(mainText1);
+ msg.setMainField2(mainText2);
+ msg.setStatusBar(statusBar);
+ msg.setMediaClock(mediaClock);
+ msg.setMediaTrack(mediaTrack);
+ msg.setAlignment(alignment);
sendRPCRequest(msg);
}
@@ -4875,10 +5755,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param mainText2 -Text displayed on the second display line.
* @param alignment -Specifies how mainText1 and mainText2s texts should be aligned on display.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void show(String mainText1, String mainText2,
- TextAlignment alignment, Integer correlationID)
+ TextAlignment alignment, Integer correlationID)
throws SdlException {
show(mainText1, mainText2, null, null, null, alignment, correlationID);
@@ -4889,13 +5770,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @param ttsText -The text to speech message in the form of a string.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void speak(String ttsText, Integer correlationID)
+ @SuppressWarnings("unused")
+ public void speak(@NonNull String ttsText, Integer correlationID)
throws SdlException {
-
- Speak msg = RPCRequestFactory.buildSpeak(TTSChunkFactory.createSimpleTTSChunks(ttsText),
- correlationID);
+
+ Speak msg = new Speak(TTSChunkFactory.createSimpleTTSChunks(ttsText));
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4905,12 +5787,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @param ttsChunks -Text/phonemes to speak in the form of ttsChunks.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void speak(Vector<TTSChunk> ttsChunks,
- Integer correlationID) throws SdlException {
+ @SuppressWarnings("unused")
+ public void speak(@NonNull Vector<TTSChunk> ttsChunks,
+ Integer correlationID) throws SdlException {
- Speak msg = RPCRequestFactory.buildSpeak(ttsChunks, correlationID);
+ Speak msg = new Speak(ttsChunks);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4920,13 +5804,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @param buttonName -Name of the button to subscribe.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void subscribeButton(ButtonName buttonName,
- Integer correlationID) throws SdlException {
+ @SuppressWarnings("unused")
+ public void subscribeButton(@NonNull ButtonName buttonName,
+ Integer correlationID) throws SdlException {
- SubscribeButton msg = RPCRequestFactory.buildSubscribeButton(buttonName,
- correlationID);
+ SubscribeButton msg = new SubscribeButton(buttonName);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4936,8 +5821,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
protected void unregisterAppInterfacePrivate(Integer correlationID)
throws SdlException {
- UnregisterAppInterface msg =
- RPCRequestFactory.buildUnregisterAppInterface(correlationID);
+ UnregisterAppInterface msg = new UnregisterAppInterface();
+ msg.setCorrelationID(correlationID);
+
Intent sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE.toString());
@@ -4954,13 +5840,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @param buttonName -Name of the button to unsubscribe.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void unsubscribeButton(ButtonName buttonName,
- Integer correlationID) throws SdlException {
+ @SuppressWarnings("unused")
+ public void unsubscribeButton(@NonNull ButtonName buttonName,
+ Integer correlationID) throws SdlException {
- UnsubscribeButton msg = RPCRequestFactory.buildUnsubscribeButton(
- buttonName, correlationID);
+ UnsubscribeButton msg = new UnsubscribeButton(buttonName);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -4973,10 +5860,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param choiceVrCommands -Vector of vrCommands used to select this choice by voice. Must contain
* at least one non-empty element.
* @return Choice created.
- * @throws SdlException
*/
+ @SuppressWarnings("unused")
public Choice createChoiceSetChoice(Integer choiceID, String choiceMenuName,
- Vector<String> choiceVrCommands) {
+ Vector<String> choiceVrCommands) {
Choice returnChoice = new Choice();
returnChoice.setChoiceID(choiceID);
@@ -4998,26 +5885,35 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param audioType -Specifies the type of audio data being requested.
* @param muteAudio -Defines if the current audio source should be muted during the APT session.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void performaudiopassthru(String initialPrompt, String audioPassThruDisplayText1, String audioPassThruDisplayText2,
- SamplingRate samplingRate, Integer maxDuration, BitsPerSample bitsPerSample,
- AudioType audioType, Boolean muteAudio, Integer correlationID) throws SdlException {
+ @NonNull SamplingRate samplingRate, @NonNull Integer maxDuration, @NonNull BitsPerSample bitsPerSample,
+ @NonNull AudioType audioType, Boolean muteAudio, Integer correlationID) throws SdlException {
+ Vector<TTSChunk> chunks = TTSChunkFactory.createSimpleTTSChunks(initialPrompt);
+ PerformAudioPassThru msg = new PerformAudioPassThru(samplingRate, maxDuration, bitsPerSample, audioType);
+ msg.setCorrelationID(correlationID);
+ msg.setInitialPrompt(chunks);
+ msg.setAudioPassThruDisplayText1(audioPassThruDisplayText1);
+ msg.setAudioPassThruDisplayText2(audioPassThruDisplayText2);
+ msg.setMuteAudio(muteAudio);
- PerformAudioPassThru msg = RPCRequestFactory.BuildPerformAudioPassThru(initialPrompt, audioPassThruDisplayText1, audioPassThruDisplayText2,
- samplingRate, maxDuration, bitsPerSample, audioType, muteAudio, correlationID);
sendRPCRequest(msg);
}
/**
* Ends audio pass thru session. Responses are captured through callback on IProxyListener.
*
- * @param correlationID
- * @throws SdlException
+ * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void endaudiopassthru(Integer correlationID) throws SdlException
+ @SuppressWarnings("unused")
+ public void endaudiopassthru(Integer correlationID) throws SdlException
{
- EndAudioPassThru msg = RPCRequestFactory.BuildEndAudioPassThru(correlationID);
+ EndAudioPassThru msg = new EndAudioPassThru();
+ msg.setCorrelationID(correlationID);
+
sendRPCRequest(msg);
}
@@ -5040,15 +5936,30 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param deviceStatus -Subscribes to device status including signal and battery strength.
* @param driverBraking -Subscribes to the status of the brake pedal.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void subscribevehicledata(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure,
+ boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure,
boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
boolean driverBraking, Integer correlationID) throws SdlException
{
- SubscribeVehicleData msg = RPCRequestFactory.BuildSubscribeVehicleData(gps, speed, rpm, fuelLevel, fuelLevel_State, instantFuelConsumption, externalTemperature, prndl, tirePressure,
- odometer, beltStatus, bodyInformation, deviceStatus, driverBraking, correlationID);
+ SubscribeVehicleData msg = new SubscribeVehicleData();
+ msg.setGps(gps);
+ msg.setSpeed(speed);
+ msg.setRpm(rpm);
+ msg.setFuelLevel(fuelLevel);
+ msg.setFuelLevel_State(fuelLevel_State);
+ msg.setInstantFuelConsumption(instantFuelConsumption);
+ msg.setExternalTemperature(externalTemperature);
+ msg.setPrndl(prndl);
+ msg.setTirePressure(tirePressure);
+ msg.setOdometer(odometer);
+ msg.setBeltStatus(beltStatus);
+ msg.setBodyInformation(bodyInformation);
+ msg.setDeviceStatus(deviceStatus);
+ msg.setDriverBraking(driverBraking);
+ msg.setCorrelationID(correlationID);
sendRPCRequest(msg);
}
@@ -5072,16 +5983,32 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param deviceStatus -Unsubscribes to device status including signal and battery strength.
* @param driverBraking -Unsubscribes to the status of the brake pedal.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void unsubscribevehicledata(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure,
- boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID) throws SdlException
+ boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure,
+ boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
+ boolean driverBraking, Integer correlationID) throws SdlException
{
- UnsubscribeVehicleData msg = RPCRequestFactory.BuildUnsubscribeVehicleData(gps, speed, rpm, fuelLevel, fuelLevel_State, instantFuelConsumption, externalTemperature, prndl, tirePressure,
- odometer, beltStatus, bodyInformation, deviceStatus, driverBraking, correlationID);
+ UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
+ msg.setGps(gps);
+ msg.setSpeed(speed);
+ msg.setRpm(rpm);
+ msg.setFuelLevel(fuelLevel);
+ msg.setFuelLevel_State(fuelLevel_State);
+ msg.setInstantFuelConsumption(instantFuelConsumption);
+ msg.setExternalTemperature(externalTemperature);
+ msg.setPrndl(prndl);
+ msg.setTirePressure(tirePressure);
+ msg.setOdometer(odometer);
+ msg.setBeltStatus(beltStatus);
+ msg.setBodyInformation(bodyInformation);
+ msg.setDeviceStatus(deviceStatus);
+ msg.setDriverBraking(driverBraking);
+ msg.setCorrelationID(correlationID);
+
sendRPCRequest(msg);
}
@@ -5106,16 +6033,32 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param deviceStatus -Performs an ad-hoc request for device status including signal and battery strength.
* @param driverBraking -Performs an ad-hoc request for the status of the brake pedal.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void getvehicledata(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean vin, boolean prndl, boolean tirePressure,
- boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID) throws SdlException
+ boolean instantFuelConsumption, boolean externalTemperature, boolean vin, boolean prndl, boolean tirePressure,
+ boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
+ boolean driverBraking, Integer correlationID) throws SdlException
{
-
- GetVehicleData msg = RPCRequestFactory.BuildGetVehicleData(gps, speed, rpm, fuelLevel, fuelLevel_State, instantFuelConsumption, externalTemperature, vin, prndl, tirePressure, odometer,
- beltStatus, bodyInformation, deviceStatus, driverBraking, correlationID);
+ GetVehicleData msg = new GetVehicleData();
+ msg.setGps(gps);
+ msg.setSpeed(speed);
+ msg.setRpm(rpm);
+ msg.setFuelLevel(fuelLevel);
+ msg.setFuelLevel_State(fuelLevel_State);
+ msg.setInstantFuelConsumption(instantFuelConsumption);
+ msg.setExternalTemperature(externalTemperature);
+ msg.setVin(vin);
+ msg.setPrndl(prndl);
+ msg.setTirePressure(tirePressure);
+ msg.setOdometer(odometer);
+ msg.setBeltStatus(beltStatus);
+ msg.setBodyInformation(bodyInformation);
+ msg.setDeviceStatus(deviceStatus);
+ msg.setDriverBraking(driverBraking);
+ msg.setCorrelationID(correlationID);
+
sendRPCRequest(msg);
}
@@ -5128,11 +6071,16 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param timeout -App defined timeout. Indicates how long of a timeout from the last action.
* @param softButtons -App defined SoftButtons.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void scrollablemessage(String scrollableMessageBody, Integer timeout, Vector<SoftButton> softButtons, Integer correlationID) throws SdlException
+ @SuppressWarnings("unused")
+ public void scrollablemessage(@NonNull String scrollableMessageBody, Integer timeout, Vector<SoftButton> softButtons, Integer correlationID) throws SdlException
{
- ScrollableMessage msg = RPCRequestFactory.BuildScrollableMessage(scrollableMessageBody, timeout, softButtons, correlationID);
+ ScrollableMessage msg = new ScrollableMessage(scrollableMessageBody);
+ msg.setCorrelationID(correlationID);
+ msg.setTimeout(timeout);
+ msg.setSoftButtons(softButtons);
+
sendRPCRequest(msg);
}
@@ -5147,25 +6095,33 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param sliderFooter - Text footer to display (meant to display min/max threshold descriptors).
* @param timeout -App defined timeout. Indicates how long of a timeout from the last action.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void slider(Integer numTicks, Integer position, String sliderHeader, Vector<String> sliderFooter, Integer timeout, Integer correlationID) throws SdlException
+ @SuppressWarnings("unused")
+ public void slider(@NonNull Integer numTicks, @NonNull Integer position, @NonNull String sliderHeader, Vector<String> sliderFooter, Integer timeout, Integer correlationID) throws SdlException
{
- Slider msg = RPCRequestFactory.BuildSlider(numTicks, position, sliderHeader, sliderFooter, timeout, correlationID);
+ Slider msg = new Slider(numTicks, position, sliderHeader);
+ msg.setCorrelationID(correlationID);
+ msg.setSliderFooter(sliderFooter);
+ msg.setTimeout(timeout);
+
sendRPCRequest(msg);
}
/**
* Responses are captured through callback on IProxyListener.
*
- * @param language
- * @param hmiDisplayLanguage
- * @param correlationID
- * @throws SdlException
+ * @param language requested SDL voice engine (VR+TTS) language registration
+ * @param hmiDisplayLanguage request display language registration.
+ * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void changeregistration(Language language, Language hmiDisplayLanguage, Integer correlationID) throws SdlException
+ @SuppressWarnings("unused")
+ public void changeregistration(@NonNull Language language, @NonNull Language hmiDisplayLanguage, Integer correlationID) throws SdlException
{
- ChangeRegistration msg = RPCRequestFactory.BuildChangeRegistration(language, hmiDisplayLanguage, correlationID);
+ ChangeRegistration msg = new ChangeRegistration(language, hmiDisplayLanguage);
+ msg.setCorrelationID(correlationID);
+
sendRPCRequest(msg);
}
@@ -5178,13 +6134,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of the file.
* A value greater than zero is used for resuming partial data chunks.
* @param iLength - The total length of the file being sent.
- * @throws SdlException
- * @see {@link#putFileStream(InputStream, String, Long, Long)}
+ * @throws SdlException if an unrecoverable error is encountered
+ * @see #putFileStream(InputStream, String, Long, Long)
*/
+ @SuppressWarnings("unused")
@Deprecated
- public void putFileStream(InputStream is, String sdlFileName, Integer iOffset, Integer iLength) throws SdlException
+ public void putFileStream(InputStream is, @NonNull String sdlFileName, Integer iOffset, Integer iLength) throws SdlException
{
- PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength);
+ PutFile msg = new PutFile(sdlFileName, FileType.BINARY);
+ msg.setCorrelationID(10000);
+ msg.setSystemFile(true);
+ msg.setOffset(iOffset);
+ msg.setLength(iLength);
+
startRPCStream(is, msg);
}
@@ -5198,10 +6160,16 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* indicate data starting from the beginning of the file and a value greater
* than zero is used for resuming partial data chunks.
* @param length The total length of the file being sent.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void putFileStream(InputStream inputStream, String fileName, Long offset, Long length) throws SdlException {
- PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length);
+ @SuppressWarnings("unused")
+ public void putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length) throws SdlException {
+ PutFile msg = new PutFile(fileName, FileType.BINARY);
+ msg.setCorrelationID(10000);
+ msg.setSystemFile(true);
+ msg.setOffset(offset);
+ msg.setLength(length);
+
startRPCStream(inputStream, msg);
}
@@ -5215,13 +6183,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param iLength - The total length of the file being sent.
*
* @return OutputStream - The output stream of byte data that is written to by the app developer
- * @throws SdlException
- * @see {@link#putFileStream(String, Long, Long)}
+ * @throws SdlException if an unrecoverable error is encountered
+ * @see #putFileStream(String, Long, Long)
*/
+ @SuppressWarnings("unused")
@Deprecated
- public OutputStream putFileStream(String sdlFileName, Integer iOffset, Integer iLength) throws SdlException
+ public OutputStream putFileStream(@NonNull String sdlFileName, Integer iOffset, Integer iLength) throws SdlException
{
- PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength);
+ PutFile msg = new PutFile(sdlFileName, FileType.BINARY);
+ msg.setCorrelationID(10000);
+ msg.setSystemFile(true);
+ msg.setOffset(iOffset);
+ msg.setLength(iLength);
+
return startRPCStream(msg);
}
@@ -5234,10 +6208,16 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* indicate data starting from the beginning of the file and a value greater
* than zero is used for resuming partial data chunks.
* @param length The total length of the file being sent.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public OutputStream putFileStream(String fileName, Long offset, Long length) throws SdlException {
- PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length);
+ @SuppressWarnings("unused")
+ public OutputStream putFileStream(@NonNull String fileName, Long offset, Long length) throws SdlException {
+ PutFile msg = new PutFile(fileName, FileType.BINARY);
+ msg.setCorrelationID(10000);
+ msg.setSystemFile(true);
+ msg.setOffset(offset);
+ msg.setLength(length);
+
return startRPCStream(msg);
}
@@ -5253,13 +6233,20 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param fileType - The selected file type -- see the FileType enumeration for details
* @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
* @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
- * @throws SdlException
- * @see {@link#putFileStream(InputStream, String, Long, Long, FileType, Boolean, Boolean)}
+ * @throws SdlException if an unrecoverable error is encountered
+ * @see #putFileStream(InputStream, String, Long, Long, FileType, Boolean, Boolean, OnPutFileUpdateListener)
*/
+ @SuppressWarnings("unused")
@Deprecated
- public void putFileStream(InputStream is, String sdlFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
+ public void putFileStream(InputStream is, @NonNull String sdlFileName, Integer iOffset, Integer iLength, @NonNull FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
{
- PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength, fileType, bPersistentFile, bSystemFile);
+ PutFile msg = new PutFile(sdlFileName, fileType);
+ msg.setCorrelationID(10000);
+ msg.setPersistentFile(bPersistentFile);
+ msg.setSystemFile(bSystemFile);
+ msg.setOffset(iOffset);
+ msg.setLength(iLength);
+
startRPCStream(is, msg);
}
@@ -5279,10 +6266,15 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* sessions / ignition cycles.
* @param isSystemFile Indicates if the file is meant to be passed through
* core to elsewhere in the system.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void putFileStream(InputStream inputStream, String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
- PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length);
+ @SuppressWarnings("unused")
+ public void putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
+ PutFile msg = new PutFile(fileName, FileType.BINARY);
+ msg.setCorrelationID(10000);
+ msg.setSystemFile(true);
+ msg.setOffset(offset);
+ msg.setLength(length);
msg.setOnPutFileUpdateListener(cb);
startRPCStream(inputStream, msg);
}
@@ -5299,13 +6291,20 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
* @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
* @return OutputStream - The output stream of byte data that is written to by the app developer
- * @throws SdlException
- * @see {@link#putFileStream(String, Long, Long, FileType, Boolean, Boolean)}
+ * @throws SdlException if an unrecoverable error is encountered
+ * @see #putFileStream(String, Long, Long, FileType, Boolean, Boolean, OnPutFileUpdateListener)
*/
+ @SuppressWarnings("unused")
@Deprecated
- public OutputStream putFileStream(String sdlFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
+ public OutputStream putFileStream(@NonNull String sdlFileName, Integer iOffset, Integer iLength, @NonNull FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
{
- PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength, fileType, bPersistentFile, bSystemFile);
+ PutFile msg = new PutFile(sdlFileName, fileType);
+ msg.setCorrelationID(10000);
+ msg.setPersistentFile(bPersistentFile);
+ msg.setSystemFile(bSystemFile);
+ msg.setOffset(iOffset);
+ msg.setLength(iLength);
+
return startRPCStream(msg);
}
@@ -5324,11 +6323,17 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* sessions / ignition cycles.
* @param isSystemFile Indicates if the file is meant to be passed through
* core to elsewhere in the system.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public OutputStream putFileStream(String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
- PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length);
+ @SuppressWarnings("unused")
+ public OutputStream putFileStream(@NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
+ PutFile msg = new PutFile(fileName, FileType.BINARY);
+ msg.setCorrelationID(10000);
+ msg.setSystemFile(true);
+ msg.setOffset(offset);
+ msg.setLength(length);
msg.setOnPutFileUpdateListener(cb);
+
return startRPCStream(msg);
}
@@ -5343,15 +6348,22 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param fileType - The selected file type -- see the FileType enumeration for details
* @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
* @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
- * @param correlationID - A unique ID that correlates each RPCRequest and RPCResponse.
+ * @param iCorrelationID - A unique ID that correlates each RPCRequest and RPCResponse.
* @return RPCStreamController - If the putFileStream was not started successfully null is returned, otherwise a valid object reference is returned
- * @throws SdlException
- * @see {@link#putFileStream(String, String, Long, FileType, Boolean, Boolean, Integer)}
+ * @throws SdlException if an unrecoverable error is encountered
+ * @see #putFileStream(String, String, Long, FileType, Boolean, Boolean, Boolean, Integer, OnPutFileUpdateListener)
*/
+ @SuppressWarnings("unused")
@Deprecated
- public RPCStreamController putFileStream(String sPath, String sdlFileName, Integer iOffset, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) throws SdlException
+ public RPCStreamController putFileStream(String sPath, @NonNull String sdlFileName, Integer iOffset, @NonNull FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) throws SdlException
{
- PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, 0, fileType, bPersistentFile, bSystemFile, iCorrelationID);
+ PutFile msg = new PutFile(sdlFileName, fileType);
+ msg.setCorrelationID(iCorrelationID);
+ msg.setPersistentFile(bPersistentFile);
+ msg.setSystemFile(bSystemFile);
+ msg.setOffset(iOffset);
+ msg.setLength(0);
+
return startPutFileStream(sPath, msg);
}
@@ -5375,11 +6387,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @return RPCStreamController If the putFileStream was not started
* successfully null is returned, otherwise a valid object reference is
* returned .
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public RPCStreamController putFileStream(String path, String fileName, Long offset, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId, OnPutFileUpdateListener cb ) throws SdlException {
- PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, 0L, fileType, isPersistentFile, isSystemFile, isPayloadProtected, correlationId);
+ @SuppressWarnings("unused")
+ public RPCStreamController putFileStream(String path, @NonNull String fileName, Long offset, @NonNull FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId, OnPutFileUpdateListener cb ) throws SdlException {
+ PutFile msg = new PutFile(fileName, fileType);
+ msg.setCorrelationID(correlationId);
+ msg.setPersistentFile(isPersistentFile);
+ msg.setSystemFile(isSystemFile);
+ msg.setOffset(offset);
+ msg.setLength(0L);
+ msg.setPayloadProtected(isPayloadProtected);
msg.setOnPutFileUpdateListener(cb);
+
return startPutFileStream(path,msg);
}
@@ -5394,15 +6414,22 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param fileType - The selected file type -- see the FileType enumeration for details
* @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
* @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
- * @param correlationID - A unique ID that correlates each RPCRequest and RPCResponse.
+ * @param iCorrelationID - A unique ID that correlates each RPCRequest and RPCResponse.
* @return RPCStreamController - If the putFileStream was not started successfully null is returned, otherwise a valid object reference is returned
- * @throws SdlException
- * @see {@link#putFileStream(InputStream, String, Long, Long, FileType, Boolean, Boolean, Integer)}
+ * @throws SdlException if an unrecoverable error is encountered
+ * @see #putFileStream(InputStream, String, Long, Long, FileType, Boolean, Boolean, Boolean, Integer)
*/
+ @SuppressWarnings("unused")
@Deprecated
- public RPCStreamController putFileStream(InputStream is, String sdlFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) throws SdlException
+ public RPCStreamController putFileStream(InputStream is, @NonNull String sdlFileName, Integer iOffset, Integer iLength, @NonNull FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) throws SdlException
{
- PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength, fileType, bPersistentFile, bSystemFile, iCorrelationID);
+ PutFile msg = new PutFile(sdlFileName, fileType);
+ msg.setCorrelationID(iCorrelationID);
+ msg.setPersistentFile(bPersistentFile);
+ msg.setSystemFile(bSystemFile);
+ msg.setOffset(iOffset);
+ msg.setLength(iLength);
+
return startPutFileStream(is, msg);
}
@@ -5424,10 +6451,18 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* core to elsewhere in the system.
* @param correlationId A unique id that correlates each RPCRequest and
* RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public RPCStreamController putFileStream(InputStream inputStream, String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId) throws SdlException {
- PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length, fileType, isPersistentFile, isSystemFile, isPayloadProtected, correlationId);
+ @SuppressWarnings("unused")
+ public RPCStreamController putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length, @NonNull FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId) throws SdlException {
+ PutFile msg = new PutFile(fileName, fileType);
+ msg.setCorrelationID(correlationId);
+ msg.setPersistentFile(isPersistentFile);
+ msg.setSystemFile(isSystemFile);
+ msg.setOffset(offset);
+ msg.setLength(length);
+ msg.setPayloadProtected(isPayloadProtected);
+
return startPutFileStream(inputStream, msg);
}
@@ -5436,6 +6471,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* Used to end an existing putFileStream that was previously initiated with any putFileStream method.
*
*/
+ @SuppressWarnings("unused")
public void endPutFileStream()
{
endRPCStream();
@@ -5449,13 +6485,18 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param sdlFileName -File reference name.
* @param fileType -Selected file type.
* @param persistentFile -Indicates if the file is meant to persist between sessions / ignition cycles.
- * @param fileData
+ * @param fileData byte array of data of the file that is to be sent
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void putfile(String sdlFileName, FileType fileType, Boolean persistentFile, byte[] fileData, Integer correlationID) throws SdlException
+ @SuppressWarnings("unused")
+ public void putfile(@NonNull String sdlFileName, @NonNull FileType fileType, Boolean persistentFile, byte[] fileData, Integer correlationID) throws SdlException
{
- PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, fileType, persistentFile, fileData, correlationID);
+ PutFile msg = new PutFile(sdlFileName, fileType);
+ msg.setCorrelationID(correlationID);
+ msg.setPersistentFile(persistentFile);
+ msg.setBulkData(fileData);
+
sendRPCRequest(msg);
}
@@ -5465,11 +6506,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @param sdlFileName -File reference name.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void deletefile(String sdlFileName, Integer correlationID) throws SdlException
+ @SuppressWarnings("unused")
+ public void deletefile(@NonNull String sdlFileName, Integer correlationID) throws SdlException
{
- DeleteFile msg = RPCRequestFactory.buildDeleteFile(sdlFileName, correlationID);
+ DeleteFile msg = new DeleteFile(sdlFileName);
+ msg.setCorrelationID(correlationID);
+
sendRPCRequest(msg);
}
@@ -5478,11 +6522,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* Responses are captured through callback on IProxyListener.
*
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
+ @SuppressWarnings("unused")
public void listfiles(Integer correlationID) throws SdlException
{
- ListFiles msg = RPCRequestFactory.buildListFiles(correlationID);
+ ListFiles msg = new ListFiles();
+ msg.setCorrelationID(correlationID);
+
sendRPCRequest(msg);
}
@@ -5492,11 +6539,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @param sdlFileName -File reference name.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void setappicon(String sdlFileName, Integer correlationID) throws SdlException
+ @SuppressWarnings("unused")
+ public void setappicon(@NonNull String sdlFileName, Integer correlationID) throws SdlException
{
- SetAppIcon msg = RPCRequestFactory.buildSetAppIcon(sdlFileName, correlationID);
+ SetAppIcon msg = new SetAppIcon(sdlFileName);
+ msg.setCorrelationID(correlationID);
+
sendRPCRequest(msg);
}
@@ -5506,15 +6556,39 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @param displayLayout -Predefined or dynamically created screen layout.
* @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException
+ * @throws SdlException if an unrecoverable error is encountered
*/
- public void setdisplaylayout(String displayLayout, Integer correlationID) throws SdlException
+ @SuppressWarnings("unused")
+ public void setdisplaylayout(@NonNull String displayLayout, Integer correlationID) throws SdlException
{
- SetDisplayLayout msg = RPCRequestFactory.BuildSetDisplayLayout(displayLayout, correlationID);
+ SetDisplayLayout msg = new SetDisplayLayout(displayLayout);
+ msg.setCorrelationID(correlationID);
+
sendRPCRequest(msg);
}
-
- /******************** END Public Helper Methods *************************/
+
+ @SuppressWarnings("unused")
+ public boolean isCapabilitySupported(SystemCapabilityType systemCapabilityType) {
+ return _systemCapabilityManager != null && _systemCapabilityManager.isCapabilitySupported(systemCapabilityType);
+ }
+
+ @SuppressWarnings("unused")
+ public void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener){
+ if(_systemCapabilityManager != null){
+ _systemCapabilityManager.getCapability(systemCapabilityType, scListener);
+ }
+ }
+
+ @SuppressWarnings("unused")
+ public Object getCapability(SystemCapabilityType systemCapabilityType){
+ if(_systemCapabilityManager != null ){
+ return _systemCapabilityManager.getCapability(systemCapabilityType);
+ }else{
+ return null;
+ }
+ }
+
+ /* ******************* END Public Helper Methods *************************/
/**
* Gets type of transport currently used by this SdlProxy.
@@ -5523,6 +6597,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @see TransportType
*/
+ @SuppressWarnings("unused")
public TransportType getCurrentTransportType() throws IllegalStateException {
if (sdlSession == null) {
throw new IllegalStateException("Incorrect state of SdlProxyBase: Calling for getCurrentTransportType() while connection is not initialized");
@@ -5542,50 +6617,74 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
- public boolean isServiceTypeProtected(SessionType sType)
- {
- if (sdlSession == null)
- return false;
-
- return sdlSession.isServiceProtected(sType);
+ @SuppressWarnings("unused")
+ public boolean isServiceTypeProtected(SessionType sType) {
+ return sdlSession != null && sdlSession.isServiceProtected(sType);
+
}
-
+
+
+ public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener){
+ if(serviceType != null && sdlSession != null && sdlServiceListener != null){
+ sdlSession.addServiceListener(serviceType, sdlServiceListener);
+ }
+ }
+
+ public void removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener){
+ if(serviceType != null && sdlSession != null && sdlServiceListener != null){
+ sdlSession.removeServiceListener(serviceType, sdlServiceListener);
+ }
+ }
+
+ @SuppressWarnings("unused")
+ public VideoStreamingParameters getAcceptedVideoParams(){
+ return sdlSession.getAcceptedVideoParams();
+ }
+
public IProxyListenerBase getProxyListener()
{
return _proxyListener;
}
+ @SuppressWarnings("unused")
public String getAppName()
{
return _applicationName;
}
+ @SuppressWarnings("unused")
public String getNgnAppName()
{
return _ngnMediaScreenAppName;
}
+ @SuppressWarnings("unused")
public String getAppID()
{
return _appID;
}
+ @SuppressWarnings("unused")
public DeviceInfo getDeviceInfo()
{
return deviceInfo;
}
+ @SuppressWarnings("unused")
public long getInstanceDT()
{
return instanceDateTime;
}
+ @SuppressWarnings("unused")
public void setConnectionDetails(String sDetails)
{
sConnectionDetails = sDetails;
}
+ @SuppressWarnings("unused")
public String getConnectionDetails()
{
return sConnectionDetails;
}
//for testing only
+ @SuppressWarnings("unused")
public void setPoliciesURL(String sText)
{
sPoliciesURL = sText;
@@ -5595,5 +6694,316 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
{
return sPoliciesURL;
}
-
+
+
+
+ /**
+ * VideoStreamingManager houses all the elements needed to create a scoped, streaming manager for video projection. It is only a private, instance
+ * dependant class at the moment until it can become public. Once the class is public and API defined, it will be moved into the SdlSession class
+ */
+ @TargetApi(19)
+ private class VideoStreamingManager implements ISdlServiceListener{
+ Context context;
+ ISdl internalInterface;
+ volatile VirtualDisplayEncoder encoder;
+ private Class<? extends SdlRemoteDisplay> remoteDisplayClass = null;
+ SdlRemoteDisplay remoteDisplay;
+ IVideoStreamListener streamListener;
+ float[] touchScalar = {1.0f,1.0f}; //x, y
+ private HapticInterfaceManager hapticManager;
+ SdlMotionEvent sdlMotionEvent = null;
+
+ public VideoStreamingManager(Context context,ISdl iSdl){
+ this.context = context;
+ this.internalInterface = iSdl;
+ encoder = new VirtualDisplayEncoder();
+ internalInterface.addServiceListener(SessionType.NAV,this);
+ //Take care of the touch events
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_TOUCH_EVENT, new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ if(notification !=null && remoteDisplay != null){
+ MotionEvent event = convertTouchEvent((OnTouchEvent)notification);
+ if(event!=null){
+ remoteDisplay.handleMotionEvent(event);
+ }
+ }
+ }
+ });
+ }
+
+ public void startVideoStreaming(Class<? extends SdlRemoteDisplay> remoteDisplayClass, VideoStreamingParameters parameters, boolean encrypted){
+ streamListener = startVideoStream(encrypted,parameters);
+ if(streamListener == null){
+ Log.e(TAG, "Error starting video service");
+ return;
+ }
+ VideoStreamingCapability capability = (VideoStreamingCapability)_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING);
+ if(capability != null && capability.getIsHapticSpatialDataSupported()){
+ hapticManager = new HapticInterfaceManager(internalInterface);
+ }
+ this.remoteDisplayClass = remoteDisplayClass;
+ try {
+ encoder.init(context,streamListener,parameters);
+ //We are all set so we can start streaming at at this point
+ encoder.start();
+ //Encoder should be up and running
+ createRemoteDisplay(encoder.getVirtualDisplay());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Log.d(TAG, parameters.toString());
+ }
+
+ public void stopStreaming(){
+ if(remoteDisplay!=null){
+ remoteDisplay.stop();
+ remoteDisplay = null;
+ }
+ if(encoder!=null){
+ encoder.shutDown();
+ }
+ if(internalInterface!=null){
+ internalInterface.stopVideoService();
+ }
+ }
+
+ public void dispose(){
+ stopStreaming();
+ internalInterface.removeServiceListener(SessionType.NAV,this);
+ }
+
+ 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<Boolean>( new SdlRemoteDisplay.Creator(context, 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
+ VideoStreamingManager.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(getWiProVersion()>=5){ //At this point we should already have the capability
+ VideoStreamingCapability capability = (VideoStreamingCapability)_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING);
+ resolution = capability.getPreferredResolution();
+ }else {
+ DisplayCapabilities dispCap = (DisplayCapabilities) _systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY);
+ if (dispCap != null) {
+ resolution = (dispCap.getScreenParams().getImageResolution());
+ }
+ }
+ if(resolution != null){
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ disp.getMetrics(displayMetrics);
+ touchScalar[0] = ((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
+ touchScalar[1] = ((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
+ }
+
+ }
+
+ @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.start();
+ } catch (Exception ex) {
+ Log.e(TAG, "Unable to create Virtual Display.");
+ }
+ }
+
+ @Override
+ public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
+
+
+ }
+
+ @Override
+ public void onServiceEnded(SdlSession session, SessionType type) {
+ if(SessionType.NAV.equals(type)){
+ if(remoteDisplay!=null){
+ stopStreaming();
+ }
+ }
+ }
+
+ @Override
+ public void onServiceError(SdlSession session, SessionType type, String reason) {
+
+ }
+
+ private MotionEvent convertTouchEvent(OnTouchEvent touchEvent){
+ List<TouchEvent> eventList = touchEvent.getEvent();
+ if (eventList == null || eventList.size() == 0) return null;
+
+ TouchType touchType = touchEvent.getType();
+ if (touchType == null){ return null;}
+
+ int eventListSize = eventList.size();
+
+ MotionEvent.PointerProperties[] pointerProperties = new MotionEvent.PointerProperties[eventListSize];
+ MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[eventListSize];
+
+ TouchEvent event;
+ MotionEvent.PointerProperties properties;
+ MotionEvent.PointerCoords coords;
+ TouchCoord touchCoord;
+
+ for(int i = 0; i < eventListSize; i++){
+ event = eventList.get(i);
+ if(event == null || event.getId() == null || event.getTouchCoordinates() == null){
+ continue;
+ }
+
+ properties = new MotionEvent.PointerProperties();
+ properties.id = event.getId();
+ properties.toolType = MotionEvent.TOOL_TYPE_FINGER;
+
+
+ List<TouchCoord> coordList = event.getTouchCoordinates();
+ if (coordList == null || coordList.size() == 0){ continue; }
+
+ touchCoord = coordList.get(coordList.size() -1);
+ if(touchCoord == null){ continue; }
+
+ coords = new MotionEvent.PointerCoords();
+ coords.x = touchCoord.getX() * touchScalar[0];
+ coords.y = touchCoord.getY() * touchScalar[1];
+ coords.orientation = 0;
+ coords.pressure = 1.0f;
+ coords.size = 1;
+
+ //Add the info to lists only after we are sure we have all available info
+ pointerProperties[i] = properties;
+ pointerCoords[i] = coords;
+
+ }
+
+
+ if(sdlMotionEvent == null) {
+ if (touchType == TouchType.BEGIN) {
+ sdlMotionEvent = new SdlMotionEvent();
+ }else{
+ return null;
+ }
+ }
+
+ int eventAction = sdlMotionEvent.getMotionEvent(touchType, pointerProperties);
+ long startTime = sdlMotionEvent.startOfEvent;
+
+ //If the motion event should be finished we should clear our reference
+ if(eventAction == MotionEvent.ACTION_UP || eventAction == MotionEvent.ACTION_CANCEL){
+ sdlMotionEvent = null;
+ }
+
+ return MotionEvent.obtain(startTime, SystemClock.uptimeMillis(), eventAction, eventListSize, pointerProperties, pointerCoords, 0, 0,1,1,0,0, InputDevice.SOURCE_TOUCHSCREEN,0);
+
+ }
+
+
+
+ }
+
+ /**
+ * Keeps track of the current motion event for VPM
+ */
+ private static class SdlMotionEvent{
+ long startOfEvent;
+ SparseIntArray pointerStatuses = new SparseIntArray();
+
+ SdlMotionEvent(){
+ startOfEvent = SystemClock.uptimeMillis();
+ }
+
+ /**
+ * Handles the SDL Touch Event to keep track of pointer status and returns the appropirate
+ * Android MotionEvent according to this events status
+ * @param touchType The SDL TouchType that was received from the module
+ * @param pointerProperties the parsed pointer properties built from the OnTouchEvent RPC
+ * @return the correct native Andorid MotionEvent action to dispatch
+ */
+ synchronized int getMotionEvent(TouchType touchType, MotionEvent.PointerProperties[] pointerProperties){
+ int motionEvent = MotionEvent.ACTION_DOWN;
+ switch (touchType){
+ case BEGIN:
+ if(pointerStatuses.size() == 0){
+ //The motion event has just begun
+ motionEvent = MotionEvent.ACTION_DOWN;
+ }else{
+ motionEvent = MotionEvent.ACTION_POINTER_DOWN;
+ }
+ setPointerStatuses(motionEvent, pointerProperties);
+ break;
+ case MOVE:
+ motionEvent = MotionEvent.ACTION_MOVE;
+ setPointerStatuses(motionEvent, pointerProperties);
+
+ break;
+ case END:
+ //Clears out pointers that have ended
+ setPointerStatuses(MotionEvent.ACTION_UP, pointerProperties);
+
+ if(pointerStatuses.size() == 0){
+ //The motion event has just ended
+ motionEvent = MotionEvent.ACTION_UP;
+ }else{
+ motionEvent = MotionEvent.ACTION_POINTER_UP;
+ }
+ break;
+ case CANCEL:
+ //Assuming this cancels the entire event
+ motionEvent = MotionEvent.ACTION_CANCEL;
+ pointerStatuses.clear();
+ break;
+ default:
+ break;
+ }
+ return motionEvent;
+ }
+
+ private void setPointerStatuses(int motionEvent, MotionEvent.PointerProperties[] pointerProperties){
+
+ for(int i = 0; i < pointerProperties.length; i ++){
+ MotionEvent.PointerProperties properties = pointerProperties[i];
+ if(properties != null){
+ if(motionEvent == MotionEvent.ACTION_UP || motionEvent == MotionEvent.ACTION_POINTER_UP){
+ pointerStatuses.delete(properties.id);
+ }else if(motionEvent == MotionEvent.ACTION_DOWN && properties.id == 0){
+ pointerStatuses.put(properties.id, MotionEvent.ACTION_DOWN);
+ }else{
+ pointerStatuses.put(properties.id, motionEvent);
+ }
+
+ }
+ }
+ }
+ }
} // end-class
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
index 9e6921a61..cbc392f67 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
@@ -17,141 +17,160 @@ import com.smartdevicelink.transport.MultiplexTransportConfig;
import android.app.Service;
import android.content.Context;
-public class SdlProxyBuilder
-{
- // Builder Pattern
- private IProxyListenerALM listener;
- private String appId;
- private String appName;
- private Boolean isMediaApp;
-
- private Service service;
- private SdlProxyConfigurationResources sdlProxyConfigurationResources;
- private Vector<TTSChunk> ttsChunks;
- private String sShortAppName;
- private Vector<String>vrSynonyms;
- private SdlMsgVersion sdlMessageVersion;
- private Language lang;
- private Language hmiLang;
- private Vector<AppHMIType> vrAppHMITypes;
- private String autoActivateID;
- private boolean callbackToUIThread;
- private boolean preRegister;
- private String sAppResumeHash;
- private BaseTransportConfig mTransport;
- private List<Class<? extends SdlSecurityBase>> sdlSecList;
-
- public static class Builder
- {
- // Required parameters
- private IProxyListenerALM listener;
- private String appId;
- private String appName;
- private Boolean isMediaApp;
- private Context context;
-
- // Optional parameters - initialized to default values
- private Service service = null;
- private SdlProxyConfigurationResources sdlProxyConfigurationResources = null;
- private Vector<TTSChunk> ttsChunks = null;
- private String sShortAppName = null;
- private Vector<String>vrSynonyms = null;
- private SdlMsgVersion sdlMessageVersion = null;
- private Language lang = Language.EN_US;
- private Language hmiLang = Language.EN_US;
- private Vector<AppHMIType> vrAppHMITypes = null;
- private String autoActivateID = null;
- private boolean callbackToUIThread = false;
- private boolean preRegister = false;
- private String sAppResumeHash = null;
- private List<Class<? extends SdlSecurityBase>> sdlSecList = null;
- private BaseTransportConfig mTransport; //Initialized in constructor
-
- /**
- * @deprecated Use Builder(IProxyListenerALM, String, String, Boolean, Context) instead
- */
- @Deprecated
- public Builder(IProxyListenerALM listener, String appId, String appName, Boolean isMediaApp)
- {
- this.listener = listener;
- this.appId = appId;
- this.appName = appName;
- this.isMediaApp = isMediaApp;
- this.mTransport = new BTTransportConfig();
- }
-
- public Builder(IProxyListenerALM listener, String appId, String appName, Boolean isMediaApp, Context context)
- {
- this.listener = listener;
- this.appId = appId;
- this.appName = appName;
- this.isMediaApp = isMediaApp;
- this.context = context;
- this.mTransport = new MultiplexTransportConfig(context, appId);
- }
-
- public Builder setService(Service val)
- { service = val; return this; }
- public Builder setSdlProxyConfigurationResources(SdlProxyConfigurationResources val)
- { sdlProxyConfigurationResources = val; return this; }
- public Builder setTtsName(Vector<TTSChunk> val)
- { ttsChunks = val; return this; }
- public Builder setShortAppName(String val)
- { sShortAppName = val; return this; }
- public Builder setVrSynonyms(Vector<String> val)
- { vrSynonyms = val; return this; }
- public Builder setSdlMessageVersion(SdlMsgVersion val)
- { sdlMessageVersion = val; return this; }
- public Builder setLangDesired(Language val)
- { lang = val; return this; }
- public Builder setHMILangDesired(Language val)
- { hmiLang = val; return this; }
- public Builder setVrAppHMITypes(Vector<AppHMIType> val)
- { vrAppHMITypes = val; return this; }
- public Builder setAutoActivateID(String val)
- { autoActivateID = val; return this; }
- public Builder setCallbackToUIThread(boolean val)
- { callbackToUIThread = val; return this; }
- public Builder setPreRegister(boolean val)
- { preRegister = val; return this; }
- public Builder setAppResumeDataHash(String val)
- { sAppResumeHash = val; return this; }
- public Builder setTransportType(BaseTransportConfig val)
- { mTransport = val; return this; }
- public Builder setSdlSecurity(List<Class<? extends SdlSecurityBase>> val)
- { sdlSecList = val; return this; }
-
- public SdlProxyALM build() throws SdlException
- {
- SdlProxyBuilder obj = new SdlProxyBuilder(this);
- SdlProxyALM proxy = new SdlProxyALM(obj.service,obj.listener,obj.sdlProxyConfigurationResources,obj.appName,obj.ttsChunks,obj.sShortAppName,obj.vrSynonyms,obj.isMediaApp,obj.sdlMessageVersion,obj.lang,obj.hmiLang,obj.vrAppHMITypes,obj.appId,obj.autoActivateID,obj.callbackToUIThread,obj.preRegister,obj.sAppResumeHash,obj.mTransport);
- proxy.setSdlSecurityClassList(obj.sdlSecList);
- return proxy;
- }
- }
-
- private SdlProxyBuilder(Builder builder)
- {
- listener = builder.listener;
- appId = builder.appId;
- appName = builder.appName;
- isMediaApp = builder.isMediaApp;
-
- service = builder.service;
- sdlProxyConfigurationResources = builder.sdlProxyConfigurationResources;
- ttsChunks = builder.ttsChunks;
- sShortAppName = builder.sShortAppName;
- vrSynonyms = builder.vrSynonyms;
- sdlMessageVersion = builder.sdlMessageVersion;
- lang = builder.lang;
- hmiLang = builder.hmiLang;
- vrAppHMITypes = builder.vrAppHMITypes;
- autoActivateID = builder.autoActivateID;
- callbackToUIThread = builder.callbackToUIThread;
- preRegister = builder.preRegister;
- sAppResumeHash = builder.sAppResumeHash;
- mTransport = builder.mTransport;
- sdlSecList = builder.sdlSecList;
- }
+public class SdlProxyBuilder {
+ // Required parameters
+ private IProxyListenerALM listener;
+ private String appId;
+ private String appName;
+ private Boolean isMediaApp;
+ private Context context;
+ private BaseTransportConfig mTransport;
+
+ // Optional parameters
+ private Service service;
+ private SdlProxyConfigurationResources sdlProxyConfigurationResources;
+ private Vector<TTSChunk> ttsChunks;
+ private String sShortAppName;
+ private Vector<String> vrSynonyms;
+ private SdlMsgVersion sdlMessageVersion;
+ private Language lang;
+ private Language hmiLang;
+ private Vector<AppHMIType> vrAppHMITypes;
+ private String autoActivateID;
+ private boolean callbackToUIThread;
+ private boolean preRegister;
+ private String sAppResumeHash;
+ private List<Class<? extends SdlSecurityBase>> sdlSecList;
+
+ private SdlProxyBuilder() {
+ service = null;
+ sdlProxyConfigurationResources = null;
+ ttsChunks = null;
+ sShortAppName = null;
+ vrSynonyms = null;
+ sdlMessageVersion = null;
+ lang = Language.EN_US;
+ hmiLang = Language.EN_US;
+ vrAppHMITypes = null;
+ autoActivateID = null;
+ callbackToUIThread = false;
+ preRegister = false;
+ sAppResumeHash = null;
+ sdlSecList = null;
+ }
+
+ public static class Builder {
+ SdlProxyBuilder sdlProxyBuilder;
+
+ /**
+ * @deprecated Use Builder(IProxyListenerALM, String, String, Boolean, Context) instead
+ */
+ @Deprecated
+ public Builder(IProxyListenerALM listener, String appId, String appName, Boolean isMediaApp) {
+ sdlProxyBuilder = new SdlProxyBuilder();
+ sdlProxyBuilder.listener = listener;
+ sdlProxyBuilder.appId = appId;
+ sdlProxyBuilder.appName = appName;
+ sdlProxyBuilder.isMediaApp = isMediaApp;
+ sdlProxyBuilder.mTransport = new BTTransportConfig();
+ }
+
+ public Builder(IProxyListenerALM listener, String appId, String appName, Boolean isMediaApp, Context context) {
+ sdlProxyBuilder = new SdlProxyBuilder();
+ sdlProxyBuilder.listener = listener;
+ sdlProxyBuilder.appId = appId;
+ sdlProxyBuilder.appName = appName;
+ sdlProxyBuilder.isMediaApp = isMediaApp;
+ sdlProxyBuilder.context = context;
+ sdlProxyBuilder.mTransport = new MultiplexTransportConfig(context, appId);
+ }
+
+ public Builder setService(Service val) {
+ sdlProxyBuilder.service = val;
+ return this;
+ }
+
+ public Builder setSdlProxyConfigurationResources(SdlProxyConfigurationResources val) {
+ sdlProxyBuilder.sdlProxyConfigurationResources = val;
+ return this;
+ }
+
+ public Builder setTtsName(Vector<TTSChunk> val) {
+ sdlProxyBuilder.ttsChunks = val;
+ return this;
+ }
+
+ public Builder setShortAppName(String val) {
+ sdlProxyBuilder.sShortAppName = val;
+ return this;
+ }
+
+ public Builder setVrSynonyms(Vector<String> val) {
+ sdlProxyBuilder.vrSynonyms = val;
+ return this;
+ }
+
+ public Builder setSdlMessageVersion(SdlMsgVersion val) {
+ sdlProxyBuilder.sdlMessageVersion = val;
+ return this;
+ }
+
+ public Builder setLangDesired(Language val) {
+ sdlProxyBuilder.lang = val;
+ return this;
+ }
+
+ public Builder setHMILangDesired(Language val) {
+ sdlProxyBuilder.hmiLang = val;
+ return this;
+ }
+
+ public Builder setVrAppHMITypes(Vector<AppHMIType> val) {
+ sdlProxyBuilder.vrAppHMITypes = val;
+ return this;
+ }
+
+ public Builder setAutoActivateID(String val) {
+ sdlProxyBuilder.autoActivateID = val;
+ return this;
+ }
+
+ public Builder setCallbackToUIThread(boolean val) {
+ sdlProxyBuilder.callbackToUIThread = val;
+ return this;
+ }
+
+ public Builder setPreRegister(boolean val) {
+ sdlProxyBuilder.preRegister = val;
+ return this;
+ }
+
+ public Builder setAppResumeDataHash(String val) {
+ sdlProxyBuilder.sAppResumeHash = val;
+ return this;
+ }
+
+ public Builder setTransportType(BaseTransportConfig val) {
+ sdlProxyBuilder.mTransport = val;
+ return this;
+ }
+
+ public Builder setSdlSecurity(List<Class<? extends SdlSecurityBase>> val) {
+ sdlProxyBuilder.sdlSecList = val;
+ return this;
+ }
+
+ public SdlProxyALM build() throws SdlException {
+ SdlProxyALM proxy = new SdlProxyALM(sdlProxyBuilder.service, sdlProxyBuilder.listener,
+ sdlProxyBuilder.sdlProxyConfigurationResources, sdlProxyBuilder.appName,
+ sdlProxyBuilder.ttsChunks, sdlProxyBuilder.sShortAppName, sdlProxyBuilder.vrSynonyms,
+ sdlProxyBuilder.isMediaApp, sdlProxyBuilder.sdlMessageVersion, sdlProxyBuilder.lang,
+ sdlProxyBuilder.hmiLang, sdlProxyBuilder.vrAppHMITypes, sdlProxyBuilder.appId,
+ sdlProxyBuilder.autoActivateID, sdlProxyBuilder.callbackToUIThread, sdlProxyBuilder.preRegister,
+ sdlProxyBuilder.sAppResumeHash, sdlProxyBuilder.mTransport);
+ proxy.setSdlSecurityClassList(sdlProxyBuilder.sdlSecList);
+ return proxy;
+ }
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java
new file mode 100644
index 000000000..710355c49
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java
@@ -0,0 +1,169 @@
+package com.smartdevicelink.proxy;
+
+import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
+import com.smartdevicelink.proxy.rpc.GetSystemCapability;
+import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
+import com.smartdevicelink.proxy.rpc.HMICapabilities;
+import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.util.CorrelationIdGenerator;
+
+import java.security.InvalidParameterException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class SystemCapabilityManager {
+ HashMap<SystemCapabilityType, Object> cachedSystemCapabilities = new HashMap<>();
+ ISdl callback;
+
+ public SystemCapabilityManager(ISdl callback){
+ this.callback = callback;
+ }
+
+ public void parseRAIResponse(RegisterAppInterfaceResponse response){
+ if(response!=null && response.getSuccess()) {
+ cachedSystemCapabilities.put(SystemCapabilityType.HMI, response.getHmiCapabilities());
+ cachedSystemCapabilities.put(SystemCapabilityType.DISPLAY, response.getDisplayCapabilities());
+ cachedSystemCapabilities.put(SystemCapabilityType.AUDIO_PASSTHROUGH, response.getAudioPassThruCapabilities());
+ cachedSystemCapabilities.put(SystemCapabilityType.PCM_STREAMING, response.getPcmStreamingCapabilities());
+ cachedSystemCapabilities.put(SystemCapabilityType.BUTTON, response.getButtonCapabilities());
+ cachedSystemCapabilities.put(SystemCapabilityType.HMI_ZONE, response.getHmiZoneCapabilities());
+ cachedSystemCapabilities.put(SystemCapabilityType.PRESET_BANK, response.getPresetBankCapabilities());
+ cachedSystemCapabilities.put(SystemCapabilityType.SOFTBUTTON, response.getSoftButtonCapabilities());
+ cachedSystemCapabilities.put(SystemCapabilityType.SPEECH, response.getSpeechCapabilities());
+ cachedSystemCapabilities.put(SystemCapabilityType.VOICE_RECOGNITION, response.getVrCapabilities());
+ }
+ }
+
+ /**
+ * 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
+ * @param capability
+ */
+ public void setCapability(SystemCapabilityType systemCapabilityType, Object capability){
+ cachedSystemCapabilities.put(systemCapabilityType,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.containsKey(type)){
+ return true;
+ }else if(cachedSystemCapabilities.containsKey(SystemCapabilityType.HMI)){
+ HMICapabilities hmiCapabilities = ((HMICapabilities)cachedSystemCapabilities.get(SystemCapabilityType.HMI));
+ switch (type) {
+ case NAVIGATION:
+ return hmiCapabilities.isNavigationAvailable();
+ case PHONE_CALL:
+ return hmiCapabilities.isPhoneCallAvailable();
+ case VIDEO_STREAMING:
+ return hmiCapabilities.isVideoStreamingAvailable();
+ case REMOTE_CONTROL:
+ return hmiCapabilities.isRemoteControlAvailable();
+ default:
+ return false;
+ }
+ }else{
+ return false;
+ }
+ }
+ /**
+ * @param systemCapabilityType Type of capability desired
+ * @param scListener callback to execute upon retrieving capability
+ */
+ public void getCapability(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener scListener){
+ Object capability = cachedSystemCapabilities.get(systemCapabilityType);
+ if(capability != null){
+ scListener.onCapabilityRetrieved(capability);
+ return;
+ }else if(scListener == null){
+ return;
+ }
+
+ retrieveCapability(systemCapabilityType, scListener);
+ }
+
+ /**
+ * @param systemCapabilityType Type of capability desired
+ * @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
+ */
+ public Object getCapability(final SystemCapabilityType systemCapabilityType){
+ Object capability = cachedSystemCapabilities.get(systemCapabilityType);
+ if(capability != null){
+ return capability;
+ }
+
+ retrieveCapability(systemCapabilityType, null);
+ return null;
+ }
+
+ /**
+ * @param systemCapabilityType Type of capability desired
+ * passes GetSystemCapabilityType request to `callback` to be sent by proxy
+ */
+ private void retrieveCapability(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener scListener){
+ final GetSystemCapability request = new GetSystemCapability();
+ request.setSystemCapabilityType(systemCapabilityType);
+ request.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if(response.getSuccess()){
+ Object retrievedCapability = ((GetSystemCapabilityResponse) response).getSystemCapability().getCapabilityForType(systemCapabilityType);
+ cachedSystemCapabilities.put(systemCapabilityType, retrievedCapability);
+ if(scListener!=null){scListener.onCapabilityRetrieved(retrievedCapability); }
+ }else{
+ if(scListener!=null){scListener.onError(response.getInfo());}
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ if(scListener!=null){scListener.onError(info);}
+ }
+ });
+ request.setCorrelationID(CorrelationIdGenerator.generateId());
+
+ if(callback!=null){
+ callback.sendRPCRequest(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<T>();
+ }
+ }else{
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/Version.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/Version.java
index 214792f85..d49d979fe 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/Version.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/Version.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy;
+import com.smartdevicelink.BuildConfig;
+
public class Version {
- public static final String VERSION = "VERSION-INFO";
+ public static final String VERSION = BuildConfig.VERSION_NAME;
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IAudioStreamListener.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IAudioStreamListener.java
new file mode 100644
index 000000000..8d21b7615
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IAudioStreamListener.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2017, Xevo 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 copyright holder 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.interfaces;
+
+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 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.
+ */
+ void sendAudio(ByteBuffer data, long presentationTimeUs);
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
index 8b437e05e..618819f20 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
@@ -6,6 +6,7 @@ import com.smartdevicelink.proxy.rpc.AddCommandResponse;
import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.proxy.rpc.AlertResponse;
+import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
import com.smartdevicelink.proxy.rpc.DeleteCommandResponse;
@@ -17,6 +18,8 @@ import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
+import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
import com.smartdevicelink.proxy.rpc.ListFilesResponse;
@@ -27,13 +30,14 @@ import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnHashChange;
+import com.smartdevicelink.proxy.rpc.OnInteriorVehicleData;
import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
import com.smartdevicelink.proxy.rpc.OnLanguageChange;
import com.smartdevicelink.proxy.rpc.OnLockScreenStatus;
import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
+import com.smartdevicelink.proxy.rpc.OnStreamRPC;
import com.smartdevicelink.proxy.rpc.OnSystemRequest;
import com.smartdevicelink.proxy.rpc.OnTBTClientState;
-import com.smartdevicelink.proxy.rpc.OnStreamRPC;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
import com.smartdevicelink.proxy.rpc.OnVehicleData;
import com.smartdevicelink.proxy.rpc.OnWayPointChange;
@@ -43,10 +47,12 @@ import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
+import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
import com.smartdevicelink.proxy.rpc.SendLocationResponse;
import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
+import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.proxy.rpc.ShowResponse;
@@ -335,4 +341,16 @@ public interface IProxyListenerBase {
public void onUnsubscribeWayPointsResponse(UnsubscribeWayPointsResponse response);
public void onOnWayPointChange(OnWayPointChange notification);
+
+ public void onGetSystemCapabilityResponse(GetSystemCapabilityResponse response);
+
+ public void onGetInteriorVehicleDataResponse(GetInteriorVehicleDataResponse response);
+
+ public void onButtonPressResponse(ButtonPressResponse response);
+
+ public void onSetInteriorVehicleDataResponse(SetInteriorVehicleDataResponse response);
+
+ public void onOnInteriorVehicleData(OnInteriorVehicleData notification);
+
+ public void onSendHapticDataResponse(SendHapticDataResponse response);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
new file mode 100644
index 000000000..9177a146b
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
@@ -0,0 +1,116 @@
+package com.smartdevicelink.proxy.interfaces;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
+
+/*
+ * Copyright (c) 2017 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+@SuppressWarnings("unused")
+public interface ISdl {
+
+ /**
+ * Starts the connection with the module
+ */
+ void start();
+
+ /**
+ * Ends connection with the module
+ */
+ void stop();
+
+ /**
+ * 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 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 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 sevice to be started with
+ * @param encrypted flag to start this service with encryption or not
+ */
+ void startVideoService(VideoStreamingParameters parameters, boolean encrypted);
+
+ /**
+ * Stops the video service if open
+ */
+ void stopVideoService();
+
+ /**
+ * Starts the Audio streaming service
+ * @param encrypted flag to start this service with encryption or not
+ */
+ void startAudioService(boolean encrypted);
+
+ /**
+ * Stops the audio service if open
+ */
+ void stopAudioService();
+
+ /**
+ * Pass an RPC message through the proxy to be sent to the connected module
+ * @param message RPCRequest that should be sent to the module
+ */
+ void sendRPCRequest(RPCRequest message);
+
+ /**
+ * 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
+ */
+ boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener);
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdlServiceListener.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdlServiceListener.java
new file mode 100644
index 000000000..db5179a73
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdlServiceListener.java
@@ -0,0 +1,11 @@
+package com.smartdevicelink.proxy.interfaces;
+
+
+import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.protocol.enums.SessionType;
+
+public interface ISdlServiceListener {
+ public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted);
+ public void onServiceEnded(SdlSession session, SessionType type);
+ public void onServiceError(SdlSession session, SessionType type, String reason);
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IVideoStreamListener.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IVideoStreamListener.java
new file mode 100644
index 000000000..f645b0d55
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IVideoStreamListener.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2017, Xevo 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 copyright holder 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.interfaces;
+
+import java.nio.ByteBuffer;
+
+/**
+ * A listener that receives video streaming data from app.
+ */
+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 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/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/OnSystemCapabilityListener.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/OnSystemCapabilityListener.java
new file mode 100644
index 000000000..d6fb11b4d
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/OnSystemCapabilityListener.java
@@ -0,0 +1,6 @@
+package com.smartdevicelink.proxy.interfaces;
+
+public interface OnSystemCapabilityListener {
+ void onCapabilityRetrieved(Object capability);
+ void onError(String info);
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddCommand.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddCommand.java
index c8936edb8..9dec67b7d 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddCommand.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddCommand.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -59,7 +61,7 @@ import java.util.List;
* <td>Y</td>
* <td></td>
* <td>SmartDeviceLink 1.0</td>
- * <tr/>
+ * </tr>
* <tr>
* <td>vrCommands</td>
* <td>String</td>
@@ -111,6 +113,14 @@ public class AddCommand extends RPCRequest {
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>
@@ -131,7 +141,7 @@ public class AddCommand extends RPCRequest {
* <p>
* <b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
*/
- public void setCmdID(Integer cmdID) {
+ public void setCmdID(@NonNull Integer cmdID) {
setParameters(KEY_CMD_ID, cmdID);
}
/**
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddCommandResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddCommandResponse.java
index da908908b..27a19a53e 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddCommandResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddCommandResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Add Command Response is sent, when AddCommand has been called
@@ -21,5 +24,15 @@ 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 resultCode whether the request is successfully processed
+ */
+ public AddCommandResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java
index 8c55bbd9a..b61a28772 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -75,17 +77,26 @@ public class AddSubMenu extends RPCRequest {
* Constructs a new AddSubMenu object indicated by the Hashtable parameter
*
*
- * @param hash
- * The Hashtable to use
+ * @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
*/
@@ -103,7 +114,7 @@ public class AddSubMenu extends RPCRequest {
*
* <p><b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
*/
- public void setMenuID( Integer menuID ) {
+ public void setMenuID( @NonNull Integer menuID ) {
setParameters(KEY_MENU_ID, menuID);
}
/**
@@ -152,7 +163,7 @@ public class AddSubMenu extends RPCRequest {
* @param menuName
* String which will be displayed representing this submenu item
*/
- public void setMenuName( String menuName ) {
+ public void setMenuName( @NonNull String menuName ) {
setParameters(KEY_MENU_NAME, menuName);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java
index 6b386eef5..dff7cd091 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Add SubMenu Response is sent, when AddSubMenu has been called
@@ -20,4 +23,14 @@ public class AddSubMenuResponse extends RPCResponse {
public AddSubMenuResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new AddSubMenuResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public AddSubMenuResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AirbagStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AirbagStatus.java
index 1c6fb52bb..a1ef8aa88 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AirbagStatus.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AirbagStatus.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -107,49 +109,62 @@ public class AirbagStatus extends RPCStruct {
super(hash);
}
- public void setDriverAirbagDeployed(VehicleDataEventStatus driverAirbagDeployed) {
+ public AirbagStatus(@NonNull VehicleDataEventStatus driverAirbagDeployed, @NonNull VehicleDataEventStatus driverSideAirbagDeployed, @NonNull VehicleDataEventStatus driverCurtainAirbagDeployed, @NonNull VehicleDataEventStatus driverKneeAirbagDeployed,
+ @NonNull VehicleDataEventStatus passengerCurtainAirbagDeployed, @NonNull VehicleDataEventStatus passengerAirbagDeployed, @NonNull VehicleDataEventStatus passengerSideAirbagDeployed, @NonNull VehicleDataEventStatus passengerKneeAirbagDeployed) {
+ this();
+ setDriverAirbagDeployed(driverAirbagDeployed);
+ setDriverSideAirbagDeployed(driverSideAirbagDeployed);
+ setDriverCurtainAirbagDeployed(driverCurtainAirbagDeployed);
+ setDriverKneeAirbagDeployed(driverKneeAirbagDeployed);
+ setPassengerAirbagDeployed(passengerAirbagDeployed);
+ setPassengerSideAirbagDeployed(passengerSideAirbagDeployed);
+ setPassengerCurtainAirbagDeployed(passengerCurtainAirbagDeployed);
+ setPassengerKneeAirbagDeployed(passengerKneeAirbagDeployed);
+ }
+
+ public void setDriverAirbagDeployed(@NonNull VehicleDataEventStatus driverAirbagDeployed) {
setValue(KEY_DRIVER_AIRBAG_DEPLOYED, driverAirbagDeployed);
}
public VehicleDataEventStatus getDriverAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_AIRBAG_DEPLOYED);
}
- public void setDriverSideAirbagDeployed(VehicleDataEventStatus driverSideAirbagDeployed) {
+ public void setDriverSideAirbagDeployed(@NonNull VehicleDataEventStatus driverSideAirbagDeployed) {
setValue(KEY_DRIVER_SIDE_AIRBAG_DEPLOYED, driverSideAirbagDeployed);
}
public VehicleDataEventStatus getDriverSideAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_SIDE_AIRBAG_DEPLOYED);
}
- public void setDriverCurtainAirbagDeployed(VehicleDataEventStatus driverCurtainAirbagDeployed) {
+ public void setDriverCurtainAirbagDeployed(@NonNull VehicleDataEventStatus driverCurtainAirbagDeployed) {
setValue(KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED, driverCurtainAirbagDeployed);
}
public VehicleDataEventStatus getDriverCurtainAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_CURTAIN_AIRBAG_DEPLOYED);
}
- public void setPassengerAirbagDeployed(VehicleDataEventStatus passengerAirbagDeployed) {
+ public void setPassengerAirbagDeployed(@NonNull VehicleDataEventStatus passengerAirbagDeployed) {
setValue(KEY_PASSENGER_AIRBAG_DEPLOYED, passengerAirbagDeployed);
}
public VehicleDataEventStatus getPassengerAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_AIRBAG_DEPLOYED);
}
- public void setPassengerCurtainAirbagDeployed(VehicleDataEventStatus passengerCurtainAirbagDeployed) {
+ public void setPassengerCurtainAirbagDeployed(@NonNull VehicleDataEventStatus passengerCurtainAirbagDeployed) {
setValue(KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED, passengerCurtainAirbagDeployed);
}
public VehicleDataEventStatus getPassengerCurtainAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED);
}
- public void setDriverKneeAirbagDeployed(VehicleDataEventStatus driverKneeAirbagDeployed) {
+ public void setDriverKneeAirbagDeployed(@NonNull VehicleDataEventStatus driverKneeAirbagDeployed) {
setValue(KEY_DRIVER_KNEE_AIRBAG_DEPLOYED, driverKneeAirbagDeployed);
}
public VehicleDataEventStatus getDriverKneeAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_KNEE_AIRBAG_DEPLOYED);
}
- public void setPassengerSideAirbagDeployed(VehicleDataEventStatus passengerSideAirbagDeployed) {
+ public void setPassengerSideAirbagDeployed(@NonNull VehicleDataEventStatus passengerSideAirbagDeployed) {
setValue(KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED, passengerSideAirbagDeployed);
}
public VehicleDataEventStatus getPassengerSideAirbagDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED);
}
- public void setPassengerKneeAirbagDeployed(VehicleDataEventStatus passengerKneeAirbagDeployed) {
+ public void setPassengerKneeAirbagDeployed(@NonNull VehicleDataEventStatus passengerKneeAirbagDeployed) {
setValue(KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED, passengerKneeAirbagDeployed);
}
public VehicleDataEventStatus getPassengerKneeAirbagDeployed() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java
index 6ed8ca1a4..f1a71bd66 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Alert Maneuver Response is sent, when AlertManeuver has been called
@@ -31,5 +34,14 @@ public class AlertManeuverResponse extends RPCResponse{
public AlertManeuverResponse(Hashtable<String, Object> hash) {
super(hash);
}
-
+ /**
+ * Constructs a new AlertManeuverResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public AlertManeuverResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AlertResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AlertResponse.java
index 0ecf2579a..c95be6e37 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AlertResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AlertResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
@@ -31,6 +34,16 @@ public class AlertResponse extends RPCResponse {
public AlertResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new AlertResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public AlertResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
public Integer getTryAgainTime() {
return getInteger(KEY_TRY_AGAIN_TIME);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java
index 61de1d1f5..7252eeb83 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.AudioType;
import com.smartdevicelink.proxy.rpc.enums.BitsPerSample;
@@ -65,12 +67,24 @@ public class AudioPassThruCapabilities extends RPCStruct {
public AudioPassThruCapabilities(Hashtable<String, Object> hash) {
super(hash);
}
-
+ /**
+ * Constructs a newly allocated AudioPassThruCapabilities object
+ * @param samplingRate the sampling rate for AudioPassThru
+ * @param bitsPerSample the sample depth in bit for AudioPassThru
+ * @param audioType the audiotype for AudioPassThru
+ */
+ public AudioPassThruCapabilities(@NonNull SamplingRate samplingRate, @NonNull BitsPerSample bitsPerSample, @NonNull AudioType audioType) {
+ this();
+ setSamplingRate(samplingRate);
+ setBitsPerSample(bitsPerSample);
+ setAudioType(audioType);
+ }
+
/**
* set the sampling rate for AudioPassThru
* @param samplingRate the sampling rate for AudioPassThru
*/
- public void setSamplingRate(SamplingRate samplingRate) {
+ public void setSamplingRate(@NonNull SamplingRate samplingRate) {
setValue(KEY_SAMPLING_RATE, samplingRate);
}
@@ -86,7 +100,7 @@ public class AudioPassThruCapabilities extends RPCStruct {
* set the sample depth in bit for AudioPassThru
* @param bitsPerSample the sample depth in bit for AudioPassThru
*/
- public void setBitsPerSample(BitsPerSample bitsPerSample) {
+ public void setBitsPerSample(@NonNull BitsPerSample bitsPerSample) {
setValue(KEY_BITS_PER_SAMPLE, bitsPerSample);
}
@@ -102,7 +116,7 @@ public class AudioPassThruCapabilities extends RPCStruct {
* set the audiotype for AudioPassThru
* @param audioType the audiotype for AudioPassThru
*/
- public void setAudioType(AudioType audioType) {
+ public void setAudioType(@NonNull AudioType audioType) {
setValue(KEY_AUDIO_TYPE, audioType);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/BeltStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/BeltStatus.java
index 598cf3adf..440343354 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/BeltStatus.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/BeltStatus.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -128,6 +130,7 @@ public class BeltStatus extends RPCStruct {
public static final String KEY_MIDDLE_ROW_2_BUCKLE_BELTED = "middleRow2BuckleBelted";
public static final String KEY_MIDDLE_ROW_3_BUCKLE_BELTED = "middleRow3BuckleBelted";
public static final String KEY_LEFT_ROW_3_BUCKLE_BELTED = "leftRow3BuckleBelted";
+
public static final String KEY_RIGHT_ROW_3_BUCKLE_BELTED = "rightRow3BuckleBelted";
public static final String KEY_REAR_INFLATABLE_BELTED = "rearInflatableBelted";
public static final String KEY_RIGHT_REAR_INFLATABLE_BELTED = "rightRearInflatableBelted";
@@ -146,19 +149,43 @@ public class BeltStatus extends RPCStruct {
super(hash);
}
- public void setDriverBeltDeployed(VehicleDataEventStatus driverBeltDeployed) {
+ public BeltStatus(@NonNull VehicleDataEventStatus driverBeltDeployed, @NonNull VehicleDataEventStatus passengerBeltDeployed, @NonNull VehicleDataEventStatus passengerBuckleBelted,
+ @NonNull VehicleDataEventStatus driverBuckleBelted, @NonNull VehicleDataEventStatus leftRow2BuckleBelted, @NonNull VehicleDataEventStatus passengerChildDetected,
+ @NonNull VehicleDataEventStatus rightRow2BuckleBelted, @NonNull VehicleDataEventStatus middleRow2BuckleBelted, @NonNull VehicleDataEventStatus middleRow3BuckleBelted,
+ @NonNull VehicleDataEventStatus leftRow3BuckleBelted, @NonNull VehicleDataEventStatus rightRow3BuckleBelted, @NonNull VehicleDataEventStatus leftRearInflatableBelted,
+ @NonNull VehicleDataEventStatus rightRearInflatableBelted, @NonNull VehicleDataEventStatus middleRow1BeltDeployed, @NonNull VehicleDataEventStatus middleRow1BuckleBelted
+ ) {
+ this();
+ setDriverBeltDeployed(driverBeltDeployed);
+ setPassengerBeltDeployed(passengerBeltDeployed);
+ setPassengerBuckleBelted(passengerBuckleBelted);
+ setDriverBuckleBelted(driverBuckleBelted);
+ setLeftRow2BuckleBelted(leftRow2BuckleBelted);
+ setPassengerChildDetected(passengerChildDetected);
+ setRightRow2BuckleBelted(rightRow2BuckleBelted);
+ setMiddleRow2BuckleBelted(middleRow2BuckleBelted);
+ setMiddleRow3BuckleBelted(middleRow3BuckleBelted);
+ setLeftRow3BuckleBelted(leftRow3BuckleBelted);
+ setRightRow3BuckleBelted(rightRow3BuckleBelted);
+ setLeftRearInflatableBelted(leftRearInflatableBelted);
+ setRightRearInflatableBelted(rightRearInflatableBelted);
+ setMiddleRow1BeltDeployed(middleRow1BeltDeployed);
+ setMiddleRow1BuckleBelted(middleRow1BuckleBelted);
+ }
+
+ public void setDriverBeltDeployed(@NonNull VehicleDataEventStatus driverBeltDeployed) {
setValue(KEY_DRIVER_BELT_DEPLOYED, driverBeltDeployed);
}
public VehicleDataEventStatus getDriverBeltDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_DRIVER_BELT_DEPLOYED);
}
- public void setPassengerBeltDeployed(VehicleDataEventStatus passengerBeltDeployed) {
+ public void setPassengerBeltDeployed(@NonNull VehicleDataEventStatus passengerBeltDeployed) {
setValue(KEY_PASSENGER_BELT_DEPLOYED, passengerBeltDeployed);
}
public VehicleDataEventStatus getPassengerBeltDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_BELT_DEPLOYED);
}
- public void setPassengerBuckleBelted(VehicleDataEventStatus passengerBuckleBelted) {
+ public void setPassengerBuckleBelted(@NonNull VehicleDataEventStatus passengerBuckleBelted) {
setValue(KEY_PASSENGER_BUCKLE_BELTED, passengerBuckleBelted);
}
public VehicleDataEventStatus getPassengerBuckleBelted() {
@@ -176,61 +203,61 @@ public class BeltStatus extends RPCStruct {
public VehicleDataEventStatus getLeftRow2BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_LEFT_ROW_2_BUCKLE_BELTED);
}
- public void setPassengerChildDetected(VehicleDataEventStatus passengerChildDetected) {
+ public void setPassengerChildDetected(@NonNull VehicleDataEventStatus passengerChildDetected) {
setValue(KEY_PASSENGER_CHILD_DETECTED, passengerChildDetected);
}
public VehicleDataEventStatus getPassengerChildDetected() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_PASSENGER_CHILD_DETECTED);
}
- public void setRightRow2BuckleBelted(VehicleDataEventStatus rightRow2BuckleBelted) {
+ public void setRightRow2BuckleBelted(@NonNull VehicleDataEventStatus rightRow2BuckleBelted) {
setValue(KEY_RIGHT_ROW_2_BUCKLE_BELTED, rightRow2BuckleBelted);
}
public VehicleDataEventStatus getRightRow2BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_RIGHT_ROW_2_BUCKLE_BELTED);
}
- public void setMiddleRow2BuckleBelted(VehicleDataEventStatus middleRow2BuckleBelted) {
+ public void setMiddleRow2BuckleBelted(@NonNull VehicleDataEventStatus middleRow2BuckleBelted) {
setValue(KEY_MIDDLE_ROW_2_BUCKLE_BELTED, middleRow2BuckleBelted);
}
public VehicleDataEventStatus getMiddleRow2BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_MIDDLE_ROW_2_BUCKLE_BELTED);
}
- public void setMiddleRow3BuckleBelted(VehicleDataEventStatus middleRow3BuckleBelted) {
+ public void setMiddleRow3BuckleBelted(@NonNull VehicleDataEventStatus middleRow3BuckleBelted) {
setValue(KEY_MIDDLE_ROW_3_BUCKLE_BELTED, middleRow3BuckleBelted);
}
public VehicleDataEventStatus getMiddleRow3BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_MIDDLE_ROW_3_BUCKLE_BELTED);
}
- public void setLeftRow3BuckleBelted(VehicleDataEventStatus leftRow3BuckleBelted) {
+ public void setLeftRow3BuckleBelted(@NonNull VehicleDataEventStatus leftRow3BuckleBelted) {
setValue(KEY_LEFT_ROW_3_BUCKLE_BELTED, leftRow3BuckleBelted);
}
public VehicleDataEventStatus getLeftRow3BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_LEFT_ROW_3_BUCKLE_BELTED);
}
- public void setRightRow3BuckleBelted(VehicleDataEventStatus rightRow3BuckleBelted) {
+ public void setRightRow3BuckleBelted(@NonNull VehicleDataEventStatus rightRow3BuckleBelted) {
setValue(KEY_RIGHT_ROW_3_BUCKLE_BELTED, rightRow3BuckleBelted);
}
public VehicleDataEventStatus getRightRow3BuckleBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_RIGHT_ROW_3_BUCKLE_BELTED);
}
- public void setLeftRearInflatableBelted(VehicleDataEventStatus rearInflatableBelted) {
+ public void setLeftRearInflatableBelted(@NonNull VehicleDataEventStatus rearInflatableBelted) {
setValue(KEY_REAR_INFLATABLE_BELTED, rearInflatableBelted);
}
public VehicleDataEventStatus getLeftRearInflatableBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_REAR_INFLATABLE_BELTED);
}
- public void setRightRearInflatableBelted(VehicleDataEventStatus rightRearInflatableBelted) {
+ public void setRightRearInflatableBelted(@NonNull VehicleDataEventStatus rightRearInflatableBelted) {
setValue(KEY_RIGHT_REAR_INFLATABLE_BELTED, rightRearInflatableBelted);
}
public VehicleDataEventStatus getRightRearInflatableBelted() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_RIGHT_REAR_INFLATABLE_BELTED);
}
- public void setMiddleRow1BeltDeployed(VehicleDataEventStatus middleRow1BeltDeployed) {
+ public void setMiddleRow1BeltDeployed(@NonNull VehicleDataEventStatus middleRow1BeltDeployed) {
setValue(KEY_MIDDLE_ROW_1_BELT_DEPLOYED, middleRow1BeltDeployed);
}
public VehicleDataEventStatus getMiddleRow1BeltDeployed() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_MIDDLE_ROW_1_BELT_DEPLOYED);
}
- public void setMiddleRow1BuckleBelted(VehicleDataEventStatus middleRow1BuckleBelted) {
+ public void setMiddleRow1BuckleBelted(@NonNull VehicleDataEventStatus middleRow1BuckleBelted) {
setValue(KEY_MIDDLE_ROW_1_BUCKLE_BELTED, middleRow1BuckleBelted);
}
public VehicleDataEventStatus getMiddleRow1BuckleBelted() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java
index 4f851c383..7773aaaa7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStableStatus;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus;
@@ -107,20 +109,25 @@ public class BodyInformation extends RPCStruct {
public BodyInformation(Hashtable<String, Object> hash) {
super(hash);
}
-
- public void setParkBrakeActive(Boolean parkBrakeActive) {
+ public BodyInformation(@NonNull Boolean parkBrakeActive, @NonNull IgnitionStableStatus ignitionStableStatus, @NonNull IgnitionStatus ignitionStatus) {
+ this();
+ setParkBrakeActive(parkBrakeActive);
+ setIgnitionStableStatus(ignitionStableStatus);
+ setIgnitionStatus(ignitionStatus);
+ }
+ public void setParkBrakeActive(@NonNull Boolean parkBrakeActive) {
setValue(KEY_PARK_BRAKE_ACTIVE, parkBrakeActive);
}
public Boolean getParkBrakeActive() {
return getBoolean(KEY_PARK_BRAKE_ACTIVE);
}
- public void setIgnitionStableStatus(IgnitionStableStatus ignitionStableStatus) {
+ public void setIgnitionStableStatus(@NonNull IgnitionStableStatus ignitionStableStatus) {
setValue(KEY_IGNITION_STABLE_STATUS, ignitionStableStatus);
}
public IgnitionStableStatus getIgnitionStableStatus() {
return (IgnitionStableStatus) getObject(IgnitionStableStatus.class, KEY_IGNITION_STABLE_STATUS);
}
- public void setIgnitionStatus(IgnitionStatus ignitionStatus) {
+ public void setIgnitionStatus(@NonNull IgnitionStatus ignitionStatus) {
setValue(KEY_IGNITION_STATUS, ignitionStatus);
}
public IgnitionStatus getIgnitionStatus() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
index 5c0ebd779..b79685d12 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -76,6 +78,20 @@ public class ButtonCapabilities extends RPCStruct {
super(hash);
}
/**
+ * Constructs a newly allocated ButtonCapabilities object
+ * @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.
+ */
+ public ButtonCapabilities(@NonNull ButtonName name, @NonNull Boolean shortPressAvailable, @NonNull Boolean longPressAvailable, @NonNull Boolean upDownAvailable) {
+ this();
+ setName(name);
+ setShortPressAvailable(shortPressAvailable);
+ setLongPressAvailable(longPressAvailable);
+ setUpDownAvailable(upDownAvailable);
+ }
+ /**
* Get the name of theSDL HMI button.
* @return ButtonName the name of the Button
*/
@@ -86,7 +102,7 @@ public class ButtonCapabilities extends RPCStruct {
* Set the name of theSDL HMI button.
* @param name the name of button
*/
- public void setName( ButtonName name ) {
+ public void setName( @NonNull ButtonName name ) {
setValue(KEY_NAME, name);
}
/**
@@ -100,7 +116,7 @@ public class ButtonCapabilities extends RPCStruct {
* 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 void setShortPressAvailable( Boolean shortPressAvailable ) {
+ public void setShortPressAvailable( @NonNull Boolean shortPressAvailable ) {
setValue(KEY_SHORT_PRESS_AVAILABLE, shortPressAvailable);
}
/**
@@ -114,7 +130,7 @@ public class ButtonCapabilities extends RPCStruct {
* 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 void setLongPressAvailable( Boolean longPressAvailable ) {
+ public void setLongPressAvailable( @NonNull Boolean longPressAvailable ) {
setValue(KEY_LONG_PRESS_AVAILABLE, longPressAvailable);
}
/**
@@ -128,7 +144,7 @@ public class ButtonCapabilities extends RPCStruct {
* 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 void setUpDownAvailable( Boolean upDownAvailable ) {
+ public void setUpDownAvailable( @NonNull Boolean upDownAvailable ) {
setValue(KEY_UP_DOWN_AVAILABLE, upDownAvailable);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
new file mode 100644
index 000000000..94fb75083
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
@@ -0,0 +1,107 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.ButtonName;
+import com.smartdevicelink.proxy.rpc.enums.ButtonPressMode;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import java.util.Hashtable;
+
+/**
+ * This function allows a remote control type mobile application
+ * simulate a hardware button press event.
+ */
+public class ButtonPress extends RPCRequest {
+ public static final String KEY_MODULE_TYPE = "moduleType";
+ public static final String KEY_BUTTON_NAME = "buttonName";
+ public static final String KEY_BUTTON_PRESS_MODE = "buttonPressMode";
+
+ /**
+ * Constructs a new ButtonPress object
+ */
+ public ButtonPress() {
+ super(FunctionID.BUTTON_PRESS.toString());
+ }
+
+ /**
+ * <p>Constructs a new ButtonPress object indicated by the
+ * Hashtable parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public ButtonPress(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * 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 buttonPressMode Indicates whether this is a LONG or SHORT button press event.
+ */
+ public ButtonPress(@NonNull ModuleType moduleType, @NonNull ButtonName buttonName, @NonNull ButtonPressMode buttonPressMode) {
+ this();
+ setModuleType(moduleType);
+ setButtonName(buttonName);
+ setButtonPressMode(buttonPressMode);
+ }
+
+ /**
+ * Gets the ModuleType
+ *
+ * @return ModuleType - The module where the button should be pressed
+ */
+ public ModuleType getModuleType() {
+ return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE);
+ }
+
+ /**
+ * Sets a ModuleType
+ *
+ * @param moduleType
+ * Represents module where the button should be pressed
+ */
+ public void setModuleType(@NonNull ModuleType moduleType) {
+ setParameters(KEY_MODULE_TYPE, moduleType);
+ }
+
+ /**
+ * Gets the ButtonName
+ *
+ * @return ButtonName - The name of supported RC climate or radio button
+ */
+ public ButtonName getButtonName() {
+ return (ButtonName) getObject(ButtonName.class, KEY_BUTTON_NAME);
+ }
+
+ /**
+ * Sets a ButtonName
+ *
+ * @param buttonName
+ * Represents name of supported RC climate or radio button
+ */
+ public void setButtonName(@NonNull ButtonName buttonName) {
+ setParameters(KEY_BUTTON_NAME, buttonName);
+ }
+
+ /**
+ * Gets the ButtonPressMode
+ *
+ * @return ButtonPressMode - Indicates whether this is a LONG or SHORT button press event.
+ */
+ public ButtonPressMode getButtonPressMode() {
+ return (ButtonPressMode) getObject(ButtonPressMode.class, KEY_BUTTON_PRESS_MODE);
+ }
+
+ /**
+ * Sets a ButtonPressMode
+ *
+ * @param buttonPressMode
+ * Indicates whether this is a LONG or SHORT button press event.
+ */
+ public void setButtonPressMode(@NonNull ButtonPressMode buttonPressMode) {
+ setParameters(KEY_BUTTON_PRESS_MODE, buttonPressMode);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java
new file mode 100644
index 000000000..f2644160e
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPressResponse.java
@@ -0,0 +1,41 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+public class ButtonPressResponse extends RPCResponse {
+
+ /**
+ * Constructs a new ButtonPressResponse object
+ */
+ public ButtonPressResponse() {
+ super(FunctionID.BUTTON_PRESS.toString());
+ }
+
+ /**
+ * <p>Constructs a new ButtonPressResponse object indicated by the
+ * Hashtable parameter</p>
+ *
+ *
+ * @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
+ */
+ public ButtonPressResponse(@NonNull Result resultCode, @NonNull Boolean success) {
+ this();
+ setResultCode(resultCode);
+ setSuccess(success);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistration.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
index c481e36c6..f2981412f 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.Language;
@@ -124,13 +126,24 @@ public class ChangeRegistration extends RPCRequest {
super(hash);
}
+ /**
+ * Constructs a new ChangeRegistration object
+ * @param language a language value
+ * @param hmiDisplayLanguage a Language value
+ */
+ public ChangeRegistration(@NonNull Language language, @NonNull Language hmiDisplayLanguage) {
+ this();
+ setLanguage(language);
+ setHmiDisplayLanguage(hmiDisplayLanguage);
+ }
+
/**
* Sets language
*
* @param language
* a language value
*/
- public void setLanguage(Language language) {
+ public void setLanguage(@NonNull Language language) {
setParameters(KEY_LANGUAGE, language);
}
@@ -149,7 +162,7 @@ public class ChangeRegistration extends RPCRequest {
* @param hmiDisplayLanguage
* a Language value
*/
- public void setHmiDisplayLanguage(Language hmiDisplayLanguage) {
+ public void setHmiDisplayLanguage(@NonNull Language hmiDisplayLanguage) {
setParameters(KEY_HMI_DISPLAY_LANGUAGE, hmiDisplayLanguage);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java
index e5404cad3..4c1b0209b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Change Registration Response is sent, when ChangeRegistration has been called
@@ -30,4 +33,15 @@ public class ChangeRegistrationResponse extends RPCResponse {
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);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Choice.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Choice.java
index 886a88d23..989ac2997 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Choice.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Choice.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -74,9 +76,21 @@ public class Choice extends RPCStruct {
super(hash);
}
/**
+ * Constructs a newly allocated Choice object
+ * @param choiceID Min: 0 Max: 65535
+ * @param menuName the menu name
+ * @param vrCommands the List of vrCommands
+ */
+ public Choice(@NonNull Integer choiceID, @NonNull String menuName, @NonNull List<String> vrCommands) {
+ this();
+ setChoiceID(choiceID);
+ setMenuName(menuName);
+ setVrCommands(vrCommands);
+ }
+ /**
* Get the application-scoped identifier that uniquely identifies this choice.
* @return choiceID Min: 0; Max: 65535
- */
+ */
public Integer getChoiceID() {
return getInteger(KEY_CHOICE_ID);
}
@@ -84,7 +98,7 @@ public class Choice extends RPCStruct {
* Set the application-scoped identifier that uniquely identifies this choice.
* @param choiceID Min: 0 Max: 65535
*/
- public void setChoiceID(Integer choiceID) {
+ public void setChoiceID(@NonNull Integer choiceID) {
setValue(KEY_CHOICE_ID, choiceID);
}
/**
@@ -102,7 +116,7 @@ public class Choice extends RPCStruct {
* Max: 100
* @param menuName the menu name
*/
- public void setMenuName(String menuName) {
+ public void setMenuName(@NonNull String menuName) {
setValue(KEY_MENU_NAME, menuName);
}
/**
@@ -119,7 +133,7 @@ public class Choice extends RPCStruct {
* @param vrCommands the List of vrCommands
* @since SmartDeviceLink 2.0
*/
- public void setVrCommands(List<String> vrCommands) {
+ public void setVrCommands(@NonNull List<String> vrCommands) {
setValue(KEY_VR_COMMANDS, vrCommands);
}
/**
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
new file mode 100644
index 000000000..61a967585
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
@@ -0,0 +1,290 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
+import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
+import java.util.Hashtable;
+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_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 ClimateControlCapabilities() {
+ }
+
+ public ClimateControlCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * 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) {
+ this();
+ setModuleName(moduleName);
+ }
+
+ /**
+ * Sets the moduleName portion of the ClimateControlCapabilities class
+ *
+ * @param moduleName The short friendly name of the climate control module. It should not be used to identify a module by mobile application.
+ */
+ public void setModuleName(@NonNull String moduleName) {
+ setValue(KEY_MODULE_NAME, moduleName);
+ }
+
+ /**
+ * Gets the moduleName portion of the ClimateControlCapabilities class
+ *
+ * @return String - Short friendly name of the climate control module.
+ */
+ public String getModuleName() {
+ return getString(KEY_MODULE_NAME);
+ }
+
+ /**
+ * 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.
+ */
+ public void setFanSpeedAvailable(Boolean fanSpeedAvailable) {
+ setValue(KEY_FAN_SPEED_AVAILABLE, fanSpeedAvailable);
+ }
+
+ /**
+ * Gets the fanSpeedAvailable portion of the ClimateControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of fan speed.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getFanSpeedAvailable() {
+ return getBoolean(KEY_FAN_SPEED_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setDesiredTemperatureAvailable(Boolean desiredTemperatureAvailable) {
+ setValue(KEY_DESIRED_TEMPERATURE_AVAILABLE, desiredTemperatureAvailable);
+ }
+
+ /**
+ * Gets the desiredTemperatureAvailable portion of the ClimateControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of desired temperature.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getDesiredTemperatureAvailable() {
+ return getBoolean(KEY_DESIRED_TEMPERATURE_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setAcEnableAvailable(Boolean acEnableAvailable) {
+ setValue(KEY_AC_ENABLE_AVAILABLE, acEnableAvailable);
+ }
+
+ /**
+ * Gets the acEnableAvailable portion of the ClimateControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of turn on/off AC.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getAcEnableAvailable() {
+ return getBoolean(KEY_AC_ENABLE_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setAcMaxEnableAvailable(Boolean acMaxEnableAvailable) {
+ setValue(KEY_AC_MAX_ENABLE_AVAILABLE, acMaxEnableAvailable);
+ }
+
+ /**
+ * Gets the acMaxEnableAvailable portion of the ClimateControlCapabilities class
+ *
+ * @return Boolean - 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 Boolean getAcMaxEnableAvailable() {
+ return getBoolean(KEY_AC_MAX_ENABLE_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setCirculateAirEnableAvailable(Boolean circulateAirEnableAvailable) {
+ setValue(KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, circulateAirEnableAvailable);
+ }
+
+ /**
+ * Gets the circulateAirEnableAvailable portion of the ClimateControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of enable/disable circulate Air mode.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getCirculateAirEnableAvailable() {
+ return getBoolean(KEY_CIRCULATE_AIR_ENABLE_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setAutoModeEnableAvailable(Boolean autoModeEnableAvailable) {
+ setValue(KEY_AUTO_MODE_ENABLE_AVAILABLE, autoModeEnableAvailable);
+ }
+
+ /**
+ * Gets the autoModeEnableAvailable portion of the ClimateControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of enable/disable auto mode.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getAutoModeEnableAvailable() {
+ return getBoolean(KEY_AUTO_MODE_ENABLE_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setDualModeEnableAvailable(Boolean dualModeEnableAvailable) {
+ setValue(KEY_DUAL_MODE_ENABLE_AVAILABLE, dualModeEnableAvailable);
+ }
+
+ /**
+ * Gets the dualModeEnableAvailable portion of the ClimateControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of enable/disable dual mode.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getDualModeEnableAvailable() {
+ return getBoolean(KEY_DUAL_MODE_ENABLE_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setDefrostZoneAvailable(Boolean defrostZoneAvailable) {
+ setValue(KEY_DEFROST_ZONE_AVAILABLE, defrostZoneAvailable);
+ }
+
+ /**
+ * Gets the defrostZoneAvailable portion of the ClimateControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of defrost zones.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getDefrostZoneAvailable() {
+ return getBoolean(KEY_DEFROST_ZONE_AVAILABLE);
+ }
+
+ /**
+ * Gets the List<DefrostZone> portion of the ClimateControlCapabilities class
+ *
+ * @return List<DefrostZone> - A set of all defrost zones that are controllable.
+ */
+ public List<DefrostZone> getDefrostZone() {
+ return (List<DefrostZone>) getObject(DefrostZone.class, KEY_DEFROST_ZONE);
+ }
+
+ /**
+ * Sets the defrostZone portion of the ClimateControlCapabilities class
+ *
+ * @param defrostZone
+ * A set of all defrost zones that are controllable.
+ */
+ public void setDefrostZone(List<DefrostZone> defrostZone) {
+ setValue(KEY_DEFROST_ZONE, defrostZone);
+ }
+
+ /**
+ * 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.
+ */
+ public void setVentilationModeAvailable(Boolean ventilationModeAvailable) {
+ setValue(KEY_VENTILATION_MODE_AVAILABLE, ventilationModeAvailable);
+ }
+
+ /**
+ * Gets the ventilationModeAvailable portion of the ClimateControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of air ventilation mode.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getVentilationModeAvailable() {
+ return getBoolean(KEY_VENTILATION_MODE_AVAILABLE);
+ }
+
+ /**
+ * Gets the List<VentilationMode> portion of the ClimateControlCapabilities class
+ *
+ * @return List<VentilationMode> - A set of all ventilation modes that are controllable.
+ */
+ public List<VentilationMode> getVentilationMode() {
+ return (List<VentilationMode>) getObject(VentilationMode.class, KEY_VENTILATION_MODE);
+ }
+
+ /**
+ * Sets the ventilationMode portion of the ClimateControlCapabilities class
+ *
+ * @param ventilationMode
+ * A set of all ventilation modes that are controllable.
+ */
+ public void setVentilationMode(List<VentilationMode> ventilationMode) {
+ setValue(KEY_VENTILATION_MODE, ventilationMode);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java
new file mode 100644
index 000000000..0da8060f3
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java
@@ -0,0 +1,106 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
+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 ClimateControlData() {
+ }
+
+ public ClimateControlData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public void setFanSpeed(Integer fanSpeed) {
+ setValue(KEY_FAN_SPEED, fanSpeed);
+ }
+
+ public Integer getFanSpeed() {
+ return getInteger(KEY_FAN_SPEED);
+ }
+
+ public void setCurrentTemperature(Temperature currentTemperature) {
+ setValue(KEY_CURRENT_TEMPERATURE, currentTemperature);
+ }
+
+ public Temperature getCurrentTemperature() {
+ return (Temperature) getObject(Temperature.class, KEY_CURRENT_TEMPERATURE);
+ }
+
+ public void setDesiredTemperature(Temperature desiredTemperature) {
+ setValue(KEY_DESIRED_TEMPERATURE, desiredTemperature);
+ }
+
+ public Temperature getDesiredTemperature() {
+ return (Temperature) getObject(Temperature.class, KEY_DESIRED_TEMPERATURE);
+ }
+
+ public void setAcEnable(Boolean acEnable) {
+ setValue(KEY_AC_ENABLE, acEnable);
+ }
+
+ public Boolean getAcEnable() {
+ return getBoolean(KEY_AC_ENABLE);
+ }
+
+ public void setCirculateAirEnable(Boolean circulateAirEnable) {
+ setValue(KEY_CIRCULATE_AIR_ENABLE, circulateAirEnable);
+ }
+
+ public Boolean getCirculateAirEnable() {
+ return getBoolean(KEY_CIRCULATE_AIR_ENABLE);
+ }
+
+ public void setAutoModeEnable(Boolean autoModeEnable) {
+ setValue(KEY_AUTO_MODE_ENABLE, autoModeEnable);
+ }
+
+ public Boolean getAutoModeEnable() {
+ return getBoolean(KEY_AUTO_MODE_ENABLE);
+ }
+
+ public void setDefrostZone(DefrostZone defrostZone) {
+ setValue(KEY_DEFROST_ZONE, defrostZone);
+ }
+
+ public DefrostZone getDefrostZone() {
+ return (DefrostZone) getObject(DefrostZone.class, KEY_DEFROST_ZONE);
+ }
+
+ public void setDualModeEnable(Boolean dualModeEnable) {
+ setValue(KEY_DUAL_MODE_ENABLE, dualModeEnable);
+ }
+
+ public Boolean getDualModeEnable() {
+ return getBoolean(KEY_DUAL_MODE_ENABLE);
+ }
+
+ public void setAcMaxEnable(Boolean acMaxEnable) {
+ setValue(KEY_AC_MAX_ENABLE, acMaxEnable);
+ }
+
+ public Boolean getAcMaxEnable() {
+ return getBoolean(KEY_AC_MAX_ENABLE);
+ }
+
+ public void setVentilationMode(VentilationMode ventilationMode) {
+ setValue(KEY_VENTILATION_MODE, ventilationMode);
+ }
+
+ public VentilationMode getVentilationMode() {
+ return (VentilationMode) getObject(VentilationMode.class, KEY_VENTILATION_MODE);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java
index c58f70b50..3f663ca35 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -70,26 +72,33 @@ public class ClusterModeStatus extends RPCStruct {
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 void setPowerModeActive(Boolean powerModeActive) {
+ public void setPowerModeActive(@NonNull Boolean powerModeActive) {
setValue(KEY_POWER_MODE_ACTIVE, powerModeActive);
}
public Boolean getPowerModeActive() {
return getBoolean(KEY_POWER_MODE_ACTIVE);
}
- public void setPowerModeQualificationStatus(PowerModeQualificationStatus powerModeQualificationStatus) {
+ public void setPowerModeQualificationStatus(@NonNull PowerModeQualificationStatus powerModeQualificationStatus) {
setValue(KEY_POWER_MODE_QUALIFICATION_STATUS, powerModeQualificationStatus);
}
public PowerModeQualificationStatus getPowerModeQualificationStatus() {
return (PowerModeQualificationStatus) getObject(PowerModeQualificationStatus.class, KEY_POWER_MODE_QUALIFICATION_STATUS);
}
- public void setCarModeStatus(CarModeStatus carModeStatus) {
+ public void setCarModeStatus(@NonNull CarModeStatus carModeStatus) {
setValue(KEY_CAR_MODE_STATUS, carModeStatus);
}
public CarModeStatus getCarModeStatus() {
return (CarModeStatus) getObject(CarModeStatus.class, KEY_CAR_MODE_STATUS);
}
- public void setPowerModeStatus(PowerModeStatus powerModeStatus) {
+ public void setPowerModeStatus(@NonNull PowerModeStatus powerModeStatus) {
setValue(KEY_POWER_MODE_STATUS, powerModeStatus);
}
public PowerModeStatus getPowerModeStatus() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Coordinate.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Coordinate.java
index 433f9540b..f886ff52a 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Coordinate.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Coordinate.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.util.SdlDataTypeConverter;
@@ -16,12 +18,18 @@ public class Coordinate extends RPCStruct{
super(hash);
}
+ public Coordinate(@NonNull Float latitudeDegrees, @NonNull Float longitudeDegrees) {
+ this();
+ setLatitudeDegrees(latitudeDegrees);
+ setLongitudeDegrees(longitudeDegrees);
+ }
+
public Float getLatitudeDegrees() {
Object value = getValue(KEY_LATITUDE_DEGREES);
return SdlDataTypeConverter.objectToFloat(value);
}
- public void setLatitudeDegrees(Float latitudeDegrees) {
+ public void setLatitudeDegrees(@NonNull Float latitudeDegrees) {
setValue(KEY_LATITUDE_DEGREES, latitudeDegrees);
}
@@ -30,7 +38,7 @@ public class Coordinate extends RPCStruct{
return SdlDataTypeConverter.objectToFloat(value);
}
- public void setLongitudeDegrees(Float longitudeDegrees) {
+ public void setLongitudeDegrees(@NonNull Float longitudeDegrees) {
setValue(KEY_LONGITUDE_DEGREES, longitudeDegrees);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
index dc813d048..07f17d1e6 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -94,6 +96,18 @@ public class CreateInteractionChoiceSet extends RPCRequest {
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
@@ -109,7 +123,7 @@ public class CreateInteractionChoiceSet extends RPCRequest {
*
* <b>Notes: </b>Min Value: 0; Max Value: 2000000000
*/
- public void setInteractionChoiceSetID( Integer interactionChoiceSetID ) {
+ public void setInteractionChoiceSetID( @NonNull Integer interactionChoiceSetID ) {
setParameters(KEY_INTERACTION_CHOICE_SET_ID, interactionChoiceSetID);
}
/**
@@ -131,7 +145,7 @@ public class CreateInteractionChoiceSet extends RPCRequest {
*
* <b>Notes: </b>Min Value: 1; Max Value: 100
*/
- public void setChoiceSet( List<Choice> choiceSet ) {
+ public void setChoiceSet( @NonNull List<Choice> choiceSet ) {
setParameters(KEY_CHOICE_SET, choiceSet);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java
index 36adc2857..db368bb61 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Create Interaction ChoiceSet Response is sent, when CreateInteractionChoiceSet
@@ -22,4 +25,15 @@ public class CreateInteractionChoiceSetResponse extends RPCResponse {
public CreateInteractionChoiceSetResponse(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a new CreateInteractionChoiceSetResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public CreateInteractionChoiceSetResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DIDResult.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DIDResult.java
index cd9d24c78..b739e8789 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DIDResult.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DIDResult.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -58,13 +60,18 @@ public class DIDResult extends RPCStruct {
public DIDResult(Hashtable<String, Object> hash) {
super(hash);
}
- public void setResultCode(VehicleDataResultCode resultCode) {
+ public DIDResult(@NonNull VehicleDataResultCode resultCode, @NonNull Integer didLocation) {
+ this();
+ setResultCode(resultCode);
+ setDidLocation(didLocation);
+ }
+ public void setResultCode(@NonNull VehicleDataResultCode resultCode) {
setValue(KEY_RESULT_CODE, resultCode);
}
public VehicleDataResultCode getResultCode() {
return (VehicleDataResultCode) getObject(VehicleDataResultCode.class, KEY_RESULT_CODE);
}
- public void setDidLocation(Integer didLocation) {
+ public void setDidLocation(@NonNull Integer didLocation) {
setValue(KEY_DID_LOCATION, didLocation);
}
public Integer getDidLocation() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommand.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommand.java
index 5c5820fbd..b08fa56c3 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommand.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommand.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -73,6 +75,14 @@ public class DeleteCommand extends RPCRequest {
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
*
@@ -90,7 +100,7 @@ public class DeleteCommand extends RPCRequest {
*
* <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000</p>
*/
- public void setCmdID( Integer cmdID ) {
+ public void setCmdID( @NonNull Integer cmdID ) {
setParameters(KEY_CMD_ID, cmdID);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java
index ad905b1e0..c6b5c994c 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Delete Command Response is sent, when DeleteCommand has been called.
@@ -21,4 +24,14 @@ public class DeleteCommandResponse extends RPCResponse {
public DeleteCommandResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new DeleteCommandResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public DeleteCommandResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFile.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFile.java
index 7be0e7859..c9a0e76c7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFile.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFile.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -55,22 +57,28 @@ public class DeleteFile extends RPCRequest {
/**
* <p>Constructs a new DeleteFile object indicated by the Hashtable parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
+ * @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);
+ }
+
+ /**
* Sets a file reference name
*
* @param sdlFileName
* a String value representing a file reference name
*/
- public void setSdlFileName(String sdlFileName) {
+ public void setSdlFileName(@NonNull String sdlFileName) {
setParameters(KEY_SDL_FILE_NAME, sdlFileName);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
index 499b5e518..347cd0490 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
@@ -22,10 +25,23 @@ public class DeleteFileResponse extends RPCResponse {
public DeleteFileResponse(Hashtable<String, Object> hash) {
super(hash);
}
- public void setSpaceAvailable(Integer spaceAvailable) {
+ /**
+ * Constructs a new DeleteFileResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ * @param spaceAvailable the total local space available on the module for the registered app.
+ */
+ public DeleteFileResponse(@NonNull Boolean success, @NonNull Result resultCode, @NonNull Integer spaceAvailable) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ setSpaceAvailable(spaceAvailable);
+ }
+ public void setSpaceAvailable(@NonNull Integer spaceAvailable) {
setParameters(KEY_SPACE_AVAILABLE, spaceAvailable);
}
public Integer getSpaceAvailable() {
return getInteger(KEY_SPACE_AVAILABLE);
}
+
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
index 41e884bce..741675419 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -79,6 +81,15 @@ public class DeleteInteractionChoiceSet extends RPCRequest {
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);
+ }
+ /**
* Gets a unique ID that identifies the Choice Set
* @return Integer -an Integer value representing the unique Choice Set ID
*/
@@ -90,7 +101,7 @@ public class DeleteInteractionChoiceSet extends RPCRequest {
* @param interactionChoiceSetID a unique ID that identifies the Choice Set
* <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000 </p>
*/
- public void setInteractionChoiceSetID( Integer interactionChoiceSetID ) {
+ public void setInteractionChoiceSetID( @NonNull Integer interactionChoiceSetID ) {
setParameters(KEY_INTERACTION_CHOICE_SET_ID, interactionChoiceSetID);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java
index 5f29ed567..d122975a0 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Delete Interaction ChoiceSet Response is sent, when DeleteInteractionChoiceSet has been called
@@ -18,4 +21,14 @@ public class DeleteInteractionChoiceSetResponse extends RPCResponse {
public DeleteInteractionChoiceSetResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new DeleteInteractionChoiceSetResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public DeleteInteractionChoiceSetResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
index db3524aa1..97c4042e3 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -68,6 +70,16 @@ public class DeleteSubMenu extends RPCRequest {
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>
+ */
+ 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
*/
@@ -80,7 +92,7 @@ public class DeleteSubMenu extends RPCRequest {
*
* <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000</p>
*/
- public void setMenuID( Integer menuID ) {
+ public void setMenuID( @NonNull Integer menuID ) {
setParameters(KEY_MENU_ID, menuID);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java
index 3e2c36dd4..d13c850df 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Delete SubMenu Response is sent, when DeleteSubMenu has been called
@@ -21,4 +24,14 @@ public class DeleteSubMenuResponse extends RPCResponse {
public DeleteSubMenuResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new DeleteSubMenuResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public DeleteSubMenuResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeviceStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeviceStatus.java
index d90c4631f..40382b81a 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeviceStatus.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DeviceStatus.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.DeviceLevelStatus;
import com.smartdevicelink.proxy.rpc.enums.PrimaryAudioSource;
@@ -126,12 +128,42 @@ public class DeviceStatus extends RPCStruct {
public DeviceStatus(Hashtable<String, Object> hash) {
super(hash);
}
-
+
+ /**
+ * 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 textmessage 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 eCallEventActive
+ */
+ public DeviceStatus(@NonNull Boolean voiceRecOn, @NonNull Boolean btIconOn, @NonNull Boolean callActive, @NonNull Boolean phoneRoaming, @NonNull Boolean textMsgAvailable, @NonNull DeviceLevelStatus battLevelStatus,
+ @NonNull Boolean stereoAudioOutputMuted, @NonNull Boolean monoAudioOutputMuted, @NonNull DeviceLevelStatus signalLevelStatus, @NonNull PrimaryAudioSource primaryAudioSource, @NonNull Boolean eCallEventActive) {
+ this();
+ setVoiceRecOn(voiceRecOn);
+ setBtIconOn(btIconOn);
+ setCallActive(callActive);
+ setPhoneRoaming(phoneRoaming);
+ setTextMsgAvailable(textMsgAvailable);
+ setBattLevelStatus(battLevelStatus);
+ setStereoAudioOutputMuted(stereoAudioOutputMuted);
+ setMonoAudioOutputMuted(monoAudioOutputMuted);
+ setSignalLevelStatus(signalLevelStatus);
+ setPrimaryAudioSource(primaryAudioSource);
+ setECallEventActive(eCallEventActive);
+ }
+
/**
* set the voice recognition on or off
* @param voiceRecOn
*/
- public void setVoiceRecOn(Boolean voiceRecOn) {
+ public void setVoiceRecOn(@NonNull Boolean voiceRecOn) {
setValue(KEY_VOICE_REC_ON, voiceRecOn);
}
@@ -147,7 +179,7 @@ public class DeviceStatus extends RPCStruct {
* set the bluetooth connection established
* @param btIconOn the bluetooth connection established
*/
- public void setBtIconOn(Boolean btIconOn) {
+ public void setBtIconOn(@NonNull Boolean btIconOn) {
setValue(KEY_BT_ICON_ON, btIconOn);
}
@@ -163,7 +195,7 @@ public class DeviceStatus extends RPCStruct {
* set a call is being active
* @param callActive a call is being active
*/
- public void setCallActive(Boolean callActive) {
+ public void setCallActive(@NonNull Boolean callActive) {
setValue(KEY_CALL_ACTIVE, callActive);
}
@@ -179,7 +211,7 @@ public class DeviceStatus extends RPCStruct {
* set the phone is in roaming mode
* @param phoneRoaming the phone is in roaming mode
*/
- public void setPhoneRoaming(Boolean phoneRoaming) {
+ public void setPhoneRoaming(@NonNull Boolean phoneRoaming) {
setValue(KEY_PHONE_ROAMING, phoneRoaming);
}
@@ -190,7 +222,7 @@ public class DeviceStatus extends RPCStruct {
public Boolean getPhoneRoaming() {
return getBoolean(KEY_PHONE_ROAMING);
}
- public void setTextMsgAvailable(Boolean textMsgAvailable) {
+ public void setTextMsgAvailable(@NonNull Boolean textMsgAvailable) {
setValue(KEY_TEXT_MSG_AVAILABLE, textMsgAvailable);
}
@@ -206,7 +238,7 @@ public class DeviceStatus extends RPCStruct {
* set battery level status
* @param battLevelStatus battery level status
*/
- public void setBattLevelStatus(DeviceLevelStatus battLevelStatus) {
+ public void setBattLevelStatus(@NonNull DeviceLevelStatus battLevelStatus) {
setValue(KEY_BATT_LEVEL_STATUS, battLevelStatus);
}
@@ -222,7 +254,7 @@ public class DeviceStatus extends RPCStruct {
* set the status of the stereo audio output channel
* @param stereoAudioOutputMuted the status of the stereo audio output channel
*/
- public void setStereoAudioOutputMuted(Boolean stereoAudioOutputMuted) {
+ public void setStereoAudioOutputMuted(@NonNull Boolean stereoAudioOutputMuted) {
setValue(KEY_STEREO_AUDIO_OUTPUT_MUTED, stereoAudioOutputMuted);
}
@@ -238,7 +270,7 @@ public class DeviceStatus extends RPCStruct {
* set the status of the mono audio output channel
* @param monoAudioOutputMuted the status of the mono audio output channel
*/
- public void setMonoAudioOutputMuted(Boolean monoAudioOutputMuted) {
+ public void setMonoAudioOutputMuted(@NonNull Boolean monoAudioOutputMuted) {
setValue(KEY_MONO_AUDIO_OUTPUT_MUTED, monoAudioOutputMuted);
}
@@ -254,7 +286,7 @@ public class DeviceStatus extends RPCStruct {
* set signal level status
* @param signalLevelStatus signal level status
*/
- public void setSignalLevelStatus(DeviceLevelStatus signalLevelStatus) {
+ public void setSignalLevelStatus(@NonNull DeviceLevelStatus signalLevelStatus) {
setValue(KEY_SIGNAL_LEVEL_STATUS, signalLevelStatus);
}
@@ -270,7 +302,7 @@ public class DeviceStatus extends RPCStruct {
* set the current primary audio source of SDL (if selected).
* @param primaryAudioSource the current primary audio source of SDL (if selected).
*/
- public void setPrimaryAudioSource(PrimaryAudioSource primaryAudioSource) {
+ public void setPrimaryAudioSource(@NonNull PrimaryAudioSource primaryAudioSource) {
setValue(KEY_PRIMARY_AUDIO_SOURCE, primaryAudioSource);
}
@@ -281,7 +313,7 @@ public class DeviceStatus extends RPCStruct {
public PrimaryAudioSource getPrimaryAudioSource() {
return (PrimaryAudioSource) getObject(PrimaryAudioSource.class, KEY_PRIMARY_AUDIO_SOURCE);
}
- public void setECallEventActive(Boolean eCallEventActive) {
+ public void setECallEventActive(@NonNull Boolean eCallEventActive) {
setValue(KEY_E_CALL_EVENT_ACTIVE, eCallEventActive);
}
public Boolean getECallEventActive() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
index f83c07735..3d40ba31d 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -79,9 +81,19 @@ public class DiagnosticMessage extends RPCRequest {
*
* @param targetID
*/
-
- public void setTargetID(Integer targetID) {
+
+ /**
+ * Constructs a new DiagnosticMessage object
+ */
+ public DiagnosticMessage(@NonNull Integer targetID, @NonNull Integer messageLength, @NonNull List<Integer> messageData) {
+ this();
+ setTargetID(targetID);
+ setMessageLength(messageLength);
+ setMessageData(messageData);
+ }
+
+ public void setTargetID(@NonNull Integer targetID) {
setParameters(KEY_TARGET_ID, targetID);
}
/**
@@ -96,7 +108,7 @@ public class DiagnosticMessage extends RPCRequest {
return getInteger(KEY_TARGET_ID);
}
- public void setMessageLength(Integer messageLength) {
+ public void setMessageLength(@NonNull Integer messageLength) {
setParameters(KEY_MESSAGE_LENGTH, messageLength);
}
public Integer getMessageLength() {
@@ -108,7 +120,7 @@ public class DiagnosticMessage extends RPCRequest {
return (List<Integer>) getObject(Integer.class, KEY_MESSAGE_DATA);
}
- public void setMessageData(List<Integer> messageData) {
+ public void setMessageData(@NonNull List<Integer> messageData) {
setParameters(KEY_MESSAGE_DATA, messageData);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
index c478496f7..096acbd50 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
import java.util.List;
@@ -23,12 +26,25 @@ public class DiagnosticMessageResponse extends RPCResponse {
public DiagnosticMessageResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new DiagnosticMessageResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public DiagnosticMessageResponse(@NonNull Boolean success, @NonNull Result resultCode, @NonNull List<Integer> messageDataResult) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ setMessageDataResult(messageDataResult);
+ }
@SuppressWarnings("unchecked")
public List<Integer> getMessageDataResult() {
return (List<Integer>) getObject(Integer.class, KEY_MESSAGE_DATA_RESULT);
}
- public void setMessageDataResult(List<Integer> messageDataResult) {
+ public void setMessageDataResult(@NonNull List<Integer> messageDataResult) {
setParameters(KEY_MESSAGE_DATA_RESULT, messageDataResult);
}
+
+
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DialNumber.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DialNumber.java
index 4afc68a0c..4707efc86 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DialNumber.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DialNumber.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -22,6 +24,10 @@ public class DialNumber extends RPCRequest {
super(hash);
}
+ public DialNumber(@NonNull String number){
+ this();
+ setNumber(number);
+ }
/**
* Sets a number to dial
*
@@ -31,7 +37,7 @@ public class DialNumber extends RPCRequest {
* <b>Notes: </b>Maxlength=40</p>
* All characters shall be stripped from string except digits 0-9 and * # , ; +
*/
- public void setNumber(String number) {
+ public void setNumber(@NonNull String number) {
if (number != null) {
number = number.replaceAll("[^0-9*#,;+]", ""); //This will sanitize the input
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DialNumberResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DialNumberResponse.java
index 613755442..ff2cef3be 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DialNumberResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DialNumberResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Dial Number Response is sent, when DialNumber has been called
@@ -20,4 +23,14 @@ public class DialNumberResponse extends RPCResponse {
super(hash);
}
+ /**
+ * Constructs a new DialNumberResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public DialNumberResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
index 69928a128..12bf0ffd8 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
@@ -75,6 +77,20 @@ public class DisplayCapabilities extends RPCStruct {
super(hash);
}
/**
+ * Constructs a newly allocated DisplayCapabilities object
+ * @param displayType the display type
+ * @param textFields the List of textFields
+ * @param mediaClockFormats the List of MediaClockFormat
+ * @param graphicSupported
+ */
+ public DisplayCapabilities(@NonNull DisplayType displayType, @NonNull List<TextField> textFields, @NonNull List<MediaClockFormat> mediaClockFormats, @NonNull Boolean graphicSupported) {
+ this();
+ setDisplayType(displayType);
+ setTextFields(textFields);
+ setMediaClockFormats(mediaClockFormats);
+ setGraphicSupported(graphicSupported);
+ }
+ /**
* Get the type of display
* @return the type of display
*/
@@ -85,7 +101,7 @@ public class DisplayCapabilities extends RPCStruct {
* Set the type of display
* @param displayType the display type
*/
- public void setDisplayType( DisplayType displayType ) {
+ public void setDisplayType( @NonNull DisplayType displayType ) {
setValue(KEY_DISPLAY_TYPE, displayType);
}
/**
@@ -102,7 +118,7 @@ public class DisplayCapabilities extends RPCStruct {
* 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 void setTextFields( List<TextField> textFields ) {
+ public void setTextFields( @NonNull List<TextField> textFields ) {
setValue(KEY_TEXT_FIELDS, textFields);
}
@@ -137,7 +153,7 @@ public class DisplayCapabilities extends RPCStruct {
* 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 void setMediaClockFormats( List<MediaClockFormat> mediaClockFormats ) {
+ public void setMediaClockFormats( @NonNull List<MediaClockFormat> mediaClockFormats ) {
setValue(KEY_MEDIA_CLOCK_FORMATS, mediaClockFormats);
}
@@ -146,7 +162,7 @@ public class DisplayCapabilities extends RPCStruct {
* @param graphicSupported
* @since SmartDeviceLink 2.0
*/
- public void setGraphicSupported(Boolean graphicSupported) {
+ public void setGraphicSupported(@NonNull Boolean graphicSupported) {
setValue(KEY_GRAPHIC_SUPPORTED, graphicSupported);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ECallInfo.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ECallInfo.java
index da6c37d9a..b62620026 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ECallInfo.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ECallInfo.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.ECallConfirmationStatus;
+import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataNotificationStatus;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataResultCode;
@@ -57,30 +60,39 @@ 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 indicated by the Hashtable
- * parameter
- * @param hash
- *
- * <p>The hash table to use</p>
+ /** 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
+ */
+ public ECallInfo(@NonNull VehicleDataNotificationStatus eCallNotificationStatus, @NonNull VehicleDataNotificationStatus auxECallNotificationStatus, @NonNull ECallConfirmationStatus eCallConfirmationStatus) {
+ this();
+ setECallNotificationStatus(eCallNotificationStatus);
+ setAuxECallNotificationStatus(auxECallNotificationStatus);
+ setECallConfirmationStatus(eCallConfirmationStatus);
+ }
- public void setECallNotificationStatus(VehicleDataNotificationStatus eCallNotificationStatus) {
+ public void setECallNotificationStatus(@NonNull VehicleDataNotificationStatus eCallNotificationStatus) {
setValue(KEY_E_CALL_NOTIFICATION_STATUS, eCallNotificationStatus);
}
public VehicleDataNotificationStatus getECallNotificationStatus() {
return (VehicleDataNotificationStatus) getObject(VehicleDataNotificationStatus.class, KEY_E_CALL_NOTIFICATION_STATUS);
}
- public void setAuxECallNotificationStatus(VehicleDataNotificationStatus auxECallNotificationStatus) {
+ public void setAuxECallNotificationStatus(@NonNull VehicleDataNotificationStatus auxECallNotificationStatus) {
setValue(KEY_AUX_E_CALL_NOTIFICATION_STATUS, auxECallNotificationStatus);
}
public VehicleDataNotificationStatus getAuxECallNotificationStatus() {
return (VehicleDataNotificationStatus) getObject(VehicleDataNotificationStatus.class, KEY_AUX_E_CALL_NOTIFICATION_STATUS);
}
- public void setECallConfirmationStatus(ECallConfirmationStatus eCallConfirmationStatus) {
+ public void setECallConfirmationStatus(@NonNull ECallConfirmationStatus eCallConfirmationStatus) {
setValue(KEY_E_CALL_CONFIRMATION_STATUS, eCallConfirmationStatus);
}
public ECallConfirmationStatus getECallConfirmationStatus() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/EmergencyEvent.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/EmergencyEvent.java
index 19b8f69bb..0bc0a2e67 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/EmergencyEvent.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/EmergencyEvent.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -79,44 +81,55 @@ public class EmergencyEvent extends RPCStruct {
public static final String KEY_ROLLOVER_EVENT = "rolloverEvent";
public static final String KEY_MAXIMUM_CHANGE_VELOCITY = "maximumChangeVelocity";
public static final String KEY_MULTIPLE_EVENTS = "multipleEvents";
-
- /** Constructs a new EmergencyEvent object indicated by the Hashtable
- * parameter
- * @param hash
- *
- * <p>The hash table to use</p>
- */
+ /** Constructs a new EmergencyEvent object
+ *
+ */
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
+ */
+ public EmergencyEvent(@NonNull EmergencyEventType emergencyEventType, @NonNull FuelCutoffStatus fuelCutoffStatus, @NonNull VehicleDataEventStatus rolloverEvent, @NonNull Integer maximumChangeVelocity, @NonNull VehicleDataEventStatus multipleEvents) {
+ this();
+ setEmergencyEventType(emergencyEventType);
+ setFuelCutoffStatus(fuelCutoffStatus);
+ setRolloverEvent(rolloverEvent);
+ setMaximumChangeVelocity(maximumChangeVelocity);
+ setMultipleEvents(multipleEvents);
+ }
- public void setEmergencyEventType(EmergencyEventType emergencyEventType) {
+ public void setEmergencyEventType(@NonNull EmergencyEventType emergencyEventType) {
setValue(KEY_EMERGENCY_EVENT_TYPE, emergencyEventType);
}
public EmergencyEventType getEmergencyEventType() {
return (EmergencyEventType) getObject(EmergencyEventType.class, KEY_EMERGENCY_EVENT_TYPE);
}
- public void setFuelCutoffStatus(FuelCutoffStatus fuelCutoffStatus) {
+ public void setFuelCutoffStatus(@NonNull FuelCutoffStatus fuelCutoffStatus) {
setValue(KEY_FUEL_CUTOFF_STATUS, fuelCutoffStatus);
}
public FuelCutoffStatus getFuelCutoffStatus() {
return (FuelCutoffStatus) getObject(FuelCutoffStatus.class, KEY_FUEL_CUTOFF_STATUS);
}
- public void setRolloverEvent(VehicleDataEventStatus rolloverEvent) {
+ public void setRolloverEvent(@NonNull VehicleDataEventStatus rolloverEvent) {
setValue(KEY_ROLLOVER_EVENT, rolloverEvent);
}
public VehicleDataEventStatus getRolloverEvent() {
return (VehicleDataEventStatus) getObject(VehicleDataEventStatus.class, KEY_ROLLOVER_EVENT);
}
- public void setMaximumChangeVelocity(Integer maximumChangeVelocity) {
+ public void setMaximumChangeVelocity(@NonNull Integer maximumChangeVelocity) {
setValue(KEY_MAXIMUM_CHANGE_VELOCITY, maximumChangeVelocity);
}
public Integer getMaximumChangeVelocity() {
return getInteger(KEY_MAXIMUM_CHANGE_VELOCITY);
}
- public void setMultipleEvents(VehicleDataEventStatus multipleEvents) {
+ public void setMultipleEvents(@NonNull VehicleDataEventStatus multipleEvents) {
setValue(KEY_MULTIPLE_EVENTS, multipleEvents);
}
public VehicleDataEventStatus getMultipleEvents() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java
index 4f7a09f7b..fddb8a30c 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* End Audio Pass Thru Response is sent, when EndAudioPassThru has been called
@@ -21,4 +24,14 @@ public class EndAudioPassThruResponse extends RPCResponse {
public EndAudioPassThruResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new EndAudioPassThruResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public EndAudioPassThruResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
index fec91005b..274e5c1be 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.CompassDirection;
import com.smartdevicelink.proxy.rpc.enums.Dimension;
@@ -175,12 +177,40 @@ public class GPSData extends RPCStruct {
public GPSData(Hashtable<String, Object> hash) {
super(hash);
}
-
+
+ /**
+ * Constructs a newly allocated GPSData object
+ */
+ public GPSData(@NonNull Double longitudeDegrees, @NonNull Double latitudeDegrees, @NonNull Integer utcYear,
+ @NonNull Integer utcMonth, @NonNull Integer utcDay, @NonNull Integer utcHours,
+ @NonNull Integer utcMinutes, @NonNull Integer utcSeconds, @NonNull CompassDirection compassDirection,
+ @NonNull Double pdop, @NonNull Double hdop, @NonNull Double vdop, @NonNull Boolean actual,
+ @NonNull Integer satellites, @NonNull Dimension dimension, @NonNull Double altitude, @NonNull Double heading, @NonNull Double speed) {
+ this();
+ setLongitudeDegrees(longitudeDegrees);
+ setLatitudeDegrees(latitudeDegrees);
+ setUtcYear(utcYear);
+ setUtcMonth(utcMonth);
+ setUtcDay(utcDay);
+ setUtcHours(utcHours);
+ setUtcMinutes(utcMinutes);
+ setUtcSeconds(utcSeconds);
+ setCompassDirection(compassDirection);
+ setPdop(pdop);
+ setHdop(hdop);
+ setVdop(vdop);
+ setActual(actual);
+ setSatellites(satellites);
+ setDimension(dimension);
+ setAltitude(altitude);
+ setHeading(heading);
+ setSpeed(speed);
+ }
/**
* set longitude degrees
* @param longitudeDegrees
*/
- public void setLongitudeDegrees(Double longitudeDegrees) {
+ public void setLongitudeDegrees(@NonNull Double longitudeDegrees) {
setValue(KEY_LONGITUDE_DEGREES, longitudeDegrees);
}
@@ -197,7 +227,7 @@ public class GPSData extends RPCStruct {
* set latitude degrees
* @param latitudeDegrees latitude degrees
*/
- public void setLatitudeDegrees(Double latitudeDegrees) {
+ public void setLatitudeDegrees(@NonNull Double latitudeDegrees) {
setValue(KEY_LATITUDE_DEGREES, latitudeDegrees);
}
@@ -214,7 +244,7 @@ public class GPSData extends RPCStruct {
* set utc year
* @param utcYear utc year
*/
- public void setUtcYear(Integer utcYear) {
+ public void setUtcYear(@NonNull Integer utcYear) {
setValue(KEY_UTC_YEAR, utcYear);
}
@@ -230,7 +260,7 @@ public class GPSData extends RPCStruct {
* set utc month
* @param utcMonth utc month
*/
- public void setUtcMonth(Integer utcMonth) {
+ public void setUtcMonth(@NonNull Integer utcMonth) {
setValue(KEY_UTC_MONTH, utcMonth);
}
@@ -246,7 +276,7 @@ public class GPSData extends RPCStruct {
* set utc day
* @param utcDay utc day
*/
- public void setUtcDay(Integer utcDay) {
+ public void setUtcDay(@NonNull Integer utcDay) {
setValue(KEY_UTC_DAY, utcDay);
}
@@ -262,7 +292,7 @@ public class GPSData extends RPCStruct {
* set utc hours
* @param utcHours utc hours
*/
- public void setUtcHours(Integer utcHours) {
+ public void setUtcHours(@NonNull Integer utcHours) {
setValue(KEY_UTC_HOURS, utcHours);
}
@@ -278,7 +308,7 @@ public class GPSData extends RPCStruct {
* set utc minutes
* @param utcMinutes utc minutes
*/
- public void setUtcMinutes(Integer utcMinutes) {
+ public void setUtcMinutes(@NonNull Integer utcMinutes) {
setValue(KEY_UTC_MINUTES, utcMinutes);
}
@@ -294,7 +324,7 @@ public class GPSData extends RPCStruct {
* set utc seconds
* @param utcSeconds utc seconds
*/
- public void setUtcSeconds(Integer utcSeconds) {
+ public void setUtcSeconds(@NonNull Integer utcSeconds) {
setValue(KEY_UTC_SECONDS, utcSeconds);
}
@@ -305,7 +335,7 @@ public class GPSData extends RPCStruct {
public Integer getUtcSeconds() {
return getInteger(KEY_UTC_SECONDS);
}
- public void setCompassDirection(CompassDirection compassDirection) {
+ public void setCompassDirection(@NonNull CompassDirection compassDirection) {
setValue(KEY_COMPASS_DIRECTION, compassDirection);
}
public CompassDirection getCompassDirection() {
@@ -316,7 +346,7 @@ public class GPSData extends RPCStruct {
* set the positional dilution of precision
* @param pdop the positional dilution of precision
*/
- public void setPdop(Double pdop) {
+ public void setPdop(@NonNull Double pdop) {
setValue(KEY_PDOP, pdop);
}
@@ -332,7 +362,7 @@ public class GPSData extends RPCStruct {
* set the horizontal dilution of precision
* @param hdop the horizontal dilution of precision
*/
- public void setHdop(Double hdop) {
+ public void setHdop(@NonNull Double hdop) {
setValue(KEY_HDOP, hdop);
}
@@ -349,7 +379,7 @@ public class GPSData extends RPCStruct {
* set the vertical dilution of precision
* @param vdop the vertical dilution of precision
*/
- public void setVdop(Double vdop) {
+ public void setVdop(@NonNull Double vdop) {
setValue(KEY_VDOP, vdop);
}
@@ -366,7 +396,7 @@ public class GPSData extends RPCStruct {
* set what coordinates based on
* @param actual True, if coordinates are based on satellites.False, if based on dead reckoning
*/
- public void setActual(Boolean actual) {
+ public void setActual(@NonNull Boolean actual) {
setValue(KEY_ACTUAL, actual);
}
@@ -382,7 +412,7 @@ public class GPSData extends RPCStruct {
* set the number of satellites in view
* @param satellites the number of satellites in view
*/
- public void setSatellites(Integer satellites) {
+ public void setSatellites(@NonNull Integer satellites) {
setValue(KEY_SATELLITES, satellites);
}
@@ -393,7 +423,7 @@ public class GPSData extends RPCStruct {
public Integer getSatellites() {
return getInteger(KEY_SATELLITES);
}
- public void setDimension(Dimension dimension) {
+ public void setDimension(@NonNull Dimension dimension) {
setValue(KEY_DIMENSION, dimension);
}
public Dimension getDimension() {
@@ -404,7 +434,7 @@ public class GPSData extends RPCStruct {
* set altitude in meters
* @param altitude altitude in meters
*/
- public void setAltitude(Double altitude) {
+ public void setAltitude(@NonNull Double altitude) {
setValue(KEY_ALTITUDE, altitude);
}
@@ -421,7 +451,7 @@ public class GPSData extends RPCStruct {
* set the heading.North is 0, East is 90, etc.
* @param heading the heading.
*/
- public void setHeading(Double heading) {
+ public void setHeading(@NonNull Double heading) {
setValue(KEY_HEADING, heading);
}
@@ -437,7 +467,7 @@ public class GPSData extends RPCStruct {
* set speed in KPH
* @param speed the speed
*/
- public void setSpeed(Double speed) {
+ public void setSpeed(@NonNull Double speed) {
setValue(KEY_SPEED, speed);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GenericResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GenericResponse.java
index 4618fd857..a92c237e3 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GenericResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GenericResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Generic Response is sent, when the name of a received msg cannot be
@@ -54,4 +57,14 @@ public class GenericResponse extends RPCResponse {
public GenericResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new GenericResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public GenericResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCs.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCs.java
index 83243823e..23eeac0d4 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCs.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCs.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -69,14 +71,23 @@ public class GetDTCs extends RPCRequest {
* <p>Constructs a new GetDTCs object indicated by the Hashtable parameter
* </p>
*
- * @param hash
- * The Hashtable to use
+ * @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);
+ }
+
+ /**
* Sets a name of the module to receive the DTC form
*
* @param ecuName
@@ -85,7 +96,7 @@ public class GetDTCs extends RPCRequest {
* <p>
* <b>Notes:</p> </b>Minvalue:0; Maxvalue:65535
*/
- public void setEcuName(Integer ecuName) {
+ public void setEcuName(@NonNull Integer ecuName) {
setParameters(KEY_ECU_NAME, ecuName);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
index 02d130db8..802f6b34a 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
import java.util.List;
@@ -24,6 +27,19 @@ public class GetDTCsResponse extends RPCResponse{
super(hash);
}
+ /**
+ * Constructs a new GetDTCsResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ * @param ecuHeader
+ */
+ public GetDTCsResponse(@NonNull Boolean success, @NonNull Result resultCode, @NonNull Integer ecuHeader) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ setEcuHeader(ecuHeader);
+ }
+
@SuppressWarnings("unchecked")
public List<String> getDtc(){
return (List<String>) getObject(String.class, KEY_DTC);
@@ -37,7 +53,8 @@ public class GetDTCsResponse extends RPCResponse{
return getInteger(KEY_ECU_HEADER);
}
- public void setEcuHeader(Integer ecuHeader){
+ public void setEcuHeader(@NonNull Integer ecuHeader){
setParameters(KEY_ECU_HEADER, ecuHeader);
}
+
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
new file mode 100644
index 000000000..dc6ab5444
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
@@ -0,0 +1,89 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import java.util.Hashtable;
+
+/**
+ * Read the current status value of specified remote control module (type). In addition,
+ * When subscribe=true, subscribes for specific remote control module data items;
+ * When subscribe=false, un-subscribes for specific remote control module data items.
+ * Once subscribed, the application will be notified by the onInteriorVehicleData notification
+ * 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_SUBSCRIBE = "subscribe";
+
+ /**
+ * Constructs a new GetInteriorVehicleData object
+ */
+ public GetInteriorVehicleData() {
+ super(FunctionID.GET_INTERIOR_VEHICLE_DATA.toString());
+ }
+
+ /**
+ * <p>Constructs a new GetInteriorVehicleData object indicated by the
+ * Hashtable parameter</p>
+ *
+ *
+ * @param hash
+ * The Hashtable to use
+ */
+ public GetInteriorVehicleData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new GetInteriorVehicleData object
+ */
+ public GetInteriorVehicleData(@NonNull ModuleType moduleType) {
+ this();
+ setModuleType(moduleType);
+ }
+
+ /**
+ * Gets the ModuleType
+ *
+ * @return 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 ModuleType getModuleType() {
+ return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setModuleType(@NonNull ModuleType moduleType) {
+ setParameters(KEY_MODULE_TYPE, moduleType);
+ }
+
+ /**
+ * Sets subscribe parameter
+ *
+ * @param subscribe
+ * If subscribe is true, the head unit will register onInteriorVehicleData notifications for the requested moduelType.
+ * If subscribe is false, the head unit will unregister onInteriorVehicleData notifications for the requested moduelType.
+ */
+ public void setSubscribe(Boolean subscribe) {
+ setParameters(KEY_SUBSCRIBE, subscribe);
+ }
+
+ /**
+ * Gets subscribe parameter
+ *
+ * @return Boolean - If subscribe is true, the head unit will register onInteriorVehicleData notifications for the requested moduelType.
+ * If subscribe is false, the head unit will unregister onInteriorVehicleData notifications for the requested moduelType.
+ */
+ public Boolean getSubscribe() {
+ return getBoolean(KEY_SUBSCRIBE);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java
new file mode 100644
index 000000000..88d663805
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java
@@ -0,0 +1,88 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+public class GetInteriorVehicleDataResponse extends RPCResponse {
+ public static final String KEY_MODULE_DATA = "moduleData";
+ public static final String KEY_IS_SUBSCRIBED = "isSubscribed";
+
+ /**
+ * 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
+ */
+ public GetInteriorVehicleDataResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new GetInteriorVehicleDataResponse object
+ * @param moduleData
+ * @param resultCode whether the request is successfully processed
+ * @param success whether the request is successfully processed
+
+ */
+ public GetInteriorVehicleDataResponse( @NonNull ModuleData moduleData, @NonNull Result resultCode, @NonNull Boolean success) {
+ this();
+ setModuleData(moduleData);
+ setResultCode(resultCode);
+ setSuccess(success);
+ }
+
+ /**
+ * Gets the moduleData
+ *
+ * @return ModuleData
+ */
+ public ModuleData getModuleData() {
+ return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA);
+ }
+
+ /**
+ * Sets the moduleData
+ *
+ * @param moduleData
+ */
+ public void setModuleData(ModuleData moduleData) {
+ setParameters(KEY_MODULE_DATA, moduleData);
+ }
+
+ /**
+ * 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 void setIsSubscribed(Boolean isSubscribed) {
+ setParameters(KEY_IS_SUBSCRIBED, isSubscribed);
+ }
+
+ /**
+ * 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/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java
new file mode 100644
index 000000000..031adddcf
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapability.java
@@ -0,0 +1,59 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+
+import java.util.Hashtable;
+
+/**
+ * Used to request the corresponding capability object for a given capability.
+ */
+
+public class GetSystemCapability extends RPCRequest {
+ public static final String KEY_SYSTEM_CAPABILITY_TYPE = "systemCapabilityType";
+
+ /**
+ * Constructs a new GetSystemCapability object
+ */
+ public GetSystemCapability(){
+ super(FunctionID.GET_SYSTEM_CAPABILITY.toString());
+ }
+
+ /**
+ * <p>Constructs a new GetSystemCapability object indicated by the Hashtable parameter</p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
+ public GetSystemCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new GetSystemCapability object
+ * @param systemCapabilityType SystemCapabilityType being requested
+ */
+ public GetSystemCapability(@NonNull SystemCapabilityType systemCapabilityType){
+ this();
+ setSystemCapabilityType(systemCapabilityType);
+ }
+
+ /**
+ * Used to get the SystemCapabilityType being requested
+ * @return the SystemCapabilityType being requested
+ */
+ 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 void setSystemCapabilityType(@NonNull SystemCapabilityType value){
+ setParameters(KEY_SYSTEM_CAPABILITY_TYPE, value);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java
new file mode 100644
index 000000000..afcc8c48c
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java
@@ -0,0 +1,64 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+/**
+ * GetSystemCapabilityResponse is sent, when GetSystemCapability has been called
+ */
+
+public class GetSystemCapabilityResponse extends RPCResponse {
+ public static final String KEY_SYSTEM_CAPABILITY = "systemCapability";
+
+ /**
+ * Constructs a new GetSystemCapability object
+ */
+ 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
+ */
+ public GetSystemCapabilityResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new GetSystemCapabilityResponse object
+ * @param systemCapability SystemCapability object
+ * @param resultCode whether the request is successfully processed
+ * @param success whether the request is successfully processed
+ */
+ public GetSystemCapabilityResponse(@NonNull SystemCapability systemCapability, @NonNull Result resultCode, @NonNull Boolean success) {
+ this();
+ setSystemCapability(systemCapability);
+ setResultCode(resultCode);
+ setSuccess(success);
+ }
+
+ /**
+ * Get the SystemCapability object returned after a GetSystemCapability call
+ * @return SystemCapability object
+ */
+ public SystemCapability getSystemCapability(){
+ return (SystemCapability) getObject(SystemCapability.class, KEY_SYSTEM_CAPABILITY);
+ }
+
+ /**
+ * Set a SystemCapability object in the response
+ * @param value SystemCapability object
+ */
+ public void setSystemCapability(@NonNull SystemCapability value){
+ setParameters(KEY_SYSTEM_CAPABILITY, value);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
index 39e33993b..2a1eb0a2d 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
@@ -1,10 +1,13 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
import com.smartdevicelink.proxy.rpc.enums.PRNDL;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
import com.smartdevicelink.proxy.rpc.enums.WiperStatus;
import com.smartdevicelink.util.SdlDataTypeConverter;
@@ -53,6 +56,16 @@ public class GetVehicleDataResponse extends RPCResponse {
public GetVehicleDataResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new GetVehicleDataResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public GetVehicleDataResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
public void setGps(GPSData gps) {
setParameters(KEY_GPS, gps);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPoints.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPoints.java
index 443e66b3d..95b076e52 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPoints.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPoints.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.WayPointType;
@@ -17,11 +19,16 @@ public class GetWayPoints extends RPCRequest {
super(hash);
}
+ public GetWayPoints(@NonNull WayPointType wayPointType) {
+ this();
+ setWayPointType(wayPointType);
+ }
+
public WayPointType getWayPointType() {
return (WayPointType) getObject(WayPointType.class, KEY_WAY_POINT_TYPE);
}
- public void setWayPointType(WayPointType wayPointType) {
+ public void setWayPointType(@NonNull WayPointType wayPointType) {
setParameters(KEY_WAY_POINT_TYPE, wayPointType);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPointsResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPointsResponse.java
index 13eb85642..32344ffbd 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPointsResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetWayPointsResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
import java.util.List;
@@ -15,7 +18,16 @@ public class GetWayPointsResponse extends RPCResponse {
public GetWayPointsResponse(Hashtable<String, Object> hash) {
super(hash);
}
-
+ /**
+ * Constructs a new GetWayPointsResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public GetWayPointsResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
public void setWayPoints(List<LocationDetails> wayPoints) {
setParameters(KEY_WAY_POINTS, wayPoints);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java
index accc18aba..8f4cdfe66 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java
@@ -7,8 +7,10 @@ import java.util.Hashtable;
public class HMICapabilities extends RPCStruct{
public static final String KEY_NAVIGATION = "navigation";
public static final String KEY_PHONE_CALL = "phoneCall";
-
- public HMICapabilities() { }
+ public static final String KEY_VIDEO_STREAMING = "videoStreaming";
+ public static final String KEY_REMOTE_CONTROL = "remoteControl";
+
+ public HMICapabilities() { }
public HMICapabilities(Hashtable<String, Object> hash) {
super(hash);
@@ -38,4 +40,29 @@ public class HMICapabilities extends RPCStruct{
setValue(KEY_PHONE_CALL, available);
}
+ public boolean isVideoStreamingAvailable(){
+ Object available = getValue(KEY_VIDEO_STREAMING);
+ if(available == null){
+ return false;
+ }
+ return (Boolean)available;
+ }
+
+ public void setVideoStreamingAvailable(Boolean available){
+ setValue(KEY_VIDEO_STREAMING, available);
+ }
+
+ public boolean isRemoteControlAvailable(){
+ Object available = getValue(KEY_REMOTE_CONTROL);
+ if(available == null){
+ return false;
+ }
+ return (Boolean)available;
+ }
+
+ public void setRemoteControlAvailable(Boolean available){
+ setValue(KEY_REMOTE_CONTROL, available);
+ }
+
+
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMIPermissions.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMIPermissions.java
index bf2184d0c..307ff8b06 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMIPermissions.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMIPermissions.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
@@ -56,7 +58,16 @@ public class HMIPermissions extends RPCStruct {
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
+ */
+ 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
@@ -70,7 +81,7 @@ public class HMIPermissions extends RPCStruct {
* set HMI level that is permitted for this given RPC.
* @param allowed HMI level that is permitted for this given RPC
*/
- public void setAllowed(List<HMILevel> allowed) {
+ public void setAllowed(@NonNull List<HMILevel> allowed) {
setValue(KEY_ALLOWED, allowed);
}
@@ -87,7 +98,7 @@ public class HMIPermissions extends RPCStruct {
* 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
*/
- public void setUserDisallowed(List<HMILevel> userDisallowed) {
+ public void setUserDisallowed(@NonNull List<HMILevel> userDisallowed) {
setValue(KEY_USER_DISALLOWED, userDisallowed);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java
new file mode 100644
index 000000000..a102f3eb1
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java
@@ -0,0 +1,89 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/*
+ * Copyright (c) 2017 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * Defines a haptic rectangle that contains a reference ID and the spatial data of a rectangle UI component.
+ * @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 HapticRect() {}
+
+ public HapticRect(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ 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 void setId(@NonNull Integer id) {
+ setValue(KEY_ID, 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 void setRect(@NonNull Rectangle rect) {
+ setValue(KEY_RECT, 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/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HeadLampStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HeadLampStatus.java
index 935b8357e..68ffc88ad 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HeadLampStatus.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HeadLampStatus.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -44,29 +46,40 @@ 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_LOW_BEAMS_ON = "lowBeamsOn";
- /**<p> Constructs a new HeadLampStatus object indicated by the Hashtable
- * parameter</p>
- * @param hash
- * The hash table to use
- */
+ /**
+ * Constructs a new HeadLampStatus object
+ */
public HeadLampStatus() {}
+ /**
+ * <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
+ */
+ public HeadLampStatus(@NonNull Boolean lowBeamsOn, @NonNull Boolean highBeamsOn) {
+ this();
+ setLowBeamsOn(lowBeamsOn);
+ setHighBeamsOn(highBeamsOn);
+ }
public void setAmbientLightStatus(AmbientLightStatus ambientLightSensorStatus) {
setValue(KEY_AMBIENT_LIGHT_SENSOR_STATUS, ambientLightSensorStatus);
}
public AmbientLightStatus getAmbientLightStatus() {
return (AmbientLightStatus) getObject(AmbientLightStatus.class, KEY_AMBIENT_LIGHT_SENSOR_STATUS);
}
- public void setHighBeamsOn(Boolean highBeamsOn) {
+ public void setHighBeamsOn(@NonNull Boolean highBeamsOn) {
setValue(KEY_HIGH_BEAMS_ON, highBeamsOn);
}
public Boolean getHighBeamsOn() {
return getBoolean(KEY_HIGH_BEAMS_ON);
}
- public void setLowBeamsOn(Boolean lowBeamsOn) {
+ public void setLowBeamsOn(@NonNull Boolean lowBeamsOn) {
setValue(KEY_LOW_BEAMS_ON, lowBeamsOn);
}
public Boolean getLowBeamsOn() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Image.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Image.java
index 8182fc43c..bab596543 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Image.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Image.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.ImageType;
@@ -51,12 +53,23 @@ public class Image extends RPCStruct {
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 imageType whether it is a static or dynamic image
+ */
+ public Image(@NonNull String value, @NonNull ImageType imageType) {
+ this();
+ setValue(value);
+ setImageType(imageType);
+ }
+
/**
* 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 void setValue(String value) {
+ public void setValue(@NonNull String value) {
setValue(KEY_VALUE, value);
}
@@ -72,7 +85,7 @@ public class Image extends RPCStruct {
* set the image type
* @param imageType whether it is a static or dynamic image
*/
- public void setImageType(ImageType imageType) {
+ public void setImageType(@NonNull ImageType imageType) {
setValue(KEY_IMAGE_TYPE, imageType);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ImageField.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ImageField.java
index 1d3b32967..0dccc55cc 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ImageField.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ImageField.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
import com.smartdevicelink.proxy.rpc.enums.FileType;
@@ -71,17 +73,24 @@ public class ImageField extends RPCStruct {
public ImageField(Hashtable<String, Object> hash) {
super(hash);
}
+
+ public ImageField(@NonNull ImageFieldName name, @NonNull List<FileType> imageTypeSupported) {
+ this();
+ setName(name);
+ setImageTypeSupported(imageTypeSupported);
+ }
+
public ImageFieldName getName() {
return (ImageFieldName) getObject(ImageFieldName.class, KEY_NAME);
}
- public void setName( ImageFieldName name ) {
+ public void setName(@NonNull ImageFieldName name ) {
setValue(KEY_NAME, name);
}
@SuppressWarnings("unchecked")
public List<FileType> getImageTypeSupported() {
return (List<FileType>) getObject(FileType.class, KEY_IMAGE_TYPE_SUPPORTED);
}
- public void setImageTypeSupported( List<FileType> imageTypeSupported ) {
+ public void setImageTypeSupported(@NonNull List<FileType> imageTypeSupported ) {
setValue(KEY_IMAGE_TYPE_SUPPORTED, imageTypeSupported);
}
@SuppressWarnings("unchecked")
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
index d9c85eb8f..2eb69f652 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -60,8 +62,14 @@ public class ImageResolution extends RPCStruct {
public ImageResolution(Hashtable<String, Object> hash) {
super(hash);
}
+
+ public ImageResolution(@NonNull Integer resolutionWidth, @NonNull Integer resolutionHeight) {
+ this();
+ setResolutionWidth(resolutionWidth);
+ setResolutionHeight(resolutionHeight);
+ }
- public void setResolutionWidth(Integer resolutionWidth) {
+ public void setResolutionWidth(@NonNull Integer resolutionWidth) {
setValue(KEY_RESOLUTION_WIDTH, resolutionWidth);
}
@@ -69,11 +77,17 @@ public class ImageResolution extends RPCStruct {
return getInteger(KEY_RESOLUTION_WIDTH);
}
- public void setResolutionHeight(Integer resolutionHeight) {
+ public void setResolutionHeight(@NonNull Integer resolutionHeight) {
setValue(KEY_RESOLUTION_HEIGHT, resolutionHeight);
}
public Integer getResolutionHeight() {
return getInteger(KEY_RESOLUTION_HEIGHT);
}
+
+ @Override
+ public String toString() {
+ return "width=" + String.valueOf(getResolutionWidth()) +
+ ", height=" + String.valueOf(getResolutionHeight());
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ListFilesResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ListFilesResponse.java
index f1f77a7df..550eef9d8 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ListFilesResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ListFilesResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
import java.util.List;
@@ -24,6 +27,17 @@ public class ListFilesResponse extends RPCResponse {
public ListFilesResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new ListFilesResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public ListFilesResponse(@NonNull Boolean success, @NonNull Result resultCode, @NonNull Integer spaceAvailable) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ setSpaceAvailable(spaceAvailable);
+ }
public void setFilenames(List<String> filenames) {
setParameters(KEY_FILENAMES, filenames);
}
@@ -31,7 +45,7 @@ public class ListFilesResponse extends RPCResponse {
public List<String> getFilenames() {
return (List<String>) getObject(String.class, KEY_FILENAMES);
}
- public void setSpaceAvailable(Integer spaceAvailable) {
+ public void setSpaceAvailable(@NonNull Integer spaceAvailable) {
setParameters(KEY_SPACE_AVAILABLE, spaceAvailable);
}
public Integer getSpaceAvailable() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MenuParams.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MenuParams.java
index e096cb7df..841cf6b90 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MenuParams.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MenuParams.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -71,6 +73,14 @@ public class MenuParams extends RPCStruct {
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.
* @return parentID Min: 0 Max: 2000000000
@@ -135,7 +145,7 @@ public class MenuParams extends RPCStruct {
* @param menuName the menu name
*/
- public void setMenuName( String menuName ) {
+ public void setMenuName( @NonNull String menuName ) {
setValue(KEY_MENU_NAME, menuName);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java
new file mode 100644
index 000000000..dc5a9b5aa
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java
@@ -0,0 +1,116 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+
+import java.util.Collections;
+import java.util.Hashtable;
+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 void setMainField1( List<MetadataType> metadataTypes ) {
+ setValue(KEY_MAIN_FIELD_1_TYPE, metadataTypes);
+ }
+
+ /**
+ * Set the metadata type of data contained in the "mainField1" text field
+ */
+ public void setMainField1(MetadataType metadataType) {
+ setValue(KEY_MAIN_FIELD_1_TYPE, Collections.singletonList(metadataType));
+ }
+
+ /**
+ * @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 void setMainField2( List<MetadataType> metadataTypes ) {
+ setValue(KEY_MAIN_FIELD_2_TYPE, metadataTypes);
+ }
+
+ /**
+ * Set the metadata type of data contained in the "mainField2" text field
+ */
+ public void setMainField2(MetadataType metadataType) {
+ setValue(KEY_MAIN_FIELD_2_TYPE, Collections.singletonList(metadataType));
+ }
+
+ /**
+ * @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 void setMainField3( List<MetadataType> metadataTypes ) {
+ setValue(KEY_MAIN_FIELD_3_TYPE, metadataTypes);
+ }
+
+ /**
+ * Set the metadata type of data contained in the "mainField3" text field
+ */
+ public void setMainField3(MetadataType metadataType) {
+ setValue(KEY_MAIN_FIELD_3_TYPE, Collections.singletonList(metadataType));
+ }
+
+ /**
+ * @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 void setMainField4( List<MetadataType> metadataTypes ) {
+ setValue(KEY_MAIN_FIELD_4_TYPE, metadataTypes);
+ }
+
+ /**
+ * Set the metadata type of data contained in the "mainField4" text field
+ */
+ public void setMainField4(MetadataType metadataType) {
+ setValue(KEY_MAIN_FIELD_4_TYPE, Collections.singletonList(metadataType));
+ }
+
+ /**
+ * @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/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
new file mode 100644
index 000000000..9ae3f7fd3
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
@@ -0,0 +1,84 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+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 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 void setModuleType(@NonNull ModuleType moduleType) {
+ setValue(KEY_MODULE_TYPE, moduleType);
+ }
+
+ /**
+ * 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 void setRadioControlData(RadioControlData radioControlData) {
+ setValue(KEY_RADIO_CONTROL_DATA, radioControlData);
+ }
+
+ /**
+ * 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 void setClimateControlData(ClimateControlData climateControlData) {
+ setValue(KEY_CLIMATE_CONTROL_DATA, climateControlData);
+ }
+
+ /**
+ * Gets the climateControlData portion of the ModuleData class
+ *
+ * @return ClimateControlData
+ */
+ public ClimateControlData getClimateControlData() {
+ return (ClimateControlData) getObject(ClimateControlData.class, KEY_CLIMATE_CONTROL_DATA);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MyKey.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MyKey.java
index f17a6b54c..3393f527a 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MyKey.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MyKey.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -20,11 +22,11 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus;
* <td>Indicates whether e911 override is on.</td>
* </tr>
* </table>
- *
- *@since SmartDeviceLink 2.0
- *
- *@see GetVehicleData
- *@see OnVehicleData
+ *
+ *@since SmartDeviceLink 2.0
+ *
+ *@see GetVehicleData
+ *@see OnVehicleData
*@see VehicleDataStatus
*
*
@@ -33,21 +35,25 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus;
public class MyKey extends RPCStruct {
public static final String KEY_E_911_OVERRIDE = "e911Override";
/**
- * <p>
- * Constructs a new MyKey object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
+ * 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);
}
-
- public void setE911Override(VehicleDataStatus e911Override) {
+ /**
+ * Constructs a new MyKey object indicated
+ */
+ public MyKey(@NonNull VehicleDataStatus e911Override) {
+ this();
+ setE911Override(e911Override);
+ }
+ public void setE911Override(@NonNull VehicleDataStatus e911Override) {
setValue(KEY_E_911_OVERRIDE, e911Override);
}
public VehicleDataStatus getE911Override() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationCapability.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationCapability.java
new file mode 100644
index 000000000..c3d0d59f8
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/NavigationCapability.java
@@ -0,0 +1,35 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+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 NavigationCapability(){}
+
+ public NavigationCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public Boolean getSendLocationEnabled(){
+ return getBoolean(KEY_LOCATION_ENABLED);
+ }
+
+ public void setSendLocationEnabled(Boolean sendLocationEnabled){
+ setValue(KEY_LOCATION_ENABLED, sendLocationEnabled);
+ }
+
+ public Boolean getWayPointsEnabled(){
+ return getBoolean(KEY_GETWAYPOINTS_ENABLED);
+ }
+
+ public void setWayPointsEnabled(Boolean getWayPointsEnabled){
+ setValue(KEY_GETWAYPOINTS_ENABLED, getWayPointsEnabled);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
index 0e4a4f7c7..adc3296c1 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
@@ -55,6 +57,14 @@ public class OnAppInterfaceUnregistered extends RPCNotification {
super(hash);
}
/**
+ *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
*/
@@ -65,7 +75,7 @@ public class OnAppInterfaceUnregistered extends RPCNotification {
* <p>Set the reason application's interface was terminated</p>
* @param reason The reason application's interface registration was terminated
*/
- public void setReason( AppInterfaceUnregisteredReason reason ) {
+ public void setReason( @NonNull AppInterfaceUnregisteredReason reason ) {
setParameters(KEY_REASON, reason);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonEvent.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
index 185493ec7..28bf0b3ce 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.ButtonEventMode;
@@ -107,7 +109,17 @@ public class OnButtonEvent extends RPCNotification {
/**
* <p>Returns <i>{@linkplain ButtonName}</i> the button's name</p>
* @return 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) {
+ this();
+ setButtonName(buttonName);
+ setButtonEventMode(buttonEventMode);
+ }
public ButtonName getButtonName() {
return (ButtonName) getObject(ButtonName.class, KEY_BUTTON_NAME);
}
@@ -115,7 +127,7 @@ public class OnButtonEvent extends RPCNotification {
* <p>Set the button's name</p>
* @param buttonName name of the button
*/
- public void setButtonName(ButtonName buttonName) {
+ public void setButtonName(@NonNull ButtonName buttonName) {
setParameters(KEY_BUTTON_NAME, buttonName);
}
/**
@@ -130,7 +142,7 @@ public class OnButtonEvent extends RPCNotification {
* @param buttonEventMode indicates the button is pressed or released
* @see ButtonEventMode
*/
- public void setButtonEventMode(ButtonEventMode buttonEventMode) {
+ public void setButtonEventMode(@NonNull ButtonEventMode buttonEventMode) {
setParameters(KEY_BUTTON_EVENT_MODE, buttonEventMode);
}
public void setCustomButtonID(Integer customButtonID) {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonPress.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonPress.java
index 48562ab2f..f96548ec2 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonPress.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnButtonPress.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
@@ -110,6 +112,16 @@ public class OnButtonPress extends RPCNotification {
super(hash);
}
/**
+ *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) {
+ this();
+ setButtonName(buttonName);
+ setButtonPressMode(buttonPressMode);
+ }
+ /**
* <p>Returns an <i>{@linkplain ButtonName}</i> the button's name</p>
* @return ButtonName Name of the button
*/
@@ -120,7 +132,7 @@ public class OnButtonPress extends RPCNotification {
* <p>Set the button's name</p>
* @param buttonName name of the button
*/
- public void setButtonName( ButtonName buttonName ) {
+ public void setButtonName( @NonNull ButtonName buttonName ) {
setParameters(KEY_BUTTON_NAME, buttonName);
}
/**<p>Returns <i>{@linkplain ButtonPressMode}</i></p>
@@ -133,7 +145,7 @@ public class OnButtonPress extends RPCNotification {
* <p>Set the button press mode of the event</p>
* @param buttonPressMode indicates whether this is a short or long press
*/
- public void setButtonPressMode( ButtonPressMode buttonPressMode ) {
+ public void setButtonPressMode( @NonNull ButtonPressMode buttonPressMode ) {
setParameters(KEY_BUTTON_PRESS_MODE, buttonPressMode);
}
public void setCustomButtonName(Integer customButtonID) {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnCommand.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnCommand.java
index 0ce4ef7b7..0a7f1e89d 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnCommand.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnCommand.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
@@ -68,6 +70,16 @@ public class OnCommand extends RPCNotification {
super(hash);
}
/**
+ *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) {
+ this();
+ setCmdID(cmdID);
+ setTriggerSource(triggerSource);
+ }
+ /**
* <p>Returns an <i>Integer</i> object representing the Command ID</p>
* @return Integer an integer representation of this object
*/
@@ -78,7 +90,7 @@ public class OnCommand extends RPCNotification {
* <p>Sets a Command ID</p>
* @param cmdID an integer object representing a Command ID
*/
- public void setCmdID( Integer cmdID ) {
+ public void setCmdID( @NonNull Integer cmdID ) {
setParameters(KEY_CMD_ID, cmdID);
}
/**
@@ -93,7 +105,7 @@ public class OnCommand extends RPCNotification {
* <p>Indicates whether command was selected via VR or via a menu selection (using the OK button).</p>
* @param triggerSource a TriggerSource object
*/
- public void setTriggerSource( TriggerSource triggerSource ) {
+ public void setTriggerSource( @NonNull TriggerSource triggerSource ) {
setParameters(KEY_TRIGGER_SOURCE, triggerSource);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
index 82517ca28..8bd45e528 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
@@ -54,6 +56,14 @@ public class OnDriverDistraction extends RPCNotification {
super(hash);
}
/**
+ *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.
*/
@@ -64,7 +74,7 @@ public class OnDriverDistraction extends RPCNotification {
* <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 void setState( DriverDistractionState state ) {
+ public void setState( @NonNull DriverDistractionState state ) {
setParameters(KEY_STATE, state);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
index 930e742f5..505549014 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.AudioStreamingState;
@@ -83,6 +85,18 @@ public class OnHMIStatus extends RPCNotification {
super(hash);
}
/**
+ *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
+ */
+ public OnHMIStatus(@NonNull HMILevel hmiLevel, @NonNull AudioStreamingState audioStreamingState, @NonNull SystemContext systemContext) {
+ this();
+ setHmiLevel(hmiLevel);
+ setAudioStreamingState(audioStreamingState);
+ setSystemContext(systemContext);
+ }
+ /**
* <p>Get HMILevel in effect for the application</p>
* @return {@linkplain HMILevel} the current HMI Level in effect for the application
*/
@@ -93,7 +107,7 @@ public class OnHMIStatus extends RPCNotification {
* <p>Set the HMILevel of OnHMIStatus</p>
* @param hmiLevel the HMILevel to set
*/
- public void setHmiLevel( HMILevel hmiLevel ) {
+ public void setHmiLevel( @NonNull HMILevel hmiLevel ) {
setParameters(KEY_HMI_LEVEL, hmiLevel);
}
/**
@@ -107,7 +121,7 @@ public class OnHMIStatus extends RPCNotification {
* <p>Set the audio streaming state</p>
* @param audioStreamingState the state of audio streaming of the application
*/
- public void setAudioStreamingState( AudioStreamingState audioStreamingState ) {
+ public void setAudioStreamingState( @NonNull AudioStreamingState audioStreamingState ) {
setParameters(KEY_AUDIO_STREAMING_STATE, audioStreamingState);
}
/**
@@ -122,7 +136,7 @@ public class OnHMIStatus extends RPCNotification {
* @param systemContext Indicates that a user-initiated interaction is in-progress
* (VRSESSION or MENU), or not (MAIN)
*/
- public void setSystemContext( SystemContext systemContext ) {
+ public void setSystemContext( @NonNull SystemContext systemContext ) {
setParameters(KEY_SYSTEM_CONTEXT, systemContext);
}
/**
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHashChange.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHashChange.java
index 7ac4df083..2a4581f06 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHashChange.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHashChange.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
@@ -53,12 +55,20 @@ public class OnHashChange extends RPCNotification {
public OnHashChange(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * Constructs a new OnHashChange object
+ */
+ public OnHashChange(@NonNull String hashID) {
+ this();
+ setHashID(hashID);
+ }
public String getHashID() {
return getString(KEY_HASH_ID);
}
- public void setHashID(String hashID) {
+ public void setHashID(@NonNull String hashID) {
setParameters(KEY_HASH_ID, hashID);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java
new file mode 100644
index 000000000..a91a720c4
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnInteriorVehicleData.java
@@ -0,0 +1,58 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCNotification;
+
+import java.util.Hashtable;
+
+public class OnInteriorVehicleData extends RPCNotification {
+ public static final String KEY_MODULE_DATA = "moduleData";
+
+ /**
+ * Constructs a new OnInteriorVehicleData object
+ */
+ public OnInteriorVehicleData() {
+ super(FunctionID.ON_INTERIOR_VEHICLE_DATA.toString());
+ }
+
+ /**
+ * <p>Constructs a new OnInteriorVehicleData object indicated by the
+ * Hashtable parameter</p>
+ *
+ *
+ * @param hash
+ * The Hashtable to use
+ */
+ public OnInteriorVehicleData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new OnInteriorVehicleData object
+ * @param moduleData
+ */
+ public OnInteriorVehicleData(@NonNull ModuleData moduleData) {
+ this();
+ setModuleData(moduleData);
+ }
+
+ /**
+ * Gets the moduleData
+ *
+ * @return ModuleData
+ */
+ public ModuleData getModuleData() {
+ return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA);
+ }
+
+ /**
+ * Sets the moduleData
+ *
+ * @param moduleData
+ */
+ public void setModuleData(@NonNull ModuleData moduleData) {
+ setParameters(KEY_MODULE_DATA, moduleData);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
index 900091dc2..5bf3b8893 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.KeyboardEvent;
@@ -46,7 +48,6 @@ public class OnKeyboardInput extends RPCNotification {
/**
* Constructs a new OnKeyboardInput object
*/
-
public OnKeyboardInput() {
super(FunctionID.ON_KEYBOARD_INPUT.toString());
}
@@ -63,12 +64,19 @@ public class OnKeyboardInput extends RPCNotification {
public OnKeyboardInput(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new OnKeyboardInput object
+ */
+ public OnKeyboardInput(@NonNull KeyboardEvent event) {
+ this();
+ setEvent(event);
+ }
public KeyboardEvent getEvent() {
return (KeyboardEvent) getObject(KeyboardEvent.class, KEY_EVENT);
}
- public void setEvent(KeyboardEvent event) {
+ public void setEvent(@NonNull KeyboardEvent event) {
setParameters(KEY_EVENT, event);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnLanguageChange.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnLanguageChange.java
index 1b514f1cd..5464eb359 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnLanguageChange.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnLanguageChange.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.Language;
@@ -73,10 +75,20 @@ public class OnLanguageChange extends RPCNotification {
super(hash);
}
/**
+ *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) {
+ this();
+ 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 void setLanguage(Language language) {
+ public void setLanguage(@NonNull Language language) {
setParameters(KEY_LANGUAGE, language);
}
/**
@@ -90,7 +102,7 @@ public class OnLanguageChange extends RPCNotification {
* <p>Sets language that current display use</p>
* @param hmiDisplayLanguage language that current SDL voice engine(VR+TTS) use
*/
- public void setHmiDisplayLanguage(Language hmiDisplayLanguage) {
+ public void setHmiDisplayLanguage(@NonNull Language hmiDisplayLanguage) {
setParameters(KEY_HMI_DISPLAY_LANGUAGE, hmiDisplayLanguage);
}
/**
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
index a98d69fb5..efe1c184b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
@@ -63,6 +65,14 @@ public class OnPermissionsChange extends RPCNotification {
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);
+ }
+ /**
* <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
*/
@@ -74,7 +84,7 @@ public class OnPermissionsChange extends RPCNotification {
* <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 void setPermissionItem(List<PermissionItem> permissionItem) {
+ public void setPermissionItem(@NonNull List<PermissionItem> permissionItem) {
setParameters(KEY_PERMISSION_ITEM, permissionItem);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
index 271f94f7f..a178b581f 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
@@ -1,5 +1,6 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
import android.util.Log;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
@@ -76,7 +77,7 @@ import java.util.List;
* <td>minvalue: 0; maxvalue:100000000000</td>
* <td>SmartDeviceLink 2.3.2 </td>
* </tr>
- * </table>
+ * </table>
* @since SmartDeviceLink 2.3.2
*/
public class OnSystemRequest extends RPCNotification {
@@ -93,12 +94,11 @@ public class OnSystemRequest extends RPCNotification {
public static final String KEY_LENGTH = "length";
private String body;
- private Headers headers;
+ private Headers headers;
- /** Constructs a new OnSystemsRequest object
- *
+ /**
+ * Constructs a new OnSystemsRequest object
*/
-
public OnSystemRequest() {
super(FunctionID.ON_SYSTEM_REQUEST.toString());
}
@@ -111,6 +111,14 @@ public class OnSystemRequest extends RPCNotification {
super(hash);
setBulkData(bulkData);
}
+
+ /**
+ * Constructs a new OnSystemsRequest object
+ */
+ public OnSystemRequest(@NonNull RequestType requestType) {
+ this();
+ setRequestType(requestType);
+ }
private void handleBulkData(byte[] bulkData){
if(bulkData == null){
@@ -222,7 +230,7 @@ public class OnSystemRequest extends RPCNotification {
return (RequestType) getObject(RequestType.class, KEY_REQUEST_TYPE);
}
- public void setRequestType(RequestType requestType) {
+ public void setRequestType(@NonNull RequestType requestType) {
setParameters(KEY_REQUEST_TYPE, requestType);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnTBTClientState.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnTBTClientState.java
index a8f05a291..fad694373 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnTBTClientState.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnTBTClientState.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.TBTState;
@@ -54,6 +56,14 @@ public class OnTBTClientState extends RPCNotification {
super(hash);
}
/**
+ *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
*/
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnTouchEvent.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
index 36905aad6..7504c9197 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.TouchType;
@@ -48,11 +50,11 @@ public class OnTouchEvent extends RPCNotification {
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
@@ -66,8 +68,17 @@ public class OnTouchEvent extends RPCNotification {
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);
+ }
- public void setType(TouchType type) {
+ public void setType(@NonNull TouchType type) {
setParameters(KEY_TYPE, type);
}
@@ -75,7 +86,7 @@ public class OnTouchEvent extends RPCNotification {
return (TouchType) getObject(TouchType.class, KEY_TYPE);
}
- public void setEvent(List<TouchEvent> event) {
+ public void setEvent(@NonNull List<TouchEvent> event) {
setParameters(KEY_EVENT, event);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnWayPointChange.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnWayPointChange.java
index 5f102dce0..cb9130e1a 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnWayPointChange.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnWayPointChange.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
@@ -17,12 +19,17 @@ public class OnWayPointChange extends RPCNotification {
super(hash);
}
+ 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 void setWayPoints(List<LocationDetails> wayPoints) {
+ public void setWayPoints(@NonNull List<LocationDetails> wayPoints) {
setParameters(KEY_WAY_POINTS, wayPoints);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ParameterPermissions.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ParameterPermissions.java
index 244b73b89..5fbb00b74 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ParameterPermissions.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ParameterPermissions.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -58,7 +60,18 @@ public class ParameterPermissions extends RPCStruct {
public ParameterPermissions(Hashtable<String, Object> hash) {
super(hash);
}
-
+
+ /**
+ * 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) {
+ this();
+ setAllowed(allowed);
+ setUserDisallowed(userDisallowed);
+ }
+
/**
* 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.
@@ -72,7 +85,7 @@ public class ParameterPermissions extends RPCStruct {
* set a set of all parameters that are permitted for this given RPC.
* @param allowed parameter that is permitted for this given RPC
*/
- public void setAllowed(List<String> allowed) {
+ public void setAllowed(@NonNull List<String> allowed) {
setValue(KEY_ALLOWED, allowed);
}
@@ -89,7 +102,7 @@ public class ParameterPermissions extends RPCStruct {
* set a set of all parameters that are prohibited for this given RPC.
* @param userDisallowed paramter that is prohibited for this given RPC
*/
- public void setUserDisallowed(List<String> userDisallowed) {
+ public void setUserDisallowed(@NonNull List<String> userDisallowed) {
setValue(KEY_USER_DISALLOWED, userDisallowed);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
index 5f2d27e1c..bbd0c32e3 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.AudioType;
@@ -112,16 +114,29 @@ public class PerformAudioPassThru extends RPCRequest {
/**
* <p>Constructs a new PerformAudioPassThru object indicated by the Hashtable
* parameter</p>
- *
- *
- * @param hash
- * The Hashtable to use
+ *
+ * @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);
+ }
+
+ /**
* Sets initial prompt which will be spoken before opening the audio pass
* thru session by SDL
*
@@ -208,7 +223,7 @@ public class PerformAudioPassThru extends RPCRequest {
* @param samplingRate
* a SamplingRate value representing a 8 or 16 or 22 or 24 khz
*/
- public void setSamplingRate(SamplingRate samplingRate) {
+ public void setSamplingRate(@NonNull SamplingRate samplingRate) {
setParameters(KEY_SAMPLING_RATE, samplingRate);
}
@@ -230,7 +245,7 @@ public class PerformAudioPassThru extends RPCRequest {
* <p></p>
* <b>Notes: </b>Minvalue:1; Maxvalue:1000000
*/
- public void setMaxDuration(Integer maxDuration) {
+ public void setMaxDuration(@NonNull Integer maxDuration) {
setParameters(KEY_MAX_DURATION, maxDuration);
}
@@ -250,7 +265,7 @@ public class PerformAudioPassThru extends RPCRequest {
* @param audioQuality
* a BitsPerSample value representing 8 bit or 16 bit
*/
- public void setBitsPerSample(BitsPerSample audioQuality) {
+ public void setBitsPerSample(@NonNull BitsPerSample audioQuality) {
setParameters(KEY_BITS_PER_SAMPLE, audioQuality);
}
@@ -269,7 +284,7 @@ public class PerformAudioPassThru extends RPCRequest {
* @param audioType
* an audioType
*/
- public void setAudioType(AudioType audioType) {
+ public void setAudioType(@NonNull AudioType audioType) {
setParameters(KEY_AUDIO_TYPE, audioType);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java
index 2e90356ed..f68a412f0 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Perform Audio Pass Thru Response is sent, when PerformAudioPassThru has been called
@@ -30,4 +33,15 @@ public class PerformAudioPassThruResponse extends RPCResponse {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
index d8aeee70d..9067edb98 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
@@ -127,15 +129,26 @@ public class PerformInteraction extends RPCRequest {
/**
* Constructs a new PerformInteraction object indicated by the Hashtable
* parameter
- *
- *
- * @param hash
- * The Hashtable to use
+ *
+ * @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 Displayed when the interaction begins
+ * @param interactionMode indicate how user selects interaction choice (VR_ONLY, MANUAL_ONLY or BOTH)
+ * @param interactionChoiceSetIDList a List<Integer> representing an Array of one or more Choice Set IDs. User can select any choice from any of the specified
+ * Choice Sets <b>Notes: </b>Min Value: 0; Max Vlaue: 2000000000
+ */
+ 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
@@ -155,7 +168,7 @@ public class PerformInteraction extends RPCRequest {
* @param initialText
* a String value that Displayed when the interaction begins
*/
- public void setInitialText(String initialText) {
+ public void setInitialText(@NonNull String initialText) {
setParameters(KEY_INITIAL_TEXT, initialText);
}
/**
@@ -200,7 +213,7 @@ public class PerformInteraction extends RPCRequest {
* indicate how user selects interaction choice (VR_ONLY,
* MANUAL_ONLY or BOTH)
*/
- public void setInteractionMode(InteractionMode interactionMode) {
+ public void setInteractionMode(@NonNull InteractionMode interactionMode) {
setParameters(KEY_INTERACTION_MODE, interactionMode);
}
/**
@@ -226,7 +239,7 @@ public class PerformInteraction extends RPCRequest {
* <p></p>
* <b>Notes: </b>Min Value: 0; Max Vlaue: 2000000000
*/
- public void setInteractionChoiceSetIDList(List<Integer> interactionChoiceSetIDList) {
+ public void setInteractionChoiceSetIDList(@NonNull List<Integer> interactionChoiceSetIDList) {
setParameters(KEY_INTERACTION_CHOICE_SET_ID_LIST, interactionChoiceSetIDList);
}
/**
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
index 3e4b10b1c..5bd4afe8c 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import java.util.Hashtable;
@@ -35,6 +38,16 @@ public class PerformInteractionResponse extends RPCResponse {
super(hash);
}
/**
+ * Constructs a new PerformInteractionResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public PerformInteractionResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+ /**
* Gets the application-scoped identifier that uniquely identifies this choice.
* @return choiceID Min: 0 Max: 65535
*/
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java
index 59b6a347a..aad3af8eb 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java
@@ -1,6 +1,8 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -53,37 +55,45 @@ public class PermissionItem extends RPCStruct {
public static final String KEY_HMI_PERMISSIONS = "hmiPermissions";
public static final String KEY_PARAMETER_PERMISSIONS = "parameterPermissions";
/**
- * <p>
- * Constructs a new PermissionItem object indicated by the Hashtable
- * parameter
- * </p>
- *
- * @param hash
- * The Hashtable to use
+ * Constructs a new PermissionItem object
*/
-
- public PermissionItem() { }
+ 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
+ *
+ * @param hash The Hashtable to use
+ */
public PermissionItem(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new PermissionItem object
+ */
+ public PermissionItem() { }
public String getRpcName() {
return getString(KEY_RPC_NAME);
}
- public void setRpcName(String rpcName) {
+ public void setRpcName(@NonNull String rpcName) {
setValue(KEY_RPC_NAME, rpcName);
}
@SuppressWarnings("unchecked")
public HMIPermissions getHMIPermissions() {
return (HMIPermissions) getObject(HMIPermissions.class, KEY_HMI_PERMISSIONS);
}
- public void setHMIPermissions(HMIPermissions hmiPermissions) {
+ public void setHMIPermissions(@NonNull HMIPermissions hmiPermissions) {
setValue(KEY_HMI_PERMISSIONS, hmiPermissions);
}
@SuppressWarnings("unchecked")
public ParameterPermissions getParameterPermissions() {
return (ParameterPermissions) getObject(ParameterPermissions.class, KEY_PARAMETER_PERMISSIONS);
}
- public void setParameterPermissions(ParameterPermissions parameterPermissions) {
+ public void setParameterPermissions(@NonNull ParameterPermissions parameterPermissions) {
setValue(KEY_PARAMETER_PERMISSIONS, parameterPermissions);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PhoneCapability.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PhoneCapability.java
new file mode 100644
index 000000000..c317e0eb9
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PhoneCapability.java
@@ -0,0 +1,27 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/**
+ * Extended capabilities of the module's phone feature
+ */
+
+public class PhoneCapability extends RPCStruct {
+ public static final String KEY_DIALNUMBER_ENABLED = "dialNumberEnabled";
+
+ public PhoneCapability(){}
+
+ public PhoneCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public Boolean getDialNumberEnabled(){
+ return getBoolean(KEY_DIALNUMBER_ENABLED);
+ }
+
+ public void setDialNumberEnabled(Boolean dialNumberEnabled){
+ setValue(KEY_DIALNUMBER_ENABLED, dialNumberEnabled);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java
index 211586da9..79d7c9546 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -39,12 +41,21 @@ public class PresetBankCapabilities extends RPCStruct {
public PresetBankCapabilities(Hashtable<String, Object> hash) {
super(hash);
}
-
+
+ /**
+ * Constructs a newly allocated PresetBankCapabilities object
+ * @param onScreenPresetsAvailable if Onscreen custom presets are available.
+ */
+ public PresetBankCapabilities(@NonNull Boolean onScreenPresetsAvailable) {
+ this();
+ setOnScreenPresetsAvailable(onScreenPresetsAvailable);
+ }
+
/**
* set if Onscreen custom presets are available.
* @param onScreenPresetsAvailable if Onscreen custom presets are available.
*/
- public void setOnScreenPresetsAvailable(Boolean onScreenPresetsAvailable) {
+ public void setOnScreenPresetsAvailable(@NonNull Boolean onScreenPresetsAvailable) {
setValue(KEY_ON_SCREEN_PRESETS_AVAILABLE, onScreenPresetsAvailable);
}
@@ -55,4 +66,12 @@ public class PresetBankCapabilities extends RPCStruct {
public Boolean onScreenPresetsAvailable() {
return getBoolean(KEY_ON_SCREEN_PRESETS_AVAILABLE);
}
+
+ /**
+ * Defines, if Onscreen custom presets are available.
+ * @return if Onscreen custom presets are available
+ */
+ public Boolean getOnScreenPresetsAvailable() {
+ return getBoolean(KEY_ON_SCREEN_PRESETS_AVAILABLE);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PutFile.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PutFile.java
index 9fa04c154..0b13f0a1d 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PutFile.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PutFile.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.FileType;
@@ -128,24 +130,34 @@ public class PutFile extends RPCRequest {
/**
* Constructs a new PutFile object indicated by the Hashtable parameter
- * <p></p>
*
- * @param hash
- * The Hashtable to use
+ * @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);
+ }
+
+ /**
* Sets a file reference name
*
* @param sdlFileName
* a String value representing a file reference name
* <p></p>
- * <b>Notes: </b>Maxlength=500
+ * <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
*/
- public void setSdlFileName(String sdlFileName) {
+ public void setSdlFileName(@NonNull String sdlFileName) {
setParameters(KEY_SDL_FILE_NAME, sdlFileName);
}
@@ -164,7 +176,7 @@ public class PutFile extends RPCRequest {
* @param fileType
* a FileType value representing a selected file type
*/
- public void setFileType(FileType fileType) {
+ public void setFileType(@NonNull FileType fileType) {
setParameters(KEY_FILE_TYPE, fileType);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PutFileResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PutFileResponse.java
index 87425547a..028436d1e 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PutFileResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/PutFileResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
@@ -31,7 +34,18 @@ public class PutFileResponse extends RPCResponse {
public PutFileResponse(Hashtable<String, Object> hash) {
super(hash);
}
- public void setSpaceAvailable(Integer spaceAvailable) {
+ /**
+ * 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, @NonNull Integer spaceAvailable) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ setSpaceAvailable(spaceAvailable);
+ }
+ public void setSpaceAvailable(@NonNull Integer spaceAvailable) {
setParameters(KEY_SPACE_AVAILABLE, spaceAvailable);
}
public Integer getSpaceAvailable() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
new file mode 100644
index 000000000..1eee9a17a
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
@@ -0,0 +1,248 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+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";
+ 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 RadioControlCapabilities() {
+ }
+
+ public RadioControlCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * 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.
+ */
+ 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.
+ */
+ public void setModuleName(@NonNull String moduleName) {
+ setValue(KEY_MODULE_NAME, moduleName);
+ }
+
+ /**
+ * Gets the moduleName portion of the RadioControlCapabilities class
+ *
+ * @return String - Short friendly name of the climate control module.
+ */
+ public String getModuleName() {
+ return getString(KEY_MODULE_NAME);
+ }
+
+ /**
+ * 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.
+ */
+ public void setRadioEnableAvailable(Boolean radioEnableAvailable) {
+ setValue(KEY_RADIO_ENABLE_AVAILABLE, radioEnableAvailable);
+ }
+
+ /**
+ * Gets the radioEnableAvailable portion of the RadioControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of enable/disable radio.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getRadioEnableAvailable() {
+ return getBoolean(KEY_RADIO_ENABLE_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setRadioBandAvailable(Boolean radioBandAvailable) {
+ setValue(KEY_RADIO_BAND_AVAILABLE, radioBandAvailable);
+ }
+
+ /**
+ * Gets the radioBandAvailable portion of the RadioControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of radio band.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getRadioBandAvailable() {
+ return getBoolean(KEY_RADIO_BAND_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setRadioFrequencyAvailable(Boolean radioFrequencyAvailable) {
+ setValue(KEY_RADIO_FREQUENCY_AVAILABLE, radioFrequencyAvailable);
+ }
+
+ /**
+ * Gets the radioFrequencyAvailable portion of the RadioControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of radio frequency.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getRadioFrequencyAvailable() {
+ return getBoolean(KEY_RADIO_FREQUENCY_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setHdChannelAvailable(Boolean hdChannelAvailable) {
+ setValue(KEY_HD_CHANNEL_AVAILABLE, hdChannelAvailable);
+ }
+
+ /**
+ * Gets the hdChannelAvailable portion of the RadioControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of HD radio channel.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getHdChannelAvailable() {
+ return getBoolean(KEY_HD_CHANNEL_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setRdsDataAvailable(Boolean rdsDataAvailable) {
+ setValue(KEY_RDS_DATA_AVAILABLE, rdsDataAvailable);
+ }
+
+ /**
+ * Gets the rdsDataAvailable portion of the RadioControlCapabilities class
+ *
+ * @return Boolean - Availability of the getting Radio Data System (RDS) data.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getRdsDataAvailable() {
+ return getBoolean(KEY_RDS_DATA_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setAvailableHDsAvailable(Boolean availableHDsAvailable) {
+ setValue(KEY_AVAILABLE_HDS_AVAILABLE, availableHDsAvailable);
+ }
+
+ /**
+ * Gets the availableHDsAvailable portion of the RadioControlCapabilities class
+ *
+ * @return Boolean - Availability of the getting the number of available HD channels.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getAvailableHDsAvailable() {
+ return getBoolean(KEY_AVAILABLE_HDS_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setStateAvailable(Boolean stateAvailable) {
+ setValue(KEY_STATE_AVAILABLE, stateAvailable);
+ }
+
+ /**
+ * Gets the stateAvailable portion of the RadioControlCapabilities class
+ *
+ * @return Boolean - Availability of the getting the Radio state.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getStateAvailable() {
+ return getBoolean(KEY_STATE_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setSignalStrengthAvailable(Boolean signalStrengthAvailable) {
+ setValue(KEY_SIGNAL_STRENGTH_AVAILABLE, signalStrengthAvailable);
+ }
+
+ /**
+ * Gets the signalStrengthAvailable portion of the RadioControlCapabilities class
+ *
+ * @return Boolean - Availability of the getting the signal strength.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getSignalStrengthAvailable() {
+ return getBoolean(KEY_SIGNAL_STRENGTH_AVAILABLE);
+ }
+
+ /**
+ * 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.
+ */
+ public void setSignalChangeThresholdAvailable(Boolean signalChangeThresholdAvailable) {
+ setValue(KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE, signalChangeThresholdAvailable);
+ }
+
+ /**
+ * Gets the signalChangeThresholdAvailable portion of the RadioControlCapabilities class
+ *
+ * @return Boolean - Availability of the getting the signal Change Threshold.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getSignalChangeThresholdAvailable() {
+ return getBoolean(KEY_SIGNAL_CHANGE_THRESHOLD_AVAILABLE);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java
new file mode 100644
index 000000000..4744399ac
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java
@@ -0,0 +1,223 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.RadioBand;
+import com.smartdevicelink.proxy.rpc.enums.RadioState;
+import java.util.Hashtable;
+
+/**
+ * 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";
+ 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 RadioControlData() {
+ }
+
+ public RadioControlData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * 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
+ */
+ public void setFrequencyInteger(Integer frequencyInteger) {
+ setValue(KEY_FREQUENCY_INTEGER, frequencyInteger);
+ }
+
+ /**
+ * Gets the frequencyInteger portion of the RadioControlData class
+ *
+ * @return Integer - The integer part of the frequency i.e. for 101.7 this value should be 101.
+ */
+ public Integer getFrequencyInteger() {
+ return getInteger(KEY_FREQUENCY_INTEGER);
+ }
+
+ /**
+ * Sets the frequencyFraction portion of the RadioControlData class
+ *
+ * @param frequencyFraction
+ * The fractional part of the frequency i.e. for 101.7 is 7.
+ */
+ public void setFrequencyFraction(Integer frequencyFraction) {
+ setValue(KEY_FREQUENCY_FRACTION, frequencyFraction);
+ }
+
+ /**
+ * Gets the frequencyFraction portion of the RadioControlData class
+ *
+ * @return Integer - The fractional part of the frequency i.e. for 101.7 is 7.
+ */
+ public Integer getFrequencyFraction() {
+ return getInteger(KEY_FREQUENCY_FRACTION);
+ }
+
+ /**
+ * Sets the band portion of the RadioControlData class
+ *
+ * @param band
+ * The radio band (AM|FM|XM) of the radio tuner.
+ */
+ public void setBand(RadioBand band) {
+ setValue(KEY_BAND, band);
+ }
+
+ /**
+ * Gets the band portion of the RadioControlData class
+ *
+ * @return RadioBand - The radio band (AM|FM|XM) of the radio tuner.
+ */
+ public RadioBand getBand() {
+ return (RadioBand) getObject(RadioBand.class, KEY_BAND);
+ }
+
+ /**
+ * Sets the rdsData portion of the RadioControlData class
+ *
+ * @param rdsData
+ * Read only parameter. See RdsData data type for details.
+ */
+ public void setRdsData(RdsData rdsData) {
+ setValue(KEY_RDS_DATA, rdsData);
+ }
+
+ /**
+ * Gets the rdsData portion of the RadioControlData class
+ *
+ * @return RdsData - Read only parameter. See RdsData data type for details.
+ */
+ public RdsData getRdsData() {
+ return (RdsData) getObject(RdsData.class, KEY_RDS_DATA);
+ }
+
+ /**
+ * Sets the availableHDs portion of the RadioControlData class
+ *
+ * @param availableHDs
+ * Number of HD sub-channels if available.
+ */
+ public void setAvailableHDs(Integer availableHDs) {
+ setValue(KEY_AVAILABLE_HDS, availableHDs);
+ }
+
+ /**
+ * Gets the availableHDs portion of the RadioControlData class
+ *
+ * @return Integer - Number of HD sub-channels if available.
+ */
+ public Integer getAvailableHDs() {
+ return getInteger(KEY_AVAILABLE_HDS);
+ }
+
+ /**
+ * Sets the hdChannel portion of the RadioControlData class
+ *
+ * @param hdChannel
+ * Current HD sub-channel if available.
+ */
+ public void setHdChannel(Integer hdChannel) {
+ setValue(KEY_HD_CHANNEL, hdChannel);
+ }
+
+ /**
+ * Gets the hdChannel portion of the RadioControlData class
+ *
+ * @return Integer - Current HD sub-channel if available.
+ */
+ public Integer getHdChannel() {
+ return getInteger(KEY_HD_CHANNEL);
+ }
+
+ /**
+ * Sets the signalStrength portion of the RadioControlData class
+ *
+ * @param signalStrength
+ * Read only parameter. Indicates the strength of receiving radio signal in current frequency.
+ */
+ public void setSignalStrength(Integer signalStrength) {
+ setValue(KEY_SIGNAL_STRENGTH, signalStrength);
+ }
+
+ /**
+ * Gets the signalStrength portion of the RadioControlData class
+ *
+ * @return Integer - Read only parameter. Indicates the strength of receiving radio signal in current frequency.
+ */
+ public Integer getSignalStrength() {
+ return getInteger(KEY_SIGNAL_STRENGTH);
+ }
+
+ /**
+ * 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.
+ */
+ public void setSignalChangeThreshold(Integer signalChangeThreshold) {
+ setValue(KEY_SIGNAL_CHANGE_THRESHOLD, signalChangeThreshold);
+ }
+
+ /**
+ * Gets the signalChangeThreshold portion of the RadioControlData class
+ *
+ * @return Integer - If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency.
+ */
+ public Integer getSignalChangeThreshold() {
+ return getInteger(KEY_SIGNAL_CHANGE_THRESHOLD);
+ }
+
+ /**
+ * Sets the radioEnable portion of the RadioControlData class
+ * <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.
+ */
+ public void setRadioEnable(Boolean radioEnable) {
+ setValue(KEY_RADIO_ENABLE, radioEnable);
+ }
+
+ /**
+ * Gets the radioEnable portion of the RadioControlData class
+ * <br><b>Note: </b> If this is set to false, no other data will be included.
+ *
+ * @return Boolean - True if the radio is on, false is the radio is off.
+ */
+ public Boolean getRadioEnable() {
+ return getBoolean(KEY_RADIO_ENABLE);
+ }
+
+ /**
+ * Sets the state portion of the RadioControlData class
+ *
+ * @param state
+ * Read only parameter. See RadioState data type for details.
+ */
+ public void setState(RadioState state) {
+ setValue(KEY_STATE, state);
+ }
+
+ /**
+ * Gets the state portion of the RadioControlData class
+ *
+ * @return RadioState - Read only parameter. See RadioState data type for details.
+ */
+ public RadioState getState() {
+ return (RadioState) getObject(RadioState.class, KEY_STATE);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java
new file mode 100644
index 000000000..2ed934865
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RdsData.java
@@ -0,0 +1,180 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+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 RdsData() {
+ }
+
+ public RdsData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the programService portion of the RdsData class
+ *
+ * @param programService
+ * Program Service Name.
+ */
+ public void setProgramService(String programService) {
+ setValue(KEY_PS, programService);
+ }
+
+ /**
+ * Gets the programService portion of the RdsData class
+ *
+ * @return String - Program Service Name.
+ */
+ public String getProgramService() {
+ return getString(KEY_PS);
+ }
+
+ /**
+ * Sets the radioText portion of the RdsData class
+ *
+ * @param radioText
+ * Radio Text.
+ */
+ public void setRadioText(String radioText) {
+ setValue(KEY_RT, radioText);
+ }
+
+ /**
+ * Gets the radioText portion of the RdsData class
+ *
+ * @return String - Radio Text.
+ */
+ public String getRadioText() {
+ return getString(KEY_RT);
+ }
+
+ /**
+ * Sets the clockText portion of the RdsData class
+ *
+ * @param clockText
+ * The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD.
+ */
+ public void setClockText(String clockText) {
+ setValue(KEY_CT, clockText);
+ }
+
+ /**
+ * Gets the clockText portion of the RdsData class
+ *
+ * @return String - The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD.
+ */
+ public String getClockText() {
+ return getString(KEY_CT);
+ }
+
+ /**
+ * Sets the programIdentification portion of the RdsData class
+ *
+ * @param programIdentification
+ * Program Identification - the call sign for the radio station.
+ */
+ public void setProgramIdentification(String programIdentification) {
+ setValue(KEY_PI, programIdentification);
+ }
+
+ /**
+ * Gets the programIdentification portion of the RdsData class
+ *
+ * @return String - Program Identification - the call sign for the radio station.
+ */
+ public String getProgramIdentification() {
+ return getString(KEY_PI);
+ }
+
+ /**
+ * Sets the region portion of the RdsData class
+ *
+ * @param region
+ * Region.
+ */
+ public void setRegion(String region) {
+ setValue(KEY_REG, region);
+ }
+
+ /**
+ * Gets the region portion of the RdsData class
+ *
+ * @return String - Region.
+ */
+ public String getRegion() {
+ return getString(KEY_REG);
+ }
+
+ /**
+ * Sets the trafficProgram portion of the RdsData class
+ *
+ * @param trafficProgram
+ * Traffic Program Identification - Identifies a station that offers traffic.
+ */
+ public void setTrafficProgram(Boolean trafficProgram) {
+ setValue(KEY_TP, trafficProgram);
+ }
+
+ /**
+ * Gets the trafficProgram portion of the RdsData class
+ *
+ * @return Boolean - Traffic Program Identification - Identifies a station that offers traffic.
+ */
+ public Boolean getTrafficProgram() {
+ return getBoolean(KEY_TP);
+ }
+
+ /**
+ * Sets the trafficAnnouncement portion of the RdsData class
+ *
+ * @param trafficAnnouncement
+ * Traffic Announcement Identification - Indicates an ongoing traffic announcement.
+ */
+ public void setTrafficAnnouncement(Boolean trafficAnnouncement) {
+ setValue(KEY_TA, trafficAnnouncement);
+ }
+
+ /**
+ * Gets the trafficAnnouncement portion of the RdsData class
+ *
+ * @return Boolean - Traffic Announcement Identification - Indicates an ongoing traffic announcement.
+ */
+ public Boolean getTrafficAnnouncement() {
+ return getBoolean(KEY_TA);
+ }
+
+ /**
+ * 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.
+ */
+ public void setProgramType(Integer programType) {
+ setValue(KEY_PTY, programType);
+ }
+
+ /**
+ * Gets the programType portion of the RdsData class
+ *
+ * @return Integer - The program type.
+ * The region should be used to differentiate between EU and North America program types.
+ */
+ public Integer getProgramType() {
+ return getInteger(KEY_PTY);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ReadDID.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ReadDID.java
index ec198e54c..7d62cf019 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ReadDID.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ReadDID.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -80,16 +82,31 @@ public class ReadDID extends RPCRequest {
/**
* Constructs a new ReadDID object indicated by the Hashtable parameter
- * <p></p>
*
- * @param hash
- * The Hashtable to use
+ * @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);
+ }
+
+ /**
* Sets an ID of the vehicle module
*
* @param ecuName
@@ -97,7 +114,7 @@ public class ReadDID extends RPCRequest {
* <p></p>
* <b>Notes: </b>Minvalue:0; Maxvalue:65535
*/
- public void setEcuName(Integer ecuName) {
+ public void setEcuName(@NonNull Integer ecuName) {
setParameters(KEY_ECU_NAME, ecuName);
}
@@ -124,7 +141,7 @@ public class ReadDID extends RPCRequest {
* <li>ArrayMin:0; ArrayMax:1000</li>
* </ul>
*/
- public void setDidLocation(List<Integer> didLocation) {
+ public void setDidLocation(@NonNull List<Integer> didLocation) {
setParameters(KEY_DID_LOCATION, didLocation);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java
index e0633198c..3cf835906 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
import java.util.List;
@@ -20,6 +23,16 @@ public class ReadDIDResponse extends RPCResponse {
public ReadDIDResponse(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a new ReadDIDResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public ReadDIDResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
public void setDidResult(List<DIDResult> didResult) {
setParameters(KEY_DID_RESULT, didResult);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java
new file mode 100644
index 000000000..d2545b5e5
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java
@@ -0,0 +1,119 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+/*
+ * Copyright (c) 2017 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * 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 void setX(@NonNull Float x) {
+ setValue(KEY_X, x);
+ }
+
+ /**
+ * @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 void setY(@NonNull Float y) {
+ setValue(KEY_Y, y);
+ }
+
+ /**
+ * @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 void setWidth(@NonNull Float width) {
+ setValue(KEY_WIDTH, width);
+ }
+
+ /**
+ * @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 void setHeight(@NonNull Float height) {
+ setValue(KEY_HEIGHT, 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/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
index 0f02ecca0..970613ccf 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
@@ -244,6 +246,44 @@ public class RegisterAppInterface extends RPCRequest {
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
+ * @param appID 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 appID) {
+ this();
+ setSdlMsgVersion(syncMsgVersion);
+ setAppName(appName);
+ setIsMediaApplication(isMediaApplication);
+ setLanguageDesired(languageDesired);
+ setHmiDisplayLanguageDesired(hmiDisplayLanguageDesired);
+ setAppID(appID);
+ }
+ /**
* Gets the version of the SDL&reg; SmartDeviceLink interface
*
* @return SdlMsgVersion -a SdlMsgVersion object representing version of
@@ -271,8 +311,9 @@ public class RegisterAppInterface extends RPCRequest {
* RegisterAppInterface response). However, the minor version
* number sent from the app to SDL&reg; (in RegisterAppInterface
* request) is ignored by SDL&reg;
+ *
*/
- public void setSdlMsgVersion(SdlMsgVersion sdlMsgVersion) {
+ public void setSdlMsgVersion(@NonNull SdlMsgVersion sdlMsgVersion) {
setParameters(KEY_SDL_MSG_VERSION, sdlMsgVersion);
}
@@ -308,7 +349,7 @@ public class RegisterAppInterface extends RPCRequest {
* application</li>
* </ul>
*/
- public void setAppName(String appName) {
+ public void setAppName(@NonNull String appName) {
setParameters(KEY_APP_NAME, appName);
}
@@ -422,7 +463,7 @@ public class RegisterAppInterface extends RPCRequest {
* @param isMediaApplication
* a Boolean value
*/
- public void setIsMediaApplication(Boolean isMediaApplication) {
+ public void setIsMediaApplication(@NonNull Boolean isMediaApplication) {
setParameters(KEY_IS_MEDIA_APPLICATION, isMediaApplication);
}
/**
@@ -443,7 +484,7 @@ public class RegisterAppInterface extends RPCRequest {
*
*
*/
- public void setLanguageDesired(Language languageDesired) {
+ public void setLanguageDesired(@NonNull Language languageDesired) {
setParameters(KEY_LANGUAGE_DESIRED, languageDesired);
}
@@ -467,7 +508,7 @@ public class RegisterAppInterface extends RPCRequest {
* @param hmiDisplayLanguageDesired
* @since SmartDeviceLink 2.0
*/
- public void setHmiDisplayLanguageDesired(Language hmiDisplayLanguageDesired) {
+ public void setHmiDisplayLanguageDesired(@NonNull Language hmiDisplayLanguageDesired) {
setParameters(KEY_HMI_DISPLAY_LANGUAGE_DESIRED, hmiDisplayLanguageDesired);
}
@@ -534,7 +575,7 @@ public class RegisterAppInterface extends RPCRequest {
* <b>Notes: </b>Maxlength = 100
* @since SmartDeviceLink 2.0
*/
- public void setAppID(String appID) {
+ public void setAppID(@NonNull String appID) {
setParameters(KEY_APP_ID, appID);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
index df5c3f531..0fea2f9a9 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
@@ -1,14 +1,18 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.Version;
import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
+import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
@@ -35,6 +39,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
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_PCM_STREAM_CAPABILITIES = "pcmStreamCapabilities";
/**
@@ -62,6 +67,16 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
* @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);
+ }
@SuppressWarnings("unchecked")
public SdlMsgVersion getSdlMsgVersion() {
return (SdlMsgVersion) getObject(SdlMsgVersion.class, KEY_SDL_MSG_VERSION);
@@ -228,7 +243,16 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
*/
@SuppressWarnings("unchecked")
public List<SpeechCapabilities> getSpeechCapabilities() {
- return (List<SpeechCapabilities>) getObject(SpeechCapabilities.class, KEY_SPEECH_CAPABILITIES);
+ 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
@@ -299,6 +323,23 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
public void setAudioPassThruCapabilities(List<AudioPassThruCapabilities> audioPassThruCapabilities) {
setParameters(KEY_AUDIO_PASS_THRU_CAPABILITIES, audioPassThruCapabilities);
}
+
+ /**
+ * Gets pcmStreamingCapabilities set when application interface is registered.
+ *
+ * @return pcmStreamingCapabilities
+ */
+ @SuppressWarnings("unchecked")
+ public AudioPassThruCapabilities getPcmStreamingCapabilities() {
+ return (AudioPassThruCapabilities) getObject(AudioPassThruCapabilities.class, KEY_PCM_STREAM_CAPABILITIES);
+ }
+ /**
+ * Sets pcmStreamingCapabilities
+ * @param pcmStreamingCapabilities
+ */
+ public void setPcmStreamingCapabilities(AudioPassThruCapabilities pcmStreamingCapabilities) {
+ setParameters(KEY_PCM_STREAM_CAPABILITIES, pcmStreamingCapabilities);
+ }
public String getProxyVersionInfo() {
if (Version.VERSION != null)
return Version.VERSION;
@@ -337,5 +378,5 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
public String getSystemSoftwareVersion() {
return getString(KEY_SYSTEM_SOFTWARE_VERSION);
- }
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java
new file mode 100644
index 000000000..ec51aa633
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RemoteControlCapabilities.java
@@ -0,0 +1,82 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+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 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 void setClimateControlCapabilities(List<ClimateControlCapabilities> climateControlCapabilities) {
+ setValue(KEY_CLIMATE_CONTROL_CAPABILITIES, climateControlCapabilities);
+ }
+
+ /**
+ * 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 void setRadioControlCapabilities(List<RadioControlCapabilities> radioControlCapabilities) {
+ setValue(KEY_RADIO_CONTROL_CAPABILITIES, radioControlCapabilities);
+ }
+
+ /**
+ * 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 void setButtonCapabilities(List<ButtonCapabilities> buttonCapabilities) {
+ setValue(KEY_BUTTON_CAPABILITIES, buttonCapabilities);
+ }
+
+ /**
+ * 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);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
index 664eb33a9..2adb03ec1 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.GlobalProperty;
@@ -68,15 +70,24 @@ public class ResetGlobalProperties extends RPCRequest {
/**
* Constructs a new ResetGlobalProperties object indicated by the Hashtable
* parameter
- *
- *
- * @param hash
- * The Hashtable to use
+ *
+ * @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
*
@@ -98,7 +109,7 @@ public class ResetGlobalProperties extends RPCRequest {
* <p></p>
* <b>Notes: </b>Array must have at least one element
*/
- public void setProperties( List<GlobalProperty> properties ) {
+ public void setProperties(@NonNull List<GlobalProperty> properties ) {
setParameters(KEY_PROPERTIES, properties);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java
index dec7cde94..78f245ea8 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Reset Global Properties Response is sent, when ResetGlobalProperties has been called
@@ -30,4 +33,14 @@ public class ResetGlobalPropertiesResponse extends RPCResponse {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScreenParams.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScreenParams.java
index a821264e6..e9a3168e7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScreenParams.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScreenParams.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -58,12 +60,21 @@ public class ScreenParams extends RPCStruct {
public ScreenParams(Hashtable<String, Object> hash) {
super(hash);
}
-
+
+ /**
+ * Constructs a new ScreenParams object
+ */
+
+ public ScreenParams(@NonNull ImageResolution resolution) {
+ this();
+ setImageResolution(resolution);
+ }
+
@SuppressWarnings("unchecked")
public ImageResolution getImageResolution() {
return (ImageResolution) getObject(ImageResolution.class, KEY_RESOLUTION);
}
- public void setImageResolution( ImageResolution resolution ) {
+ public void setImageResolution( @NonNull ImageResolution resolution ) {
setValue(KEY_RESOLUTION, resolution);
}
@SuppressWarnings("unchecked")
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
index 971b68712..8f249ffe0 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.Language;
@@ -65,7 +67,7 @@ import java.util.List;
* <p>REJECTED </p>
* <p>ABORTED</p>
*
- * @see scrollableMessageBody
+ * @see scrollableMessageBody
* @see TextFieldName
*/
public class ScrollableMessage extends RPCRequest {
@@ -85,14 +87,23 @@ public class ScrollableMessage extends RPCRequest {
* parameter
* <p></p>
*
- * @param hash
- * The Hashtable to use
+ * @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);
+ }
+
+ /**
* Sets a Body of text that can include newlines and tabs
*
* @param scrollableMessageBody
@@ -101,7 +112,7 @@ public class ScrollableMessage extends RPCRequest {
* <p></p>
* <b>Notes: </b>Maxlength=500
*/
- public void setScrollableMessageBody(String scrollableMessageBody) {
+ public void setScrollableMessageBody(@NonNull String scrollableMessageBody) {
setParameters(KEY_SCROLLABLE_MESSAGE_BODY, scrollableMessageBody);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java
index 880c27f95..2113e3095 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Scrollable Message Response is sent, when ScrollableMessage has been called
@@ -30,4 +33,14 @@ public class ScrollableMessageResponse extends RPCResponse {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
index 2221972c1..128d2050f 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -62,7 +64,17 @@ public class SdlMsgVersion extends RPCStruct {
* <li>maxvalue="10"</li>
* </ul>
* @return the major version
- */
+ */
+ /**
+ * Constructs a newly allocated SdlMsgVersion object
+ * @param majorVersion minvalue="1" and maxvalue="10"
+ * @param minorVersion min: 0; max: 1000
+ */
+ public SdlMsgVersion(@NonNull Integer majorVersion, @NonNull Integer minorVersion) {
+ this();
+ setMajorVersion(majorVersion);
+ setMinorVersion(minorVersion);
+ }
public Integer getMajorVersion() {
return getInteger( KEY_MAJOR_VERSION );
}
@@ -74,7 +86,7 @@ public class SdlMsgVersion extends RPCStruct {
* </ul>
* @param majorVersion minvalue="1" and maxvalue="10"
*/
- public void setMajorVersion( Integer majorVersion ) {
+ public void setMajorVersion( @NonNull Integer majorVersion ) {
setValue(KEY_MAJOR_VERSION, majorVersion);
}
/**
@@ -96,7 +108,7 @@ public class SdlMsgVersion extends RPCStruct {
* </ul>
* @param minorVersion min: 0; max: 1000
*/
- public void setMinorVersion( Integer minorVersion ) {
+ public void setMinorVersion( @NonNull Integer minorVersion ) {
setValue(KEY_MINOR_VERSION, minorVersion);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java
new file mode 100644
index 000000000..a93fd2b98
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java
@@ -0,0 +1,86 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+import java.util.List;
+
+/*
+ * Copyright (c) 2017 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * 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";
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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 void setHapticRectData(List<HapticRect> hapticRectData) {
+ setParameters(KEY_HAPTIC_RECT_DATA, hapticRectData);
+ }
+
+ @SuppressWarnings("unchecked")
+ /**
+ * @return array of spatial data structures that represent the locations of all user controls present on the app's layout.
+ */
+ public List<HapticRect> getHapticRectData() {
+ return (List<HapticRect>) getObject(HapticRect.class, KEY_HAPTIC_RECT_DATA);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java
new file mode 100644
index 000000000..58761a4a5
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java
@@ -0,0 +1,67 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+/*
+ * Copyright (c) 2017 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * 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(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);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendLocationResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendLocationResponse.java
index dcee04e9a..dc1193a8b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendLocationResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendLocationResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Add SendLocation Response is sent, when SendLocation has been called
@@ -19,4 +22,15 @@ public class SendLocationResponse extends RPCResponse{
public SendLocationResponse(Hashtable<String, Object> hash){
super(hash);
}
+
+ /**
+ * Constructs a new SendLocationResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SendLocationResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIcon.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIcon.java
index 30496f159..02ee081c2 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIcon.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIcon.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -58,22 +60,31 @@ public class SetAppIcon extends RPCRequest {
* Constructs a new SetAppIcon object indicated by the Hashtable parameter
* <p></p>
*
- * @param hash
- * The Hashtable to use
+ * @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);
+ }
+
+ /**
* Sets a file reference name
*
* @param sdlFileName
* a String value representing a file reference name
* <p></p>
- * <b>Notes: </b>Maxlength=500
+ * <b>Notes: </b>Maxlength=500, however the max file name length may vary based on remote filesystem limitations
*/
- public void setSdlFileName(String sdlFileName) {
+ public void setSdlFileName(@NonNull String sdlFileName) {
setParameters(KEY_SDL_FILE_NAME, sdlFileName);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java
index c6d0f7ddf..45e6ff180 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java
@@ -1,9 +1,13 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
/**
* Set App Icon Response is sent, when SetAppIcon has been called.
*
@@ -29,4 +33,15 @@ public class SetAppIconResponse extends RPCResponse {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
index e137e7f5b..d9bb2ec69 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -64,15 +66,25 @@ public class SetDisplayLayout extends RPCRequest {
}
/**
+ * 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 diaply layout
+ * a String value representing a display layout
*/
- public void setDisplayLayout(String displayLayout) {
+ public void setDisplayLayout(@NonNull String displayLayout) {
setParameters(KEY_DISPLAY_LAYOUT, displayLayout);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
index 36e9fb7db..48b98bd24 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
import java.util.List;
@@ -35,7 +38,18 @@ public class SetDisplayLayoutResponse extends RPCResponse {
public SetDisplayLayoutResponse(Hashtable<String, Object> hash) {
super(hash);
}
-
+
+ /**
+ * Constructs a new SetDisplayLayoutResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SetDisplayLayoutResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
@SuppressWarnings("unchecked")
public DisplayCapabilities getDisplayCapabilities() {
return (DisplayCapabilities) getObject(DisplayCapabilities.class, KEY_DISPLAY_CAPABILITIES);
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java
index f33bc0b7c..89b5219a5 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Set Global Properties Response is sent, when SetGlobalProperties has been called
@@ -30,4 +33,15 @@ public class SetGlobalPropertiesResponse extends RPCResponse {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java
new file mode 100644
index 000000000..ad5a0d26a
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleData.java
@@ -0,0 +1,62 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+/**
+ * This function allows a remote control type mobile application change the settings
+ * of a specific remote control module.
+ */
+public class SetInteriorVehicleData extends RPCRequest {
+ public static final String KEY_MODULE_DATA = "moduleData";
+
+ /**
+ * Constructs a new SetInteriorVehicleData object
+ */
+ public SetInteriorVehicleData() {
+ super(FunctionID.SET_INTERIOR_VEHICLE_DATA.toString());
+ }
+
+ /**
+ * <p>Constructs a new SetInteriorVehicleData object indicated by the
+ * Hashtable parameter</p>
+ *
+ *
+ * @param hash
+ * The Hashtable to use
+ */
+ public SetInteriorVehicleData(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new SetInteriorVehicleData object
+ * @param moduleData
+ */
+ public SetInteriorVehicleData(@NonNull ModuleData moduleData) {
+ this();
+ setModuleData(moduleData);
+ }
+
+ /**
+ * Sets the moduleData
+ *
+ * @param moduleData
+ */
+ public void setModuleData(@NonNull ModuleData moduleData) {
+ setParameters(KEY_MODULE_DATA, moduleData);
+ }
+
+ /**
+ * Gets the moduleData
+ *
+ * @return ModuleData
+ */
+ public ModuleData getModuleData() {
+ return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java
new file mode 100644
index 000000000..837b36fc7
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java
@@ -0,0 +1,63 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+public class SetInteriorVehicleDataResponse extends RPCResponse {
+ public static final String KEY_MODULE_DATA = "moduleData";
+
+ /**
+ * 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
+ */
+ public SetInteriorVehicleDataResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new SetInteriorVehicleDataResponse object
+ * @param moduleData
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SetInteriorVehicleDataResponse(@NonNull ModuleData moduleData, @NonNull Result resultCode, @NonNull Boolean success) {
+ this();
+ setModuleData(moduleData);
+ setResultCode(resultCode);
+ setSuccess(success);
+ }
+
+ /**
+ * Gets the moduleData
+ *
+ * @return ModuleData
+ */
+ public ModuleData getModuleData() {
+ return (ModuleData) getObject(ModuleData.class, KEY_MODULE_DATA);
+ }
+
+ /**
+ * Sets the moduleData
+ *
+ * @param moduleData
+ */
+ public void setModuleData(@NonNull ModuleData moduleData) {
+ setParameters(KEY_MODULE_DATA, moduleData);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
index bcef52745..4ec73b9d7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
@@ -85,13 +87,27 @@ public class SetMediaClockTimer extends RPCRequest {
* parameter
* <p></p>
*
- * @param hash
- * The Hashtable to use
+ * @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);
+ }
+ /**
* Gets the Start Time which media clock timer is set
*
* @return StartTime -a StartTime object specifying hour, minute, second
@@ -149,7 +165,7 @@ public class SetMediaClockTimer extends RPCRequest {
* the timer's value when it was paused</li>
* </ul>
*/
- public void setUpdateMode( UpdateMode updateMode ) {
+ public void setUpdateMode( @NonNull UpdateMode updateMode ) {
setParameters(KEY_UPDATE_MODE, updateMode);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java
index e74ecc1b9..56a63c947 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Set Media Clock Timer Response is sent, when SetMediaClockTimer has been called
@@ -30,4 +33,14 @@ public class SetMediaClockTimerResponse extends RPCResponse {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Show.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
index 331ddebbe..6a42fe1a8 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
@@ -164,6 +164,7 @@ public class Show extends RPCRequest {
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";
/**
* Constructs a new Show object
*/
@@ -520,4 +521,29 @@ public class Show extends RPCRequest {
public void setCustomPresets(List<String> customPresets) {
setParameters(KEY_CUSTOM_PRESETS, customPresets);
}
+
+ /**
+ * 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 void setMetadataTags(MetadataTags metadataTags){
+ setParameters(KEY_METADATA_TAGS, metadataTags);
+ }
+
+ /**
+ * 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);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java
index a3e2dbaf1..5482a00ae 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Show Constant TBT Response is sent, when ShowConstantTBT has been called
@@ -20,4 +23,14 @@ public class ShowConstantTbtResponse extends RPCResponse{
super(hash);
}
+ /**
+ * Constructs a new ShowConstantTbtResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public ShowConstantTbtResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java
index 54ff95033..1187f6687 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/ShowResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Show Response is sent, when Show has been called
@@ -30,4 +33,15 @@ public class ShowResponse extends RPCResponse {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java
index 4b8722ea5..6aa49ad28 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SingleTireStatus.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
@@ -41,12 +43,21 @@ public class SingleTireStatus extends RPCStruct {
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);
+ }
/**
* set the volume status of a single tire
* @param status the volume status of a single tire
*/
- public void setStatus(ComponentVolumeStatus status) {
+ public void setStatus(@NonNull ComponentVolumeStatus status) {
setValue(KEY_STATUS, status);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
index 31fb55b1e..df92e22fe 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -110,6 +112,19 @@ public class Slider extends RPCRequest {
}
/**
+ * 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
@@ -118,7 +133,7 @@ public class Slider extends RPCRequest {
* <p></p>
* <b>Notes: </b>Minvalue=2; Maxvalue=26
*/
- public void setNumTicks(Integer numTicks) {
+ public void setNumTicks(@NonNull Integer numTicks) {
setParameters(KEY_NUM_TICKS, numTicks);
}
@@ -141,7 +156,7 @@ public class Slider extends RPCRequest {
* <p></p>
* <b>Notes: </b>Minvalue=1; Maxvalue=26
*/
- public void setPosition(Integer position) {
+ public void setPosition(@NonNull Integer position) {
setParameters(KEY_POSITION, position);
}
@@ -163,7 +178,7 @@ public class Slider extends RPCRequest {
* <p></p>
* <b>Notes: </b>Maxlength=500
*/
- public void setSliderHeader(String sliderHeader) {
+ public void setSliderHeader(@NonNull String sliderHeader) {
setParameters(KEY_SLIDER_HEADER, sliderHeader);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java
index 8d226d72c..b7f4a08a6 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SliderResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
@@ -31,6 +34,18 @@ public class SliderResponse extends RPCResponse {
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);
+ }
+
/**
* Sets an Initial position of slider control
* @param sliderPosition
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java
index 23e31316d..751729220 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButton.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -79,22 +81,32 @@ public class SoftButton extends RPCStruct {
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
+ *
+ * @param hash The Hashtable to use
*/
-
- public SoftButton() { }
- public SoftButton(Hashtable<String, Object> hash) {
+ public SoftButton(Hashtable<String, Object> hash) {
super(hash);
}
- public void setType(SoftButtonType type) {
+
+ /**
+ * 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 void setType(@NonNull SoftButtonType type) {
setValue(KEY_TYPE, type);
}
public SoftButtonType getType() {
@@ -119,7 +131,7 @@ public class SoftButton extends RPCStruct {
public Boolean getIsHighlighted() {
return getBoolean(KEY_IS_HIGHLIGHTED);
}
- public void setSoftButtonID(Integer softButtonID) {
+ public void setSoftButtonID(@NonNull Integer softButtonID) {
setValue(KEY_SOFT_BUTTON_ID, softButtonID);
}
public Integer getSoftButtonID() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
index 205dfe74c..9299e1b2b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -66,12 +68,27 @@ public class SoftButtonCapabilities extends RPCStruct {
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);
+ }
/**
* set the button supports a short press.
* @param shortPressAvailable whether the button supports a short press.
*/
- public void setShortPressAvailable(Boolean shortPressAvailable) {
+ public void setShortPressAvailable(@NonNull Boolean shortPressAvailable) {
setValue(KEY_SHORT_PRESS_AVAILABLE, shortPressAvailable);
}
@@ -87,7 +104,7 @@ public class SoftButtonCapabilities extends RPCStruct {
* set the button supports a LONG press.
* @param longPressAvailable whether the button supports a long press
*/
- public void setLongPressAvailable(Boolean longPressAvailable) {
+ public void setLongPressAvailable(@NonNull Boolean longPressAvailable) {
setValue(KEY_LONG_PRESS_AVAILABLE, longPressAvailable);
}
@@ -103,7 +120,7 @@ public class SoftButtonCapabilities extends RPCStruct {
* set the button supports "button down" and "button up".
* @param upDownAvailable the button supports "button down" and "button up".
*/
- public void setUpDownAvailable(Boolean upDownAvailable) {
+ public void setUpDownAvailable(@NonNull Boolean upDownAvailable) {
setValue(KEY_UP_DOWN_AVAILABLE, upDownAvailable);
}
@@ -119,7 +136,7 @@ public class SoftButtonCapabilities extends RPCStruct {
* set the button supports referencing a static or dynamic image.
* @param imageSupported whether the button supports referencing a static or dynamic image.
*/
- public void setImageSupported(Boolean imageSupported) {
+ public void setImageSupported(@NonNull Boolean imageSupported) {
setValue(KEY_IMAGE_SUPPORTED, imageSupported);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java
index 347960731..8a0b3a380 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Speak.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
@@ -120,12 +122,20 @@ public class Speak extends RPCRequest {
* Constructs a new Speak object indicated by the Hashtable parameter
* <p></p>
*
- * @param hash
- * The Hashtable to use
+ * @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
@@ -152,7 +162,7 @@ public class Speak extends RPCRequest {
* <li>Each chunk can be no more than 500 characters</li>
* </ul>
*/
- public void setTtsChunks( List<TTSChunk> ttsChunks ) {
+ public void setTtsChunks( @NonNull List<TTSChunk> ttsChunks ) {
setParameters(KEY_TTS_CHUNKS, ttsChunks);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java
index 740d24776..5f78b609b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SpeakResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Speak Response is sent, when Speak has been called
@@ -30,4 +33,16 @@ public class SpeakResponse extends RPCResponse {
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);
+ }
+
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java
index ec515ad46..e047a716b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/StartTime.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -53,6 +55,19 @@ public class StartTime extends RPCStruct {
public StartTime(Hashtable<String, Object> hash) {
super(hash);
}
+
+ /**
+ * 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.
@@ -66,7 +81,7 @@ public class StartTime extends RPCStruct {
* <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 void setHours( Integer hours ) {
+ public void setHours(@NonNull Integer hours ) {
setValue(KEY_HOURS, hours);
}
/**
@@ -80,7 +95,7 @@ public class StartTime extends RPCStruct {
* Set the minute. Minvalue="0", maxvalue="59".
* @param minutes min: 0; max: 59
*/
- public void setMinutes( Integer minutes ) {
+ public void setMinutes( @NonNull Integer minutes ) {
setValue(KEY_MINUTES, minutes);
}
/**
@@ -94,7 +109,7 @@ public class StartTime extends RPCStruct {
* Set the second. Minvalue="0", maxvalue="59".
* @param seconds min: 0 max: 59
*/
- public void setSeconds( Integer seconds ) {
+ public void setSeconds( @NonNull Integer seconds ) {
setValue(KEY_SECONDS, seconds);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java
index 4eedfcb47..80e988e35 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButton.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
@@ -88,12 +90,20 @@ public class SubscribeButton extends RPCRequest {
* parameter</p>
*
*
- * @param hash
- * The Hashtable to use
+ * @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>
@@ -105,7 +115,7 @@ public class SubscribeButton extends RPCRequest {
* Sets a name of the button to subscribe to
* @param buttonName a <i>{@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i> value
*/
- public void setButtonName( ButtonName buttonName ) {
+ public void setButtonName(@NonNull ButtonName buttonName ) {
setParameters(KEY_BUTTON_NAME, buttonName);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java
index 81fca78c2..fbed88bbc 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Sub scribeButton Response is sent, when SubscribeButton has been called
@@ -24,10 +27,20 @@ public class SubscribeButtonResponse extends RPCResponse {
* parameter</p>
*
*
- * @param hash
- * The Hashtable to use
+ * @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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
index 3c2a245ee..86f23c69b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
@@ -48,12 +51,21 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* parameter</p>
*
*
- * @param hash
- * The Hashtable to use
+ * @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);
+ }
/**
* Sets gps
* @param gps
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java
index 880a97229..8ca946c5c 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeWayPointsResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
@@ -13,4 +16,15 @@ public class SubscribeWayPointsResponse extends RPCResponse {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
new file mode 100644
index 000000000..6ee294905
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
@@ -0,0 +1,78 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+
+import java.util.Hashtable;
+
+/**
+ * Struct that indicates the a SystemCapabilityType and houses different structs to describe particular capabilities
+ */
+
+public class SystemCapability extends RPCStruct {
+ public static final String KEY_SYSTEM_CAPABILITY_TYPE = "systemCapabilityType";
+ public static final String KEY_NAVIGATION_CAPABILITY = "navigationCapability";
+ public static final String KEY_PHONE_CAPABILITY = "phoneCapability";
+ public static final String KEY_VIDEO_STREAMING_CAPABILITY = "videoStreamingCapability";
+ public static final String KEY_REMOTE_CONTROL_CAPABILITY = "remoteControlCapability";
+
+ public SystemCapability(){}
+
+ public SystemCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Create a systemCapability object
+ * @param systemCapabilityType The type
+ */
+ public SystemCapability(@NonNull SystemCapabilityType systemCapabilityType){
+ this();
+ setSystemCapabilityType(systemCapabilityType);
+ }
+
+ /**
+ *
+ * @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(){
+ return (SystemCapabilityType) getObject(SystemCapabilityType.class, KEY_SYSTEM_CAPABILITY_TYPE);
+ }
+
+ /**
+ * @param value Set the SystemCapabilityType that indicates which type of data should be changed and identifies which data object exists in this struct.
+ */
+ public void setSystemCapabilityType(@NonNull SystemCapabilityType value){
+ setValue(KEY_SYSTEM_CAPABILITY_TYPE, value);
+ }
+
+ public RPCStruct getCapabilityForType(SystemCapabilityType type) {
+ if (type.equals(SystemCapabilityType.NAVIGATION)) {
+ return (RPCStruct) getObject(NavigationCapability.class, KEY_NAVIGATION_CAPABILITY);
+ } else if (type.equals(SystemCapabilityType.PHONE_CALL)) {
+ return (RPCStruct) getObject(PhoneCapability.class, KEY_PHONE_CAPABILITY);
+ } else if (type.equals(SystemCapabilityType.VIDEO_STREAMING)){
+ return (RPCStruct) getObject(VideoStreamingCapability.class, KEY_VIDEO_STREAMING_CAPABILITY);
+ }else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){
+ return (RPCStruct) getObject(RemoteControlCapabilities.class, KEY_REMOTE_CONTROL_CAPABILITY);
+ }else{
+ return null;
+ }
+ }
+
+ public void setCapabilityForType(SystemCapabilityType type, RPCStruct capability){
+ if(type.equals(SystemCapabilityType.NAVIGATION)){
+ setValue(KEY_NAVIGATION_CAPABILITY, capability);
+ }else if(type.equals(SystemCapabilityType.PHONE_CALL)){
+ setValue(KEY_PHONE_CAPABILITY, capability);
+ }else if(type.equals(SystemCapabilityType.VIDEO_STREAMING)){
+ setValue(KEY_VIDEO_STREAMING_CAPABILITY, capability);
+ }else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){
+ setValue(KEY_REMOTE_CONTROL_CAPABILITY, capability);
+ }else{
+ return;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java
index 154907419..7c614c447 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequest.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
@@ -63,6 +65,15 @@ public class SystemRequest extends RPCRequest {
super(hash);
}
+ /**
+ * Constructs a new SystemRequest object
+ * @param requestType The type of system request.
+ */
+ public SystemRequest(@NonNull RequestType requestType){
+ this();
+ setRequestType(requestType);
+ }
+
@SuppressWarnings("unchecked")
public List<String> getLegacyData() {
return (List<String>) getObject(String.class, KEY_DATA);
@@ -84,7 +95,7 @@ public class SystemRequest extends RPCRequest {
return (RequestType) getObject(RequestType.class, KEY_REQUEST_TYPE);
}
- public void setRequestType(RequestType requestType) {
+ public void setRequestType(@NonNull RequestType requestType) {
setParameters(KEY_REQUEST_TYPE, requestType);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java
index 6fc920f1e..fab8b09ba 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* System Request Response is sent, when SystemRequest has been called
@@ -18,4 +21,15 @@ public class SystemRequestResponse extends RPCResponse {
public SystemRequestResponse(Hashtable<String, Object> hash) {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java
index d98bb8a5c..a1e26d6b2 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TTSChunk.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
@@ -51,10 +53,21 @@ public class TTSChunk extends RPCStruct {
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);
+ }
/**
* 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 );
}
@@ -62,7 +75,7 @@ public class TTSChunk extends RPCStruct {
* 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 void setText( String text ) {
+ public void setText(@NonNull String text ) {
setValue(KEY_TEXT, text);
}
/**
@@ -76,7 +89,7 @@ public class TTSChunk extends RPCStruct {
* 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 void setType( SpeechCapabilities type ) {
+ public void setType(@NonNull SpeechCapabilities type ) {
setValue(KEY_TYPE, type);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java
new file mode 100644
index 000000000..87513a3cd
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Temperature.java
@@ -0,0 +1,69 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.TemperatureUnit;
+import com.smartdevicelink.util.SdlDataTypeConverter;
+
+import java.util.Hashtable;
+
+public class Temperature extends RPCStruct{
+ public static final String KEY_UNIT = "unit";
+ public static final String KEY_VALUE = "value";
+
+ 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);
+ }
+
+ /**
+ * Sets the unit portion of the Temperature class
+ *
+ * @param unit
+ * Temperature Unit.
+ */
+ public void setUnit(@NonNull TemperatureUnit unit) {
+ setValue(KEY_UNIT, unit);
+ }
+
+ /**
+ * Gets the unit portion of the Temperature class
+ *
+ * @return TemperatureUnit - Temperature Unit.
+ */
+ public TemperatureUnit getUnit() {
+ return (TemperatureUnit) getObject(TemperatureUnit.class, KEY_UNIT);
+ }
+
+ /**
+ * Gets the value portion of the Temperature class
+ *
+ * @return Float - Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL.
+ */
+ public Float getValue() {
+ Object value = getValue(KEY_VALUE);
+ return SdlDataTypeConverter.objectToFloat(value);
+ }
+
+ /**
+ * 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.
+ */
+ public void setValue(@NonNull Float value) {
+ setValue(KEY_VALUE, value);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java
index 28e283e9f..7f745186b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TextField.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -61,7 +63,7 @@ import static com.smartdevicelink.proxy.rpc.TireStatus.KEY_INNER_RIGHT_REAR;
* @see PerformInteraction
* @see ScrollableMessage
* @see PerformAudioPassThru
- * @see ShowConstantTBT
+ * @see ShowConstantTbt
*
*/
public class TextField extends RPCStruct {
@@ -80,6 +82,20 @@ public class TextField extends RPCStruct {
public TextField(Hashtable<String, Object> hash) {
super(hash);
}
+ /**
+ * Constructs a newly allocated TextField object
+ * @param name Enumeration identifying the field.
+ * @param characterSet The character set that is supported in this field.
+ * @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
@@ -91,7 +107,7 @@ public class TextField extends RPCStruct {
* Set the enumeration identifying the field.
* @param name the name of TextField
*/
- public void setName( TextFieldName name ) {
+ public void setName(@NonNull TextFieldName name ) {
setValue(KEY_NAME, name);
}
/**
@@ -105,7 +121,7 @@ public class TextField extends RPCStruct {
* Set the character set that is supported in this field.
* @param characterSet - the character set
*/
- public void setCharacterSet( CharacterSet characterSet ) {
+ public void setCharacterSet(@NonNull CharacterSet characterSet ) {
setValue(KEY_CHARACTER_SET, characterSet);
}
/**
@@ -127,7 +143,7 @@ public class TextField extends RPCStruct {
* </ul>
* @param width the number of characters in one row of this field
*/
- public void setWidth( Integer width ) {
+ public void setWidth(@NonNull Integer width ) {
setValue(KEY_WIDTH, width);
}
/**
@@ -141,7 +157,7 @@ public class TextField extends RPCStruct {
public Integer getRows() {
return getInteger( KEY_ROWS );
}
- public void setRows( Integer rows ) {
+ public void setRows(@NonNull Integer rows ) {
setValue(KEY_ROWS, rows);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java
index 4b2169215..4a5e95625 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TireStatus.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataNotificationStatus;
import com.smartdevicelink.proxy.rpc.enums.WarningLightStatus;
@@ -79,61 +81,81 @@ public class TireStatus extends RPCStruct {
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
- * <p>
- * The Hashtable to use</p>
+ *
+ * @param hash The Hashtable to use
*/
-
- public TireStatus() { }
- public TireStatus(Hashtable<String, Object> hash) {
+ public TireStatus(Hashtable<String, Object> hash) {
super(hash);
}
- public void setPressureTellTale(WarningLightStatus pressureTellTale) {
+
+ /**
+ * 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);
+ }
+
+ public void setPressureTellTale(@NonNull WarningLightStatus pressureTellTale) {
setValue(KEY_PRESSURE_TELL_TALE, pressureTellTale);
}
public WarningLightStatus getPressureTellTale() {
return (WarningLightStatus) getObject(WarningLightStatus.class, KEY_PRESSURE_TELL_TALE);
}
- public void setLeftFront(SingleTireStatus leftFront) {
+ public void setLeftFront(@NonNull SingleTireStatus leftFront) {
setValue(KEY_LEFT_FRONT, leftFront);
}
@SuppressWarnings("unchecked")
public SingleTireStatus getLeftFront() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_LEFT_FRONT);
}
- public void setRightFront(SingleTireStatus rightFront) {
+ public void setRightFront(@NonNull SingleTireStatus rightFront) {
setValue(KEY_RIGHT_FRONT, rightFront);
}
@SuppressWarnings("unchecked")
public SingleTireStatus getRightFront() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_RIGHT_FRONT);
}
- public void setLeftRear(SingleTireStatus leftRear) {
+ public void setLeftRear(@NonNull SingleTireStatus leftRear) {
setValue(KEY_LEFT_REAR, leftRear);
}
@SuppressWarnings("unchecked")
public SingleTireStatus getLeftRear() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_LEFT_REAR);
}
- public void setRightRear(SingleTireStatus rightRear) {
+ public void setRightRear(@NonNull SingleTireStatus rightRear) {
setValue(KEY_RIGHT_REAR, rightRear);
}
@SuppressWarnings("unchecked")
public SingleTireStatus getRightRear() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_RIGHT_REAR);
}
- public void setInnerLeftRear(SingleTireStatus innerLeftRear) {
+ public void setInnerLeftRear(@NonNull SingleTireStatus innerLeftRear) {
setValue(KEY_INNER_LEFT_REAR, innerLeftRear);
}
@SuppressWarnings("unchecked")
public SingleTireStatus getInnerLeftRear() {
return (SingleTireStatus) getObject(SingleTireStatus.class, KEY_INNER_LEFT_REAR);
}
- public void setInnerRightRear(SingleTireStatus innerRightRear) {
+ public void setInnerRightRear(@NonNull SingleTireStatus innerRightRear) {
setValue(KEY_INNER_RIGHT_REAR, innerRightRear);
}
@SuppressWarnings("unchecked")
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java
index 2c0a1a260..b14dcfaec 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchCoord.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -45,21 +47,30 @@ import java.util.Hashtable;
public class TouchCoord extends RPCStruct {
public static final String KEY_X = "x";
public static final String KEY_Y = "y";
+
public TouchCoord() {}
+
/**
* <p>Constructs a new TouchCoord object indicated by the Hashtable parameter</p>
- *
- *
- * @param hash
- * <p>
- * The Hashtable to use</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);
+ }
- public void setX(Integer x) {
+ public void setX(@NonNull Integer x) {
setValue(KEY_X, x);
}
@@ -67,7 +78,7 @@ public class TouchCoord extends RPCStruct {
return getInteger(KEY_X);
}
- public void setY(Integer y) {
+ public void setY(@NonNull Integer y) {
setValue(KEY_Y, y);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java
index 58433f26c..0abb75062 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.ArrayList;
@@ -64,16 +66,26 @@ public class TouchEvent extends RPCStruct {
/**
* <p>Constructs a new TouchEvent object indicated by the Hashtable parameter</p>
*
- *
- * @param hash
- * <p>
- * The Hashtable to use</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);
+ }
- public void setId(Integer id) {
+ public void setId(@NonNull Integer id) {
setValue(KEY_ID, id);
}
@@ -113,7 +125,7 @@ public class TouchEvent extends RPCStruct {
return null;
}
- public void setTimestamps(List<Long> ts){
+ public void setTimestamps(@NonNull List<Long> ts){
setValue(KEY_TS, ts);
}
@@ -136,7 +148,7 @@ public class TouchEvent extends RPCStruct {
public List<TouchCoord> getC() {
return getTouchCoordinates();
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
public List<TouchCoord> getTouchCoordinates() {
return (List<TouchCoord>) getObject(TouchCoord.class, KEY_C);
}
@@ -151,7 +163,7 @@ public class TouchEvent extends RPCStruct {
setTouchCoordinates(c);
}
- public void setTouchCoordinates( List<TouchCoord> c ) {
+ public void setTouchCoordinates(@NonNull List<TouchCoord> c ) {
setValue(KEY_C, c);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java
index 668c81e0d..c8c441158 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
@@ -52,8 +54,21 @@ public class TouchEventCapabilities extends RPCStruct {
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);
+ }
- public void setPressAvailable(Boolean pressAvailable) {
+ public void setPressAvailable(@NonNull Boolean pressAvailable) {
setValue(KEY_PRESS_AVAILABLE, pressAvailable);
}
@@ -61,7 +76,7 @@ public class TouchEventCapabilities extends RPCStruct {
return getBoolean(KEY_PRESS_AVAILABLE);
}
- public void setMultiTouchAvailable(Boolean multiTouchAvailable) {
+ public void setMultiTouchAvailable(@NonNull Boolean multiTouchAvailable) {
setValue(KEY_MULTI_TOUCH_AVAILABLE, multiTouchAvailable);
}
@@ -69,7 +84,7 @@ public class TouchEventCapabilities extends RPCStruct {
return getBoolean(KEY_MULTI_TOUCH_AVAILABLE);
}
- public void setDoublePressAvailable(Boolean doublePressAvailable) {
+ public void setDoublePressAvailable(@NonNull Boolean doublePressAvailable) {
setValue(KEY_DOUBLE_PRESS_AVAILABLE, doublePressAvailable);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java
index 8db9e032f..a00e375bd 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java
@@ -14,212 +14,7 @@ import com.smartdevicelink.proxy.RPCRequest;
* <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>
- *
- * <p><b>HMILevel can be FULL, LIMITED, BACKGROUND or NONE</b></p>
- *
- * <p><b>Parameter List</b></p>
- * <table border="1" rules="all">
- * <tr>
- * <th>Name</th>
- * <th>Type</th>
- * <th>Description</th>
- * <th>Reg.</th>
- * <th>Notes</th>
- * <th>SmartDeviceLink Version</th>
- * </tr>
- * <tr>
- * <td>gps</td>
- * <td>Boolean</td>
- * <td>GPS data. See {@linkplain GPSData} for details</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>speed</td>
- * <td>Boolean</td>
- * <td>The vehicle speed in kilometers per hour</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>rpm</td>
- * <td>Boolean</td>
- * <td>The number of revolutions per minute of the engine</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>fuelLevel</td>
- * <td>Boolean</td>
- * <td>The fuel level in the tank (percentage)</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>fuelLevel_State</td>
- * <td>Boolean</td>
- * <td>The fuel level state</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>instantFuelConsumption</td>
- * <td>Boolean</td>
- * <td>The instantaneous fuel consumption in microlitres</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>externalTemperature</td>
- * <td>Boolean</td>
- * <td>The external temperature in degrees celsius</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>prndl</td>
- * <td>Boolean</td>
- * <td>Currently selected gear.</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>tirePressure</td>
- * <td>Boolean</td>
- * <td>Tire pressure status</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>odometer</td>
- * <td>Boolean</td>
- * <td>Odometer in km</td>
- * <td>N</td>
- * <td>Max Length: 500</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>beltStatus</td>
- * <td>Boolean</td>
- * <td>The status of the seat belts</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>bodyInformation</td>
- * <td>Boolean</td>
- * <td>The body information including ignition status and internal temp</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>deviceStatus</td>
- * <td>Boolean</td>
- * <td>The device status including signal and battery strength</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>driverBraking</td>
- * <td>Boolean</td>
- * <td>The status of the brake pedal</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>wiperStatus</td>
- * <td>Boolean</td>
- * <td>The status of the wipers</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>headLampStatus</td>
- * <td>Boolean</td>
- * <td>Status of the head lamps</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>engineTorque</td>
- * <td>Boolean</td>
- * <td>Torque value for engine (in Nm) on non-diesel variants</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>accPedalPosition</td>
- * <td>Boolean</td>
- * <td>Accelerator pedal position (percentage depressed)</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>steeringWheelAngle</td>
- * <td>Boolean</td>
- * <td>Current angle of the steering wheel (in deg)</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>eCallInfo</td>
- * <td>Boolean</td>
- * <td>Emergency Call notification and confirmation data.</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>airbagStatus</td>
- * <td>Boolean</td>
- * <td>The status of the air bags.</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>emergencyEvent</td>
- * <td>Boolean</td>
- * <td>Information related to an emergency event (and if it occurred).</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>clusterModeStatus</td>
- * <td>Boolean</td>
- * <td>The status modes of the instrument panel cluster.</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * <tr>
- * <td>myKey</td>
- * <td>Boolean</td>
- * <td>Information related to the MyKey feature.</td>
- * <td>N</td>
- * <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
- * </tr>
- * </table>
+ *
* @see RegisterAppInterface
* @see OnAppInterfaceUnregistered
*/
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java
index d77bf3b39..4660dc24e 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Unregister AppInterface Response is sent, when UnregisterAppInterface has been called
@@ -30,4 +33,15 @@ public class UnregisterAppInterfaceResponse extends RPCResponse {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
index 521800426..53a4e9162 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
@@ -63,29 +65,35 @@ public class UnsubscribeButton extends RPCRequest {
* parameter
* <p></p>
*
- * @param hash
- * The Hashtable to use
- */
+ * @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);
+ }
+
/**
* Gets a name of the button to unsubscribe from
*
- * @return ButtonName -an Enumeration value, see <i>
- * {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i>
- */
+ * @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);
}
/**
* Sets the name of the button to unsubscribe from
*
- * @param buttonName
- * an enum value, see <i>
- * {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i>
- */
- public void setButtonName( ButtonName buttonName ) {
+ * @param buttonName an enum value, see <i> {@linkplain com.smartdevicelink.proxy.rpc.enums.ButtonName}</i>
+ */
+ public void setButtonName(@NonNull ButtonName buttonName ) {
setParameters(KEY_BUTTON_NAME, buttonName);
}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java
index 7efc00955..5d6bd8579 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Unsubscribe Button Response is sent, when UnsubscribeButton has been called
@@ -24,10 +27,20 @@ public class UnsubscribeButtonResponse extends RPCResponse {
* parameter
* <p></p>
*
- * @param hash
- * The Hashtable to use
+ * @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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
index af3c94444..bba857522 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.util.DebugTool;
import static android.provider.Contacts.SettingsColumns.KEY;
@@ -42,9 +45,20 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
/**
* Constructs a new UnsubscribeVehicleDataResponse object
*/
- public UnsubscribeVehicleDataResponse() {
- super(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString());
- }
+ 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
@@ -135,7 +149,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
}
/**
* Sets Fuel Level State
- * @param fuelLevel_State
+ * @param fuelLevelState
*/
public void setFuelLevelState(VehicleDataResult fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java
index 8804892aa..b7feef73e 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeWayPointsResponse.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Hashtable;
@@ -13,4 +16,15 @@ public class UnsubscribeWayPointsResponse extends RPCResponse {
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);
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java
index add51c5a5..5b0fbabf7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java
@@ -1,9 +1,12 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
/**
* Update Turn List Response is sent, when UpdateTurnList has been called
@@ -23,4 +26,15 @@ public class UpdateTurnListResponse extends RPCResponse{
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);
+ }
+
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
index c0965cd39..10860deab 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -41,28 +43,38 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataType;
public class VehicleDataResult extends RPCStruct {
public static final String KEY_DATA_TYPE = "dataType";
public static final String KEY_RESULT_CODE = "resultCode";
+
+ public VehicleDataResult() { }
/**
* <p>
* Constructs a new VehicleDataResult object indicated by the Hashtable
* parameter
* </p>
*
- * @param hash
- *
- * <p>The Hashtable to use</p>
+ * @param hash the Hashtable to use
*/
-
- public VehicleDataResult() { }
public VehicleDataResult(Hashtable<String, Object> hash) {
super(hash);
}
- public void setDataType(VehicleDataType dataType) {
+
+ /**
+ * 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 void setDataType(@NonNull VehicleDataType dataType) {
setValue(KEY_DATA_TYPE, dataType);
}
public VehicleDataType getDataType() {
return (VehicleDataType) getObject(VehicleDataType.class, KEY_DATA_TYPE);
}
- public void setResultCode(VehicleDataResultCode resultCode) {
+ public void setResultCode(@NonNull VehicleDataResultCode resultCode) {
setValue(KEY_RESULT_CODE, resultCode);
}
public VehicleDataResultCode getResultCode() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
new file mode 100644
index 000000000..6600cf38d
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
@@ -0,0 +1,52 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * Contains information about this system's video streaming capabilities.
+ */
+
+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 VideoStreamingCapability(){}
+ public VideoStreamingCapability(Hashtable<String, Object> hash){super(hash);}
+
+ public void setPreferredResolution(ImageResolution res){
+ setValue(KEY_PREFERRED_RESOLUTION, res);
+ }
+
+ public ImageResolution getPreferredResolution(){
+ return (ImageResolution) getObject(ImageResolution.class, KEY_PREFERRED_RESOLUTION);
+ }
+
+ public void setMaxBitrate(Integer maxBitrate){
+ setValue(KEY_MAX_BITRATE, maxBitrate);
+ }
+
+ public Integer getMaxBitrate(){
+ return getInteger(KEY_MAX_BITRATE);
+ }
+
+ public void setSupportedFormats(List<VideoStreamingFormat> formats){
+ setValue(KEY_SUPPORTED_FORMATS, formats);
+ }
+
+ public List<VideoStreamingFormat> getSupportedFormats(){
+ return (List<VideoStreamingFormat>) getObject(VideoStreamingFormat.class, KEY_SUPPORTED_FORMATS);
+ }
+
+ public Boolean getIsHapticSpatialDataSupported() {
+ return getBoolean(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED);
+ }
+
+ public void setIsHapticSpatialDataSupported(Boolean hapticSpatialDataSupported) {
+ setValue(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, hapticSpatialDataSupported);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java
new file mode 100644
index 000000000..0ddfec2ef
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java
@@ -0,0 +1,54 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
+
+import java.util.Hashtable;
+
+/**
+ * Video streaming formats and their specifications.
+ */
+
+public class VideoStreamingFormat extends RPCStruct {
+ public static final String KEY_PROTOCOL = "protocol";
+ public static final String KEY_CODEC = "codec";
+
+ 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);
+ }
+
+ public void setProtocol(@NonNull VideoStreamingProtocol protocol){
+ setValue(KEY_PROTOCOL, protocol);
+ }
+
+ public VideoStreamingProtocol getProtocol(){
+ return (VideoStreamingProtocol) getObject(VideoStreamingProtocol.class, KEY_PROTOCOL);
+ }
+
+ public void setCodec(@NonNull VideoStreamingCodec codec){
+ setValue(KEY_CODEC, codec);
+ }
+
+ public VideoStreamingCodec getCodec(){
+ return (VideoStreamingCodec) getObject(VideoStreamingCodec.class, KEY_CODEC);
+ }
+
+ @Override
+ public String toString() {
+ return "codec=" + String.valueOf(getCodec()) +
+ ", protocol=" + String.valueOf(getProtocol());
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java
index 00474cd06..10eb6b0be 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VrHelpItem.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy.rpc;
+import android.support.annotation.NonNull;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
@@ -49,22 +51,33 @@ 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 VrHelpItem() { }
/**
* <p>
* Constructs a new VrHelpItem object indicated by the Hashtable
* parameter
* </p>
*
- * @param hash
- * <p>
- * The Hashtable to use
+ * @param hash -The Hashtable to use
*/
-
- public VrHelpItem() { }
public VrHelpItem(Hashtable<String, Object> hash) {
super(hash);
}
- public void setText(String text) {
+
+ /**
+ * 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 void setText(@NonNull String text) {
setValue(KEY_TEXT, text);
}
public String getText() {
@@ -77,7 +90,7 @@ public class VrHelpItem extends RPCStruct {
public Image getImage() {
return (Image) getObject(Image.class, KEY_IMAGE);
}
- public void setPosition(Integer position) {
+ public void setPosition(@NonNull Integer position) {
setValue(KEY_POSITION, position);
}
public Integer getPosition() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java
index a6aed67d9..0a4f56255 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java
@@ -39,9 +39,18 @@ public enum AppHMIType {
*/
TESTING,
/**
+ * Custom App Interfaces
+ */
+ PROJECTION,
+ /**
* System App
*/
- SYSTEM;
+ SYSTEM,
+ /**
+ * Remote Control
+ */
+ REMOTE_CONTROL,
+ ;
/**
* Convert String to AppHMIType
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java
index 1391a9d44..f478a78ee 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java
@@ -115,7 +115,28 @@ public enum ButtonName{
*
* @since SmartDeviceLink 1.0
*/
- PRESET_9, CUSTOM_BUTTON, SEARCH;
+ 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,
+ ;
public static ButtonName valueForString(String value) {
try{
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java
new file mode 100644
index 000000000..4c6b15e85
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/DefrostZone.java
@@ -0,0 +1,17 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+public enum DefrostZone {
+ FRONT,
+ REAR,
+ ALL,
+ NONE,
+ ;
+
+ public static DefrostZone valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java
index 5f0a0b88f..4ac4f6264 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java
@@ -11,6 +11,83 @@ import java.util.EnumSet;
*/
public enum Language {
/**
+ * English - SA
+ */
+
+ EN_SA("EN-SA"),
+
+ /**
+ * Hebrew - IL
+ */
+
+ HE_IL("HE-IL"),
+
+ /**
+ * Romanian - RO
+ */
+
+ RO_RO("RO-RO"),
+
+ /**
+ * Ukrainian - UA
+ */
+
+ UK_UA("UK-UA"),
+
+ /**
+ * Indonesian - ID
+ */
+
+ ID_ID("ID-ID"),
+
+ /**
+ * Vietnamese - VN
+ */
+
+ VI_VN("VI-VN"),
+
+ /**
+ * Malay - MY
+ */
+
+ MS_MY("MS-MY"),
+
+ /**
+ * Hindi - IN
+ */
+
+ HI_IN("HI-IN"),
+
+ /**
+ * Dutch - BE
+ */
+
+ NL_BE("NL-BE"),
+
+ /**
+ * Greek - GR
+ */
+
+ EL_GR("EL-GR"),
+
+ /**
+ * Hungarian - HU
+ */
+
+ HU_HU("HU-HU"),
+
+ /**
+ * Finnish - FI
+ */
+
+ FI_FI("FI-FI"),
+
+ /**
+ * Slovak - SK
+ */
+
+ SK_SK("SK-SK"),
+ /**
* English - US
*/
@@ -129,7 +206,17 @@ public enum Language {
* Norwegian - Norway
*/
- NO_NO("NO-NO");
+ NO_NO("NO-NO"),
+ /**
+ * English - India
+ */
+
+ EN_IN("EN-IN"),
+ /**
+ * Thai - Thailand
+ */
+
+ TH_TH("TH-TH");
private final String INTERNAL_NAME;
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java
new file mode 100644
index 000000000..9f51a6437
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java
@@ -0,0 +1,96 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+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 internalName;
+
+ private MetadataType(String internalName) {
+ this.internalName = internalName;
+ }
+
+ public String toString() {
+ return this.internalName;
+ }
+
+ 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/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java
new file mode 100644
index 000000000..faef92d36
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/ModuleType.java
@@ -0,0 +1,15 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+public enum ModuleType {
+ CLIMATE,
+ RADIO,
+ ;
+
+ public static ModuleType valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java
new file mode 100644
index 000000000..2b2c862d8
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioBand.java
@@ -0,0 +1,16 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+public enum RadioBand {
+ AM,
+ FM,
+ XM,
+ ;
+
+ public static RadioBand valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java
new file mode 100644
index 000000000..533c86dca
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RadioState.java
@@ -0,0 +1,20 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * List possible states of a remote control radio module.
+ */
+public enum RadioState {
+ ACQUIRING,
+ ACQUIRED,
+ MULTICAST,
+ NOT_FOUND,
+ ;
+
+ public static RadioState valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java
index 870e4115e..c0a15f235 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java
@@ -168,7 +168,16 @@ 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;
+ 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,
+ ;
/**
* Convert String to Result
* @param value String
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
new file mode 100644
index 000000000..a6cf96d57
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
@@ -0,0 +1,429 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * <p>The SystemCapabilityType indicates which type of capability information exists in a SystemCapability struct.</p>
+ *
+ * <p><b>Enum List</b></p>
+ * <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>
+ * <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>
+ * <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>
+ * <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>
+ * <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>
+ * <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</td>
+ * </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>
+ * <tr>
+ * <td>PCM_STREAMING</td>
+ * <td>AudioPassThruCapabilities</td>
+ * <td>Returns an 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>
+ * <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>
+ * <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>
+ * <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>
+ * <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>
+ * <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>
+ * <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>
+ *
+ */
+
+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,
+
+ /**
+ * <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,
+
+ /**
+ * <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,
+
+ /**
+ * <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,
+
+ /* 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,
+
+ /**
+ * 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>
+ */
+ DISPLAY,
+
+ /**
+ * 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,
+
+ /**
+ * 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,
+
+ /**
+ * 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>
+ */
+ BUTTON,
+
+ /**
+ * 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,
+
+ /**
+ * 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>
+ */
+ PRESET_BANK,
+
+ /**
+ * 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>
+ */
+ SOFTBUTTON,
+
+ /**
+ * 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,
+ /**
+ * 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,
+
+ ;
+
+ public static SystemCapabilityType valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java
new file mode 100644
index 000000000..6c9b04875
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TemperatureUnit.java
@@ -0,0 +1,14 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+public enum TemperatureUnit {
+ CELSIUS,
+ FAHRENHEIT;
+
+ public static TemperatureUnit valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TouchType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TouchType.java
index 952904915..7cc259aa4 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TouchType.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/TouchType.java
@@ -20,7 +20,11 @@ public enum TouchType {
*
*/
- END;
+ END,
+ /** The user has made a cancellation gesture.
+ *
+ */
+ CANCEL;
/**
* Convert String to TouchType
* @param value String
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java
new file mode 100644
index 000000000..b7a2ae9a2
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VentilationMode.java
@@ -0,0 +1,17 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+public enum VentilationMode {
+ UPPER,
+ LOWER,
+ BOTH,
+ NONE,
+ ;
+
+ public static VentilationMode valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java
new file mode 100644
index 000000000..a41c1d064
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java
@@ -0,0 +1,50 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Enum for each type of video streaming codec.
+ */
+
+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;
+
+ public static VideoStreamingCodec valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java
new file mode 100644
index 000000000..412badcac
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java
@@ -0,0 +1,44 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * Enum for each type of video streaming protocol type.
+ */
+
+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;
+
+ public static VideoStreamingProtocol valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java
new file mode 100644
index 000000000..107de1bf9
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java
@@ -0,0 +1,52 @@
+package com.smartdevicelink.proxy.rpc.listeners;
+
+import android.util.Log;
+
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import org.json.JSONException;
+
+import java.util.Vector;
+
+/**
+ * This is the listener for sending Multiple RPCs.
+ */
+public abstract class OnMultipleRequestListener extends OnRPCResponseListener {
+
+ final Vector<Integer> correlationIds;
+ OnRPCResponseListener rpcResponseListener;
+ private static String TAG = "OnMultipleRequestListener";
+
+ public OnMultipleRequestListener(){
+ setListenerType(UPDATE_LISTENER_TYPE_MULTIPLE_REQUESTS);
+ correlationIds = new Vector<>();
+
+ rpcResponseListener = new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ correlationIds.remove(Integer.valueOf(correlationId));
+ if(correlationIds.size()>0){
+ onUpdate(correlationIds.size());
+ }else{
+ 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 abstract void onError(int correlationId, Result resultCode, String info);
+
+ public OnRPCResponseListener getSingleRpcResponseListener(){
+ return rpcResponseListener;
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java
index 4bc5ccd79..c21244926 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java
@@ -12,6 +12,10 @@ public abstract class OnRPCResponseListener {
* Listener type specific to putfile
*/
public final static int UPDATE_LISTENER_TYPE_PUT_FILE = 1;
+ /**
+ * Listener type specific to sendRequests and sendSequentialRequests
+ */
+ 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
diff --git a/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java b/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
index 40cc7d5ed..f6a668279 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
@@ -2,13 +2,18 @@ package com.smartdevicelink.streaming;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.interfaces.IAudioStreamListener;
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
-public class StreamPacketizer extends AbstractPacketizer implements Runnable{
+public class StreamPacketizer extends AbstractPacketizer implements IVideoStreamListener, IAudioStreamListener, Runnable{
public final static String TAG = "StreamPacketizer";
@@ -23,21 +28,31 @@ public class StreamPacketizer extends AbstractPacketizer implements Runnable{
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;
+
public SdlConnection sdlConnection = null;
private Object mPauseLock;
private boolean mPaused;
private boolean isServiceProtected = false;
-
+ private BlockingQueue<ByteBuffer> mOutputQueue;
+
public StreamPacketizer(IStreamListener streamListener, InputStream is, SessionType sType, byte rpcSessionID, SdlSession session) throws IOException {
super(streamListener, is, sType, rpcSessionID, session);
mPauseLock = new Object();
mPaused = false;
isServiceProtected = _session.isServiceProtected(_serviceType);
+ if (bufferSize == 0) {
+ // fail safe
+ bufferSize = BUFF_READ_SIZE;
+ }
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<ByteBuffer>(MAX_QUEUE_SIZE / bufferSize);
}
public void start() throws IOException {
@@ -75,20 +90,48 @@ public class StreamPacketizer extends AbstractPacketizer implements Runnable{
}
}
- 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);
+ 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
+ ByteBuffer frame;
+ try {
+ frame = mOutputQueue.take();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ break;
+ }
+
+ while (frame.hasRemaining()) {
+ int len = frame.remaining() > bufferSize ? bufferSize : frame.remaining();
+
+ 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);
+ }
}
}
} catch (IOException e)
@@ -119,4 +162,82 @@ public class StreamPacketizer extends AbstractPacketizer implements Runnable{
mPauseLock.notifyAll();
}
}
+
+ /**
+ * Called by the app.
+ *
+ * @see com.smartdevicelink.proxy.interfaces.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 com.smartdevicelink.proxy.interfaces.IVideoStreamListener#sendFrame(ByteBuffer, long)
+ */
+ @Override
+ public void sendFrame(ByteBuffer data, long presentationTimeUs) {
+ sendByteBufferData(data);
+ }
+
+ /**
+ * Called by the app.
+ *
+ * @see com.smartdevicelink.proxy.interfaces.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 com.smartdevicelink.proxy.interfaces.IAudioStreamListener#sendAudio(ByteBuffer, long)
+ */
+ @Override
+ public void sendAudio(ByteBuffer data, long presentationTimeUs) {
+ sendByteBufferData(data);
+ }
+
+ 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(buffer);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ private void sendByteBufferData(ByteBuffer data) {
+ 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(buffer);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingCodec.java b/sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingCodec.java
new file mode 100644
index 000000000..bf69a792b
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingCodec.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017, Xevo 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 copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.streaming.audio;
+
+/**
+ * Enum for each type of audio streaming codec.
+ */
+public enum AudioStreamingCodec {
+ /**
+ * Linear-PCM without any compression.
+ */
+ LPCM;
+
+ public static AudioStreamingCodec valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingLPCMParams.java b/sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingLPCMParams.java
new file mode 100644
index 000000000..bde6abc4c
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingLPCMParams.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017, Xevo 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 copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.streaming.audio;
+
+/**
+ * A struct to hold LPCM specific audio format information.
+ */
+public class AudioStreamingLPCMParams extends AudioStreamingParams {
+ /**
+ * Sample format of linear PCM data.
+ */
+ public enum SampleFormat {
+ /**
+ * LPCM data is represented by 8-bit unsigned integers. Centerpoint is 128.
+ */
+ LPCM_8BIT_UNSIGNED,
+
+ /**
+ * 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 SampleFormat sampleFormat;
+
+ public AudioStreamingLPCMParams(SampleFormat sampleFormat, int samplingRate, int channels) {
+ super(samplingRate, channels);
+ this.sampleFormat = sampleFormat;
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingParams.java b/sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingParams.java
new file mode 100644
index 000000000..fe0f7a981
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/streaming/audio/AudioStreamingParams.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, Xevo 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 copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.streaming.audio;
+
+/**
+ * A struct to hold audio format information that are common to codecs.
+ */
+public class AudioStreamingParams {
+ /**
+ * Sampling rate in Hz, e.g. 44100
+ * <p>
+ * This is reserved for future and not used right now.
+ */
+ public int samplingRate;
+
+ /**
+ * Number of channels in the audio stream
+ * <p>
+ * This is reserved for future and not used right now.
+ */
+ public int channels;
+
+ public AudioStreamingParams(int samplingRate, int channels) {
+ this.samplingRate = samplingRate;
+ this.channels = channels;
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java b/sdl_android/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java
new file mode 100644
index 000000000..6946d1fbb
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java
@@ -0,0 +1,507 @@
+/*
+ * Copyright (c) 2017, Xevo 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 copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.streaming.video;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.Random;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import com.smartdevicelink.SdlConnection.SdlConnection;
+import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.protocol.ProtocolMessage;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
+import com.smartdevicelink.streaming.AbstractPacketizer;
+import com.smartdevicelink.streaming.IStreamListener;
+
+/*
+ * Note for testing.
+ * The RTP stream generated by this packetizer can be tested with GStreamer (1.4 or later).
+ * Assuming that "VideoStreamPort" is configured as 5050 in smartDeviceLink.ini, here is the
+ * GStreamer pipeline that receives the stream, decode it and render it:
+ *
+ * $ gst-launch-1.0 souphttpsrc location=http://127.0.0.1:5050 ! "application/x-rtp-stream" ! rtpstreamdepay ! "application/x-rtp,media=(string)video,clock-rate=90000,encoding-name=(string)H264" ! rtph264depay ! "video/x-h264, stream-format=(string)avc, alignment=(string)au" ! avdec_h264 ! autovideosink sync=false
+ */
+
+/**
+ * This class receives H.264 byte stream (in Annex-B format), parses it, construct RTP packets
+ * from it based on RFC 6184, then frame the packets based on RFC 4571.
+ * The primary purpose of using RTP is to carry timestamp information along with the data.
+ *
+ * @author Sho Amano
+ */
+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<ByteBuffer>(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() {
+ SdlConnection connection = _session.getSdlConnection();
+
+ while (mThread != null && !mThread.isInterrupted()) {
+ ByteBuffer frame;
+ try {
+ frame = mOutputQueue.take();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ break;
+ }
+
+ while (frame.hasRemaining()) {
+ int len = frame.remaining() > bufferSize ? bufferSize : frame.remaining();
+
+ 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 (connection != null) {
+ connection.endService(_serviceType, _rpcSessionID);
+ }
+ }
+
+ /**
+ * Called by the app and encoder.
+ *
+ * @see com.smartdevicelink.proxy.interfaces.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 com.smartdevicelink.proxy.interfaces.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/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java b/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
new file mode 100644
index 000000000..8af6b1c59
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2017 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.streaming.video;
+
+import android.annotation.TargetApi;
+import android.app.Presentation;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+import android.view.Display;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+
+import java.lang.reflect.Constructor;
+import java.util.concurrent.Callable;
+
+/**
+ * SdlRemoteDisplay is an abstract class that should be extended by developers to creat their remote displays.
+ * All logic for UI events can be stored in their extension.
+ *
+ * <br><br> <b>NOTE:</b> When the UI changes (buttons appear, layouts change, etc) the developer should call {@link #invalidate()} to alert any
+ * other interfaces that are listening for those types of events.
+ */
+@TargetApi(17)
+public abstract class SdlRemoteDisplay extends Presentation {
+ private static final String TAG = "SdlRemoteDisplay";
+ private static final int REFRESH_RATE_MS = 50;
+
+ protected Window w;
+ protected View mainView;
+ protected Handler handler = new Handler();
+ protected Handler uiHandler = new Handler(Looper.getMainLooper());
+ protected Callback callback;
+
+ public SdlRemoteDisplay(Context context, Display display) {
+ super(context, display);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ setTitle(TAG);
+
+ w = getWindow();
+
+ startRefreshTask();
+
+ w.setType(WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION);
+ }
+
+ protected void startRefreshTask() {
+ handler.postDelayed(mStartRefreshTaskCallback, REFRESH_RATE_MS);
+ }
+
+ protected void stopRefreshTask() {
+ handler.removeCallbacks(mStartRefreshTaskCallback);
+ }
+
+ protected Runnable mStartRefreshTaskCallback = new Runnable() {
+ public void run() {
+ if(mainView == null){
+ mainView = w.getDecorView().findViewById(android.R.id.content);
+ }
+ if (mainView != null) {
+ mainView.invalidate();
+ }
+
+ handler.postDelayed(this, REFRESH_RATE_MS);
+ }
+ };
+
+ @SuppressWarnings("unused")
+ public View getMainView(){
+ if(mainView == null){
+ mainView = w.getDecorView().findViewById(android.R.id.content);
+ }
+ return this.mainView;
+ }
+
+ @SuppressWarnings("unused")
+ public void invalidate(){
+ // let listeners know the view has been invalidated
+ if(callback != null){
+ callback.onInvalidated(this);
+ }
+ }
+
+ public void handleMotionEvent(final MotionEvent motionEvent){
+ uiHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mainView.dispatchTouchEvent(motionEvent);
+ }
+ });
+ }
+
+ public void stop(){
+ stopRefreshTask();
+ dismissPresentation();
+ }
+
+ public void dismissPresentation() {
+ uiHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ dismiss();
+ }
+ });
+ }
+ public interface Callback{
+ void onCreated(SdlRemoteDisplay remoteDisplay);
+ void onInvalidated(SdlRemoteDisplay remoteDisplay);
+ }
+
+ public static class Creator implements Callable<Boolean> {
+ private Context context;
+ private Display mDisplay;
+ boolean presentationShowError = false;
+ SdlRemoteDisplay remoteDisplay;
+ Class<? extends SdlRemoteDisplay> remoteDisplayClass;
+ private Handler uiHandler = new Handler(Looper.getMainLooper());
+ private 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;
+ this.remoteDisplayClass = remoteDisplayClass;
+ this.callback = callback;
+ }
+
+ @Override
+ public Boolean call() {
+
+ uiHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ // Want to create presentation on UI thread so it finds the right Looper
+ // when setting up the Dialog.
+ if ((remoteDisplay == null) && (mDisplay != null))
+ {
+ try {
+ Constructor constructor = remoteDisplayClass.getConstructor(Context.class, Display.class);
+ remoteDisplay = (SdlRemoteDisplay) constructor.newInstance(context, mDisplay);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Log.e(TAG, "Unable to create Presentation Class");
+ presentationShowError = true;
+ return;
+ }
+
+ try {
+ remoteDisplay.show();
+ remoteDisplay.callback = callback;
+ if(callback!=null){
+ callback.onCreated(remoteDisplay);
+ }
+
+ } catch (WindowManager.InvalidDisplayException ex) {
+ Log.e(TAG, "Couldn't show presentation! Display was removed in the meantime.", ex);
+ remoteDisplay = null;
+ presentationShowError = true;
+ }
+ }
+ }
+ });
+
+ return presentationShowError;
+ }
+
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java b/sdl_android/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
new file mode 100644
index 000000000..f565a22dc
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2017 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.streaming.video;
+
+import android.util.DisplayMetrics;
+
+import com.smartdevicelink.proxy.rpc.ImageResolution;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
+
+import java.util.List;
+
+@SuppressWarnings("FieldCanBeLocal")
+public class VideoStreamingParameters {
+ private final VideoStreamingProtocol DEFAULT_PROTOCOL = VideoStreamingProtocol.RAW;
+ private final VideoStreamingCodec DEFAULT_CODEC = VideoStreamingCodec.H264;
+ private final int DEFAULT_WIDTH = 1024;
+ private final int DEFAULT_HEIGHT = 576;
+ private final int DEFAULT_DENSITY = DisplayMetrics.DENSITY_HIGH;
+ private final int DEFAULT_FRAMERATE = 30;
+ private final int DEFAULT_BITRATE = 512000;
+ private final int DEFAULT_INTERVAL = 5;
+
+
+ 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;
+ }
+
+ /**
+ * Will only copy values that are not null or are greater than 0
+ * @param params VideoStreamingParameters that should be copied into this new instants
+ */
+ @SuppressWarnings("unused")
+ 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) {
+ if (params.displayDensity > 0) {
+ this.displayDensity = params.displayDensity;
+ }
+ if (params.frameRate > 0) {
+ this.frameRate = params.frameRate;
+ }
+ if (params.bitrate > 0) {
+ this.bitrate = params.bitrate;
+ }
+ if (params.interval > 0) {
+ this.interval = params.interval;
+ }
+ if (params.resolution != null) {
+ if (params.resolution.getResolutionHeight() != null && params.resolution.getResolutionHeight() > 0) {
+ this.resolution.setResolutionHeight(params.resolution.getResolutionHeight());
+ }
+ if (params.resolution.getResolutionWidth() != null && params.resolution.getResolutionWidth() > 0) {
+ this.resolution.setResolutionWidth(params.resolution.getResolutionWidth());
+ }
+ }
+ if (params.format != null) {
+ this.format = params.format;
+ }
+ }
+ }
+
+ /**
+ * 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
+ * @see com.smartdevicelink.proxy.SystemCapabilityManager
+ * @see VideoStreamingCapability
+ */
+ public void update(VideoStreamingCapability capability){
+ if(capability.getMaxBitrate()!=null){ this.bitrate = capability.getMaxBitrate(); }
+ ImageResolution resolution = capability.getPreferredResolution();
+ if(resolution!=null){
+ if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight(resolution.getResolutionHeight()); }
+ if(resolution.getResolutionWidth()!=null && resolution.getResolutionWidth() > 0){ this.resolution.setResolutionWidth(resolution.getResolutionWidth()); }
+ }
+ List<VideoStreamingFormat> formats = capability.getSupportedFormats();
+ if(formats != null && formats.size()>0){
+ this.format = formats.get(0);
+ }
+
+ }
+
+ @SuppressWarnings("unused")
+ public void setDisplayDensity(int displayDensity) {
+ this.displayDensity = displayDensity;
+ }
+
+ public int getDisplayDensity() {
+ return displayDensity;
+ }
+
+ public void setFrameRate(int frameRate) {
+ this.frameRate = frameRate;
+ }
+
+ public int getFrameRate() {
+ return frameRate;
+ }
+
+ public void setBitrate(int bitrate) {
+ this.bitrate = bitrate;
+ }
+
+ public int getBitrate() {
+ return bitrate;
+ }
+
+ public void setInterval(int interval) {
+ this.interval = interval;
+ }
+
+ public int getInterval() {
+ return interval;
+ }
+
+ public void setFormat(VideoStreamingFormat format){
+ this.format = format;
+ }
+
+ public VideoStreamingFormat getFormat(){
+ return format;
+ }
+
+ public void setResolution(ImageResolution resolution){
+ this.resolution = resolution;
+ }
+
+ public ImageResolution getResolution() {
+ return resolution;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("VideoStreamingParams - format: {");
+ builder.append(format.toString());
+ builder.append("}, resolution: {");
+ builder.append(resolution.getResolutionHeight());
+ builder.append(" , ");
+ builder.append(resolution.getResolutionWidth());
+ builder.append("}, frame rate {");
+ builder.append(frameRate);
+ builder.append("}, displayDensity{ ");
+ builder.append(displayDensity);
+ builder.append("}, bitrate");
+ builder.append(bitrate);
+ builder.append("}, IFrame interval{ ");
+ builder.append(interval);
+ builder.append("}");
+ return builder.toString();
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransport.java b/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransport.java
index 526d2226d..5d0c9bed5 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransport.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransport.java
@@ -10,6 +10,7 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
+import android.os.Build;
import android.os.Build.VERSION;
import com.smartdevicelink.SdlConnection.SdlConnection;
@@ -46,6 +47,8 @@ public class BTTransport extends SdlTransport {
// Boolean to monitor if the transport is in a disconnecting state
private boolean _disconnecting = false;
+
+ private final Object DISCONNECT_LOCK = new Object();
public BTTransport(ITransportListener transportListener) {
super(transportListener);
@@ -55,8 +58,14 @@ public class BTTransport extends SdlTransport {
super(transportListener);
bKeepSocketActive = bKeepSocket;
} // end-ctor
-
+
+ @Deprecated
public BluetoothSocket getBTSocket(BluetoothServerSocket bsSocket){
+
+ if(bsSocket == null || Build.VERSION.SDK_INT > Build.VERSION_CODES.O) { //Reflection is no longer allowed on SDK classes)
+ return null;
+ }
+
Field[] f = bsSocket.getClass().getDeclaredFields();
@SuppressWarnings("unused")
@@ -83,11 +92,14 @@ public class BTTransport extends SdlTransport {
return null;
}
-
+
+ @Deprecated
public int getChannel(BluetoothSocket bsSocket){
int channel = -1;
- if (bsSocket == null) return channel;
+ if (bsSocket == null || Build.VERSION.SDK_INT > Build.VERSION_CODES.O){ //Reflection is no longer allowed on SDK classes
+ return channel;
+ }
Field[] f = bsSocket.getClass().getDeclaredFields();
@@ -172,7 +184,7 @@ public class BTTransport extends SdlTransport {
sComment = "Accepting Connections on SDP Server Port Number: " + iSocket + "\r\n";
sComment += "Keep Server Socket Open: " + bKeepSocketActive;
- if (iSocket < 0)
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O && iSocket < 0)
{
SdlConnection.enableLegacyMode(false, null);
throw new SdlException("Could not open connection to SDL.", SdlExceptionCause.BLUETOOTH_SOCKET_UNAVAILABLE);
@@ -229,13 +241,15 @@ public class BTTransport extends SdlTransport {
* @param msg
* @param ex
*/
- private synchronized void disconnect(String msg, Exception ex) {
- // If already disconnecting, return
- if (_disconnecting) {
- // No need to recursively call
- return;
- }
- _disconnecting = true;
+ private void disconnect(String msg, Exception ex) {
+ synchronized(DISCONNECT_LOCK) {
+ // If already disconnecting, return
+ if (_disconnecting) {
+ // No need to recursively call
+ return;
+ }
+ _disconnecting = true;
+ }
String disconnectMsg = (msg == null ? "" : msg);
if (ex != null) {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java b/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
index 2d3725e76..c27182d76 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
@@ -12,6 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
+ *
+ *
+ * Note: This file has been modified from its original form.
*/
package com.smartdevicelink.transport;
@@ -29,6 +32,7 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@@ -50,10 +54,15 @@ public class MultiplexBluetoothTransport {
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";
-
-
- protected static final String SHARED_PREFS = "sdl.bluetoothprefs";
+ // Key names received from the BluetoothSerialServer Handler
+ public static final String DEVICE_NAME = "device_name";
+ public static final String DEVICE_ADDRESS = "device_address";
+ public static final String TOAST = "toast";
+ private static final long MS_TILL_TIMEOUT = 2500;
+ private static final int READ_BUFFER_SIZE = 4096;
+ private static final Object THREAD_LOCK = new Object();;
+ protected static final String SHARED_PREFS = "sdl.bluetoothprefs";
// Constants that indicate the current connection state
public static final int STATE_NONE = 0; // we're doing nothing
@@ -67,40 +76,24 @@ public class MultiplexBluetoothTransport {
private final BluetoothAdapter mAdapter = BluetoothAdapter.getDefaultAdapter();
private final Handler mHandler;
private AcceptThread mSecureAcceptThread;
- private static Object threadLock = null;
private ConnectThread mConnectThread;
- private static ConnectedThread mConnectedThread; //I HATE ALL THIS STATIC CRAP, But it seems like the only way right now
- private static ConnectedWriteThread mConnectedWriteThread; //I HATE ALL THIS STATIC CRAP, But it seems like the only way right now
-
- private static int mState;
-
- // Key names received from the BluetoothSerialServer Handler
- public static final String DEVICE_NAME = "device_name";
- public static final String TOAST = "toast";
-
-
+ private ConnectedThread mConnectedThread;
+ private ConnectedWriteThread mConnectedWriteThread;
+ private int mState;
private int mBluetoothLevel = 0;
Handler timeOutHandler;
Runnable socketRunable;
- private static final long msTillTimeout = 2500;
-
- private static final int READ_BUFFER_SIZE = 4096;
+ boolean keepSocketAlive = true;
public static String currentlyConnectedDevice = null;
public static String currentlyConnectedDeviceAddress = null;
- private static MultiplexBluetoothTransport serverInstance = null;
- //private BluetoothServerSocket serverSocket= null;
- static boolean keepSocketAlive = true;
-
-
/**
* Constructor. Prepares a new BluetoothChat session.
- * @param context The UI Activity Context
* @param handler A Handler to send messages back to the UI Activity
*/
- private MultiplexBluetoothTransport(Handler handler) {
+ public MultiplexBluetoothTransport(Handler handler) {
//Log.w(TAG, "Creating Bluetooth Serial Adapter");
// mAdapter = BluetoothAdapter.getDefaultAdapter();
mState = STATE_NONE;
@@ -108,32 +101,41 @@ public class MultiplexBluetoothTransport {
//This will keep track of which method worked last night
mBluetoothLevel = SdlRouterService.getBluetoothPrefs(SHARED_PREFS);
- Object object = new Object();
- threadLock = object;
-
}
-
- /*
- * Let's use this method from now on to get bluetooth service
+ /**
+ * This method has been deprecated. It will return an instance of MultiplexBluetoothTransport but <b>should not</b> be used.
+ * @param handler for receiving status messages from the transport
+ * @return an instance of MultiplexBluetoothTransport
+ * @deprecated
*/
+ @Deprecated
public synchronized static MultiplexBluetoothTransport getBluetoothSerialServerInstance(Handler handler){
- return getBluetoothSerialServerInstance(handler,true);
+ return new MultiplexBluetoothTransport(handler);
}
- /*
- * Let's use this method from now on to get bluetooth service
+ /**
+ * This method has been deprecated. It will return an instance of MultiplexBluetoothTransport but <b>should not</b> be used.
+ * @param handler for receiving status messages from the transport
+ * @param keepSocketAlive Flag for keeping the socket alive
+ * @return an instance of MultiplexBluetoothTransport
+ * @deprecated
*/
+ @Deprecated
public synchronized static MultiplexBluetoothTransport getBluetoothSerialServerInstance(Handler handler, boolean keepSocketAlive){
-
- if(serverInstance==null){
- serverInstance = new MultiplexBluetoothTransport(handler);
- }
- MultiplexBluetoothTransport.keepSocketAlive = keepSocketAlive;
- return serverInstance;
+ MultiplexBluetoothTransport transport = new MultiplexBluetoothTransport(handler);
+ transport.setKeepSocketAlive(keepSocketAlive);
+ return transport;
}
+
+ /**
+ * This method has been deprecated. <b>It will always return null.</b>
+ * @return always null
+ * @deprecated
+ */
+ @Deprecated
public synchronized static MultiplexBluetoothTransport getBluetoothSerialServerInstance(){
- return serverInstance;
+ return null;
}
//These methods are used so we can have a semi-static reference to the Accept Thread (Static reference inherited by housing class)
@@ -146,8 +148,6 @@ public class MultiplexBluetoothTransport {
protected synchronized void setStateManually(int state){
//Log.d(TAG, "Setting state from: " +mState + " to: " +state);
mState = state;
-
- clearInstanceOnError(state);
}
/**
* Set the current state of the chat connection
@@ -161,14 +161,6 @@ public class MultiplexBluetoothTransport {
// Give the new state to the Handler so the UI Activity can update
//Also sending the previous state so we know if we lost a connection
mHandler.obtainMessage(SdlRouterService.MESSAGE_STATE_CHANGE, state, previousState).sendToTarget();
-
- clearInstanceOnError(state);
- }
-
- private void clearInstanceOnError(int state){
- if(state == STATE_ERROR){
- serverInstance = null;
- }
}
/**
@@ -178,7 +170,7 @@ public class MultiplexBluetoothTransport {
}
public void setKeepSocketAlive(boolean keepSocketAlive){
- MultiplexBluetoothTransport.keepSocketAlive = keepSocketAlive;
+ this.keepSocketAlive = keepSocketAlive;
}
/**
@@ -187,7 +179,7 @@ public class MultiplexBluetoothTransport {
public synchronized void start() {
//Log.d(TAG, "Starting up Bluetooth Server to Listen");
// Cancel any thread attempting to make a connection
- if (serverInstance.mConnectThread != null) {serverInstance.mConnectThread.cancel(); serverInstance.mConnectThread = null;}
+ if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
// Cancel any thread currently running a connection
if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
@@ -196,14 +188,14 @@ public class MultiplexBluetoothTransport {
// Start the thread to listen on a BluetoothServerSocket
- if (getBluetoothSerialServerInstance().getAcceptThread() == null
- && serverInstance.mAdapter != null
- && serverInstance.mAdapter.isEnabled()) {
+ if (getAcceptThread() == null
+ && mAdapter != null
+ && mAdapter.isEnabled()) {
//Log.d(TAG, "Secure thread was null, attempting to create new");
- getBluetoothSerialServerInstance().setAcceptThread(new AcceptThread(true));
- if(getBluetoothSerialServerInstance().getAcceptThread()!=null){
- getBluetoothSerialServerInstance().setState(STATE_LISTEN);
- getBluetoothSerialServerInstance().getAcceptThread().start();
+ setAcceptThread(new AcceptThread(true));
+ if(getAcceptThread()!=null){
+ setState(STATE_LISTEN);
+ getAcceptThread().start();
}
}
}
@@ -215,7 +207,7 @@ public class MultiplexBluetoothTransport {
public synchronized void connect(BluetoothDevice device) {
// Cancel any thread attempting to make a connection
if (mState == STATE_CONNECTING) {
- if (serverInstance.mConnectThread != null) {serverInstance.mConnectThread.cancel(); serverInstance.mConnectThread = null;}
+ if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
}
// Cancel any thread currently running a connection
@@ -230,9 +222,9 @@ public class MultiplexBluetoothTransport {
}
// Start the thread to connect with the given device
- serverInstance.mConnectThread = new ConnectThread(device);
- serverInstance.mConnectThread.start();
- serverInstance.setState(STATE_CONNECTING);
+ mConnectThread = new ConnectThread(device);
+ mConnectThread.start();
+ setState(STATE_CONNECTING);
}
/**
@@ -242,9 +234,9 @@ public class MultiplexBluetoothTransport {
*/
public synchronized void connected(BluetoothSocket socket, BluetoothDevice device) {
// Cancel the thread that completed the connection
- if (getBluetoothSerialServerInstance().mConnectThread != null) {
- getBluetoothSerialServerInstance().mConnectThread.cancel();
- getBluetoothSerialServerInstance().mConnectThread = null;
+ if (mConnectThread != null) {
+ mConnectThread.cancel();
+ mConnectThread = null;
}
// Cancel any thread currently running a connection
@@ -257,9 +249,9 @@ public class MultiplexBluetoothTransport {
mConnectedWriteThread = null;
}
// Cancel the accept thread because we only want to connect to one device
- if (!keepSocketAlive && getBluetoothSerialServerInstance().mSecureAcceptThread != null) {
- getBluetoothSerialServerInstance().mSecureAcceptThread.cancel();
- getBluetoothSerialServerInstance().mSecureAcceptThread = null;
+ if (!keepSocketAlive && mSecureAcceptThread != null) {
+ mSecureAcceptThread.cancel();
+ mSecureAcceptThread = null;
}
// Start the thread to manage the connection and perform transmissions
@@ -269,32 +261,33 @@ public class MultiplexBluetoothTransport {
mConnectedWriteThread = new ConnectedWriteThread(socket);
mConnectedWriteThread.start();
- //Store a static name of the device that is connected. We can do this since the only time
- //we will access it will be when we receive a CONNECT packet from a device
- if(device!=null && device.getName()!=null && device.getName()!=""){
- currentlyConnectedDevice = device.getName();
- }
+
// Send the name of the connected device back to the UI Activity
Message msg = mHandler.obtainMessage(SdlRouterService.MESSAGE_DEVICE_NAME);
Bundle bundle = new Bundle();
- bundle.putString(DEVICE_NAME, device.getName());
+ //Store a static name of the device that is connected.
+ currentlyConnectedDevice = device.getName();
+ if(currentlyConnectedDevice != null){
+ bundle.putString(DEVICE_NAME, currentlyConnectedDevice);
+ bundle.putString(DEVICE_ADDRESS, device.getAddress());
+ }
msg.setData(bundle);
- getBluetoothSerialServerInstance().mHandler.sendMessage(msg);
- getBluetoothSerialServerInstance().setState(STATE_CONNECTED);
+ mHandler.sendMessage(msg);
+ setState(STATE_CONNECTED);
}
/**
* Stop all threads
*/
public synchronized void stop() {
- getBluetoothSerialServerInstance().stop(STATE_NONE);
+ stop(STATE_NONE);
}
protected synchronized void stop(int stateToTransitionTo) {
//Log.d(TAG, "Attempting to close the bluetooth serial server");
- if (getBluetoothSerialServerInstance().mConnectThread != null) {
- getBluetoothSerialServerInstance().mConnectThread.cancel();
- getBluetoothSerialServerInstance().mConnectThread = null;
+ if (mConnectThread != null) {
+ mConnectThread.cancel();
+ mConnectThread = null;
}
if (mConnectedThread != null) {
@@ -308,7 +301,7 @@ public class MultiplexBluetoothTransport {
mSecureAcceptThread = null;
}
- getBluetoothSerialServerInstance().setState(stateToTransitionTo);
+ setState(stateToTransitionTo);
}
@@ -339,7 +332,7 @@ public class MultiplexBluetoothTransport {
Bundle bundle = new Bundle();
bundle.putString(TOAST, "Unable to connect device");
msg.setData(bundle);
- getBluetoothSerialServerInstance().mHandler.sendMessage(msg);
+ mHandler.sendMessage(msg);
// Start the service over to restart listening mode
// BluetoothSerialServer.this.start();
@@ -354,14 +347,14 @@ public class MultiplexBluetoothTransport {
Bundle bundle = new Bundle();
bundle.putString(TOAST, "Device connection was lost");
msg.setData(bundle);
- getBluetoothSerialServerInstance().mHandler.sendMessage(msg);
- getBluetoothSerialServerInstance().stop();
+ mHandler.sendMessage(msg);
+ stop();
}
private void timerDelayRemoveDialog(final BluetoothSocket sock){
- getBluetoothSerialServerInstance().timeOutHandler = new Handler();
- getBluetoothSerialServerInstance().socketRunable = new Runnable() {
+ timeOutHandler = new Handler();
+ socketRunable = new Runnable() {
public void run() {
//Log.e(TAG, "BLUETOOTH SOCKET CONNECT TIMEOUT - ATTEMPT TO CLOSE SOCKET");
try {
@@ -371,7 +364,7 @@ public class MultiplexBluetoothTransport {
}
}
};
- getBluetoothSerialServerInstance().timeOutHandler.postDelayed(socketRunable, msTillTimeout);
+ timeOutHandler.postDelayed(socketRunable, MS_TILL_TIMEOUT);
}
@@ -388,14 +381,14 @@ public class MultiplexBluetoothTransport {
@SuppressLint("NewApi")
public AcceptThread(boolean secure) {
- synchronized(threadLock){
+ 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 = getBluetoothSerialServerInstance().mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE, SERVER_UUID);
+ tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE, SERVER_UUID);
}
} catch (IOException e) {
//Log.e(TAG, "Socket Type: " + mSocketType + "listen() failed", e);
@@ -412,7 +405,7 @@ public class MultiplexBluetoothTransport {
}
public void run() {
- synchronized(threadLock){
+ synchronized(THREAD_LOCK){
Log.d(TAG, "Socket Type: " + mSocketType +
" BEGIN mAcceptThread" + this);
setName("AcceptThread" + mSocketType);
@@ -425,7 +418,7 @@ public class MultiplexBluetoothTransport {
try {
if(listenAttempts>=5){
Log.e(TAG, "Complete failure in attempting to listen for Bluetooth connection, erroring out.");
- getBluetoothSerialServerInstance().stop(STATE_ERROR);
+ MultiplexBluetoothTransport.this.stop(STATE_ERROR);
return;
}
listenAttempts++;
@@ -440,12 +433,12 @@ public class MultiplexBluetoothTransport {
}
else{
Log.e(TAG, "Listening Socket was null, stopping the bluetooth serial server.");
- getBluetoothSerialServerInstance().stop(STATE_ERROR);
+ MultiplexBluetoothTransport.this.stop(STATE_ERROR);
return;
}
} catch (IOException e) {
Log.e(TAG, "Socket Type: " + mSocketType + "accept() failed");
- getBluetoothSerialServerInstance().stop(STATE_ERROR);
+ MultiplexBluetoothTransport.this.stop(STATE_ERROR);
return;
}
@@ -456,7 +449,7 @@ public class MultiplexBluetoothTransport {
case STATE_LISTEN:
case STATE_CONNECTING:
// Situation normal. Start the connected thread.
- getBluetoothSerialServerInstance().connected(socket, socket.getRemoteDevice());
+ connected(socket, socket.getRemoteDevice());
break;
case STATE_NONE:
@@ -464,9 +457,7 @@ public class MultiplexBluetoothTransport {
// Either not ready or already connected. Terminate new socket.
try {
Log.d(TAG, "Close unwanted socket");
- if(socket!=null){
- socket.close();
- }
+ socket.close();
} catch (IOException e) {
Log.e(TAG, "Could not close unwanted socket", e);
}
@@ -739,7 +730,7 @@ public class MultiplexBluetoothTransport {
// Exception during write
//OMG! WE MUST NOT BE CONNECTED ANYMORE! LET THE USER KNOW
Log.e(TAG, "Error sending bytes to connected device!");
- getBluetoothSerialServerInstance().connectionLost();
+ connectionLost();
}
}
@@ -797,7 +788,7 @@ public class MultiplexBluetoothTransport {
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];
@@ -847,9 +838,9 @@ public class MultiplexBluetoothTransport {
return !(mState == STATE_NONE);
}
-
+ @Deprecated
public BluetoothSocket getBTSocket(BluetoothServerSocket bsSocket){
- if(bsSocket == null){
+ if(bsSocket == null || Build.VERSION.SDK_INT > Build.VERSION_CODES.O){ //Reflection is no longer allowed on SDK classes
return null;
}
Field[] f = bsSocket.getClass().getDeclaredFields();
@@ -875,11 +866,12 @@ public class MultiplexBluetoothTransport {
return null;
}
-
+
+ @Deprecated
public int getChannel(BluetoothSocket bsSocket){
int channel = -1;
- if (bsSocket == null){
+ if (bsSocket == null || Build.VERSION.SDK_INT > Build.VERSION_CODES.O){ //Reflection is no longer allowed on SDK classes
return channel;
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java b/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
index b42732d3a..d4b341721 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
@@ -22,8 +22,10 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
+import android.os.Build;
import android.util.Log;
+import com.smartdevicelink.util.AndroidTools;
import com.smartdevicelink.util.HttpRequestTask;
import com.smartdevicelink.util.HttpRequestTask.HttpRequestTaskCallback;
@@ -117,18 +119,29 @@ public class RouterServiceValidator {
if(this.service != null){
Log.d(TAG, "Supplied service name of " + this.service.getClassName());
- if(!isServiceRunning(context,this.service)){
+ 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;
Log.w(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())) {
+ return true;
+ }
}
}
if(this.service == null){
- this.service= componentNameForServiceRunning(pm); //Change this to an array if multiple services are started?
- if(this.service == null){ //if this is still null we know there is no service running so we can return false
+ if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O ) {
+ this.service = componentNameForServiceRunning(pm); //Change this to an array if multiple services are started?
+ if (this.service == null) { //if this is still null we know there is no service running so we can return false
+ wakeUpRouterServices();
+ return false;
+ }
+ }else{
wakeUpRouterServices();
return false;
}
+
}
//Log.d(TAG, "Checking app package: " + service.getClassName());
@@ -154,7 +167,7 @@ public class RouterServiceValidator {
if(BluetoothAdapter.getDefaultAdapter()!=null && BluetoothAdapter.getDefaultAdapter().isEnabled()){
Intent intent = new Intent(TransportConstants.START_ROUTER_SERVICE_ACTION);
intent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
- context.sendBroadcast(intent);
+ AndroidTools.sendExplicitBroadcast(context,intent,null);
}
}
public ComponentName getService(){
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
index 6a5cda6b7..defeb67fa 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
@@ -1,30 +1,37 @@
package com.smartdevicelink.transport;
-import java.util.List;
-import java.util.Locale;
-import java.util.Vector;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import com.smartdevicelink.util.AndroidTools;
-import com.smartdevicelink.transport.RouterServiceValidator.TrustedListCallback;
-
+import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothProfile;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.os.Build;
import android.util.Log;
+import com.smartdevicelink.R;
+import com.smartdevicelink.transport.RouterServiceValidator.TrustedListCallback;
+import com.smartdevicelink.util.AndroidTools;
+import com.smartdevicelink.util.SdlAppInfo;
+import com.smartdevicelink.util.ServiceFinder;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Vector;
+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";
- private static final String BOOT_COMPLETE = "android.intent.action.BOOT_COMPLETED";
- private static final String ACL_CONNECTED = "android.bluetooth.device.action.ACL_CONNECTED";
- private static final String STATE_CHANGED = "android.bluetooth.adapter.action.STATE_CHANGED" ;
-
protected static final String SDL_ROUTER_SERVICE_CLASS_NAME = "sdlrouterservice";
public static final String LOCAL_ROUTER_SERVICE_EXTRA = "router_service";
@@ -48,8 +55,9 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
//Log.i(TAG, "Sdl Receiver Activated");
- String action = intent.getAction();
-
+ final String action = intent.getAction();
+ 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.
@@ -57,9 +65,7 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
return;
}
- if(!(action.equalsIgnoreCase(BOOT_COMPLETE)
- || action.equalsIgnoreCase(ACL_CONNECTED)
- || action.equalsIgnoreCase(STATE_CHANGED)
+ if(!(action.equalsIgnoreCase(BluetoothDevice.ACTION_ACL_CONNECTED)
|| action.equalsIgnoreCase(USBTransport.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
@@ -73,9 +79,42 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
onSdlEnabled(context, intent);
return;
}
-
- boolean didStart = false;
- localRouterClass = defineLocalSdlRouterClass();
+
+ 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 (localRouterClass != null) {
+
+ // Check if the service declaration in AndroidManifest has the intent-filter action specified correctly
+ boolean serviceFilterHasAction = false;
+ String className = localRouterClass.getName();
+ List<SdlAppInfo> services = AndroidTools.querySdlAppInfo(context, null);
+ for (SdlAppInfo sdlAppInfo : services) {
+ if(sdlAppInfo != null && sdlAppInfo.getRouterServiceComponentName() != null && className.equals((sdlAppInfo.getRouterServiceComponentName().getClassName()))){
+ serviceFilterHasAction = true;
+ break;
+ }
+ }
+ if (!serviceFilterHasAction){
+ Log.e(TAG, "WARNING: This application has not specified its intent-filter for the SdlRouterService. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ }
+
+ // Check if the service declaration in AndroidManifest has the router service version metadata specified correctly
+ ResolveInfo info = context.getPackageManager().resolveService(new Intent(context, localRouterClass), PackageManager.GET_META_DATA);
+ if (info != null) {
+ if (info.serviceInfo.metaData == null || !info.serviceInfo.metaData.containsKey(context.getString(R.string.sdl_router_service_version_name))) {
+ Log.e(TAG, "WARNING: This application has not specified its metadata tags for the SdlRouterService. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ }
+ } else {
+ Log.e(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. 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)){
@@ -93,18 +132,12 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
//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
- //Validate the router service so the service knows if this is a trusted router service
- RouterServiceValidator vlad = new RouterServiceValidator(finalContext,componentName);
- finalIntent.putExtra(TransportConstants.ROUTER_SERVICE_VALIDATED, vlad.validate());
onSdlEnabled(finalContext, finalIntent);
}
});
-
-
}
-
}else{
//This was previously not hooked up, so let's leave it commented out
//onSdlDisabled(context);
@@ -113,28 +146,17 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}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 );
+ didStart = wakeUpRouterService(context, false,altServiceWake,device );
}
-
}
-
- if (intent.getAction().contains("android.bluetooth.adapter.action.STATE_CHANGED")){
- int state = intent.getIntExtra("android.bluetooth.adapter.extra.STATE",-1);
- if (state == BluetoothAdapter.STATE_OFF ||
- state == BluetoothAdapter.STATE_TURNING_OFF){
- //onProtocolDisabled(context);
- //Let's let the service that is running manage what to do for this
- //If we were to do it here, for every instance of this BR it would send
- //an intent to stop service, where it's only one that is needed.
- return;
- }
- }
-
+
+
+ Log.d(TAG, "Check for local router");
if(localRouterClass!=null){ //If there is a supplied router service lets run some logic regarding starting one
- if(!didStart){
- didStart = wakeUpRouterService(context, true,false);
+ if(!didStart){Log.d(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
@@ -148,42 +170,79 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
context.sendBroadcast(restart);
}
}
-
- private boolean wakeUpRouterService(Context context, boolean ping, boolean altTransportWake){
- if(!isRouterServiceRunning(context, ping)){
- //If there isn't a service running we should try to start one
- //The under class should have implemented this....
-
- //So let's start up our service since no copy is running
- Intent serviceIntent = new Intent(context, localRouterClass);
- if(altTransportWake){
- serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
- }
- try {
- context.startService(serviceIntent);
- }catch (SecurityException e){
- Log.e(TAG, "Security exception, process is bad");
- return false; // Let's exit, we can't start the service
- }
- return true;
- }else{
- if(altTransportWake && runningBluetoothServicePackage!=null && runningBluetoothServicePackage.size()>0){
- Intent serviceIntent = new Intent();
- serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
- //context.startService(serviceIntent);
- for(ComponentName compName: runningBluetoothServicePackage){
- serviceIntent.setComponent(compName);
- context.startService(serviceIntent);
-
- }
- return true;
- }
- return false;
- }
+
+ 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<ComponentName>();
+ 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
+ Intent serviceIntent;
+ List<SdlAppInfo> sdlAppInfoList = AndroidTools.querySdlAppInfo(context, new SdlAppInfo.BestRouterComparator());
+ if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty()) {
+ serviceIntent = new Intent();
+ serviceIntent.setComponent(sdlAppInfoList.get(0).getRouterServiceComponentName());
+ } else{
+ Log.d(TAG, "No SDL Router Services found");
+ Log.d(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
+ return;
+ }
+ if (altTransportWake) {
+ serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
+ }
+ if(device != null){
+ serviceIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
+ }
+ try {
+ if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
+ context.startService(serviceIntent);
+ }else {
+ serviceIntent.putExtra(FOREGROUND_EXTRA, true);
+ 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) {
+ Log.e(TAG, "Security exception, process is bad");
+ }
+ } else {
+ 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);
+ context.startService(serviceIntent);
+
+ }
}
/**
- * Determines if an instance of the Router Service is currently running on the device.
+ * 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.
* @param pingService Set this to true if you want to make sure the service is up and listening to bluetooth
* @return True if a SDL Router Service is currently running, false otherwise.
@@ -193,31 +252,30 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
Log.e(TAG, "Can't look for router service, context supplied was null");
return false;
}
- ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
- if(runningBluetoothServicePackage==null){
+ if (runningBluetoothServicePackage == null) {
runningBluetoothServicePackage = new Vector<ComponentName>();
- }else{
+ } else {
runningBluetoothServicePackage.clear();
}
+ ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ manager.getRunningAppProcesses();
List<RunningServiceInfo> runningServices = null;
- try{
+ try {
runningServices = manager.getRunningServices(Integer.MAX_VALUE);
- }catch(NullPointerException e){
+ } catch (NullPointerException e) {
Log.e(TAG, "Can't get list of running services");
return false;
}
- for (RunningServiceInfo service : runningServices) {
+ 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
- if(pingService){
+ //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
+ if (pingService) {
pingRouterService(context, service.service.getPackageName(), service.service.getClassName());
- }
- }
- }
-
+ }
+ }
+ }
return runningBluetoothServicePackage.size() > 0;
}
@@ -242,33 +300,46 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
// 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(Context context){
+ public static void queryForConnectedService(final Context context){
//Leverage existing call. Include ping bit
- requestTransportStatus(context,null,true);
+ 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<ComponentName>();
+ 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.
*/
+ @Deprecated
public static void requestTransportStatus(Context context, final SdlRouterStatusProvider.ConnectedStatusCallback callback){
- requestTransportStatus(context,callback,false);
+ requestTransportStatus(context,callback,false, true);
}
- private static void requestTransportStatus(Context context, final SdlRouterStatusProvider.ConnectedStatusCallback callback, final boolean triggerRouterServicePing){
+ 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(isRouterServiceRunning(context,false) && !runningBluetoothServicePackage.isEmpty()){ //So there is a service up, let's see if it's connected
+ if((!lookForServices || isRouterServiceRunning(context,false)) && !runningBluetoothServicePackage.isEmpty()){ //So there is a service up, let's see if it's connected
final ConcurrentLinkedQueue<ComponentName> list = new ConcurrentLinkedQueue<ComponentName>(runningBluetoothServicePackage);
final SdlRouterStatusProvider.ConnectedStatusCallback sdlBrCallback = new SdlRouterStatusProvider.ConnectedStatusCallback() {
@@ -307,20 +378,36 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}else{
Log.w(TAG, "Router service isn't running, returning false.");
- if(BluetoothAdapter.getDefaultAdapter()!=null && BluetoothAdapter.getDefaultAdapter().isEnabled()){
+ if(isBluetoothConnected()){
+ Log.d(TAG, "Bluetooth is connected. Attempting to start Router Service");
Intent serviceIntent = new Intent();
serviceIntent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
serviceIntent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
- context.sendBroadcast(serviceIntent);
+ 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()) {
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ 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));
+ }else{
+ return true;
+ }
+ }
+ return false;
+ }
+
public static ComponentName consumeQueuedRouterService(){
synchronized(QUEUED_SERVICE_LOCK){
ComponentName retVal = queuedService;
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlPsm.java b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlPsm.java
index ed86cbb69..1fc40bda4 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlPsm.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlPsm.java
@@ -76,7 +76,7 @@ public class SdlPsm{
frameType = rawByte&(byte)FRAME_TYPE_MASK;
//Log.trace(TAG, rawByte + " = Frame Type: " + frameType);
- if((version < 1 || version > 4) //These are known versions supported by this library.
+ if((version < 1 || version > 5) //These are known versions supported by this library.
&& frameType!=SdlPacket.FRAME_TYPE_CONTROL){
return ERROR_STATE;
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
index 4d3dabfa5..617fabcb2 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
@@ -22,11 +22,15 @@ import org.json.JSONException;
import org.json.JSONObject;
import android.Manifest;
+
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
@@ -41,6 +45,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.DeadObjectException;
@@ -54,6 +59,7 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.util.Log;
import android.util.SparseArray;
+import android.util.SparseIntArray;
import com.smartdevicelink.R;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
@@ -71,6 +77,12 @@ import com.smartdevicelink.transport.utl.ByteAraryMessageAssembler;
import com.smartdevicelink.transport.utl.ByteArrayMessageSpliter;
import com.smartdevicelink.util.AndroidTools;
import com.smartdevicelink.util.BitConverter;
+import com.smartdevicelink.util.SdlAppInfo;
+
+import static com.smartdevicelink.transport.TransportConstants.FOREGROUND_EXTRA;
+import static com.smartdevicelink.transport.TransportConstants.SDL_NOTIFICATION_CHANNEL_ID;
+import static com.smartdevicelink.transport.TransportConstants.SDL_NOTIFICATION_CHANNEL_NAME;
+
/**
* <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
@@ -78,13 +90,14 @@ import com.smartdevicelink.util.BitConverter;
* @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 = 4;
+ protected static final int ROUTER_SERVICE_VERSION_NUMBER = 6;
private static final String ROUTER_SERVICE_PROCESS = "com.smartdevicelink.router";
@@ -93,42 +106,50 @@ public class SdlRouterService extends Service{
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/";
+
/**
* @deprecated use {@link TransportConstants#START_ROUTER_SERVICE_ACTION} instead
*/
@Deprecated
public static final String START_SERVICE_ACTION = "sdl.router.startservice";
- public static final String REGISTER_WITH_ROUTER_ACTION = "com.sdl.android.register";
+ 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;
+ @SuppressWarnings("unused")
+ public static final int MESSAGE_WRITE = 3;
public static final int MESSAGE_DEVICE_NAME = 4;
public static final int MESSAGE_TOAST = 5;
- private final int UNREGISTER_APP_INTERFACE_CORRELATION_ID = 65530;
-
- private static MultiplexBluetoothTransport mSerialService = null;
+ @SuppressWarnings("FieldCanBeLocal")
+ private final int UNREGISTER_APP_INTERFACE_CORRELATION_ID = 65530;
+
+ /**
+ * 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";
+
+ private MultiplexBluetoothTransport mSerialService = null;
private static boolean connectAsClient = false;
private static boolean closing = false;
private boolean isTransportConnected = false;
private TransportType connectedTransportType = null;
- private static Context currentContext = null;
-
- private Handler versionCheckTimeOutHandler, altTransportTimerHandler;
- private Runnable versionCheckRunable, altTransportTimerRunnable;
- private LocalRouterService localCompareTo = null;
- private final static int VERSION_TIMEOUT_RUNNABLE = 1500;
- private final static int ALT_TRANSPORT_TIMEOUT_RUNNABLE = 30000;
-
+
+ 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;
public static HashMap<String,RegisteredApp> registeredApps;
private SparseArray<String> sessionMap;
- private SparseArray<Integer> sessionHashIdMap;
+ private SparseIntArray sessionHashIdMap;
+ private SparseIntArray cleanedSessionMap;
private final Object SESSION_LOCK = new Object(), REGISTERED_APPS_LOCK = new Object(), PING_COUNT_LOCK = new Object();
private static Messenger altTransportService = null;
@@ -136,11 +157,10 @@ public class SdlRouterService extends Service{
private String connectedDeviceName = ""; //The name of the connected Device
private boolean startSequenceComplete = false;
- private ExecutorService packetExecuter = null;
+ private ExecutorService packetExecutor = null;
PacketWriteTaskMaster packetWriteTaskMaster = null;
- private static LocalRouterService selfRouterService;
-
+
/**
* This flag is to keep track of if we are currently acting as a foreground service
*/
@@ -164,14 +184,14 @@ public class SdlRouterService extends Service{
****************************************************************************************************************************************/
/** create our receiver from the router service */
- BroadcastReceiver mainServiceReceiver = new BroadcastReceiver()
+ 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));
+ sendBroadcast(prepareRegistrationIntent(action));
}
};
@@ -180,116 +200,72 @@ public class SdlRouterService extends Service{
registrationIntent.setAction(action);
registrationIntent.putExtra(TransportConstants.BIND_LOCATION_PACKAGE_NAME_EXTRA, this.getPackageName());
registrationIntent.putExtra(TransportConstants.BIND_LOCATION_CLASS_NAME_EXTRA, this.getClass().getName());
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
+ 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(BluetoothAdapter.getDefaultAdapter()!=null && BluetoothAdapter.getDefaultAdapter().isEnabled()){
-
+ if(bluetoothAvailable()){
if(startSequenceComplete &&
!connectAsClient && (mSerialService ==null
|| mSerialService.getState() == MultiplexBluetoothTransport.STATE_NONE)){
- Log.e(TAG, "Serial service not initliazed while registering app");
+ Log.e(TAG, "Serial service not initialized while registering app");
//Maybe we should try to do a connect here instead
Log.d(TAG, "Serial service being restarted");
- if(mSerialService ==null){
- Log.e(TAG, "Local copy of BT Server is null");
- mSerialService = MultiplexBluetoothTransport.getBluetoothSerialServerInstance();
- if(mSerialService==null){
- Log.e(TAG, "Local copy of BT Server is still null and so is global");
- mSerialService = MultiplexBluetoothTransport.getBluetoothSerialServerInstance(mHandlerBT);
+ initBluetoothSerialService();
- }
- }
- mSerialService.start();
}
}
Log.i(TAG, app.appId + " has just been registered with SDL Router Service");
}
-
-
- /**
- * this is to make sure the AceeptThread is still running
- */
- BroadcastReceiver registerAnInstanceOfSerialServer = new BroadcastReceiver() {
- final Object COMPARE_LOCK = new Object();
- @Override
- public void onReceive(Context context, Intent intent)
- {
- LocalRouterService tempService = intent.getParcelableExtra(SdlBroadcastReceiver.LOCAL_ROUTER_SERVICE_EXTRA);
- synchronized(COMPARE_LOCK){
- //Let's make sure we are on the same version.
- if(tempService!=null && tempService.name!=null){
- sdlMultiList.remove(tempService.name.getPackageName());
- if((localCompareTo == null || localCompareTo.isNewer(tempService)) && AndroidTools.isServiceExported(context, tempService.name)){
- LocalRouterService self = getLocalRouterService();
- if(!self.isEqual(tempService)){ //We want to ignore self
- Log.i(TAG, "Newer service received than previously stored service - " + tempService.launchIntent.getAction());
- localCompareTo = tempService;
- }else{
- Log.i(TAG, "Ignoring self local router service");
- }
- }
- if(sdlMultiList.isEmpty()){
- Log.d(TAG, "All router services have been accounted more. We can start the version check now");
- if(versionCheckTimeOutHandler!=null){
- versionCheckTimeOutHandler.removeCallbacks(versionCheckRunable);
- versionCheckTimeOutHandler.post(versionCheckRunable);
- }
- }
- }
- }
- /*if(intent!=null && intent.getBooleanExtra(SdlBroadcastReceiver.LOCAL_ROUTER_SERVICE_DID_START_OWN, false)){
- Log.w(TAG, "Another serivce has been started, let's resend our version info to make sure they know about us too");
- }*/
- }
- @SuppressWarnings("unused")
- private void notifyStartedService(Context context){
- Intent restart = new Intent(SdlRouterService.REGISTER_NEWER_SERVER_INSTANCE_ACTION);
- restart.putExtra(SdlBroadcastReceiver.LOCAL_ROUTER_SERVICE_EXTRA, getLocalRouterService());
- context.sendBroadcast(restart);
- }
- };
-
-
-
/**
* If the user disconnects the bluetooth device we will want to stop SDL and our current
* connection through RFCOMM
*/
- BroadcastReceiver mListenForDisconnect = new BroadcastReceiver()
+ final BroadcastReceiver mListenForDisconnect = new BroadcastReceiver()
{
@Override
+ @SuppressWarnings("MissingPermission")
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
- if(action!=null){Log.d(TAG, "Disconnect received. Action: " + intent.getAction());}
- else{Log.d(TAG, "Disconnect received.");}
- if(intent.getAction()!=null && intent.getAction().equalsIgnoreCase("android.bluetooth.adapter.action.STATE_CHANGED")
- &&( (BluetoothAdapter.getDefaultAdapter().getState() == BluetoothAdapter.STATE_TURNING_ON)
- || (BluetoothAdapter.getDefaultAdapter().getState() == BluetoothAdapter.STATE_ON))){
- return;
- }
-
- connectAsClient=false;
-
- if(action!=null && intent.getAction().equalsIgnoreCase("android.bluetooth.adapter.action.STATE_CHANGED")
- &&( (BluetoothAdapter.getDefaultAdapter().getState() == BluetoothAdapter.STATE_TURNING_OFF)
- || (BluetoothAdapter.getDefaultAdapter().getState() == BluetoothAdapter.STATE_OFF))){
- Log.d(TAG, "Bluetooth is shutting off, SDL Router Service is closing.");
- //Since BT is shutting off...there's no reason for us to be on now.
- //Let's take a break...I'm sleepy
- shouldServiceRemainOpen(intent);
+ if(action == null){
+ Log.d(TAG, "Disconnect received with no action.");
+ }else {
+ Log.d(TAG, "Disconnect received. Action: " + intent.getAction());
+
+ if(action.equalsIgnoreCase(BluetoothAdapter.ACTION_STATE_CHANGED)){
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ if(adapter != null) {
+ int bluetoothState = adapter.getState();
+ 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:
+ Log.d(TAG, "Bluetooth is shutting off, SDL Router Service is closing.");
+ connectAsClient = false;
+ shouldServiceRemainOpen(intent);
+ return;
+ default:
+ break;
+ }
+ }
}
- else{//So we just got d/c'ed from the bluetooth...alright...Let the client know
- if(legacyModeEnabled){
+ //Otherwise
+ connectAsClient = false;
+ if (legacyModeEnabled) {
Log.d(TAG, "Legacy mode enabled and bluetooth d/c'ed, restarting router service bluetooth.");
enableLegacyMode(false);
onTransportDisconnected(TransportType.BLUETOOTH);
@@ -307,7 +283,7 @@ public class SdlRouterService extends Service{
*********************************************** Handlers for bound clients **************************************************************
****************************************************************************************************************************************/
-
+
/**
* Target we publish for clients to send messages to RouterHandler.
*/
@@ -316,13 +292,14 @@ public class SdlRouterService extends Service{
/**
* Handler of incoming messages from clients.
*/
- static class RouterHandler extends Handler {
+ @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){
@@ -354,7 +331,7 @@ public class SdlRouterService extends Service{
if(appId == null){
appId = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
}
- if(appId == null || appId.length()<=0 || msg.replyTo == null){
+ if(appId.length()<=0 || msg.replyTo == null){
Log.w(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;
@@ -416,7 +393,7 @@ public class SdlRouterService extends Service{
appIdToUnregister = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
}
Log.i(TAG, "Unregistering client: " + appIdToUnregister);
- RegisteredApp unregisteredApp = null;
+ RegisteredApp unregisteredApp;
synchronized(service.REGISTERED_APPS_LOCK){
unregisteredApp = registeredApps.remove(appIdToUnregister);
}
@@ -441,33 +418,28 @@ public class SdlRouterService extends Service{
break;
case TransportConstants.ROUTER_SEND_PACKET:
- Log.d(TAG, "Received packet to send");
if(receivedBundle!=null){
Runnable packetRun = new Runnable(){
@Override
public void run() {
- if(receivedBundle!=null){
- String buffAppId = receivedBundle.getString(TransportConstants.APP_ID_EXTRA_STRING);
- if(buffAppId == null){
- buffAppId = "" + receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
- }
- RegisteredApp buffApp = null;
- if(buffAppId!=null){
- synchronized(service.REGISTERED_APPS_LOCK){
- buffApp = registeredApps.get(buffAppId);
- }
- }
-
- if(buffApp !=null){
- buffApp.handleIncommingClientMessage(receivedBundle);
- }else{
- service.writeBytesToTransport(receivedBundle);
- }
- }
- }
+ 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{
+ service.writeBytesToTransport(receivedBundle);
+ }
+ }
};
- if(service.packetExecuter!=null){
- service.packetExecuter.execute(packetRun);
+ if(service.packetExecutor !=null){
+ service.packetExecutor.execute(packetRun);
}
}
break;
@@ -478,7 +450,7 @@ public class SdlRouterService extends Service{
}
Message extraSessionResponse = Message.obtain();
extraSessionResponse.what = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE;
- if(appIdRequesting!=null && appIdRequesting.length()>0){
+ if(appIdRequesting.length()>0){
synchronized(service.REGISTERED_APPS_LOCK){
if(registeredApps!=null){
RegisteredApp appRequesting = registeredApps.get(appIdRequesting);
@@ -510,7 +482,7 @@ public class SdlRouterService extends Service{
service.removeSessionFromMap((int)sessionId);
Message removeSessionResponse = Message.obtain();
removeSessionResponse.what = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE;
- if(appIdWithSession != null && appIdWithSession.length()>0){
+ if(appIdWithSession.length()>0){
if(sessionId>=0){
synchronized(service.REGISTERED_APPS_LOCK){
if(registeredApps!=null){
@@ -555,8 +527,9 @@ public class SdlRouterService extends Service{
/**
* Handler of incoming messages from an alternative transport (USB).
*/
- static class AltTransportHandler extends Handler {
- ClassLoader loader;
+ @SuppressWarnings("Convert2Diamond")
+ static class AltTransportHandler extends Handler {
+ final ClassLoader loader;
final WeakReference<SdlRouterService> provider;
public AltTransportHandler(SdlRouterService provider){
@@ -612,7 +585,7 @@ public class SdlRouterService extends Service{
break;
case TransportConstants.ROUTER_RECEIVED_PACKET:
if(receivedBundle!=null){
- receivedBundle.setClassLoader(loader);//We do this because loading a custom parceable object isn't possible without it
+ 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){
@@ -621,7 +594,7 @@ public class SdlRouterService extends Service{
Log.w(TAG, "Received null packet from alt transport service");
}
}else{
- Log.w(TAG, "Flase positive packet reception");
+ Log.w(TAG, "False positive packet reception");
}
}else{
Log.e(TAG, "Bundle was null while sending packet to router service from alt transport");
@@ -632,9 +605,9 @@ public class SdlRouterService extends Service{
}
}
- };
-
- /**
+ }
+
+ /**
* Target we publish for alternative transport (USB) clients to send messages to RouterHandler.
*/
final Messenger routerStatusMessenger = new Messenger(new RouterStatusHandler(this));
@@ -642,7 +615,8 @@ public class SdlRouterService extends Service{
/**
* Handler of incoming messages from an alternative transport (USB).
*/
- static class RouterStatusHandler extends Handler {
+ @SuppressWarnings("Convert2Diamond")
+ static class RouterStatusHandler extends Handler {
final WeakReference<SdlRouterService> provider;
public RouterStatusHandler(SdlRouterService provider){
@@ -661,7 +635,7 @@ public class SdlRouterService extends Service{
if(msg.replyTo!=null){
Message message = Message.obtain();
message.what = TransportConstants.ROUTER_STATUS_CONNECTED_STATE_RESPONSE;
- message.arg1 = (service.isTransportConnected == true) ? 1 : 0;
+ message.arg1 = (service.isTransportConnected) ? 1 : 0;
try {
msg.replyTo.send(message);
} catch (RemoteException e) {
@@ -672,15 +646,15 @@ public class SdlRouterService extends Service{
if(service.pingIntent == null){
service.initPingIntent();
}
- service.getBaseContext().sendBroadcast(service.pingIntent);
+ AndroidTools.sendExplicitBroadcast(service.getApplicationContext(),service.pingIntent, null);
}
break;
default:
- Log.w(TAG, "Unsopported request: " + msg.what);
+ Log.w(TAG, "Unsupported request: " + msg.what);
break;
}
}
- };
+ }
/* **************************************************************************************************************************************
*********************************************** Life Cycle **************************************************************
@@ -704,7 +678,7 @@ public class SdlRouterService extends Service{
}else if(TransportConstants.BIND_REQUEST_TYPE_STATUS.equals(requestType)){
return this.routerStatusMessenger.getBinder();
}else{
- Log.w(TAG, "Uknown bind request type");
+ Log.w(TAG, "Unknown bind request type");
}
}
@@ -738,9 +712,11 @@ public class SdlRouterService extends Service{
it.remove();
}
}
+
}
}
+ @SuppressWarnings("unused")
private void pingClients(){
Message message = Message.obtain();
Log.d(TAG, "Pinging "+ registeredApps.size()+ " clients");
@@ -766,9 +742,9 @@ public class SdlRouterService extends Service{
}
/**
- * We want to make sure we are in the right process here. If there is somesort of developer error
+ * 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
+ * @return if this service is executing in the correct process
*/
private boolean processCheck(){
int myPid = android.os.Process.myPid();
@@ -786,6 +762,7 @@ public class SdlRouterService extends Service{
}
+ @SuppressWarnings("SameParameterValue")
private boolean permissionCheck(String permissionToCheck){
if(permissionToCheck == null){
throw new IllegalArgumentException("permission is null");
@@ -820,6 +797,7 @@ public class SdlRouterService extends Service{
super.onCreate();
if(!initCheck()){ // Run checks on process and permissions
+ deployNextRouterService();
stopSelf();
return;
}
@@ -829,33 +807,56 @@ public class SdlRouterService extends Service{
registeredApps = new HashMap<String,RegisteredApp>();
}
closing = false;
- currentContext = getBaseContext();
-
- startVersionCheck();
+
Log.i(TAG, "SDL Router Service has been created");
synchronized(SESSION_LOCK){
this.sessionMap = new SparseArray<String>();
- this.sessionHashIdMap = new SparseArray<Integer>();
+ this.sessionHashIdMap = new SparseIntArray();
+ this.cleanedSessionMap = new SparseIntArray();
}
- packetExecuter = Executors.newSingleThreadExecutor();
+
+ packetExecutor = Executors.newSingleThreadExecutor();
+
+ startUpSequence();
}
- HashMap<String,ResolveInfo> sdlMultiList ;
- public void startVersionCheck(){
- Intent intent = new Intent(TransportConstants.START_ROUTER_SERVICE_ACTION);
- List<ResolveInfo> infos = getPackageManager().queryBroadcastReceivers(intent, 0);
- sdlMultiList = new HashMap<String,ResolveInfo>();
- for(ResolveInfo info: infos){
- //Log.d(TAG, "Sdl enabled app: " + info.activityInfo.packageName);
- if(getPackageName().equals(info.activityInfo.applicationInfo.packageName)){
- //Log.d(TAG, "Ignoring my own package");
- continue;
- }
- sdlMultiList.put(info.activityInfo.packageName, info);
- }
- registerReceiver(registerAnInstanceOfSerialServer, new IntentFilter(REGISTER_NEWER_SERVER_INSTANCE_ACTION));
- newestServiceCheck(currentContext);
+
+ /**
+ * 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){
+ Log.e(TAG, "Unable to start next SDL router service. " + e.getMessage());
+ }
+ }
+ break;
+
+ }
+ }
+ } else{
+ Log.d(TAG, "No sdl apps found");
+ return;
+ }
+ closing = true;
+ closeBluetoothSerialServer();
+ notifyAltTransportOfClose(TransportConstants.ROUTER_SHUTTING_DOWN_REASON_NEWER_SERVICE);
}
public void startUpSequence(){
@@ -885,6 +886,7 @@ public class SdlRouterService extends Service{
}
+ @SuppressLint({"NewApi", "MissingPermission"})
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if(!initPassed) {
@@ -896,6 +898,18 @@ public class SdlRouterService extends Service{
}
}
if(intent != null ){
+ if(intent.getBooleanExtra(FOREGROUND_EXTRA, false)){
+ String address = null;
+ if(intent.hasExtra(BluetoothDevice.EXTRA_DEVICE)){
+ BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+ if(device != null){
+ address = device.getAddress();
+ }
+ }
+ int timeout = getNotificationTimeout(address);
+ enterForeground("Waiting for connection...", timeout, false);
+ resetForegroundTimeOut(timeout);
+ }
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
@@ -911,18 +925,14 @@ public class SdlRouterService extends Service{
@Override
public void onDestroy(){
stopClientPings();
- if(versionCheckTimeOutHandler!=null){
- versionCheckTimeOutHandler.removeCallbacks(versionCheckRunable);
- versionCheckTimeOutHandler = null;
- }
+
if(altTransportTimerHandler!=null){
- altTransportTimerHandler.removeCallbacks(versionCheckRunable);
+ altTransportTimerHandler.removeCallbacks(altTransportTimerRunnable);
altTransportTimerHandler = null;
- versionCheckRunable = null;
}
+
Log.w(TAG, "Sdl Router Service Destroyed");
closing = true;
- currentContext = null;
//No need for this Broadcast Receiver anymore
unregisterAllReceivers();
closeBluetoothSerialServer();
@@ -946,9 +956,9 @@ public class SdlRouterService extends Service{
//SESSION_LOCK = null;
startSequenceComplete=false;
- if(packetExecuter!=null){
- packetExecuter.shutdownNow();
- packetExecuter = null;
+ if(packetExecutor !=null){
+ packetExecutor.shutdownNow();
+ packetExecutor = null;
}
exitForeground();
@@ -961,6 +971,7 @@ public class SdlRouterService extends Service{
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){}
@@ -968,13 +979,14 @@ public class SdlRouterService extends Service{
}
private void unregisterAllReceivers(){
+ //noinspection EmptyCatchBlock
try{
- unregisterReceiver(registerAnInstanceOfSerialServer); ///This should be first. It will always be registered, these others may not be and cause an exception.
unregisterReceiver(mListenForDisconnect);
unregisterReceiver(mainServiceReceiver);
}catch(Exception e){}
}
+ @SuppressWarnings("SameParameterValue")
private void notifyAltTransportOfClose(int reason){
if(altTransportService!=null){
Message msg = Message.obtain();
@@ -987,17 +999,66 @@ public class SdlRouterService extends Service{
}
}
}
-
+
+ /**
+ * 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){
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ if(address != null){
+ if(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);
+ }
+ }
+ // 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){
+ if(android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2){
+ return;
+ }
+ if(foregroundTimeoutHandler == null){
+ foregroundTimeoutHandler = new Handler();
+ }
+ if(foregroundTimeoutRunnable == null) {
+ foregroundTimeoutRunnable = new Runnable() {
+ @Override
+ public void run() {
+ exitForeground();
+ }
+ };
+ }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(){
+ if(foregroundTimeoutHandler != null && foregroundTimeoutRunnable != null){
+ foregroundTimeoutHandler.removeCallbacks(foregroundTimeoutRunnable);
+ }
+
+ }
+
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
- private void enterForeground() {
+ private void enterForeground(String content, long chronometerLength, boolean ongoing) {
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB){
Log.w(TAG, "Unable to start service as foreground due to OS SDK version being lower than 11");
isForeground = false;
return;
}
-
Bitmap icon;
int resourcesIncluded = getResources().getIdentifier("ic_sdl", "drawable", getPackageName());
@@ -1016,9 +1077,9 @@ public class SdlRouterService extends Service{
}else{
builder.setContentTitle("SmartDeviceLink");
}
- builder.setTicker("SmartDeviceLink Connected");
- builder.setContentText("Connected to " + this.getConnectedDeviceName());
-
+ builder.setTicker("SmartDeviceLink");
+ builder.setContentText(content);
+
//We should use icon from library resources if available
int trayId = getResources().getIdentifier("sdl_tray_icon", "drawable", getPackageName());
@@ -1029,26 +1090,62 @@ public class SdlRouterService extends Service{
builder.setSmallIcon(android.R.drawable.stat_sys_data_bluetooth);
}
builder.setLargeIcon(icon);
- builder.setOngoing(true);
+ 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);
+
+ if(chronometerLength > 0) {
+ builder.setWhen(chronometerLength + System.currentTimeMillis());
+ builder.setUsesChronometer(true);
+ builder.setChronometerCountDown(true);
+ }
Notification notification;
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN){
notification = builder.getNotification();
}else{
+ 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) {
+ String channelId = SDL_NOTIFICATION_CHANNEL_ID;
+ int importance = NotificationManager.IMPORTANCE_DEFAULT;
+ NotificationChannel notificationChannel = new NotificationChannel(channelId, SDL_NOTIFICATION_CHANNEL_NAME, importance);
+ notificationChannel.enableLights(false);
+ notificationChannel.enableVibration(false);
+ notificationManager.createNotificationChannel(notificationChannel);
+ builder.setChannelId(channelId);
+ }else{
+ Log.e(TAG, "Unable to retrieve notification Manager service");
+ }
+
+ }
notification = builder.build();
}
if(notification == null){
Log.e(TAG, "Notification was null");
+ return;
}
startForeground(FOREGROUND_SERVICE_ID, notification);
isForeground = true;
}
-
+
private void exitForeground(){
if(isForeground){
+ if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){
+ NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ if(notificationManager!=null){
+ notificationManager.deleteNotificationChannel(TransportConstants.SDL_NOTIFICATION_CHANNEL_ID);
+ }
+ }
+
this.stopForeground(true);
+ isForeground = false;
}
}
@@ -1063,13 +1160,12 @@ public class SdlRouterService extends Service{
/**
* Checks to make sure bluetooth adapter is available and on
- * @return
+ * @return if the bluetooth adapter is available and is enabled
*/
+ @SuppressWarnings("MissingPermission")
private boolean bluetoothAvailable(){
try {
- boolean retVal = (!(BluetoothAdapter.getDefaultAdapter() == null) && BluetoothAdapter.getDefaultAdapter().isEnabled());
- //Log.d(TAG, "Bluetooth Available? - " + retVal);
- return retVal;
+ return (!(BluetoothAdapter.getDefaultAdapter() == null) && BluetoothAdapter.getDefaultAdapter().isEnabled());
}catch(NullPointerException e){ // only for BluetoothAdapter.getDefaultAdapter().isEnabled() call
return false;
}
@@ -1091,7 +1187,7 @@ public class SdlRouterService extends Service{
return true;
}else if(intent!=null && TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT.equals(intent.getAction())){
- Log.i(TAG, "Received start intent with alt transprt request.");
+ Log.i(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
@@ -1121,18 +1217,16 @@ public class SdlRouterService extends Service{
Log.d(TAG, "Not starting own bluetooth during legacy mode");
return;
}
- Log.i(TAG, "Iniitializing bluetooth transport");
//init serial service
- if(mSerialService ==null){
- mSerialService = MultiplexBluetoothTransport.getBluetoothSerialServerInstance();
- if(mSerialService==null){
- mSerialService = MultiplexBluetoothTransport.getBluetoothSerialServerInstance(mHandlerBT);
- }
+ if(mSerialService == null || mSerialService.getState() == MultiplexBluetoothTransport.STATE_ERROR){
+ Log.i(TAG, "Initializing bluetooth transport");
+ mSerialService = new MultiplexBluetoothTransport(mHandlerBT);
}
if (mSerialService != null) {
// Only if the state is STATE_NONE, do we know that we haven't started already
- if (mSerialService.getState() == MultiplexBluetoothTransport.STATE_NONE || mSerialService.getState() == MultiplexBluetoothTransport.STATE_ERROR) {
+ if (mSerialService.getState() == MultiplexBluetoothTransport.STATE_NONE) {
// Start the Bluetooth services
+ Log.i(TAG, "Starting bluetooth transport");
mSerialService.start();
}
@@ -1141,7 +1235,8 @@ public class SdlRouterService extends Service{
public void onTransportConnected(final TransportType type){
isTransportConnected = true;
- enterForeground();
+ cancelForegroundTimeOut();
+ enterForeground("Connected to " + this.getConnectedDeviceName(),0, true);
if(packetWriteTaskMaster!=null){
packetWriteTaskMaster.close();
packetWriteTaskMaster = null;
@@ -1153,11 +1248,17 @@ public class SdlRouterService extends Service{
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()));
- sendBroadcast(startService);
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ startService.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ }
+
+ AndroidTools.sendExplicitBroadcast(getApplicationContext(),startService, null);
+
//HARDWARE_CONNECTED
if(!(registeredApps== null || registeredApps.isEmpty())){
//If we have clients
@@ -1195,14 +1296,7 @@ public class SdlRouterService extends Service{
}
cachedModuleVersion = -1; //Reset our cached version
- if(registeredApps== null || registeredApps.isEmpty()){
- Intent unregisterIntent = new Intent();
- unregisterIntent.putExtra(HARDWARE_DISCONNECTED, type.name());
- unregisterIntent.putExtra(TransportConstants.ENABLE_LEGACY_MODE_EXTRA, legacyModeEnabled);
- unregisterIntent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
- sendBroadcast(unregisterIntent);
- //return;
- }else{
+ if(registeredApps != null && !registeredApps.isEmpty()){
Message message = Message.obtain();
message.what = TransportConstants.HARDWARE_CONNECTION_EVENT;
Bundle bundle = new Bundle();
@@ -1244,17 +1338,32 @@ public class SdlRouterService extends Service{
}
}
- private final Handler mHandlerBT = new Handler() {
+ private final Handler mHandlerBT = new BluetoothHandler(this);
+ private static class BluetoothHandler extends Handler{
+
+ final WeakReference<SdlRouterService> provider;
+
+ public BluetoothHandler(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:
- connectedDeviceName = msg.getData().getString(MultiplexBluetoothTransport.DEVICE_NAME);
+ Bundle bundle = msg.getData();
+ if(bundle !=null) {
+ service.connectedDeviceName = bundle.getString(MultiplexBluetoothTransport.DEVICE_NAME);
+ service.setSDLConnectedStatus(bundle.getString(MultiplexBluetoothTransport.DEVICE_ADDRESS),true);
+ }
break;
case MESSAGE_STATE_CHANGE:
switch (msg.arg1) {
case MultiplexBluetoothTransport.STATE_CONNECTED:
- onTransportConnected(TransportType.BLUETOOTH);
+ service.onTransportConnected(TransportType.BLUETOOTH);
break;
case MultiplexBluetoothTransport.STATE_CONNECTING:
// Currently attempting to connect - update UI?
@@ -1264,28 +1373,28 @@ public class SdlRouterService extends Service{
case MultiplexBluetoothTransport.STATE_NONE:
// We've just lost the connection
if(!connectAsClient ){
- if(!legacyModeEnabled && !closing){
- initBluetoothSerialService();
+ if(!service.legacyModeEnabled && !closing){
+ service.initBluetoothSerialService();
}
- onTransportDisconnected(TransportType.BLUETOOTH);
+ service.onTransportDisconnected(TransportType.BLUETOOTH);
}
break;
case MultiplexBluetoothTransport.STATE_ERROR:
- if(mSerialService!=null){
+ if(service.mSerialService!=null){
Log.d(TAG, "Bluetooth serial server error received, setting state to none, and clearing local copy");
- mSerialService.setStateManually(MultiplexBluetoothTransport.STATE_NONE);
- mSerialService = null;
+ service.mSerialService.setStateManually(MultiplexBluetoothTransport.STATE_NONE);
+ service.mSerialService = null;
}
break;
}
break;
case MESSAGE_READ:
- onPacketRead((SdlPacket) msg.obj);
+ service.onPacketRead((SdlPacket) msg.obj);
break;
}
}
- };
+ }
@SuppressWarnings("unused") //The return false after the packet null check is not dead code. Read the getByteArray method from bundle
public boolean writeBytesToTransport(Bundle bundle){
@@ -1293,10 +1402,10 @@ public class SdlRouterService extends Service{
return false;
}
if(mSerialService !=null && mSerialService.getState()==MultiplexBluetoothTransport.STATE_CONNECTED){
- byte[] packet = bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
- int offset = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0); //If nothing, start at the begining 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.
+ byte[] packet = bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
if(packet!=null){
+ 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.
mSerialService.write(packet,offset,count);
return true;
}
@@ -1317,17 +1426,15 @@ public class SdlRouterService extends Service{
return true;
}
return false;
- }else if(sendThroughAltTransport(bytes,offset,count)){
- return true;
- }else{
- return false;
+ }else {
+ return sendThroughAltTransport(bytes,offset,count);
}
}
/**
* This Method will send the packets through the alt transport that is connected
- * @param array The byte array of data to be wrote out
+ * @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>
*/
@@ -1350,7 +1457,7 @@ public class SdlRouterService extends Service{
}
/** This Method will send the packets through the alt transport that is connected
- * @param array The byte array of data to be wrote out
+ * @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>
*/
@@ -1387,11 +1494,12 @@ public class SdlRouterService extends Service{
boolean shouldAssertNewSession = packet.getFrameType() == FrameType.Control && (packet.getFrameInfo() == SdlPacket.FRAME_INFO_START_SERVICE_ACK || packet.getFrameInfo() == SdlPacket.FRAME_INFO_START_SERVICE_NAK);
String appid = getAppIDForSession(session, shouldAssertNewSession); //Find where this packet should go
if(appid!=null && appid.length()>0){
- RegisteredApp app = null;
+ RegisteredApp app;
synchronized(REGISTERED_APPS_LOCK){
app = registeredApps.get(appid);
}
- if(app==null){Log.e(TAG, "No app found for app id " + appid + " Removing session maping and sending unregisterAI to head unit.");
+ if(app==null){
+ Log.e(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);
byte[] uai = createForceUnregisterApp((byte)session, (byte)packet.getVersion());
@@ -1400,7 +1508,7 @@ public class SdlRouterService extends Service{
synchronized(this.SESSION_LOCK){
if(this.sessionHashIdMap.indexOfKey(session)>=0){
hashId = this.sessionHashIdMap.get(session);
- this.sessionHashIdMap.remove(session);
+ this.sessionHashIdMap.delete(session);
}
}
byte[] stopService = (SdlPacketFactory.createEndSession(SessionType.RPC, (byte)session, 0, (byte)packet.getVersion(),BitConverter.intToByteArray(hashId))).constructPacket();
@@ -1417,6 +1525,29 @@ public class SdlRouterService extends Service{
}
}
+ // 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()) {
+ Log.d(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
+ Log.d(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();
@@ -1486,10 +1617,10 @@ public class SdlRouterService extends Service{
}
/**
- * This method is an all else fails situation. If the head unit is out of synch with the apps on the phone
+ * 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
- * @param version
+ * @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){
Log.i(TAG, "Attempting to stop session " + session);
@@ -1499,7 +1630,8 @@ public class SdlRouterService extends Service{
synchronized(this.SESSION_LOCK){
if(this.sessionHashIdMap.indexOfKey(session)>=0){
hashId = this.sessionHashIdMap.get(session);
- this.sessionHashIdMap.remove(session);
+ this.sessionHashIdMap.delete(session);
+ this.cleanedSessionMap.put(session,hashId);
}
}
byte[] stopService = (SdlPacketFactory.createEndSession(SessionType.RPC, (byte)session, 0, (byte)version,BitConverter.intToByteArray(hashId))).constructPacket();
@@ -1531,7 +1663,7 @@ public class SdlRouterService extends Service{
manuallyWriteBytes(stopService,0,stopService.length);
synchronized(SESSION_LOCK){
this.sessionMap.remove(sessionId);
- this.sessionHashIdMap.remove(sessionId);
+ this.sessionHashIdMap.delete(sessionId);
}
}
synchronized(REGISTERED_APPS_LOCK){
@@ -1550,40 +1682,41 @@ public class SdlRouterService extends Service{
}
/**
- * bluetoothQuerryAndConnect()
* 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", "unused"})
public synchronized boolean bluetoothQuerryAndConnect(){
- if( BluetoothAdapter.getDefaultAdapter().isEnabled()){
- Set<BluetoothDevice> pairedBT= BluetoothAdapter.getDefaultAdapter().getBondedDevices();
- Log.d(TAG, "Querry Bluetooth paired devices");
+ BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+ if(adapter != null && adapter.isEnabled()){
+ Set<BluetoothDevice> pairedBT= adapter.getBondedDevices();
+ Log.d(TAG, "Query Bluetooth paired devices");
if (pairedBT.size() > 0) {
for (BluetoothDevice device : pairedBT) {
- if(device.getName().toLowerCase(Locale.US).contains("sync")
- || device.getName().toLowerCase(Locale.US).contains("livio")){
+ String name = device.getName().toLowerCase(Locale.US);
+ if(name.contains("sync") || name.contains("livio")){
bluetoothConnect(device);
- return true;
+ return true;
}
}
}
- }
- else{
+ }else{
Log.e(TAG, "There was an issue with connecting as client");
}
- return false;
- }
-
+ return false;
+ }
+
+ @SuppressWarnings("MissingPermission")
private synchronized boolean bluetoothConnect(BluetoothDevice device){
- Log.d(TAG,"Connecting to device: " + device.getName().toString());
+ Log.d(TAG,"Connecting to device: " + device.getName());
if(mSerialService == null || !mSerialService.isConnected())
{ // Set up the Bluetooth serial object
- mSerialService = MultiplexBluetoothTransport.getBluetoothSerialServerInstance(mHandlerBT);
+ mSerialService = new MultiplexBluetoothTransport(mHandlerBT);
}
// We've been given a device - let's connect to it
- if(mSerialService.getState()!=MultiplexBluetoothTransport.STATE_CONNECTING){//mSerialService.stop();
+ if(mSerialService.getState()!=MultiplexBluetoothTransport.STATE_CONNECTING){
mSerialService.connect(device);
if(mSerialService.getState() == MultiplexBluetoothTransport.STATE_CONNECTING){
return true;
@@ -1599,115 +1732,82 @@ public class SdlRouterService extends Service{
//********************************************************* PREFERENCES ****************************************************************
//**************************************************************************************************************************************
/**
+ * @deprecated
* This method will set the last known bluetooth connection method that worked with this phone.
* This helps speed up the process of connecting
* @param level The level of bluetooth connecting method that last worked
* @param prefLocation Where the preference should be stored
*/
- public final static void setBluetoothPrefs (int level, String prefLocation) {
- if(currentContext==null){
- return;
- }
- SharedPreferences mBluetoothPrefs = currentContext.getSharedPreferences(prefLocation, Context.MODE_PRIVATE);
- // Write the new prefs
- SharedPreferences.Editor prefAdd = mBluetoothPrefs.edit();
- prefAdd.putInt("level", level);
- prefAdd.commit();
+ @SuppressWarnings("DeprecatedIsStillUsed")
+ @Deprecated
+ public static void setBluetoothPrefs (int level, String prefLocation) {
+ Log.w(TAG, "This method is deprecated and will not take any action");
}
-
- public final static int getBluetoothPrefs(String prefLocation)
+
+ /**
+ * @deprecated
+ * This method has been deprecated as it was bad practice.
+ */
+ @SuppressWarnings({"DeprecatedIsStillUsed", "SameReturnValue"})
+ @Deprecated
+ public static int getBluetoothPrefs(String prefLocation)
{
- if(currentContext==null){
- return 0;
- }
- SharedPreferences mBluetoothPrefs = currentContext.getSharedPreferences(prefLocation, Context.MODE_PRIVATE);
- return mBluetoothPrefs.getInt("level", 0);
+ return 0;
}
+
+ /**
+ * 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);
+ }
+
+
/* ***********************************************************************************************************************************************************************
* ***************************************************************** CUSTOM ADDITIONS ************************************************************************************
*************************************************************************************************************************************************************************/
- private LocalRouterService getLocalBluetoothServiceComapre(){
- return this.localCompareTo;
- }
-
+ @SuppressWarnings("DeprecatedIsStillUsed")
+ @Deprecated
protected static LocalRouterService getLocalRouterService(Intent launchIntent, ComponentName name){
- if(SdlRouterService.selfRouterService == null){
if(launchIntent == null){
Log.w(TAG, "Supplied intent was null, local router service will not contain intent");
- //Log.e(TAG, "Unable to create local router service instance. Supplied intent was null");
- //return null;
}
if(name == null){
Log.e(TAG, "Unable to create local router service object because component name was null");
return null;
}
- selfRouterService = new LocalRouterService(launchIntent,ROUTER_SERVICE_VERSION_NUMBER, System.currentTimeMillis(), name);
- }
- if(launchIntent!=null){
- //Assume we want to set this in our service
- //Log.d(TAG, "Setting new intent on our local router service object");
- selfRouterService.launchIntent = launchIntent;
- }
- return selfRouterService;
+ //noinspection deprecation
+ return new LocalRouterService(launchIntent,ROUTER_SERVICE_VERSION_NUMBER, System.currentTimeMillis(), name);
}
- private LocalRouterService getLocalRouterService(){
- //return getLocalRouterService(new Intent(getBaseContext(),SdlRouterService.class));
- return getLocalRouterService(null, new ComponentName(this, this.getClass()));
- }
/**
* This method is used to check for the newest version of this class to make sure the latest and greatest is up and running.
- * @param context
- */
- private void newestServiceCheck(final Context context){
- getLocalRouterService(); //Make sure our timestamp is set
- versionCheckTimeOutHandler = new Handler();
- versionCheckRunable = new Runnable() {
- public void run() {
- Log.i(TAG, "Starting up Version Checking ");
-
- LocalRouterService newestServiceReceived = getLocalBluetoothServiceComapre();
- LocalRouterService self = getLocalRouterService(); //We can send in null here, because it should have already been created
- //Log.v(TAG, "Self service info " + self);
- //Log.v(TAG, "Newest compare to service info " + newestServiceReceived);
- if(newestServiceReceived!=null && self.isNewer(newestServiceReceived)){
- if(SdlRouterService.mSerialService!=null && SdlRouterService.mSerialService.isConnected()){ //We are currently connected. Wait for next connection
- return;
- }
- Log.d(TAG, "There is a newer version "+newestServiceReceived.version+" of the Router Service, starting it up");
- if(newestServiceReceived.launchIntent == null){
- if(newestServiceReceived.name!=null){
- newestServiceReceived.launchIntent = new Intent().setComponent(newestServiceReceived.name);
- }else{
- Log.w(TAG, "Service didn't include launch intent or component name");
- startUpSequence();
- return;
- }
- }
- closing = true;
- closeBluetoothSerialServer();
- context.startService(newestServiceReceived.launchIntent);
- notifyAltTransportOfClose(TransportConstants.ROUTER_SHUTTING_DOWN_REASON_NEWER_SERVICE);
- if(getBaseContext()!=null){
- stopSelf();
- }else{
- onDestroy();
- }
- }
- else{ //Let's start up like normal
- Log.d(TAG, "No newer services than " + ROUTER_SERVICE_VERSION_NUMBER +" found. Starting up bluetooth transport");
- startUpSequence();
- }
- }
- };
- versionCheckTimeOutHandler.postDelayed(versionCheckRunable, VERSION_TIMEOUT_RUNNABLE);
- }
-
- /**
- * This method is used to check for the newest version of this class to make sure the latest and greatest is up and running.
- * @param context
*/
private void startAltTransportTimer(){
altTransportTimerHandler = new Handler();
@@ -1723,7 +1823,7 @@ public class SdlRouterService extends Service{
/**
* Removes session from map if the key is found.
- * @param sessionId
+ * @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){
@@ -1738,20 +1838,19 @@ public class SdlRouterService extends Service{
}
}
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
private boolean removeAllSessionsWithAppId(String appId){
synchronized(SESSION_LOCK){
if(sessionMap!=null){
SparseArray<String> iter = sessionMap.clone();
int size = iter.size();
for(int i = 0; i<size; i++){
- //Log.d(TAG, "Investigating session " +iter.keyAt(i));
- //Log.d(TAG, "App id is: " + iter.valueAt(i));
- if(((String)iter.valueAt(i)).compareTo(appId) == 0){
- sessionHashIdMap.remove(iter.keyAt(i));
+ if(iter.valueAt(i).compareTo(appId) == 0){
+ sessionHashIdMap.delete(iter.keyAt(i));
sessionMap.removeAt(i);
}
}
+ return true;
}
}
return false;
@@ -1759,7 +1858,8 @@ public class SdlRouterService extends Service{
/**
* Removes all sessions from the sessions map for this given app id
- * @param app
+ * @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();
@@ -1775,9 +1875,10 @@ public class SdlRouterService extends Service{
}
}
- private boolean removeAppFromMap(RegisteredApp app){
+ private boolean removeAppFromMap(RegisteredApp app){
synchronized(REGISTERED_APPS_LOCK){
- RegisteredApp old = registeredApps.remove(app);
+ //noinspection SuspiciousMethodCalls
+ RegisteredApp old = registeredApps.remove(app);
if(old!=null){
old.close();
return true;
@@ -1869,9 +1970,9 @@ public class SdlRouterService extends Service{
/**
* 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
- * @param version
- * @return
+ * @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();
@@ -1886,11 +1987,10 @@ public class SdlRouterService extends Service{
pm.setCorrID(request.getCorrelationID());
if (request.getBulkData() != null)
pm.setBulkData(request.getBulkData());
- byte[] data = null;
+ 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 = new BinaryFrameHeader();
- binFrameHeader = SdlPacketFactory.createBinaryFrameHeader(pm.getRPCType(), pm.getFunctionID(), pm.getCorrID(), 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 {
@@ -1904,14 +2004,14 @@ public class SdlRouterService extends Service{
/**
* Method for finding the next, highest priority write task from all connected apps.
- * @return
+ * @return the next task for writing out packets if one exists
*/
protected PacketWriteTask getNextTask(){
final long currentTime = System.currentTimeMillis();
RegisteredApp priorityApp = null;
long currentPriority = -Long.MAX_VALUE, peekWeight;
synchronized(REGISTERED_APPS_LOCK){
- PacketWriteTask peekTask = null;
+ PacketWriteTask peekTask;
for (RegisteredApp app : registeredApps.values()) {
peekTask = app.peekNextTask();
if(peekTask!=null){
@@ -1965,8 +2065,9 @@ public class SdlRouterService extends Service{
synchronized(PING_COUNT_LOCK){
pingCount = 0;
}
+
clientPingExecutor.scheduleAtFixedRate(new Runnable(){
-
+ List<ResolveInfo> sdlApps;
@Override
public void run() {
if(getPingCount()>=10){
@@ -1977,7 +2078,12 @@ public class SdlRouterService extends Service{
if(pingIntent == null){
initPingIntent();
}
- getBaseContext().sendBroadcast(pingIntent);
+
+ if(sdlApps == null){
+ sdlApps = getPackageManager().queryBroadcastReceivers(pingIntent, 0);
+ }
+
+ AndroidTools.sendExplicitBroadcast(getApplicationContext(), pingIntent, sdlApps);
synchronized(PING_COUNT_LOCK){
pingCount++;
}
@@ -2001,7 +2107,7 @@ public class SdlRouterService extends Service{
}
pingIntent = null;
}
-
+
/* ****************************************************************************************************************************************
// ********************************************************** TINY CLASSES ************************************************************
//*****************************************************************************************************************************************/
@@ -2011,15 +2117,19 @@ public class SdlRouterService extends Service{
* 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({"unused", "DeprecatedIsStillUsed"})
+ @Deprecated
static class LocalRouterService implements Parcelable{
Intent launchIntent = null;
int version = 0;
- long timestamp;
+ final long timestamp;
ComponentName name;
- private LocalRouterService(Intent intent, int version, 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;
@@ -2027,10 +2137,10 @@ public class SdlRouterService extends Service{
}
/**
* Check if input is newer than this version
- * @param service
- * @return
+ * @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(LocalRouterService service){
+ 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
@@ -2039,29 +2149,26 @@ public class SdlRouterService extends Service{
return false;
}
-
- public boolean isEqual(LocalRouterService service) {
- if(service != null && service.name!= null
- && this.name !=null){
- return (this.name.equals(service.name));
- }
- 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){
+ 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) {
@@ -2074,7 +2181,7 @@ public class SdlRouterService extends Service{
// catch DexException
}
}
-
+
@Override
public int describeContents() {
return 0;
@@ -2088,28 +2195,34 @@ public class SdlRouterService extends Service{
dest.writeParcelable(name, 0);
}
-
+
+ @SuppressWarnings("deprecation")
public static final Parcelable.Creator<LocalRouterService> CREATOR = new Parcelable.Creator<LocalRouterService>() {
- public LocalRouterService createFromParcel(Parcel in) {
- return new LocalRouterService(in);
- }
+ @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;
@@ -2119,13 +2232,13 @@ public class SdlRouterService extends Service{
protected static final int PAUSE_TIME_FOR_QUEUE = 1500;
- String appId;
- Messenger messenger;
- Vector<Long> sessionIds;
+ final String appId;
+ final Messenger messenger;
+ final Vector<Long> sessionIds;
ByteAraryMessageAssembler buffer;
- int prioirtyForBuffingMessage;
+ int priorityForBuffingMessage;
DeathRecipient deathNote = null;
- //Packey queue vars
+ //Packet queue vars
PacketWriteTaskBlockingQueue queue;
Handler queueWaitHandler= null;
Runnable queueWaitRunnable = null;
@@ -2133,8 +2246,8 @@ public class SdlRouterService extends Service{
/**
* This is a simple class to hold onto a reference of a registered app.
- * @param appId
- * @param messenger
+ * @param appId the supplied id for this app that is attempting to register
+ * @param messenger the specific messenger that is tied to this app
*/
public RegisteredApp(String appId, Messenger messenger){
this.appId = appId;
@@ -2144,15 +2257,7 @@ public class SdlRouterService extends Service{
queueWaitHandler = new Handler();
setDeathNote();
}
-
- /*public RegisteredApp(long appId, Messenger messenger){
- this.appId = appId;
- this.messenger = messenger;
- this.sessionIds = new Vector<Long>();
- this.queue = new PacketWriteTaskBlockingQueue();
- queueWaitHandler = new Handler();
- setDeathNote();
- }*/
+
/**
* Closes this app properly.
@@ -2181,7 +2286,7 @@ public class SdlRouterService extends Service{
}*/
/**
* This is a convenience variable and may not be used or useful in different protocols
- * @return
+ * @return a vector of all the session ids associated with this app
*/
public Vector<Long> getSessionIds() {
return sessionIds;
@@ -2189,48 +2294,50 @@ public class SdlRouterService extends Service{
/**
* Returns the position of the desired object if it is contained in the vector. If not it will return -1.
- * @param id
- * @return
+ * @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
- * @return
+ * @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);
- if(removedSessionId!=null){
- return true;
- }else{
- return false;
- }
+ return removedSessionId != null;
}else{
return false;
}
}
+
/**
- * @param sessionId
+ * 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, (long)sessionId);
+ this.sessionIds.set(position, sessionId);
}
+ @SuppressWarnings("unused")
public void clearSessionIds(){
this.sessionIds.clear();
}
+ @SuppressWarnings("SameReturnValue")
public boolean handleIncommingClientMessage(final Bundle receivedBundle){
int flags = receivedBundle.getInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_NONE);
- //Log.d(TAG, "Flags received: " + flags);
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.prioirtyForBuffingMessage = receivedBundle.getInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT,0);
+ this.priorityForBuffingMessage = receivedBundle.getInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT,0);
}
handleMessage(flags, packet);
}else{
@@ -2274,7 +2381,7 @@ public class SdlRouterService extends Service{
if (buffer.isFinished()) { //We are finished building the buffer so we should write the bytes out
byte[] bytes = buffer.getBytes();
if (queue != null) {
- queue.add(new PacketWriteTask(bytes, 0, bytes.length, this.prioirtyForBuffingMessage));
+ queue.add(new PacketWriteTask(bytes, 0, bytes.length, this.priorityForBuffingMessage));
if (packetWriteTaskMaster != null) {
packetWriteTaskMaster.alert();
}
@@ -2347,7 +2454,7 @@ public class SdlRouterService extends Service{
public void binderDied() {
synchronized(deathLock){
Log.w(TAG, "Binder died for app " + RegisteredApp.this.appId);
- if(messenger!=null && messenger.getBinder()!=null){
+ if(messenger.getBinder()!=null){
messenger.getBinder().unlinkToDeath(this, 0);
}
removeAllSessionsForApp(RegisteredApp.this,true);
@@ -2368,11 +2475,8 @@ public class SdlRouterService extends Service{
return false;
}
- protected boolean clearDeathNote(){
- if(messenger!=null && messenger.getBinder()!=null && deathNote!=null){
- return messenger.getBinder().unlinkToDeath(deathNote, 0);
- }
- return false;
+ protected boolean clearDeathNote() {
+ return messenger != null && messenger.getBinder() != null && deathNote != null && messenger.getBinder().unlinkToDeath(deathNote, 0);
}
}
@@ -2384,15 +2488,16 @@ public class SdlRouterService extends Service{
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_CONSTATNT = 500;
+ 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 = null;
- private int offset, size, priorityCoefficient;
+ private final int offset, size, priorityCoefficient;
private final long timestamp;
final Bundle receivedBundle;
+ @SuppressWarnings("SameParameterValue")
public PacketWriteTask(byte[] bytes, int offset, int size, int priorityCoefficient){
timestamp = System.currentTimeMillis();
bytesToWrite = bytes;
@@ -2406,9 +2511,9 @@ public class SdlRouterService extends Service{
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 begining of the array
+ 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); Log.d(TAG, "packet priority coef: "+ this.priorityCoefficient);
+ this.priorityCoefficient = bundle.getInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT,0);
}
@Override
@@ -2420,8 +2525,8 @@ public class SdlRouterService extends Service{
}
}
- private long getWeight(long currentTime){ //Time waiting - size - prioirty_coef
- return ((((currentTime-timestamp) + DELAY_CONSTANT) * DELAY_COEF ) - ((size -SIZE_CONSTANT) * SIZE_COEF) - (priorityCoefficient * PRIORITY_COEF_CONSTATNT));
+ 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));
}
}
@@ -2443,7 +2548,7 @@ public class SdlRouterService extends Service{
public void run() {
while(!isHalted){
try{
- PacketWriteTask task = null;
+ PacketWriteTask task;
synchronized(QUEUE_LOCK){
task = getNextTask();
if(task != null){
@@ -2483,9 +2588,10 @@ public class SdlRouterService extends Service{
* @author Joey Grover
*
*/
+ @SuppressWarnings("Convert2Diamond")
private class PacketWriteTaskBlockingQueue{
final class Node<E> {
- E item;
+ final E item;
Node<E> prev;
Node<E> next;
Node(E item, Node<E> previous, Node<E> next) {
@@ -2539,7 +2645,7 @@ public class SdlRouterService extends Service{
/**
* Insert the task in the queue where it belongs
- * @param task
+ * @param task the new PacketWriteTask that needs to be added to the queue to be handled
*/
public void add(PacketWriteTask task){
synchronized(this){
@@ -2552,15 +2658,12 @@ public class SdlRouterService extends Service{
Node<PacketWriteTask> taskNode = new Node<PacketWriteTask>(task, head, tail);
head = taskNode;
tail = taskNode;
- return;
}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);
- return;
}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);
- return;
}else{
- if(tail!=null && tail.item.priorityCoefficient==0){ //Saves us from going through the entire list if all of these tasks are priority coef == 0
+ 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;
}
@@ -2573,7 +2676,6 @@ public class SdlRouterService extends Service{
return;
}else{
currentPlace = currentPlace.next;
- continue;
}
}else{
//We've found where this task should be inserted
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java
index 916b414d3..8dbca61a7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterStatusProvider.java
@@ -18,6 +18,7 @@ import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.util.Log;
+import android.os.Looper;
public class SdlRouterStatusProvider {
@@ -128,6 +129,7 @@ public class SdlRouterStatusProvider {
final WeakReference<SdlRouterStatusProvider> provider;
public ClientHandler(SdlRouterStatusProvider provider){
+ super(Looper.getMainLooper());
this.provider = new WeakReference<SdlRouterStatusProvider>(provider);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java b/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
index e9fb0efcf..c858c7790 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
@@ -1,11 +1,14 @@
package com.smartdevicelink.transport;
-
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
+import android.annotation.TargetApi;
+import android.os.Build;
+import android.os.NetworkOnMainThreadException;
import android.util.Log;
import com.smartdevicelink.exception.SdlException;
@@ -107,6 +110,7 @@ public class TCPTransport extends SdlTransport {
* @param length Number of bytes to send
* @return True if data was sent successfully, False otherwise
*/
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected boolean sendBytesOverTransport(SdlPacket packet) {
TCPTransportState currentState = getCurrentState();
@@ -123,7 +127,7 @@ public class TCPTransport extends SdlTransport {
mOutputStream.write(msgBytes, 0, msgBytes.length);
bResult = true;
logInfo("TCPTransport.sendBytesOverTransport: successfully send data");
- } catch (IOException e) {
+ } catch (IOException | NetworkOnMainThreadException e) {
logError("TCPTransport.sendBytesOverTransport: error during sending data: " + e.getMessage());
bResult = false;
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java b/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
index 89187d524..3db2aa1e1 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
@@ -7,6 +7,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -488,7 +489,7 @@ public class TransportBroker {
}
//Make sure we know where to bind to
if(this.routerService==null){
- if(!isRouterServiceRunning(getContext())){//We should be able to ignore this case because of the validation now
+ if((Build.VERSION.SDK_INT < Build.VERSION_CODES.O) && !isRouterServiceRunning(getContext())){//We should be able to ignore this case because of the validation now
Log.d(TAG,whereToReply + " found no router service. Shutting down.");
this.onHardwareDisconnected(null);
return false;
@@ -500,6 +501,7 @@ public class TransportBroker {
if(!sendBindingIntent()){
Log.e(TAG, "Something went wrong while trying to bind with the router service.");
+ SdlBroadcastReceiver.queryForConnectedService(currentContext);
return false;
}
return true;
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/TransportConstants.java b/sdl_android/src/main/java/com/smartdevicelink/transport/TransportConstants.java
index 29cdea035..5d86bc87b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/TransportConstants.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/TransportConstants.java
@@ -10,6 +10,8 @@ package com.smartdevicelink.transport;
*/
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 BIND_LOCATION_PACKAGE_NAME_EXTRA = "BIND_LOCATION_PACKAGE_NAME_EXTRA";
public static final String BIND_LOCATION_CLASS_NAME_EXTRA = "BIND_LOCATION_CLASS_NAME_EXTRA";
@@ -51,9 +53,15 @@ public class TransportConstants {
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 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";
+
+
+
+
/**
* This class houses all important router service versions
*/
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java b/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
index fe23a1e7b..e0e1c93f2 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
@@ -2,10 +2,15 @@ package com.smartdevicelink.transport;
import android.app.Activity;
import android.content.Intent;
+import android.content.pm.ResolveInfo;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.util.Log;
+import com.smartdevicelink.util.AndroidTools;
+
+import java.util.List;
+
/**
* The USBAccessoryAttachmentActivity is a proxy to listen for
* USB_ACCESSORY_ATTACHED intents.
@@ -67,7 +72,10 @@ public class USBAccessoryAttachmentActivity extends Activity {
.putExtra(UsbManager.EXTRA_PERMISSION_GRANTED,
intent.getParcelableExtra(
UsbManager.EXTRA_PERMISSION_GRANTED));
- sendBroadcast(usbAccessoryAttachedIntent);
+
+
+ AndroidTools.sendExplicitBroadcast(getApplicationContext(),usbAccessoryAttachedIntent,null);
+
}
finish();
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java b/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
index 6ab4ed59c..8a0d57294 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
@@ -199,9 +199,7 @@ public class USBTransport extends SdlTransport {
/**
* Sends the array of bytes over USB.
*
- * @param msgBytes Array of bytes to send
- * @param offset Offset in the array to start from
- * @param length Number of bytes to send
+ * @param packet The packet that is to be written out on the USB transport
* @return true if the bytes are sent successfully
*/
@Override
@@ -227,13 +225,13 @@ public class USBTransport extends SdlTransport {
} catch (IOException e) {
final String msg = "Failed to send bytes over USB";
logW(msg, e);
- handleTransportError(msg, e);
+ disconnect(msg, e);
}
} else {
final String msg =
"Can't send bytes when output stream is null";
logW(msg);
- handleTransportError(msg, null);
+ disconnect(msg, null);
}
break;
@@ -420,6 +418,12 @@ public class USBTransport extends SdlTransport {
String disconnectMsg = (msg == null ? "" : msg);
if (ex != null) {
disconnectMsg += ", " + ex.toString();
+
+ if(ex instanceof SdlException
+ && SdlExceptionCause.SDL_USB_PERMISSION_DENIED.equals(((SdlException)ex).getSdlExceptionCause())){
+ //If the USB device disconnected we don't want to cycle the proxy ourselves
+ ex = null;
+ }
}
if (ex == null) {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java b/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java
index ff8819ec3..81ca436c7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java
@@ -1,16 +1,59 @@
+/*
+ * Copyright (c) 2018 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
package com.smartdevicelink.util;
import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
-import android.content.pm.ServiceInfo;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
+
+import com.smartdevicelink.transport.TransportConstants;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+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 componentName of the component in question
+ * @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) {
@@ -22,4 +65,97 @@ public class AndroidTools {
}
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<String,ResolveInfo>();
+ 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 = null;
+ 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. Ihe method will also send the broadcast implicitly if no list of apps is
+ * provided for backwards comparability.
+ *
+ * @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);
+ context.sendBroadcast(intent);
+ }
+
+ 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
+ }
+ }
+ }
+ }
+
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java b/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
new file mode 100644
index 000000000..cee0650e3
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2018 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.util;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.ResolveInfo;
+import android.os.Bundle;
+import android.util.Log;
+
+import java.util.Comparator;
+import java.util.Set;
+
+/**
+ * Created by Joey Grover on 2/2/18.
+ */
+
+public class SdlAppInfo {
+ private static final String TAG = "SdlAppInfo";
+
+ //FIXME we shouldn't be duplicating constants, but this currently keeps us from needing a context instance.
+ private static final String SDL_ROUTER_VERSION_METADATA = "sdl_router_version";
+ private static final String SDL_CUSTOM_ROUTER_METADATA = "sdl_custom_router";
+
+
+ String packageName;
+ ComponentName routerServiceComponentName;
+ int routerServiceVersion = 4; //We use this as a default and assume if the number doens't exist in meta data it is because the app hasn't updated.
+ boolean isCustomRouterService = false;
+ long lastUpdateTime;
+
+
+ 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.containsKey(SDL_ROUTER_VERSION_METADATA)){
+ this.routerServiceVersion = metadata.getInt(SDL_ROUTER_VERSION_METADATA);
+ }
+
+ if(metadata.containsKey(SDL_CUSTOM_ROUTER_METADATA)){
+ this.isCustomRouterService = metadata.getBoolean(SDL_CUSTOM_ROUTER_METADATA);
+ }
+ }
+
+ if(packageInfo != null){
+ this.lastUpdateTime = packageInfo.lastUpdateTime;
+ if(this.lastUpdateTime <= 0){
+ this.lastUpdateTime = packageInfo.firstInstallTime;
+ }
+ }
+ }
+
+ public int getRouterServiceVersion() {
+ return routerServiceVersion;
+ }
+
+ public boolean isCustomRouterService() {
+ return isCustomRouterService;
+ }
+
+
+ public ComponentName getRouterServiceComponentName() {
+ return routerServiceComponentName;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("-------- Sdl App Info ------\n");
+
+ builder.append("Package Name: ");
+ builder.append(packageName);
+
+ builder.append("\nRouter Service: ");
+ builder.append(this.routerServiceComponentName.getClassName());
+
+ builder.append("\nRouter Service Version: ");
+ builder.append(this.routerServiceVersion);
+
+ builder.append("\nCustom Router Service?: ");
+ builder.append(this.isCustomRouterService);
+
+ builder.append("\nLast updated: ");
+ builder.append(this.lastUpdateTime);
+
+ builder.append("\n-------- Sdl App Info End------");
+
+ return builder.toString();
+ }
+
+ /**
+ * 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>{
+
+ @Override
+ public int compare(SdlAppInfo one, SdlAppInfo two) {
+ if(one != null){
+ if(two != null){
+ if(one.isCustomRouterService){
+ if(two.isCustomRouterService){
+ return 0;
+ }else{
+ return 1;
+ }
+ }else if(two.isCustomRouterService){
+ return -1;
+
+ }//else, do nothing. Move to version check
+
+ int versionCompare = two.routerServiceVersion - one.routerServiceVersion;
+
+ if(versionCompare == 0){ //Versions are equal so lets use the one that has been updated most recently
+ int updateTime = (int)(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 updateTime;
+ }
+ }else{
+ return versionCompare;
+ }
+
+ }else{
+ return -1;
+ }
+ }else{
+ if(two != null){
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java b/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java
new file mode 100644
index 000000000..ba19310e8
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java
@@ -0,0 +1,142 @@
+package com.smartdevicelink.util;
+
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.ResolveInfo;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+
+import com.smartdevicelink.transport.SdlRouterService;
+
+import java.util.HashMap;
+import java.util.Vector;
+
+import static com.smartdevicelink.transport.TransportConstants.BIND_LOCATION_CLASS_NAME_EXTRA;
+import static com.smartdevicelink.transport.TransportConstants.BIND_LOCATION_PACKAGE_NAME_EXTRA;
+import static com.smartdevicelink.transport.TransportConstants.SEND_PACKET_TO_APP_LOCATION_EXTRA_NAME;
+
+/**
+ * Created by Joey Grover on 8/18/17.
+ */
+
+public class ServiceFinder {
+ public static final String TAG = ServiceFinder.class.getSimpleName();
+
+ private static final int TIMEOUT = 1000;
+ final String receiverLocation;
+ final Context context;
+ final ServiceFinderCallback callback;
+ final Vector<ComponentName> services;
+ final HashMap<String, ResolveInfo> sdlMultiMap;
+ final Handler timeoutHandler;
+ final Runnable timeoutRunnable;
+
+
+ public ServiceFinder(Context context, String packageName, final ServiceFinderCallback callback) {
+ this.receiverLocation = packageName + ".ServiceFinder";
+ this.context = context.getApplicationContext();
+ this.callback = callback;
+ this.services = new Vector<>();
+
+ this.sdlMultiMap = AndroidTools.getSdlEnabledApps(context, packageName);
+
+ this.context.registerReceiver(mainServiceReceiver, new IntentFilter(this.receiverLocation));
+
+ timeoutRunnable = new Runnable() {
+ @Override
+ public void run() {
+ onFinished();
+ }
+ };
+ timeoutHandler = new Handler(Looper.getMainLooper());
+ timeoutHandler.postDelayed(timeoutRunnable, TIMEOUT + (50 * packageName.length()));
+
+ //Send out our broadcast
+ context.sendBroadcast(createQueryIntent(this.receiverLocation));
+
+
+ }
+
+ BroadcastReceiver mainServiceReceiver = new BroadcastReceiver() {
+ private final Object LIST_LOCK = new Object();
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.d(TAG, "Received intent " + intent);
+ if (intent != null) {
+ String packageName = intent.getStringExtra(BIND_LOCATION_PACKAGE_NAME_EXTRA);
+ String className = intent.getStringExtra(BIND_LOCATION_CLASS_NAME_EXTRA);
+ Log.d(TAG, "Received intent from package: " + packageName + ". Classname: " + className);
+ synchronized (LIST_LOCK) {
+ //Add to running services
+ services.add(new ComponentName(packageName, className));
+ //Remove from our waiting for response list
+ sdlMultiMap.remove(packageName);
+
+ //If list is empty, return to callback and unregister
+ if (sdlMultiMap.isEmpty() && callback != null) {
+ timeoutHandler.removeCallbacks(timeoutRunnable);
+ onFinished();
+ }
+ }
+ }
+ }
+ };
+
+ private void onFinished() {
+ if (callback != null) {
+ callback.onComplete(services);
+ }
+ context.unregisterReceiver(mainServiceReceiver);
+
+ }
+
+// /**
+// * 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
+// * @param packageName
+// * @return
+// */
+// public static HashMap<String, ResolveInfo> getSdlEnabledApps(Context context, String packageName) {
+// Intent intent = new Intent(TransportConstants.START_ROUTER_SERVICE_ACTION);
+// PackageManager manager = context.getPackageManager();
+// List<ResolveInfo> infos = manager.queryBroadcastReceivers(intent, 0);
+// HashMap<String, ResolveInfo> sdlMultiMap = new HashMap<String, ResolveInfo>();
+// for (ResolveInfo info : infos) {
+// //Log.d(TAG, "Sdl enabled app: " + info.activityInfo.packageName);
+// if (info.activityInfo.applicationInfo.packageName.equals(packageName)) {
+// //Log.d(TAG, "Ignoring my own package");
+// continue;
+// }
+//
+// sdlMultiMap.put(info.activityInfo.packageName, info);
+// try {
+// ServiceInfo[] services = manager.getPackageInfo(info.activityInfo.applicationInfo.packageName, PackageManager.GET_SERVICES).services;
+// for (int i = 0; i < services.length; i++) {
+// Log.d(TAG, "Found : " + services[i].name);
+// }
+// } catch (PackageManager.NameNotFoundException e) {
+// e.printStackTrace();
+// }
+// }
+// return sdlMultiMap;
+// }
+
+ private static Intent createQueryIntent(String receiverLocation) {
+ Intent intent = new Intent();
+ intent.setAction(SdlRouterService.REGISTER_WITH_ROUTER_ACTION);
+ intent.putExtra(SEND_PACKET_TO_APP_LOCATION_EXTRA_NAME, receiverLocation);
+ intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ return intent;
+ }
+
+ public interface ServiceFinderCallback {
+ void onComplete(Vector<ComponentName> routerServices);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/util/Version.java b/sdl_android/src/main/java/com/smartdevicelink/util/Version.java
new file mode 100644
index 000000000..8621c8cfd
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/util/Version.java
@@ -0,0 +1,47 @@
+package com.smartdevicelink.util;
+
+
+public class Version {
+
+ int major,minor,patch;
+
+ public Version(){
+ major = 0;
+ minor = 0;
+ patch = 0;
+ }
+
+ public Version(String versionString){
+ String[] versions = versionString.split("\\.");
+ if(versions.length!=3){
+ throw new IllegalArgumentException("Incorrect version string format");
+ }
+ major = Integer.valueOf(versions[0]);
+ minor = Integer.valueOf(versions[1]);
+ patch = Integer.valueOf(versions[2]);
+
+ }
+
+ public int getMajor() {
+ return major;
+ }
+
+ public int getMinor() {
+ return minor;
+ }
+
+ public int getPatch() {
+ return patch;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append(major);
+ builder.append(".");
+ builder.append(minor);
+ builder.append(".");
+ builder.append(patch);
+ return builder.toString();
+ }
+}
diff --git a/sdl_android/src/main/res/values/sdl.xml b/sdl_android/src/main/res/values/sdl.xml
new file mode 100644
index 000000000..a4f2f6a5f
--- /dev/null
+++ b/sdl_android/src/main/res/values/sdl.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="sdl_router_service_version_name" translatable="false">sdl_router_version</string>
+ <integer name="sdl_router_service_version_value">6</integer>
+
+ <string name="sdl_router_service_is_custom_name" translatable="false">sdl_custom_router</string>
+</resources>
diff --git a/sdl_android/src/main/res/xml/accessory_filter.xml b/sdl_android/src/main/res/xml/accessory_filter.xml
new file mode 100644
index 000000000..4b0ab7c83
--- /dev/null
+++ b/sdl_android/src/main/res/xml/accessory_filter.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resource>
+ <usb-accessory
+ manufacturer="SDL"
+ model="Core"
+ version="1.0"/>
+</resource> \ No newline at end of file
diff --git a/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java b/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java
new file mode 100644
index 000000000..87c547bb1
--- /dev/null
+++ b/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java
@@ -0,0 +1,169 @@
+/***************************************************************************************************
+ * Copyright © 2017 Xevo Inc.
+ * Redistribution and use in source and binary forms, with or without modification, are permitted
+ * provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions
+ * and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name of the copyright holder 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.haptic;
+
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.HapticRect;
+import com.smartdevicelink.proxy.rpc.Rectangle;
+import com.smartdevicelink.proxy.rpc.SendHapticData;
+
+import junit.framework.TestCase;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mock;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.stubbing.Answer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.mockito.Mockito.*;
+
+/**
+ * Created on 9/26/2017.
+ */
+@RunWith(MockitoJUnitRunner.Strict.class)
+public class HapticInterfaceManagerTest extends TestCase {
+ @Mock
+ private ISdl mockProxy;
+
+ @Captor
+ private ArgumentCaptor<SendHapticData> captor;
+
+ private HapticInterfaceManager hapticMgr;
+
+ @Before
+ public void setUp() throws Exception {
+ hapticMgr = new HapticInterfaceManager(mockProxy);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ hapticMgr = null;
+ }
+
+ @Test
+ public void testSetHapticData() throws Exception {
+ List<HapticRect> rects = new ArrayList<>();
+ Rectangle rect = new Rectangle();
+ rect.setX(10f);
+ rect.setY(10f);
+ rect.setWidth(50f);
+ rect.setHeight(20f);
+ HapticRect hRect = new HapticRect();
+ hRect.setRect(rect);
+ rects.add(hRect);
+ hapticMgr.setHapticData(rects);
+ verify(mockProxy).sendRPCRequest(any(SendHapticData.class));
+ }
+
+ @Test
+ public void testRefreshHapticData() throws Exception {
+ View root = createViews();
+ hapticMgr.refreshHapticData(root);
+ verify(mockProxy).sendRPCRequest(captor.capture());
+ SendHapticData data = captor.getValue();
+ assertNotNull("SendHapticData RPC", data);
+ List<HapticRect> list = data.getHapticRectData();
+ assertNotNull("List", list);
+ assertEquals("Haptic Rects", 4, list.size());
+ }
+
+ @Test
+ public void testRefreshHapticDataNull() throws Exception {
+ hapticMgr.refreshHapticData(null);
+ verify(mockProxy).sendRPCRequest(captor.capture());
+ SendHapticData data = captor.getValue();
+ assertNotNull("SendHapticData RPC", data);
+ List<HapticRect> list = data.getHapticRectData();
+ assertNull("List", list);
+ }
+
+ @Test
+ public void testRefreshWithUserData() throws Exception {
+ List<HapticRect> rects = new ArrayList<>();
+ Rectangle rect = new Rectangle();
+ rect.setX(10f);
+ rect.setY(10f);
+ rect.setWidth(50f);
+ rect.setHeight(20f);
+ HapticRect hRect = new HapticRect();
+ hRect.setRect(rect);
+ rects.add(hRect);
+ hapticMgr.setHapticData(rects);
+ verify(mockProxy).sendRPCRequest(any(SendHapticData.class));
+
+ View root = createViews();
+ hapticMgr.refreshHapticData(root);
+ verify(mockProxy, times(1)).sendRPCRequest(any(SendHapticData.class));
+ }
+
+ private View createViews() {
+
+ View view = mock(View.class);
+
+ ViewGroup parent1 = mock(ViewGroup.class);
+ ViewGroup parent2 = mock(ViewGroup.class);
+
+ when(parent1.getChildCount()).thenReturn(5);
+
+ when(parent1.getChildAt(0)).thenReturn(view);
+ when(parent1.getChildAt(1)).thenReturn(view);
+ when(parent1.getChildAt(2)).thenReturn(view);
+ when(parent1.getChildAt(3)).thenReturn(parent2);
+ when(parent1.getChildAt(4)).thenReturn(view);
+
+ when(parent2.getChildCount()).thenReturn(2);
+ when(parent2.getChildAt(0)).thenReturn(view);
+ when(parent2.getChildAt(1)).thenReturn(view);
+
+ when(view.isFocusable()).then(new Answer<Boolean>() {
+ private int count = 0;
+
+ @Override
+ public Boolean answer(InvocationOnMock invocation) throws Throwable {
+ int curCount = count++;
+ return (curCount == 1) || (curCount == 2) || (curCount == 3);
+ }
+ });
+ when(view.isClickable()).then(new Answer<Boolean>() {
+ private int count = 0;
+
+ @Override
+ public Boolean answer(InvocationOnMock invocation) throws Throwable {
+ int curCount = count++;
+ return (curCount == 0) || (curCount == 3);
+ }
+ });
+
+ return parent1;
+ }
+}