summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnil Dahiya <anil_dahiya@infosys.com>2016-07-18 13:20:41 +0530
committerAnil Dahiya <anil_dahiya@infosys.com>2016-07-18 13:20:41 +0530
commit0018645ed6e949dc8e662920503a0b52c5ca980a (patch)
tree75dbf6442567b7f5fa28dca37a82cd3f6e1e76fd
parentdc04a05b3309908ead8d7a2c08496439878d2d65 (diff)
parenteae875b471191482167cd66057d87d6b4e6d6d83 (diff)
downloadsdl_android-0018645ed6e949dc8e662920503a0b52c5ca980a.tar.gz
Merge branch 'develop' into feature/external_security_support
-rw-r--r--.travis.yml12
-rw-r--r--README.md2
-rw-r--r--build.gradle47
-rw-r--r--sdl_android_lib/res/drawable-hdpi/sdl_128.pngbin0 -> 15594 bytes
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java236
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlSession.java48
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/AbstractProtocol.java55
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/BinaryFrameHeader.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/IProtocolListener.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/ProtocolMessage.java12
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacket.aidl5
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacket.java349
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacketFactory.java92
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/WiProProtocol.java483
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/RPCResponse.java18
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxy.java404
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java521
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java359
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBuilder.java27
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyFactory.java27
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommand.java108
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommandResponse.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenu.java82
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java3
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AirbagStatus.java85
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Alert.java123
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuver.java22
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertResponse.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java8
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/BeltStatus.java115
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/BodyInformation.java84
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java24
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistration.java98
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Choice.java27
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java50
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java73
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java3
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DIDResult.java46
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DTC.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommand.java53
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java5
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFile.java35
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java3
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java57
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java53
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java3
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java79
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceStatus.java7
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java69
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java9
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumber.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java7
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ECallInfo.java52
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EmergencyEvent.java68
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java27
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GPSData.java14
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GenericResponse.java38
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCs.java58
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleData.java210
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java8
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HMIPermissions.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HeadLampStatus.java40
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Headers.java16
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Image.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageField.java47
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageResolution.java49
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/KeyboardProperties.java60
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFiles.java19
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MenuParams.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MyKey.java34
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java3
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java1
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonEvent.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonPress.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnCommand.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHashChange.java39
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java45
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLockScreenStatus.java34
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSystemRequest.java109
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTouchEvent.java51
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnVehicleData.java234
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ParameterPermissions.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java115
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteraction.java110
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PermissionItem.java53
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java103
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFileResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDID.java69
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java179
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java52
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScreenParams.java47
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessage.java69
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java8
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIcon.java38
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java18
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java34
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java109
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java68
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Show.java165
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java42
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SingleTireStatus.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Slider.java92
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SliderResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SoftButton.java78
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Speak.java68
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SpeakResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/StartTime.java14
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButton.java62
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java232
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequest.java40
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java5
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TTSChunk.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TextField.java15
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TireStatus.java69
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchCoord.java48
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEvent.java104
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java41
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Turn.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java220
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java44
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java224
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnList.java14
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VehicleDataResult.java44
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VehicleType.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VrHelpItem.java52
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AmbientLightStatus.java14
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AudioStreamingState.java5
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AudioType.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java5
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ButtonEventMode.java3
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ButtonPressMode.java8
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/CarModeStatus.java23
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/DisplayType.java49
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ECallConfirmationStatus.java27
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/EmergencyEventType.java27
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/FileType.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/FuelCutoffStatus.java21
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java20
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/HMILevel.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/HmiZoneCapabilities.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/IgnitionStatus.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java55
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/InteractionMode.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java25
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardLayout.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeypressMode.java15
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Language.java98
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LayoutMode.java21
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LockScreenStatus.java18
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MediaClockFormat.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PowerModeQualificationStatus.java26
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PowerModeStatus.java29
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PrerecordedSpeech.java11
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/RequestType.java12
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Result.java11
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java9
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java16
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SpeechCapabilities.java21
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SystemAction.java22
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TBTState.java36
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java105
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TouchType.java22
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/UpdateMode.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataNotificationStatus.java16
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java39
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataStatus.java8
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java87
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/WiperStatus.java71
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java14
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/trace/SdlTrace.java24
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java124
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/ITransportListener.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/MultiplexBluetoothTransport.java888
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/MultiplexTransport.java314
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/MultiplexTransportConfig.java51
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/RouterServiceValidator.java575
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/SdlBroadcastReceiver.java274
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/SdlPsm.java247
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/SdlRouterService.java2451
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/SdlTransport.java25
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/TCPTransport.java65
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java597
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/TransportConstants.java196
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/USBTransport.java71
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/enums/TransportType.java5
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java71
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java107
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/util/BitConverter.java18
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/util/HttpRequestTask.java172
210 files changed, 13805 insertions, 1692 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..47ad9677a
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,12 @@
+language: android
+android:
+ components:
+ # use the latest revision of Android SDK Tools
+ - platform-tools
+ - tools
+
+ # The BuildTools version used by your project
+ - build-tools-23.0.2
+
+ # The SDK version used to compile your project
+ - android-18 \ No newline at end of file
diff --git a/README.md b/README.md
index 48f0f925c..f9e066d48 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![Slack Status](http://sdlslack.herokuapp.com/badge.svg)](http://slack.smartdevicelink.org)
+[![Slack Status](http://sdlslack.herokuapp.com/badge.svg)](http://slack.smartdevicelink.com)
# SmartDeviceLink (SDL)
SmartDeviceLink (SDL) is a standard set of protocols and messages that connect applications on a smartphone to a vehicle head unit. This messaging enables a consumer to interact with their application using common in-vehicle interfaces such as a touch screen display, embedded voice recognition, steering wheel controls and various vehicle knobs and buttons. There are three main components that make up the SDL ecosystem.
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 000000000..241c951c6
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,47 @@
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.1.0'
+ }
+}
+apply plugin: 'com.android.library'
+
+dependencies {
+ compile fileTree(dir: 'libs', include: '*.jar')
+}
+
+android {
+ compileSdkVersion 18
+ buildToolsVersion "23.0.2"
+
+ lintOptions {
+ // When we start automating build deployments this should be removed
+ abortOnError false
+ }
+
+ sourceSets {
+ main {
+ manifest.srcFile 'sdl_android_lib/AndroidManifest.xml'
+ java.srcDirs = ['src']
+ resources.srcDirs = ['src']
+ aidl.srcDirs = ['src']
+ renderscript.srcDirs = ['src']
+ res.srcDirs = ['res']
+ assets.srcDirs = ['assets']
+ }
+
+ // Move the tests to tests/java, tests/res, etc...
+ instrumentTest.setRoot('tests')
+
+ // Move the build types to build-types/<type>
+ // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
+ // This moves them out of them default location under src/<type>/... which would
+ // conflict with src/ being used by the main source set.
+ // Adding new build types or product flavors should be accompanied
+ // by a similar customization.
+ debug.setRoot('build-types/debug')
+ release.setRoot('build-types/release')
+ }
+}
diff --git a/sdl_android_lib/res/drawable-hdpi/sdl_128.png b/sdl_android_lib/res/drawable-hdpi/sdl_128.png
new file mode 100644
index 000000000..552ac8aef
--- /dev/null
+++ b/sdl_android_lib/res/drawable-hdpi/sdl_128.png
Binary files differ
diff --git a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
index 355d1e862..f4b4c43d9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
+++ b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
@@ -15,7 +15,7 @@ public interface ISdlConnectionListener {
byte sessionID, byte version, String correlationID);
public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, boolean isEncrypted);
+ byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted);
public void onProtocolSessionEnded(SessionType sessionType,
byte sessionID, String correlationID);
diff --git a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java
index a181df7b0..fc90336bc 100644
--- a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java
+++ b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java
@@ -1,20 +1,37 @@
package com.smartdevicelink.SdlConnection;
-
import java.util.concurrent.CopyOnWriteArrayList;
+
+import android.content.ComponentName;
+import android.util.Log;
+
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.protocol.AbstractProtocol;
import com.smartdevicelink.protocol.IProtocolListener;
import com.smartdevicelink.protocol.ProtocolMessage;
+import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.protocol.WiProProtocol;
import com.smartdevicelink.protocol.enums.SessionType;
-
-import com.smartdevicelink.transport.*;
+import com.smartdevicelink.transport.BTTransport;
+import com.smartdevicelink.transport.BTTransportConfig;
+import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.transport.ITransportListener;
+import com.smartdevicelink.transport.MultiplexTransport;
+import com.smartdevicelink.transport.MultiplexTransportConfig;
+import com.smartdevicelink.transport.RouterServiceValidator;
+import com.smartdevicelink.transport.SdlBroadcastReceiver;
+import com.smartdevicelink.transport.SdlTransport;
+import com.smartdevicelink.transport.TCPTransport;
+import com.smartdevicelink.transport.TCPTransportConfig;
+import com.smartdevicelink.transport.USBTransport;
+import com.smartdevicelink.transport.USBTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
public class SdlConnection implements IProtocolListener, ITransportListener {
+ private static final String TAG = "SdlConnection";
+
SdlTransport _transport = null;
AbstractProtocol _protocol = null;
ISdlConnectionListener _connectionListener = null;
@@ -22,11 +39,15 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
// Thread safety locks
- Object TRANSPORT_REFERENCE_LOCK = new Object();
+ static Object TRANSPORT_REFERENCE_LOCK = new Object();
Object PROTOCOL_REFERENCE_LOCK = new Object();
-
+
+ private Object SESSION_LOCK = new Object();
private CopyOnWriteArrayList<SdlSession> listenerList = new CopyOnWriteArrayList<SdlSession>();
-
+ private static TransportType legacyTransportRequest = null;
+ private final static int BUFF_READ_SIZE = 1000000;
+ protected static MultiplexTransportConfig cachedMultiConfig = null;
+
/**
* Constructor.
*
@@ -34,6 +55,25 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
* @param transportConfig Transport configuration for this connection.
*/
public SdlConnection(BaseTransportConfig transportConfig) {
+ RouterServiceValidator vlad = null;
+ //Let's check if we can even do multiplexing
+ if(transportConfig.getTransportType() == TransportType.MULTIPLEX){
+ ComponentName tempCompName = SdlBroadcastReceiver.consumeQueuedRouterService();
+ if(tempCompName!=null){
+ vlad =new RouterServiceValidator(((MultiplexTransportConfig)transportConfig).getContext(),tempCompName);
+ }else{
+ vlad =new RouterServiceValidator(((MultiplexTransportConfig)transportConfig).getContext());
+ }
+ //vlad.setFlags(RouterServiceValidator.FLAG_DEBUG_VERSION_CHECK);
+ }
+ constructor(transportConfig,vlad);
+ }
+ //For unit tests
+ protected SdlConnection(BaseTransportConfig transportConfig,RouterServiceValidator rsvp){
+ constructor(transportConfig,rsvp);
+ }
+
+ private void constructor(BaseTransportConfig transportConfig,RouterServiceValidator rsvp){
_connectionListener = new InternalMsgDispatcher();
// Initialize the transport
@@ -46,10 +86,34 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
_transport = null;
}
- if (transportConfig.getTransportType() == TransportType.BLUETOOTH)
- {
- BTTransportConfig myConfig = (BTTransportConfig) transportConfig;
- _transport = new BTTransport(this, myConfig.getKeepSocketActive());
+ //Let's check if we can even do multiplexing
+ if(!isLegacyModeEnabled() &&
+ rsvp!= null &&
+ transportConfig.getTransportType() == TransportType.MULTIPLEX){
+ //rsvp = new RouterServiceValidator(((MultiplexTransportConfig)transportConfig).getContext());
+ //vlad.setFlags(RouterServiceValidator.FLAG_DEBUG_VERSION_CHECK);
+ if(rsvp.validate()){
+ Log.w(TAG, "SDL Router service is valid; attempting to connect");
+ ((MultiplexTransportConfig)transportConfig).setService(rsvp.getService());//Let thes the transport broker know which service to connect to
+ }else{
+ Log.w(TAG, "SDL Router service isn't trusted. Enabling legacy bluetooth connection.");
+ if(cachedMultiConfig == null){
+ cachedMultiConfig = (MultiplexTransportConfig) transportConfig;
+ cachedMultiConfig.setService(null);
+ }
+ enableLegacyMode(true,TransportType.BLUETOOTH); //We will use legacy bluetooth connection for this attempt
+ Log.d(TAG, "Legacy transport : " + legacyTransportRequest);
+ }
+ }
+
+ if(!isLegacyModeEnabled() && //Make sure legacy mode is not enabled
+ (transportConfig.getTransportType() == TransportType.MULTIPLEX)){
+ _transport = new MultiplexTransport((MultiplexTransportConfig)transportConfig,this);
+ }else if(isLegacyModeEnabled() && legacyTransportRequest == TransportType.BLUETOOTH){
+ Log.d(TAG, "Creating legacy bluetooth connection");
+ _transport = new BTTransport(this, true);
+ }else if(transportConfig.getTransportType() == TransportType.BLUETOOTH){
+ _transport = new BTTransport(this,((BTTransportConfig)transportConfig).getKeepSocketActive());
}
else if (transportConfig.getTransportType() == TransportType.TCP)
{
@@ -77,19 +141,19 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
- private void closeConnection(boolean willRecycle, byte rpcSessionID) {
+ private void closeConnection(boolean willRecycle, byte rpcSessionID, int sessionHashId) {
synchronized(PROTOCOL_REFERENCE_LOCK) {
+
if (_protocol != null) {
// If transport is still connected, sent EndProtocolSessionMessage
if (_transport != null && _transport.getIsConnected()) {
- _protocol.EndProtocolSession(SessionType.RPC, rpcSessionID);
+ _protocol.EndProtocolSession(SessionType.RPC, rpcSessionID, sessionHashId);
}
if (willRecycle) {
_protocol = null;
}
} // end-if
}
-
synchronized (TRANSPORT_REFERENCE_LOCK) {
if (willRecycle) {
if (_transport != null) {
@@ -138,12 +202,11 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
}
@Override
- public void onTransportBytesReceived(byte[] receivedBytes,
- int receivedBytesLength) {
+ public void onTransportPacketReceived(SdlPacket packet) {
// Send bytes to protocol to be interpreted
synchronized(PROTOCOL_REFERENCE_LOCK) {
if (_protocol != null) {
- _protocol.HandleReceivedBytes(receivedBytes, receivedBytesLength);
+ _protocol.handlePacketReceived(packet);
}
}
}
@@ -152,8 +215,12 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
public void onTransportConnected() {
synchronized(PROTOCOL_REFERENCE_LOCK){
if(_protocol != null){
+ boolean shouldRequestSession = _transport !=null && _transport.getTransportType()== TransportType.MULTIPLEX;
for (SdlSession s : listenerList) {
if (s.getSessionId() == 0) {
+ if(shouldRequestSession){
+ ((MultiplexTransport)_transport).requestNewSession();
+ }
startHandShake();
}
}
@@ -174,12 +241,11 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
}
@Override
- public void onProtocolMessageBytesToSend(byte[] msgBytes, int offset,
- int length) {
+ public void onProtocolMessageBytesToSend(SdlPacket packet) {
// Protocol has packaged bytes to send, pass to transport for transmission
synchronized(TRANSPORT_REFERENCE_LOCK) {
if (_transport != null) {
- _transport.sendBytes(msgBytes, offset, length);
+ _transport.sendBytes(packet);
}
}
}
@@ -191,8 +257,8 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
@Override
public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, boolean isEncrypted) {
- _connectionListener.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, isEncrypted);
+ byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
+ _connectionListener.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, hashID, isEncrypted);
}
@Override
@@ -234,16 +300,18 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
public void endService (SessionType sessionType, byte sessionID) {
synchronized(PROTOCOL_REFERENCE_LOCK){
if(_protocol != null){
- _protocol.EndProtocolSession(sessionType, sessionID);
+ _protocol.EndProtocolService(sessionType, sessionID);
}
}
}
- void registerSession(SdlSession registerListener) throws SdlException {
- listenerList.addIfAbsent(registerListener);
-
+ void registerSession(SdlSession registerListener) throws SdlException {
+ boolean didAdd = listenerList.addIfAbsent(registerListener);
if (!this.getIsConnected()) {
this.startTransport();
} else {
+ if(didAdd && _transport !=null && _transport.getTransportType()== TransportType.MULTIPLEX){ //If we're connected we can request the extra session now
+ ((MultiplexTransport)_transport).requestNewSession();
+ }
this.startHandShake();
}
}
@@ -254,8 +322,11 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
}
public void unregisterSession(SdlSession registerListener) {
- listenerList.remove(registerListener);
- closeConnection(listenerList.size() == 0, registerListener.getSessionId());
+ boolean didRemove = listenerList.remove(registerListener);
+ if(didRemove && _transport !=null && _transport.getTransportType()== TransportType.MULTIPLEX){ //If we're connected we can request the extra session now
+ ((MultiplexTransport)_transport).removeSession(registerListener.getSessionId());
+ }
+ closeConnection(listenerList.size() == 0, registerListener.getSessionId(), registerListener.getSessionHashId());
}
@@ -275,13 +346,48 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
for (SdlSession session : listenerList) {
session.onTransportDisconnected(info);
}
+ if(cachedMultiConfig!=null ){
+ if(cachedMultiConfig.getService()!=null){
+ synchronized(TRANSPORT_REFERENCE_LOCK) {
+ // Ensure transport is null
+ if (_transport != null) {
+ if (_transport.getIsConnected()) {
+ _transport.disconnect();
+ }
+ _transport = null;
+ }
+ _transport = new MultiplexTransport(cachedMultiConfig, SdlConnection.this);
+ try {
+ startTransport();
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ ((MultiplexTransport)_transport).forceHardwareConnectEvent(TransportType.BLUETOOTH);
+ }
+ }else{ //The service must be null or already consumed. Let's see if we can find the connection that consumed it
+ for (SdlSession session : listenerList) {
+ session.checkForOpenMultiplexConnection(SdlConnection.this);;
+ }
+ }
+ }
}
@Override
public void onTransportError(String info, Exception e) {
+ //If there's an error with the transport we want to make sure we clear out any reference to it held by the static list in sessions
+ SdlSession.removeConnection(SdlConnection.this);
+ //If we are erroring out to go into legacy mode, lets cache our multiplexing
+ if(isLegacyModeEnabled() && _transport!=null && TransportType.MULTIPLEX.equals(_transport.getTransportType())){
+ MultiplexTransport multi = ((MultiplexTransport)_transport);
+ cachedMultiConfig = multi.getConfig();
+ cachedMultiConfig.setService(null); //Make sure we're clearning this out
+ }else{
+ cachedMultiConfig = null; //It should now be consumed
+ }
for (SdlSession session : listenerList) {
session.onTransportError(info, e);
}
+
}
@Override
@@ -294,10 +400,10 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
@Override
public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, boolean isEncrypted) {
+ byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
for (SdlSession session : listenerList) {
if (session.getSessionId() == 0) {
- session.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, isEncrypted);
+ session.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, hashID, isEncrypted);
break;
}
}
@@ -305,7 +411,7 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
if (sessionType.equals(SessionType.NAV) || sessionType.equals(SessionType.PCM) || isEncrypted){
SdlSession session = findSessionById(sessionID);
if (session != null) {
- session.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, isEncrypted);
+ session.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, hashID, isEncrypted);
}
}
}
@@ -411,6 +517,76 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
mySession._incomingHeartbeatMonitor.notifyTransportActivity();
}
}
+
+ public void forceHardwareConnectEvent(TransportType type){
+ if(_transport == null){
+ Log.w(TAG, "Unable to force connect, transport was null!");
+ return;
+ }
+ if(isLegacyModeEnabled()){//We know we should no longer be in legacy mode for future connections, so lets clear out that flag
+ enableLegacyMode(false,null);
+ }
+ if(_transport!=null && (_transport.getTransportType()==TransportType.MULTIPLEX)){ //This is only valid for the multiplex connection
+ MultiplexTransport multi = ((MultiplexTransport)_transport);
+ MultiplexTransportConfig config = multi.getConfig();
+ ComponentName tempCompName = SdlBroadcastReceiver.consumeQueuedRouterService();
+ //Log.d(TAG, "Consumed component name: " +tempCompName );
+ if(config.getService().equals(tempCompName)){ //If this is the same service that just connected that we are already looking at. Attempt to reconnect
+ boolean forced = multi.forceHardwareConnectEvent(TransportType.BLUETOOTH);
+
+ if(!forced && multi.isDisconnecting() ){ //If we aren't able to force a connection it means the
+ //Log.d(TAG, "Recreating our multiplexing transport");
+ _transport = new MultiplexTransport(config,this);
+ ((MultiplexTransport)_transport).forceHardwareConnectEvent(TransportType.BLUETOOTH);
+ }//else{Log.w(TAG, "Guess we're just calling it a day");}
+ }else if(tempCompName!=null){
+ //We have a conflicting service request
+ Log.w(TAG, "Conflicting services. Disconnecting from current and connecting to new");
+ Log.w(TAG, "Old service " + config.getService().toShortString());
+ Log.w(TAG, "New Serivce " + tempCompName.toString());
+ multi.disconnect();
+ config.setService(tempCompName);
+ _transport = new MultiplexTransport(config,this);
+ try {
+ startTransport();
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ ((MultiplexTransport)_transport).forceHardwareConnectEvent(TransportType.BLUETOOTH);
+
+ }
+ }else if(_transport.getTransportType()==TransportType.BLUETOOTH
+ && !_transport.getIsConnected()){
+ if(cachedMultiConfig!=null){
+ //We are in legacy mode, but just received a force connect. The router service should never be pointing us here if we are truely in legacy mode
+ ComponentName tempCompName = SdlBroadcastReceiver.consumeQueuedRouterService();
+ cachedMultiConfig.setService(tempCompName);
+ //We are not connected yet so we should be able to close down
+ _transport.disconnect(); //This will force us into the
+ }else{
+ Log.i(TAG, "No cached multiplexing config, transport error being called");
+ _transport.disconnect();
+ }
+ Log.w(TAG, "Using own transport, but not connected. Attempting to join multiplexing");
+ }else{
+ Log.w(TAG, "Currently in legacy mode connected to own transport service. Nothing will take place on trnasport cycle");
+ }
+ }
+
+ public static void enableLegacyMode(boolean enable, TransportType type){
+ synchronized(TRANSPORT_REFERENCE_LOCK) {
+ if(enable){
+ legacyTransportRequest = type;
+ }else{
+ legacyTransportRequest = null;
+ }
+ }
+ }
+ public static boolean isLegacyModeEnabled(){
+ synchronized(TRANSPORT_REFERENCE_LOCK) {
+ return (legacyTransportRequest!=null);
+ }
+ }
@Override
public void onProtocolSessionEndedNACKed(SessionType sessionType,
diff --git a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlSession.java b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlSession.java
index 18e222c04..09f029fca 100644
--- a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlSession.java
+++ b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlSession.java
@@ -28,6 +28,7 @@ import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamPacketizer;
import com.smartdevicelink.streaming.StreamRPCPacketizer;
import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.transport.MultiplexTransport;
import com.smartdevicelink.transport.enums.TransportType;
public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorListener, IStreamListener, ISecurityInitializedListener {
@@ -49,7 +50,9 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
StreamPacketizer mAudioPacketizer = null;
SdlEncoder mSdlEncoder = null;
private final static int BUFF_READ_SIZE = 1024;
-
+ private int sessionHashId = 0;
+
+
public static SdlSession createSession(byte wiproVersion, ISdlConnectionListener listener, BaseTransportConfig btConfig) {
SdlSession session = new SdlSession();
@@ -90,7 +93,10 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
_incomingHeartbeatMonitor.setListener(this);
}
-
+ public int getSessionHashId() {
+ return this.sessionHashId;
+ }
+
public byte getSessionId() {
return this.sessionId;
}
@@ -462,14 +468,17 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
@Override
public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, boolean isEncrypted) {
+ byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
this.sessionId = sessionID;
lockScreenMan.setSessionID(sessionID);
if (isEncrypted)
encryptedServices.addIfAbsent(sessionType);
- this.sessionListener.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, isEncrypted);
-
- initialiseSession();
+ this.sessionListener.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, hashID, isEncrypted);
+ //if (version == 3)
+ initialiseSession();
+ if (sessionType.eq(SessionType.RPC)){
+ sessionHashId = hashID;
+ }
}
@Override
@@ -552,4 +561,31 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
}
}
}
+
+ public void clearConnection(){
+ _sdlConnection = null;
+ }
+
+ public void checkForOpenMultiplexConnection(SdlConnection connection){
+ removeConnection(connection);
+ connection.unregisterSession(this);
+ _sdlConnection = null;
+ for (SdlConnection c : shareConnections) {
+ if (c.getCurrentTransportType() == TransportType.MULTIPLEX) {
+ if(c.getIsConnected() || ((MultiplexTransport)c._transport).isPendingConnected()){
+ _sdlConnection = c;
+ try {
+ _sdlConnection.registerSession(this);//Handshake will start when register.
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ return;
+ }
+
+ }
+ }
+ }
+ public static boolean removeConnection(SdlConnection connection){
+ return shareConnections.remove(connection);
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/AbstractProtocol.java b/sdl_android_lib/src/com/smartdevicelink/protocol/AbstractProtocol.java
index 0aa2cc682..5cdf06e95 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/AbstractProtocol.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/AbstractProtocol.java
@@ -2,8 +2,6 @@ package com.smartdevicelink.protocol;
import com.smartdevicelink.protocol.WiProProtocol.MessageFrameAssembler;
import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.trace.SdlTrace;
-import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
public abstract class AbstractProtocol {
private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
@@ -23,10 +21,6 @@ public abstract class AbstractProtocol {
_protocolListener = protocolListener;
} // end-ctor
- // This method receives raw bytes as they arrive from transport. Those bytes
- // are then collected by the protocol and assembled into complete messages and
- // handled internally by the protocol or propagated to the protocol listener.
- public abstract void HandleReceivedBytes(byte[] receivedBytes, int length);
// This method receives a protocol message (e.g. RPC, BULK, etc.) and processes
// it for transmission over the transport. The results of this processing will
@@ -36,6 +30,9 @@ public abstract class AbstractProtocol {
// over which to send the message, etc.
public abstract void SendMessage(ProtocolMessage msg);
+
+ public abstract void handlePacketReceived(SdlPacket packet);
+
// This method starts a protocol session. A corresponding call to the protocol
// listener onProtocolSessionStarted() method will be made when the protocol
// session has been established.
@@ -47,7 +44,8 @@ public abstract class AbstractProtocol {
// This method ends a protocol session. A corresponding call to the protocol
// listener onProtocolSessionEnded() method will be made when the protocol
// session has ended.
- public abstract void EndProtocolSession(SessionType sessionType, byte sessionID);
+ public abstract void EndProtocolSession(SessionType sessionType, byte sessionID, int hashID);
+
// TODO REMOVE
// This method sets the interval at which heartbeat protocol messages will be
// sent to SDL.
@@ -62,11 +60,11 @@ public abstract class AbstractProtocol {
public abstract void SendHeartBeatACK(byte sessionID);
// This method is called whenever the protocol receives a complete frame
- protected void handleProtocolFrameReceived(ProtocolFrameHeader header, byte[] data, MessageFrameAssembler assembler) {
- SdlTrace.logProtocolEvent(InterfaceActivityDirection.Receive, header, data,
- 0, data.length, SDL_LIB_TRACE_KEY);
+ protected void handleProtocolFrameReceived(SdlPacket packet, MessageFrameAssembler assembler) {
+ //FIXME SdlTrace.logProtocolEvent(InterfaceActivityDirection.Receive, header, data,
+ // 0, packet.dataSize, SDL_LIB_TRACE_KEY);
- assembler.handleFrame(header, data);
+ assembler.handleFrame(packet);
}
private synchronized void resetOutgoingHeartbeat(SessionType sessionType, byte sessionID) {
@@ -82,26 +80,25 @@ public abstract class AbstractProtocol {
}
// This method is called whenever a protocol has an entire frame to send
- protected void handleProtocolFrameToSend(ProtocolFrameHeader header, byte[] data, int offset, int length) {
- SdlTrace.logProtocolEvent(InterfaceActivityDirection.Transmit, header, data,
- offset, length, SDL_LIB_TRACE_KEY);
- resetOutgoingHeartbeat(header.getSessionType(), header.getSessionID());
+ /**
+ * SdlPacket should have included payload at this point.
+ * @param header
+ */
+ protected void handlePacketToSend(SdlPacket header) {
+ //FIXME SdlTrace.logProtocolEvent(InterfaceActivityDirection.Transmit, header, data,
+ // offset, length, SDL_LIB_TRACE_KEY);
+ resetOutgoingHeartbeat(SessionType.valueOf((byte)header.getServiceType()), (byte)header.getSessionId());
+
synchronized(_frameLock) {
- byte[] frameHeader = header.assembleHeaderBytes();
- handleProtocolMessageBytesToSend(frameHeader, 0, frameHeader.length);
- if (data != null) {
- handleProtocolMessageBytesToSend(data, offset, length);
- } // end-if
+ //byte[] frameHeader = header.constructPacket();
+ if(header!=null){
+ _protocolListener.onProtocolMessageBytesToSend(header);
+ }//TODO else log out error
+
}
}
-
- // This method handles protocol message bytes that are ready to send.
- // A callback is sent to the protocol listener.
- protected void handleProtocolMessageBytesToSend(byte[] bytesToSend,
- int offset, int length) {
- _protocolListener.onProtocolMessageBytesToSend(bytesToSend, offset, length);
- }
+
// This method handles received protocol messages.
protected void handleProtocolMessageReceived(ProtocolMessage message) {
@@ -125,8 +122,8 @@ public abstract class AbstractProtocol {
// This method handles the startup of a protocol session. A callback is sent
// to the protocol listener.
protected void handleProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, boolean isEncrypted) {
- _protocolListener.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, isEncrypted);
+ byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
+ _protocolListener.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, hashID, isEncrypted);
}
protected void handleProtocolSessionNACKed(SessionType sessionType,
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/BinaryFrameHeader.java b/sdl_android_lib/src/com/smartdevicelink/protocol/BinaryFrameHeader.java
index 3f40509ab..b3c21a340 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/BinaryFrameHeader.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/BinaryFrameHeader.java
@@ -43,7 +43,7 @@ public class BinaryFrameHeader {
return msg;
}
- protected byte[] assembleHeaderBytes() {
+ public byte[] assembleHeaderBytes() {
int binHeader = _functionID;
// reset the 4 leftmost bits, for _rpcType
binHeader &= 0xFFFFFFFF >>> 4;
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/IProtocolListener.java b/sdl_android_lib/src/com/smartdevicelink/protocol/IProtocolListener.java
index 280f660df..b54ff66c8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/IProtocolListener.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/IProtocolListener.java
@@ -5,14 +5,14 @@ import com.smartdevicelink.protocol.enums.*;
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.
- void onProtocolMessageBytesToSend(byte[] msgBytes, int offset, int length);
+ void onProtocolMessageBytesToSend(SdlPacket packet);
// Called to indicate that a complete message (RPC, BULK, etc.) has been
// received. This call includes the message.
void onProtocolMessageReceived(ProtocolMessage msg);
// Called to indicate that a protocol session has been started (from either side)
- void onProtocolSessionStarted(SessionType sessionType, byte sessionID, byte version, String correlationID, boolean isEncrypted);
+ void onProtocolSessionStarted(SessionType sessionType, byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted);
void onProtocolSessionNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID);
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/ProtocolMessage.java b/sdl_android_lib/src/com/smartdevicelink/protocol/ProtocolMessage.java
index 63a77c825..99b34aff6 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/ProtocolMessage.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/ProtocolMessage.java
@@ -14,6 +14,8 @@ public class ProtocolMessage {
private int _jsonSize;
private boolean payloadProtected = false;
+ int priorityCoefficient = 0;
+
private byte[] _data = null;
private byte[] _bulkData = null;
@@ -132,4 +134,14 @@ public class ProtocolMessage {
return payloadProtected;
}
+ /**
+ * Set the priority for this packet. The lower the number the higher the priority. <br>0 is the highest priority and the default.
+ * @param priority
+ */
+ public void setPriorityCoefficient(int priority){
+ this.priorityCoefficient = priority;
+ }
+ public int getPrioirtyCoefficient(){
+ return this.priorityCoefficient;
+ }
} // end-class \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacket.aidl b/sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacket.aidl
new file mode 100644
index 000000000..cec80021e
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacket.aidl
@@ -0,0 +1,5 @@
+package com.smartdevicelink.protocol;
+//Seems silly, but....welcome to Android
+//We need to do this so the compiler knows that the SdlPacket.java class ia actually a parceable object and how to handle it
+// when dealing with other interface (aidl) files as well as being able to send them through intents
+parcelable SdlPacket; \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacket.java b/sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacket.java
new file mode 100644
index 000000000..9cb871248
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacket.java
@@ -0,0 +1,349 @@
+package com.smartdevicelink.protocol;
+
+import java.nio.ByteBuffer;
+
+import com.smartdevicelink.protocol.enums.FrameType;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class SdlPacket implements Parcelable{
+
+
+ public static final int HEADER_SIZE = 12;
+ public static final int HEADER_SIZE_V1 = 8;//Backwards
+
+ private static final int ENCRIPTION_MASK = 0x08; //4th lowest bit
+
+ public static final int FRAME_TYPE_CONTROL = 0x00;
+ public static final int FRAME_TYPE_SINGLE = 0x01;
+ public static final int FRAME_TYPE_FIRST = 0x02;
+ public static final int FRAME_TYPE_CONSECUTIVE = 0x03;
+
+ /*
+ * Service Type
+ */
+ public static final int SERVICE_TYPE_CONTROL = 0x00;
+ //RESERVED 0x01 - 0x06
+ public static final int SERVICE_TYPE_RPC = 0x07;
+ //RESERVED 0x08 - 0x09
+ public static final int SERVICE_TYPE_PCM = 0x0A;
+ public static final int SERVICE_TYPE_VIDEO = 0x0B;
+ //RESERVED 0x0C - 0x0E
+ public static final int SERVICE_TYPE_BULK_DATA = 0x0F;
+ //RESERVED 0x10 - 0xFF
+
+
+ /*
+ * Frame Info
+ */
+ //Control Frame Info
+ public static final int FRAME_INFO_HEART_BEAT = 0x00;
+ public static final int FRAME_INFO_START_SERVICE = 0x01;
+ public static final int FRAME_INFO_START_SERVICE_ACK = 0x02;
+ public static final int FRAME_INFO_START_SERVICE_NAK = 0x03;
+ public static final int FRAME_INFO_END_SERVICE = 0x04;
+ public static final int FRAME_INFO_END_SERVICE_ACK = 0x05;
+ public static final int FRAME_INFO_END_SERVICE_NAK = 0x06;
+ //0x07-0xFD are reserved
+ public static final int FRAME_INFO_SERVICE_DATA_ACK = 0xFE;
+ public static final int FRAME_INFO_HEART_BEAT_ACK = 0xFF;
+
+ public static final int FRAME_INFO_FINAL_CONNESCUTIVE_FRAME = 0x00;
+
+ //Most others
+ public static final int FRAME_INFO_RESERVED = 0x00;
+
+
+ int version;
+ boolean encrypted;
+ int frameType;
+ int serviceType;
+ int frameInfo;
+ int sessionId;
+ int dataSize;
+ int messageId;
+ int priorityCoefficient;
+ byte[] payload = null;
+
+ public SdlPacket(int version, boolean encrypted, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload) {
+ this.version = version;
+ this.encrypted = encrypted;
+ this.frameType = frameType;
+ this.serviceType = serviceType;
+ this.frameInfo = frameInfo;
+ this.sessionId = sessionId;
+ this.dataSize = dataSize;
+ this.messageId = messageId;
+ this.priorityCoefficient = 0;
+ if(payload!=null){
+ this.payload = new byte[payload.length];
+ System.arraycopy(payload, 0, this.payload, 0, payload.length);
+ }
+ }
+
+ public SdlPacket(int version, boolean encrypted, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload, int offset,int bytesToWrite) {
+ this.version = version;
+ this.encrypted = encrypted;
+ this.frameType = frameType;
+ this.serviceType = serviceType;
+ this.frameInfo = frameInfo;
+ this.sessionId = sessionId;
+ this.dataSize = dataSize;
+ this.messageId = messageId;
+ this.priorityCoefficient = 0;
+ if(payload!=null){
+ this.payload = new byte[bytesToWrite];
+ System.arraycopy(payload, offset, this.payload, 0, bytesToWrite);
+ }
+ }
+ /**
+ * This constructor is available as a protected method. A few defaults have been set, however a few things <b>MUST</b> be set before use. The rest will "work"
+ * however, it won't be valid data.
+ *
+ * <p>Frame Type
+ * <p>Service Type
+ * <p>Frame Info
+ * <p>
+ */
+ protected SdlPacket(){
+ //Package only empty constructor
+ //TODO add defaults
+ this.version = 1;
+ this.encrypted = false;
+ this.frameType = -1; //This NEEDS to be set
+ this.serviceType = -1;
+ this.frameInfo = -1;
+ this.sessionId = 0;
+ this.dataSize = 0;
+ this.messageId = 0;
+
+ }
+
+ /**
+ * Creates a new packet based on previous packet definitions
+ * @param packet
+ */
+ protected SdlPacket(SdlPacket packet){
+ this.version = packet.version;
+ this.encrypted = packet.encrypted;
+ this.frameType = packet.frameType;
+ this.serviceType = packet.serviceType;
+ this.frameInfo = packet.frameInfo;
+ this.sessionId = packet.sessionId;
+ this.dataSize = 0;
+ this.messageId = 0;
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ public boolean isEncrypted() {
+ return encrypted;
+ }
+
+ public FrameType getFrameType() {
+ switch(frameType){
+ case FRAME_TYPE_CONTROL:
+ return FrameType.Control;
+ case FRAME_TYPE_FIRST:
+ return FrameType.First;
+ case FRAME_TYPE_CONSECUTIVE:
+ return FrameType.Consecutive;
+ case FRAME_TYPE_SINGLE:
+ default:
+ return FrameType.Single;
+ }
+ }
+
+ public int getServiceType() {
+ return serviceType;
+ }
+
+ public int getFrameInfo() {
+ return frameInfo;
+ }
+
+ public int getSessionId() {
+ return sessionId;
+ }
+
+ public int getMessageId() {
+ return messageId;
+ }
+
+ public long getDataSize() {
+ return dataSize;
+ }
+
+ public byte[] getPayload() {
+ return payload;
+ }
+
+ public byte[] constructPacket(){
+ return constructPacket(version, encrypted, frameType,
+ serviceType, frameInfo, sessionId,
+ dataSize, messageId, payload);
+ }
+ public void setPayload(byte[] bytes){
+ this.payload = bytes;
+ }
+ /**
+ * Set the priority for this packet. The lower the number the higher the priority. <br>0 is the highest priority and the default.
+ * @param priority
+ */
+ public void setPriorityCoefficient(int priority){
+ this.priorityCoefficient = priority;
+ }
+ public int getPrioirtyCoefficient(){
+ return this.priorityCoefficient;
+ }
+ /**
+ * This method takes in the various components to the SDL packet structure and creates a new byte array that can be sent via the transport
+ * @param version
+ * @param compression
+ * @param frameType
+ * @param serviceType
+ * @param controlFrameInfo
+ * @param sessionId
+ * @param dataSize
+ * @param messageId
+ * @param payload
+ * @return
+ */
+ public static byte[] constructPacket(int version, boolean encrypted, int frameType,
+ int serviceType, int controlFrameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload){
+ ByteBuffer builder;
+ switch(version){
+ case 1:
+ builder = ByteBuffer.allocate(HEADER_SIZE_V1 + dataSize);
+ break;
+ default:
+ builder = ByteBuffer.allocate(HEADER_SIZE + dataSize);
+ break;
+ }
+
+ builder.put((byte)((version<<4) + getEncryptionBit(encrypted) + frameType));
+ builder.put((byte)serviceType);
+ builder.put((byte)controlFrameInfo);
+ builder.put((byte)sessionId);
+
+ builder.put((byte)((dataSize&0xFF000000)>>24));
+ builder.put((byte)((dataSize&0x00FF0000)>>16));
+ builder.put((byte)((dataSize&0x0000FF00)>>8));
+ builder.put((byte)((dataSize&0x000000FF)));
+
+ if(version>1){ //Version 1 did not include this part of the header
+ builder.put((byte)((messageId&0xFF000000)>>24));
+ builder.put((byte)((messageId&0x00FF0000)>>16));
+ builder.put((byte)((messageId&0x0000FF00)>>8));
+ builder.put((byte)((messageId&0x000000FF)));
+ }
+
+ if(payload!=null && payload.length>0){
+ builder.put(payload);
+ }
+
+ return builder.array();
+ }
+
+
+ public static int getEncryptionBit(boolean encrypted){
+ if(encrypted){
+ return ENCRIPTION_MASK;
+ }else{
+ return 0;
+ }
+ }
+
+
+
+@Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("***** Sdl Packet ******");
+ builder.append( "\nVersion: " +version);
+ builder.append( "\nEncrypted: " +encrypted);
+ builder.append( "\nFrameType: " +frameType);
+ builder.append( "\nServiceType: " +serviceType);
+ builder.append( "\nFrameInfo: " +frameInfo);
+ builder.append( "\nSessionId: " +sessionId);
+ builder.append( "\nDataSize: " +dataSize);
+ if(version>1){
+ builder.append( "\nMessageId: " +messageId);
+ }
+ builder.append("\n***** Sdl Packet End******");
+
+
+ return builder.toString();
+ }
+
+
+
+ /* ***************************************************************************************************************************************************
+ * *********************************************************** Parceable Overrides *****************************************************************
+ *****************************************************************************************************************************************************/
+
+
+ //I think this is FIFO...right?
+ public SdlPacket(Parcel p) {
+ this.version = p.readInt();
+ this.encrypted = (p.readInt() == 0) ? false : true;
+ this.frameType = p.readInt();
+ this.serviceType = p.readInt();
+ this.frameInfo = p.readInt();
+ this.sessionId = p.readInt();
+ this.dataSize = p.readInt();
+ this.messageId = p.readInt();
+ if(p.readInt() == 1){ //We should have a payload attached
+ payload = new byte[dataSize];
+ p.readByteArray(payload);
+ }
+ this.priorityCoefficient = p.readInt();
+ }
+
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+
+ dest.writeInt(version);
+ dest.writeInt(encrypted? 1 : 0);
+ dest.writeInt(frameType);
+ dest.writeInt(serviceType);
+ dest.writeInt(frameInfo);
+ dest.writeInt(sessionId);
+ dest.writeInt(dataSize);
+ dest.writeInt(messageId);
+ dest.writeInt(payload!=null? 1 : 0);
+ if(payload!=null){
+ dest.writeByteArray(payload);
+ }
+ dest.writeInt(priorityCoefficient);
+
+ }
+
+ public static final Parcelable.Creator<SdlPacket> CREATOR = new Parcelable.Creator<SdlPacket>() {
+ public SdlPacket createFromParcel(Parcel in) {
+ return new SdlPacket(in);
+ }
+
+ @Override
+ public SdlPacket[] newArray(int size) {
+ return new SdlPacket[size];
+ }
+
+ };
+
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacketFactory.java b/sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacketFactory.java
new file mode 100644
index 000000000..db1795f02
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/SdlPacketFactory.java
@@ -0,0 +1,92 @@
+package com.smartdevicelink.protocol;
+
+import com.smartdevicelink.protocol.enums.FrameDataControlFrameType;
+import com.smartdevicelink.protocol.enums.SessionType;
+
+public class SdlPacketFactory {
+
+ /*
+ * public SdlPacket(int version, boolean compression, int frameType,
+ int serviceType, int frameInfo, int sessionId,
+ int dataSize, int messageId, byte[] payload) {
+ */
+ public static SdlPacket createStartSession(SessionType serviceType, int messageID, byte version, byte sessionID, boolean isEncrypted) {
+ SdlPacket packet = new SdlPacket(version,isEncrypted,SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(),SdlPacket.FRAME_INFO_START_SERVICE,sessionID,
+ 0,messageID,null);
+
+ return packet;
+ }
+
+ public static SdlPacket createHeartbeat(SessionType serviceType, byte sessionID, byte version) {
+
+ return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(),FrameDataControlFrameType.Heartbeat.value(),sessionID,
+ 0,0,null);
+
+ }
+
+ public static SdlPacket createHeartbeatACK(SessionType serviceType, byte sessionID, byte version) {
+ return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(),FrameDataControlFrameType.HeartbeatACK.value(),sessionID,
+ 0,0,null);
+ }
+
+ public static SdlPacket createStartSessionACK(SessionType serviceType, byte sessionID, int messageID, byte version) {
+
+ return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(),FrameDataControlFrameType.StartSessionACK.value(),sessionID,
+ 0,messageID,null);
+
+ }
+
+ public static SdlPacket createStartSessionNACK(SessionType serviceType, byte sessionID, int messageID, byte version) {
+
+ return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(),SdlPacket.FRAME_INFO_START_SERVICE_NAK,sessionID,
+ 0,messageID,null);
+ }
+
+ public static SdlPacket createEndSession(SessionType serviceType, byte sessionID, int messageID, byte version, byte[] payload) {
+ return new SdlPacket(version,false,SdlPacket.FRAME_TYPE_CONTROL,
+ serviceType.getValue(),SdlPacket.FRAME_INFO_END_SERVICE,sessionID,
+ payload.length,messageID,payload);
+ }
+
+ public static SdlPacket createSingleSendData(SessionType serviceType, byte sessionID,
+ int dataLength, int messageID, byte version, byte[] payload, boolean isEncrypted) {
+
+ return new SdlPacket(version,isEncrypted,SdlPacket.FRAME_TYPE_SINGLE,
+ serviceType.getValue(),0,sessionID,
+ payload.length,messageID,payload);
+ }
+
+ public static SdlPacket createMultiSendDataFirst(SessionType serviceType, byte sessionID,
+ int messageID, byte version, byte[] payload, boolean isEncrypted) {
+
+ return new SdlPacket(version,isEncrypted,SdlPacket.FRAME_TYPE_FIRST,
+ serviceType.getValue(),0,sessionID,
+ 8,messageID,payload);
+
+ }
+
+ public static SdlPacket createMultiSendDataRest(SessionType serviceType, byte sessionID,
+ int dataLength, byte frameSequenceNumber, int messageID, byte version, byte[] payload,int offset,int length, boolean isEncrypted) {
+
+ return new SdlPacket(version,isEncrypted,SdlPacket.FRAME_TYPE_CONSECUTIVE,
+ serviceType.getValue(),frameSequenceNumber,sessionID,
+ length,messageID,payload,offset,length);
+ }
+
+
+ public static BinaryFrameHeader createBinaryFrameHeader(byte rpcType, int functionID, int corrID, int jsonSize) {
+ BinaryFrameHeader msg = new BinaryFrameHeader();
+ msg.setRPCType(rpcType);
+ msg.setFunctionID(functionID);
+ msg.setCorrID(corrID);
+ msg.setJsonSize(jsonSize);
+
+ return msg;
+ }
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/WiProProtocol.java b/sdl_android_lib/src/com/smartdevicelink/protocol/WiProProtocol.java
index 6d0c92469..3b950d79e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/WiProProtocol.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/WiProProtocol.java
@@ -3,12 +3,14 @@ package com.smartdevicelink.protocol;
import java.io.ByteArrayOutputStream;
import java.util.Hashtable;
-import android.util.Log;
-
import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.SdlConnection.SdlSession;
-import com.smartdevicelink.exception.*;
-import com.smartdevicelink.protocol.enums.*;
+import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.exception.SdlExceptionCause;
+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.security.SdlSecurityBase;
import com.smartdevicelink.util.BitConverter;
import com.smartdevicelink.util.DebugTool;
@@ -22,13 +24,6 @@ public class WiProProtocol extends AbstractProtocol {
private static int HEADER_SIZE = 8;
private static int MAX_DATA_SIZE = V1_V2_MTU_SIZE - HEADER_SIZE;
- boolean _haveHeader = false;
- byte[] _headerBuf = new byte[HEADER_SIZE];
- int _headerBufWritePos = 0;
- ProtocolFrameHeader _currentHeader = null;
- byte[] _dataBuf = null;
- int _dataBufWritePos = 0;
-
int hashID = 0;
int messageID = 0;
SdlConnection sdlconn = null;
@@ -59,86 +54,77 @@ public class WiProProtocol extends AbstractProtocol {
public byte getVersion() {
return this._version;
}
-
- public void setVersion(byte version) {
+
+ public void setVersion(byte version) {
if (version > 4) {
this._version = 4; //protect for future, proxy only supports v4 or lower
HEADER_SIZE = 12;
MAX_DATA_SIZE = V1_V2_MTU_SIZE - HEADER_SIZE; //default to lowest size since capabilities of this version are unknown
- _headerBuf = new byte[HEADER_SIZE];
} else if (version == 4) {
this._version = version;
HEADER_SIZE = 12;
MAX_DATA_SIZE = V3_V4_MTU_SIZE; //versions 4 supports 128k MTU
- _headerBuf = new byte[HEADER_SIZE];
} else if (version == 3) {
this._version = version;
HEADER_SIZE = 12;
MAX_DATA_SIZE = V3_V4_MTU_SIZE; //versions 3 supports 128k MTU
- _headerBuf = new byte[HEADER_SIZE];
} else if (version == 2) {
this._version = version;
HEADER_SIZE = 12;
MAX_DATA_SIZE = V1_V2_MTU_SIZE - HEADER_SIZE;
- _headerBuf = new byte[HEADER_SIZE];
} else if (version == 1){
this._version = version;
HEADER_SIZE = 8;
MAX_DATA_SIZE = V1_V2_MTU_SIZE - HEADER_SIZE;
- _headerBuf = new byte[HEADER_SIZE];
}
}
public void StartProtocolSession(SessionType sessionType) {
- ProtocolFrameHeader header = ProtocolFrameHeaderFactory.createStartSession(sessionType, 0x00, _version, (byte) 0x00, false);
- sendFrameToTransport(header);
+ SdlPacket header = SdlPacketFactory.createStartSession(sessionType, 0x00, _version, (byte) 0x00, false);
+ handlePacketToSend(header);
} // end-method
private void sendStartProtocolSessionACK(SessionType sessionType, byte sessionID) {
- ProtocolFrameHeader header = ProtocolFrameHeaderFactory.createStartSessionACK(sessionType, sessionID, 0x00, _version);
- sendFrameToTransport(header);
+ SdlPacket header = SdlPacketFactory.createStartSessionACK(sessionType, sessionID, 0x00, _version);
+ handlePacketToSend(header);
} // end-method
- public void EndProtocolSession(SessionType sessionType, byte sessionID) {
- ProtocolFrameHeader header = ProtocolFrameHeaderFactory.createEndSession(sessionType, sessionID, hashID, _version);
- //byte[] data = new byte[4];
- //data = BitConverter.intToByteArray(hashID);
- //handleProtocolFrameToSend(header, data, 0, data.length);
- sendFrameToTransport(header);
+ public void EndProtocolSession(SessionType sessionType, byte sessionID, int hashId) {
+ SdlPacket header = SdlPacketFactory.createEndSession(sessionType, sessionID, hashID, _version, BitConverter.intToByteArray(hashId));
+ handlePacketToSend(header);
+
} // end-method
public void SendMessage(ProtocolMessage protocolMsg) {
protocolMsg.setRPCType((byte) 0x00); //always sending a request
- SessionType serviceType = protocolMsg.getSessionType();
+ SessionType sessionType = protocolMsg.getSessionType();
byte sessionID = protocolMsg.getSessionID();
byte[] data = null;
-
- if (_version > 1 && serviceType != SessionType.NAV && serviceType != SessionType.PCM) {
- if (serviceType.eq(SessionType.CONTROL)) {
+ if (_version > 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];
final BinaryFrameHeader binFrameHeader =
- ProtocolFrameHeaderFactory.createBinaryFrameHeader(protocolMsg.getRPCType(),protocolMsg.getFunctionID(), protocolMsg.getCorrID(), 0);
+ SdlPacketFactory.createBinaryFrameHeader(protocolMsg.getRPCType(),protocolMsg.getFunctionID(), protocolMsg.getCorrID(), 0);
System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, HEADER_SIZE);
System.arraycopy(secureData, 0, data,HEADER_SIZE, secureData.length);
}
else if (protocolMsg.getBulkData() != null) {
- data = new byte[12 + protocolMsg.getJsonSize() + protocolMsg.getBulkData().length];
- serviceType = SessionType.BULK_DATA;
- }
- else{
- data = new byte[12 + protocolMsg.getJsonSize()];
- }
- if (!serviceType.eq(SessionType.CONTROL)) {
- BinaryFrameHeader binFrameHeader = new BinaryFrameHeader();
- binFrameHeader = ProtocolFrameHeaderFactory.createBinaryFrameHeader(protocolMsg.getRPCType(), protocolMsg.getFunctionID(), protocolMsg.getCorrID(), protocolMsg.getJsonSize());
- System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, 12);
- System.arraycopy(protocolMsg.getData(), 0, data, 12, protocolMsg.getJsonSize());
- if (protocolMsg.getBulkData() != null) {
- System.arraycopy(protocolMsg.getBulkData(), 0, data, 12 + protocolMsg.getJsonSize(), protocolMsg.getBulkData().length);
- }
+ data = new byte[12 + protocolMsg.getJsonSize() + protocolMsg.getBulkData().length];
+ sessionType = SessionType.BULK_DATA;
+ } else {
+ data = new byte[12 + protocolMsg.getJsonSize()];
+ }
+ if (!sessionType.eq(SessionType.CONTROL)) {
+ BinaryFrameHeader binFrameHeader = new BinaryFrameHeader();
+ binFrameHeader = SdlPacketFactory.createBinaryFrameHeader(protocolMsg.getRPCType(), protocolMsg.getFunctionID(), protocolMsg.getCorrID(), protocolMsg.getJsonSize());
+ System.arraycopy(binFrameHeader.assembleHeaderBytes(), 0, data, 0, 12);
+ System.arraycopy(protocolMsg.getData(), 0, data, 12, protocolMsg.getJsonSize());
+ if (protocolMsg.getBulkData() != null) {
+ System.arraycopy(protocolMsg.getBulkData(), 0, data, 12 + protocolMsg.getJsonSize(), protocolMsg.getBulkData().length);
+ }
}
} else {
data = protocolMsg.getData();
@@ -179,7 +165,6 @@ public class WiProProtocol extends AbstractProtocol {
if (data.length > MAX_DATA_SIZE) {
messageID++;
- ProtocolFrameHeader firstHeader = ProtocolFrameHeaderFactory.createMultiSendDataFirst(serviceType, sessionID, messageID, _version, protocolMsg.getPayloadProtected());
// Assemble first frame.
int frameCount = data.length / MAX_DATA_SIZE;
@@ -192,187 +177,72 @@ public class WiProProtocol extends AbstractProtocol {
System.arraycopy(BitConverter.intToByteArray(data.length), 0, firstFrameData, 0, 4);
// Second four bytes are frame count.
System.arraycopy(BitConverter.intToByteArray(frameCount), 0, firstFrameData, 4, 4);
-
- handleProtocolFrameToSend(firstHeader, firstFrameData, 0, firstFrameData.length);
+
+ SdlPacket firstHeader = SdlPacketFactory.createMultiSendDataFirst(sessionType, sessionID, messageID, _version,firstFrameData,protocolMsg.getPayloadProtected());
+ firstHeader.setPriorityCoefficient(1+protocolMsg.priorityCoefficient);
+ //Send the first frame
+ handlePacketToSend(firstHeader);
int currentOffset = 0;
byte frameSequenceNumber = 0;
-
+
for (int i = 0; i < frameCount; i++) {
if (i < (frameCount - 1)) {
++frameSequenceNumber;
if (frameSequenceNumber ==
- ProtocolFrameHeader.FrameDataFinalConsecutiveFrame) {
+ SdlPacket.FRAME_INFO_FINAL_CONNESCUTIVE_FRAME) {
// we can't use 0x00 as frameSequenceNumber, because
// it's reserved for the last frame
++frameSequenceNumber;
}
} else {
- frameSequenceNumber = ProtocolFrameHeader.FrameDataFinalConsecutiveFrame;
+ frameSequenceNumber = SdlPacket.FRAME_INFO_FINAL_CONNESCUTIVE_FRAME;
} // end-if
int bytesToWrite = data.length - currentOffset;
if (bytesToWrite > MAX_DATA_SIZE) {
bytesToWrite = MAX_DATA_SIZE;
}
-
- ProtocolFrameHeader consecHeader = ProtocolFrameHeaderFactory.createMultiSendDataRest(serviceType, sessionID, bytesToWrite, frameSequenceNumber , messageID, _version, protocolMsg.getPayloadProtected());
- handleProtocolFrameToSend(consecHeader, data, currentOffset, bytesToWrite);
+ SdlPacket consecHeader = SdlPacketFactory.createMultiSendDataRest(sessionType, sessionID, bytesToWrite, frameSequenceNumber , messageID, _version,data, currentOffset, bytesToWrite, protocolMsg.getPayloadProtected());
+ consecHeader.setPriorityCoefficient(i+2+protocolMsg.priorityCoefficient);
+ handlePacketToSend(consecHeader);
currentOffset += bytesToWrite;
}
} else {
messageID++;
- ProtocolFrameHeader header = ProtocolFrameHeaderFactory.createSingleSendData(serviceType, sessionID, data.length, messageID, _version, protocolMsg.getPayloadProtected());
- handleProtocolFrameToSend(header, data, 0, data.length);
+ SdlPacket header = SdlPacketFactory.createSingleSendData(sessionType, sessionID, data.length, messageID, _version,data, protocolMsg.getPayloadProtected());
+ header.setPriorityCoefficient(protocolMsg.priorityCoefficient);
+ handlePacketToSend(header);
}
}
}
-
- private void sendFrameToTransport(ProtocolFrameHeader header) {
- handleProtocolFrameToSend(header, null, 0, 0);
- }
-
- public void HandleReceivedBytes(byte[] receivedBytes, int receivedBytesLength) {
- byte[] remainingBytes = processReceivedBytes(receivedBytes, receivedBytesLength);
- while (remainingBytes != null)
- {
- remainingBytes = processReceivedBytes(remainingBytes, remainingBytes.length);
- }
- }
-
- private byte[] processReceivedBytes(byte[] receivedBytes, int receivedBytesLength) {
- int receivedBytesReadPos = 0;
-
+ public void handlePacketReceived(SdlPacket packet){
//Check for a version difference
if (_version == 1) {
- //Nothing has been read into the buffer and version is 2
- if (_headerBufWritePos == 0 && (byte) (receivedBytes[0] >>> 4) > 1) {
- setVersion((byte) (receivedBytes[0] >>> 4));
- //Buffer has something in it and version is 2
- } else if ((byte) (_headerBuf[0] >>> 4) > 1) {
- //safe current state of the buffer and also set the new version
- byte[] tempHeader = new byte[_headerBufWritePos];
- tempHeader = _headerBuf;
- setVersion((byte) (_headerBuf[0] >>> 4));
- _headerBuf = tempHeader;
- } else if ( (_version == 1) && ( HEADER_SIZE == 12) ){
- setVersion((byte) (1));
- }
-
- }
-
- // If I don't yet know the message size, grab those bytes.
- if (!_haveHeader) {
- // If I can't get the size, just get the bytes that are there.
- int headerBytesNeeded = _headerBuf.length - _headerBufWritePos;
- if (receivedBytesLength < headerBytesNeeded) {
- System.arraycopy(receivedBytes, receivedBytesReadPos,
- _headerBuf, _headerBufWritePos, receivedBytesLength);
- _headerBufWritePos += receivedBytesLength;
- return null;
- } else {
- // If I got the size, allocate the buffer
- System.arraycopy(receivedBytes, receivedBytesReadPos,
- _headerBuf, _headerBufWritePos, headerBytesNeeded);
- _headerBufWritePos += headerBytesNeeded;
- receivedBytesReadPos += headerBytesNeeded;
- _haveHeader = true;
- _currentHeader = ProtocolFrameHeader.parseWiProHeader(_headerBuf);
-
-
- int iDataSize = _currentHeader.getDataSize();
- if (iDataSize <= MAX_DATA_SIZE) {
- _dataBuf = new byte[iDataSize];
- }
- else {
- //something is wrong with the header
- Log.e("HandleReceivedBytes", "Corrupt header found, request to allocate a byte array of size: " + iDataSize);
- Log.e("HandleReceivedBytes", "_headerBuf: " + _headerBuf.toString());
- Log.e("HandleReceivedBytes", "_currentHeader: " + _currentHeader.toString());
- Log.e("HandleReceivedBytes", "receivedBytes: " + receivedBytes.toString());
- Log.e("HandleReceivedBytes", "receivedBytesReadPos: " + receivedBytesReadPos);
- Log.e("HandleReceivedBytes", "_headerBufWritePos: " + _headerBufWritePos);
- Log.e("HandleReceivedBytes", "headerBytesNeeded: " + headerBytesNeeded);
- handleProtocolError("Error handling protocol message from sdl, header invalid.",
- new SdlException("Error handling protocol message from sdl, header invalid.", SdlExceptionCause.INVALID_HEADER));
- return null;
- }
- _dataBufWritePos = 0;
- }
+ setVersion((byte)packet.version);
}
+
+ MessageFrameAssembler assembler = getFrameAssemblerForFrame(packet);
+ assembler.handleFrame(packet);
- if (_dataBuf == null)
- {
- Log.e("HandleReceivedBytes", "Error: Databuffer is null, logging debug info.");
- try
- {
- Log.e("HandleReceivedBytes", "_headerBuf: " + _headerBuf.toString());
- Log.e("HandleReceivedBytes", "_currentHeader: " + _currentHeader.toString());
- Log.e("HandleReceivedBytes", "receivedBytes: " + receivedBytes.toString());
- Log.e("HandleReceivedBytes", "receivedBytesReadPos: " + receivedBytesReadPos);
- Log.e("HandleReceivedBytes", "receivedBytesLength: " + receivedBytesLength);
- Log.e("HandleReceivedBytes", "_headerBufWritePos: " + _headerBufWritePos);
- }
- catch(NullPointerException e)
- {
- Log.e("HandleReceivedBytes", "Null Pointer Encountered: " + e);
- }
-
- handleProtocolError("Error handling protocol message from sdl, header invalid.",
- new SdlException("Error handling protocol message from sdl, data buffer is null.", SdlExceptionCause.DATA_BUFFER_NULL));
- return null;
- }
-
- onResetIncomingHeartbeat(_currentHeader.getSessionType(), _currentHeader.getSessionID());
-
- int bytesLeft = receivedBytesLength - receivedBytesReadPos;
- int bytesNeeded = _dataBuf.length - _dataBufWritePos;
- // If I don't have enough bytes for the message, just grab what's there.
- if (bytesLeft < bytesNeeded) {
- System.arraycopy(receivedBytes, receivedBytesReadPos, _dataBuf,
- _dataBufWritePos, bytesLeft);
- _dataBufWritePos += bytesLeft;
- return null;
- } else {
- // Fill the buffer and call the handler!
- System.arraycopy(receivedBytes, receivedBytesReadPos, _dataBuf, _dataBufWritePos, bytesNeeded);
- receivedBytesReadPos += bytesNeeded;
-
- MessageFrameAssembler assembler = getFrameAssemblerForFrame(_currentHeader);
- handleProtocolFrameReceived(_currentHeader, _dataBuf, assembler);
+ onResetIncomingHeartbeat(SessionType.valueOf((byte)packet.getServiceType()), (byte)packet.getSessionId());
- // Reset all class member variables for next frame
- _dataBuf = null;
- _dataBufWritePos = 0;
- _haveHeader = false;
- _headerBuf = new byte[HEADER_SIZE];
- _currentHeader = null;
- _headerBufWritePos = 0;
-
- // If there are any bytes left, recurse.
- int moreBytesLeft = receivedBytesLength - receivedBytesReadPos;
- if (moreBytesLeft > 0) {
- byte[] moreBytes = new byte[moreBytesLeft];
- System.arraycopy(receivedBytes, receivedBytesReadPos,
- moreBytes, 0, moreBytesLeft);
- return moreBytes;
- }
- }
- return null;
}
+
+
- protected MessageFrameAssembler getFrameAssemblerForFrame(ProtocolFrameHeader header) {
- Hashtable<Integer, MessageFrameAssembler> hashSessionID = _assemblerForSessionID.get(Byte.valueOf(header.getSessionID()));
+ protected MessageFrameAssembler getFrameAssemblerForFrame(SdlPacket packet) {
+ Hashtable<Integer, MessageFrameAssembler> hashSessionID = _assemblerForSessionID.get(packet.getSessionId());
if (hashSessionID == null) {
hashSessionID = new Hashtable<Integer, MessageFrameAssembler>();
- _assemblerForSessionID.put(Byte.valueOf(header.getSessionID()), hashSessionID);
+ _assemblerForSessionID.put((byte)packet.getSessionId(), hashSessionID);
} // end-if
- MessageFrameAssembler ret = (MessageFrameAssembler) _assemblerForMessageID.get(Integer.valueOf(header.getMessageID()));
+ MessageFrameAssembler ret = (MessageFrameAssembler) _assemblerForMessageID.get(Integer.valueOf(packet.getMessageId()));
if (ret == null) {
ret = new MessageFrameAssembler();
- _assemblerForMessageID.put(Integer.valueOf(header.getMessageID()), ret);
+ _assemblerForMessageID.put(Integer.valueOf(packet.getMessageId()), ret);
} // end-if
return ret;
@@ -380,36 +250,31 @@ public class WiProProtocol extends AbstractProtocol {
protected class MessageFrameAssembler {
protected boolean hasFirstFrame = false;
- protected boolean hasSecondFrame = false;
protected ByteArrayOutputStream accumulator = null;
protected int totalSize = 0;
protected int framesRemaining = 0;
- protected void handleFirstDataFrame(ProtocolFrameHeader header, byte[] data) {
+ protected void handleFirstDataFrame(SdlPacket packet) {
//The message is new, so let's figure out how big it is.
hasFirstFrame = true;
- totalSize = BitConverter.intFromByteArray(data, 0) - HEADER_SIZE;
- framesRemaining = BitConverter.intFromByteArray(data, 4);
+ totalSize = BitConverter.intFromByteArray(packet.payload, 0) - HEADER_SIZE;
+ framesRemaining = BitConverter.intFromByteArray(packet.payload, 4);
accumulator = new ByteArrayOutputStream(totalSize);
}
- protected void handleSecondFrame(ProtocolFrameHeader header, byte[] data) {
- handleRemainingFrame(header, data);
- }
-
- protected void handleRemainingFrame(ProtocolFrameHeader header, byte[] data) {
- accumulator.write(data, 0, header.getDataSize());
- notifyIfFinished(header);
+ protected void handleRemainingFrame(SdlPacket packet) {
+ accumulator.write(packet.payload, 0, (int)packet.getDataSize());
+ notifyIfFinished(packet);
}
- protected void notifyIfFinished(ProtocolFrameHeader header) {
-
- if (header.getFrameType() == FrameType.Consecutive && header.getFrameData() == 0x0)
+ protected void notifyIfFinished(SdlPacket packet) {
+ //if (framesRemaining == 0) {
+ if (packet.getFrameType() == FrameType.Consecutive && packet.getFrameInfo() == 0x0)
{
ProtocolMessage message = new ProtocolMessage();
- message.setPayloadProtected(header.isEncrypted());
- message.setSessionType(header.getSessionType());
- message.setSessionID(header.getSessionID());
+ message.setPayloadProtected(packet.isEncrypted());
+ 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) {
BinaryFrameHeader binFrameHeader = BinaryFrameHeader.
@@ -420,9 +285,11 @@ public class WiProProtocol extends AbstractProtocol {
message.setCorrID(binFrameHeader.getCorrID());
if (binFrameHeader.getJsonSize() > 0) message.setData(binFrameHeader.getJsonData());
if (binFrameHeader.getBulkData() != null) message.setBulkData(binFrameHeader.getBulkData());
- } else message.setData(accumulator.toByteArray());
+ } else{
+ message.setData(accumulator.toByteArray());
+ }
- _assemblerForMessageID.remove(header.getMessageID());
+ _assemblerForMessageID.remove(packet.getMessageId());
try {
handleProtocolMessageReceived(message);
@@ -431,151 +298,147 @@ public class WiProProtocol extends AbstractProtocol {
} // end-catch
hasFirstFrame = false;
- hasSecondFrame = false;
accumulator = null;
} // end-if
} // end-method
- protected void handleMultiFrameMessageFrame(ProtocolFrameHeader header, byte[] data) {
- //if (!hasFirstFrame) {
- // hasFirstFrame = true;
- if (header.getFrameType() == FrameType.First)
- {
- handleFirstDataFrame(header, data);
+ protected void handleMultiFrameMessageFrame(SdlPacket packet) {
+ if (packet.getFrameType() == FrameType.First){
+ handleFirstDataFrame(packet);
}
-
- //} else if (!hasSecondFrame) {
- // hasSecondFrame = true;
- // framesRemaining--;
- // handleSecondFrame(header, data);
- //} else {
- // framesRemaining--;
- else
- {
- handleRemainingFrame(header, data);
+ else{
+ handleRemainingFrame(packet);
}
- //}
} // end-method
- protected void handleFrame(ProtocolFrameHeader header, byte[] data) {
-
- if (data != null && data.length > 0 && header.isEncrypted() )
+ protected void handleFrame(SdlPacket packet) {
+
+ if (packet != null && packet.payload.length > 0 && packet.isEncrypted() )
{
if (sdlconn != null)
{
- SdlSession session = sdlconn.findSessionById(header.getSessionID());
-
+ SdlSession session = sdlconn.findSessionById((byte)packet.getSessionId());
+
if (session == null)
return;
-
+
SdlSecurityBase sdlSec = session.getSdlSecurity();
byte[] dataToRead = new byte[4096];
-
- int iNumBytes = sdlSec.decryptData(data, dataToRead);
-
+
+ int iNumBytes = sdlSec.decryptData(packet.payload, dataToRead);
+
byte[] decryptedData = new byte[iNumBytes];
System.arraycopy(dataToRead, 0, decryptedData, 0, iNumBytes);
- data = decryptedData;
+ packet.payload = decryptedData;
}
}
-
- if (header.getFrameType().equals(FrameType.Control)) {
- handleControlFrame(header, data);
+
+ if (packet.getFrameType().equals(FrameType.Control)) {
+ handleControlFrame(packet);
} else {
// Must be a form of data frame (single, first, consecutive, etc.)
- if ( header.getFrameType() == FrameType.First
- || header.getFrameType() == FrameType.Consecutive
+ if ( packet.getFrameType() == FrameType.First
+ || packet.getFrameType() == FrameType.Consecutive
) {
- handleMultiFrameMessageFrame(header, data);
+ handleMultiFrameMessageFrame(packet);
} else {
- handleSingleFrameMessageFrame(header, data);
+ handleSingleFrameMessageFrame(packet);
}
} // end-if
} // end-method
- private void handleProtocolHeartbeat(ProtocolFrameHeader header,
- byte[] data) {
- WiProProtocol.this.handleProtocolHeartbeat(header.getSessionType(),header.getSessionID());
+ private void handleProtocolHeartbeatACK(SdlPacket packet) {
+ WiProProtocol.this.handleProtocolHeartbeatACK(SessionType.valueOf((byte)packet.getServiceType()),(byte)packet.getSessionId());
} // end-method
-
- private void handleProtocolHeartbeatACK(ProtocolFrameHeader header,
- byte[] data) {
- WiProProtocol.this.handleProtocolHeartbeatACK(header.getSessionType(),header.getSessionID());
+ private void handleProtocolHeartbeat(SdlPacket packet) {
+ WiProProtocol.this.handleProtocolHeartbeat(SessionType.valueOf((byte)packet.getServiceType()),(byte)packet.getSessionId());
} // end-method
-
- private void handleControlFrame(ProtocolFrameHeader header, byte[] data) {
- if (header.getFrameData() == FrameDataControlFrameType.Heartbeat.getValue()) {
- handleProtocolHeartbeat(header, data);
- } else if (header.getFrameData() == FrameDataControlFrameType.HeartbeatACK.getValue()) {
- handleProtocolHeartbeatACK(header, data);
- } else if (header.getFrameData() == FrameDataControlFrameType.StartSession.getValue()) {
- sendStartProtocolSessionACK(header.getSessionType(), header.getSessionID());
- } else if (header.getFrameData() == FrameDataControlFrameType.StartSessionACK.getValue()) {
+
+ private void handleControlFrame(SdlPacket packet) {
+ int frameInfo = packet.getFrameInfo();
+ SessionType serviceType = SessionType.valueOf((byte)packet.getServiceType());
+
+ if (frameInfo == FrameDataControlFrameType.Heartbeat.getValue()) {
+ handleProtocolHeartbeat(packet);
+ }
+ if (frameInfo == FrameDataControlFrameType.HeartbeatACK.getValue()) {
+ handleProtocolHeartbeatACK(packet);
+ }
+ else if (frameInfo == FrameDataControlFrameType.StartSession.getValue()) {
+ sendStartProtocolSessionACK(serviceType, (byte)packet.getSessionId());
+ } else if (frameInfo == FrameDataControlFrameType.StartSessionACK.getValue()) {
// Use this sessionID to create a message lock
- Object messageLock = _messageLocks.get(header.getSessionID());
+ Object messageLock = _messageLocks.get(packet.getSessionId());
if (messageLock == null) {
messageLock = new Object();
- _messageLocks.put(header.getSessionID(), messageLock);
+ _messageLocks.put((byte)packet.getSessionId(), messageLock);
}
- //hashID = BitConverter.intFromByteArray(data, 0);
- if (_version > 1) hashID = header.getMessageID();
- handleProtocolSessionStarted(header.getSessionType(), header.getSessionID(), _version, "", header.isEncrypted());
- } else if (header.getFrameData() == FrameDataControlFrameType.StartSessionNACK.getValue()) {
- if (header.getSessionType().eq(SessionType.NAV) || header.getSessionType().eq(SessionType.PCM)) {
- handleProtocolSessionNACKed(header.getSessionType(), header.getSessionID(), _version, "");
+ 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);
+ }
+ }
+ handleProtocolSessionStarted(serviceType,(byte) packet.getSessionId(), _version, "", hashID, packet.isEncrypted());
+ } else if (frameInfo == FrameDataControlFrameType.StartSessionNACK.getValue()) {
+ if (serviceType.eq(SessionType.NAV) || serviceType.eq(SessionType.PCM)) {
+ handleProtocolSessionNACKed(serviceType, (byte)packet.getSessionId(), _version, "");
} else {
- handleProtocolError("Got StartSessionNACK for protocol sessionID=" + header.getSessionID(), null);
+ handleProtocolError("Got StartSessionNACK for protocol sessionID=" + packet.getSessionId(), null);
}
- } else if (header.getFrameData() == FrameDataControlFrameType.EndSession.getValue()) {
- //if (hashID == BitConverter.intFromByteArray(data, 0))
+ } else if (frameInfo == FrameDataControlFrameType.EndSession.getValue()) {
if (_version > 1) {
- if (hashID == header.getMessageID())
- handleProtocolSessionEnded(header.getSessionType(), header.getSessionID(), "");
- } else handleProtocolSessionEnded(header.getSessionType(), header.getSessionID(), "");
- } else if (header.getFrameData() == FrameDataControlFrameType.EndSessionACK.getValue()) {
- handleProtocolSessionEnded(header.getSessionType(), header.getSessionID(), "");
- } else if (header.getFrameData() == FrameDataControlFrameType.EndSessionNACK.getValue()) {
- handleProtocolSessionEndedNACK(header.getSessionType(), header.getSessionID(), "");
- } else if (header.getFrameData() == FrameDataControlFrameType.ServiceDataACK.getValue()) {
- if (data != null && data.length == 4) //service data ack will be 4 bytes in length
+ if (hashID == packet.getMessageId())
+ handleProtocolSessionEnded(serviceType, (byte)packet.getSessionId(), "");
+ } else {
+ handleProtocolSessionEnded(serviceType, (byte)packet.getSessionId(), "");
+ }
+ } else if (frameInfo == FrameDataControlFrameType.EndSessionACK.getValue()) {
+ handleProtocolSessionEnded(serviceType, (byte)packet.getSessionId(), "");
+ } else if (frameInfo == FrameDataControlFrameType.EndSessionNACK.getValue()) {
+ handleProtocolSessionEndedNACK(serviceType, (byte)packet.getSessionId(), "");
+ } else if (frameInfo == FrameDataControlFrameType.ServiceDataACK.getValue()) {
+ if (packet.payload != null && packet.payload.length == 4) //service data ack will be 4 bytes in length
{
- int serviceDataAckSize = BitConverter.intFromByteArray(data, 0);
- handleProtocolServiceDataACK(header.getSessionType(), serviceDataAckSize, header.getSessionID());
+ int serviceDataAckSize = BitConverter.intFromByteArray(packet.payload, 0);
+ handleProtocolServiceDataACK(serviceType, serviceDataAckSize,(byte)packet.getSessionId ());
}
}
} // end-method
- private void handleSingleFrameMessageFrame(ProtocolFrameHeader header, byte[] data) {
-
+ private void handleSingleFrameMessageFrame(SdlPacket packet) {
ProtocolMessage message = new ProtocolMessage();
- message.setPayloadProtected(header.isEncrypted());
- if (header.getSessionType() == SessionType.RPC) {
- message.setMessageType(MessageType.RPC);
- } else if (header.getSessionType() == SessionType.BULK_DATA) {
+ message.setPayloadProtected(packet.isEncrypted());
+ SessionType serviceType = SessionType.valueOf((byte)packet.getServiceType());
+ if (serviceType == SessionType.RPC) {
+ message.setMessageType(MessageType.RPC);
+ } else if (serviceType == SessionType.BULK_DATA) {
message.setMessageType(MessageType.BULK);
} // end-if
- message.setSessionType(header.getSessionType());
- message.setSessionID(header.getSessionID());
-
- boolean isControlService = message.getSessionType().equals(SessionType.CONTROL);
-
+ message.setSessionType(serviceType);
+ 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) {
BinaryFrameHeader binFrameHeader = BinaryFrameHeader.
- parseBinaryHeader(data);
+ parseBinaryHeader(packet.payload);
message.setVersion(_version);
message.setRPCType(binFrameHeader.getRPCType());
message.setFunctionID(binFrameHeader.getFunctionID());
message.setCorrID(binFrameHeader.getCorrID());
- if (binFrameHeader.getJsonSize() > 0) message.setData(binFrameHeader.getJsonData());
- if (binFrameHeader.getBulkData() != null) message.setBulkData(binFrameHeader.getBulkData());
- }
- else
- message.setData(data);
+ if (binFrameHeader.getJsonSize() > 0){
+ message.setData(binFrameHeader.getJsonData());
+ }
+ if (binFrameHeader.getBulkData() != null){
+ message.setBulkData(binFrameHeader.getBulkData());
+ }
+ } else {
+ message.setData(packet.payload);
+ }
- _assemblerForMessageID.remove(header.getMessageID());
+ _assemblerForMessageID.remove(packet.getMessageId());
try {
handleProtocolMessageReceived(message);
@@ -588,8 +451,8 @@ public class WiProProtocol extends AbstractProtocol {
@Override
public void StartProtocolService(SessionType sessionType, byte sessionID, boolean isEncrypted) {
- ProtocolFrameHeader header = ProtocolFrameHeaderFactory.createStartSession(sessionType, 0x00, _version, sessionID, isEncrypted);
- sendFrameToTransport(header);
+ SdlPacket header = SdlPacketFactory.createStartSession(sessionType, 0x00, _version, sessionID, isEncrypted);
+ handlePacketToSend(header);
}
@@ -607,19 +470,21 @@ public class WiProProtocol extends AbstractProtocol {
@Override
public void SendHeartBeat(byte sessionID) {
- final ProtocolFrameHeader heartbeat = ProtocolFrameHeaderFactory.createHeartbeat(SessionType.CONTROL, sessionID, _version);
- sendFrameToTransport(heartbeat);
+ final SdlPacket heartbeat = SdlPacketFactory.createHeartbeat(SessionType.CONTROL, sessionID, _version);
+ handlePacketToSend(heartbeat);
}
@Override
public void SendHeartBeatACK(byte sessionID) {
- final ProtocolFrameHeader heartbeat = ProtocolFrameHeaderFactory.createHeartbeatACK(SessionType.CONTROL, sessionID, _version);
- sendFrameToTransport(heartbeat);
+ final SdlPacket heartbeat = SdlPacketFactory.createHeartbeatACK(SessionType.CONTROL, sessionID, _version);
+ handlePacketToSend(heartbeat);
}
-
+
@Override
public void EndProtocolService(SessionType serviceType, byte sessionID) {
- ProtocolFrameHeader header = ProtocolFrameHeaderFactory.createEndSession(serviceType, sessionID, hashID, _version);
- sendFrameToTransport(header);
+ SdlPacket header = SdlPacketFactory.createEndSession(serviceType, sessionID, hashID, _version, new byte[4]);
+ handlePacketToSend(header);
+
}
+
} // end-class
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCResponse.java
index 4527602a3..0a4dc2a70 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCResponse.java
@@ -22,18 +22,18 @@ import com.smartdevicelink.proxy.rpc.enums.Result;
* </li> <li>ResultCode:
* <ul>
*
- * The result code provides additional information about a response returning a
- * failed outcome.
- * <br>
+ * <p>The result code provides additional information about a response returning a
+ * failed outcome.</p>
*
- * Any response can have at least one, or possibly more, of the following result
+ *
+ * <p>Any response can have at least one, or possibly more, of the following result
* code values: SUCCESS, INVALID_DATA, OUT_OF_MEMORY, TOO_MANY_PENDING_REQUESTS,
- * APPLICATION_NOT_REGISTERED, GENERIC_ERROR,REJECTED.
- * <br>
+ * APPLICATION_NOT_REGISTERED, GENERIC_ERROR,REJECTED.</p>
+ *
+ *
+ * <p>Any additional result codes for a given operation can be found in related
+ * RPCs</p>
*
- * Any additional result codes for a given operation can be found in related
- * RPCs
- * <br>
* </ul>
* </li> <li>Info:
* <ul>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxy.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxy.java
deleted file mode 100644
index 605fb245b..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxy.java
+++ /dev/null
@@ -1,404 +0,0 @@
-package com.smartdevicelink.proxy;
-
-import java.util.Vector;
-
-import com.smartdevicelink.exception.SdlException;
-import com.smartdevicelink.exception.SdlExceptionCause;
-import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
-import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.trace.SdlTrace;
-import com.smartdevicelink.transport.BTTransportConfig;
-import com.smartdevicelink.transport.BaseTransportConfig;
-
-@Deprecated
-public class SdlProxy extends SdlProxyBase<IProxyListener> {
-
- 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}";
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxy(IProxyListener listener) throws SdlException {
- super( listener,
- /*application context*/null,
- /*enable advanced lifecycle management*/false,
- /*app name*/ null,
- /*TTS Name*/null,
- /*ngn media screen app name*/null,
- /*vr synonyms*/null,
- /*is media app*/ null,
- /*sdlMsgVersion*/null,
- /*language desired*/null,
- /*HMI Display Language Desired*/null,
- /*App Type*/null,
- /*App ID*/null,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ true,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxy instance passing in: IProxyListener.", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param sAppName
- * @param sAppID
- * @throws SdlException
- */
- @Deprecated
- public SdlProxy(IProxyListener listener, String sAppName, String sAppID) throws SdlException {
- super( listener,
- /*application context*/null,
- /*enable advanced lifecycle management*/false,
- /*app name*/ sAppName,
- /*TTS Name*/null,
- /*ngn media screen app name*/null,
- /*vr synonyms*/null,
- /*is media app*/ null,
- /*sdlMsgVersion*/null,
- /*language desired*/null,
- /*HMI Display Language Desired*/null,
- /*App Type*/null,
- /*App ID*/sAppID,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ true,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxy instance passing in: IProxyListener.", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources
- * @throws SdlException
- */
- @Deprecated
- public SdlProxy(IProxyListener listener, SdlProxyConfigurationResources sdlProxyConfigurationResources)
- throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/false,
- /*app name*/ null,
- /*TTS Name*/null,
- /*ngn media screen app name*/null,
- /*vr synonyms*/null,
- /*is media app*/ null,
- /*sdlMsgVersion*/null,
- /*language desired*/null,
- /*HMI Display Language Desired*/null,
- /*App Type*/null,
- /*App ID*/null,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ true,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxy instance passing in: IProxyListener, SdlProxyConfigurationResources.", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxy(IProxyListener listener, boolean callbackToUIThread) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/false,
- /*app name*/ null,
- /*TTS Name*/null,
- /*ngn media screen app name*/null,
- /*vr synonyms*/null,
- /*is media app*/ null,
- /*sdlMsgVersion*/null,
- /*language desired*/null,
- /*HMI Display Language Desired*/null,
- /*App Type*/null,
- /*App ID*/null,
- /*autoActivateID*/null,
- callbackToUIThread,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxy instance passing in: IProxyListener, callBackToUIThread.", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources
- * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxy(IProxyListener listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- boolean callbackToUIThread) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/false,
- /*app name*/ null,
- /*TTS Name*/null,
- /*ngn media screen app name*/null,
- /*vr synonyms*/null,
- /*is media app*/ null,
- /*sdlMsgVersion*/null,
- /*language desired*/null,
- /*HMI Display Language Desired*/null,
- /*App Type*/null,
- /*App ID*/null,
- /*autoActivateID*/null,
- callbackToUIThread,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxy instance passing in: IProxyListener, callBackToUIThread.", SDL_LIB_TRACE_KEY);
- }
-
- /********************************************** TRANSPORT SWITCHING SUPPORT *****************************************/
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxy(IProxyListener listener, BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*application context*/null,
- /*enable advanced lifecycle management*/false,
- /*app name*/ null,
- /*TTS Name*/null,
- /*ngn media screen app name*/null,
- /*vr synonyms*/null,
- /*is media app*/ null,
- /*sdlMsgVersion*/null,
- /*language desired*/null,
- /*HMI Display Language Desired*/null,
- /*App Type*/null,
- /*App ID*/null,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ true,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxy instance passing in: IProxyListener.", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxy(IProxyListener listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- BaseTransportConfig transportConfig)
- throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/false,
- /*app name*/ null,
- /*TTS Name*/null,
- /*ngn media screen app name*/null,
- /*vr synonyms*/null,
- /*is media app*/ null,
- /*sdlMsgVersion*/null,
- /*language desired*/null,
- /*HMI Display Language Desired*/null,
- /*App Type*/null,
- /*App ID*/null,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ true,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxy instance passing in: IProxyListener, SdlProxyConfigurationResources.", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxy(IProxyListener listener, boolean callbackToUIThread, BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/false,
- /*app name*/ null,
- /*TTS Name*/null,
- /*ngn media screen app name*/null,
- /*vr synonyms*/null,
- /*is media app*/ null,
- /*sdlMsgVersion*/null,
- /*language desired*/null,
- /*HMI Display Language Desired*/null,
- /*App Type*/null,
- /*App ID*/null,
- /*autoActivateID*/null,
- callbackToUIThread,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxy instance passing in: IProxyListener, callBackToUIThread.", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources
- * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxy(IProxyListener listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- boolean callbackToUIThread, BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/false,
- /*app name*/ null,
- /*TTS Name*/null,
- /*ngn media screen app name*/null,
- /*vr synonyms*/null,
- /*is media app*/ null,
- /*sdlMsgVersion*/null,
- /*language desired*/null,
- /*HMI Display Language Desired*/null,
- /*App Type*/null,
- /*App ID*/null,
- /*autoActivateID*/null,
- callbackToUIThread,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxy instance passing in: IProxyListener, callBackToUIThread.", SDL_LIB_TRACE_KEY);
- }
-
- /******************** Public Helper Methods *************************/
-
-
- /**
- * Sends a RegisterAppInterface RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param sdlMsgVersion
- * @param appName
- * @param ngnMediaScreenAppName
- * @param vrSynonyms
- * @param isMediaApp
- * @param languageDesired
- * @param autoActivateID
- * @param correlationID
- *
- * @throws SdlException
- */
- @Deprecated
- public void registerAppInterface(
- SdlMsgVersion sdlMsgVersion, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, Integer correlationID)
- throws SdlException {
-
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This SdlProxy object has been disposed, it is no long capable of sending requests.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- registerAppInterfacePrivate(
- sdlMsgVersion,
- appName,
- null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- languageDesired,
- hmiDisplayLanguageDesired,
- null,
- appID,
- autoActivateID,
- correlationID);
- }
-
- /**
- * Sends a RegisterAppInterface RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param appName
- * @param isMediaApp
- * @param autoActivateID
- * @throws SdlException
- */
- @Deprecated
- public void registerAppInterface(
- String appName, Boolean isMediaApp, String appID, String autoActivateID, Integer correlationID)
- throws SdlException {
-
- registerAppInterface(
- /*sdlMsgVersion*/null,
- appName,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- appID,
- autoActivateID,
- correlationID);
- }
-
- /**
- * Sends a RegisterAppInterface RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param appName
- * @throws SdlException
- */
- @Deprecated
- public void registerAppInterface(String appName, String appID, Integer correlationID)
- throws SdlException {
-
- registerAppInterface(appName, false, appID, "", correlationID);
- }
-
- /**
- * Sends an UnregisterAppInterface RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param correlationID
- * @throws SdlException
- */
- @Deprecated
- public void unregisterAppInterface(Integer correlationID)
- throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This SdlProxy object has been disposed, it is no long capable of executing methods.",
- SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- unregisterAppInterfacePrivate(correlationID);
- }
-
- /**
- * Returns is isConnected state of the SDL transport.
- *
- * @return Boolean isConnected
- */
- @Deprecated
- public Boolean getIsConnected() {
- return super.getIsConnected();
- }
-
-}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java
index 093b919ac..2bdbdf82e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java
@@ -4,10 +4,10 @@ import java.util.List;
import java.util.Vector;
import android.app.Service;
+import android.content.Context;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
-import com.smartdevicelink.proxy.Version;
import com.smartdevicelink.proxy.interfaces.IProxyListenerALM;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
@@ -27,16 +27,18 @@ import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
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.BaseTransportConfig;
+import com.smartdevicelink.transport.MultiplexTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
+
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}";
-
/**
+ * @deprecated
* Constructor for the SdlProxy object, the proxy for communicating between the App and SDL
*
* Takes advantage of the advanced lifecycle management.
@@ -44,6 +46,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @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,
@@ -62,11 +65,40 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
/*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 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,
+ 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,
+ 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.
@@ -83,6 +115,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @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,
@@ -107,12 +140,54 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
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.
*
+ * @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 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 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,
+ appName,
+ /*TTS Name*/null,
+ ngnMediaScreenAppName,
+ vrSynonyms,
+ isMediaApp,
+ sdlMsgVersion,
+ languageDesired,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
+ autoActivateID,
+ /*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
@@ -125,6 +200,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @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,
@@ -149,12 +225,54 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
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.
*
+ * @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 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 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,
+ appName,
+ /*TTS Name*/null,
+ ngnMediaScreenAppName,
+ vrSynonyms,
+ isMediaApp,
+ sdlMsgVersion,
+ languageDesired,
+ /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
+ /*App Type*/null,
+ /*App ID*/appID,
+ autoActivateID,
+ /*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
@@ -168,6 +286,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @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,
@@ -193,12 +312,56 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
"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.
*
+ * @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 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 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,
+ appName,
+ /*TTS Name*/null,
+ ngnMediaScreenAppName,
+ vrSynonyms,
+ isMediaApp,
+ sdlMsgVersion,
+ languageDesired,
+ /*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);
+ }
+ /**
+ * @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
@@ -212,6 +375,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @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,
@@ -238,7 +402,53 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
"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.
+ *
+ * @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 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 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,
+ sdlProxyConfigurationResources,
+ /*enable advanced lifecycle management*/true,
+ appName,
+ /*TTS Name*/null,
+ ngnMediaScreenAppName,
+ vrSynonyms,
+ isMediaApp,
+ sdlMsgVersion,
+ languageDesired,
+ /*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,
@@ -266,6 +476,33 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
"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,
+ sdlProxyConfigurationResources,
+ /*enable advanced lifecycle management*/true,
+ appName,
+ /*TTS Name*/null,
+ ngnMediaScreenAppName,
+ vrSynonyms,
+ isMediaApp,
+ sdlMsgVersion,
+ languageDesired,
+ /*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 *****************************************/
/**
@@ -533,6 +770,7 @@ 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.
@@ -547,6 +785,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @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
{
@@ -571,8 +810,49 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
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);
}
+ /**
+ * 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 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 languageDesired Indicates the language desired for the SDL interface.
+ * @param hmiDisplayLanguageDesired Desired language in HMI.
+ * @param appID Identifier of the client 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, String appName, Boolean isMediaApp,Language languageDesired, Language hmiDisplayLanguageDesired,
+ 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));
+
+ 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);
+ }
/**
+ * @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.
@@ -582,7 +862,8 @@ 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
- */
+ */
+ @Deprecated
public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID) throws SdlException {
super( listener,
/*sdlProxyConfigurationResources*/null,
@@ -605,8 +886,44 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
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.
+ *
+ * @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,
+ appName,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
+ isMediaApp,
+ /*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);
+ }
/**
+ * @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.
@@ -617,7 +934,8 @@ 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
- */
+ */
+ @Deprecated
public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources, String appName, Boolean isMediaApp,String appID) throws SdlException {
super( listener,
sdlProxyConfigurationResources,
@@ -641,6 +959,42 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
"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.
+ *
+ * @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 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,
+ sdlProxyConfigurationResources,
+ /*enable advanced lifecycle management*/true,
+ appName,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
+ isMediaApp,
+ /*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,
@@ -664,8 +1018,8 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
"appName, isMediaApp, appID", 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.
@@ -678,6 +1032,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @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,
@@ -701,6 +1056,43 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
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 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.
+ * @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,
+ appName,
+ /*ttsName*/null,
+ /*ngnMediaScreenAppName*/null,
+ /*vrSynonyms*/null,
+ isMediaApp,
+ /*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.
@@ -745,7 +1137,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
autoActivateID,
callbackToUIThread,
preRegister,
- new BTTransportConfig());
+ new MultiplexTransportConfig(appService.getBaseContext(),appID));
this.setAppService(appService);
this.sendTransportBroadcast();
@@ -788,8 +1180,8 @@ 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.
@@ -812,6 +1204,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @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,
@@ -838,6 +1231,56 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
"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.
+ *
+ * @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
+ * 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 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,
+ String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
+ super( listener,
+ sdlProxyConfigurationResources,
+ /*enable advanced lifecycle management*/true,
+ appName,
+ ttsName,
+ ngnMediaScreenAppName,
+ vrSynonyms,
+ isMediaApp,
+ sdlMsgVersion,
+ languageDesired,
+ /*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);
+ }
/**
@@ -891,8 +1334,8 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
"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.
@@ -916,6 +1359,7 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
* @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,
@@ -947,6 +1391,57 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
*
* 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
+ * 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 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,
+ sdlProxyConfigurationResources,
+ /*enable advanced lifecycle management*/true,
+ appName,
+ ttsName,
+ ngnMediaScreenAppName,
+ vrSynonyms,
+ isMediaApp,
+ sdlMsgVersion,
+ languageDesired,
+ /*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.
+ *
* @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.
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java
index 62915610c..2b31ea03c 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -275,7 +275,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (_advancedLifecycleManagementEnabled) {
// Cycle the proxy
- cycleProxy(SdlDisconnectedReason.TRANSPORT_ERROR);
+ if(SdlConnection.isLegacyModeEnabled()){
+ cycleProxy(SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED);
+
+ }else{
+ cycleProxy(SdlDisconnectedReason.TRANSPORT_ERROR);
+ }
} else {
notifyProxyClosed(info, e, SdlDisconnectedReason.TRANSPORT_ERROR);
}
@@ -294,7 +299,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, boolean isEncrypted) {
+ byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
Intent sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionStarted");
@@ -330,6 +335,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
NavServiceStarted();
} else if (sessionType.eq(SessionType.PCM)) {
AudioServiceStarted();
+ } else if (sessionType.eq(SessionType.RPC)){
+ cycleProxy(SdlDisconnectedReason.RPC_SESSION_ENDED);
+ }
+ 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
}
}
@@ -901,17 +914,27 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
String sBodyString = msg.getBody();
JSONObject jsonObjectToSendToServer;
- String valid_json;
-
+ String valid_json = "";
+ int length;
if (sBodyString == null)
- {
- List<String> legacyData = msg.getLegacyData();
- JSONArray jsonArrayOfSdlPPackets = new JSONArray(legacyData);
- jsonObjectToSendToServer = new JSONObject();
- jsonObjectToSendToServer.put("data", jsonArrayOfSdlPPackets);
- bLegacy = true;
- updateBroadcastIntent(sendIntent, "COMMENT6", "\r\nLegacy SystemRequest: true");
- valid_json = jsonObjectToSendToServer.toString().replace("\\", "");
+ {
+ if(RequestType.HTTP.equals(msg.getRequestType())){
+ length = msg.getBulkData().length;
+ Intent sendIntent3 = createBroadcastIntent();
+ updateBroadcastIntent(sendIntent3, "FUNCTION_NAME", "replace");
+ updateBroadcastIntent(sendIntent3, "COMMENT1", "Valid Json length before replace: " + length);
+ sendBroadcastIntent(sendIntent3);
+
+ }else{
+ List<String> legacyData = msg.getLegacyData();
+ JSONArray jsonArrayOfSdlPPackets = new JSONArray(legacyData);
+ jsonObjectToSendToServer = new JSONObject();
+ jsonObjectToSendToServer.put("data", jsonArrayOfSdlPPackets);
+ bLegacy = true;
+ updateBroadcastIntent(sendIntent, "COMMENT6", "\r\nLegacy SystemRequest: true");
+ valid_json = jsonObjectToSendToServer.toString().replace("\\", "");
+ length = valid_json.getBytes("UTF-8").length;
+ }
}
else
{
@@ -919,10 +942,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
updateBroadcastIntent(sendIntent3, "FUNCTION_NAME", "replace");
updateBroadcastIntent(sendIntent3, "COMMENT1", "Valid Json length before replace: " + sBodyString.getBytes("UTF-8").length);
sendBroadcastIntent(sendIntent3);
- valid_json = sBodyString.replace("\\", "");
+ valid_json = sBodyString.replace("\\", "");
+ length = valid_json.getBytes("UTF-8").length;
}
- urlConnection = getURLConnection(myHeader, sURLString, iTimeout, valid_json.getBytes("UTF-8").length);
+ urlConnection = getURLConnection(myHeader, sURLString, iTimeout, length);
if (urlConnection == null)
{
@@ -932,7 +956,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream());
- wr.writeBytes(valid_json);
+ if(RequestType.HTTP.equals(msg.getRequestType())){
+ wr.write(msg.getBulkData());
+ }else{
+ wr.writeBytes(valid_json);
+ }
+
wr.flush();
wr.close();
@@ -958,68 +987,89 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
InputStream is = urlConnection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
- StringBuffer response = new StringBuffer();
+ StringBuilder response = new StringBuilder();
while((line = rd.readLine()) != null)
{
response.append(line);
response.append('\r');
}
rd.close();
-
- Vector<String> cloudDataReceived = new Vector<String>();
-
- // Convert the response to JSON
- JSONObject jsonResponse = new JSONObject(response.toString());
- if (jsonResponse.get("data") instanceof JSONArray)
- {
- JSONArray jsonArray = jsonResponse.getJSONArray("data");
- for (int i=0; i<jsonArray.length(); i++)
- {
- if (jsonArray.get(i) instanceof String)
- {
- cloudDataReceived.add(jsonArray.getString(i));
- //Log.i("sendOnSystemRequestToUrl", "jsonArray.getString(i): " + jsonArray.getString(i));
- }
- }
- }
- else if (jsonResponse.get("data") instanceof String)
- {
- cloudDataReceived.add(jsonResponse.getString("data"));
- //Log.i("sendOnSystemRequestToUrl", "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.");
- return;
- }
-
- String sResponse = cloudDataReceived.toString();
-
- if (sResponse.length() > 512)
- {
- sResponse = sResponse.substring(0, 511);
- }
-
- updateBroadcastIntent(sendIntent, "DATA", "Data from cloud response: " + sResponse);
-
- // Send new SystemRequest to SDL
- SystemRequest mySystemRequest;
-
- if (bLegacy)
- mySystemRequest = RPCRequestFactory.buildSystemRequestLegacy(cloudDataReceived, getPoliciesReservedCorrelationID());
- else
- mySystemRequest = RPCRequestFactory.buildSystemRequest(response.toString(), getPoliciesReservedCorrelationID());
-
- if (getIsConnected())
- {
- sendRPCRequestPrivate(mySystemRequest);
- Log.i("sendOnSystemRequestToUrl", "sent to sdl");
-
- updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
- updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
- updateBroadcastIntent(sendIntent2, "CORRID", mySystemRequest.getCorrelationID());
- }
+ //We've read the body
+ if(RequestType.HTTP.equals(msg.getRequestType())){
+ // Create the SystemRequest RPC to send to module.
+ PutFile putFile = new PutFile();
+ putFile.setFileType(FileType.JSON);
+ putFile.setCorrelationID(POLICIES_CORRELATION_ID);
+ putFile.setSdlFileName("response_data");
+ putFile.setFileData(response.toString().getBytes("UTF-8"));
+ updateBroadcastIntent(sendIntent, "DATA", "Data from cloud response: " + response.toString());
+
+ sendRPCRequestPrivate(putFile);
+ Log.i("sendOnSystemRequestToUrl", "sent to sdl");
+
+ updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.PUT_FILE.toString());
+ updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
+ updateBroadcastIntent(sendIntent2, "CORRID", putFile.getCorrelationID());
+
+ }else{
+ Vector<String> cloudDataReceived = new Vector<String>();
+ final String dataKey = "data";
+ // Convert the response to JSON
+ JSONObject jsonResponse = new JSONObject(response.toString());
+ if(jsonResponse.has(dataKey)){
+ if (jsonResponse.get(dataKey) instanceof JSONArray)
+ {
+ JSONArray jsonArray = jsonResponse.getJSONArray(dataKey);
+ for (int i=0; i<jsonArray.length(); i++)
+ {
+ if (jsonArray.get(i) instanceof String)
+ {
+ cloudDataReceived.add(jsonArray.getString(i));
+ //Log.i("sendOnSystemRequestToUrl", "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"));
+ }
+ }
+ 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.");
+ return;
+ }
+
+ String sResponse = cloudDataReceived.toString();
+
+ if (sResponse.length() > 512)
+ {
+ sResponse = sResponse.substring(0, 511);
+ }
+
+ updateBroadcastIntent(sendIntent, "DATA", "Data from cloud response: " + sResponse);
+
+ // Send new SystemRequest to SDL
+ SystemRequest mySystemRequest;
+
+ if (bLegacy){
+ mySystemRequest = RPCRequestFactory.buildSystemRequestLegacy(cloudDataReceived, getPoliciesReservedCorrelationID());
+ }else{
+ mySystemRequest = RPCRequestFactory.buildSystemRequest(response.toString(), getPoliciesReservedCorrelationID());
+ }
+
+ if (getIsConnected())
+ {
+ sendRPCRequestPrivate(mySystemRequest);
+ Log.i("sendOnSystemRequestToUrl", "sent to sdl");
+
+ updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
+ updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
+ updateBroadcastIntent(sendIntent2, "CORRID", mySystemRequest.getCorrelationID());
+ }
+ }
}
catch (SdlException e)
{
@@ -1140,6 +1190,25 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sendTransportBroadcast();
}
}
+ /**
+ * This method will fake the multiplex connection event
+ * @param action
+ */
+ public void forceOnConnected(){
+ synchronized(CONNECTION_REFERENCE_LOCK) {
+ if (sdlSession != null) {
+ if(sdlSession.getSdlConnection()==null){ //There is an issue when switching from v1 to v2+ where the connection is closed. So we restart the session during this call.
+ try {
+ sdlSession.startSession();
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ }
+ sdlSession.getSdlConnection().forceHardwareConnectEvent(TransportType.BLUETOOTH);
+
+ }
+ }
+ }
public void sendTransportBroadcast()
{
@@ -1327,7 +1396,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_cycling = true;
cleanProxy(disconnectedReason);
initializeProxy();
- notifyProxyClosed("Sdl Proxy Cycled", new SdlException("Sdl Proxy Cycled", SdlExceptionCause.SDL_PROXY_CYCLED), disconnectedReason);
+ if(!SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED.equals(disconnectedReason)){//We don't want to alert higher if we are just cycling for legacy bluetooth
+ notifyProxyClosed("Sdl Proxy Cycled", new SdlException("Sdl Proxy Cycled", SdlExceptionCause.SDL_PROXY_CYCLED), disconnectedReason);
+ }
}
catch (SdlException e) {
Intent sendIntent = createBroadcastIntent();
@@ -1361,7 +1432,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private void dispatchIncomingMessage(ProtocolMessage message) {
try{
// Dispatching logic
- if (message.getSessionType().equals(SessionType.RPC)) {
+ if (message.getSessionType().equals(SessionType.RPC)
+ ||message.getSessionType().equals(SessionType.BULK_DATA) ) {
try {
if (_wiproVersion == 1) {
if (message.getVersion() > 1) setWiProVersion(message.getVersion());
@@ -1583,8 +1655,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
throw new SdlException("CorrelationID cannot be null. RPC: " + request.getFunctionName(), SdlExceptionCause.INVALID_ARGUMENT);
}
pm.setCorrID(request.getCorrelationID());
- if (request.getBulkData() != null)
+ if (request.getBulkData() != null){
pm.setBulkData(request.getBulkData());
+ }
+ if(request.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.name())){
+ pm.setPriorityCoefficient(1);
+ }
// Queue this outgoing message
synchronized(OUTGOING_MESSAGE_QUEUE_THREAD_LOCK) {
@@ -1795,13 +1871,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (_bAppResumeEnabled)
{
- if ( (msg.getResultCode() == Result.RESUME_FAILED) || (msg.getResultCode() != Result.SUCCESS) )
+ if ( (_sdlMsgVersion.getMajorVersion() > 2) && (_lastHashID != null) && (msg.getSuccess()) && (msg.getResultCode() != Result.RESUME_FAILED) )
+ _bResumeSuccess = true;
+ else
{
_bResumeSuccess = false;
_lastHashID = null;
}
- else if ( (_sdlMsgVersion.getMajorVersion() > 2) && (_lastHashID != null) && (msg.getResultCode() == Result.SUCCESS) )
- _bResumeSuccess = true;
}
_diagModes = msg.getSupportedDiagModes();
@@ -1949,15 +2025,15 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (_bAppResumeEnabled)
{
- if ( (msg.getResultCode() == Result.RESUME_FAILED) || (msg.getResultCode() != Result.SUCCESS) )
+ if ( (_sdlMsgVersion.getMajorVersion() > 2) && (_lastHashID != null) && (msg.getSuccess()) && (msg.getResultCode() != Result.RESUME_FAILED) )
+ _bResumeSuccess = true;
+ else
{
_bResumeSuccess = false;
_lastHashID = null;
}
- else if ( (_sdlMsgVersion.getMajorVersion() > 2) && (_lastHashID != null) && (msg.getResultCode() == Result.SUCCESS) )
- _bResumeSuccess = true;
- }
-
+ }
+
_diagModes = msg.getSupportedDiagModes();
if (!isDebugEnabled())
@@ -2952,10 +3028,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
final OnSystemRequest msg = new OnSystemRequest(hash);
- if ( (msg.getUrl() != null) &&
- (msg.getRequestType() == RequestType.PROPRIETARY) &&
- (msg.getFileType() == FileType.JSON) )
- {
+ if ((msg.getUrl() != null) &&
+ (((msg.getRequestType() == RequestType.PROPRIETARY) && (msg.getFileType() == FileType.JSON))
+ || ((msg.getRequestType() == RequestType.HTTP) && (msg.getFileType() == FileType.BINARY)))){
Thread handleOffboardTransmissionThread = new Thread() {
@Override
public void run() {
@@ -3578,49 +3653,75 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
- public Surface createOpenGLInputSurface(int frameRate, int iFrameInterval, int width,
- int height, int bitrate, boolean isEncrypted) {
-
- if (sdlSession == null) return null;
-
- navServiceStartResponseReceived = false;
- navServiceStartResponse = false;
- sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
-
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(10000));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- while (!navServiceStartResponseReceived && !fTask.isDone());
- scheduler.shutdown();
- scheduler = null;
- fTask = null;
-
- if (navServiceStartResponse) {
- return sdlSession.createOpenGLInputSurface(frameRate, iFrameInterval, width,
- height, bitrate, SessionType.NAV, sdlSession.getSessionId());
- } else {
- return null;
- }
- }
-
- public void startEncoder () {
- if (sdlSession == null) return;
-
- sdlSession.startEncoder();
- }
-
- public void releaseEncoder() {
- if (sdlSession == null) return;
-
- sdlSession.releaseEncoder();
- }
-
- public void drainEncoder(boolean endOfStream) {
- if (sdlSession == null) return;
-
- sdlSession.drainEncoder(endOfStream);
- }
+ /**
+ * 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
+ * @param iFrameInterval - specified interval to utilize for creation of Surface
+ * @param width - specified width to utilize for creation of Surface
+ * @param height - specified height to utilize for creation of Surface
+ * @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;
+
+ navServiceStartResponseReceived = false;
+ navServiceStartResponse = false;
+ sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
+
+ FutureTask<Void> fTask = createFutureTask(new CallableMethod(2000));
+ ScheduledExecutorService scheduler = createScheduler();
+ scheduler.execute(fTask);
+
+ while (!navServiceStartResponseReceived && !fTask.isDone());
+ scheduler.shutdown();
+ scheduler = null;
+ fTask = null;
+
+ if (navServiceStartResponse) {
+ return sdlSession.createOpenGLInputSurface(frameRate, iFrameInterval, width,
+ height, bitrate, SessionType.NAV, sdlSession.getSessionId());
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ *Starts the MediaCodec encoder utilized in conjunction with the Surface returned via the createOpenGLInputSurface method
+ */
+ public void startEncoder () {
+ if (sdlSession == null) return;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return;
+
+ sdlSession.startEncoder();
+ }
+
+ /**
+ *Releases the MediaCodec encoder utilized in conjunction with the Surface returned via the createOpenGLInputSurface method
+ */
+ public void releaseEncoder() {
+ if (sdlSession == null) return;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return;
+
+ sdlSession.releaseEncoder();
+ }
+
+ /**
+ *Releases the MediaCodec encoder utilized in conjunction with the Surface returned via the createOpenGLInputSurface method
+ */
+ public void drainEncoder(boolean endOfStream) {
+ if (sdlSession == null) return;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return;
+
+ sdlSession.drainEncoder(endOfStream);
+ }
private void NavServiceStarted() {
navServiceStartResponseReceived = true;
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBuilder.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBuilder.java
index f0de64e67..9e6921a61 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBuilder.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBuilder.java
@@ -12,7 +12,10 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.transport.BTTransportConfig;
import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.transport.MultiplexTransportConfig;
+
import android.app.Service;
+import android.content.Context;
public class SdlProxyBuilder
{
@@ -45,6 +48,7 @@ public class SdlProxyBuilder
private String appId;
private String appName;
private Boolean isMediaApp;
+ private Context context;
// Optional parameters - initialized to default values
private Service service = null;
@@ -60,17 +64,32 @@ public class SdlProxyBuilder
private boolean callbackToUIThread = false;
private boolean preRegister = false;
private String sAppResumeHash = null;
- private BaseTransportConfig mTransport = new BTTransportConfig();
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.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)
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyFactory.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyFactory.java
deleted file mode 100644
index 9134fc5d4..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyFactory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.smartdevicelink.proxy;
-
-import com.smartdevicelink.exception.SdlException;
-@Deprecated
-public class SdlProxyFactory {
-
- @Deprecated
- public static SdlProxy buildSdlProxy(IProxyListener listener) {
- SdlProxy ret = null;
- try {
- ret = new SdlProxy(listener);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- return ret;
- }
- @Deprecated
- public static SdlProxy buildSdlProxy(IProxyListener listener, String sAppName, String sAppID) {
- SdlProxy ret = null;
- try {
- ret = new SdlProxy(listener,sAppName,sAppID);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- return ret;
- }
-} \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommand.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommand.java
index 3ecac23c5..57b58ea5b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommand.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommand.java
@@ -8,24 +8,24 @@ import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.util.DebugTool;
/**
-* <p>
-* This class will add a command to the application's Command Menu
-* </p>
-* <p>
-* <b>Note:</b> A command will be added to the end of the list of elements in
-* the Command Menu under the following conditions:
-* </p>
+*
+* <p>This class will add a command to the application's Command Menu</p>
+*
+*
+* <p><b>Note:</b> A command will be added to the end of the list of elements in
+* the Command Menu under the following conditions:</p>
+*
* <ul>
* <li>When a Command is added with no MenuParams value provided</li>
* <li>When a MenuParams value is provided with a MenuParam.position value
* greater than or equal to the number of menu items currently defined in the
* menu specified by the MenuParam.parentID value</li>
* </ul>
-* <br/>
-* <p>
-* The set of choices which the application builds using AddCommand can be a
-* mixture of:
-* </p>
+*
+*
+* <p>The set of choices which the application builds using AddCommand can be a
+* mixture of:</p>
+*
* <ul>
* <li>Choices having only VR synonym definitions, but no MenuParams definitions
* </li>
@@ -33,10 +33,53 @@ import com.smartdevicelink.util.DebugTool;
* </li>
* <li>Choices having both MenuParams and VR synonym definitions</li>
* </ul>
-* <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUD</b>
-* </p>
*
+* <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUD</b></p>
+*
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>cmdID</td>
+ * <td> Integer</td>
+ * <td>unique ID of the command to add</td>
+ * <td>Y</td>
+ * <td> minvalue:0; maxvalue:2000000000</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * <tr>
+ * <td>menuParams</td>
+ * <td>ButtonName</td>
+ * <td>Name of the button to unsubscribe.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * <tr/>
+ * <tr>
+ * <td>vrCommands</td>
+ * <td>String</td>
+ * <td><p>An array of strings to be used as VR synonyms for this command.</p> <p>If this array is provided, it may not be empty.</p></td>
+ * <td>N</td>
+ * <td>minsize:1; maxsize:100</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * <tr>
+ * <td>cmdIcon</td>
+ * <td>Image</td>
+ * <td><p>Image struct determining whether static or dynamic icon.</p><p>If omitted on supported displays, no (or the default if applicable) icon shall be displayed.</p></td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+* </table>
+* <p> <b>Response</b></p><p>Indicates that the corresponding request has failed or succeeded, if the response returns with a SUCCESS result code, this means a command was added to the Command Menu successfully.</p>
+*
+* <p><b>Non-default Result Codes:</b></p> <p>INVALID_ID</p> <p>DUPLICATE_NAME</p>
* @since SmartDeviceLink 1.0
* @see DeleteCommand
* @see AddSubMenu
@@ -79,15 +122,15 @@ public class AddCommand extends RPCRequest {
return (Integer) parameters.get(KEY_CMD_ID);
}
/**
- * Sets an Unique Command ID that identifies the command. Is returned in an
+ * <p>Sets an Unique Command ID that identifies the command. Is returned in an
* <i>{@linkplain OnCommand}</i> notification to identify the command
- * selected by the user
- * <p>
+ * selected by the user</p>
+ *
*
* @param cmdID
* an integer object representing a Command ID
* <p>
- * <b>Notes:</b> Min Value: 0; Max Value: 2000000000
+ * <b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
*/
public void setCmdID(Integer cmdID) {
if (cmdID != null) {
@@ -103,6 +146,7 @@ public class AddCommand extends RPCRequest {
* </p>
*
* @return MenuParams -a MenuParams object
+ *
*/
@SuppressWarnings("unchecked")
public MenuParams getMenuParams() {
@@ -121,9 +165,9 @@ public class AddCommand extends RPCRequest {
}
/**
* <p>
- * Sets Menu parameters<br/>
+ * Sets Menu parameters</p>
* If provided, this will define the command and how it is added to the
- * Command Menu<br/>
+ * Command Menu<p>
* If null, commands will not be accessible through the HMI application menu
* </p>
*
@@ -159,11 +203,11 @@ public class AddCommand extends RPCRequest {
}
/**
* <p>
- * Sets Voice Recognition Commands <br/>
- * If provided, defines one or more VR phrases the recognition of any of
+ * Sets Voice Recognition Commands </p>
+ * <p>If provided, defines one or more VR phrases the recognition of any of
* which triggers the <i>{@linkplain OnCommand}</i> notification with this
- * cmdID<br/>
- * If null, commands will not be accessible by voice commands (when the user
+ * cmdID</p>
+ * <p>If null, commands will not be accessible by voice commands (when the user
* hits push-to-talk)
* </p>
*
@@ -172,7 +216,7 @@ public class AddCommand extends RPCRequest {
* <p>
* <b>Notes: </b>Optional only if menuParams is provided. If
* provided, array must contain at least one non-empty (not null,
- * not zero-length, not whitespace only) element
+ * not zero-length, not whitespace only) element</p>
*/
public void setVrCommands( List<String> vrCommands ) {
if (vrCommands != null) {
@@ -183,7 +227,7 @@ public class AddCommand extends RPCRequest {
}
/**
- * Gets the image to be shown along with a command </p>
+ * <p>Gets the image to be shown along with a command </p>
*
* @return Image -an Image object
* @since SmartDeviceLink 2.0
@@ -204,14 +248,14 @@ public class AddCommand extends RPCRequest {
}
/**
- * Sets the Image<br/>
- * If provided, defines the image to be be shown along with a command
+ * <p>Sets the Image
+ * If provided, defines the image to be be shown along with a command</p>
* @param cmdIcon
- * an Image obj representing the Image obj shown along with a
- * command
+ * <p>an Image obj representing the Image obj shown along with a
+ * command</p>
* <p>
* <b>Notes: </b>If omitted on supported displays, no (or the
- * default if applicable) icon will be displayed
+ * default if applicable) icon will be displayed</p>
* @since SmartDeviceLink 2.0
*/
public void setCmdIcon(Image cmdIcon) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommandResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommandResponse.java
index 5d64cf6c8..da908908b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommandResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommandResponse.java
@@ -11,7 +11,9 @@ import com.smartdevicelink.proxy.RPCResponse;
* @since SmartDeviceLink 1.0
*/
public class AddCommandResponse extends RPCResponse {
-
+ /**
+ * Constructs a new AddCommandResponse object
+ */
public AddCommandResponse() {
super(FunctionID.ADD_COMMAND.toString());
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenu.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenu.java
index 9985fab61..2edc70c50 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenu.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenu.java
@@ -6,15 +6,55 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
/**
- * Add a SubMenu to the Command Menu
- * <p>
- * A SubMenu can only be added to the Top Level Menu (i.e.a SunMenu cannot be
- * added to a SubMenu), and may only contain commands as children
- * <p>
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUD</b>
- * </p>
+ * <p>Add a SubMenu to the Command Menu</p>
*
+ * <p>A SubMenu can only be added to the Top Level Menu (i.e.a SubMenu cannot be
+ * added to a SubMenu), and may only contain commands as children</p>
+ *
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUD</b></p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>menuID</td>
+ * <td>Integer</td>
+ * <td>Unique ID that identifies this sub menu. This value is used in AddCommand to which SubMenu is the parent of the command being added.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>position</td>
+ * <td>Integer</td>
+ * <td>Position within the items of the top level Command Menu. 0 will insert at the front, 1 will insert after the first existing element, etc. Position of any submenu will always be located before the return and exit options.</td>
+ * <td>N</td>
+ * <td>Min Value: 0 <p>Max Value: 1000</p> <p>If position is greater or equal than the number of items on top level, the sub menu will be appended by the end.</p><p>If this parameter is omitted, the entry will be added at the end of the list.</P></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>menuName</td>
+ * <td>String</td>
+ * <td>Text which is displayed representing this submenu item</td>
+ * <td>Y</td>
+ * <td>maxlength:500</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * </table>
+ * <b>Response</b>
+ * <p>Indicates that the corresponding request either failed or succeeded. If the response returns with a SUCCESS result code, this means the SubMenu was added to the Command Menu successfully</p>
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>INVALID_ID</p>
+ * <p>DUPLICATE NAME</p>
* @since SmartDeviceLink 1.0
* @see DeleteSubMenu
* @see AddCommand
@@ -33,7 +73,7 @@ public class AddSubMenu extends RPCRequest {
}
/**
* Constructs a new AddSubMenu object indicated by the Hashtable parameter
- * <p>
+ *
*
* @param hash
* The Hashtable to use
@@ -44,7 +84,7 @@ public class AddSubMenu extends RPCRequest {
/**
* Returns an <i>Integer</i> object representing the Menu ID that identifies
* a sub menu
- * <p>
+ *
*
* @return Integer -an integer representing the Menu ID that identifies a sub
* menu
@@ -53,15 +93,15 @@ public class AddSubMenu extends RPCRequest {
return (Integer) parameters.get( KEY_MENU_ID );
}
/**
- * Sets a Menu ID that identifies a sub menu. This value is used in
+ * <p>Sets a Menu ID that identifies a sub menu.</p><p> This value is used in
* {@linkplain AddCommand} to which SubMenu is the parent of the command
- * being added
- * <p>
+ * being added</p>
+ *
*
* @param menuID
* an integer object representing a Menu ID
- * <p>
- * <b>Notes:</b> Min Value: 0; Max Value: 2000000000
+ *
+ * <p><b>Notes:</b> Min Value: 0; Max Value: 2000000000</p>
*/
public void setMenuID( Integer menuID ) {
if (menuID != null) {
@@ -71,8 +111,8 @@ public class AddSubMenu extends RPCRequest {
}
}
/**
- * Returns an <i>Integer</i> object representing the position of menu
- * <p>
+ * <p>Returns an <i>Integer</i> object representing the position of menu</p>
+ *
*
* @return Integer -the value representing the relative position of menus
*/
@@ -83,17 +123,17 @@ public class AddSubMenu extends RPCRequest {
* Sets a position of menu
*
* @param position
- * An Integer object representing the position within the items
+ * <p>An Integer object representing the position within the items
* of the top level Command Menu. 0 will insert at the front, 1
* will insert after the first existing element, etc. Position of
* any submenu will always be located before the return and exit
* options
- * <p>
- * <b>Notes: </b><br/>
+ * </p>
+ * <b>Notes: </b>
* <ul>
* <li>
* Min Value: 0; Max Value: 1000</li>
- * <li>If position is greater or equal than the number of items
+ * <li>If position is greater than or equal to the number of items
* on top level, the sub menu will be appended by the end</li>
* <li>If this parameter is omitted, the entry will be added at
* the end of the list</li>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java
index c43317628..6b386eef5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java
@@ -10,6 +10,9 @@ import com.smartdevicelink.proxy.RPCResponse;
* @since SmartDeviceLink 1.0
*/
public class AddSubMenuResponse extends RPCResponse {
+ /**
+ * Constructs a new AddSubMenuResponse object
+ */
public AddSubMenuResponse() {
super(FunctionID.ADD_SUB_MENU.toString());
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AirbagStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AirbagStatus.java
index 13028f257..b80a9c2c4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AirbagStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AirbagStatus.java
@@ -4,7 +4,83 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
-
+/**
+ * <p>The status of the air bags.</p>
+ *
+ *
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>SmartDeviceLink Version.</th>
+ * </tr>
+ * <tr>
+ * <td>driverAirbagDeployed </td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>Status of driver airbag.</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>driverSideAirbagDeployed</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>Status of driver side airbag.</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>driverCurtainAirbagDeployed</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>Status of driver curtain airbag.</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>passengerAirbagDeployed</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>Status of passenger airbag.</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>passengerCurtainAirbagDeployed</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>Status of passenger curtain airbag.</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>driverKneeAirbagDeployed</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>Status of driver knee airbag.</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>passengerSideAirbagDeployed</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>Status of passenger side airbag.</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>passengerKneeAirbagDeployed</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>Status of passenger knee airbag</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ *
+ * </table>
+ *
+ * <p><b>Response:</b></p>
+ * If a resultCode of "SUCCESS" is returned, the request was accepted by SDL. By the time the corresponding response is received, the Alert will have completed.
+ *
+ * <p><b> Non-default Result Codes:</b></p>
+ * <p>REJECTED</p><p> ABORTED</P>
+ *
+ *
+ * @since SmartDeviceLink 1.0
+ *
+ * @see TextFieldName
+ * @see Image
+ * @see SubscribeVehicleData
+ */
public class AirbagStatus extends RPCStruct {
public static final String KEY_DRIVER_AIRBAG_DEPLOYED = "driverAirbagDeployed";
public static final String KEY_DRIVER_SIDE_AIRBAG_DEPLOYED = "driverSideAirbagDeployed";
@@ -14,6 +90,13 @@ public class AirbagStatus extends RPCStruct {
public static final String KEY_PASSENGER_SIDE_AIRBAG_DEPLOYED = "passengerSideAirbagDeployed";
public static final String KEY_PASSENGER_CURTAIN_AIRBAG_DEPLOYED = "passengerCurtainAirbagDeployed";
public static final String KEY_PASSENGER_KNEE_AIRBAG_DEPLOYED = "passengerKneeAirbagDeployed";
+ /** Constructs a new AirbagStatus object indicated by the Hashtable
+ * parameter
+ * @param hash
+ * The hash table to use
+ *
+ *
+ */
public AirbagStatus() { }
public AirbagStatus(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Alert.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Alert.java
index dad62cad5..811d65a42 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Alert.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Alert.java
@@ -10,7 +10,7 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* Provides information to the user using either TTS, the Display or both and
* can include a system-generated alert tone
- * <p>
+ *
* <ul>
* <li>The displayed portion of the Alert, if any, will persist until the
* specified timeout has elapsed, or the Alert is preempted</li>
@@ -20,7 +20,7 @@ import com.smartdevicelink.proxy.RPCRequest;
* <li>An Alert can be preempted by a user action (button push)</li>
* <li>An Alert will fail if it is issued while another Alert is in progress</li>
* <li>Although each Alert parameter is optional, in fact each Alert request
- * must supply at least one of the following parameters:<br/>
+ * must supply at least one of the following parameters:
* <ul>
* <li>alertText1</li>
* <li>alertText2</li>
@@ -29,12 +29,89 @@ import com.smartdevicelink.proxy.RPCRequest;
* </ul>
* </li>
* </ul>
- * <br/>
- * <b>HMILevel needs to be FULL or LIMITED.</b><br/>
- * <b>If the app has been granted function group Notification the HMILevel can
- * also be BACKGROUND</b><br/>
*
+ * <p><b>HMILevel needs to be FULL or LIMITED.</b></p>
+ * <b>If the app has been granted function group Notification the HMILevel can
+ * also be BACKGROUND</b>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>alertText1</td>
+ * <td>String</td>
+ * <td>Text to be displayed in the first field of the display during the Alert. </td>
+ * <td>N</td>
+ * <td> Length is limited to what is indicated in RegisterAppInterface response. If omitted, top display line will be cleared. Text is always centered</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>alertText2</td>
+ * <td>String</td>
+ * <td>Text to be displayed in the second field of the display during the Alert. </td>
+ * <td>N</td>
+ * <td> Only permitted if HMI supports a second display line. Length is limited to what is indicated in RegisterAppInterface response. If omitted, second display line will be cleared. </td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>alertText3</td>
+ * <td>String</td>
+ * <td>Text to be displayed in the third field of the display during the Alert.</td>
+ * <td>N</td>
+ * <td>Array must have a least one element. </td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>ttsChunks</td>
+ * <td>TTSChunk[]</td>
+ * <td>Array of type TTSChunk which, taken together, specify what is to be spoken to the user.</td>
+ * <td>N</td>
+ * <td>Array must have a least one element. </td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>duration</td>
+ * <td>Integer</td>
+ * <td><p>The duration of the displayed portion of the alert, in milliseconds.</p> After this amount of time has passed, the display fields alertText1 and alertText2 will revert to what was displayed in those fields before the alert began.</td>
+ * <td>N</td>
+ * <td>Min Value: 3000 Max Value: 10000 <p>If omitted, the default is 5000 milliseconds</p></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>playTone</td>
+ * <td>Boolean</td>
+ * <td>Specifies whether the alert tone should be played before the TTS (if any) is spoken.</td>
+ * <td>N</td>
+ * <td>If omitted, default is true.</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>softButtons</td>
+ * <td>SoftButton[]</td>
+ * <td>Specifies the softbuttons, the apps wants to use in this alert.</td>
+ * <td></td>
+ * <td>If omitted on supported displays, the alert will not have any SoftButton.ArrayMin: 0; ArrayMax: 4</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>progressIndicator</td>
+ * <td>Boolean</td>
+ * <td>If supported on the given platform, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * </table>
* @since SmartDeviceLink 1.0
+ *
+ *
+ * @see GetVehicleData
+ * @see OnVehicleData
* @see Show
* @see Speak
*/
@@ -55,8 +132,8 @@ public class Alert extends RPCRequest {
super(FunctionID.ALERT.toString());
}
/**
- * Constructs a new Alert object indicated by the Hashtable parameter
- * <p>
+ * <p>Constructs a new Alert object indicated by the Hashtable parameter</p>
+ *
*
* @param hash
* The Hashtable to use
@@ -80,8 +157,8 @@ public class Alert extends RPCRequest {
*
* @param alertText1
* String Value
- * <p>
- * <b>Notes: </b><br/>
+ *
+ * <p><b>Notes: </b></p>
* <ul>
* <li>Length is limited to what is indicated in <i>
* {@linkplain RegisterAppInterface}</i> response</li>
@@ -112,8 +189,8 @@ public class Alert extends RPCRequest {
*
* @param alertText2
* String Value
- * <p>
- * <b>Notes: </b><br/>
+ *
+ * <p><b>Notes: </b></p>
* <ul>
* <li>Only permitted if HMI supports a second display line</li>
* <li>Length is limited to what is indicated in <i>
@@ -149,8 +226,8 @@ public class Alert extends RPCRequest {
*
* @param alertText3
* String Value
- * <p>
- * <b>Notes: </b><br/>
+ *
+ * <p> <b>Notes: </b></p>
* <ul>
* <li>Only permitted if HMI supports a third display line</li>
* <li>Length is limited to what is indicated in <i>
@@ -199,8 +276,8 @@ public class Alert extends RPCRequest {
* spoken to the user
*
* @param ttsChunks
- * <p>
- * <b>Notes: </b>Array must have a least one element
+ *
+ * <p> <b>Notes: </b>Array must have a least one element</p>
*/
public void setTtsChunks(List<TTSChunk> ttsChunks) {
if (ttsChunks != null) {
@@ -219,17 +296,17 @@ public class Alert extends RPCRequest {
return (Integer) parameters.get(KEY_DURATION);
}
/**
- * Sets the duration of the displayed portion of the alert, in milliseconds.
+ * <p>Sets the duration of the displayed portion of the alert, in milliseconds.
* After this amount of time has passed, the display fields alertText1 and
* alertText2 will revert to what was displayed in those fields before the
- * alert began
- * <p>
+ * alert began</p>
+ *
*
* @param duration
* the Integer values representing the duration time, in
* milliseconds
* <p>
- * <b>Notes: </b><br/>
+ * <b>Notes: </b></p>
* <ul>
* <li>Min Value: 3000; Max Value: 10000</li>
* <li>If omitted, the default is 5000 milliseconds</li>
@@ -258,8 +335,8 @@ public class Alert extends RPCRequest {
* @param playTone
* a Boolean value which specifies whether the alert tone should
* be played before the TTS (if any) is spoken
- * <p>
- * <b>Notes: </b>If omitted, default is true
+ *
+ * <p> <b>Notes: </b>If omitted, default is true</p>
*/
public void setPlayTone(Boolean playTone) {
if (playTone != null) {
@@ -302,7 +379,7 @@ public class Alert extends RPCRequest {
* @param softButtons
* a List<SoftButton> value
* <p>
- * <b>Notes: </b><br/>
+ * <b>Notes: </b></p>
* <ul>
* <li>If omitted on supported displays, the alert will not have
* any SoftButton</li>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuver.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuver.java
index 9aab52589..fba595150 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuver.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuver.java
@@ -8,13 +8,13 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
/**
- * This will bring up an alert with information related to the next navigation maneuver including potential voice
+ * <p>This will bring up an alert with information related to the next navigation maneuver including potential voice
* navigation instructions. Shown information will be taken from the ShowConstantTBT function
- * <p>
- * Function Group: Navigation
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * <p>
+ * </p>
+ * <p>Function Group: Navigation</p>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
*
* @since SmartDeviceLink 2.0
* @see ShowConstantTbt
@@ -32,9 +32,9 @@ public class AlertManeuver extends RPCRequest{
}
/**
- * <p>
- * Constructs a new AlertManeuver object indicated by the Hashtable parameter
- * </p>
+ *
+ * <p>Constructs a new AlertManeuver object indicated by the Hashtable parameter</p>
+ *
*
* @param hash
* The Hashtable to use
@@ -76,7 +76,7 @@ public class AlertManeuver extends RPCRequest{
* @param softButtons
* a List<SoftButton> value
* <p>
- * <b>Notes: </b><br/>
+ * <b>Notes: </b></p>
* <ul>
* <li>If omitted on supported displays, the alert will not have any SoftButton</li>
* <li>ArrayMin: 0</li>
@@ -125,7 +125,7 @@ public class AlertManeuver extends RPCRequest{
*
* @param ttsChunks
* <p>
- * <b>Notes: </b>Array must have a least one element
+ * <b>Notes: </b></p>Array must have a least one element
*/
public void setTtsChunks(List<TTSChunk> ttsChunks){
if(ttsChunks != null){
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertResponse.java
index fc01fbe63..cea706d4e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertResponse.java
@@ -21,9 +21,9 @@ public class AlertResponse extends RPCResponse {
}
/**
- * Constructs a new AlertResponse object indicated by the Hashtable
+ * <p>Constructs a new AlertResponse object indicated by the Hashtable
* parameter
- * <p>
+ * </p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java
index 0db1c6c8b..48cfd129b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AudioPassThruCapabilities.java
@@ -8,8 +8,10 @@ import com.smartdevicelink.proxy.rpc.enums.BitsPerSample;
import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
/**
- * Describes different audio type configurations for PerformAudioPassThru, e.g. {8kHz,8-bit,PCM}
- * <p><b>Parameter List
+ *<p> Describes different audio type configurations for PerformAudioPassThru, e.g. {8kHz,8-bit,PCM}
+ * Specifies the capabilities of audio capturing: sampling rate, bits per sample, audio type.</p>
+ *
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -39,6 +41,8 @@ import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
+ * @see ButtonName
+ * @see GetCapabilities
* @since SmartDeviceLink 2.0
*/
public class AudioPassThruCapabilities extends RPCStruct {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/BeltStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/BeltStatus.java
index ccf15c855..71db21640 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/BeltStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/BeltStatus.java
@@ -4,6 +4,114 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
+/** The status of the seat belts.
+ *
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>driverBeltDeployed</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The driver seat belt is deployed.</td>
+ * </tr>
+ * <tr>
+ * <td>passengerBeltDeployed</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The passenger seat belt is deployed.</td>
+ * </tr>
+ * <tr>
+ * <td>passengerBuckleBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The passenger seat belt is buckled.</td>
+ * </tr>
+ * <tr>
+ * <td>driverBuckleBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The driver seat belt is buckled.</td>
+ * </tr>
+ * <tr>
+ * <td>leftRow2BuckleBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The left seat belt of the 2nd row is buckled.</td>
+ * </tr>
+ * <tr>
+ * <td>passengerChildDetected</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The child passenger is detected.</td>
+ * </tr>
+ * <tr>
+ * <td>rightRow2BuckleBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The right seat belt of the 2nd row is buckled.</td>
+ * </tr>
+ * <tr>
+ * <td>middleRow2BuckleBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The middle seat belt of the 2nd row is buckled.</td>
+ * </tr>
+ * <tr>
+ * <td>middleRow3BuckleBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The middle seat belt of the 3rd row is buckled.</td>
+ * </tr>
+ * <tr>
+ * <td>leftRow3BuckleBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The left seat belt of the 3rd row is buckled.</td>
+ * </tr>
+ * <tr>
+ * <td>rightRow3BuckleBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The right seat belt of the 3rd row is buckled.</td>
+ * </tr>
+ * <tr>
+ * <td>leftRearInflatableBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The left rear inflatable is belted.</td>
+ * </tr>
+ * <tr>
+ * <td>rightRearInflatableBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The right rear inflatable is belted.</td>
+ * </tr>
+ * <tr>
+ * <td>middleRow1BeltDeployed</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The seat belt of the middle row is deployed.</td>
+ * </tr>
+ * <tr>
+ * <td>middleRow1BuckleBelted</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td>false</td>
+ * <td>The seat belt of the middle row is buckled.</td>
+ * </tr>
+ * </table>
+* @since SmartDeviceLink 2.0
+* @see VehicleDataEventStatus
+* @see GetVehicleData
+* @see OnVehicleData
+ * @see SubscribeVehicleData
+ */
public class BeltStatus extends RPCStruct {
public static final String KEY_DRIVER_BELT_DEPLOYED = "driverBeltDeployed";
@@ -21,6 +129,13 @@ public class BeltStatus extends RPCStruct {
public static final String KEY_RIGHT_REAR_INFLATABLE_BELTED = "rightRearInflatableBelted";
public static final String KEY_MIDDLE_ROW_1_BELT_DEPLOYED = "middleRow1BeltDeployed";
public static final String KEY_MIDDLE_ROW_1_BUCKLE_BELTED = "middleRow1BuckleBelted";
+ /** Constructs a new BeltStatus object indicated by the Hashtable
+ * parameter
+ * @param hash
+ * The hash table to use
+ *
+ *
+ */
public BeltStatus() { }
public BeltStatus(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/BodyInformation.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/BodyInformation.java
index 5b9b984d8..038b1970e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/BodyInformation.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/BodyInformation.java
@@ -5,6 +5,83 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStableStatus;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus;
+/** The body information including power modes.
+ *
+ * <p><b>Note:</b> The structure defines the information about the park brake and ignition.</p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>parkBrakeActive</td>
+ * <td>Boolean</td>
+ * <td>true</td>
+ * <td>Describes, if the parkbreak is active. The information about the park brake: - true, if active - false if not.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>ignitionStableStatus</td>
+ * <td>IgnitionStableStatus</td>
+ * <td>true</td>
+ * <td>Describes, if the ignition situation is considered stableThe information about stability of the ignition switch. See {@linkplain IgnitionStableStatus}</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>ignitionStatus</td>
+ * <td>IgnitionStatus</td>
+ * <td>true</td>
+ * <td>The information about ignition status. See {@linkplain IgnitionStatus}</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>parkBrakeActive</td>
+ * <td>Boolean</td>
+ * <td>true</td>
+ * <td>The information about the park brake: - true, if active - false if not.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>driverDoorAjar</td>
+ * <td>Boolean</td>
+ * <td>true</td>
+ * <td>The information about the park brake: - true, if active - false if not.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>passengerDoorAjar</td>
+ * <td>Boolean</td>
+ * <td>true</td>
+ * <td>The information about the park brake: - true, if active - false if not.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>rearLeftDoorAjar</td>
+ * <td>Boolean</td>
+ * <td>true</td>
+ * <td>The information about the park brake: - true, if active - false if not.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>rearRightDoorAjar</td>
+ * <td>Boolean</td>
+ * <td>true</td>
+ * <td>References signal "DrStatRr_B_Actl".</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * </table>
+ * @since SmartDeviceLink 2.0
+ * @see SubscribeVehicleData
+ * @see GetVehicleData
+ * @see OnVehicleData
+ *
+ */
public class BodyInformation extends RPCStruct {
public static final String KEY_PARK_BRAKE_ACTIVE = "parkBrakeActive";
@@ -14,6 +91,13 @@ public class BodyInformation extends RPCStruct {
public static final String KEY_PASSENGER_DOOR_AJAR = "passengerDoorAjar";
public static final String KEY_REAR_LEFT_DOOR_AJAR = "rearLeftDoorAjar";
public static final String KEY_REAR_RIGHT_DOOR_AJAR = "rearRightDoorAjar";
+ /** Constructs a new BodyInformation object indicated by the Hashtable
+ * parameter
+ * @param hash
+ * The hash table to use
+ *
+ *
+ */
public BodyInformation() { }
public BodyInformation(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
index f59848036..9b15c5be9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
@@ -7,7 +7,7 @@ import com.smartdevicelink.proxy.rpc.enums.ButtonName;
/**
* Provides information about the capabilities of a SDL HMI button.
- * <p><b> Parameter List
+ * <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -24,24 +24,40 @@ import com.smartdevicelink.proxy.rpc.enums.ButtonName;
* <tr>
* <td>shortPressAvailable</td>
* <td>Boolean</td>
- * <td>The button supports a SHORT press. See ButtonPressMode for more information.</td>
+ * <td>The button supports a SHORT press. See {@linkplain ButtonPressMode} for more information.</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>longPressAvailable</td>
* <td>Boolean</td>
- * <td>The button supports a LONG press. See ButtonPressMode for more information.</td>
+ * <td>The button supports a LONG press. See {@linkplain ButtonPressMode} for more information.</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>upDownAvailable</td>
* <td>Boolean</td>
* <td>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.
- * <p> When the button is released, the <i>{@linkplain OnButtonEvent}</i> notification will be invoked with a value of BUTTONUP.</td>
+ * <p> When the button is released, the <i>{@linkplain OnButtonEvent}</i> notification will be invoked with a value of BUTTONUP.</p></td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
+ *
+ * <p>Upon the request HMI must provide the list of the following information:</p>
+ * <p>The names of all existing/supported hardware buttons.</p>
+ * <p>The availability of LONG/SHORT press for each existing/supported hardware button correspondingly</p>
+ * <p>The availability of UP/DOWN events for each existing/supported hardware button correspondingly.</p>
+ *
* @since SmartDeviceLink 1.0
+ *
+ * @see ButtonName
+ * @see ButtonEventMode
+ * @see ButtonPressMode
+ *
+ *
+ *
+ * @see OnButtonEvent
+ * @see OnButtonPress
+ *
*/
public class ButtonCapabilities extends RPCStruct {
public static final String KEY_NAME = "name";
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistration.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
index 1cf47841e..2b4c69f42 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
@@ -9,15 +9,91 @@ import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.Language;
/**
- * If the app recognizes during the app registration that the Sdl HMI language
+ * If the app recognizes during the app registration that the SDL HMI language
* (voice/TTS and/or display) does not match the app language, the app will be
* able (but does not need) to change this registration with changeRegistration
- * prior to app being brought into focus
- * <p>
- * Function Group: Base
- * <p>
- * <b>HMILevel can by any</b>
- * <p>
+ * prior to app being brought into focus.
+ *
+ * <p>Function Group: Base</p>
+ *
+ * <p><b>HMILevel can by any</b></p>
+ *
+ * <b>Note:</b>
+ *
+ * <p>SDL will send the language value confirmed to be supported by HMI via UI.GetCapabilities.</p>
+ * <p><b> Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>Language</td>
+ * <td>Language</td>
+ * <td>Requested SDL voice engine (VR+TTS) language registration.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>hmiDisplayLanguage</td>
+ * <td>Language</td>
+ * <td>Request display language registration.</td>
+ * <td>Y</td>
+ * <td>Minvalue=0; Maxvalue=2000000000</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>appName</td>
+ * <td>String</td>
+ * <td>Request new app name registration</td>
+ * <td>N</td>
+ * <td>maxlength:100</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>ttsName</td>
+ * <td>TTSChunk</td>
+ * <td>Request new ttsName registration</td>
+ * <td>N</td>
+ * <td>minsize:1; maxsize:100</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>ngnMediaScreenAppName</td>
+ * <td>String</td>
+ * <td>Request new app short name registration</td>
+ * <td>N</td>
+ * <td>maxlength: 100</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>vrSynonyms</td>
+ * <td>String</td>
+ * <td>Request new VR synonyms registration</td>
+ * <td>N</td>
+ * <td>maxlength: 40; minsize:1; maxsize:100</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * </table>
+ *
+ * <p><b>Response </b></p>
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p> TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>REJECTED</p>
+ * <p>DISALLOWED</p>
*
* @since SmartDeviceLink 2.0
* @see RegisterAppInterface
@@ -38,9 +114,9 @@ public class ChangeRegistration extends RPCRequest {
}
/**
- * Constructs a new ChangeRegistration object indicated by the Hashtable
- * parameter
- * <p>
+ * <p>Constructs a new ChangeRegistration object indicated by the Hashtable
+ * parameter</p>
+ *
*
* @param hash
* The Hashtable to use
@@ -222,7 +298,7 @@ public class ChangeRegistration extends RPCRequest {
* a List<String> value representing the an array of 1-100
* elements
* <p>
- * <b>Notes: </b>
+ * <b>Notes: </b></p>
* <ul>
* <li>Each vr synonym is limited to 40 characters, and there can
* be 1-100 synonyms in array</li>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java
index 0ab62ba49..e5404cad3 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java
@@ -20,9 +20,9 @@ public class ChangeRegistrationResponse extends RPCResponse {
}
/**
- * Constructs a new ChangeRegistrationResponse object indicated by the Hashtable
- * parameter
- * <p>
+ * <p>Constructs a new ChangeRegistrationResponse object indicated by the Hashtable
+ * parameter</p>
+ *
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Choice.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Choice.java
index 79f181690..2bc59736e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Choice.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Choice.java
@@ -8,7 +8,8 @@ import com.smartdevicelink.util.DebugTool;
/**
* A choice is an option which a user can select either via the menu or via voice recognition (VR) during an application initiated interaction.
- * <p><b> Parameter List
+ * For example, the application may request for the user`s choice among several suggested ones: Yes, No, Skip.
+ * <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -18,10 +19,10 @@ import com.smartdevicelink.util.DebugTool;
* </tr>
* <tr>
* <td>choiceID</td>
- * <td>Int16</td>
+ * <td>Integer</td>
* <td>Application-scoped identifier that uniquely identifies this choice.
- * <br/>Min: 0
- * <br/>Max: 65535
+ * Min: 0;
+ * Max: 65535
* </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -29,8 +30,8 @@ import com.smartdevicelink.util.DebugTool;
* <td>menuName</td>
* <td>String</td>
* <td>Text which appears in menu, representing this choice.
- * <br/>Min: 1
- * <br/>Max: 100
+ * Min: 1;
+ * Max: 100
* </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -49,6 +50,10 @@ import com.smartdevicelink.util.DebugTool;
* </table>
*
* @since SmartDeviceLink 1.0
+ *
+ * @see AddCommand
+ * @see PerformInteraction
+ * @see Image
*/
public class Choice extends RPCStruct {
public static final String KEY_SECONDARY_TEXT = "secondaryText";
@@ -71,7 +76,7 @@ public class Choice extends RPCStruct {
}
/**
* Get the application-scoped identifier that uniquely identifies this choice.
- * @return choiceID Min: 0 Max: 65535
+ * @return choiceID Min: 0; Max: 65535
*/
public Integer getChoiceID() {
return (Integer) store.get(KEY_CHOICE_ID);
@@ -89,8 +94,8 @@ public class Choice extends RPCStruct {
}
/**
* Text which appears in menu, representing this choice.
- * <br/>Min: 1
- * <br/>Max: 100
+ * Min: 1;
+ * Max: 100
* @return menuName the menu name
*/
public String getMenuName() {
@@ -98,8 +103,8 @@ public class Choice extends RPCStruct {
}
/**
* Text which appears in menu, representing this choice.
- * <br/>Min: 1
- * <br/>Max: 100
+ * Min: 1;
+ * Max: 100
* @param menuName the menu name
*/
public void setMenuName(String menuName) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java
index 6ea37a444..17e16af65 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ClusterModeStatus.java
@@ -6,12 +6,62 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.CarModeStatus;
import com.smartdevicelink.proxy.rpc.enums.PowerModeQualificationStatus;
import com.smartdevicelink.proxy.rpc.enums.PowerModeStatus;
+/** <p>The status modes of the instrument panel cluster.</p>
+ *
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>powerModeActive</td>
+ * <td>Boolean</td>
+ * <td></td>
+ * <td>References signal "PowerMode_UB".</td>
+ * </tr>
+ * <tr>
+ * <td>powerModeQualificationStatus</td>
+ * <td>PowerModeQualificationStatus</td>
+ * <td></td>
+ * <td>References signal "PowerModeQF".</td>
+ * </tr>
+ * <tr>
+ * <td>carModeStatus</td>
+ * <td>CarModeStatus</td>
+ * <td></td>
+ * <td>Describes the carmode the vehicle is in.</td>
+ * </tr>
+ * <tr>
+ * <td>powerModeStatus</td>
+ * <td>PowerModeStatus</td>
+ * <td>true</td>
+ * <td>Describes the different powermodes</td>
+ * </tr>
+ *
+ * </table>
+ * @since SmartDeviceLink 1.0
+ *
+ * @see SubscribeVehicleData
+ * @see SubscribeVehicleData
+ * @see Image
+ *
+ */
public class ClusterModeStatus extends RPCStruct {
public static final String KEY_POWER_MODE_ACTIVE = "powerModeActive";
public static final String KEY_POWER_MODE_QUALIFICATION_STATUS = "powerModeQualificationStatus";
public static final String KEY_CAR_MODE_STATUS = "carModeStatus";
public static final String KEY_POWER_MODE_STATUS = "powerModeStatus";
+ /** <p>Constructs a new ClusterModeStatus object indicated by the Hashtable
+ * parameter</p>
+ * @param hash
+ * The hash table to use
+ *
+ */
public ClusterModeStatus() { }
public ClusterModeStatus(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
index 45c2901de..97793558f 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
@@ -10,11 +10,64 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* Creates a Choice Set which can be used in subsequent <i>
* {@linkplain PerformInteraction}</i> Operations.
- * <p>
- * Function Group: Base
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * </p>
+ *
+ * <p>Function Group: Base </p>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
+ * <p>AudioStreamingState : ANY</p>
+ *
+ * <p>SystemContext: MAIN, MENU, VR</p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>interactionChoiceSetID</td>
+ * <td>Integer</td>
+ * <td>A unique ID that identifies the Choice Set</td>
+ * <td>Y</td>
+ * <td>Min Value: 0; Max Value: 2000000000</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>choiceSet</td>
+ * <td>Choice[]</td>
+ * <td>Array of one or more elements.</td>
+ * <td>Y</td>
+ * <td>Min Value: 1; Max Value: 100</td>
+ * <td>SmartDeviceLink 1.0 </td>
+ * </tr>
+ * </table>
+ *
+ *
+ * <p> <b>Note:</b></p>Second Utterance issue with CreateInteractionChoiceSet RPC. Before a perform interaction
+ * is sent you MUST wait for the success from the CreateInteractionChoiceSet RPC.
+ * If you do not wait the system may not recognize the first utterance from the user.
+ *
+ * <p><b>Response</b></p>
+ *
+ * Indicates that the corresponding request either failed or succeeded. If the response returns with a SUCCESS result code, this means the Choice Set was created.
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p> REJECTED</p>
+ * <p> INVALID_ID</p>
+ * <p> DUPLICATE_NAME</p>
+ * <p>UNSUPPORTED_RESOURCE </p>
+ *
*
* @since SmartDeviceLink 1.0
* @see DeleteInteractionChoiceSet
@@ -31,9 +84,9 @@ public class CreateInteractionChoiceSet extends RPCRequest {
super(FunctionID.CREATE_INTERACTION_CHOICE_SET.toString());
}
/**
- * Constructs a new CreateInteractionChoiceSet object indicated by the
- * Hashtable parameter
- * <p>
+ * <p>Constructs a new CreateInteractionChoiceSet object indicated by the
+ * Hashtable parameter</p>
+ *
*
* @param hash
* The Hashtable to use
@@ -54,7 +107,7 @@ public class CreateInteractionChoiceSet extends RPCRequest {
*
* @param interactionChoiceSetID
* an Integer value representing the Choice Set ID
- * <p>
+ *
* <b>Notes: </b>Min Value: 0; Max Value: 2000000000
*/
public void setInteractionChoiceSetID( Integer interactionChoiceSetID ) {
@@ -95,7 +148,7 @@ public class CreateInteractionChoiceSet extends RPCRequest {
* @param choiceSet
* a List<Choice> representing the array of one or more
* elements
- * <p>
+ *
* <b>Notes: </b>Min Value: 1; Max Value: 100
*/
public void setChoiceSet( List<Choice> choiceSet ) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java
index d5a417090..36adc2857 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java
@@ -12,6 +12,9 @@ import com.smartdevicelink.proxy.RPCResponse;
* @since SmartDeviceLink 1.0
*/
public class CreateInteractionChoiceSetResponse extends RPCResponse {
+ /**
+ * Constructs a new CreateInteractionChoiceSetResponse object
+ */
public CreateInteractionChoiceSetResponse() {
super(FunctionID.CREATE_INTERACTION_CHOICE_SET.toString());
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DIDResult.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DIDResult.java
index 0420aac2c..84afe2a70 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DIDResult.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DIDResult.java
@@ -4,12 +4,56 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataResultCode;
+/** Individual requested DID result and data.
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th> Additional</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>resultCode</td>
+ * <td>VehicleDataResultCode</td>
+ * <td>true</td>
+ * <td></td>
+ * <td>Individual DID result code </td>
+ * </tr>
+ * <tr>
+ * <td>didLocation</td>
+ * <td>Integer</td>
+ * <td>true</td>
+ * <td>minvalue = 0 maxvalue = 65535 </td>
+ * <td>The address of DID location from the ReadDID request.</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>data</td>
+ * <td>String</td>
+ * <td>false</td>
+ * <td>maxlength = 5000 </td>
+ * <td>The DID data which is the hex byte string of however many bytes are stored at that location</td>
+ * </tr>
+ * </table>
+ * @since SmartDeviceLink 1.0
+ *
+ * @see VehicleDataResultCode
+ * @see ReadDID
+ */
public class DIDResult extends RPCStruct {
public static final String KEY_RESULT_CODE = "resultCode";
public static final String KEY_DATA = "data";
public static final String KEY_DID_LOCATION = "didLocation";
-
+ /** <p>Constructs a new DIDResult object indicated by the Hashtable
+ * parameter</p>
+ * @param hash
+ * The hash table to use
+ */
+
public DIDResult() {}
public DIDResult(Hashtable<String, Object> hash) {
super(hash);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DTC.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DTC.java
index e7128d65e..e8ff471d8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DTC.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DTC.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.RPCStruct;
/**
* String containing hexadecimal identifier as well as other common names.
- * <p><b>Parameter List
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommand.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommand.java
index bf32d6996..635f85814 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommand.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommand.java
@@ -6,14 +6,47 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
/**
- * Removes a command from the Command Menu
- * <p>
- * <b>HMI Status Requirements:</b><br/>
- * HMILevel: FULL, LIMITED or BACKGROUND<br/>
- * AudioStreamingState: N/A<br/>
- * SystemContext: Should not be attempted when VRSESSION or MENU
- * </p>
+ * Removes a command from the Command Menu.
*
+ * <p><b>HMI Status Requirements:</b></p>
+ * <p>HMILevel: FULL, LIMITED or BACKGROUND</p>
+ * AudioStreamingState: N/A
+ * <p>SystemContext: Should not be attempted when VRSESSION or MENU</p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>cmdID</td>
+ * <td>Integer</td>
+ * <td>Unique ID that identifies the Command to be deleted from Command Menu</td>
+ * <td>Y</td>
+ * <td>Min Value: 0;Max Value: 2000000000</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * </table>
+ *
+ *<p><b> Response:</b></p>
+ *
+ * Indicates that the corresponding request either failed or succeeded. If the response returns with a SUCCESS result code,this means a command was removed from the Command Menu successfully.
+ *
+ *<p><b> Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p> GENERIC_ERROR</p>
+ * <p>REJECTED</p>
+ * <p> INVALID_ID</p>
+ * <p> IN_USER</p>
* @since SmartDeviceLink 1.0
* @see AddCommand
* @see AddSubMenu
@@ -31,7 +64,7 @@ public class DeleteCommand extends RPCRequest {
/**
* Constructs a new DeleteCommand object indicated by the Hashtable
* parameter
- * <p>
+ *
*
* @param hash
* The Hashtable to use
@@ -54,8 +87,8 @@ public class DeleteCommand extends RPCRequest {
*
* @param cmdID
* an Integer value representing Command ID
- * <p>
- * <b>Notes: </b>Min Value: 0; Max Value: 2000000000
+ *
+ * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000</p>
*/
public void setCmdID( Integer cmdID ) {
if (cmdID != null) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java
index b6bcc9e7d..ad905b1e0 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java
@@ -6,11 +6,14 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
/**
- * Delete Command Response is sent, when DeleteCommand has been called
+ * Delete Command Response is sent, when DeleteCommand has been called.
*
* @since SmartDeviceLink 1.0
*/
public class DeleteCommandResponse extends RPCResponse {
+ /** Constructs a new DeleteCommandResponse object
+ *
+ */
public DeleteCommandResponse() {
super(FunctionID.DELETE_COMMAND.toString());
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFile.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFile.java
index b2bc91a99..4d35c6fd3 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFile.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFile.java
@@ -8,8 +8,37 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* Used to delete a file resident on the SDL module in the app's local cache.
* Not supported on first generation SDL vehicles
- * <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 2.0</th>
+ * </tr>
+ * <tr>
+ * <td>SDLFileName</td>
+ * <td>String</td>
+ * <td> File reference name.</td>
+ * <td>Y</td>
+ * <td>maxlength:500</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * </table>
+ *
+ * <p><b>Response </b></p>
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p> SUCCESS</p>
+ * <p> INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY</p>
+ * <p> TOO_MANY_PENDING_REQUESTS</p>
+ * <p> APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>REJECTED</p>
* @since SmartDeviceLink 2.0
* @see PutFile
* @see ListFiles
@@ -25,8 +54,8 @@ public class DeleteFile extends RPCRequest {
}
/**
- * Constructs a new DeleteFile object indicated by the Hashtable parameter
- * <p>
+ * <p>Constructs a new DeleteFile object indicated by the Hashtable parameter</p>
+ *
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
index ad54b2a14..9916b95dc 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
@@ -12,6 +12,9 @@ import com.smartdevicelink.proxy.RPCResponse;
*/
public class DeleteFileResponse extends RPCResponse {
public static final String KEY_SPACE_AVAILABLE = "spaceAvailable";
+ /** Constructs a new DeleteFileResponse object
+ *
+ */
public DeleteFileResponse() {
super(FunctionID.DELETE_FILE.toString());
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
index 0d7d610d7..87f8cdbc3 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
@@ -10,12 +10,50 @@ import com.smartdevicelink.proxy.RPCRequest;
* interactionChoiceSetID. If the specified interactionChoiceSetID is currently
* in use by an active <i> {@linkplain PerformInteraction}</i> this call to
* delete the Choice Set will fail returning an IN_USE resultCode
- * <p>
- * Function Group: Base
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUD</b><br/>
- * </p>
*
+ * <p>Function Group: Base</p>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUD</b></p>
+ *
+ * <p>AudioStreamingState: Any</p>
+ *
+ * <p>SystemContext: MAIN, MENU, VR </p>
+ *
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>interactionChoiceSetID</td>
+ * <td>Integer</td>
+ * <td> A unique ID that identifies the Choice Set (specified in a previous call to CreateInteractionChoiceSet)</td>
+ * <td>Y</td>
+ * <td>Min Value: 0 ; Max Value: 2000000000</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * </table>
+ *
+ * <p><b>Response </b></p>
+ *
+ * If a resultCode of "SUCCESS" is returned, the requested choice set has been created and can now be referenced by the application using the value of interactionChoiceSetID provided by the application.
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>REJECTED</p>
+ * <p>INVALID_ID</p>
+
* @since SmartDeviceLink 1.0
* @see CreateInteractionChoiceSet
* @see PerformInteraction
@@ -30,9 +68,9 @@ public class DeleteInteractionChoiceSet extends RPCRequest {
super(FunctionID.DELETE_INTERACTION_CHOICE_SET.toString());
}
/**
- * Constructs a new DeleteInteractionChoiceSet object indicated by the
- * Hashtable parameter
- * <p>
+ * <p>Constructs a new DeleteInteractionChoiceSet object indicated by the
+ * Hashtable parameter</p>
+ *
*
* @param hash
* The Hashtable to use
@@ -50,8 +88,7 @@ public class DeleteInteractionChoiceSet extends RPCRequest {
/**
* Sets a unique ID that identifies the Choice Set
* @param interactionChoiceSetID a unique ID that identifies the Choice Set
- * <p>
- * <b>Notes: </b>Min Value: 0; Max Value: 2000000000
+ * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000 </p>
*/
public void setInteractionChoiceSetID( Integer interactionChoiceSetID ) {
if (interactionChoiceSetID != null) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
index bd7fc216b..aac605f51 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
@@ -6,13 +6,46 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
/**
- * Deletes a submenu from the Command Menu
- * <p>
- * <b>Notes: </b>When an app deletes a submenu that has child commands, those
- * child commands are also deleted
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * </p>
+ * Deletes a submenu from the Command Menu.
+ *
+ * <p><b>Notes: </b>When an app deletes a submenu that has child commands, those
+ * child commands are also deleted</p>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>menuID</td>
+ * <td>Integer</td>
+ * <td>Unique ID that identifies the SubMenu to be delete</td>
+ * <td>Y</td>
+ * <td>Min Value: 0; Max Value: 2000000000</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * </table>
+ *
+ *<p> <b>Response </b></p>
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ *<p>SUCCESS</p>
+ *<p> INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY</p>
+ * <p> TOO_MANY_PENDING_REQUESTS</p>
+ * <p> APPLICATION_NOT_REGISTERED</p>
+ * <p> GENERIC_ERROR</p>
+ * <p> REJECTED</p>
+ * <p> INVALID_ID</p>
+ * <p> IN_USE </p>
*
* @since SmartDeviceLink 1.0
* @see AddCommand
@@ -28,7 +61,7 @@ public class DeleteSubMenu extends RPCRequest {
super(FunctionID.DELETE_SUB_MENU.toString());
}
/**
- * Constructs a new DeleteSubMenu object indicated by the Hashtable parameter<p>
+ * Constructs a new DeleteSubMenu object indicated by the Hashtable parameter
* @param hash The Hashtable to use
*/
public DeleteSubMenu(Hashtable<String, Object> hash) {
@@ -44,8 +77,8 @@ public class DeleteSubMenu extends RPCRequest {
/**
* Sets the MenuID that identifies the SubMenu to be delete
* @param menuID an Integer value representing menuID that identifies the SubMenu to be delete
- * <p>
- * <b>Notes: </b>Min Value: 0; Max Value: 2000000000
+ *
+ * <p><b>Notes: </b>Min Value: 0; Max Value: 2000000000</p>
*/
public void setMenuID( Integer menuID ) {
if (menuID != null) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java
index c13e37131..3e2c36dd4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java
@@ -11,6 +11,9 @@ import com.smartdevicelink.proxy.RPCResponse;
* @since SmartDeviceLink 1.0
*/
public class DeleteSubMenuResponse extends RPCResponse {
+ /**
+ * Constructs a new DeleteSubMenuResponse object
+ */
public DeleteSubMenuResponse() {
super(FunctionID.DELETE_SUB_MENU.toString());
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java
index e57af4159..b7d8ea5cf 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java
@@ -3,7 +3,73 @@ package com.smartdevicelink.proxy.rpc;
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
-
+/**
+ * Various information about connecting device.
+ *
+ *
+ *
+ * <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>Version</th>
+ * </tr>
+ * <tr>
+ * <td>hardware</td>
+ * <td>String</td>
+ * <td>Device model</td>
+ * <td>N</td>
+ * <td>Max Length: 500</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>firmwareRev</td>
+ * <td>String</td>
+ * <td>Device firmware revision</td>
+ * <td>N</td>
+ * <td>Max Length: 500</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>os</td>
+ * <td>String</td>
+ * <td>Device OS version</td>
+ * <td>N</td>
+ * <td>Max Length: 500</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>osVersion</td>
+ * <td>String</td>
+ * <td>Device OS version</td>
+ * <td>N</td>
+ * <td>Max Length: 500</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>carrier</td>
+ * <td>String</td>
+ * <td>Device mobile carrier (if applicable)</td>
+ * <td>N</td>
+ * <td>Max Length: 500</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>maxNumberRFCOMMPorts</td>
+ * <td>Integer</td>
+ * <td>Omitted if connected not via BT.</td>
+ * <td>N</td>
+ * <td>Min Value: 0; Max Value: 100</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * </table>
+ *
+ */
public class DeviceInfo extends RPCStruct{
public static final String KEY_HARDWARE = "hardware";
public static final String KEY_FIRMWARE_REV = "firmwareRev";
@@ -11,7 +77,16 @@ public class DeviceInfo extends RPCStruct{
public static final String KEY_OS_VERSION = "osVersion";
public static final String KEY_CARRIER = "carrier";
public static final String KEY_MAX_NUMBER_RFCOMM_PORTS = "maxNumberRFCOMMPorts";
- public static final String DEVICE_OS = "Android";
+ public static final String DEVICE_OS = "Android";
+
+ /** Constructs a new DeviceInfo object indicated by the Hashtable
+ * parameter
+ * @param hash
+ *
+ * The hash table to use
+ *
+ *
+ */
public DeviceInfo() { }
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceStatus.java
index ca110a8b3..51d5304b4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceStatus.java
@@ -8,7 +8,7 @@ import com.smartdevicelink.proxy.rpc.enums.PrimaryAudioSource;
/**
* Describes the status related to a connected mobile device or SDL and if or how it is represented in the vehicle.
- * <p><b>Parameter List
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -95,6 +95,11 @@ import com.smartdevicelink.proxy.rpc.enums.PrimaryAudioSource;
* </tr>
* </table>
* @since SmartDeviceLink 2.0
+ *
+ * @see DeviceLevelStatus
+ * @see GetVehicleData
+ * @see OnVehicleData
+ *
*/
public class DeviceStatus extends RPCStruct {
public static final String KEY_VOICE_REC_ON = "voiceRecOn";
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
index e5b8e8c45..0a0d8f997 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
@@ -5,20 +5,81 @@ import java.util.List;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
+/** Non periodic vehicle diagnostic request.
+ *
+ * <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>Version</th>
+ * </tr>
+ * <tr>
+ * <td>targetID</td>
+ * <td>Integer</td>
+ * <td>Name of target ECU.</td>
+ * <td>Y</td>
+ * <td>Min Value: 0; Max Value: 65535</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>messageLength</td>
+ * <td>Integer</td>
+ * <td>Length of message (in bytes).</td>
+ * <td>Y</td>
+ * <td>Min Value: 0; Max Value:65535</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>messageData</td>
+ * <td>Integer</td>
+ * <td>Array of bytes comprising CAN message.</td>
+ * <td>Y</td>
+ * <td>Min Value: 0; Max Value:255; Min Size:1; Max Size:65535</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * </table>
+ * <p><b>HMI must:</b> </p>
+ *
+ * <p>1. Check the requested data using provided information of targetID (name of ECU),messageLength and messageData.</p>
+ * <p> 2. Respond with one of the appropriate result codes.And in case of SUCCESS return messageDataResult which is an array of bytes comprising CAN message result.</p>
+ * @since SmartDeviceLink 3.0
+ *
+ */
public class DiagnosticMessage extends RPCRequest {
public static final String KEY_TARGET_ID = "targetID";
public static final String KEY_MESSAGE_LENGTH = "messageLength";
public static final String KEY_MESSAGE_DATA = "messageData";
+ /**
+ * Constructs a new DiagnosticMessage object
+ */
public DiagnosticMessage() {
super(FunctionID.DIAGNOSTIC_MESSAGE.toString());
}
+ /**
+ * <p>
+ * Constructs a new DiagnosticMessage object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
public DiagnosticMessage(Hashtable<String, Object> hash) {
super(hash);
}
+ /** Sets TargetID
+ *
+ * @param targetID
+ */
+
public void setTargetID(Integer targetID) {
if (targetID != null) {
parameters.put(KEY_TARGET_ID, targetID);
@@ -26,6 +87,14 @@ public class DiagnosticMessage extends RPCRequest {
parameters.remove(KEY_TARGET_ID);
}
}
+ /**
+ * <p>
+ * Returns an <i>Integer</i> object representing the Target ID that you want to add
+ * </p>
+ *
+ * @return Integer -an integer representation a Unique Target ID
+ */
+
public Integer getTargetID() {
return (Integer) parameters.get(KEY_TARGET_ID);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
index 57e5bc98b..8cb0bc8d4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
@@ -5,9 +5,16 @@ import java.util.List;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
-
+/**
+ * Diagnostic Message Response is sent, when DiagnosticMessage has been called.
+ *
+ * @since SmartDeviceLink 3.0
+ */
public class DiagnosticMessageResponse extends RPCResponse {
public static final String KEY_MESSAGE_DATA_RESULT = "messageDataResult";
+ /**
+ * Constructs a new DiagnosticMessageResponse object
+ */
public DiagnosticMessageResponse() {
super(FunctionID.DIAGNOSTIC_MESSAGE.toString());
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumber.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumber.java
index 76fbc02d1..4651e1f20 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumber.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumber.java
@@ -28,7 +28,7 @@ public class DialNumber extends RPCRequest {
* @param number
* a phone number is a string, which can be up to 40 chars.
* <p>
- * <b>Notes: </b>Maxlength=40<p>
+ * <b>Notes: </b>Maxlength=40</p>
* All characters shall be stripped from string except digits 0-9 and * # , ; +
*/
public void setNumber(String number) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
index 1a44ad601..f0739e371 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
@@ -10,7 +10,7 @@ import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
import com.smartdevicelink.util.DebugTool;
/**
* Contains information about the display for the SDL system to which the application is currently connected.
- * <p><b> Parameter List
+ * <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -47,6 +47,11 @@ import com.smartdevicelink.util.DebugTool;
* </tr>
* </table>
* @since SmartDeviceLink 1.0
+ * @see DisplayType
+ * @see MediaClockFormat
+ * @see TextFieldName
+ * @see ImageType
+ *
*/
public class DisplayCapabilities extends RPCStruct {
public static final String KEY_DISPLAY_TYPE = "displayType";
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ECallInfo.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ECallInfo.java
index 21173c487..88eb89e03 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ECallInfo.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ECallInfo.java
@@ -5,12 +5,62 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.ECallConfirmationStatus;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataNotificationStatus;
+/** Emergency Call notification and confirmation data.
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>eCallNotificationStatus</td>
+ * <td>VehicleDataNotificationStatus</td>
+ * <td>References signal "eCallNotification_4A".</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>auxECallNotificationStatus</td>
+ * <td>VehicleDataNotificationStatus</td>
+ * <td>References signal "eCallNotification". This is an alternative signal available on some carlines replacing the eCallNotificationStatus, but showing the same values.</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>eCallConfirmationStatus</td>
+ * <td>ECallConfirmationStatus</td>
+ * <td>References signal "eCallConfirmation"</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * </table>
+ * @since SmartDeviceLink 2.0
+ * @see SubscribeVehicleData
+ *
+ *
+ * @see TextFieldName
+ * @see Image
+ *
+ */
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>
+ */
public ECallInfo() { }
public ECallInfo(Hashtable<String, Object> hash) {
super(hash);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EmergencyEvent.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EmergencyEvent.java
index 77fa72e5b..5e1f2ede1 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EmergencyEvent.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EmergencyEvent.java
@@ -6,6 +6,67 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.EmergencyEventType;
import com.smartdevicelink.proxy.rpc.enums.FuelCutoffStatus;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
+/** Information related to an emergency event (and if it occurred).
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>emergencyEventType</td>
+ * <td>EmergencyEventType</td>
+ * <td></td>
+ * <td>References signal "VedsEvntType_D_Ltchd". See{@linkplain EmergencyEventType}</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>fuelCutoffStatus</td>
+ * <td>FuelCutoffStatus</td>
+ * <td></td>
+ * <td>References signal "RCM_FuelCutoff". See{@linkplain FuelCutoffStatus}</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>rolloverEvent</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td></td>
+ * <td>References signal "VedsEvntRoll_D_Ltchd". See{@linkplain VehicleDataEventStatus}</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>maximumChangeVelocity</td>
+ * <td>Integer</td>
+ * <td></td>
+ * <td>References signal "VedsMaxDeltaV_D_Ltchd".</td>
+ * <td>minvalue=0; maxvalue=255;<p> Additional reserved values:</p> <p>0x00 No event; 0xFE Not supported; 0xFF Fault</p> </td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ *
+ * <tr>
+ * <td>multipleEvents</td>
+ * <td>VehicleDataEventStatus</td>
+ * <td></td>
+ * <td>References signal "VedsMultiEvnt_D_Ltchd". See{@linkplain VehicleDataEventStatus}</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * </table>
+ *
+ * @see Image
+ * @see SubscribeVehicleData
+ * @since SmartDeviceLink 2.0
+ *
+ */
public class EmergencyEvent extends RPCStruct {
public static final String KEY_EMERGENCY_EVENT_TYPE = "emergencyEventType";
@@ -13,6 +74,13 @@ 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>
+ */
public EmergencyEvent() { }
public EmergencyEvent(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java
index 8a6793691..ab61c548e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java
@@ -7,11 +7,24 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* When this request is invoked, the audio capture stops
- * <p>
- * Function Group: AudioPassThru
- * <p>
+ *
+ * <p>Function Group: AudioPassThru</p>
+ *
* <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * </p>
+ *
+ * <p><b>Request</b></p>
+ *
+ * <p>No parameters.</p>
+ * <p><b>Response</b> </p>
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>REJECTED</p>
+ * <p>DISALLOWED</p>
* @since SmartDeviceLink 2.0
* @see PerformAudioPassThru
*/
@@ -25,9 +38,9 @@ public class EndAudioPassThru extends RPCRequest {
}
/**
- * Constructs a new EndAudioPassThru object indicated by the Hashtable
- * parameter
- * <p>
+ * <p>Constructs a new EndAudioPassThru object indicated by the Hashtable
+ * parameter</p>
+ *
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GPSData.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GPSData.java
index e21f694c1..d76b11355 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GPSData.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GPSData.java
@@ -8,7 +8,7 @@ import com.smartdevicelink.proxy.rpc.enums.Dimension;
import com.smartdevicelink.util.SdlDataTypeConverter;
/**
* Describes the GPS data. Not all data will be available on all carlines.
- * <p><b>Parameter List
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -55,21 +55,21 @@ import com.smartdevicelink.util.SdlDataTypeConverter;
* <tr>
* <td>utcHours</td>
* <td>Integer</td>
- * <td>Minvalue: 1<b>Maxvalue: 23
+ * <td>Minvalue: 0<b>Maxvalue: 23
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
* <tr>
* <td>utcMinutes</td>
* <td>Integer</td>
- * <td>Minvalue: 1<b>Maxvalue: 59
+ * <td>Minvalue: 0<b>Maxvalue: 59
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
* <tr>
* <td>utcSeconds</td>
* <td>Integer</td>
- * <td>Minvalue: 1<b>Maxvalue: 59
+ * <td>Minvalue: 0<b>Maxvalue: 59
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
@@ -115,9 +115,9 @@ import com.smartdevicelink.util.SdlDataTypeConverter;
* <td>altitude</td>
* <td>Integer</td>
* <td>Altitude in meters
- * <b>Minvalue: -10000
- * <b>Maxvalue: 10000
- * </td>
+ * <b>Minvalue: -10000</b>
+ * <b>Maxvalue: 10000</b>
+ * <b>Note:</b> SYNC uses Mean Sea Level for calculating GPS. </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
* <tr>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GenericResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GenericResponse.java
index e231dd04d..4618fd857 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GenericResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GenericResponse.java
@@ -9,7 +9,43 @@ import com.smartdevicelink.proxy.RPCResponse;
* 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.
-*/
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>success</td>
+ * <td>Boolean</td>
+ * <td>true, if successful; false, if failed</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>resultCode</td>
+ * <td>Result</td>
+ * <td>Defines the possible result codes returned by SDL to the application in a Response to a requested operation</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>info</td>
+ * <td>String</td>
+ * <td>Provides additional human readable info regarding the result.</td>
+ * <td>N</td>
+ * <td>maxlength=1000</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * </table>
+ * @since SmartDeviceLink 1.0
+ */
public class GenericResponse extends RPCResponse {
public GenericResponse() {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCs.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCs.java
index 967c62cbb..fa3ba1c01 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCs.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCs.java
@@ -7,12 +7,52 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* This RPC allows to request diagnostic module trouble codes from a certain
- * vehicle module
- * <p>
- * Function Group: ProprietaryData
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * <p>
+ * vehicle module.
+ *
+ *<p> Function Group: ProprietaryData</p>
+ *
+ *<p> <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>ecuName</td>
+ * <td>Integer</td>
+ * <td>Name of ECU.</td>
+ * <td>Y</td>
+ * <td>Min Value: 0; Max Value: 65535</td>
+ * <td>SmartDeviceLink 2.0 </td>
+ * </tr>
+ * <tr>
+ * <td>dtcMask</td>
+ * <td>Integer</td>
+ * <td>DTC Mask Byte to be sent in diagnostic request to module.</td>
+ * <td>N</td>
+ * <td>Min Value: 0; Max Value: 255</td>
+ * <td>SmartDeviceLink 2.0 </td>
+ * </tr>
+ * </table>
+ * <p><b>Response</b></p>
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ *<p> SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ *<p> OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ *<p>GENERIC_ERROR</p>
+ * <p>REJECTED</p>
+ * <p>DISALLOWED </p>
+ * <p>USER_DISALLOWED</p>
+ * @since SmartDeviceLink 2.0
*/
public class GetDTCs extends RPCRequest {
public static final String KEY_DTC_MASK = "dtcMask";
@@ -26,8 +66,8 @@ public class GetDTCs extends RPCRequest {
}
/**
- * Constructs a new GetDTCs object indicated by the Hashtable parameter
- * <p>
+ * <p>Constructs a new GetDTCs object indicated by the Hashtable parameter
+ * </p>
*
* @param hash
* The Hashtable to use
@@ -43,7 +83,7 @@ public class GetDTCs extends RPCRequest {
* an Integer value representing a name of the module to receive
* the DTC form
* <p>
- * <b>Notes: </b>Minvalue:0; Maxvalue:65535
+ * <b>Notes:</p> </b>Minvalue:0; Maxvalue:65535
*/
public void setEcuName(Integer ecuName) {
if (ecuName != null) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleData.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleData.java
index b3d2e6189..0c15c02c9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleData.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleData.java
@@ -4,7 +4,202 @@ import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
-
+/**
+ * Non periodic vehicle data read request.
+ *
+ * <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>Version</th>
+ * </tr>
+ * <tr>
+ * <td>gps</td>
+ * <td>Boolean</td>
+ * <td>GPS data. See {@linkplain GPS data }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>vin</td>
+ * <td>Boolean</td>
+ * <td>Vehicle identification number</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>
+ * </table>
+ *
+ *
+ * <p><b>Response</b></p>
+ *
+ * <p> <b>Non-default Result Codes:</b></p>
+ * <p> SUCCESS</p>
+ * <p> INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p> GENERIC_ERROR</p>
+ * <p> REJECTED</p>
+ * <p> VEHICLE_DATA_NOT_ALLOWED</p>
+ * <p>VEHICLE_DATA_NOT_AVAILABLE</p>
+ * <p> USER_DISALLOWED</p>
+ *
+ * @see SubscribeVehicleData
+ * @see UnSubscribeVehicleData
+ * @since SmartDeviceLink 2.0
+ *
+ *
+ */
public class GetVehicleData extends RPCRequest {
public static final String KEY_SPEED = "speed";
public static final String KEY_RPM = "rpm";
@@ -31,10 +226,23 @@ public class GetVehicleData extends RPCRequest {
public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
public static final String KEY_MY_KEY = "myKey";
+ /**
+ * Constructs a new GetVehicleData object
+ */
public GetVehicleData() {
super(FunctionID.GET_VEHICLE_DATA.toString());
}
+ /**
+ * <p>
+ * Constructs a new GetVehicleDta object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
+
public GetVehicleData(Hashtable<String, Object> hash) {
super(hash);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
index 3ae2b54d8..51eb7a4b7 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
@@ -12,6 +12,11 @@ import com.smartdevicelink.proxy.rpc.enums.WiperStatus;
import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.SdlDataTypeConverter;
+/**
+ * Get Vehicle Data Response is sent, when GetVehicleData has been called.
+ *
+ * @since SmartDeviceLink 2.0
+ */
public class GetVehicleDataResponse extends RPCResponse {
public static final String KEY_SPEED = "speed";
public static final String KEY_RPM = "rpm";
@@ -39,6 +44,9 @@ public class GetVehicleDataResponse extends RPCResponse {
public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
public static final String KEY_MY_KEY = "myKey";
+ /**
+ * Constructs a new GetVehicleDataResponse object
+ */
public GetVehicleDataResponse() {
super(FunctionID.GET_VEHICLE_DATA.toString());
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HMIPermissions.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HMIPermissions.java
index 629fb7b79..d8223279a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HMIPermissions.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HMIPermissions.java
@@ -8,7 +8,7 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
/**
* Defining sets of HMI levels, which are permitted or prohibited for a given RPC.
- * <p><b>Parameter List
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -30,7 +30,7 @@ import com.smartdevicelink.proxy.rpc.enums.HMILevel;
* <tr>
* <td>userDisallowed</td>
* <td>HMILevel</td>
- * <td>A set of all HMI levels that are prohibated for this given RPC.
+ * <td>A set of all HMI levels that are prohibited for this given RPC.
* <ul>
* <li>Min: 0</li>
* <li>Max: 100</li>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HeadLampStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HeadLampStatus.java
index 70f3fd76f..46a982fe2 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HeadLampStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HeadLampStatus.java
@@ -4,11 +4,51 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
+/** Status of the head lamps.
+ *
+ * <p><table border="1" rules="all"></p>
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>lowBeamsOn</td>
+ * <td>Boolean</td>
+ * <td>true</td>
+ * <td>Status of the low beam lamps. </td>
+ * </tr>
+ * <tr>
+ * <td>highBeamsOn</td>
+ * <td>Boolean</td>
+ * <td>true</td>
+ * <td>Status of the high beam lamps. </td>
+ * </tr>
+ * <tr>
+ * <td>ambientLightSensorStatus</td>
+ * <td>AmbientLightStatus</td>
+ * <td>true</td>
+ * <td>Status of the ambient light sensor.</td>
+ * </tr>
+ *
+ *
+ * </table>
+ * @see OnVehicleData
+ * @see GetVehicleData
+ * @since SmartDeviceLink 1.0
+ *
+ */
public class HeadLampStatus extends RPCStruct {
public static final String KEY_AMBIENT_LIGHT_SENSOR_STATUS = "ambientLightSensorStatus";
public static final String KEY_HIGH_BEAMS_ON = "highBeamsOn";
public static final String KEY_LOW_BEAMS_ON = "lowBeamsOn";
+ /**<p> Constructs a new HeadLampStatus object indicated by the Hashtable
+ * parameter</p>
+ * @param hash
+ * The hash table to use
+ */
public HeadLampStatus() {}
public HeadLampStatus(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Headers.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Headers.java
index 0e72ff6e3..2be4f1a17 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Headers.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Headers.java
@@ -3,6 +3,11 @@ package com.smartdevicelink.proxy.rpc;
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
+/**
+ *
+ * @since SmartDeviceLink 3.0
+ *
+ */
public class Headers extends RPCStruct {
public static final String KEY_CONTENT_TYPE = "ContentType";
@@ -17,7 +22,16 @@ public class Headers extends RPCStruct {
public static final String KEY_CONTENT_LENGTH = "Content-Length";
public Headers() { }
-
+ /**
+ * <p>
+ * Constructs a new Headers object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
+
public Headers(Hashtable<String, Object> hash) {
super(hash);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Image.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Image.java
index d46607923..76ad2d224 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Image.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Image.java
@@ -7,7 +7,7 @@ import com.smartdevicelink.proxy.rpc.enums.ImageType;
/**
*Specifies, which image shall be used, e.g. in Alerts or on Softbuttons provided the display supports it.
- *<p><b>Parameter List
+ *<p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageField.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageField.java
index 528b23425..9e38dc264 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageField.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageField.java
@@ -8,6 +8,53 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
import com.smartdevicelink.util.DebugTool;
+/** <p>The name that identifies the field.For example AppIcon,SoftButton, LocationImage, etc.</p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th> Version</th>
+ * </tr>
+ * <tr>
+ * <td>name</td>
+ * <td>ImageFieldName</td>
+ * <td>The name that identifies the field.{@linkplain ImageFieldName}</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>imageTypeSupported</td>
+ * <td>FileType</td>
+ * <td>The image types that are supported in this field. {@linkplain FileType}</td>
+ * <td></td>
+ * <td>maxlength: 100</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>imageResolution</td>
+ * <td>ImageResolution</td>
+ * <td>The image resolution of this field.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * </table>
+ * @since SmartDeviceLink 3.0
+ * @see DisplayType
+ * @see MediaClockFormat
+ * @see TextFieldName
+ * @see ImageType
+ *
+ *
+ *
+ *
+ */
public class ImageField extends RPCStruct {
public static final String KEY_IMAGE_TYPE_SUPPORTED = "imageTypeSupported";
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageResolution.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageResolution.java
index 4242a09f1..682092082 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageResolution.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageResolution.java
@@ -3,13 +3,60 @@ package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
+/** The image resolution of this field.
+ *
+ * <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>Version</th>
+ * </tr>
+ * <tr>
+ * <td>resolutionWidth</td>
+ * <td>Integer</td>
+ * <td>The image resolution width.</td>
+ * <td></td>
+ * <td>minvalue:1; maxvalue: 10000</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>resolutionHeight</td>
+ * <td>Integer</td>
+ * <td>The image resolution height.</td>
+ * <td></td>
+ * <td>minvalue:1; maxvalue: 10000</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ *
+ * </table>
+ * @since SmartDeviceLink 3.0
+ * @see DisplayType
+ * @see MediaClockFormat
+ * @see TextFieldName
+ * @see ImageType
+ *
+ */
public class ImageResolution extends RPCStruct {
public static final String KEY_RESOLUTION_WIDTH = "resolutionWidth";
public static final String KEY_RESOLUTION_HEIGHT = "resolutionHeight";
public ImageResolution() {}
-
+ /**
+ * <p>
+ * Constructs a new ImageResolution object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
+
public ImageResolution(Hashtable<String, Object> hash) {
super(hash);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/KeyboardProperties.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/KeyboardProperties.java
index 4e5652581..fb35dcf24 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/KeyboardProperties.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/KeyboardProperties.java
@@ -7,6 +7,66 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
+/** This mode causes the interaction to immediately display a keyboard entry through the HMI.
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th> Additional</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>language</td>
+ * <td>Language</td>
+ * <td>false</td>
+ * <td></td>
+ * <td>The keyboard language. </td>
+ * </tr>
+ * <tr>
+ * <td>keyboardLayout</td>
+ * <td>KeyboardLayout</td>
+ * <td>false</td>
+ * <td></td>
+ * <td>Desired keyboard layout.</td>
+ * </tr>
+ * <tr>
+ * <td>sendDynamicEntry</td>
+ * <td>Boolean</td>
+ * <td>false</td>
+ * <td></td>
+ * <td>In this mode, all keypresses will be sent as they occur. If disabled, entire string of text will be returned only once submitted by user.If omitted, this value will be set to FALSE.</td>
+ * </tr>
+ * <tr>
+ * <td>keypressMode</td>
+ * <td>KeypressMode</td>
+ * <td>False</td>
+ * <td></td>
+ * <td>Desired keypress mode.If omitted, this value will be set to RESEND_CURRENT_ENTRY. </td>
+ * </tr>
+ * <tr>
+ * <td>limitedCharacterList</td>
+ * <td>String</td>
+ * <td>false</td>
+ * <td>Array = true maxlength = 1 minsize = 1 maxsize = 100</td>
+ * <td>Array of keyboard characters to enable. All omitted characters will be greyed out (disabled) on the keyboard. If omitted, the entire keyboard will be enabled.</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>autoCompleteText</td>
+ * <td>String</td>
+ * <td>false</td>
+ * <td>maxlength = 1000 </td>
+ * <td>Allows an app to prepopulate the text field with a suggested or completed entry as the user types.</td>
+ * </tr>
+ * </table>
+ *
+ * @since SmartDeviceLink 3.0
+ *@see ButtonName
+ *
+ */
public class KeyboardProperties extends RPCStruct {
public static final String KEY_KEYPRESS_MODE = "keypressMode";
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFiles.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFiles.java
index f135eaa9e..faeaa7977 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFiles.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFiles.java
@@ -7,9 +7,20 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* Requests the current list of resident filenames for the registered app. Not
- * supported on First generation SDL vehicles
- * <p>
+ * supported on First generation SDL vehicles.
*
+ * <p><b>Request</b></p>
+ * <p>No parameters.</p>
+ * <p><b>Response:</b></p>
+ * Returns the current list of resident filenames for the registered app along with the current space available.
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR </p>
+ * <p>REJECTED</p>
* @since SmartDeviceLink 2.0
*/
public class ListFiles extends RPCRequest {
@@ -22,8 +33,8 @@ public class ListFiles extends RPCRequest {
}
/**
- * Constructs a new ListFiles object indicated by the Hashtable parameter
- * <p>
+ * <p>Constructs a new ListFiles object indicated by the Hashtable parameter
+ * </p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MenuParams.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MenuParams.java
index 065a8f1ac..a9f22238a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MenuParams.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MenuParams.java
@@ -5,7 +5,7 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
/**
* Used when adding a sub menu to an application menu or existing sub menu.
- * <p><b> Parameter List
+ * <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -15,7 +15,7 @@ import com.smartdevicelink.proxy.RPCStruct;
* </tr>
* <tr>
* <td>parentID</td>
- * <td>Int32</td>
+ * <td>Integer</td>
* <td>The unique ID of an existing submenu to which a command will be added.
* If this element is not provided, the command will be added to the top level of the Command Menu.
* <ul>
@@ -25,9 +25,9 @@ import com.smartdevicelink.proxy.RPCStruct;
* </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
- * <tr>
+ * <tr>
* <td>position</td>
- * <td>Int16</td>
+ * <td>Integer</td>
* <td>Position within the items of the parent Command Menu. 0 will insert at the front, 1 will insert after the first existing element, etc.
* Position of any submenu will always be located before the return and exit options.
* <ul>
@@ -52,6 +52,8 @@ import com.smartdevicelink.proxy.RPCStruct;
* </tr>
* </table>
* @since SmartDeviceLink 1.0
+ * @see AddCommand
+ * @see AddSubMenu
*/
public class MenuParams extends RPCStruct {
public static final String KEY_PARENT_ID = "parentID";
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MyKey.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MyKey.java
index 96d05dcec..4936f9fec 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MyKey.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MyKey.java
@@ -4,9 +4,43 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus;
+/** Information related to the MyKey feature.
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>e911Override</td>
+ * <td>VehicleDataStatus</td>
+ * <td>true</td>
+ * <td>Indicates whether e911 override is on.</td>
+ * </tr>
+ * </table>
+ *
+ *@since SmartDeviceLink 2.0
+ *
+ *@see GetVehicleData
+ *@see OnVehicleData
+ *@see 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
+ */
public MyKey() { }
public MyKey(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
index 21cb9bc52..af155226e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
@@ -20,7 +20,7 @@ import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
* SystemContext:
* <ul><li>Any</li></ul>
* </ul>
- * <p>
+ * <p></p>
* <b>Parameter List:</b>
* <table border="1" rules="all">
* <tr>
@@ -36,7 +36,6 @@ import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
* <td>SmartDeviceLink 1.0</td>
* </tr>
* </table>
- * </p>
* @since SmartDeviceLink 1.0
* @see RegisterAppInterface
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java
index 421bbd933..40186c63d 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java
@@ -35,7 +35,6 @@ import com.smartdevicelink.proxy.RPCNotification;
* <th>Notes</th>
* <th>SmartDeviceLink Ver Available</th>
* </tr>
-
* </table>
* </p>
*
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonEvent.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
index 3e5bf33f4..7f9afb627 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
@@ -9,7 +9,7 @@ import com.smartdevicelink.proxy.rpc.enums.ButtonName;
/**
* Notifies application that user has depressed or released a button to which
- * the application has subscribed.</br> Further information about button events
+ * the application has subscribed.Further information about button events
* and button-presses can be found at {@linkplain SubscribeButton}.
* <p>
* </p>
@@ -36,7 +36,7 @@ import com.smartdevicelink.proxy.rpc.enums.ButtonName;
* button will cancel VR.</li>
* </ul>
* </ul>
- * <p>
+ * <p></p>
* <b>Parameter List:</b>
* <table border="1" rules="all">
* <tr>
@@ -66,14 +66,14 @@ import com.smartdevicelink.proxy.rpc.enums.ButtonName;
* <tr>
* <td>customButtonID</td>
* <td>Integer</td>
- * <td>If ButtonName is ��CUSTOM_BUTTON", this references the integer ID passed
+ * <td>If ButtonName is CUSTOM_BUTTON", this references the integer ID passed
* by a custom button. (e.g. softButton ID)</td>
* <td>N</td>
* <td>Minvalue=0 Maxvalue=65536</td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
* </table>
- * </p>
+ * <p></p>
*
* @since SmartDeviceLink 1.0
*
@@ -142,7 +142,7 @@ public class OnButtonEvent extends RPCNotification {
return null;
}
/**
- * <p> Set the event mode of the button,pressed or released
+ * <p> Set the event mode of the button,pressed or released</p>
* @param buttonEventMode indicates the button is pressed or released
* @see ButtonEventMode
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonPress.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonPress.java
index 2d48b9635..c881cc297 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonPress.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonPress.java
@@ -74,7 +74,7 @@ import com.smartdevicelink.proxy.rpc.enums.ButtonPressMode;
* <tr>
* <td>customButtonID</td>
* <td>Integer</td>
- * <td>If ButtonName is ��CUSTOM_BUTTON", this references the integer ID passed
+ * <td>If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed
* by a custom button. (e.g. softButton ID)</td>
* <td>N</td>
* <td>Minvalue=0 Maxvalue=65536</td>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnCommand.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnCommand.java
index 77632b8b2..eae7e77f8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnCommand.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnCommand.java
@@ -32,7 +32,7 @@ import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
* </tr>
* <tr>
* <td>cmdID</td>
- * <td>Int32</td>
+ * <td>Integer</td>
* <td>The cmdID of the command the user selected. This is the cmdID value provided by the application in the AddCommand operation that created the command.</td>
* <td></td>
* <td>SmartDeviceLink 1.0</td>
@@ -99,8 +99,8 @@ public class OnCommand extends RPCNotification {
return null;
}
/**
- * <p>Sets TriggerSource<br/>
- * Indicates whether command was selected via VR or via a menu selection (using the OK button).</p>
+ * <p>Sets TriggerSource</p>
+ * <p>Indicates whether command was selected via VR or via a menu selection (using the OK button).</p>
* @param triggerSource a TriggerSource object
*/
public void setTriggerSource( TriggerSource triggerSource ) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHashChange.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHashChange.java
index e806e5225..776d69e4a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHashChange.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHashChange.java
@@ -4,13 +4,50 @@ import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
-
+/**
+ * Notification containing an updated hashID which can be used over connection cycles (i.e. loss of connection, ignition cycles, etc.).
+ * Sent after initial registration and subsequently after any change in the calculated hash of all persisted app data.
+ * <p></p>
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>hashID</td>
+ * <td>String</td>
+ * <td>Calculated hash ID to be referenced during RegisterAppInterface.</td>
+ * <td>Y</td>
+ * <td>maxlength: 100</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * </table>
+ * @since SmartDeviceLink 3.0
+ *
+ */
public class OnHashChange extends RPCNotification {
public static final String KEY_HASH_ID = "hashID";
+ /**
+ * Constructs a new OnHashChange object
+ */
public OnHashChange() {
super(FunctionID.ON_HASH_CHANGE.toString());
}
+ /**
+ * <p>
+ * Constructs a new OnKeyboardInput object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
public OnHashChange(Hashtable<String, Object> hash) {
super(hash);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
index 4de2acf3f..e71cda0a8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
@@ -6,14 +6,59 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.KeyboardEvent;
+/**
+ * On-screen keyboard event. Can be full string or individual keypresses depending on keyboard mode.
+ * <p></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>Version</th>
+ * </tr>
+ * <tr>
+ * <td>event</td>
+ * <td>KeyboardEvent</td>
+ * <td>On-screen keyboard input data.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 3.0</td>
+ * </tr>
+ * <tr>
+ * <td>data</td>
+ * <td>String</td>
+ * <td>On-screen keyboard input data.For dynamic keypress events, this will be the current compounded string of entry text.For entry cancelled and entry aborted events, this data param will be omitted.</td>
+ * <td></td>
+ * <td>Maxlength: 500</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ *
+ * </table>
+ *
+ */
public class OnKeyboardInput extends RPCNotification {
public static final String KEY_DATA = "data";
public static final String KEY_EVENT = "event";
+ /**
+ * Constructs a new OnKeyboardInput object
+ */
public OnKeyboardInput() {
super(FunctionID.ON_KEYBOARD_INPUT.toString());
}
+ /**
+ * <p>
+ * Constructs a new OnKeyboardInput object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
public OnKeyboardInput(Hashtable<String, Object> hash) {
super(hash);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLockScreenStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLockScreenStatus.java
index 1ad23994c..11f6469ef 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLockScreenStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLockScreenStatus.java
@@ -4,7 +4,15 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus;
-
+import com.smartdevicelink.proxy.rpc.OnHMIStatus;
+/**
+ * The lockscreen must perform the following:
+ * Limit all application control usability from the mobile device with a full-screen static image overlay or separate view.
+ * For simplicity, the OnLockScreenStatus RPC will be provided via the onOnLockScreenNotification call back. The call back will include the LockScreenStatus enum which indicates if the lockscreen is required, optional or not required.
+ * The call back also includes details regarding the current HMI_Status level, driver distraction status and user selection status of the application.
+ *
+ *
+ */
public class OnLockScreenStatus extends RPCNotification {
public static final String KEY_DRIVER_DISTRACTION = "driverDistraction";
public static final String KEY_SHOW_LOCK_SCREEN = "showLockScreen";
@@ -13,7 +21,11 @@ public class OnLockScreenStatus extends RPCNotification {
public OnLockScreenStatus() {
super(FunctionID.ON_LOCK_SCREEN_STATUS.toString());
}
-
+ /**
+ * <p>Get the current driver distraction status(i.e. whether driver distraction rules are in effect, or not)</p>
+ * @return Boolean
+ */
+
public Boolean getDriverDistractionStatus() {
return (Boolean)parameters.get(KEY_DRIVER_DISTRACTION);
}
@@ -26,7 +38,11 @@ public class OnLockScreenStatus extends RPCNotification {
parameters.remove(KEY_DRIVER_DISTRACTION);
}
}
-
+ /**
+ * <p>Get the {@linkplain LockScreenStatus} enumeration, indicating if the lockscreen should be required, optional or off </p>
+ * @return {@linkplain LockScreenStatus}
+ */
+
public LockScreenStatus getShowLockScreen() {
return (LockScreenStatus)parameters.get(KEY_SHOW_LOCK_SCREEN);
}
@@ -38,7 +54,11 @@ public class OnLockScreenStatus extends RPCNotification {
parameters.remove(KEY_SHOW_LOCK_SCREEN);
}
}
-
+ /**
+ * <p>Get user selection status for the application (has the app been selected via hmi or voice command)</p>
+ * @return Boolean the current user selection status
+ */
+
public Boolean getUserSelected() {
return (Boolean)parameters.get(KEY_USER_SELECTED);
}
@@ -50,7 +70,11 @@ public class OnLockScreenStatus extends RPCNotification {
parameters.remove(KEY_USER_SELECTED);
}
}
-
+ /**
+ * <p>Get HMILevel in effect for the application</p>
+ * @return {@linkplain HMILevel} the current HMI Level in effect for the application
+ */
+
public HMILevel getHMILevel() {
return (HMILevel)parameters.get(OnHMIStatus.KEY_HMI_LEVEL);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSystemRequest.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
index fa96cd1cf..a034626a9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
@@ -14,7 +14,70 @@ import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
-
+/**
+ * An asynchronous request from the system for specific data from the device or the cloud or response to a request from the device or cloud. Binary data can be included in hybrid part of message for some requests (such as Authentication request responses)
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>requestType</td>
+ * <td>RequestType</td>
+ * <td>The type of system request.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.3.2 </td>
+ * </tr>
+ * <tr>
+ * <td>url</td>
+ * <td>Array of Strings</td>
+ * <td>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.</td>
+ * <td>N</td>
+ * <td>maxlength: 1000; minsize:1; maxsize: 100</td>
+ * <td>SmartDeviceLink 2.3.2 </td>
+ * </tr>
+ * <tr>
+ * <td>timeout</td>
+ * <td>Integer</td>
+ * <td>Optional timeout for HTTP requests;Required if a URL is provided</td>
+ * <td>N</td>
+ * <td>minvalue:0; maxvalue: 2000000000</td>
+ * <td>SmartDeviceLink </td>
+ * </tr>
+ * <tr>
+ * <td>fileType</td>
+ * <td>FileType</td>
+ * <td>Optional file type (meant for HTTP file requests).</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.3.2 </td>
+ * </tr>
+ * <tr>
+ * <td>offset</td>
+ * <td>Float</td>
+ * <td>Optional offset in bytes for resuming partial data chunks</td>
+ * <td>N</td>
+ * <td>minvalue:0; maxvalue:100000000000</td>
+ * <td>SmartDeviceLink 2.3.2 </td>
+ * </tr>
+ * <tr>
+ * <td>length</td>
+ * <td>Float</td>
+ * <td>Optional length in bytes for resuming partial data chunks</td>
+ * <td>N</td>
+ * <td>minvalue: 0; maxvalue:100000000000</td>
+ * <td>SmartDeviceLink 2.3.2 </td>
+ * </tr>
+ * </table>
+ * @since SmartDeviceLink 2.3.2
+ */
public class OnSystemRequest extends RPCNotification {
public static final String KEY_URL_V1 = "URL";
public static final String KEY_URL = "url";
@@ -29,8 +92,12 @@ 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
+ *
+ */
+
public OnSystemRequest() {
super(FunctionID.ON_SYSTEM_REQUEST.toString());
}
@@ -52,18 +119,32 @@ public class OnSystemRequest extends RPCNotification {
JSONObject httpJson;
String tempBody = null;
Headers tempHeaders = null;
-
- try{
- JSONObject bulkJson = new JSONObject(new String(bulkData));
- httpJson = bulkJson.getJSONObject("HTTPRequest");
- tempBody = getBody(httpJson);
- tempHeaders = getHeaders(httpJson);
- }catch(JSONException e){
- Log.e("OnSystemRequest", "HTTPRequest in bulk data was malformed.");
- e.printStackTrace();
- }catch(NullPointerException e){
- Log.e("OnSystemRequest", "Invalid HTTPRequest object in bulk data.");
- e.printStackTrace();
+ if(RequestType.PROPRIETARY.equals(this.getRequestType())){
+ try{
+ JSONObject bulkJson = new JSONObject(new String(bulkData));
+
+ httpJson = bulkJson.getJSONObject("HTTPRequest");
+ tempBody = getBody(httpJson);
+ tempHeaders = getHeaders(httpJson);
+ }catch(JSONException e){
+ Log.e("OnSystemRequest", "HTTPRequest in bulk data was malformed.");
+ e.printStackTrace();
+ }catch(NullPointerException e){
+ Log.e("OnSystemRequest", "Invalid HTTPRequest object in bulk data.");
+ e.printStackTrace();
+ }
+ }else if(RequestType.HTTP.equals(this.getRequestType())){
+ tempHeaders = new Headers();
+ tempHeaders.setContentType("application/json");
+ tempHeaders.setConnectTimeout(7);
+ tempHeaders.setDoOutput(true);
+ tempHeaders.setDoInput(true);
+ tempHeaders.setUseCaches(false);
+ tempHeaders.setRequestMethod("POST");
+ tempHeaders.setReadTimeout(7);
+ tempHeaders.setInstanceFollowRedirects(false);
+ tempHeaders.setCharset("utf-8");
+ tempHeaders.setContentLength(bulkData.length);
}
this.body = tempBody;
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTouchEvent.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
index 47ecc30a3..bfb31d789 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
@@ -8,13 +8,62 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.rpc.enums.TouchType;
+/**
+ *
+ * Notifies about touch events on the screen's prescribed area.
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>type</td>
+ * <td>TouchType</td>
+ * <td>The type of touch event.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>event</td>
+ * <td>TouchEvent</td>
+ * <td>List of all individual touches involved in this event.</td>
+ * <td>Y</td>
+ * <td>minsize:1; maxsize:10</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * </table>
+ *
+ * <p><b>Note:</b></p>
+ * <p>SDL needs to be informed about every User`s touching the touch screen.</p>
+ *
+ */
public class OnTouchEvent extends RPCNotification {
public static final String KEY_EVENT = "event";
public static final String KEY_TYPE = "type";
-
+ /**
+ * Constructs a new OnTouchEvent object
+ */
+
public OnTouchEvent() {
super(FunctionID.ON_TOUCH_EVENT.toString());
}
+ /**
+ * <p>
+ * Constructs a new OnTouchEvent object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
+
public OnTouchEvent(Hashtable<String, Object> hash) {
super(hash);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnVehicleData.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnVehicleData.java
index ec50e659e..1a6baefef 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnVehicleData.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnVehicleData.java
@@ -10,7 +10,239 @@ import com.smartdevicelink.proxy.rpc.enums.VehicleDataEventStatus;
import com.smartdevicelink.proxy.rpc.enums.WiperStatus;
import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.SdlDataTypeConverter;
-
+/**
+ *Individual requested DID result and data.
+ *
+ *
+ * <p>Callback for the periodic and non periodic vehicle data read function.</p>
+ *
+ * <p> <b>Note:</b></p>
+ *
+ * Initially SDL sends SubscribeVehicleData for getting the periodic updates from HMI whenever each of subscribed data types changes. OnVehicleData is expected to bring such updated values to SDL
+ *
+ *
+ *
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</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>Float</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>Integer</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>Float</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>ComponentVolumeStatus</td>
+ * <td>The fuel level state (Ok/Low)</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>instantFuelConsumption</td>
+ * <td>Float</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>Float</td>
+ * <td>The external temperature in degrees celsius.</td>
+ * <td>N</td>
+ * <td>Subscribable </td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>vin</td>
+ * <td>String</td>
+ * <td>Vehicle identification number.</td>
+ * <td>N</td>
+ * <td>Subscribable </td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>prndl</td>
+ * <td>PRNDL</td>
+ * <td>Currently selected gear.</td>
+ * <td>N</td>
+ * <td>Subscribable </td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>tirePressure</td>
+ * <td>TireStatus</td>
+ * <td>Tire pressure status</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>odometer</td>
+ * <td>Integer</td>
+ * <td>Odometer in km</td>
+ * <td>N</td>
+ * <td>Subscribable </td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>beltStatus</td>
+ * <td>BeltStatus</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>BodyInformation</td>
+ * <td>The body information including power modes.</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>deviceStatus</td>
+ * <td>DeviceStatus</td>
+ * <td>The connected mobile device status including signal and battery strength.</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>eCallInfo</td>
+ * <td>ECallInfo</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>AirBagStatus</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>EmergencyEvernt</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>ClusterModeStatus</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>MyKey</td>
+ * <td>Information related to the MyKey feature.</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>driverBraking</td>
+ * <td>vehicleDataEventStatus</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>WiperStatus</td>
+ * <td>The status of the wipers</td>
+ * <td>N</td>
+ * <td> </td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>headLampStatus</td>
+ * <td>headLampStatus</td>
+ * <td>Status of the head lamps</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>engineTorque</td>
+ * <td>Float</td>
+ * <td>Torque value for engine (in Nm) on non-diesel variants</td>
+ * <td>N</td>
+ * <td>minvalue:-1000; maxvalue:2000</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>accPedalPosition</td>
+ * <td>Float</td>
+ * <td>Accelerator pedal position (percentage depressed)</td>
+ * <td>N</td>
+ * <td>minvalue: 0; maxvalue:100</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>steeringWheelAngle</td>
+ * <td>Float</td>
+ * <td>Current angle of the steering wheel (in deg)</td>
+ * <td>N</td>
+ * <td> minvalue: -2000; maxvalue:2000</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * </table>
+ *
+ * @since SmartDeviceLink 1.0
+ *
+ * @see SubscribeVehicleData
+ * @see UnsubscribeVehicleData
+ *
+ *
+ */
public class OnVehicleData extends RPCNotification {
public static final String KEY_SPEED = "speed";
public static final String KEY_RPM = "rpm";
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ParameterPermissions.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ParameterPermissions.java
index ef8eddc16..996de27ac 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ParameterPermissions.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ParameterPermissions.java
@@ -7,7 +7,7 @@ import com.smartdevicelink.proxy.RPCStruct;
/**
* Defining sets of parameters, which are permitted or prohibited for a given RPC.
- * <p><b>Parameter List
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
index 4ba1658b2..0e663f63d 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
@@ -12,13 +12,84 @@ import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
/**
* This will open an audio pass thru session. By doing so the app can receive
- * audio data through the vehicle�s microphone
- * <p>
- * Function Group: AudioPassThru
- * <p>
+ * audio data through the vehicles microphone
+ *
+ * <p>Function Group: AudioPassThru</p>
+ *
* <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * </p>
*
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th> Version</th>
+ * </tr>
+ * <tr>
+ * <td>initialPrompt</td>
+ * <td>TTSChunk[]</td>
+ * <td>SDL will speak this prompt before opening the audio pass thru session. </td>
+ * <td>N</td>
+ * <td>This is an array of text chunks of type TTSChunk. The array must have at least one item If omitted, then no initial prompt is spoken: <p>Array Minsize: 1</p> Array Maxsize: 100</td>
+ * <td>SmartDeviceLink 2.0 </td>
+ * </tr>
+ * <tr>
+ * <td>audioPassThruDisplayText1</td>
+ * <td>String</td>
+ * <td>First line of text displayed during audio capture.</td>
+ * <td>N</td>
+ * <td>Maxlength = 500</td>
+ * <td>SmartDeviceLink 2.0 </td>
+ * </tr>
+ * <tr>
+ * <td>samplingRate</td>
+ * <td>SamplingRate</td>
+ * <td>This value shall is allowed to be 8 or 16 or 22 or 44 khz.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>maxDuration</td>
+ * <td>Integer</td>
+ * <td>The maximum duration of audio recording in milliseconds.</td>
+ * <td>Y</td>
+ * <td>Minvalue: 1; Maxvalue: 1000000</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>bitsPerSample</td>
+ * <td>BitsPerSample</td>
+ * <td>Specifies the quality the audio is recorded - 8 bit or 16 bit.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0 </td>
+ * </tr>
+ * <tr>
+ * <td>audioType</td>
+ * <td>AudioType</td>
+ * <td>Specifies the type of audio data being requested.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>muteAudio</td>
+ * <td>Boolean</td>
+ * <td>N</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ *
+ *
+ *
+ *
+ * </table>
* @since SmartDeviceLink 2.0
* @see EndAudioPassThru
*/
@@ -40,9 +111,9 @@ public class PerformAudioPassThru extends RPCRequest {
}
/**
- * Constructs a new PerformAudioPassThru object indicated by the Hashtable
- * parameter
- * <p>
+ * <p>Constructs a new PerformAudioPassThru object indicated by the Hashtable
+ * parameter</p>
+ *
*
* @param hash
* The Hashtable to use
@@ -59,7 +130,7 @@ public class PerformAudioPassThru extends RPCRequest {
* a List<TTSChunk> value represents the initial prompt which
* will be spoken before opening the audio pass thru session by
* SDL
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>This is an array of text chunks of type TTSChunk</li>
@@ -109,9 +180,9 @@ public class PerformAudioPassThru extends RPCRequest {
* Sets a line of text displayed during audio capture
*
* @param audioPassThruDisplayText1
- * a String value representing the line of text displayed during
- * audio capture
- * <p>
+ * <p>a String value representing the line of text displayed during
+ * audio capture</p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500
*/
public void setAudioPassThruDisplayText1(String audioPassThruDisplayText1) {
@@ -136,9 +207,9 @@ public class PerformAudioPassThru extends RPCRequest {
* Sets a line of text displayed during audio capture
*
* @param audioPassThruDisplayText2
- * a String value representing the line of text displayed during
- * audio capture
- * <p>
+ * <p>a String value representing the line of text displayed during
+ * audio capture</p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500
*/
public void setAudioPassThruDisplayText2(String audioPassThruDisplayText2) {
@@ -194,7 +265,7 @@ public class PerformAudioPassThru extends RPCRequest {
* @param maxDuration
* an Integer value representing the maximum duration of audio
* recording in millisecond
- * <p>
+ * <p></p>
* <b>Notes: </b>Minvalue:1; Maxvalue:1000000
*/
public void setMaxDuration(Integer maxDuration) {
@@ -274,8 +345,8 @@ public class PerformAudioPassThru extends RPCRequest {
}
/**
- * Gets a Boolean value representing if the current audio source should be
- * muted during the APT session<br/>
+ *<p> Gets a Boolean value representing if the current audio source should be
+ * muted during the APT session</p>
*
*
* @return Boolean -a Boolean value representing if the current audio source
@@ -286,11 +357,11 @@ public class PerformAudioPassThru extends RPCRequest {
}
/**
- * Sets a muteAudio value representing if the current audio source should be
- * muted during the APT session<br/>
+ * <p>Sets a muteAudio value representing if the current audio source should be
+ * muted during the APT session
* If not, the audio source will play without interruption. If omitted, the
- * value is set to true
- * <p>
+ * value is set to true</p>
+ *
*
* @param muteAudio
* a Boolean value representing if the current audio source
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java
index 7ba905f96..2e90356ed 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java
@@ -20,9 +20,9 @@ public class PerformAudioPassThruResponse extends RPCResponse {
}
/**
- * Constructs a new PerformAudioPassThruResponse object indicated by the Hashtable
- * parameter
- * <p>
+ * <p>Constructs a new PerformAudioPassThruResponse object indicated by the Hashtable
+ * parameter</p>
+ *
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteraction.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteraction.java
index 3c6ed46a5..9ad8c1034 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteraction.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteraction.java
@@ -14,11 +14,95 @@ import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
* application may use a PerformInteraction to ask a user to say the name of a
* song to play. The user's response is only valid if it appears in the
* specified Choice Sets and is recognized by SDL
- * <p>
- * Function Group: Base
- * <p>
- * <b>HMILevel needs to be FULL</b>
- * </p>
+ * <p></p>
+ * <p>Function Group: Base</p>
+ *
+ * <p><b>HMILevel needs to be FULL</b></p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>initialText</td>
+ * <td>String</td>
+ * <td>Displayed when the interaction begins. This text may be overlaid by the "Listening" prompt during the interaction. Text is displayed on first line of multiline display, and is centered. If text does not fit on line, it will be truncated</td>
+ * <td>Y</td>
+ * <td>maxlength:500</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>initialPrompt</td>
+ * <td>TTSChunk</td>
+ * <td>An array of one or more TTSChunks that, taken together, specify what is to be spoken to the user at the start of an interaction.</td>
+ * <td>Y</td>
+ * <td>minsize:1; maxsize:100</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>interactionMode</td>
+ * <td>InteractionMode</td>
+ * <td>Indicates how user selects interaction choice. User can choose either by voice (VR_ONLY), by visual selection from the menu (MANUAL_ONLY), or by either mode (BOTH). </td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>interactionChoiceSetIDList</td>
+ * <td>Integer</td>
+ * <td>Array of one or more Choice Set IDs. User can select any choice from any of the specified Choice Sets.</td>
+ * <td>Y</td>
+ * <td>minsize:0; maxsize:100; minvalue:0; maxvalue:2000000000</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>helpPrompt</td>
+ * <td>TTSChunk</td>
+ * <td>An array of TTSChunks which, taken together, specify the help phrase to be spoken when the user says "help" during the VR session. If this parameter is omitted, the help prompt will be constructed by SDL from the first vrCommand of each choice of all the Choice Sets specified in the interactionChoiceSetIDList parameter. </td>
+ * <td>N</td>
+ * <td>minsize:1; maxsize:100; The helpPrompt specified in SetGlobalProperties is not used by PerformInteraction.</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>timeoutPrompt</td>
+ * <td>TTSChunk</td>
+ * <td>An array of TTSChunks which, taken together, specify the phrase to be spoken when the listen times out during the VR session. If this parameter is omitted, the timeout prompt will be the same as the help prompt (see helpPrompt parameter). </td>
+ * <td>N</td>
+ * <td>The timeoutPrompt specified in SetGlobalProperties is not used by PerformInteraction. minsize:1;maxsize:100</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>timeout</td>
+ * <td>Integer</td>
+ * <td>The amount of time, in milliseconds, SDL will wait for the user to make a choice (VR or Menu). If this time elapses without the user making a choice, the timeoutPrompt will be spoken. After this timeout value has been reached, the interaction will stop and a subsequent interaction will take place after SDL speaks the timeout prompt. If that times out as well, the interaction will end completely. If omitted, the default is 10000ms.</td>
+ * <td>N</td>
+ * <td>minvalue:5000; maxvalue:100000; defvalue:10000</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>vrHelp</td>
+ * <td>VrHelpItem</td>
+ * <td>Ability to send suggested VR Help Items to display on-screen during Perform Interaction If omitted on supported displays, the default SDL generated list of suggested choices will be displayed.</td>
+ * <td>N</td>
+ * <td>Min = 1;Max = 100</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>interactionLayout</td>
+ * <td>LayoutMode</td>
+ * <td>See {@linkplain LayoutMode}</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 3.0</td>
+ * </tr>
+ * </table>
+ *
*
* @since SmartDeviceLink 1.0
* @see CreateInteractionChoiceSet
@@ -43,7 +127,7 @@ public class PerformInteraction extends RPCRequest {
/**
* Constructs a new PerformInteraction object indicated by the Hashtable
* parameter
- * <p>
+ *
*
* @param hash
* The Hashtable to use
@@ -181,7 +265,7 @@ public class PerformInteraction extends RPCRequest {
* -a List<Integer> representing an Array of one or more Choice
* Set IDs. User can select any choice from any of the specified
* Choice Sets
- * <p>
+ * <p></p>
* <b>Notes: </b>Min Value: 0; Max Vlaue: 2000000000
*/
public void setInteractionChoiceSetIDList(List<Integer> interactionChoiceSetIDList) {
@@ -221,11 +305,11 @@ public class PerformInteraction extends RPCRequest {
/**
* Sets An array of TTSChunks which, taken together, specify the help phrase
* to be spoken when the user says "help" during the VR session
- * <p>
+ * <p></p>
* If this parameter is omitted, the help prompt will be constructed by SDL
* from the first vrCommand of each choice of all the Choice Sets specified
* in the interactionChoiceSetIDList parameter
- * <P>
+ * <P></p>
* <b>Notes: </b>The helpPrompt specified in
* {@linkplain SetGlobalProperties} is not used by PerformInteraction
*
@@ -270,7 +354,7 @@ public class PerformInteraction extends RPCRequest {
/**
* Sets An array of TTSChunks which, taken together, specify the phrase to
* be spoken when the listen times out during the VR session
- * <p>
+ * <p></p>
* <b>Notes: </b>The timeoutPrompt specified in
* {@linkplain SetGlobalProperties} is not used by PerformInteraction
*
@@ -309,7 +393,7 @@ public class PerformInteraction extends RPCRequest {
* an Integer value representing the amount of time, in
* milliseconds, SDL will wait for the user to make a choice (VR
* or Menu)
- * <p>
+ * <p></p>
* <b>Notes: </b>Min Value: 5000; Max Value: 100000
*/
public void setTimeout(Integer timeout) {
@@ -352,10 +436,10 @@ public class PerformInteraction extends RPCRequest {
*
* @param vrHelp
* a List representing a suggested VR Help Items to display
- * on-screen during Perform Interaction<br/>
+ * on-screen during Perform Interaction
* If omitted on supported displays, the default SDL generated
* list of suggested choices will be displayed
- * <p>
+ * <p></p>
* <b>Notes: </b>Min=1; Max=100
* @since SmartDeviceLink 2.0
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
index c0c212a85..c2b56dcd0 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
@@ -26,7 +26,7 @@ public class PerformInteractionResponse extends RPCResponse {
/**
* Constructs a new PerformInteractionResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -66,7 +66,7 @@ public class PerformInteractionResponse extends RPCResponse {
return null;
}
/**
- * <p>Sets TriggerSource<br/>
+ * <p>Sets TriggerSource
* Indicates whether command was selected via VR or via a menu selection (using the OK button).</p>
* @param triggerSource a TriggerSource object
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PermissionItem.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PermissionItem.java
index 42165fa87..7776c12b7 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PermissionItem.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PermissionItem.java
@@ -1,14 +1,65 @@
package com.smartdevicelink.proxy.rpc;
+
import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.util.DebugTool;
-
+/**
+ * Change in permissions for a given set of RPCs
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>rpcName</td>
+ * <td>String</td>
+ * <td>Name of the individual RPC in the policy table.</td>
+ * <td></td>
+ * <td>maxlength:100</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>hmiPermissions</td>
+ * <td>HMIPermissions</td>
+ * <td>Sets of parameters, which are permitted or prohibited for the given RPC.</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>parameterPermissions</td>
+ * <td>ParameterPermissions</td>
+ * <td>Sets of parameters, which are permitted or prohibited for the given RPC.</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * </table>
+ *
+ * @since SmartDeviceLink 2.0
+ */
public class PermissionItem extends RPCStruct {
public static final String KEY_RPC_NAME = "rpcName";
public static final String KEY_HMI_PERMISSIONS = "hmiPermissions";
public static final String KEY_PARAMETER_PERMISSIONS = "parameterPermissions";
+ /**
+ * <p>
+ * Constructs a new PermissionItem object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
public PermissionItem() { }
public PermissionItem(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java
index 06adf2b12..df28213c7 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PresetBankCapabilities.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.RPCStruct;
/**
* Contains information about on-screen preset capabilities.
- * <p><b>Parameter List
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java
index e47c95bda..065ad14d5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java
@@ -10,9 +10,102 @@ import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
/**
* Used to push a binary data onto the SDL module from a mobile device, such as
- * icons and album art
- * <p>
+ * icons and album art.
*
+ * <p><b> Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>FileName</td>
+ * <td>String</td>
+ * <td>File reference name.</td>
+ * <td>Y</td>
+ * <td>Maxlength=500</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>fileType</td>
+ * <td>FileType</td>
+ * <td>Selected file type.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>persistentFile</td>
+ * <td>Boolean</td>
+ * <td>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.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>systemFile</td>
+ * <td>Boolean</td>
+ * <td>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.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.3.2</td>
+ * </tr>
+ * <tr>
+ * <td>offset</td>
+ * <td>Float</td>
+ * <td>Optional offset in bytes for resuming partial data chunks</td>
+ * <td>N</td>
+ * <td>Minvalue=0; Maxvalue=100000000000</td>
+ * <td>SmartDeviceLink 2.3.2</td>
+ * </tr>
+ * <tr>
+ * <td>length</td>
+ * <td>Float</td>
+ * <td>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</td>
+ * <td>N</td>
+ * <td>Minvalue=0; Maxvalue=100000000000</td>
+ * <td>SmartDeviceLink 2.3.2</td>
+ * </tr>
+ * </table>
+ * <p> <b>Note: </b></p>
+ * When using PutFiles you may want to check for memory
+ *
+ * <p><b>Response</b> </p>
+ * Response is sent, when the file data was copied (success case). Or when an error occurred. Not supported on First generation SDL modules.
+ *
+ * <p><b> Non-default Result Codes:</b></p>
+ * <p> SUCCESS</p>
+ * <p> INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY</p>
+ * <p> TOO_MANY_PENDING_REQUESTS</p>
+ * <p> APPLICATION_NOT_REGISTERED</p>
+ * <p> GENERIC_ERROR</p>
+ * <p>REJECTED</p>
+ *
+ * <p><table border="1" rules="all"></p>
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>spaceAvailable</td>
+ * <td>Integer</td>
+ * <td>Provides the total local space available on SDL for the registered app.</td>
+ * <td></td>
+ * <td>Minvalue=0; Maxvalue=2000000000</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * </table>
* @since SmartDeviceLink 2.0
* @see DeleteFile
* @see ListFiles
@@ -35,7 +128,7 @@ public class PutFile extends RPCRequest {
/**
* Constructs a new PutFile object indicated by the Hashtable parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -49,7 +142,7 @@ public class PutFile extends RPCRequest {
*
* @param sdlFileName
* a String value representing a file reference name
- * <p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500
*/
public void setSdlFileName(String sdlFileName) {
@@ -106,7 +199,7 @@ public class PutFile extends RPCRequest {
* by the system at any time. In the event of automatic deletion by the
* system, the app will receive a rejection and have to resend the file. If
* omitted, the value will be set to false
- * <p>
+ * <p></p>
*
* @param persistentFile
* a Boolean value
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFileResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFileResponse.java
index 88c0560b3..b9195981b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFileResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFileResponse.java
@@ -23,7 +23,7 @@ public class PutFileResponse extends RPCResponse {
/**
* Constructs a new PutFileResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDID.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDID.java
index f165ae050..285416881 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDID.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDID.java
@@ -7,14 +7,63 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
/**
- * Non periodic vehicle data read request. This is an RPC to get diagnostics
+ * <p>Non periodic vehicle data read request. This is an RPC to get diagnostics
* data from certain vehicle modules. DIDs of a certain module might differ from
- * vehicle type to vehicle type
- * <p>
- * Function Group: ProprietaryData
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * <p>
+ * vehicle type to vehicle type</p>
+ *
+ * <p>Function Group: ProprietaryData</p>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>ecuName</td>
+ * <td>Integer</td>
+ * <td>Name of ECU.</td>
+ * <td>Y</td>
+ * <td>Minvalue: 0; Maxvalue: 65535</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>didLocation</td>
+ * <td>Integer</td>
+ * <td>Get raw data from vehicle data DID location(s).</td>
+ * <td>Y</td>
+ * <td>Minvalue: 0; Maxvalue: 65535</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <td>appID</td>
+ * <td>Integer</td>
+ * <td>ID of the application that requested this RPC.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * </table>
+ *
+ * <p><b>Response</b></p>
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>REJECTED</p>
+ * <p> DISALLOWED</p>
+ * <p>USER_DISALLOWED </p>
+ * <p>TRUNCATED_DATA</p>
*
* @since SmartDeviceLink 2.0
*/
@@ -31,7 +80,7 @@ public class ReadDID extends RPCRequest {
/**
* Constructs a new ReadDID object indicated by the Hashtable parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -45,7 +94,7 @@ public class ReadDID extends RPCRequest {
*
* @param ecuName
* an Integer value representing the ID of the vehicle module
- * <p>
+ * <p></p>
* <b>Notes: </b>Minvalue:0; Maxvalue:65535
*/
public void setEcuName(Integer ecuName) {
@@ -72,7 +121,7 @@ public class ReadDID extends RPCRequest {
* @param didLocation
* a List<Integer> value representing raw data from vehicle
* data DID location(s)
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>Minvalue:0; Maxvalue:65535</li>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
index 8af901be3..99bcba01a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
@@ -18,14 +18,14 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
* sending an <i> {@linkplain OnAppInterfaceUnregistered}</i> notification, or
* by loss of the underlying transport connection, or closing of the underlying
* message transmission protocol RPC session
- * <p>
+ * <p></p>
* Until the application receives its first <i>{@linkplain OnHMIStatus}</i>
* Notification, its HMI Status is assumed to be: <i>
* {@linkplain com.smartdevicelink.proxy.rpc.enums.HMILevel}</i>=NONE, <i>
* {@linkplain com.smartdevicelink.proxy.rpc.enums.AudioStreamingState}
* </i>=NOT_AUDIBLE, <i>
* {@linkplain com.smartdevicelink.proxy.rpc.enums.SystemContext}</i>=MAIN
- * <p>
+ * <p></p>
* All SDL&reg; resources which the application creates or uses (e.g. Choice
* Sets, Command Menu, etc.) are associated with the application's interface
* registration. Therefore, when the interface registration ends, the SDL&reg;
@@ -36,9 +36,9 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
* interface registration and re-creating its required SDL&reg; resources. That
* is, SDL&reg; resources created by (or on behalf of) an application do not
* persist beyond the life-span of the interface registration
- * <p>
+ * <p></p>
* Resources and settings whose lifespan is tied to the duration of an
- * application's interface registration:<br/>
+ * application's interface registration:
* <ul>
* <li>Choice Sets</li>
* <li>Command Menus (built by successive calls to <i>{@linkplain AddCommand}
@@ -47,13 +47,13 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
* <li>Media clock timer display value</li>
* <li>Media clock timer display value</li>
* </ul>
- * <p>
+ * <p></p>
* The autoActivateID is used to grant an application the HMILevel and
* AudioStreamingState it had when it last disconnected
- * <p>
+ * <p></p>
* <b>Notes: </b>The autoActivateID parameter, and associated behavior, is
* currently ignored by SDL&reg;
- * <p>
+ * <p></p>
* When first calling this method (i.e. first time within life cycle of mobile
* app), an autoActivateID should not be included. After successfully
* registering an interface, an autoActivateID is returned to the mobile
@@ -62,19 +62,154 @@ import com.smartdevicelink.proxy.rpc.enums.Language;
* turned off while the application is running, the autoActivateID can then be
* passed in another call to RegisterAppInterface to re-acquire <i>
* {@linkplain com.smartdevicelink.proxy.rpc.enums.HMILevel}</i>=FULL
- * <p>
+ * <p></p>
* If the application intends to stream audio it is important to indicate so via
* the isMediaApp parameter. When set to true, audio will reliably stream
* without any configuration required by the user. When not set, audio may
* stream, depending on what the user might have manually configured as a media
* source on SDL&reg;
- * <p>
+ * <p></p>
* There is no time limit for how long the autoActivateID is "valid" (i.e. would
* confer focus and opt-in)
- * <p>
- * <b>HMILevel is not defined before registering</b><br/>
- * </p>
*
+ *<p> <b>HMILevel is not defined before registering</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>Version</th>
+ * </tr>
+ * <tr>
+ * <td>MsgVersion</td>
+ * <td>MsgVersion</td>
+ * <td>Declares what version of the SDL interface the application expects to use with SDL</td>
+ * <td>Y</td>
+ * <td>To be compatible, app msg major version number must be less than or equal to SDL major version number. <p>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 to app (in RegisterAppInterface response).</p>However, the minor version number sent from the app to SDL (in RegisterAppInterface request) is ignored by SDL.</td>
+ * <td>SmartDeviceLink 1.0 </td>
+ * </tr>
+ * <tr>
+ * <td>appName</td>
+ * <td>String</td>
+ * <td>The mobile application's name. This name is displayed in the SDL Mobile Applications menu. It also serves as the unique identifier of the application for SDL .</td>
+ * <td>Y</td>
+ * <td><p> Must be 1-100 characters in length. Must consist of following characters: </p><p>May not be the same (by case insensitive comparison) as the name or any synonym of any currently registered application.</p> </td>
+ * <td>SmartDeviceLink 1.0 </td>
+ * </tr>
+ * <tr>
+ * <td>ttsName</td>
+ * <td>TTSChunk</td>
+ * <td>TTS string for VR recognition of the mobile application name. Meant to overcome any failing on speech engine in properly pronouncing / understanding app name.</td>
+ * <td>N</td>
+ * <td><p>Size must be 1-100 Needs to be unique over all applications. May not be empty.<p>May not start with a new line character.</p></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>ngnMediaScreenAppName</td>
+ * <td>String</td>
+ * <td>Provides an abbreviated version of the app name (if necessary) that will be displayed on the NGN media screen.</td>
+ * <td>N</td>
+ * <td>- Must be 1-5 characters. If not provided, value will be derived from appName truncated to 5 characters.</td>
+ * <td>SmartDeviceLink 1.0 </td>
+ * </tr>
+ * <tr>
+ * <td>vrSynonyms</td>
+ * <td>String</td>
+ * <td>An array of 1-100 elements, each element containing a voice-recognition synonym by which this app can be called when being addressed in the mobile applications menu.</td>
+ * <td>N</td>
+ * <td>Each vr synonym is limited to 40 characters, and there can be 1-100 synonyms in array. May not be the same (by case insensitive comparison) as the name or any synonym of any currently-registered application.</td>
+ * <td>SmartDeviceLink 1.0 </td>
+ * </tr>
+ * <tr>
+ * <td>isMediaApplication</td>
+ * <td>Boolean</td>
+ * <td>Indicates that the application will be streaming audio to SDL (via A2DP) that is audible outside of the BT media source.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0 </td>
+ * </tr>
+ * <tr>
+ * <td>languageDesired</td>
+ * <td>Language</td>
+ * <td>An enumeration indicating what language the application intends to use for user interaction (Display, TTS and VR).</td>
+ * <td>Y</td>
+ * <td>If the language indicated does not match the active language on SDL, the interface registration will be rejected.If the user changes the SDL language while this interface registration is active, the interface registration will be terminated. </td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>hmiDisplayLanguageDesired</td>
+ * <td>Language</td>
+ * <td>An enumeration indicating what language the application intends to use for user interaction ( Display).</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0 </td>
+ * </tr>
+ * <tr>
+ * <td>appHMIType</td>
+ * <td>AppHMIType</td>
+ * <td>List of all applicable app types stating which classifications to be given to the app.e.g. for platforms , like GEN2, this will determine which "corner(s)" the app can populate</td>
+ * <td>N</td>
+ * <td>Array Minsize: 1; Array Maxsize: 100</td>
+ * <td>SmartDeviceLink 2.0 </td>
+ * </tr>
+ * <tr>
+ * <td>hashID</td>
+ * <td>String</td>
+ * <td>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.). </td>
+ * <td>N</td>
+ * <td>maxlength:100</td>
+ * <td>SmartDeviceLink 2.3.1 </td>
+ * </tr>
+ * <tr>
+ * <td>deviceInfo</td>
+ * <td>DeviceInfo</td>
+ * <td>Various information abount connecting device.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.3.1 </td>
+ * </tr>
+ * <tr>
+ * <td>appID</td>
+ * <td>String</td>
+ * <td>ID used to validate app with policy table entries</td>
+ * <td>Y</td>
+ * <td>Maxlength: 100</td>
+ * <td>SmartDeviceLink 2.0 </td>
+ * </tr>
+ *
+ * <tr>
+ * <td>hmiCapabilities</td>
+ * <td>HMICapabilities</td>
+ * <td>Specifies the HMI capabilities.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.3.2.2 </td>
+ * </tr>
+ *
+ * <tr>
+ * <td>sdlVersion</td>
+ * <td>String</td>
+ * <td>The SmartDeviceLink version.</td>
+ * <td>N</td>
+ * <td>Maxlength: 100</td>
+ * <td>SmartDeviceLink 2.3.2.2</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>systemSoftwareVersion</td>
+ * <td>String</td>
+ * <td>The software version of the system that implements the SmartDeviceLink core.</td>
+ * <td>N</td>
+ * <td>Maxlength: 100</td>
+ * <td>SmartDeviceLink 2.3.2.2</td>
+ * </tr>
+ * </table>
+ * <p></p>
* @since SmartDeviceLink 1.0
* @see UnregisterAppInterface
* @see OnAppInterfaceUnregistered
@@ -101,7 +236,7 @@ public class RegisterAppInterface extends RPCRequest {
/**
* Constructs a new RegisterAppInterface object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -131,7 +266,7 @@ public class RegisterAppInterface extends RPCRequest {
* @param sdlMsgVersion
* a SdlMsgVersion object representing version of the SDL&reg;
* SmartDeviceLink interface
- * <p>
+ * <p></p>
* <b>Notes: </b>To be compatible, app msg major version number
* must be less than or equal to SDL&reg; major version number.
* If msg versions are incompatible, app has 20 seconds to
@@ -185,7 +320,7 @@ public class RegisterAppInterface extends RPCRequest {
*
* @param appName
* a String value representing the Mobile Application's Name
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>Must be 1-100 characters in length</li>
@@ -232,8 +367,8 @@ public class RegisterAppInterface extends RPCRequest {
*
* @param ttsName
* a List<TTSChunk> value represeting the TTS Name
- * <p>
- * <b>Notes: </b><br/>
+ * <p></p>
+ * <b>Notes: </b>
* <ul>
* <li>Size must be 1-100</li>
* <li>Needs to be unique over all applications</li>
@@ -272,7 +407,7 @@ public class RegisterAppInterface extends RPCRequest {
* @param ngnMediaScreenAppName
* a String value representing an abbreviated version of the
* mobile applincation's name
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>Must be 1-5 characters</li>
@@ -315,7 +450,7 @@ public class RegisterAppInterface extends RPCRequest {
* @param vrSynonyms
* a List<String> value representing the an array of 1-100
* elements
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>Each vr synonym is limited to 40 characters, and there can
@@ -376,7 +511,7 @@ public class RegisterAppInterface extends RPCRequest {
*
* @param languageDesired
* a Language Enumeration
- * <p>
+ *
*
*/
public void setLanguageDesired(Language languageDesired) {
@@ -462,7 +597,7 @@ public class RegisterAppInterface extends RPCRequest {
*
* @param appHMIType
* a List<AppHMIType>
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>Array Minsize: = 1</li>
@@ -507,7 +642,7 @@ public class RegisterAppInterface extends RPCRequest {
* @param appID
* a String value representing a unique ID, which an app will be
* given when approved
- * <p>
+ * <p></p>
* <b>Notes: </b>Maxlength = 100
* @since SmartDeviceLink 2.0
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
index 05a96160c..f89e1a8b8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
@@ -80,7 +80,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
* @param sdlMsgVersion
* a SdlMsgVersion object representing version of the SDL&reg;
* SmartDeviceLink interface
- * <p>
+ * <p></p>
* <b>Notes: </b>To be compatible, app msg major version number
* must be less than or equal to SDL&reg; major version number.
* If msg versions are incompatible, app has 20 seconds to
@@ -123,7 +123,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
*
* @param language
* a Language Enumeration
- * <p>
+ *
*
*/
public void setLanguage(Language language) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
index 1121ce2c8..4a9f18d7f 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
@@ -10,16 +10,50 @@ import com.smartdevicelink.proxy.rpc.enums.GlobalProperty;
/**
* Resets the passed global properties to their default values as defined by
* SDL
- * <p>
+ * <p></p>
* The HELPPROMPT global property default value is generated by SDL consists of
* the first vrCommand of each Command Menu item defined at the moment PTT is
- * pressed<br/>
- * The TIMEOUTPROMPT global property default value is the same as the HELPPROMPT
- * global property default value
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * </p>
+ * pressed
+ * <p>The TIMEOUTPROMPT global property default value is the same as the HELPPROMPT
+ * global property default value</p>
*
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>properties</td>
+ * <td>GlobalProperty</td>
+ * <td>An array of one or more GlobalProperty enumeration elements indicating which global properties to reset to their default value.</td>
+ * <td>Y</td>
+ * <td>Array must have at least one element.; minsize:1; maxsize:100</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ *
+ * </table>
+ * <p><b>Response</b></p>
+ *
+ * <p>Indicates whether the Global Properties were successfully set to their default values.</p>
+ *
+ * <p><b>Non-default Result Codes:</b></p>
+ *
+ * <p> SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY</p>
+ * <p> TOO_MANY_PENDING_REQUESTS</p>
+ * <p> APPLICATION_NOT_REGISTERED</p>
+ * <p> GENERIC_ERROR </p>
+ * <p> REJECTED </p>
+ * <p>DISALLOWED </p>
* @since SmartDeviceLink 1.0
* @see SetGlobalProperties
*/
@@ -34,7 +68,7 @@ public class ResetGlobalProperties extends RPCRequest {
/**
* Constructs a new ResetGlobalProperties object indicated by the Hashtable
* parameter
- * <p>
+ *
*
* @param hash
* The Hashtable to use
@@ -80,7 +114,7 @@ public class ResetGlobalProperties extends RPCRequest {
* a List<GlobalProperty> An array of one or more
* GlobalProperty enumeration elements indicating which global
* properties to reset to their default value
- * <p>
+ * <p></p>
* <b>Notes: </b>Array must have at least one element
*/
public void setProperties( List<GlobalProperty> properties ) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java
index 3390fb814..dec7cde94 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java
@@ -22,7 +22,7 @@ public class ResetGlobalPropertiesResponse extends RPCResponse {
/**
* Constructs a new ResetGlobalPropertiesResponse object indicated by the Hashtable
* parameter
- * <p>
+ *
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScreenParams.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScreenParams.java
index 9e32b9ffc..fe2c626a0 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScreenParams.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScreenParams.java
@@ -6,13 +6,58 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.TouchEventCapabilities;
import com.smartdevicelink.util.DebugTool;
+/** The resolution of the prescribed screen area.
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>resolution</td>
+ * <td>ImageResolution</td>
+ * <td>The resolution of the prescribed screen area.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.3.2</td>
+ * </tr>
+ * <tr>
+ * <td>touchEventAvailable</td>
+ * <td>TouchEventCapabilities</td>
+ * <td>Types of screen touch events available in screen area.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.3.2</td>
+ * </tr>
+ *
+ * </table>
+ * @since SmartDeviceLink 2.3.2
+ *
+ */
public class ScreenParams extends RPCStruct {
public static final String KEY_RESOLUTION = "resolution";
public static final String KEY_TOUCH_EVENT_AVAILABLE = "touchEventAvailable";
+ /**
+ * Constructs a new ScreenParams object
+ */
public ScreenParams() { }
-
+ /**
+ * <p>
+ * Constructs a new ScreenParamst object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
+
public ScreenParams(Hashtable<String, Object> hash) {
super(hash);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessage.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
index 3f9e75cce..2fae92ec5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
@@ -10,11 +10,62 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* Creates a full screen overlay containing a large block of formatted text that
* can be scrolled with up to 8 SoftButtons defined
- * <p>
- * Function Group: ScrollableMessage
- * <p>
- * <b>HMILevel needs to be FULL</b>
- * <p>
+ *
+ * <p>Function Group: ScrollableMessage</p>
+ *
+ * <p><b>HMILevel needs to be FULL</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>Version</th>
+ * </tr>
+ * <tr>
+ * <td>scrollableMessageBody</td>
+ * <td>String</td>
+ * <td>Body of text that can include newlines and tabs.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDevice Link 1.0 </td>
+ * </tr>
+ * <tr>
+ * <td>timeout</td>
+ * <td>Integer</td>
+ * <td>App defined timeout. Indicates how long of a timeout from the last action (i.e. scrolling message resets timeout).</td>
+ * <td>N</td>
+ * <td>minvalue=1000; maxvalue=65535; defvalue=30000</td>
+ * <td>SmartDevice Link 1.0 </td>
+ * </tr>
+ * <tr>
+ * <td>softButtons</td>
+ * <td>SoftButton</td>
+ * <td>App defined SoftButtons. If omitted on supported displays, only the system defined "Close" SoftButton will be displayed.</td>
+ * <td>N</td>
+ * <td>minsize=0; maxsize=8</td>
+ * <td>SmartDevice Link 1.0 </td>
+ * </tr>
+ * </table>
+ * <p> <b>Response</b></p>
+ *<b>Non-default Result Codes:</b>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA </p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>CHAR_LIMIT_EXCEEDED</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR </p>
+ * <p>DISALLOWED</p>
+ * <p>UNSUPPORTED_RESOURCE</p>
+ * <p>REJECTED </p>
+ * <p>ABORTED</p>
+ *
+ * @see scrollableMessageBody
+ * @see TextFieldName
*/
public class ScrollableMessage extends RPCRequest {
public static final String KEY_SCROLLABLE_MESSAGE_BODY = "scrollableMessageBody";
@@ -31,7 +82,7 @@ public class ScrollableMessage extends RPCRequest {
/**
* Constructs a new ScrollableMessage object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -46,7 +97,7 @@ public class ScrollableMessage extends RPCRequest {
* @param scrollableMessageBody
* a String value representing the Body of text that can include
* newlines and tabs
- * <p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500
*/
public void setScrollableMessageBody(String scrollableMessageBody) {
@@ -72,7 +123,7 @@ public class ScrollableMessage extends RPCRequest {
*
* @param timeout
* an Integer value representing an App defined timeout
- * <p>
+ * <p></p>
* <b>Notes</b>:Minval=0; Maxval=65535;Default=30000
*/
public void setTimeout(Integer timeout) {
@@ -99,7 +150,7 @@ public class ScrollableMessage extends RPCRequest {
* @param softButtons
* a List<SoftButton> value representing App defined
* SoftButtons
- * <p>
+ * <p></p>
* <b>Notes: </b>Minsize=0, Maxsize=8
*/
public void setSoftButtons(List<SoftButton> softButtons) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java
index 970782f35..880c27f95 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java
@@ -22,7 +22,7 @@ public class ScrollableMessageResponse extends RPCResponse {
/**
* Constructs a new ScrollableMessageResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
index ebe5c1c1a..cb5df057d 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.RPCStruct;
/**
* Specifies the version number of the SDL V4 interface. This is used by both the application and SDL to declare what interface version each is using.
- * <p><b> Parameter List
+ * <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -16,7 +16,7 @@ import com.smartdevicelink.proxy.RPCStruct;
* </tr>
* <tr>
* <td>majorVersion</td>
- * <td>Int16</td>
+ * <td>Integer</td>
* <td>
* <ul>
* <li>minvalue="1"</li>
@@ -27,7 +27,7 @@ import com.smartdevicelink.proxy.RPCStruct;
* </tr>
* <tr>
* <td>minorVersion</td>
- * <td>Int16</td>
+ * <td>Integer</td>
* <td>
* <ul>
* <li>minvalue="0"</li>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java
index 0257a4c1c..dc77058de 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java
@@ -46,8 +46,8 @@ public class SendLocation extends RPCRequest{
/**
* Getter for longitude of the location to send.
*
- * <p><b>IMPORTANT NOTE:</b> A previous version of this method call returned a Float
- * value, however, it has been changed to return a Double. This will compile,
+ * <p><b>IMPORTANT NOTE:</b> </p><p>A previous version of this method call returned a Float
+ * value, however, it has been changed to return a Double.</p> This will compile,
* but cause a ClassCastException if your value is not also a Double type.
* @since SmartDeviceLink v4.0
*
@@ -74,8 +74,8 @@ public class SendLocation extends RPCRequest{
/**
* Getter for latitude of the location to send.
*
- * <p><b>IMPORTANT NOTE:</b> A previous version of this method call returned a Float
- * value, however, it has been changed to return a Double. This will compile,
+ * <p><b>IMPORTANT NOTE:</b> </p><p>A previous version of this method call returned a Float
+ * value, however, it has been changed to return a Double.</p> This will compile,
* but cause a ClassCastException if your value is not also a Double type.
* @since SmartDeviceLink v4.0
*
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIcon.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIcon.java
index 1a5d5a22e..2cb5aef31 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIcon.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIcon.java
@@ -8,9 +8,41 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* Used to set existing local file on SDL as the app's icon. Not supported on
* first generation SDL vehicles
- * <p>
*
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>SDLFileName</td>
+ * <td>String</td>
+ * <td>File reference name.</td>
+ * <td>Y</td>
+ * <td>Maxlength=500</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * </table>
+ *
+ *<p><b>Response </b></p>
+ *<p><b> Non-default Result Codes: </b></p>
+ *<p>SUCCESS</p>
+ * <p> INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY</p>
+ * <p> TOO_MANY_PENDING_REQUESTS</p>
+ * <p> APPLICATION_NOT_REGISTERED</p>
+ * <p> GENERIC_ERROR</p>
+ * <p> REJECTED</p>
+ *
* @since SmartDeviceLink 2.0
+ * @see Image
*/
public class SetAppIcon extends RPCRequest {
public static final String KEY_SDL_FILE_NAME = "syncFileName";
@@ -24,7 +56,7 @@ public class SetAppIcon extends RPCRequest {
/**
* Constructs a new SetAppIcon object indicated by the Hashtable parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -38,7 +70,7 @@ public class SetAppIcon extends RPCRequest {
*
* @param sdlFileName
* a String value representing a file reference name
- * <p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500
*/
public void setSdlFileName(String sdlFileName) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java
index 9d154bebf..c6d0f7ddf 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java
@@ -4,12 +4,28 @@ import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
-
+/**
+ * Set App Icon Response is sent, when SetAppIcon has been called.
+ *
+ * @since SmartDeviceLink 2.0
+ */
public class SetAppIconResponse extends RPCResponse {
+ /**
+ * Constructs a new SetAppIconResponse object
+ */
public SetAppIconResponse() {
super(FunctionID.SET_APP_ICON.toString());
}
+ /**
+ * Constructs a new SetAppIconResponse object indicated by the Hashtable
+ * parameter
+ * <p></p>
+ *
+ * @param hash
+ * The Hashtable to use
+ */
+
public SetAppIconResponse(Hashtable<String, Object> hash) {
super(hash);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
index ec3b1e62e..2a3fd9d4b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
@@ -8,8 +8,38 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* Used to set an alternate display layout. If not sent, default screen for
* given platform will be shown
- * <p>
*
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>displayLayout</td>
+ * <td>string</td>
+ * <td>Predefined or dynamically created screen layout.<p>Currently only predefined screen layouts are defined.</p> Predefined layouts include: "ONSCREEN_PRESETS" Custom screen containing app-defined onscreen presets. </td>
+ * <td>Y</td>
+ * <td>maxlength: 500</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * </table>
+ *<p><b>Response </b></p>
+ *
+ *<p><b> Non-default Result Codes: </b></p>
+ *<p> SUCCESS </p>
+ *<p> INVALID_DATA</p>
+ *<p> OUT_OF_MEMORY</p>
+ *<p> TOO_MANY_PENDING_REQUESTS</p>
+ * <p> APPLICATION_NOT_REGISTERED</p>
+ * <p> GENERIC_ERROR</p>
+ * <p> REJECTED</p>
* @since SmartDeviceLink 2.0
*/
public class SetDisplayLayout extends RPCRequest {
@@ -24,7 +54,7 @@ public class SetDisplayLayout extends RPCRequest {
/**
* Constructs a new SetDisplayLayout object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
index 787bdd9f7..b9947a4ac 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
@@ -28,7 +28,7 @@ public class SetDisplayLayoutResponse extends RPCResponse {
/**
* Constructs a new SetDisplayLayoutResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
index be1f13bb8..7f597cafe 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
@@ -9,11 +9,100 @@ import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.util.DebugTool;
/**
* Sets value(s) for the specified global property(ies)
- * <p>
- * Function Group: Base <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * </p>
*
+ * <p>Function Group: Base </p>
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
+ * <p><b>AudioStreamingState:</b></p>
+ * Any
+ *
+ * <p><b>SystemContext:</b></p>
+ * Any
+ *
+ *
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>helpPrompt</td>
+ * <td>TTSChunk</td>
+ * <td>The help prompt. An array of text chunks of type TTSChunk. See {@linkplain TTSChunk}.The array must have at least one item.</td>
+ * <td>N</td>
+ * <td>Array must have at least one element.<p>Only optional it timeoutPrompt has been specified.</p>minsize:1; maxsize: 100</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>timeoutPrompt</td>
+ * <td>TTSChunk</td>
+ * <td>Array of one or more TTSChunk elements specifying the help prompt used in an interaction started by PTT.</td>
+ * <td>N</td>
+ * <td>Array must have at least one element. Only optional it helpPrompt has been specified <p>minsize: 1; maxsize: 100</p></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>vrHelpTitle</td>
+ * <td>string</td>
+ * <td>Text, which is shown as title of the VR help screen used in an interaction started by PTT.</td>
+ * <td>N</td>
+ * <td>If omitted on supported displays, the default SDL help title will be used. <p>If omitted and one or more vrHelp items are provided, the request will be rejected.</p>maxlength: 500</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>vrHelp</td>
+ * <td>VrHelep</td>
+ * <td>Items listed in the VR help screen used in an interaction started by PTT.</td>
+ * <td>N</td>
+ * <td>If omitted on supported displays, the default SDL VR help / What Can I Say? screen will be used<p>If the list of VR Help Items contains nonsequential positions (e.g. [1,2,4]), the RPC will be rejected.</p><p>If omitted and a vrHelpTitle is provided, the request will be rejected.</p>minsize:1; maxsize: 100 </td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>menuTitle</td>
+ * <td></td>
+ * <td>Optional text to label an app menu button (for certain touchscreen platforms).</td>
+ * <td>N</td>
+ * <td>maxlength: 500</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>menuIcon</td>
+ * <td> Image</td>
+ * <td>Optional icon to draw on an app menu button (for certain touchscreen platforms).</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>keyboardProperties</td>
+ * <td>KeyboardProperties</td>
+ * <td>On-screen keybaord configuration (if available).</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ *
+ * </table>
+ *
+ * <p><b>Note: </b>Your application shall send a SetGlobalProperties to establish an advanced help prompt before sending any voice commands.</p>
+ *
+ * <p><b>Response</b></p>
+ * Indicates whether the requested Global Properties were successfully set.
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * </p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>REJECTED</p>
+ * <p>DISALLOWED</p>
* @since SmartDeviceLink 1.0
* @see ResetGlobalProperties
*/
@@ -34,7 +123,7 @@ public class SetGlobalProperties extends RPCRequest {
/**
* Constructs a new SetGlobalProperties object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -76,7 +165,7 @@ public class SetGlobalProperties extends RPCRequest {
*
* @param helpPrompt
* a List<TTSChunk> of one or more TTSChunk elements
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>Array must have at least one element</li>
@@ -147,8 +236,8 @@ public class SetGlobalProperties extends RPCRequest {
*
* @param vrHelpTitle
* a String value representing a voice recognition Help Title
- * <p>
- * <b>Notes: </b><br/>
+ * <p></p>
+ * <b>Notes: </b>
* <ul>
* <li>If omitted on supported displays, the default SDL help
* title will be used</li>
@@ -201,8 +290,8 @@ public class SetGlobalProperties extends RPCRequest {
* @param vrHelp
* a List value representing items listed in the VR help screen
* used in an interaction started by PTT
- * <p>
- * <b>Notes: </b><br/>
+ * <p></p>
+ * <b>Notes: </b>
* <ul>
* <li>If omitted on supported displays, the default SmartDeviceLink VR
* help / What Can I Say? screen will be used</li>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java
index bef494e69..f33bc0b7c 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java
@@ -22,7 +22,7 @@ public class SetGlobalPropertiesResponse extends RPCResponse {
/**
* Constructs a new SetGlobalPropertiesResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
index 2b8f33365..bd6bac324 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
@@ -8,10 +8,64 @@ import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
/**
* Sets the media clock/timer value and the update method (e.g.count-up,
* count-down, etc.)
- * <p>
- * Function Group: Base <p>
- * <b>HMILevel needs to be FULL, LIMITIED or BACKGROUND</b>
- * </p>
+ *
+ * <p>Function Group: Base </p>
+ * <p><b>HMILevel needs to be FULL, LIMITIED or BACKGROUND</b></p>
+ *
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>startTime</td>
+ * <td>StartTime</td>
+ * <td>StartTime struct specifying hour, minute, second values to which media clock timer is set.</td>
+ * <td>N</td>
+ * <td> </td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>endTime</td>
+ * <td>StartTime</td>
+ * <td> 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</td>
+ * <td>N</td>
+ * <td>Array must have at least one element.<p>Only optional it helpPrompt has been specified</p> minsize: 1; maxsize: 100</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>updateMode</td>
+ * <td>UpdateMode</td>
+ * <td>Specifies how the media clock/timer is to be updated (COUNTUP/COUNTDOWN/PAUSE/RESUME), based at the startTime.</td>
+ * <td>Y</td>
+ * <td>If "updateMode" is COUNTUP or COUNTDOWN, this parameter must be provided. Will be ignored for PAUSE,RESUME and CLEAR</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ *
+ * </table>
+ *
+ *<p><b>Response </b></p>
+ *
+ *<p><b> Non-default Result Codes: </b></p>
+ *
+ * <p> SUCCESS </p>
+ * <p> INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY</p>
+ * <p> TOO_MANY_PENDING_REQUESTS</p>
+ * <p> APPLICATION_NOT_REGISTERED</p>
+ * <p> GENERIC_ERROR</p>
+ * <p> REJECTED </p>
+ * <p> IGNORED </p>
*
* @since SmartDeviceLink 1.0
*/
@@ -28,7 +82,7 @@ public class SetMediaClockTimer extends RPCRequest {
/**
* Constructs a new SetMediaClockTimer object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -57,7 +111,7 @@ public class SetMediaClockTimer extends RPCRequest {
*
* @param startTime
* a startTime object with specifying hour, minute, second values
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>If "updateMode" is COUNTUP or COUNTDOWN, this parameter
@@ -111,7 +165,7 @@ public class SetMediaClockTimer extends RPCRequest {
*
* @param updateMode
* a Enumeration value (COUNTUP/COUNTDOWN/PAUSE/RESUME)
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>When updateMode is PAUSE, RESUME or CLEAR, the start time value
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java
index 410b5b68c..e74ecc1b9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java
@@ -22,7 +22,7 @@ public class SetMediaClockTimerResponse extends RPCResponse {
/**
* Constructs a new SetMediaClockTimerResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Show.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Show.java
index 9782b0e7f..24307c9de 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Show.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Show.java
@@ -14,19 +14,140 @@ import com.smartdevicelink.util.DebugTool;
* this text area is visible to the user at the time of the request. The
* application's display text area remains unchanged until updated by subsequent
* calls to Show
- * <p>
+ * <p></p>
* The content of the application's display text area is visible to the user
* when the application's {@linkplain com.smartdevicelink.proxy.rpc.enums.HMILevel}
* is FULL or LIMITED, and the
* {@linkplain com.smartdevicelink.proxy.rpc.enums.SystemContext}=MAIN and no
* {@linkplain Alert} is in progress
- * <p>
+ * <p></p>
* The Show operation cannot be used to create an animated scrolling screen. To
* avoid distracting the driver, Show commands cannot be issued more than once
* every 4 seconds. Requests made more frequently than this will be rejected
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * </p>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>mainField1</td>
+ * <td>String</td>
+ * <td>Text to be displayed in a single-line display, or in the upper display line in a two-line display.</td>
+ * <td>N</td>
+ * <td>If this parameter is omitted, the text of mainField1 does not change. If this parameter is an empty string, the field will be cleared. <p>Maxlength = 500</p></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>mainField2</td>
+ * <td>String</td>
+ * <td>Text to be displayed on the second display line of a two-line display.</td>
+ * <td>N</td>
+ * <td><p>If this parameter is omitted, the text of mainField2 does not change. </p> <p>If this parameter is an empty string, the field will be cleared.</p><p>If provided and the display is a single-line display, the parameter is ignored.</p>Maxlength = 500</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>mainField3</td>
+ * <td>String</td>
+ * <td>Text to be displayed on the first display line of the second page.</td>
+ * <td>N</td>
+ * <td><p>If this parameter is omitted, the text of mainField3 does not change. </p><p>If this parameter is an empty string, the field will be cleared.</p><p>If provided and the display is a single-line display, the parameter is ignored.</p> Maxlength = 500</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>mainField4</td>
+ * <td>String</td>
+ * <td>Text to be displayed on the second display line of the second page.</td>
+ * <td>N</td>
+ * <td><p>If this parameter is omitted, the text of mainField4 does not change. </p><p>If this parameter is an empty string, the field will be cleared.</p><p>If provided and the display is a single-line display, the parameter is ignored.</p>Maxlength = 500</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>alignment</td>
+ * <td>TextAlignment</td>
+ * <td>Specifies how mainField1 and mainField2 text should be aligned on display.</td>
+ * <td>N</td>
+ * <td><p>Applies only to mainField1 and mainField2 provided on this call, not to what is already showing in display.</p><p>If this parameter is omitted, text in both mainField1 and mainField2 will be centered. </p>Has no effect with navigation display</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>statusBar</td>
+ * <td>String</td>
+ * <td>The text is placed in the status bar area.</td>
+ * <td>N</td>
+ * <td><p>Note: The status bar only exists on navigation displays</p><p>If this parameter is omitted, the status bar text will remain unchanged.</p><p>If this parameter is an empty string, the field will be cleared.</p><p>If provided and the display has no status bar, this parameter is ignored.</p>Maxlength = 500</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>mediaClock</td>
+ * <td>String</td>
+ * <td><p>Text value for MediaClock field.</p> <p>Has to be properly formatted by Mobile App according to SDL capabilities.</p>If this text is set, any automatic media clock updates previously set with SetMediaClockTimer will be stopped.</td>
+ * <td>N</td>
+ * <td><p>Must be properly formatted as described in the MediaClockFormat enumeration. </p><p>If a value of five spaces is provided, this will clear that field on the display (i.e. the media clock timer field will not display anything) </p>Maxlength = 500</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>mediaTrack</td>
+ * <td>String</td>
+ * <td>Array of one or more TTSChunk elements specifying the help prompt used in an interaction started by PTT.</td>
+ * <td>N</td>
+ * <td><p>If parameter is omitted, the track field remains unchanged.</p><p>If an empty string is provided, the field will be cleared.</p><p>This field is only valid for media applications on navigation displays.</p>Maxlength = 500</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>graphic</td>
+ * <td>Image</td>
+ * <td>Image to be shown on supported displays.</td>
+ * <td>N</td>
+ * <td>If omitted on supported displays, the displayed graphic shall not change.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>secondaryGraphic</td>
+ * <td>Image</td>
+ * <td> <p>Image struct determining whether static or dynamic secondary image to display in app.</p>If omitted on supported displays, the displayed secondary graphic shall not change.</td>
+ * <td>N</td>
+ * <td> </td>
+ * <td>SmartDeviceLink 2.3.2</td>
+ * </tr>
+ * <tr>
+ * <td>softButtons</td>
+ * <td>SoftButton</td>
+ * <td>Soft buttons as defined by the App</td>
+ * <td>N</td>
+ * <td><p>If omitted on supported displays, the currently displayed SoftButton values will not change.</p>Array Minsize: 0; Array Maxsize: 8</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>customPresets</td>
+ * <td>String</td>
+ * <td>Custom presets as defined by the App.</td>
+ * <td>N</td>
+ * <td><p>If omitted on supported displays, the presets will be shown as not defined.</p>Minsize: 0; Maxsize: 6</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * </table>
+ *<p><b>Response </b></p>
+ *
+ *<p><b> Non-default Result Codes: </b></p>
+ * <p>SUCCESS </p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p> TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p> GENERIC_ERROR</p>
+ * <p> REJECTED</p>
+ * <p> DISALLOWED</p>
+ * <p> UNSUPPORTED_RESOURCE </p>
+ * <p>ABORTED</p>
*
* @since SmartDeviceLink 1.0
* @see Alert
@@ -53,7 +174,7 @@ public class Show extends RPCRequest {
}
/**
* Constructs a new Show object indicated by the Hashtable parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -80,7 +201,7 @@ public class Show extends RPCRequest {
* the String value representing the text displayed in a
* single-line display, or in the upper display line in a
* two-line display
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>If this parameter is omitted, the text of mainField1 does
@@ -111,7 +232,7 @@ public class Show extends RPCRequest {
* @param mainField2
* the String value representing the text displayed on the second
* display line of a two-line display
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>If this parameter is omitted, the text of mainField2 does
@@ -148,7 +269,7 @@ public class Show extends RPCRequest {
* @param mainField3
* the String value representing the text displayed on the first
* display line of the second page
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>If this parameter is omitted, the text of mainField3 does
@@ -186,7 +307,7 @@ public class Show extends RPCRequest {
* @param mainField4
* the String value representing the text displayed on the second
* display line of the second page
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>If this parameter is omitted, the text of mainField4 does
@@ -227,7 +348,7 @@ public class Show extends RPCRequest {
*
* @param alignment
* an Enumeration value
- * <p>
+ * <p></p>
* <b>Notes: </b>
* <ul>
* <li>Applies only to mainField1 and mainField2 provided on this
@@ -258,9 +379,9 @@ public class Show extends RPCRequest {
* @param statusBar
* a String representing the text you want to add in the Status
* Bar
- * <p>
+ * <p></p>
* <b>Notes: </b><i>The status bar only exists on navigation
- * displays</i><br/>
+ * displays</i>
* <ul>
* <li>If this parameter is omitted, the status bar text will
* remain unchanged</li>
@@ -292,8 +413,8 @@ public class Show extends RPCRequest {
*
* @param mediaClock
* a String value for the MdaiaClock
- * <p>
- * <b>Notes: </b><br/>
+ * <p></p>
+ * <b>Notes: </b>
* <ul>
* <li>Must be properly formatted as described in the
* MediaClockFormat enumeration</li>
@@ -323,8 +444,8 @@ public class Show extends RPCRequest {
*
* @param mediaTrack
* a String value disaplayed in the track field
- * <p>
- * <b>Notes: </b><br/>
+ * <p></p>
+ * <b>Notes: </b>
* <ul>
* <li>If parameter is omitted, the track field remains unchanged</li>
* <li>If an empty string is provided, the field will be cleared</li>
@@ -344,9 +465,9 @@ public class Show extends RPCRequest {
*
* @param graphic
* the value representing the image shown on supported displays
- * <p>
+ * <p></p>
* <b>Notes: </b>If omitted on supported displays, the displayed
- * graphic shall not change<br/>
+ * graphic shall not change
* @since SmartDeviceLink 2.0
*/
public void setGraphic(Image graphic) {
@@ -438,8 +559,8 @@ public class Show extends RPCRequest {
* @param softButtons
* a List value represemting the Soft buttons defined by the
* App
- * <p>
- * <b>Notes: </b><br/>
+ * <p></p>
+ * <b>Notes: </b>
* <ul>
* <li>If omitted on supported displays, the currently displayed
* SoftButton values will not change</li>
@@ -484,7 +605,7 @@ public class Show extends RPCRequest {
* @param customPresets
* a List value representing the Custom Presets defined by the
* App
- * <p>
+ * <p></p>
* <ul>
* <li>If omitted on supported displays, the presets will be shown as not defined</li>
* <li>Array Minsize: 0</li>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java
index 293adddbe..f65e1a100 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java
@@ -8,13 +8,13 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
/**
- * This RPC is used to update the user with navigation information for the constantly shown screen (base screen), but
- * also for the alert type screen
- * <p>
- * Function Group: Navigation
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * <p>
+ * <p>This RPC is used to update the user with navigation information for the constantly shown screen (base screen), but
+ * also for the alert type screen</p>
+ *
+ * <p>Function Group: Navigation</p>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
*
* @since SmartDeviceLink 2.0
* @see AlertManeuver
@@ -57,7 +57,7 @@ public class ShowConstantTbt extends RPCRequest{
*
* @param navigationText1
* a String value representing a text for navigation text field 1
- * <p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500
*/
public void setNavigationText1(String navigationText1){
@@ -83,7 +83,7 @@ public class ShowConstantTbt extends RPCRequest{
*
* @param navigationText2
* a String value representing a text for navigation text field 2
- * <p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500
*/
public void setNavigationText2(String navigationText2){
@@ -109,7 +109,7 @@ public class ShowConstantTbt extends RPCRequest{
*
* @param eta
* a String value representing a text field for estimated time of arrival
- * <p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500
*/
public void setEta(String eta){
@@ -135,7 +135,7 @@ public class ShowConstantTbt extends RPCRequest{
*
* @param totalDistance
* a String value representing a text field for total distance
- * <p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500
*/
public void setTotalDistance(String totalDistance){
@@ -223,7 +223,7 @@ public class ShowConstantTbt extends RPCRequest{
*
* @param distanceToManeuver
* a Double value representing a Fraction of distance till next maneuver
- * <p>
+ * <p></p>
* <b>Notes: </b>Minvalue=0; Maxvalue=1000000000
*/
public void setDistanceToManeuver(Double distanceToManeuver){
@@ -249,7 +249,7 @@ public class ShowConstantTbt extends RPCRequest{
*
* @param distanceToManeuverScale
* a Double value representing a Distance till next maneuver (starting from) from previous maneuver
- * <p>
+ * <p></p>
* <b>Notes: </b>Minvalue=0; Maxvalue=1000000000
*/
public void setDistanceToManeuverScale(Double distanceToManeuverScale){
@@ -271,10 +271,10 @@ public class ShowConstantTbt extends RPCRequest{
}
/**
- * Sets a maneuver complete flag. 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<br/>
- * If omitted the value will be assumed as FALSE
- * <p>
+ * <p>Sets a maneuver complete flag. 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</p>
+ *
*
* @param maneuverComplete
* a Boolean value
@@ -298,10 +298,10 @@ public class ShowConstantTbt extends RPCRequest{
}
/**
- * Sets Three dynamic SoftButtons available (first SoftButton is fixed to "Turns"). If omitted on supported
- * displays, the currently displayed SoftButton values will not change
- * <p>
- * <b>Notes: </b>Minsize=0; Maxsize=3
+ * <p>Sets Three dynamic SoftButtons available (first SoftButton is fixed to "Turns"). If omitted on supported
+ * displays, the currently displayed SoftButton values will not change</p>
+ *
+ * <p><b>Notes: </b>Minsize=0; Maxsize=3</p>
*
* @param softButtons
* a List<SoftButton> value
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowResponse.java
index e12c09029..54ff95033 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowResponse.java
@@ -22,7 +22,7 @@ public class ShowResponse extends RPCResponse {
/**
* Constructs a new ShowResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SingleTireStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SingleTireStatus.java
index b9c7bafbc..ab30ff365 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SingleTireStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SingleTireStatus.java
@@ -7,7 +7,7 @@ import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
/**
* Tire pressure status of a single tire.
- * <p><b>Parameter List
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -19,7 +19,7 @@ import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
* <td>status</td>
* <td>ComponentVolumeStatus</td>
* <td>Describes the volume status of a single tire
- * See ComponentVolumeStatus
+ * See {@linkplain ComponentVolumeStatus}
* </td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Slider.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Slider.java
index 4cf914f43..16da80dcb 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Slider.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Slider.java
@@ -7,14 +7,80 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
/**
- * Creates a full screen or pop-up overlay (depending on platform) with a single
- * user controlled slider
- * <p>
- * Function Group: Base
- * <p>
- * <b>HMILevel needs to be FULL</b>
- * <p>
+ * <p>Creates a full screen or pop-up overlay (depending on platform) with a single
+ * user controlled slider.</p>
+ *
+ * <p>Function Group: Base</p>
*
+ * <p><b>HMILevel needs to be FULL</b></p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>numTicks</td>
+ * <td>Integer</td>
+ * <td>Number of selectable items on a horizontal axis.</td>
+ * <td>Y</td>
+ * <td>Minvalue=2; Maxvalue=26</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>position</td>
+ * <td>Integer</td>
+ * <td>Initial position of slider control (cannot exceed numTicks),</td>
+ * <td>Y</td>
+ * <td>Minvalue=1; Maxvalue=26</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>sliderHeader</td>
+ * <td>String</td>
+ * <td>Text header to display</td>
+ * <td>N</td>
+ * <td>Maxlength=500</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>sliderFooter</td>
+ * <td>Integer</td>
+ * <td><p>Text footer to display (meant to display min/max threshold descriptors).</p>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.</td>
+ * <td>N</td>
+ * <td>Maxlength=500; Minvalue=1; Maxvalue=26</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>timeout</td>
+ * <td>String</td>
+ * <td>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.</td>
+ * <td>N</td>
+ * <td>Minvalue=0; Maxvalue=65535; Defvalue= 10000</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * </table>
+*<p><b>Response </b></p>
+*
+*<p><b>Non-default Result Codes:</b></p>
+* <p> SAVED </p>
+* <p> INVALID_DATA</p>
+* <p>OUT_OF_MEMORY</p>
+* <p>TOO_MANY_PENDING_REQUESTS</p>
+* <p>APPLICATION_NOT_REGISTERED</p>
+* <p>GENERIC_ERROR</p>
+*<p> DISALLOWED</p>
+*<p> UNSUPPORTED_RESOURCE </p>
+*<p> REJECTED </p>
+* <p>ABORTED </p>
+*
* @since SmartDeviceLink 2.0
*
*/
@@ -34,7 +100,7 @@ public class Slider extends RPCRequest {
/**
* Constructs a new Slider object indicated by the Hashtable parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -49,7 +115,7 @@ public class Slider extends RPCRequest {
* @param numTicks
* an Integer value representing a number of selectable items on
* a horizontal axis
- * <p>
+ * <p></p>
* <b>Notes: </b>Minvalue=2; Maxvalue=26
*/
public void setNumTicks(Integer numTicks) {
@@ -76,7 +142,7 @@ public class Slider extends RPCRequest {
* @param position
* an Integer value representing an Initial position of slider
* control
- * <p>
+ * <p></p>
* <b>Notes: </b>Minvalue=1; Maxvalue=26
*/
public void setPosition(Integer position) {
@@ -102,7 +168,7 @@ public class Slider extends RPCRequest {
*
* @param sliderHeader
* a String value
- * <p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500
*/
public void setSliderHeader(String sliderHeader) {
@@ -127,7 +193,7 @@ public class Slider extends RPCRequest {
*
* @param sliderFooter
* a List<String> value representing a text footer to display
- * <p>
+ * <p></p>
* <b>Notes: </b>Maxlength=500; Minvalue=1; Maxvalue=26
*/
public void setSliderFooter(List<String> sliderFooter) {
@@ -162,7 +228,7 @@ public class Slider extends RPCRequest {
*
* @param timeout
* an Integer value representing an App defined timeout
- * <p>
+ * <p></p>
* <b>Notes: </b>Minvalue=0; Maxvalue=65535; Defvalue=10000
*/
public void setTimeout(Integer timeout) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SliderResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SliderResponse.java
index 6d168b6ea..0d8487d12 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SliderResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SliderResponse.java
@@ -23,7 +23,7 @@ public class SliderResponse extends RPCResponse {
/**
* Constructs a new SliderResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SoftButton.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SoftButton.java
index 5c2cec98a..e010a08da 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SoftButton.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SoftButton.java
@@ -6,7 +6,71 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SystemAction;
import com.smartdevicelink.util.DebugTool;
-
+/**
+ * <p> A simulated button or keyboard key that is displayed on a touch screen.</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>Version</th>
+ * </tr>
+ * <tr>
+ * <td>type</td>
+ * <td>SoftButtonType</td>
+ * <td>Describes, whether it is text, highlighted text, icon, or dynamic image. </td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0 </td>
+ * </tr>
+ * <tr>
+ * <td>text</td>
+ * <td>String</td>
+ * <td>Optional text to display (if defined as TEXT or BOTH)</td>
+ * <td>N</td>
+ * <td>Min: 0; Maxlength: 500</td>
+ * <td>SmartDeviceLink 2.0 </td>
+ * </tr>
+ * <tr>
+ * <td>image</td>
+ * <td>Image</td>
+ * <td>Optional image struct for SoftButton (if defined as IMAGE or BOTH).</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>isHighlighted</td>
+ * <td>Boolean</td>
+ * <td>True, if highlighted False, if not highlighted</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>softButtonID</td>
+ * <td>Integer</td>
+ * <td>Value which is returned via OnButtonPress / OnButtonEvent</td>
+ * <td></td>
+ * <td>Min: 0; Max: 65535</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>systemAction</td>
+ * <td>SystemAction</td>
+ * <td>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.</td>
+ * <td>N</td>
+ * <td>defvalue: DEFAULT_ACTION</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ *
+ * </table>
+ *
+ */
public class SoftButton extends RPCStruct {
public static final String KEY_IS_HIGHLIGHTED = "isHighlighted";
@@ -15,7 +79,17 @@ 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";
-
+ /**
+ *
+ * <p>Constructs a new SoftButton object indicated by the Hashtable
+ * parameter</p>
+ *
+ *
+ * @param hash
+ *
+ * The Hashtable to use
+ */
+
public SoftButton() { }
public SoftButton(Hashtable<String, Object> hash) {
super(hash);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
index f6ca43e96..e2849086c 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
@@ -5,8 +5,8 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
/**
- * Contains information about a SoftButton's capabilities.
- * <p><b>Parameter List
+ * <p>Contains information about a SoftButton's capabilities.</p>
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Speak.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Speak.java
index 27183af86..b5e775f06 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Speak.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Speak.java
@@ -12,50 +12,50 @@ import com.smartdevicelink.proxy.RPCRequest;
* (text-to-speech) engine. The provided text to be spoken can be simply a text
* phrase, or it can consist of phoneme specifications to direct SDL's TTS
* engine to speak a "speech-sculpted" phrase
- * <p>
+ * <p></p>
* Receipt of the Response indicates the completion of the Speak operation,
* regardless of how the Speak operation may have completed (i.e. successfully,
* interrupted, terminated, etc.)
- * <p>
+ * <p></p>
* Requesting a new Speak operation while the application has another Speak
* operation already in progress (i.e. no corresponding Response for that
* in-progress Speak operation has been received yet) will terminate the
* in-progress Speak operation (causing its corresponding Response to be sent by
* SDL) and begin the requested Speak operation
- * <p>
+ * <p></p>
* Requesting a new Speak operation while the application has an <i>
* {@linkplain Alert}</i> operation already in progress (i.e. no corresponding
* Response for that in-progress <i>{@linkplain Alert}</i> operation has been
* received yet) will result in the Speak operation request being rejected
* (indicated in the Response to the Request)
- * <p>
+ * <p></p>
* Requesting a new <i>{@linkplain Alert}</i> operation while the application
* has a Speak operation already in progress (i.e. no corresponding Response for
* that in-progress Speak operation has been received yet) will terminate the
* in-progress Speak operation (causing its corresponding Response to be sent by
* SDL) and begin the requested <i>{@linkplain Alert}</i> operation
- * <p>
+ * <p></p>
* Requesting a new Speak operation while the application has a <i>
* {@linkplain PerformInteraction}</i> operation already in progress (i.e. no
* corresponding Response for that in-progress <i>
* {@linkplain PerformInteraction}</i> operation has been received yet) will
* result in the Speak operation request being rejected (indicated in the
* Response to the Request)
- * <p>
+ * <p></p>
* Requesting a <i> {@linkplain PerformInteraction}</i> operation while the
* application has a Speak operation already in progress (i.e. no corresponding
* Response for that in-progress Speak operation has been received yet) will
* terminate the in-progress Speak operation (causing its corresponding Response
* to be sent by SDL) and begin the requested <i>
* {@linkplain PerformInteraction}</i> operation
- * <p>
+ * <p></p>
*
- * <b>HMI Status Requirements:</b><br/>
- * HMILevel: FULL, Limited<br/>
- * AudioStreamingState: Any<br/>
- * SystemContext: MAIN, MENU, VR
- * </p>
- * <b>Notes: </b>
+ * <p><b>HMI Status Requirements:</b></p>
+ * <p>HMILevel: FULL, Limited</p>
+ *<p> AudioStreamingState: Any</p>
+ * <p>SystemContext: MAIN, MENU, VR</p>
+ *
+ * <p><b>Notes: </b></p>
* <ul>
* <li>When <i>{@linkplain Alert}</i> is issued with MENU in effect, <i>
* {@linkplain Alert}</i> is queued and "played" when MENU interaction is
@@ -67,7 +67,43 @@ import com.smartdevicelink.proxy.RPCRequest;
* VR, they are "played" back in the order in which they were queued, with all
* existing rules for "collisions" still in effect</li>
* </ul>
- * <p>
+ *
+ *
+ * <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> Ver. Available</th>
+ * </tr>
+ * <tr>
+ * <td>ttsChunks</td>
+ * <td>String</td>
+ * <td>An array of 1-100 TTSChunk structs which, taken together, specify the phrase to be spoken.</td>
+ * <td>Y</td>
+ * <td><p>The array must have 1-100 elements. </p><p>The total length of the phrase composed from the ttsChunks provided must be less than 500 characters or the request will be rejected. </p>Each chunk can be no more than 500 characters.</td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * </table>
+ * <p><b>Response</b> </p>
+ * <p>This Response notifies the application of the completion, interruption, or failure of a Speak Request.</p>
+ *
+ * <p><b>Non-default Result Codes:</b> </p>
+ *
+ * <p> SUCCESS </p>
+ *<p> INVALID_DATA</p>
+ * <p> OUT_OF_MEMORY </p>
+ * <p>APPLICATION_NOT_REGISTERED </p>
+ * <p>TOO_MANY_PENDING_REQUESTS </p>
+ *<p> GENERIC_ERROR </p>
+ * <p>REJECTED </p>
+ * <p>DISALLOWED </p>
+ * <p>ABORTED </p>
+ *
+ * <p><b>Additional Notes:</b></p><ul>Total character limit depends on platform. Chunks are limited to 500 characters; however you can have multiple TTS chunks. On Gen 1.1 there is a total character limit of 500 characters across all chunks. This could vary according to the VCA.
*
* @since SmartDeviceLink 1.0
* @see Alert
@@ -83,7 +119,7 @@ public class Speak extends RPCRequest {
}
/**
* Constructs a new Speak object indicated by the Hashtable parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
@@ -123,7 +159,7 @@ public class Speak extends RPCRequest {
* @param ttsChunks
* a List<TTSChunk> value representing an array of 1-100 TTSChunk structs
* which specify the phrase to be spoken
- * <p>
+ * <p></p>
* <ul>
* <li>The array must have 1-100 elements</li>
* <li>The total length of the phrase composed from the ttsChunks
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SpeakResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SpeakResponse.java
index 3e7be103c..740d24776 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SpeakResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SpeakResponse.java
@@ -22,7 +22,7 @@ public class SpeakResponse extends RPCResponse {
/**
* Constructs a new SpeakResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/StartTime.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/StartTime.java
index 97aae52fa..bce0b9fc1 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/StartTime.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/StartTime.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.RPCStruct;
/**
* Describes the hour, minute and second values used to set the media clock.
- * <p><b> Parameter List
+ * <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -16,21 +16,21 @@ import com.smartdevicelink.proxy.RPCStruct;
* </tr>
* <tr>
* <td>hours</td>
- * <td>Int16</td>
+ * <td>Integer</td>
* <td>The hour. Minvalue="0", maxvalue="59"
- * <p><b>Note:</b>Some display types only support a max value of 19. If out of range, it will be rejected.
+ * <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
* </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>minutes</td>
- * <td>Int16</td>
+ * <td>Integer</td>
* <td>The minute. Minvalue="0", maxvalue="59".</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>seconds</td>
- * <td>Int16</td>
+ * <td>Integer</td>
* <td>The second. Minvalue="0", maxvalue="59".</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -55,7 +55,7 @@ public class StartTime extends RPCStruct {
}
/**
* Get the hour. Minvalue="0", maxvalue="59"
- * <p><b>Note:</b>Some display types only support a max value of 19. If out of range, it will be rejected.
+ * <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
* @return hours Minvalue="0", maxvalue="59"
*/
public Integer getHours() {
@@ -63,7 +63,7 @@ public class StartTime extends RPCStruct {
}
/**
* Set the hour. Minvalue="0", maxvalue="59"
- * <p><b>Note:</b>Some display types only support a max value of 19. If out of range, it will be rejected.
+ * <p><b>Note:</b></p>Some display types only support a max value of 19. If out of range, it will be rejected.
* @param hours min: 0; max: 59
*/
public void setHours( Integer hours ) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButton.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButton.java
index 9f09fb5fa..7f1f92bae 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButton.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButton.java
@@ -6,52 +6,70 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
/**
- * Establishes a subscription to button notifications for HMI buttons. Buttons
+ *<p> Establishes a subscription to button notifications for HMI buttons. Buttons
* are not necessarily physical buttons, but can also be "soft" buttons on a
* touch screen, depending on the display in the vehicle. Once subscribed to a
* particular button, an application will receive both
* {@linkplain OnButtonEvent} and {@linkplain OnButtonPress} notifications
* whenever that button is pressed. The application may also unsubscribe from
* notifications for a button by invoking the {@linkplain UnsubscribeButton}
- * operation
- * <p>
- * When a button is depressed, an {@linkplain OnButtonEvent} notification is
+ * operation</p>
+ *
+ * <p>When a button is depressed, an {@linkplain OnButtonEvent} notification is
* sent to the application with a ButtonEventMode of BUTTONDOWN. When that same
* button is released, an {@linkplain OnButtonEvent} notification is sent to the
- * application with a ButtonEventMode of BUTTONUP
- * <p>
- * When the duration of a button depression (that is, time between depression
+ * application with a ButtonEventMode of BUTTONUP</p>
+ *
+ * <p>When the duration of a button depression (that is, time between depression
* and release) is less than two seconds, an {@linkplain OnButtonPress}
* notification is sent to the application (at the moment the button is
* released) with a ButtonPressMode of SHORT. When the duration is two or more
* seconds, an {@linkplain OnButtonPress} notification is sent to the
* application (at the moment the two seconds have elapsed) with a
- * ButtonPressMode of LONG
- * <p>
+ * ButtonPressMode of LONG</p>
+ *
* The purpose of {@linkplain OnButtonPress} notifications is to allow for
* programmatic detection of long button presses similar to those used to store
* presets while listening to the radio, for example
- * <p>
- * When a button is depressed and released, the sequence in which notifications
- * will be sent to the application is as follows:
- * <p>
- * For short presses:<br/>
+ *
+ * <p>When a button is depressed and released, the sequence in which notifications
+ * will be sent to the application is as follows:</p>
+ *
+ * <p>For short presses:</p>
* <ul>
* <li>OnButtonEvent (ButtonEventMode = BUTTONDOWN)</li>
* <li>OnButtonEvent (ButtonEventMode = BUTTONUP)</li>
* <li>OnButtonPress (ButtonPressMode = SHORT)</li>
* </ul>
- * <p>
- * For long presses:<br/>
+ *
+ * <p>For long presses:</p>
* <ul>
* <li>OnButtonEvent (ButtonEventMode = BUTTONDOWN)</li>
* <li>OnButtonEvent (ButtonEventMode = BUTTONUP)</li>
* <li>OnButtonPress (ButtonPressMode = LONG)</li>
* </ul>
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * </p>
*
+ *<p> <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>buttonName</td>
+ * <td>ButtonName</td>
+ * <td>Name of the button to subscribe.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0 </td>
+ * </tr>
+ * </table>
* @since SmartDeviceLink 1.0
* @see UnsubscribeButton
*/
@@ -65,9 +83,9 @@ public class SubscribeButton extends RPCRequest {
super(FunctionID.SUBSCRIBE_BUTTON.toString());
}
/**
- * Constructs a new SubscribeButton object indicated by the Hashtable
- * parameter
- * <p>
+ * <p>Constructs a new SubscribeButton object indicated by the Hashtable
+ * parameter</p>
+ *
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java
index b51f75eee..81fca78c2 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java
@@ -20,9 +20,9 @@ public class SubscribeButtonResponse extends RPCResponse {
}
/**
- * Constructs a new SubscribeButtonResponse object indicated by the Hashtable
- * parameter
- * <p>
+ * <p>Constructs a new SubscribeButtonResponse object indicated by the Hashtable
+ * parameter</p>
+ *
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
index 10333d3d0..6b934ef21 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
@@ -11,11 +11,227 @@ import com.smartdevicelink.proxy.RPCRequest;
* onVehicleData notification whenever new data is available. The update rate is
* very much dependent on sensors, vehicle architecture and vehicle type. Be
* also prepared for the situation that a signal is not available on a vehicle
- * <p>
- * Function Group: Location, VehicleInfo and DrivingChara
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * </p>
+ *
+ * <p>Function Group: Location, VehicleInfo and DrivingChara</p>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <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>
+ *
+ * <p> <b>Response</b></p>
+ *<p><b>Non-default Result Codes:</b></p>
+ *<p>SUCCESS</p>
+ *<p>WARNINGS </p>
+ *<p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>IGNORED </p>
+ * <p>DISALLOWED</p>
+ * <p>USER_DISALLOWED </p>
*
* @since SmartDeviceLink 2.0
* @see UnsubscribeVehicleData
@@ -55,9 +271,9 @@ public class SubscribeVehicleData extends RPCRequest {
}
/**
- * Constructs a new SubscribeVehicleData object indicated by the Hashtable
- * parameter
- * <p>
+ * <p>Constructs a new SubscribeVehicleData object indicated by the Hashtable
+ * parameter</p>
+ *
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
index 327e0f7d6..f8092cae8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
@@ -45,9 +45,9 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
}
/**
- * Constructs a new SubscribeVehicleDataResponse object indicated by the Hashtable
- * parameter
- * <p>
+ * <p>Constructs a new SubscribeVehicleDataResponse object indicated by the Hashtable
+ * parameter</p>
+ *
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequest.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequest.java
index 94fe62353..14164b964 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequest.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequest.java
@@ -6,12 +6,50 @@ import java.util.List;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
+/** An asynchronous request from the device; binary data can be included in hybrid part of message for some requests (such as HTTP, Proprietary, or Authentication requests)
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>requestType</td>
+ * <td>RequestType</td>
+ * <td>The type of system request. Note that Proprietary requests should forward the binary data to the known proprietary module on the system.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ *
+ * <tr>
+ * <td>fileName</td>
+ * <td>String</td>
+ * <td>Filename of HTTP data to store in predefined system staging area. Mandatory if requestType is HTTP. PROPRIETARY requestType should ignore this parameter. </td>
+ * <td>N</td>
+ * <td>Max Length: 255</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * </table>
+ * @since SmartDeviceLink 3.0
+ *
+ *
+ *
+ */
public class SystemRequest extends RPCRequest {
public static final String KEY_FILE_NAME = "fileName";
public static final String KEY_REQUEST_TYPE = "requestType";
public static final String KEY_DATA = "data";
-
+ /**
+ * Constructs a new SystemRequest object
+ */
+
public SystemRequest() {
super(FunctionID.SYSTEM_REQUEST.toString());
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java
index 201c186c8..6fc920f1e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java
@@ -5,6 +5,11 @@ import java.util.Hashtable;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
+/**
+ * System Request Response is sent, when SystemRequest has been called
+ *
+ * @since SmartDeviceLink 3.0
+ */
public class SystemRequestResponse extends RPCResponse {
public SystemRequestResponse() {
super(FunctionID.SYSTEM_REQUEST.toString());
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TTSChunk.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TTSChunk.java
index 05bac01ab..97f865903 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TTSChunk.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TTSChunk.java
@@ -6,15 +6,15 @@ import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
/**
- * Specifies what is to be spoken. This can be simply a text phrase, which SDL will speak according to its own rules.
+ * <p>Specifies what is to be spoken. This can be simply a text phrase, which SDL will speak according to its own rules.
* It can also be phonemes from either the Microsoft SAPI phoneme set, or from the LHPLUS phoneme set.
- * It can also be a pre-recorded sound in WAV format (either developer-defined, or provided by the SDL platform).
+ * It can also be a pre-recorded sound in WAV format (either developer-defined, or provided by the SDL platform).</p>
*
* <p>In SDL, words, and therefore sentences, can be built up from phonemes and are used to explicitly provide the proper pronounciation to the TTS engine.
* For example, to have SDL pronounce the word "read" as "red", rather than as when it is pronounced like "reed",
- * the developer would use phonemes to express this desired pronounciation.
- * <p>For more information about phonemes, see <a href="http://en.wikipedia.org/wiki/Phoneme">http://en.wikipedia.org/wiki/Phoneme</a>.
- * <p><b> Parameter List
+ * the developer would use phonemes to express this desired pronounciation.</p>
+ * <p>For more information about phonemes, see <a href="http://en.wikipedia.org/wiki/Phoneme">http://en.wikipedia.org/wiki/Phoneme</a></p>.
+ * <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TextField.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TextField.java
index ed128e0f5..918f0eb2f 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TextField.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TextField.java
@@ -8,7 +8,7 @@ import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
/**
* Struct defining the characteristics of a displayed field on the HMI.
- * <p><b> Parameter List
+ * <p><b> Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
@@ -30,7 +30,7 @@ import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
* </tr>
* <tr>
* <td>width</td>
- * <td>Int16</td>
+ * <td>Integer</td>
* <td>The number of characters in one row of this field.
* <ul>
* <li>Minvalue="1"</li>
@@ -41,7 +41,7 @@ import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
* </tr>
* <tr>
* <td>rows</td>
- * <td>Int16</td>
+ * <td>Integer</td>
* <td>The number of rows for this text field.
* <ul>
* <li>Minvalue="1"</li>
@@ -52,6 +52,15 @@ import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
* </tr>
* </table>
* @since SmartDeviceLink 1.0
+ *
+ * @see TextFieldName
+ * @see Alert
+ * @see Show
+ * @see PerformInteraction
+ * @see ScrollableMessage
+ * @see PerformAudioPassThru
+ * @see ShowConstantTBT
+ *
*/
public class TextField extends RPCStruct {
public static final String KEY_WIDTH = "width";
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TireStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TireStatus.java
index 4f42f7d25..f853d673c 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TireStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TireStatus.java
@@ -5,6 +5,67 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.WarningLightStatus;
import com.smartdevicelink.util.DebugTool;
+/** <p>The status and pressure of the tires.</p>
+ * <p><b> Parameter List:</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>PressureTellTale</td>
+ * <td>WarningLightStatus</td>
+ * <td>Status of the Tire Pressure TellTale</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>LeftFront</td>
+ * <td>SingleTireStatus</td>
+ * <td>The status of the left front tire.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>RightFront</td>
+ * <td>SingleTireStatus</td>
+ * <td>The status of the right front tire.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>LeftRear</td>
+ * <td>SingleTireStatus</td>
+ * <td>The status of the left rear tire.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>RightRear</td>
+ * <td>SingleTireStatus</td>
+ * <td>The status of the right rear tire</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>InnerLeftRear</td>
+ * <td>SingleTireStatus</td>
+ * <td>The status of the inner left rear tire.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * <tr>
+ * <td>InnerRightRear</td>
+ * <td>SingleTireStatus</td>
+ * <td>The status of the inner right rear tire.</td>
+ * <td>SmartDeviceLink 2.0</td>
+ * </tr>
+ * </table>
+ *
+ * @since SmartDeviceLink 2.0
+ *
+ * @see WarningLightStatus
+ * @see SingleTireStatus
+ * @see GetVehicleData
+ * @see OnVehicleData
+ */
public class TireStatus extends RPCStruct {
public static final String KEY_PRESSURE_TELL_TALE = "pressureTellTale";
@@ -14,6 +75,14 @@ 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";
+ /**
+ * <p>Constructs a new TireStatus object indicated by the Hashtable parameter</p>
+ *
+ *
+ * @param hash
+ * <p>
+ * The Hashtable to use</p>
+ */
public TireStatus() { }
public TireStatus(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchCoord.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchCoord.java
index 104db308d..95f793fe6 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchCoord.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchCoord.java
@@ -3,12 +3,58 @@ package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
+/**
+ * <p>The x or y coordinate of the touch.</p>
+ *
+ *
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th> Version</th>
+ * </tr>
+ * <tr>
+ * <td>x</td>
+ * <td>Integer</td>
+ * <td>The x coordinate of the touch.</td>
+ * <td>Y</td>
+ * <td>minvalue = 0; maxvalue = 10000</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>y</td>
+ * <td>Integer</td>
+ * <td>The y coordinate of the touch.</td>
+ * <td>Y</td>
+ * <td>minvalue = 0; maxvalue = 10000</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * </table>
+ *@see SoftButtonCapabilities
+ *@see ButtonCapabilities
+ *@see OnButtonPress
+ *
+ *@since SmartDeviceLink 3.0
+ */
public class TouchCoord extends RPCStruct {
public static final String KEY_X = "x";
public static final String KEY_Y = "y";
public TouchCoord() {}
-
+ /**
+ * <p>Constructs a new TouchCoord object indicated by the Hashtable parameter</p>
+ *
+ *
+ * @param hash
+ * <p>
+ * The Hashtable to use</p>
+ */
+
public TouchCoord(Hashtable<String, Object> hash) {
super(hash);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEvent.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEvent.java
index a204fae8e..76e3c4207 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEvent.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEvent.java
@@ -5,6 +5,54 @@ import java.util.Hashtable;
import java.util.List;
import com.smartdevicelink.proxy.RPCStruct;
+/**
+ * <p>For touchscreen interactions, the mode of how the choices are presented.</p>
+ *
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>Version</th>
+ * </tr>
+ * <tr>
+ * <td>id</td>
+ * <td>Integer</td>
+ * <td> 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.</td>
+ * <td>N</td>
+ * <td>Min Value: 0; Max Value: 9</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>ts</td>
+ * <td>Float</td>
+ * <td>The time that the touch was recorded. <p> This number can the time since the beginning of the session or something else as long as the units are in milliseconds.</p>
+ * <p>The timestamp is used to determined the rate of change of position of a touch.</p><p>The application also uses the time to verify whether two touches,with different ids, are part of a single action by the user.</p>
+ * <p>If there is only a single timestamp in this array,</p> it is the same for every coordinate in the coordinates array.</td>
+ * <td>Y</td>
+ * <td>minvalue="0" maxvalue="5000000000" minsize="1" maxsize="1000"</td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>c</td>
+ * <td>Integer</td>
+ * <td>The coordinates of the screen area where the touch event occurred.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 3.0</td>
+ * </tr>
+ * </table>
+ *
+ * @since SmartDeviceLink 3.0
+ *
+ * @see SoftButtonCapabilities
+ * @see ButtonCapabilities
+ * @see OnButtonPress
+ */
public class TouchEvent extends RPCStruct {
public static final String KEY_ID = "id";
@@ -12,7 +60,14 @@ public class TouchEvent extends RPCStruct {
public static final String KEY_C = "c";
public TouchEvent() { }
-
+ /**
+ * <p>Constructs a new TouchEvent object indicated by the Hashtable parameter</p>
+ *
+ *
+ * @param hash
+ * <p>
+ * The Hashtable to use</p>
+ */
public TouchEvent(Hashtable<String, Object> hash) {
super(hash);
}
@@ -29,8 +84,18 @@ public class TouchEvent extends RPCStruct {
return (Integer) store.get(KEY_ID);
}
- @SuppressWarnings("unchecked")
+ /**
+ * Use getTimestamps
+ * @deprecated 4.0.2
+ * @return
+ */
+ @Deprecated
public List<Long> getTs() {
+ return getTimestamps();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Long> getTimestamps() {
if(store.get(KEY_TS) instanceof List<?>){
List<?> list = (List<?>)store.get(KEY_TS);
if(list != null && list.size()>0){
@@ -51,16 +116,35 @@ public class TouchEvent extends RPCStruct {
return null;
}
- public void setTs(List<Long> ts) {
- if (ts != null) {
+ public void setTimestamps(List<Long> ts){
+ if (ts != null) {
store.put(KEY_TS, ts);
} else {
store.remove(KEY_TS);
}
}
- @SuppressWarnings("unchecked")
+ /**
+ * Use setTimestamps.
+ * @deprecated 4.0.2
+ * @param ts
+ */
+ @Deprecated
+ public void setTs(List<Long> ts) {
+ setTimestamps(ts);
+ }
+
+ /**
+ * Use getTouchCoordinates
+ * @deprecated 4.0.2
+ * @return
+ */
+ @Deprecated
public List<TouchCoord> getC() {
+ return getTouchCoordinates();
+ }
+ @SuppressWarnings("unchecked")
+ public List<TouchCoord> getTouchCoordinates() {
if (store.get(KEY_C) instanceof List<?>) {
List<?> list = (List<?>)store.get(KEY_C);
if (list != null && list.size() > 0) {
@@ -79,7 +163,17 @@ public class TouchEvent extends RPCStruct {
return null;
}
+ /**
+ * Use setTouchCoordinates
+ * @deprecated 4.0.2
+ * @return
+ */
+ @Deprecated
public void setC( List<TouchCoord> c ) {
+ setTouchCoordinates(c);
+ }
+
+ public void setTouchCoordinates( List<TouchCoord> c ) {
if (c != null) {
store.put(KEY_C, c );
} else {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java
index 0daee4844..b67e5b61a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEventCapabilities.java
@@ -3,7 +3,46 @@ package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.proxy.RPCStruct;
import java.util.Hashtable;
-
+/**
+ * Types of screen touch events available in screen area.
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>SmartDeviceLink Version</th>
+ * </tr>
+ * <tr>
+ * <td>pressAvailable</td>
+ * <td>Boolean</td>
+ * <td></td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>multiTouchAvailable</td>
+ * <td>Boolean</td>
+ * <td></td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * <tr>
+ * <td>doublePressAvailable</td>
+ * <td>Boolean</td>
+ * <td></td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 3.0 </td>
+ * </tr>
+ * </table>
+ *
+ */
public class TouchEventCapabilities extends RPCStruct {
public static final String KEY_PRESS_AVAILABLE = "pressAvailable";
public static final String KEY_MULTI_TOUCH_AVAILABLE = "multiTouchAvailable";
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Turn.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Turn.java
index 1bfb8652c..437e176a5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Turn.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Turn.java
@@ -6,8 +6,8 @@ import com.smartdevicelink.proxy.RPCStruct;
/**
* Describes a navigation turn including an optional icon
- * <p>
- * <b>Parameter List
+ *
+ * <p><b>Parameter List</p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java
index aafdb53f9..8db9e032f 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java
@@ -10,14 +10,216 @@ import com.smartdevicelink.proxy.RPCRequest;
* dispose of all resources associated with the application's interface
* registration (e.g. Command Menu items, Choice Sets, button subscriptions,
* etc.)
- * <p>
- * After the UnregisterAppInterface operation is performed, no other operations
+ *
+ * <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>
- * <b>HMILevel can be FULL, LIMITED, BACKGROUND or NONE</b>
- * </p>
+ * 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
*/
@@ -29,9 +231,9 @@ public class UnregisterAppInterface extends RPCRequest {
super(FunctionID.UNREGISTER_APP_INTERFACE.toString());
}
/**
- * Constructs a new UnregisterAppInterface object indicated by the Hashtable
- * parameter
- * <p>
+ * <p>Constructs a new UnregisterAppInterface object indicated by the Hashtable
+ * parameter</p>
+ *
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java
index db425a503..d77bf3b39 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java
@@ -22,7 +22,7 @@ public class UnregisterAppInterfaceResponse extends RPCResponse {
/**
* Constructs a new UnregisterAppInterfaceResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
index 7575fd84a..33567a8af 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
@@ -9,13 +9,43 @@ import com.smartdevicelink.proxy.rpc.enums.ButtonName;
/**
* Deletes a subscription to button notifications for the specified button. For
* more information about button subscriptions, see {@linkplain SubscribeButton}
- * <p>
- * Application can unsubscribe from a button that is currently being pressed
- * (i.e. has not yet been released), but app will not get button event
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * <p>
*
+ * <p>Application can unsubscribe from a button that is currently being pressed
+ * (i.e. has not yet been released), but app will not get button event</p>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>buttonName</td>
+ * <td>ButtonName</td>
+ * <td>Name of the button to unsubscribe.</td>
+ * <td>Y</td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * </table>
+ *
+ * <p> <b>Response</b></p>
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR </p>
+ * <p>UNSUPPORTED_RESOURCE</p>
+ * <p>IGNORED</p>
+ * <p>REJECTED</p>
* @since SmartDeviceLink 1.0
* @see SubscribeButton
*/
@@ -31,7 +61,7 @@ public class UnsubscribeButton extends RPCRequest {
/**
* Constructs a new UnsubscribeButton object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java
index 58f7326e1..7efc00955 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java
@@ -22,7 +22,7 @@ public class UnsubscribeButtonResponse extends RPCResponse {
/**
* Constructs a new UnsubscribeButtonResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
index 429049d59..668b31fd9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
@@ -8,12 +8,224 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* This function is used to unsubscribe the notifications from the
* subscribeVehicleData function
- * <p>
- * Function Group: Location, VehicleInfo and DrivingChara
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * </p>
+ * <p>Function Group: Location, VehicleInfo and DrivingChara</p>
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
*
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Reg.</th>
+ * <th>Notes</th>
+ * <th>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>
+ * <p><b> Response</b></p>
+ * <p><b>Non-default Result Codes:</b></p>
+ * <p>SUCCESS</p>
+ * <p>WARNINGS</p>
+ * <p>INVALID_DATA</p>
+ * <p>OUT_OF_MEMORY</p>
+ * <p>TOO_MANY_PENDING_REQUESTS</p>
+ * <p>APPLICATION_NOT_REGISTERED</p>
+ * <p>GENERIC_ERROR</p>
+ * <p>IGNORED</p>
+ * <p>DISALLOWED</p>
+ *
* @since SmartDeviceLink 2.0
* @see SubscribeVehicleData
* @see GetVehicleData
@@ -55,7 +267,7 @@ public class UnsubscribeVehicleData extends RPCRequest {
/**
* Constructs a new UnsubscribeVehicleData object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
index 9d2cbf5bb..92d9a46df 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
@@ -7,7 +7,7 @@ import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.util.DebugTool;
/**
- * Unsubscribe Vehicle Data Response is sent, when UnsubscribeVehicleData has been called
+ * Unsubscribe Vehicle Data Response is sent, when UnsubscribeVehicleData has been called.
*
* @since SmartDeviceLink 2.0
*/
@@ -47,7 +47,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
/**
* Constructs a new UnsubscribeVehicleDataResponse object indicated by the Hashtable
* parameter
- * <p>
+ * <p></p>
*
* @param hash
* The Hashtable to use
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnList.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnList.java
index fd4f88fa8..ad2b41163 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnList.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnList.java
@@ -10,11 +10,11 @@ import com.smartdevicelink.proxy.RPCRequest;
/**
* Updates the list of next maneuvers, which can be requested by the user pressing the softbutton "Turns" on the
* Navigation base screen. Three softbuttons are predefined by the system: Up, Down, Close
- * <p>
- * Function Group: Navigation
- * <p>
- * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
- * <p>
+ *
+ * <p>Function Group: Navigation</p>
+ *
+ * <p><b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b></p>
+ *
*
* @since SmartDeviceLink 2.0
* @see ShowConstantTbt
@@ -49,7 +49,7 @@ public class UpdateTurnList extends RPCRequest{
* @param turnList
* a List<Turn> value representing a list of turns to be shown to the user
* <p>
- * <b>Notes: </b>Minsize=1; Maxsize=100
+ * <b>Notes: </b>Minsize=1; Maxsize=100</p>
*/
public void setTurnList(List<Turn> turnList){
if(turnList != null){
@@ -119,7 +119,7 @@ public class UpdateTurnList extends RPCRequest{
* @param softButtons
* a List<SoftButton> value
* <p>
- * <b>Notes: </b><br/>
+ * <b>Notes: </b></p>
* <ul>
* <li>If omitted on supported displays, the alert will not have any SoftButton</li>
* <li>ArrayMin: 0</li>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VehicleDataResult.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
index 8939b4895..ef466d727 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
@@ -5,10 +5,52 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataResultCode;
import com.smartdevicelink.proxy.rpc.enums.VehicleDataType;
-
+/**
+ *
+ * Individual published data request result.
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>dataType</td>
+ * <td>VehicleDataType</td>
+ * <td>Defined published data element type.</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * <tr>
+ * <td>resultCode</td>
+ * <td>VehicleDataResultCode</td>
+ * <td>Published data result code.</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 1.0</td>
+ * </tr>
+ * </table>
+ *
+ */
public class VehicleDataResult extends RPCStruct {
public static final String KEY_DATA_TYPE = "dataType";
public static final String KEY_RESULT_CODE = "resultCode";
+ /**
+ * <p>
+ * Constructs a new VehicleDataResult object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ *
+ * <p>The Hashtable to use</p>
+ */
public VehicleDataResult() { }
public VehicleDataResult(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VehicleType.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VehicleType.java
index 9de42c598..3f30774c4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VehicleType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VehicleType.java
@@ -6,7 +6,7 @@ import com.smartdevicelink.proxy.RPCStruct;
/**
* Describes the type of vehicle the mobile phone is connected with.
- * <p><b>Parameter List
+ * <p><b>Parameter List</b></p>
* <table border="1" rules="all">
* <tr>
* <th>Name</th>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VrHelpItem.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VrHelpItem.java
index bb77f3ebd..f195b4cae 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VrHelpItem.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/VrHelpItem.java
@@ -4,11 +4,61 @@ import java.util.Hashtable;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.util.DebugTool;
-
+/**
+ *
+ * VR help items i.e. the text strings to be displayed, and when pronounced by the user the recognition of any of which must trigger the corresponding VR command.
+ *
+ * <p><b>Parameter List</b></p>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th> Req.</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>text</td>
+ * <td>String</td>
+ * <td>Text to display for VR Help item</td>
+ * <td>Y</td>
+ * <td>maxlength: 500</td>
+ * <td>SmartDeviceLink 2.3.2</td>
+ * </tr>
+ * <tr>
+ * <td>image</td>
+ * <td>Image</td>
+ * <td>Image struct for VR Help item</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 2.3.2</td>
+ * </tr>
+ * <tr>
+ * <td>position</td>
+ * <td>Integer</td>
+ * <td>Position to display item in VR Help list</td>
+ * <td>N</td>
+ * <td> minvalue=1; maxvalue=100</td>
+ * <td>SmartDeviceLink 2.3.2</td>
+ * </tr>
+ * </table>
+ *
+ */
public class VrHelpItem extends RPCStruct {
public static final String KEY_POSITION = "position";
public static final String KEY_TEXT = "text";
public static final String KEY_IMAGE = "image";
+ /**
+ * <p>
+ * Constructs a new VrHelpItem object indicated by the Hashtable
+ * parameter
+ * </p>
+ *
+ * @param hash
+ * <p>
+ * The Hashtable to use
+ */
public VrHelpItem() { }
public VrHelpItem(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AmbientLightStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AmbientLightStatus.java
index 82eff5574..3f4076b11 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AmbientLightStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AmbientLightStatus.java
@@ -1,4 +1,13 @@
package com.smartdevicelink.proxy.rpc.enums;
+/** Reflects the status of the ambient light sensor.
+ *
+ * @since SmartDeviceLink 2.3.2
+ *
+ * @see SoftButtonCapabilities
+ * @see ButtonCapabilities
+ * @see OnButtonPress
+ *
+ */
public enum AmbientLightStatus {
NIGHT,
@@ -9,6 +18,11 @@ public enum AmbientLightStatus {
DAY,
UNKNOWN,
INVALID;
+ /**
+ * Convert String to AmbientLightStatus
+ * @param value String
+ * @return AmbientLightStatus
+ */
public static AmbientLightStatus valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
index 617fe9796..d4a7ff103 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
@@ -83,7 +83,11 @@ public enum AppInterfaceUnregisteredReason {
*/
PROTOCOL_VIOLATION,
;
-
+ /**
+ * Convert String to AppInterfaceUnregisteredReason
+ * @param value String
+ * @return AppInterfaceUnregisteredReason
+ */
public static AppInterfaceUnregisteredReason valueForString(String value) {
try{
return valueOf(value);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AudioStreamingState.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AudioStreamingState.java
index d332a560f..50accb6bf 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AudioStreamingState.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AudioStreamingState.java
@@ -30,6 +30,11 @@ public enum AudioStreamingState {
* @since SmartDeviceLink 1.0
*/
NOT_AUDIBLE;
+ /**
+ * Convert String to AudioStreamingState
+ * @param value String
+ * @return AudioStreamingState
+ */
public static AudioStreamingState valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AudioType.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AudioType.java
index 853a3951b..d340e0e4c 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AudioType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AudioType.java
@@ -3,6 +3,11 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Describes different audio type options for PerformAudioPassThru
*
+ * @see SoftButtonCapabilities
+ * @see ButtonCapabilities
+ * @see OnButtonPress
+ * @since SmartDeviceLink 2.0
+
*/
public enum AudioType {
/**
@@ -11,6 +16,11 @@ public enum AudioType {
* @since SmartDeviceLink 2.0
*/
PCM;
+ /**
+ * Convert String to AudioType
+ * @param value String
+ * @return AudioType
+ */
public static AudioType valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java
index 7065e7ade..b21e138a9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java
@@ -3,8 +3,9 @@ package com.smartdevicelink.proxy.rpc.enums;
import java.util.EnumSet;
/**
- * Describes different bit depth options for PerformAudioPassThru
- *
+ * Describes different bit depth options for PerformAudioPassThru.
+ * @see PerformAudioPassThru
+ * @since SmartDeviceLink 2.0
*/
public enum BitsPerSample {
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ButtonEventMode.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ButtonEventMode.java
index ad0301f10..33f1f0f49 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ButtonEventMode.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ButtonEventMode.java
@@ -3,8 +3,9 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Indicates whether the button was depressed or released. A BUTTONUP event will
* always be preceded by a BUTTONDOWN event
- * <p>
*
+ * @see SoftButtonCapabilities
+ * @see OnButtonEvent
* @since SmartDeviceLink 1.0
*/
public enum ButtonEventMode {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ButtonPressMode.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ButtonPressMode.java
index 8d6b7115b..cc2852526 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ButtonPressMode.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ButtonPressMode.java
@@ -1,10 +1,10 @@
package com.smartdevicelink.proxy.rpc.enums;
/**
- * Indicates whether this is a LONG or SHORT button press
- * <p>
- *
- * @since SmartDeviceLink 1.0
+ * Indicates whether this is a LONG or SHORT button press.
+ * <p></p>
+ *@see ButtonEventMode
+ *@since SmartDeviceLink 1.0
*/
public enum ButtonPressMode {
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/CarModeStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/CarModeStatus.java
index e24a2f8d0..c44b457ec 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/CarModeStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/CarModeStatus.java
@@ -1,10 +1,33 @@
package com.smartdevicelink.proxy.rpc.enums;
+/** Describes the carmode the vehicle is in.
+ * @see SoftButtonCapabilities
+ * @see ButtonCapabilities
+ * @see OnButtonPress
+ * @since SmartDeviceLink 2.0
+ */
public enum CarModeStatus {
+ /** Provides carmode NORMAL to each module.
+ */
+
NORMAL,
+ /** Provides carmode FACTORY to each module.
+ */
+
FACTORY,
+ /** Provides carmode TRANSPORT to each module.
+ */
+
TRANSPORT,
+ /** Provides carmode CRASH to each module.
+ */
+
+
CRASH;
+ /** Convert String to CarModeStatus
+ * @param value String
+ * @return CarModeStatus
+ */
public static CarModeStatus valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/DisplayType.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/DisplayType.java
index bf3e58118..4ff5a1bbb 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/DisplayType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/DisplayType.java
@@ -1,15 +1,64 @@
package com.smartdevicelink.proxy.rpc.enums;
+/** The type of the display.
+ *
+ *
+ * @since SmartDevcieLink 1.0
+ *
+ */
public enum DisplayType {
+ /**
+ * Center Information Display.
+ *This display type provides a 2-line x 20 character "dot matrix" display.
+ *
+ */
+
CID("CID"),
+ /** TYPE II display.
+ 1 line older radio head unit. */
+
TYPE2("TYPE2"),
+ /**
+ * TYPE V display
+ Old radio head unit.
+
+ */
+
TYPE5("TYPE5"),
+ /**
+ * Next Generation Navigation display.
+ */
+
NGN("NGN"),
+ /**
+ * GEN-2, 8 inch display.
+ */
+
GEN2_8_DMA("GEN2_8_DMA"),
+ /**
+ * GEN-2, 6 inch display.
+ */
+
GEN2_6_DMA("GEN2_6_DMA"),
+ /**
+ * 3 inch GEN1.1 display.
+ */
+
MFD3("MFD3"),
+ /**
+ * 4 inch GEN1.1 display
+ */
+
MFD4("MFD4"),
+ /**
+ * 5 inch GEN1.1 display.
+ */
+
MFD5("MFD5"),
+ /**
+ * GEN-3, 8 inch display.
+ */
+
GEN3_8_INCH("GEN3_8-INCH");
private final String INTERNAL_NAME;
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ECallConfirmationStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ECallConfirmationStatus.java
index 26408bcab..b7a341d9e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ECallConfirmationStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ECallConfirmationStatus.java
@@ -1,12 +1,39 @@
package com.smartdevicelink.proxy.rpc.enums;
+/** Reflects the status of the eCall Notification.
+ * <p>
+ *
+ * @since SmartDeviceLink 2.0
+ *
+ */
public enum ECallConfirmationStatus {
+ /**
+ * No E-Call signal triggered.
+ */
NORMAL,
+ /**
+ * An E-Call is being in progress.
+ */
CALL_IN_PROGRESS,
+ /**
+ * An E-Call was cancelled by the user.
+ */
CALL_CANCELLED,
+ /**
+ * The E-Call sequence is completed.
+ */
CALL_COMPLETED,
+ /**
+ * An E-Call could not be connected.
+ */
CALL_UNSUCCESSFUL,
+ /**
+ * E-Call is not configured on this vehicle.
+ */
ECALL_CONFIGURED_OFF,
+ /**
+ * E-Call is considered to be complete without Emergency Operator contact.
+ */
CALL_COMPLETE_DTMF_TIMEOUT;
public static ECallConfirmationStatus valueForString(String value) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/EmergencyEventType.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/EmergencyEventType.java
index 98fd5dfce..374a6c7e2 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/EmergencyEventType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/EmergencyEventType.java
@@ -1,15 +1,36 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/**
+ *
+ * Reflects the emergency event status of the vehicle.
+ *
+ */
public enum EmergencyEventType {
-
+ /** No emergency event has happened.
+ */
NO_EVENT,
+ /** Frontal collision has happened.
+ */
FRONTAL,
+ /** Side collision has happened.
+ */
SIDE,
+ /**Rear collision has happened.
+ */
REAR,
+ /** A rollover event has happened.
+ */
ROLLOVER,
+ /** The signal is not supported
+ */
NOT_SUPPORTED,
+ /** Emergency status cannot be determined
+ */
FAULT;
-
+ /**
+ * Convert String to EmergencyEventType
+ * @param value String
+ * @return EmergencyEventTpe
+ */
public static EmergencyEventType valueForString(String value) {
try{
return valueOf(value);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/FileType.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/FileType.java
index 704afd118..54e5ce8b8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/FileType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/FileType.java
@@ -1,7 +1,7 @@
package com.smartdevicelink.proxy.rpc.enums;
/**
- * Enumeration listing possible file tpyes.
+ * Enumeration listing possible file types.
* @since SmartDeviceLink 2.0
*/
public enum FileType {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/FuelCutoffStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/FuelCutoffStatus.java
index 53dd82583..266f13afb 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/FuelCutoffStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/FuelCutoffStatus.java
@@ -1,10 +1,27 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/** Reflects the status of the Restraints Control Module fuel pump cutoff.<br> The fuel pump is cut off typically after the vehicle has had a collision.
+ * <p>
+ *
+ * @since SmartDeviceLink 2.0
+ *
+ */
public enum FuelCutoffStatus {
+ /** Fuel is cut off
+ */
TERMINATE_FUEL,
+ /** Fuel is not cut off
+ *
+ */
NORMAL_OPERATION,
+ /** Status of the fuel pump cannot be determined
+ *
+ */
FAULT;
-
+ /**
+ * Convert String to FuelCutoffStatus
+ * @param value String
+ * @return FuelCuttoffStatus
+ */
public static FuelCutoffStatus valueForString(String value) {
try{
return valueOf(value);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
index 767355e46..a54d53d1d 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
@@ -13,10 +13,30 @@ public enum GlobalProperty{
* The prompt to be spoken if the user-initiated interaction times out waiting for the user's verbal input.
*/
TIMEOUTPROMPT,
+ /**
+ * The property vrHelpTitle of setGlobalProperties
+ */
+
VRHELPTITLE,
+ /**
+ * The property array of vrHelp of setGlobalProperties
+ */
+
VRHELPITEMS,
+ /**
+ * The property in-app menu name of setGlobalProperties
+ */
+
MENUNAME,
+ /**
+ * The property in-app menu icon of setGlobalProperties
+ */
+
MENUICON,
+ /**
+ * The on-screen keyboard configuration of setGlobalProperties
+ */
+
KEYBOARDPROPERTIES;
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/HMILevel.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/HMILevel.java
index 8f2da6991..8757a26ec 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/HMILevel.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/HMILevel.java
@@ -4,7 +4,7 @@ import java.util.EnumSet;
/**
* Specifies current level of the HMI. An HMI level indicates the degree of user interaction possible through the HMI (e.g. TTS only, display only, VR, etc.). The HMI level varies for an application based on the type of display (i.e. Nav or non-Nav) and the user directing "focus" to other applications (e.g. phone, other mobile applications, etc.)
- * <p>
+ *
* @since SmartDeviceLink 1.0
*/
public enum HMILevel {
@@ -17,7 +17,7 @@ public enum HMILevel {
*/
HMI_LIMITED("LIMITED"),
/**
- * App cannot interact with user via TTS, VR, Display or Button Presses. App can perform the following operations:<br/>
+ * App cannot interact with user via TTS, VR, Display or Button Presses. App can perform the following operations:
* <ul>
* <li>Operation {@linkplain com.smartdevicelink.proxy.rpc.AddCommand}</li>
* <li>Operation {@linkplain com.smartdevicelink.proxy.rpc.DeleteCommand}</li>
@@ -35,7 +35,7 @@ public enum HMILevel {
*/
HMI_BACKGROUND("BACKGROUND"),
/**
- * Application has been discovered by SDL, but application cannot send any requests or receive any notifications<br/>
+ * Application has been discovered by SDL, but application cannot send any requests or receive any notifications
* An HMILevel of NONE can also mean that the user has exited the application by saying "exit appname" or selecting "exit" from the application's menu. When this happens, the application still has an active interface registration with SDL and all SDL resources the application has created (e.g. Choice Sets, subscriptions, etc.) still exist. But while the HMILevel is NONE, the application cannot send any messages to SDL, except <i>{@linkplain com.smartdevicelink.proxy.rpc.UnregisterAppInterface}</li>
*/
HMI_NONE("NONE");
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/HmiZoneCapabilities.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/HmiZoneCapabilities.java
index e148fb347..4725b4ff4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/HmiZoneCapabilities.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/HmiZoneCapabilities.java
@@ -3,6 +3,7 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Specifies HMI Zones in the vehicle.
*
+ * @since SmartDeviceLink 1.0
*/
public enum HmiZoneCapabilities {
/**
@@ -17,6 +18,11 @@ public enum HmiZoneCapabilities {
* @since SmartDeviceLink 1.0
*/
BACK;
+ /**
+ * Convert String to HMIZoneCapabilities
+ * @param value String
+ * @return HMIZoneCapabilities
+ */
public static HmiZoneCapabilities valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/IgnitionStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/IgnitionStatus.java
index 81f2093c8..b17ccf1cf 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/IgnitionStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/IgnitionStatus.java
@@ -1,7 +1,7 @@
package com.smartdevicelink.proxy.rpc.enums;
/**
- * Reflects the status of ignition..
+ * Reflects the status of ignition.
* @since SmartDeviceLink 2.0
*/
public enum IgnitionStatus {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java
index 34971d10d..bf92ef5f4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java
@@ -1,16 +1,64 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/**
+ * The name that identifies the field.
+ *
+ * @since SmartDeviceLink 2.3.2
+ */
public enum ImageFieldName {
+ /** The image field for SoftButton
+ *
+ */
+
softButtonImage,
+ /** The first image field for Choice.
+ *
+ */
+
choiceImage,
+ /** The secondary image field for Choice.
+ *
+ */
+
choiceSecondaryImage,
+ /** The image field for vrHelpItem.
+ *
+ */
+
vrHelpItem,
+ /** The image field for Turn.
+ *
+ */
+
turnIcon,
+ /** The image field for the menu icon in SetGlobalProperties.
+ *
+ */
+
menuIcon,
+ /** The image filed for AddCommand.
+ *
+ */
+
cmdIcon,
+ /** The image field for the app icon ( set by setAppIcon).
+ *
+ */
+
appIcon,
+ /** The image filed for Show.
+ *
+ */
+
graphic,
+ /** The primary image field for ShowConstant TBT.
+ *
+ */
+
showConstantTBTIcon,
+
+ /** The secondary image field for ShowConstant TBT.
+ *
+ */
showConstantTBTNextTurnIcon,
/**
* The optional image of a destination / location
@@ -20,6 +68,11 @@ public enum ImageFieldName {
locationImage,
;
+ /**
+ * Convert String to ImageFieldName
+ * @param value String
+ * @return ImageFieldName
+ */
public static ImageFieldName valueForString(String value) {
try{
return valueOf(value);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/InteractionMode.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/InteractionMode.java
index c20bc7386..98b61a1f2 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/InteractionMode.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/InteractionMode.java
@@ -33,12 +33,12 @@ public enum InteractionMode {
* recognized choice), the interaction becomes strictly, and irreversibly, a
* VR_ONLY interaction (i.e. the MANUAL_ONLY mode forms of interaction will
* no longer be honored)
- * <P>
- * The TriggerSource parameter of the
+ *
+ * <p>The TriggerSource parameter of the
* {@linkplain com.smartdevicelink.proxy.rpc.PerformInteraction} response will
* indicate which interaction mode the user finally chose to attempt the
* selection (even if the interaction did not end with a selection being
- * made)
+ * made)</P>
*/
BOTH;
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java
index 524ee632c..7a730377d 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java
@@ -1,16 +1,39 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/**
+ * Enumeration listing possible keyboard events.
+ *
+ *
+ */
public enum KeyboardEvent {
+ /** The use has pressed the keyboard key (applies to both SINGLE_KEYPRESS and RESEND_CURRENT_ENTRY modes).
+ *
+ */
KEYPRESS,
+ /** The User has finished entering text from the keyboard and submitted the entry.
+ *
+ */
+
ENTRY_SUBMITTED,
+ /** The User has pressed the HMI-defined "Cancel" button.
+ *
+ */
+
ENTRY_CANCELLED,
+ /** The User has not finished entering text and the keyboard is aborted with the event of higher priority.
+ *
+ */
ENTRY_ABORTED,
/**
* @since SmartDeviceLink 4.0
*/
ENTRY_VOICE,
;
+ /**
+ * Convert String to KeyboardEvent
+ * @param value String
+ * @return KeyboardEvent
+ */
public static KeyboardEvent valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardLayout.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardLayout.java
index 6f1155a53..2cd71b3f3 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardLayout.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardLayout.java
@@ -1,5 +1,9 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/**
+ * Enumeration listing possible keyboard layouts.
+ *
+ * @since SmartDeviceLink 2.3.2
+ */
public enum KeyboardLayout {
QWERTY,
QWERTZ,
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeypressMode.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeypressMode.java
index cbfeed24d..32e198585 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeypressMode.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeypressMode.java
@@ -1,8 +1,21 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/**
+ * Enumeration listing possible keyboard events.
+ *
+ *
+ */
public enum KeypressMode {
+ /**
+ * Each keypress is individually sent as the user presses the keyboard keys.
+ */
SINGLE_KEYPRESS,
+ /**
+ * The keypresses are queued and a string is eventually sent once the user chooses to submit their entry.
+ */
QUEUE_KEYPRESSES,
+ /**
+ * The keypresses are queue and a string is sent each time the user presses a keyboard key; the string contains the entire current entry.
+ */
RESEND_CURRENT_ENTRY;
public static KeypressMode valueForString(String value) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Language.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Language.java
index 69fee7402..5f0a0b88f 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Language.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Language.java
@@ -4,35 +4,131 @@ import java.util.EnumSet;
/**
* Specifies the language to be used for TTS, VR, displayed messages/menus
- * <p>
+ *
*
* @since SmartDeviceLink 1.0
*
*/
public enum Language {
+ /**
+ * English - US
+ */
+
EN_US("EN-US"),
+ /**
+ * Spanish - Mexico
+ */
+
ES_MX("ES-MX"),
+ /**
+ * French - Canada
+ */
+
FR_CA("FR-CA"),
+ /**
+ * German - Germany
+ */
+
DE_DE("DE-DE"),
+ /**
+ * Spanish - Spain
+ */
+
ES_ES("ES-ES"),
+ /**
+ * English - GB
+ */
+
EN_GB("EN-GB"),
+ /**
+ * Russian - Russia
+ */
+
RU_RU("RU-RU"),
+ /**
+ * Turkish - Turkey
+ */
+
TR_TR("TR-TR"),
+ /**
+ * Polish - Poland
+ */
+
PL_PL("PL-PL"),
+ /**
+ * French - France
+ */
+
FR_FR("FR-FR"),
+ /**
+ * Italian - Italy
+ */
+
IT_IT("IT-IT"),
+ /**
+ * Swedish - Sweden
+ */
+
SV_SE("SV-SE"),
+ /**
+ * Portuguese - Portugal
+ */
+
PT_PT("PT-PT"),
+ /**
+ * Dutch (Standard) - Netherlands
+ */
+
NL_NL("NL-NL"),
+ /**
+ * English - Australia
+ */
+
EN_AU("EN-AU"),
+ /**
+ * Mandarin - China
+ */
+
ZH_CN("ZH-CN"),
+ /**
+ * Mandarin - Taiwan
+ */
+
ZH_TW("ZH-TW"),
+ /**
+ * Japanese - Japan
+ */
+
JA_JP("JA-JP"),
+ /**
+ * Arabic - Saudi Arabia
+ */
+
AR_SA("AR-SA"),
+ /**
+ * Korean - South Korea
+ */
+
KO_KR("KO-KR"),
+ /**
+ * Portuguese - Brazil
+ */
+
PT_BR("PT-BR"),
+ /**
+ * Czech - Czech Republic
+ */
+
CS_CZ("CS-CZ"),
+ /**
+ * Danish - Denmark
+ */
+
DA_DK("DA-DK"),
+ /**
+ * Norwegian - Norway
+ */
+
NO_NO("NO-NO");
private final String INTERNAL_NAME;
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LayoutMode.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LayoutMode.java
index 25783b1dc..b64cf1bb3 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LayoutMode.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LayoutMode.java
@@ -1,10 +1,29 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/**
+ * For touchscreen interactions, the mode of how the choices are presented.
+ *
+ *
+ */
public enum LayoutMode {
+ /**
+ * This mode causes the interaction to display the previous set of choices as icons.
+ */
ICON_ONLY,
+ /**
+ * This mode causes the interaction to display the previous set of choices as icons along with a search field in the HMI.
+ */
ICON_WITH_SEARCH,
+ /**
+ * This mode causes the interaction to display the previous set of choices as a list
+ */
LIST_ONLY,
+ /**
+ * This mode causes the interaction to display the previous set of choices as a list along with a search field in the HMI.
+ */
LIST_WITH_SEARCH,
+ /**
+ * This mode causes the interaction to immediately display a keyboard entry through the HMI.
+ */
KEYBOARD;
public static LayoutMode valueForString(String value) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LockScreenStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LockScreenStatus.java
index 740e262a8..ba25a3024 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LockScreenStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LockScreenStatus.java
@@ -1,8 +1,24 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/**
+ *
+ * Status of the Lock Screen.
+ *
+ */
public enum LockScreenStatus {
+ /**
+ * LockScreen is Required
+ */
+
REQUIRED,
+ /**
+ * LockScreen is Optional
+ */
+
OPTIONAL,
+ /**
+ * LockScreen is Not Required
+ */
+
OFF;
public static LockScreenStatus valueForString(String value) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MediaClockFormat.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MediaClockFormat.java
index f76ef9b3d..2bf84744a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MediaClockFormat.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MediaClockFormat.java
@@ -2,8 +2,8 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Indicates the format of the time displayed on the connected SDL unit.Format
- * description follows the following nomenclature:<br> Sp = Space<br> | = or <br>c =
- * character
+ * description follows the following nomenclature:<p> Sp = Space</p> <p>| = or </p><p>c =
+ * character</p>
*
* @since SmartDeviceLink 1.0
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PowerModeQualificationStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PowerModeQualificationStatus.java
index 381a0293e..c268e14aa 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PowerModeQualificationStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PowerModeQualificationStatus.java
@@ -1,10 +1,36 @@
package com.smartdevicelink.proxy.rpc.enums;
+/** Reflects the status of the current power mode qualification.
+ *
+ * @since SmartDeviceLink 2.0
+ *
+ */
public enum PowerModeQualificationStatus {
+ /** The power mode of the vehicle is currently considered undefined
+ *
+ */
+
POWER_MODE_UNDEFINED,
+ /** The evaluation of the power mode is in progress
+ *
+ */
+
POWER_MODE_EVALUATION_IN_PROGRESS,
+ /** Currently undefined
+ *
+ */
+
NOT_DEFINED,
+ /** The power mode of the vehicle
+ *
+ */
+
POWER_MODE_OK;
+ /**
+ * Convert String to PowerModeQualificationStatus
+ * @param value String
+ * @return PowerModeQualificationStatus
+ */
public static PowerModeQualificationStatus valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PowerModeStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PowerModeStatus.java
index 342130784..06ed3ba9a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PowerModeStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PowerModeStatus.java
@@ -1,14 +1,41 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/** Reflects the status of the current power mode.
+ *
+ * @since SmartDeviceLink 2.0
+ *
+ */
public enum PowerModeStatus {
+ /** Key not inserted
+ *
+ */
KEY_OUT,
+ /** Key is currently out
+ *
+ */
KEY_RECENTLY_OUT,
+
KEY_APPROVED_0,
POST_ACCESORY_0,
+ /** Key is in accessory positon
+ *
+ */
+
ACCESORY_1,
POST_IGNITION_1,
+
+ /** Key is in position ignition on
+ *
+ */
IGNITION_ON_2,
+ /** Key is in position running
+ *
+ */
+
RUNNING_2,
+ /** Key is in crank position
+ *
+ */
+
CRANK_3;
public static PowerModeStatus valueForString(String value) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PrerecordedSpeech.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PrerecordedSpeech.java
index 331d8eb00..2b27040a6 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PrerecordedSpeech.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PrerecordedSpeech.java
@@ -1,11 +1,20 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/**
+ * Contains a list of Pre-recorded speech items present on the platform.
+ *
+ *
+ */
public enum PrerecordedSpeech {
HELP_JINGLE,
INITIAL_JINGLE,
LISTEN_JINGLE,
POSITIVE_JINGLE,
NEGATIVE_JINGLE;
+ /**
+ * Convert String to PrerecordedSpeech
+ * @param value String
+ * @return PrerecordedSpeech
+ */
public static PrerecordedSpeech valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/RequestType.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/RequestType.java
index 5d8198884..0ddcfef3a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/RequestType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/RequestType.java
@@ -1,5 +1,9 @@
package com.smartdevicelink.proxy.rpc.enums;
-
+/**
+ * Enumeration listing possible asynchronous requests.
+ *
+ *
+ */
public enum RequestType {
HTTP,
@@ -65,7 +69,11 @@ public enum RequestType {
*/
FOTA,
;
-
+ /**
+ * Convert String to RequestType
+ * @param value String
+ * @return RequestType
+ */
public static RequestType valueForString(String value) {
try{
return valueOf(value);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Result.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Result.java
index 557069c15..870e4115e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Result.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Result.java
@@ -3,7 +3,7 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Defines the possible result codes returned by SDL to the application in a
* Response to a requested operation
- * <p>
+ *
*
* @since SmartDeviceLink 1.0
*/
@@ -13,7 +13,7 @@ public enum Result {
*/
SUCCESS,
/**
- * The data sent is invalid. For example:<br/>
+ * <p>The data sent is invalid. For example:</p>
* <ul>
* <li>Invalid Json syntax</li>
* <li>Parameters out of bounds (number or enum range)</li>
@@ -39,7 +39,7 @@ public enum Result {
*/
TOO_MANY_PENDING_REQUESTS,
/**
- * One of the provided IDs is not valid. For example:<br/>
+ * <p>One of the provided IDs is not valid. For example:</p>
* <ul>
* <li>CorrelationID</li>
* <li>CommandID</li>
@@ -169,6 +169,11 @@ 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;
+ /**
+ * Convert String to Result
+ * @param value String
+ * @return Result
+ */
public static Result valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java
index 4af196487..e659ff165 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java
@@ -4,7 +4,7 @@ import java.util.EnumSet;
/**
* Describes different sampling rates for PerformAudioPassThru
- *
+ * @since SmartDeviceLink 2.0
*/
public enum SamplingRate {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java
index ac1ba6ac1..0d1902e3a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java
@@ -20,7 +20,14 @@ public enum SdlDisconnectedReason {
BLUETOOTH_ADAPTER_ERROR,
SDL_REGISTRATION_ERROR,
APP_INTERFACE_UNREG,
- GENERIC_ERROR;
+ GENERIC_ERROR,
+ /**
+ * This only occurs when multiplexing is running and it is found to be on an old gen 1 system.
+ */
+ LEGACY_BLUETOOTH_MODE_ENABLED,
+ RPC_SESSION_ENDED
+ ;
+
public static SdlDisconnectedReason valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java
index 454b4ed77..29fa27020 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java
@@ -1,10 +1,24 @@
package com.smartdevicelink.proxy.rpc.enums;
import java.util.EnumSet;
-
+/** The enumeration defines the types of the soft buttons to be displayed on UI component:<p>The text is displayed on the soft button</p>
+ *<p>The image is displayed on the soft button</p>
+ *<p>Both image and text are displayed on the soft button.</p>
+ *
+ * @since SmartDeviceLink 2.0
+ */
public enum SoftButtonType {
+ /** Text displayed
+ *
+ */
SBT_TEXT("TEXT"),
+ /** Image displayed
+ *
+ */
SBT_IMAGE("IMAGE"),
+ /** Image displayed
+ *
+ */
SBT_BOTH("BOTH");
private final String INTERNAL_NAME;
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SpeechCapabilities.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SpeechCapabilities.java
index 4b80d12c7..2b5d17740 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SpeechCapabilities.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SpeechCapabilities.java
@@ -11,10 +11,31 @@ public enum SpeechCapabilities {
* @since SmartDeviceLink 1.0
*/
TEXT,
+ /**
+ * The SDL platform can interpret and speak LHPLUS phonemes
+ */
+
SAPI_PHONEMES,
+
+ /**
+ * The SDL platform can interpret and speak LHPLUS phonemes
+ */
+
LHPLUS_PHONEMES,
+ /**
+ * The SDL platform can play pre-recorded sounds as part of a TTS operation.<p>(e.g. Speak, Alert, PerformInteraction, etc.).</p>
+ */
PRE_RECORDED,
+ /**
+ * The SDL platform can play the prerecorded sound of 1 second of silence (i.e. no sound at all).
+ */
+
SILENCE;
+ /**
+ * Convert String to SpeechCapabilities
+ * @param value String
+ * @return SpeechCapabilities
+ */
public static SpeechCapabilities valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SystemAction.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SystemAction.java
index 58c4e2bbc..835e9b1b9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SystemAction.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/SystemAction.java
@@ -1,9 +1,31 @@
package com.smartdevicelink.proxy.rpc.enums;
+/** Enumeration that describes system actions that can be triggered.
+ *
+ * @since SmartDeviceLink 2.0
+ *
+ */
public enum SystemAction {
+ /** Default action occurs. Standard behavior (e.g. SoftButton clears overlay).
+ *
+ */
+
DEFAULT_ACTION,
+ /** App is brought into HMI_FULL.
+ *
+ */
+
STEAL_FOCUS,
+ /** Current system context is maintained. An overlay is persisted even though a SoftButton has been pressed and the notification sent.
+ *
+ */
+
KEEP_CONTEXT;
+ /**
+ * Convert String to SystemAction
+ * @param value String
+ * @return SystemAction
+ */
public static SystemAction valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TBTState.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TBTState.java
index 457c8ed59..d334ccad7 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TBTState.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TBTState.java
@@ -9,14 +9,50 @@ public enum TBTState {
* Indicates that driver requested a route update.
*/
ROUTE_UPDATE_REQUEST,
+ /**
+ * Confirmation from HMI about accepting the route.
+ */
+
ROUTE_ACCEPTED,
+ /**
+ * Information from HMI about the route refusal.
+ */
+
ROUTE_REFUSED,
+ /**
+ * Information from HMI about canceling the route.
+ */
+
ROUTE_CANCELLED,
+ /**
+ * Request from HMI for Estimated time of arrival.
+ */
+
ETA_REQUEST,
+ /**
+ * Request from HMI for the information of the next turn.
+ */
+
NEXT_TURN_REQUEST,
+ /**
+ * Request from HMI for the route status.
+ */
+
ROUTE_STATUS_REQUEST,
+ /**
+ * Request from HMI for the route summary.
+ */
+
ROUTE_SUMMARY_REQUEST,
+ /**
+ * Request from HMI for the information about trip status.
+ */
+
TRIP_STATUS_REQUEST,
+ /**
+ * Request from HMI for the timeout for waiting for the route updating.
+ */
+
ROUTE_UPDATE_REQUEST_TIMEOUT;
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java
index 073741e3a..ded9d0571 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java
@@ -1,29 +1,129 @@
package com.smartdevicelink.proxy.rpc.enums;
+/** Names of the text fields that can appear on the display.
+ *
+ * @since SmartDeviceLink 1.0
+ *
+ */
public enum TextFieldName {
+ /** The first line of first set of main fields of the persistent display; applies to "Show"
+ *
+ */
+
mainField1,
+ /** The second line of first set of main fields of the persistent display; applies to "Show"
+ *
+ */
+
mainField2,
+ /** The first line of second set of main fields of persistent display; applies to "Show"
+ *
+ */
+
mainField3,
+ /** The second line of second set of main fields of the persistent display; applies to "Show"
+ *
+ */
+
mainField4,
+ /** The status bar on NGN; applies to "Show"
+ *
+ */
+
statusBar,
+ /** Text value for MediaClock field; applies to "Show"
+ *
+ */
+
mediaClock,
+ /** The track field of NGN and GEN1.1 MFD displays. This field is only available for media applications; applies to "Show"
+ *
+ */
+
mediaTrack,
+ /** The first line of the alert text field; applies to "Alert"
+ *
+ */
+
alertText1,
+ /** The second line of the alert text field; applies to "Alert"
+ *
+ */
+
alertText2,
+ /** The third line of the alert text field; applies to "Alert"
+ *
+ */
+
alertText3,
+ /** Long form body of text that can include newlines and tabs; applies to "ScrollableMessage"
+ *
+ */
+
scrollableMessageBody,
+ /** First line suggestion for a user response (in the case of VR enabled interaction)
+ *
+ */
+
initialInteractionText,
+ /** First line of navigation text
+ *
+ */
+
navigationText1,
+ /** Second line of navigation text
+ *
+ */
+
navigationText2,
+ /** Estimated Time of Arrival time for navigation
+ *
+ */
+
ETA,
+ /** Total distance to destination for navigation
+ *
+ */
+
totalDistance,
+ /** First line of text for audio pass thru
+ *
+ */
+
audioPassThruDisplayText1,
+ /** Second line of text for audio pass thru
+ *
+ */
+
audioPassThruDisplayText2,
+ /** Header text for slider
+ *
+ */
+
sliderHeader,
+ /** Footer text for slider
+ *
+ */
+
sliderFooter,
+ /** Primary text for Choice
+ *
+ */
+
menuName,
+ /** Secondary text for Choice
+ *
+ */
+
secondaryText,
+ /** Tertiary text for Choice
+ *
+ */
+
tertiaryText,
+ /** Optional text to label an app menu button (for certain touchscreen platforms).
+ *
+ */
menuTitle,
/**
* Optional name / title of intended location for SendLocation.
@@ -50,6 +150,11 @@ public enum TextFieldName {
*/
phoneNumber,
;
+ /**
+ * Convert String to TextFieldName
+ * @param value String
+ * @return TextFieldName
+ */
public static TextFieldName valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TouchType.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TouchType.java
index 127139c13..952904915 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TouchType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TouchType.java
@@ -1,9 +1,31 @@
package com.smartdevicelink.proxy.rpc.enums;
+/** The type of touch event.
+ *
+ * @since SmartDeviceLink 2.3.2
+ *
+ */
public enum TouchType {
+ /** The user has touched the screen.
+ *
+ */
+
BEGIN,
+ /** The User has moved his finger over the screen.
+ *
+ */
+
MOVE,
+ /** The User has removed his finger from the screen.
+ *
+ */
+
END;
+ /**
+ * Convert String to TouchType
+ * @param value String
+ * @return TouchType
+ */
public static TouchType valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/UpdateMode.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/UpdateMode.java
index 15c45b5f7..cd9bf6dfe 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/UpdateMode.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/UpdateMode.java
@@ -2,7 +2,7 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Specifies what function should be performed on the media clock/counter
- * <p>
+ *
*
* @since SmartDeviceLink 1.0
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataNotificationStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataNotificationStatus.java
index 1c132f26c..d7bca9fc7 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataNotificationStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataNotificationStatus.java
@@ -3,11 +3,27 @@ package com.smartdevicelink.proxy.rpc.enums;
/**
* Reflects the status of a vehicle data notification.
* @since SmartDeviceLink 2.0
+ *
+ * @see SoftButtonCapabilities
+ * @see ButtonCapabilities
+ * @see OnButtonPress
*/
public enum VehicleDataNotificationStatus {
+ /**
+ * VehicleDataNotificationStatus is not supported.
+ */
NOT_SUPPORTED,
+ /**
+ * VehicleDataNotificationStatus is normal.
+ */
NORMAL,
+ /**
+ * VehicleDataNotificationStatus is active.
+ */
ACTIVE,
+ /**
+ * VehicleDataNotificationStatus is not in use.
+ */
NOT_USED;
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java
index 8de4ca88f..45c2e7c11 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java
@@ -1,19 +1,58 @@
package com.smartdevicelink.proxy.rpc.enums;
+/** Enumeration that describes possible result codes of a vehicle data entry request.
+ *
+ * @since SmartDeviceLink 2.0
+ *
+ *@see DIDResult
+ *@see ReadDID
+ */
public enum VehicleDataResultCode {
+ /**Individual vehicle data item / DTC / DID request or subscription successful
+ *
+ */
+
SUCCESS,
/**
*DTC / DID request successful, however, not all active DTCs or full contents of DID location available
*
* @since SmartDeviceLink 4.0
*/
+
TRUNCATED_DATA,
+ /** This vehicle data item is not allowed for this app .The request is not authorized in local policies.
+ *
+ */
+
DISALLOWED,
+ /** The user has not granted access to this type of vehicle data item at this time.
+ *
+ */
+
USER_DISALLOWED,
+ /** The ECU ID referenced is not a valid ID on the bus / system.
+ *
+ */
+
INVALID_ID,
+ /** The requested vehicle data item / DTC / DID is not currently available or responding on the bus / system.
+ *
+ */
+
VEHICLE_DATA_NOT_AVAILABLE,
+ /** The vehicle data item is already subscribed.
+ *
+ */
+
DATA_ALREADY_SUBSCRIBED,
+ /** The vehicle data item cannot be unsubscribed because it is not currently subscribed.
+ *
+ */
+
DATA_NOT_SUBSCRIBED,
+ /** The request for this item is ignored because it is already in progress
+ */
+
IGNORED;
public static VehicleDataResultCode valueForString(String value) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataStatus.java
index b944c0eed..2245bbe71 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataStatus.java
@@ -10,7 +10,15 @@ public enum VehicleDataStatus {
* No data available
*/
NO_DATA_EXISTS,
+ /**
+ * The vehicle item is in Off state
+ */
+
OFF,
+ /**
+ * The vehicle item is in On state
+ */
+
ON;
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
index fe777e707..adebca268 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
@@ -1,36 +1,119 @@
package com.smartdevicelink.proxy.rpc.enums;
/**
- * Defines the vehicle data types that can be published and subscribed to
+ * Defines the vehicle data types that can be published and subscribed to.
*
*/
public enum VehicleDataType {
+ /**
+ * Notifies GPSData may be subscribed
+ */
VEHICLEDATA_GPS,
+ /**
+ * Notifies SPEED Data may be subscribed
+ */
VEHICLEDATA_SPEED,
+ /**
+ * Notifies RPMData may be subscribed
+ */
VEHICLEDATA_RPM,
+ /**
+ * Notifies FUELLEVELData may be subscribed
+ */
VEHICLEDATA_FUELLEVEL,
+ /**
+ * Notifies FUELLEVEL_STATEData may be subscribed
+ */
VEHICLEDATA_FUELLEVEL_STATE,
+/**
+ * Notifies FUELCONSUMPTIONData may be subscribed
+ */
VEHICLEDATA_FUELCONSUMPTION,
+ /**
+ * Notifies EXTERNTEMPData may be subscribed
+ */
VEHICLEDATA_EXTERNTEMP,
+ /**
+ * Notifies VINData may be subscribed
+ */
VEHICLEDATA_VIN,
+ /**
+ * Notifies PRNDLData may be subscribed
+ */
VEHICLEDATA_PRNDL,
+ /**
+ * Notifies TIREPRESSUREData may be subscribed
+ */
VEHICLEDATA_TIREPRESSURE,
- VEHICLEDATA_ODOMETER,
+ /**
+ * Notifies ODOMETERData may be subscribed
+ */
+ VEHICLEDATA_ODOMETER,
+ /**
+ * Notifies BELTSTATUSData may be subscribed
+ */
VEHICLEDATA_BELTSTATUS,
+ /**
+ * Notifies BODYINFOData may be subscribed
+ */
VEHICLEDATA_BODYINFO,
+ /**
+ * Notifies DEVICESTATUSData may be subscribed
+ */
VEHICLEDATA_DEVICESTATUS,
+ /**
+ * Notifies BRAKINGData may be subscribed
+ */
VEHICLEDATA_BRAKING,
+ /**
+ * Notifies WIPERSTATUSData may be subscribed
+ */
VEHICLEDATA_WIPERSTATUS,
+ /**
+ * Notifies HEADLAMPSTATUSData may be subscribed
+ */
VEHICLEDATA_HEADLAMPSTATUS,
+ /**
+ * Notifies BATTVOLTAGEData may be subscribed
+ */
VEHICLEDATA_BATTVOLTAGE,
+ /**
+ * Notifies EGINETORQUEData may be subscribed
+ */
VEHICLEDATA_ENGINETORQUE,
+ /**
+ * Notifies ACCPEDALData may be subscribed
+ */
VEHICLEDATA_ACCPEDAL,
+ /**
+ * Notifies STEERINGWHEELData may be subscribed
+ */
VEHICLEDATA_STEERINGWHEEL,
+ /**
+ * Notifies ECALLINFOData may be subscribed
+ */
VEHICLEDATA_ECALLINFO,
+ /**
+ * Notifies AIRBAGSTATUSData may be subscribed
+ */
VEHICLEDATA_AIRBAGSTATUS,
+ /**
+ * Notifies EMERGENCYEVENTData may be subscribed
+ */
VEHICLEDATA_EMERGENCYEVENT,
+ /**
+ * Notifies CLUSTERMODESTATUSData may be subscribed
+ */
VEHICLEDATA_CLUSTERMODESTATUS,
+ /**
+ * Notifies MYKEYData may be subscribed
+ */
VEHICLEDATA_MYKEY;
+ /**
+ * Convert String to VehicleDataType
+ * @param value String
+ * @return VehicleDataType
+ */
public static VehicleDataType valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/WiperStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/WiperStatus.java
index 3c67ddfca..546cf05b5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/WiperStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/WiperStatus.java
@@ -1,21 +1,92 @@
package com.smartdevicelink.proxy.rpc.enums;
+/** This enumeration reflects the status of the wipers.
+ *
+ * @since SmartDeviceLink 2.0
+ *
+ * @see GetVehicleData
+ * @see OnVehicleData
+ */
public enum WiperStatus {
+ /** The wipers are off.
+ *
+ */
+
OFF,
+ /** The wipers are automatically off after detecting the wipers do not need to be engaged (rain stopped, etc.).
+ *
+ */
+
AUTO_OFF,
+ /** Means that though set to off, somehow the wipers have been engaged (physically moved enough to engage a wiping motion).
+ *
+ */
+
OFF_MOVING,
+ /** The wipers are manually off after having been working.
+ *
+ */
+
MAN_INT_OFF,
+ /** The wipers are manually on.
+ *
+ */
+
MAN_INT_ON,
+ /** The wipers are manually set to low speed.
+ *
+ */
+
MAN_LOW,
+ /** The wipers are manually set to high speed.
+ *
+ */
+
MAN_HIGH,
+ /** The wipers are manually set for doing a flick.
+ *
+ */
+
MAN_FLICK,
+ /** The wipers are set to use the water from vehicle washer bottle for cleaning the windscreen.
+ *
+ */
+
WASH,
+ /** The wipers are automatically set to low speed.
+ *
+ */
+
AUTO_LOW,
+ /** The wipers are automatically set to high speed.
+ *
+ */
+
AUTO_HIGH,
+ /** This is for when a user has just initiated a WASH and several seconds later a secondary wipe is automatically initiated to clear remaining fluid
+ */
+
COURTESYWIPE,
+ /** This is set as the user moves between possible automatic wiper speeds.
+ *
+ */
+
AUTO_ADJUST,
+ /** The wiper is stalled to its place. There may be an obstruction.
+ *
+ */
+
STALLED,
+ /** The sensor / module cannot provide any information for wiper.
+ *
+ */
+
NO_DATA_EXISTS;
+ /**
+ * Convert String to WiperStatus
+ * @param value String
+ * @return WiperStatus
+ */
public static WiperStatus valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java b/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java
index 673f03f3a..0e00ecad7 100644
--- a/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java
+++ b/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java
@@ -155,10 +155,15 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
PutFile msg = (PutFile) _request;
sFileName = msg.getSdlFileName();
long iOffsetCounter = msg.getOffset();
-
- if (lFileSize != 0)
- msg.setLength(lFileSize);
+ int priorityCoefficient = 1;
+
+ if (lFileSize != 0)
+ {
+ Long iFileSize = (long) lFileSize;
+ //TODO: PutFile RPC needs to be updated to accept Long as we might run into overflows since a Long can store a wider range than an Integer
+ msg.setLength(iFileSize);
+ }
Long iFileLength = msg.getLength();
notificationList.clear();
@@ -213,6 +218,9 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
pm.setCorrID(msg.getCorrelationID());
pm.setPayloadProtected(isRPCProtected);
+ priorityCoefficient++;
+ pm.setPriorityCoefficient(priorityCoefficient);
+
notification = new OnStreamRPC();
notification.setFileName(msg.getSdlFileName());
notification.setFileSize(iFileLength);
diff --git a/sdl_android_lib/src/com/smartdevicelink/trace/SdlTrace.java b/sdl_android_lib/src/com/smartdevicelink/trace/SdlTrace.java
index 689811b70..2d997b1c4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/trace/SdlTrace.java
+++ b/sdl_android_lib/src/com/smartdevicelink/trace/SdlTrace.java
@@ -1,12 +1,14 @@
package com.smartdevicelink.trace;
import java.sql.Timestamp;
+
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothDevice;
import android.os.Build;
import android.os.Debug;
import android.os.Process;
-import com.smartdevicelink.protocol.ProtocolFrameHeader;
+
+import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.protocol.enums.FrameDataControlFrameType;
import com.smartdevicelink.protocol.enums.FrameType;
import com.smartdevicelink.protocol.enums.SessionType;
@@ -218,7 +220,7 @@ public class SdlTrace {
return writeXmlTraceMessage(xml);
}
- public static boolean logProtocolEvent(InterfaceActivityDirection frameDirection, ProtocolFrameHeader frameHeader, byte[] frameData, int frameDataOffset, int frameDataLength, String token) {
+ public static boolean logProtocolEvent(InterfaceActivityDirection frameDirection, SdlPacket packet, int frameDataOffset, int frameDataLength, String token) {
DetailLevel dl = DiagLevel.getLevel(Mod.proto);
if (dl == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
return false;
@@ -226,12 +228,12 @@ public class SdlTrace {
StringBuffer protoMsg = new StringBuffer();
protoMsg.append("<frame>");
- protoMsg.append(SdlTrace.getProtocolFrameHeaderInfo(frameHeader, frameData));
+ protoMsg.append(SdlTrace.getProtocolFrameHeaderInfo(packet));
if (dl == DetailLevel.VERBOSE) {
- if (frameData != null && frameDataLength > 0) {
+ if (packet.getPayload() != null && frameDataLength > 0) {
protoMsg.append("<d>");
String bytesInfo = "";
- bytesInfo = Mime.base64Encode(frameData, frameDataOffset, frameDataLength);
+ bytesInfo = Mime.base64Encode(packet.getPayload(), frameDataOffset, frameDataLength);
// Base64 only available in 2.2, when SmartDeviceLink base is 2.2 use: bytesInfo = Base64.encodeToString(frameData, frameDataOffset, frameDataLength, Base64.DEFAULT);
protoMsg.append(bytesInfo);
protoMsg.append("</d>");
@@ -266,7 +268,7 @@ public class SdlTrace {
return s;
} // end-method
- private static String getProtocolFrameHeaderInfo(ProtocolFrameHeader hdr, byte[] buf) {
+ private static String getProtocolFrameHeaderInfo(SdlPacket hdr) {
StringBuilder sb = new StringBuilder();
sb.append("<hdr>");
sb.append("<ver>");
@@ -276,14 +278,14 @@ public class SdlTrace {
sb.append("</cmp><ft>");
sb.append(getProtocolFrameType(hdr.getFrameType()));
sb.append("</ft><st>");
- sb.append(getProtocolSessionType(hdr.getSessionType()));
+ sb.append(getProtocolSessionType(SessionType.valueOf((byte)hdr.getServiceType())));
sb.append("</st><sid>");
- sb.append(hdr.getSessionID());
+ sb.append(hdr.getSessionId());
sb.append("</sid><sz>");
sb.append(hdr.getDataSize());
sb.append("</sz>");
- int frameData = hdr.getFrameData();
+ int frameData = hdr.getFrameInfo();
if (hdr.getFrameType() == FrameType.Control) {
sb.append("<ca>");
if (frameData == FrameDataControlFrameType.StartSession.getValue())
@@ -303,8 +305,8 @@ public class SdlTrace {
sb.append(String.format("%02X",frameData));
sb.append("</fsn>");
} else if (hdr.getFrameType() == FrameType.First ) {
- int totalSize = BitConverter.intFromByteArray(buf, 0);
- int numFrames = BitConverter.intFromByteArray(buf, 4);
+ int totalSize = BitConverter.intFromByteArray(hdr.getPayload(), 0);
+ int numFrames = BitConverter.intFromByteArray(hdr.getPayload(), 4);
sb.append("<total>" + totalSize + "</total><numframes>" + numFrames + "</numframes>");
} else if (hdr.getFrameType() == FrameType.Single ) {
sb.append("<single/>");
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java
index e45c2967b..e41c501e5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java
@@ -12,8 +12,10 @@ import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.os.Build.VERSION;
+import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
+import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.trace.SdlTrace;
import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
import com.smartdevicelink.transport.enums.TransportType;
@@ -31,7 +33,6 @@ public class BTTransport extends SdlTransport {
private BluetoothAdapter _adapter = null;
private BluetoothSocket _activeSocket = null;
- private InputStream _input = null;
private UUID _listeningServiceUUID = SDL_V4_MOBILE_APPLICATION_SVC_CLASS;
private BluetoothAdapterMonitor _bluetoothAdapterMonitor = null;
private TransportReaderThread _transportReader = null;
@@ -133,8 +134,7 @@ public class BTTransport extends SdlTransport {
}*/
- public void openConnection () throws SdlException {
-
+ public void openConnection () throws SdlException {
if (_serverSocket != null) {
return;
}
@@ -145,15 +145,18 @@ public class BTTransport extends SdlTransport {
// Test if Adapter exists
if (_adapter == null) {
+ SdlConnection.enableLegacyMode(false, null);
throw new SdlException("No Bluetooth adapter found. Bluetooth adapter must exist to communicate with SDL.", SdlExceptionCause.BLUETOOTH_ADAPTER_NULL);
}
// Test if Bluetooth is enabled
try {
if (!_adapter.isEnabled()) {
+ SdlConnection.enableLegacyMode(false, null);
throw new SdlException("Bluetooth adapter must be enabled to instantiate a SdlProxy object.", SdlExceptionCause.BLUETOOTH_DISABLED);
}
} catch (SecurityException e) {
+ SdlConnection.enableLegacyMode(false, null);
throw new SdlException("Insufficient permissions to interact with the Bluetooth Adapter.", SdlExceptionCause.PERMISSION_DENIED);
}
@@ -166,32 +169,36 @@ public class BTTransport extends SdlTransport {
int iSocket = getChannel(mySock);
sComment = "Accepting Connections on SDP Server Port Number: " + iSocket + "\r\n";
- sComment += "Keep Server Socket Open: " + bKeepSocketActive;
+ sComment += "Keep Server Socket Open: " + bKeepSocketActive;
if (iSocket < 0)
{
+ SdlConnection.enableLegacyMode(false, null);
throw new SdlException("Could not open connection to SDL.", SdlExceptionCause.BLUETOOTH_SOCKET_UNAVAILABLE);
}
} catch (IOException e) {
-
+ SdlConnection.enableLegacyMode(false, null);
throw new SdlException("Could not open connection to SDL.", SdlExceptionCause.BLUETOOTH_SOCKET_UNAVAILABLE);
} catch (Exception ex) {
// Test to determine if the bluetooth has been disabled since last check
if (!_adapter.isEnabled()) {
+ SdlConnection.enableLegacyMode(false, null);
throw new SdlException("Bluetooth adapter must be on to instantiate a SdlProxy object.", SdlExceptionCause.BLUETOOTH_DISABLED);
}
if(((SdlException) ex).getSdlExceptionCause() == SdlExceptionCause.BLUETOOTH_SOCKET_UNAVAILABLE) {
-
+ SdlConnection.enableLegacyMode(false, null);
throw new SdlException("Could not open connection to SDL.", SdlExceptionCause.BLUETOOTH_SOCKET_UNAVAILABLE);
}
+ SdlConnection.enableLegacyMode(false, null);
throw new SdlException("Could not open connection to SDL.", ex, SdlExceptionCause.SDL_CONNECTION_FAILED);
}
// Test to ensure serverSocket is not null
if (_serverSocket == null) {
+ SdlConnection.enableLegacyMode(false, null);
throw new SdlException("Could not open connection to SDL.", SdlExceptionCause.SDL_CONNECTION_FAILED);
}
@@ -271,14 +278,7 @@ public class BTTransport extends SdlTransport {
DebugTool.logError("Failed to close activeSocket", e);
} // end-catch
- try {
- if (_input != null) {
- _input.close();
- _input = null;
- }
- } catch (Exception e) {
- DebugTool.logError("Failed to close input stream", e);
- } // end-catch
+
try {
if (_output != null) {
@@ -306,10 +306,11 @@ public class BTTransport extends SdlTransport {
* Sends data over the transport. Takes a byte array and transmits data provided starting at the
* offset and of the provided length to fragment transmission.
*/
- public boolean sendBytesOverTransport(byte[] msgBytes, int offset, int length) {
+ public boolean sendBytesOverTransport(SdlPacket packet) {
boolean sendResult = false;
try {
- _output.write(msgBytes, offset, length);
+ byte[] msgBytes = packet.constructPacket();
+ _output.write(msgBytes, 0, msgBytes.length);
sendResult = true;
} catch (Exception ex) {
DebugTool.logError("Error writing to Bluetooth socket: " + ex.toString(), ex);
@@ -322,17 +323,24 @@ public class BTTransport extends SdlTransport {
private class TransportReaderThread extends Thread {
-
- byte[] buf = new byte[4096];
private Boolean isHalted = false;
-
+ SdlPsm psm;
+ byte byteRead = -1;
+ boolean stateProgress = false;
+
+ private InputStream _input = null;
+
+
+ public TransportReaderThread(){
+ psm = new SdlPsm();
+ }
public void halt() {
isHalted = true;
}
private void acceptConnection() {
SdlTrace.logTransportEvent("BTTransport: Waiting for incoming RFCOMM connect", "", InterfaceActivityDirection.Receive, null, 0, SDL_LIB_TRACE_KEY);
-
+
try {
// Blocks thread until connection established.
_activeSocket = _serverSocket.accept();
@@ -353,10 +361,9 @@ public class BTTransport extends SdlTransport {
handleTransportConnected();
} catch (Exception e) {
-
if (!isHalted) {
// Only call disconnect if the thread has not been halted
-
+ clearInputStream();
// Check to see if Bluetooth was disabled
if (_adapter != null && !_adapter.isEnabled()) {
disconnect("Bluetooth Adapater has been disabled.", new SdlException("Bluetooth adapter must be enabled to instantiate a SdlProxy object.", e, SdlExceptionCause.BLUETOOTH_DISABLED));
@@ -365,6 +372,7 @@ public class BTTransport extends SdlTransport {
}
}
} finally {
+
if (!bKeepSocketActive && _serverSocket != null && !isHalted && (VERSION.SDK_INT > 0x00000010 /*VERSION_CODES.JELLY_BEAN*/) ) {
try {
_serverSocket.close();
@@ -378,13 +386,12 @@ public class BTTransport extends SdlTransport {
private void readFromTransport() {
try {
- int bytesRead = -1;
try {
- bytesRead = _input.read(buf);
+ byteRead = (byte)_input.read();
} catch (Exception e) {
if (!isHalted) {
// Only call disconnect if the thread has not been halted
-
+ clearInputStream();
// Check to see if Bluetooth was disabled
if (_adapter != null && !_adapter.isEnabled()) {
disconnect("Bluetooth Adapater has been disabled.", new SdlException("Bluetooth adapter must be enabled to instantiate a SdlProxy object.", e, SdlExceptionCause.BLUETOOTH_DISABLED));
@@ -394,32 +401,53 @@ public class BTTransport extends SdlTransport {
}
return;
} // end-catch
-
- if (bytesRead != -1) {
- handleReceivedBytes(buf, bytesRead);
- } else {
- // When bytesRead == -1, it indicates end of stream
- if (!isHalted) {
- // Only call disconnect if the thread has not been halted
- DebugTool.logError("End of stream reached!");
- disconnect("End of stream reached.", null);
+
+ stateProgress = psm.handleByte(byteRead);
+ if(!stateProgress){//We are trying to weed through the bad packet info until we get something
+ //Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
+ psm.reset();
+ if(byteRead == -1){ //If we read a -1 and the psm didn't move forward, then there is a problem
+ if (!isHalted) {
+ // Only call disconnect if the thread has not been halted
+ DebugTool.logError("End of stream reached!");
+ disconnect("End of stream reached.", null);
+ }
}
}
- } catch (Exception excp) {
- if (!isHalted) {
- // Only call disconnect if the thread has not been halted
- String errString = "Failure in BTTransport reader thread: " + excp.toString();
- DebugTool.logError(errString, excp);
- disconnect(errString, excp);
+ if(psm.getState() == SdlPsm.FINISHED_STATE){
+ //Log.d(TAG, "Packet formed, sending off");
+ handleReceivedPacket((SdlPacket)psm.getFormedPacket());
+ //We put a trace statement in the message read so we can avoid all the extra bytes
+ psm.reset();
}
- return;
+
+ } catch (Exception excp) {
+ if (!isHalted) {
+ // Only call disconnect if the thread has not been halted
+ clearInputStream();
+ String errString = "Failure in BTTransport reader thread: " + excp.toString();
+ DebugTool.logError(errString, excp);
+ disconnect(errString, excp);
+ }
+ return;
} // end-catch
} // end-method
+ private void clearInputStream(){
+ try {
+ if (_input != null) {
+ _input.close();
+ _input = null;
+ }
+ } catch (Exception e) {
+ DebugTool.logError("Failed to close input stream", e);
+ } // end-catch
+ }
+
public void run() {
// acceptConnection blocks until the connection has been accepted
acceptConnection();
-
+ psm.reset();
while (!isHalted) {
readFromTransport();
}
@@ -488,5 +516,17 @@ public class BTTransport extends SdlTransport {
public String getBroadcastComment() {
return sComment;
}
+
+ @Override
+ protected void handleTransportDisconnected(String info) {
+ SdlConnection.enableLegacyMode(false, null);
+ super.handleTransportDisconnected(info);
+ }
+
+ @Override
+ protected void handleTransportError(String message, Exception ex) {
+ SdlConnection.enableLegacyMode(false, null);
+ super.handleTransportError(message, ex);
+ }
} // end-class
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/ITransportListener.java b/sdl_android_lib/src/com/smartdevicelink/transport/ITransportListener.java
index 7f4f0b7de..b4c4a9b33 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/ITransportListener.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/ITransportListener.java
@@ -1,8 +1,10 @@
package com.smartdevicelink.transport;
+import com.smartdevicelink.protocol.SdlPacket;
+
public interface ITransportListener {
- // Called to indicate and deliver bytes received from transport
- void onTransportBytesReceived(byte[] receivedBytes, int receivedBytesLength);
+ // Called to indicate and deliver a packet received from transport
+ void onTransportPacketReceived(SdlPacket packet);
// Called to indicate that transport connection was established
void onTransportConnected();
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/MultiplexBluetoothTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
new file mode 100644
index 000000000..08fe98586
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
@@ -0,0 +1,888 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
+
+package com.smartdevicelink.transport;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.UUID;
+
+import android.annotation.SuppressLint;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothServerSocket;
+import android.bluetooth.BluetoothSocket;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.util.Log;
+
+/**
+ * This class does all the work for setting up and managing Bluetooth
+ * connections with other devices. It has a thread that listens for
+ * incoming connections, a thread for connecting with a device, and a
+ * thread for performing data transmissions when connected.
+ *
+ * @author Joey Grover
+ *
+ */
+public class MultiplexBluetoothTransport {
+ //finals
+ private static final String TAG = "Bluetooth Transport";
+ private static final UUID SERVER_UUID= new UUID(0x936DA01F9ABD4D9DL, 0x80C702AF85C822A8L);
+ // Name for the SDP record when creating server socket
+ private static final String NAME_SECURE =" SdlProxy";// = "LIVIO_CONNECT";
+
+
+ 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
+ public static final int STATE_LISTEN = 1; // now listening for incoming connections
+ public static final int STATE_CONNECTING = 2; // now initiating an outgoing connection
+ public static final int STATE_CONNECTED = 3; // now connected to a remote device
+ public static final int STATE_ERROR = 4; // Something bad happend, we wil not try to restart the thread
+
+
+ // Member fields
+ 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 int mBluetoothLevel = 0;
+ Handler timeOutHandler;
+ Runnable socketRunable;
+ private static final long msTillTimeout = 2500;
+
+ public static String currentlyConnectedDevice = null;
+ public static String currentlyConnectedDeviceAddress = null;
+ private static MultiplexBluetoothTransport serverInstance = null;
+ //private BluetoothServerSocket serverSocket= null;
+
+
+ static boolean listening = false;
+
+
+ /**
+ * 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) {
+ //Log.w(TAG, "Creating Bluetooth Serial Adapter");
+ // mAdapter = BluetoothAdapter.getDefaultAdapter();
+ mState = STATE_NONE;
+ mHandler = handler;
+
+ //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
+ */
+ public synchronized static MultiplexBluetoothTransport getBluetoothSerialServerInstance(Handler handler){
+
+ if(serverInstance==null){
+ serverInstance = new MultiplexBluetoothTransport(handler);
+ }
+
+ return serverInstance;
+ }
+ public synchronized static MultiplexBluetoothTransport getBluetoothSerialServerInstance(){
+ return serverInstance;
+ }
+
+ //These methods are used so we can have a semi-static reference to the Accept Thread (Static reference inherited by housing class)
+ private synchronized AcceptThread getAcceptThread(){
+ return mSecureAcceptThread;
+ }
+ private synchronized void setAcceptThread(AcceptThread aThread){
+ mSecureAcceptThread = aThread;
+ }
+ protected synchronized void setStateManually(int state){
+ //Log.d(TAG, "Setting state from: " +mState + " to: " +state);
+ mState = state;
+ }
+ /**
+ * Set the current state of the chat connection
+ * @param state An integer defining the current connection state
+ */
+ private synchronized void setState(int state) {
+ //Log.d(TAG, "Setting state from: " +mState + " to: " +state);
+ int previousState = mState;
+ mState = state;
+
+ // 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();
+ }
+
+ /**
+ * Return the current connection state. */
+ public synchronized int getState() {
+ return mState;
+ }
+
+ /**
+ * Start the chat service. Specifically start AcceptThread to begin a
+ * session in listening (server) mode. Called by the Activity onResume() */
+ 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;}
+
+ // Cancel any thread currently running a connection
+ if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
+ if (mConnectedWriteThread != null) {mConnectedWriteThread.cancel(); mConnectedWriteThread = null;}
+
+
+
+ // Start the thread to listen on a BluetoothServerSocket
+ if (getBluetoothSerialServerInstance().getAcceptThread() == null
+ //&& !listening
+ && serverInstance.mAdapter != null
+ && serverInstance.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();
+ }
+ }
+ }
+
+ /**
+ * Start the ConnectThread to initiate a connection to a remote device.
+ * @param device The BluetoothDevice to connect
+ */
+ public synchronized void connect(BluetoothDevice device) {
+ // Cancel any thread attempting to make a connection
+ if (mState == STATE_CONNECTING) {
+ if (serverInstance.mConnectThread != null) {serverInstance.mConnectThread.cancel(); serverInstance.mConnectThread = null;}
+ }
+
+ // Cancel any thread currently running a connection
+ if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
+ if (mConnectedWriteThread != null) {mConnectedWriteThread.cancel(); mConnectedWriteThread = null;}
+
+
+ // Cancel the accept thread because we only want to connect to one device
+ if (mSecureAcceptThread != null) {
+ mSecureAcceptThread.cancel();
+ mSecureAcceptThread = null;
+ }
+
+ // Start the thread to connect with the given device
+ serverInstance.mConnectThread = new ConnectThread(device);
+ serverInstance.mConnectThread.start();
+ serverInstance.setState(STATE_CONNECTING);
+ }
+
+ /**
+ * Start the ConnectedThread to begin managing a Bluetooth connection
+ * @param socket The BluetoothSocket on which the connection was made
+ * @param device The BluetoothDevice that has been connected
+ */
+ 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;
+ }
+
+ // Cancel any thread currently running a connection
+ if (mConnectedThread != null) {
+ mConnectedThread.cancel();
+ mConnectedThread = null;
+ }
+ if (mConnectedWriteThread != null) {
+ mConnectedWriteThread.cancel();
+ mConnectedWriteThread = null;
+ }
+ // Cancel the accept thread because we only want to connect to one device
+ if (getBluetoothSerialServerInstance().mSecureAcceptThread != null) {
+ getBluetoothSerialServerInstance().mSecureAcceptThread.cancel();
+ getBluetoothSerialServerInstance().mSecureAcceptThread = null;
+ }
+
+ // Start the thread to manage the connection and perform transmissions
+ mConnectedThread = new ConnectedThread(socket);
+ mConnectedThread.start();
+ // Start the thread to manage the connection and perform transmissions
+ 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());
+ msg.setData(bundle);
+ getBluetoothSerialServerInstance().mHandler.sendMessage(msg);
+ getBluetoothSerialServerInstance().setState(STATE_CONNECTED);
+ }
+
+ /**
+ * Stop all threads
+ */
+ public synchronized void stop() {
+ getBluetoothSerialServerInstance().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 (mConnectedThread != null) {
+ mConnectedThread.cancel();
+ mConnectedThread = null;
+ }
+ if (mConnectedWriteThread != null) {mConnectedWriteThread.cancel(); mConnectedWriteThread = null;}
+
+ if (mSecureAcceptThread != null) {
+ mSecureAcceptThread.cancel();
+ mSecureAcceptThread = null;
+ }
+
+ getBluetoothSerialServerInstance().setState(stateToTransitionTo);
+ }
+
+
+ /**
+ * Write to the ConnectedThread in an unsynchronized manner
+ * @param out The bytes to write
+ * @see ConnectedThread#write(byte[])
+ */
+ public void write(byte[] out, int offset, int count) {
+ // Create temporary object
+ ConnectedWriteThread r;
+ // Synchronize a copy of the ConnectedThread
+ synchronized (this) {
+ if (mState != STATE_CONNECTED) return;
+ r = mConnectedWriteThread;
+ //r.write(out,offset,count);
+ }
+ // Perform the write unsynchronized
+ r.write(out,offset,count);
+ }
+
+ /**
+ * Indicate that the connection attempt failed and notify the UI Activity.
+ */
+ private void connectionFailed() {
+ // Send a failure message back to the Activity
+ Message msg = mHandler.obtainMessage(SdlRouterService.MESSAGE_TOAST);
+ Bundle bundle = new Bundle();
+ bundle.putString(TOAST, "Unable to connect device");
+ msg.setData(bundle);
+ getBluetoothSerialServerInstance().mHandler.sendMessage(msg);
+
+ // Start the service over to restart listening mode
+ // BluetoothSerialServer.this.start();
+ }
+
+ /**
+ * Indicate that the connection was lost and notify the UI Activity.
+ */
+ private void connectionLost() {
+ listening = false;
+ // Send a failure message back to the Activity
+ Message msg = mHandler.obtainMessage(SdlRouterService.MESSAGE_TOAST);
+ Bundle bundle = new Bundle();
+ bundle.putString(TOAST, "Device connection was lost");
+ msg.setData(bundle);
+ getBluetoothSerialServerInstance().mHandler.sendMessage(msg);
+ getBluetoothSerialServerInstance().stop();
+
+ }
+
+ private void timerDelayRemoveDialog(final BluetoothSocket sock){
+ getBluetoothSerialServerInstance().timeOutHandler = new Handler();
+ getBluetoothSerialServerInstance().socketRunable = new Runnable() {
+ public void run() {
+ //Log.e(TAG, "BLUETOOTH SOCKET CONNECT TIMEOUT - ATTEMPT TO CLOSE SOCKET");
+ try {
+ sock.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ };
+ getBluetoothSerialServerInstance().timeOutHandler.postDelayed(socketRunable, msTillTimeout);
+ }
+
+
+
+ /**
+ * This thread runs while listening for incoming connections. It behaves
+ * like a server-side client. It runs until a connection is accepted
+ * (or until cancelled).
+ */
+ private class AcceptThread extends Thread {
+ // The local server socket
+ private String mSocketType;
+ final BluetoothServerSocket mmServerSocket;
+
+ @SuppressLint("NewApi")
+ public AcceptThread(boolean secure) {
+ synchronized(threadLock){
+ listening = false;
+ //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);
+ listening = true;
+ }
+ } catch (IOException e) {
+ listening = false;
+ //Log.e(TAG, "Socket Type: " + mSocketType + "listen() failed", e);
+ //Let's try to shut down this thead
+ }catch(SecurityException e2){
+ //Log.e(TAG, "<LIVIO> Security Exception in Accept Thread - "+e2.toString());
+ listening = false;
+ interrupt();
+ }
+ mmServerSocket = tmp;
+ //Should only log on debug
+ //BluetoothSocket mySock = getBTSocket(mmServerSocket);
+ //Log.d(TAG, "Accepting Connections on SDP Server Port Number: " + getChannel(mySock) + "\r\n");
+ }
+ }
+
+ public void run() {
+ synchronized(threadLock){
+ Log.d(TAG, "Socket Type: " + mSocketType +
+ " BEGIN mAcceptThread" + this);
+ setName("AcceptThread" + mSocketType);
+
+ BluetoothSocket socket = null;
+ int listenAttempts = 0;
+
+ // Listen to the server socket if we're not connected
+ while (mState != STATE_CONNECTED) {
+ try {
+ if(listenAttempts>=5){
+ Log.e(TAG, "Complete failure in attempting to listen for Bluetooth connection, erroring out.");
+ getBluetoothSerialServerInstance().stop(STATE_ERROR);
+ return;
+ }
+ listenAttempts++;
+ Log.d(TAG, "SDL Bluetooth Accept thread is running.");
+
+ // This is a blocking call and will only return on a
+ // successful connection or an exception
+ if(mmServerSocket!=null){
+
+ socket = mmServerSocket.accept();
+
+ }
+ else{
+ Log.e(TAG, "Listening Socket was null, stopping the bluetooth serial server.");
+ getBluetoothSerialServerInstance().stop(STATE_ERROR);
+ return;
+ }
+ } catch (IOException e) {
+ listening = false;
+ Log.e(TAG, "Socket Type: " + mSocketType + "accept() failed", e);
+ interrupt();
+ return;
+ }
+
+ // If a connection was accepted
+ if (socket != null) {
+ synchronized (MultiplexBluetoothTransport.this) {
+ switch (mState) {
+ case STATE_LISTEN:
+ case STATE_CONNECTING:
+ // Situation normal. Start the connected thread.
+ getBluetoothSerialServerInstance().connected(socket, socket.getRemoteDevice());
+
+ break;
+ case STATE_NONE:
+ case STATE_CONNECTED:
+ // Either not ready or already connected. Terminate new socket.
+ try {
+ Log.d(TAG, "Close unwanted socket");
+ if(socket!=null){
+ socket.close();
+ }
+ } catch (IOException e) {
+ Log.e(TAG, "Could not close unwanted socket", e);
+ }
+ break;
+ }
+ }
+ }
+ }
+ Log.d(TAG, mState + " END mAcceptThread, socket Type: " + mSocketType);
+ }
+ }
+
+ public synchronized void cancel() {
+ listening = false;
+ Log.d(TAG, mState + " Socket Type " + mSocketType + " cancel ");
+ try {
+ if(mmServerSocket != null){
+ mmServerSocket.close();
+ }
+
+ } catch (IOException e) {
+ Log.e(TAG, mState + " Socket Type " + mSocketType + " close() of server failed "+ e.getStackTrace());
+ }
+ }
+ }
+
+
+ /**
+ * This thread runs while attempting to make an outgoing connection
+ * with a device. It runs straight through; the connection either
+ * succeeds or fails.
+ */
+ private class ConnectThread extends Thread {
+ private BluetoothSocket mmSocket;
+ private final BluetoothDevice mmDevice;
+ public ConnectThread(BluetoothDevice device) {
+ mmDevice = device;
+ //Log.d(TAG, "Attempting to conenct to " + device.getName());
+ //Log.d(TAG, "UUID to conenct to " + SERVER_UUID.toString());
+
+ }
+
+ public void attemptCancelDiscovery(){
+ try{
+ mAdapter.cancelDiscovery();
+ }catch(SecurityException e2){
+ Log.e(TAG, "Don't have required permision to cancel discovery. Moving on");
+ }
+ }
+
+ public void run() {
+ setName("ConnectThread");
+ // Always cancel discovery because it will slow down a connection
+ attemptCancelDiscovery();
+ // Make a connection to the BluetoothSocket
+ int attemptCount = 0;
+ boolean success = false;
+ Looper.prepare();
+
+ while(attemptCount < 5)
+ {
+ //Looper.loop()
+ attemptCount++;
+ try {
+ // This is a blocking call and will only return on a
+ // successful connection or an exception
+ mBluetoothLevel = SdlRouterService.getBluetoothPrefs(SHARED_PREFS);
+ long waitTime = 3000;
+ try {
+ Thread.sleep(waitTime);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ //This sequence tries to use reflection first to connect with a certain number of phones that require this
+ //Next is the most common methods for phones
+ //Finally if both have failed an insecure connection is attempted, though this is not available on lower SDK's
+ boolean tryInsecure = false;
+ boolean trySecure = false;
+ //Log.i(TAG,mmDevice.getName() + " socket connecting...");
+
+ if(mBluetoothLevel<=1){
+ try {
+ SdlRouterService.setBluetoothPrefs(2,SHARED_PREFS);
+ Method m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
+ //Log.i(TAG,"connecting using createRfcommSocket");
+ mmSocket = (BluetoothSocket) m.invoke(mmDevice, Integer.valueOf(1));
+ if(mmSocket!=null){
+ //Looper.prepare();
+ timerDelayRemoveDialog(mmSocket);
+ //Looper.loop();
+ mmSocket.connect();
+ timeOutHandler.removeCallbacks(socketRunable);
+ Looper.myLooper().quit();
+ success=true;
+ SdlRouterService.setBluetoothPrefs(1,SHARED_PREFS);
+ break;
+ } else{trySecure = true;}
+
+ } catch (Exception e) {
+ //Log.e(TAG,"createRfcommSocket exception - " + e.toString());
+ SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
+
+ trySecure = true;
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e2) {
+ e2.printStackTrace();
+ }
+ }
+ }else{trySecure = true;}
+ if(trySecure && mBluetoothLevel<=2){
+ try {
+ SdlRouterService.setBluetoothPrefs(3,SHARED_PREFS);
+ //Log.i(TAG, "connecting using createRfcommSocketToServiceRecord ");
+ mmSocket = mmDevice.createRfcommSocketToServiceRecord(SERVER_UUID);
+ if(mmSocket!=null){
+ //Looper.prepare();
+ timerDelayRemoveDialog(mmSocket);
+ //Looper.loop();
+ mmSocket.connect();
+ timeOutHandler.removeCallbacks(socketRunable);
+ Looper.myLooper().quit();
+ success=true;
+ SdlRouterService.setBluetoothPrefs(2,SHARED_PREFS);
+ break;
+ }else{tryInsecure = true;}
+ } catch (IOException io) {
+ tryInsecure = true;
+ Log.e(TAG,"createRfcommSocketToServiceRecord exception - " + io.toString());
+ SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
+
+ } catch (Exception e){
+ Log.e(TAG,"createRfcommSocketToServiceRecord exception - " + e.toString());
+ SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
+
+ }
+ }else{tryInsecure = true;}
+
+ if (tryInsecure && mBluetoothLevel<=3) {
+ // try again using insecure comm if available
+ try {
+ SdlRouterService.setBluetoothPrefs(4,SHARED_PREFS);
+ //Log.i(TAG,"connecting using createInsecureRfcommSocketToServiceRecord");
+ Method m = mmDevice.getClass().getMethod("createInsecureRfcommSocketToServiceRecord", new Class[] {UUID.class});
+ mmSocket = (BluetoothSocket) m.invoke(mmDevice, new Object[] {SERVER_UUID});
+ //Looper.prepare();
+ timerDelayRemoveDialog(mmSocket);
+ //Looper.loop();
+ mmSocket.connect();
+ timeOutHandler.removeCallbacks(socketRunable);
+ Looper.myLooper().quit();
+ success=true;
+ tryInsecure = false;
+ SdlRouterService.setBluetoothPrefs(3,SHARED_PREFS);
+ break;
+ } catch (NoSuchMethodException ie) {
+ SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
+ } catch (IllegalAccessException ie) {
+ SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
+ } catch (InvocationTargetException ie) {
+ SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
+ }
+ }
+ if (tryInsecure && mBluetoothLevel<=4) {
+ // try again using insecure comm if available
+ try {
+ SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
+ //Log.i(TAG,"connecting using createInsecureRfcommSocket()");
+ Method m = mmDevice.getClass().getMethod("createInsecureRfcommSocket()", new Class[] {UUID.class});
+ mmSocket = (BluetoothSocket) m.invoke(mmDevice, new Object[] {SERVER_UUID});
+ //Looper.prepare();
+ timerDelayRemoveDialog(mmSocket);
+ //Looper.loop();
+ mmSocket.connect();
+ timeOutHandler.removeCallbacks(socketRunable);
+ Looper.myLooper().quit();
+ success=true;
+ SdlRouterService.setBluetoothPrefs(4,SHARED_PREFS);
+ break;
+ } catch (NoSuchMethodException ie) {
+ SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
+ } catch (IllegalAccessException ie) {
+ SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
+ } catch (InvocationTargetException ie) {
+ SdlRouterService.setBluetoothPrefs(0,SHARED_PREFS);
+ }
+ }
+ } catch (IOException e) {
+ connectionFailed();
+ Log.e(TAG,e.getClass().getSimpleName()
+ + " caught connecting to the bluetooth socket: "
+ + e.toString());
+ try {
+ mmSocket.close();
+ } catch (IOException e2) {
+ Log.e(TAG,"unable to close() socket during connection failure" + e2);
+ }
+ return;
+ }
+ }
+ // Reset the ConnectThread because we're done
+ if(success)
+ {
+ synchronized (MultiplexBluetoothTransport.this) {
+ mConnectThread = null;
+ }
+
+
+ // Start the connected thread
+
+ connected(mmSocket, mmDevice);
+ }
+ else
+ {
+ Log.e(TAG, "There was a problem opening up RFCOMM");
+ }
+ }
+
+ public void cancel() {
+ try {
+ Log.d(TAG, "Calling Cancel in the connect thread");
+ mmSocket.close();
+ } catch (IOException e) {
+ // close() of connect socket failed
+ }
+ catch(NullPointerException e){
+ //mSocket was pry never initialized
+ }
+ }
+ }
+
+ /**
+ * This thread runs during a connection with a remote device.
+ * It handles all incoming and outgoing transmissions.
+ */
+ private class ConnectedWriteThread extends Thread {
+ private final BluetoothSocket mmSocket;
+ private final OutputStream mmOutStream;
+
+
+ public ConnectedWriteThread(BluetoothSocket socket) {
+ //Log.d(TAG, "Creating a Connected - Write Thread");
+ mmSocket = socket;
+ OutputStream tmpOut = null;
+ setName(" Livio Bluetooth Write Thread");
+ // Get the BluetoothSocket input and output streams
+ try {
+ tmpOut = socket.getOutputStream();
+ } catch (IOException e) {
+ // temp sockets not created
+ Log.e(TAG, "Connected Write Thread: " + e.getMessage());
+ }
+ mmOutStream = tmpOut;
+
+
+ }
+ /**
+ * Write to the connected OutStream.
+ * @param buffer The bytes to write
+ */
+ public void write(byte[] buffer, int offset, int count) {
+ try {
+ if(buffer==null){
+ Log.w(TAG, "Can't write to device, nothing to send");
+ return;
+ }
+ //This would be a good spot to log out all bytes received
+ mmOutStream.write(buffer, offset, count);
+ //Log.w(TAG, "Wrote out to device: bytes = "+ count);
+ } catch (IOException e) {
+ // 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();
+ }
+ }
+
+ public synchronized void cancel() {
+ try {
+ Log.d(TAG, "Calling Cancel in the write thread");
+ if(mmOutStream!=null){
+ mmOutStream.flush();
+ mmOutStream.close();
+
+ }
+ if(mmSocket!=null){
+ mmSocket.close();
+ }
+ } catch (IOException e) {
+ // close() of connect socket failed
+ Log.d(TAG, "Write Thread: " + e.getMessage());
+ }
+ }
+ }
+
+ private class ConnectedThread extends Thread {
+ private final BluetoothSocket mmSocket;
+ private final InputStream mmInStream;
+ SdlPsm psm;
+ public ConnectedThread(BluetoothSocket socket) {
+ this.psm = new SdlPsm();
+ //Log.d(TAG, "Creating a Connected - Read Thread");
+ mmSocket = socket;
+ InputStream tmpIn = null;
+ setName(" Livio Bluetooth Read Thread");
+ // Get the BluetoothSocket input and output streams
+ try {
+ tmpIn = socket.getInputStream();
+ } catch (IOException e) {
+ // temp sockets not created
+ Log.e(TAG, "Connected Read Thread: "+e.getMessage());
+ }
+ mmInStream = tmpIn;
+
+ }
+
+ @SuppressLint("NewApi")
+ public void run() {
+ Log.d(TAG, "Running the Connected Thread");
+ byte input = 0;
+ MultiplexBluetoothTransport.currentlyConnectedDevice = mmSocket.getRemoteDevice().getName();
+ MultiplexBluetoothTransport.currentlyConnectedDeviceAddress = mmSocket.getRemoteDevice().getAddress();
+ // Keep listening to the InputStream while connected
+ boolean stateProgress;
+
+ psm.reset();
+
+ while (true) {
+ try {
+ input = (byte)mmInStream.read();
+ // Send the response of what we received
+ stateProgress = psm.handleByte(input);
+ if(!stateProgress){//We are trying to weed through the bad packet info until we get something
+ //Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
+ psm.reset();
+ continue;
+ }
+
+ if(psm.getState() == SdlPsm.FINISHED_STATE){
+ //Log.d(TAG, "Packet formed, sending off");
+ mHandler.obtainMessage(SdlRouterService.MESSAGE_READ, psm.getFormedPacket()).sendToTarget();
+ psm.reset();
+
+ }
+ }catch (IOException e){
+ Log.e(TAG, "Lost connection in the Connected Thread");
+ e.printStackTrace();
+ connectionLost();
+ break;
+ }
+ }
+ }
+
+
+ public synchronized void cancel() {
+ try {
+ //Log.d(TAG, "Calling Cancel in the Read thread");
+ if(mmInStream!=null){
+ mmInStream.close();
+ }
+ if(mmSocket!=null){
+ mmSocket.close();
+ }
+
+ } catch (IOException e) {
+ //Log.trace(TAG, "Read Thread: " + e.getMessage());
+
+ }
+ }
+ }
+
+ public boolean isConnected()
+ {
+ return !(mState == STATE_NONE);
+ }
+
+
+ public BluetoothSocket getBTSocket(BluetoothServerSocket bsSocket){
+ if(bsSocket == null){
+ return null;
+ }
+ Field[] f = bsSocket.getClass().getDeclaredFields();
+
+ //int channel = -1;
+ BluetoothSocket mySocket = null;
+ for (Field field : f) {
+ if(field.getName().equals("mSocket")){
+ field.setAccessible(true);
+ try {
+
+ mySocket = (BluetoothSocket) field.get(bsSocket);
+ return mySocket;
+ //channel = field.getInt(bsSocket);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ field.setAccessible(false);
+ }
+ }
+
+ return null;
+ }
+
+ public int getChannel(BluetoothSocket bsSocket){
+
+ int channel = -1;
+ if (bsSocket == null){
+ return channel;
+ }
+
+ Field[] f = bsSocket.getClass().getDeclaredFields();
+
+ for (Field field : f) {
+ if(field.getName().equals("mPort")){
+ field.setAccessible(true);
+ try {
+
+
+ channel = field.getInt(bsSocket);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ field.setAccessible(false);
+ }
+ }
+
+ return channel;
+ }
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/MultiplexTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/MultiplexTransport.java
new file mode 100644
index 000000000..5556d9af1
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/MultiplexTransport.java
@@ -0,0 +1,314 @@
+package com.smartdevicelink.transport;
+
+import android.annotation.SuppressLint;
+import android.content.ComponentName;
+import android.content.Context;
+import android.os.Build;
+import android.os.Looper;
+import android.os.Parcelable;
+import android.util.Log;
+
+import com.smartdevicelink.SdlConnection.SdlConnection;
+import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.protocol.SdlPacket;
+import com.smartdevicelink.transport.enums.TransportType;
+
+public class MultiplexTransport extends SdlTransport{
+ private final static String TAG = "Multiplex Transport";
+ private String sComment = "I'm_a_little_teapot";
+
+ TransportBrokerThread brokerThread;
+ protected boolean isDisconnecting = false;
+ MultiplexTransportConfig transportConfig;
+ public MultiplexTransport(MultiplexTransportConfig transportConfig, final ITransportListener transportListener){
+ super(transportListener);
+ if(transportConfig == null){
+ this.handleTransportError("Transport config was null", null);
+ }
+ this.transportConfig = transportConfig;
+ brokerThread = new TransportBrokerThread(transportConfig.context, transportConfig.appId, transportConfig.service);
+ brokerThread.start();
+ isDisconnecting = false;
+ //brokerThread.initTransportBroker();
+ //brokerThread.start();
+
+ }
+
+ public boolean forceHardwareConnectEvent(TransportType type){
+ if(brokerThread!=null){
+ brokerThread.onHardwareConnected(type);
+ return true;
+ }
+ Log.w(TAG, "Transport broker thread was null, nothing to force connect. Are we disconnecting? " + isDisconnecting);
+ return false;
+
+ }
+
+ public boolean isDisconnecting(){
+ return this.isDisconnecting;
+ }
+ /**
+ * Returns the config that was used to create this transport
+ * @return
+ */
+ public MultiplexTransportConfig getConfig(){
+ return this.transportConfig;
+ }
+
+ public boolean requestNewSession(){
+ if(brokerThread!=null){
+ brokerThread.requestNewSession();
+ return true;
+ }
+ return false;
+ }
+
+ public void removeSession(long sessionId){
+ if(brokerThread!=null){
+ brokerThread.removeSession(sessionId);
+ }
+ }
+
+ /**
+ * Overridden abstract method which returns specific type of this transport.
+ *
+ * @return Constant value - TransportType.BLUETOOTH.
+ * @see TransportType
+ */
+ public TransportType getTransportType() {
+ return TransportType.MULTIPLEX;
+ }
+
+ @Override
+ public String getBroadcastComment() {
+ return sComment;
+ }
+
+ @Override
+ protected boolean sendBytesOverTransport(SdlPacket packet) {
+ if(brokerThread!=null){
+ brokerThread.sendPacket(packet);
+ return true;
+ }
+ return false; //Sure why not.
+ }
+
+ @Override
+ public void openConnection() throws SdlException {
+ Log.d(TAG, "Open connection");
+ if(brokerThread!=null){
+ brokerThread.startConnection();
+ }//else should log out
+
+ }
+
+ @Override
+ public void disconnect() {
+ if(isDisconnecting){
+ return;
+ }
+ Log.d(TAG, "Close connection");
+ this.isDisconnecting= true;
+ if(brokerThread!= null){
+ brokerThread.cancel();
+ brokerThread = null;
+ }
+ handleTransportDisconnected(TransportType.MULTIPLEX.name());
+ isDisconnecting = false;
+
+ }
+
+
+
+ @Override
+ protected void handleTransportError(String message, Exception ex) {
+ if(brokerThread!=null){
+ brokerThread.cancel();
+ //brokerThread.interrupt();
+ brokerThread = null;
+ }
+ super.handleTransportError(message, ex);
+ }
+
+
+ public boolean isPendingConnected(){
+ if(brokerThread!=null){
+ return brokerThread.queueStart;
+ }
+ return false;
+ }
+ /**
+ * This thread will handle the broker transaction with the router service.
+ *
+ */
+ protected class TransportBrokerThread extends Thread{
+ boolean connected = false; //This helps clear up double on hardware connects
+ TransportBroker broker;
+ boolean queueStart = false;
+ final Context context;
+ final String appId;
+ final ComponentName service;
+ Looper threadLooper = null;
+ /**
+ * Thread will automatically start to prepare its looper.
+ * @param context
+ * @param appId
+ */
+ public TransportBrokerThread(Context context, String appId, ComponentName service){
+ //this.start();
+ super();
+ this.context = context;
+ this.appId = appId;
+ this.service = service;
+ //initTransportBroker(context, appId);
+ }
+
+ public void startConnection(){
+ synchronized(this){
+ connected = false;
+ if(broker!=null){
+ try{
+ broker.start();
+ }catch(Exception e){
+ handleTransportError("Error starting transport", e);
+ }
+ }else{
+ queueStart = true;
+ }
+ }
+ }
+
+ @SuppressLint("NewApi")
+ public void cancel(){
+ if(broker!=null){
+ broker.stop();
+ broker = null;
+ }
+ connected = false;
+ if(threadLooper !=null){
+ if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.JELLY_BEAN_MR2){
+ threadLooper.quitSafely();
+ }else{
+ threadLooper.quit();
+ }
+ threadLooper = null;
+ }
+ //this.interrupt();
+
+ }
+
+ public void onHardwareConnected(TransportType type){
+ if(broker!=null){
+ broker.onHardwareConnected(type);
+ }else{
+ queueStart = true;
+ }
+ }
+
+ public void sendPacket(SdlPacket packet){
+ broker.sendPacketToRouterService(packet);
+ }
+
+ public void requestNewSession(){
+ if(broker!=null){
+ broker.requestNewSession();
+ }
+ }
+ public void removeSession(long sessionId){
+ if(broker!=null){
+ broker.removeSession(sessionId);
+ }
+ }
+ @Override
+ public void run() {
+ Looper.prepare();
+
+ if(broker==null){Log.d("JOEY", "Starting broker");
+ synchronized(this){
+ initTransportBroker();
+ if(queueStart){
+ try{
+ broker.start();
+ }catch(Exception e){
+ handleTransportError("Error starting transport", e);
+ }
+ }
+ this.notify();
+ }
+ }
+ threadLooper = Looper.myLooper();
+ Looper.loop();
+ Log.i(TAG, "Looper has finished. Thread should be sutting down");
+
+ }
+
+ public void initTransportBroker(){
+
+ broker = new TransportBroker(context, appId, service){
+
+ @Override
+ public boolean onHardwareConnected(TransportType type) {
+ if(super.onHardwareConnected(type)){
+ Log.d(TAG, "On transport connected...");
+ if(!connected){
+ connected = true;
+ Log.d(TAG, "Handling transport connected");
+ handleTransportConnected();
+ }else{Log.d(TAG, "Already connected");}
+ return true;
+ }else{
+ try{
+ this.start();
+ }catch(Exception e){
+ handleTransportError("Error starting transport", e);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void onHardwareDisconnected(TransportType type) {
+ super.onHardwareDisconnected(type);
+ if(connected){
+ Log.d(TAG, "Handling disconnect");
+ connected = false;
+ SdlConnection.enableLegacyMode(isLegacyModeEnabled(), TransportType.BLUETOOTH);
+ if(isLegacyModeEnabled()){
+ Log.d(TAG, "Handle transport disconnect, legacy mode enabled");
+ this.stop();
+ isDisconnecting = true;
+ //handleTransportDisconnected("");
+ handleTransportError("",null); //This seems wrong, but it works
+ }else{
+ Log.d(TAG, "Handle transport Error");
+ isDisconnecting = true;
+ handleTransportError("",null); //This seems wrong, but it works
+ }
+ }
+ }
+
+ @Override
+ public void onLegacyModeEnabled() {
+ super.onLegacyModeEnabled();
+ SdlConnection.enableLegacyMode(isLegacyModeEnabled(), TransportType.BLUETOOTH);
+ if(isLegacyModeEnabled()){
+ Log.d(TAG, "Handle on legacy mode enabled");
+ this.stop();
+ isDisconnecting = true;
+ //handleTransportDisconnected("");
+ handleTransportError("",null); //This seems wrong, but it works
+ }
+ }
+
+ @Override
+ public void onPacketReceived(Parcelable packet) {
+ if(packet!=null){
+ SdlPacket sdlPacket = (SdlPacket)packet;
+ handleReceivedPacket(sdlPacket);
+ }
+ }
+ };
+ }
+
+ }
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/MultiplexTransportConfig.java b/sdl_android_lib/src/com/smartdevicelink/transport/MultiplexTransportConfig.java
new file mode 100644
index 000000000..b15a6cbb9
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/MultiplexTransportConfig.java
@@ -0,0 +1,51 @@
+package com.smartdevicelink.transport;
+
+import com.smartdevicelink.transport.enums.TransportType;
+
+import android.content.ComponentName;
+import android.content.Context;
+
+public class MultiplexTransportConfig extends BaseTransportConfig{
+
+ Context context;
+ String appId;
+ ComponentName service;
+
+
+
+
+ public MultiplexTransportConfig(Context context, String appId) {
+ this.context = context;
+ this.appId = appId;
+ }
+
+
+ /**
+ * Overridden abstract method which returns specific type of this transport configuration.
+ *
+ * @return Constant value TransportType.MULTIPLEX.
+ *
+ * @see TransportType
+ */
+ public TransportType getTransportType() {
+ return TransportType.MULTIPLEX;
+ }
+
+ public Context getContext(){
+ return this.context;
+ }
+
+
+ public ComponentName getService() {
+ return service;
+ }
+
+
+ public void setService(ComponentName service) {
+ this.service = service;
+ }
+
+
+
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/RouterServiceValidator.java b/sdl_android_lib/src/com/smartdevicelink/transport/RouterServiceValidator.java
new file mode 100644
index 000000000..5809a19aa
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/RouterServiceValidator.java
@@ -0,0 +1,575 @@
+package com.smartdevicelink.transport;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.app.ActivityManager;
+import android.app.ActivityManager.RunningServiceInfo;
+import android.bluetooth.BluetoothAdapter;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
+import android.util.Log;
+
+import com.smartdevicelink.util.HttpRequestTask;
+import com.smartdevicelink.util.HttpRequestTask.HttpRequestTaskCallback;
+
+/**
+ * This class will tell us if the currently running router service is valid or not.
+ * To use this class simply create a new instance of RouterServiceValidator with a supplied context.
+ * After that, you have the option to set if you want to test in a production setting. If not, it will default to a debug setting.
+ * Once you are ready to check if the router service is trusted you simply call routerServiceValidator.validate();
+ * <br><br> This validator should be passed into the multiplexing transport construction as well.
+ * @author Joey Grover
+ *
+ */
+public class RouterServiceValidator {
+ private static final String TAG = "PackageCheckUtl";
+ public static final String ROUTER_SERVICE_PACKAGE = "com.sdl.router";
+
+ private static final String REQUEST_PREFIX = "https://woprjr.smartdevicelink.com/api/1/applications/queryTrustedRouters";
+
+ private static final String DEFAULT_APP_LIST = "{\"response\": {\"com.livio.sdl\" : { \"versionBlacklist\":[] }, \"com.lexus.tcapp\" : { \"versionBlacklist\":[] }, \"com.toyota.tcapp\" : { \"versionBlacklist\": [] } , \"com.sdl.router\":{\"versionBlacklist\": [] } }}";
+
+
+ private static final String JSON_RESPONSE_OBJECT_TAG = "response";
+ private static final String JSON_RESONSE_APP_VERSIONS_TAG = "versionBlacklist";
+
+ private static final String JSON_PUT_ARRAY_TAG = "installedApps";
+ private static final String JSON_APP_PACKAGE_TAG = "packageName";
+ private static final String JSON_APP_VERSION_TAG = "version";
+
+
+ private static final long REFRESH_TRUSTED_APP_LIST_TIME = 3600000 * 24; // 24 hours in ms
+
+ private static final String SDL = "sdl";
+ private static final String SDL_PACKAGE_LIST = "sdl_package_list";
+ private static final String SDL_PACKAGE_LIST_TIMESTAMP = "sdl_package_list_timestamp";
+
+ //Flags to aid in debugging and production checks
+ public static final int FLAG_DEBUG_NONE = 0x00;
+ public static final int FLAG_DEBUG_PACKAGE_CHECK = 0x01;
+ /**
+ * This will flag the validator to check for app version during debugging.
+ * <br><br><b>NOTE: This flag will include a package check as well.
+ */
+ public static final int FLAG_DEBUG_VERSION_CHECK = 0x03; //We use 3 becuase version check will be 2, but since a version check implies a package check we do 2+1=3;
+ public static final int FLAG_DEBUG_INSTALLED_FROM_CHECK = 0x04;
+ public static final int FLAG_DEBUG_USE_TIMESTAMP_CHECK = 0x05;
+
+ public static final int FLAG_DEBUG_PERFORM_ALL_CHECKS = 0xFF;
+
+
+ private int flags = FLAG_DEBUG_NONE;
+
+ private Context context= null;
+ private boolean inDebugMode = false;
+ @SuppressWarnings("unused")
+ private static boolean pendingListRefresh = false;
+
+ private ComponentName service;//This is how we can save different routers over another in a waterfall method if we choose to.
+
+
+ public RouterServiceValidator(Context context){
+ this.context = context;
+ inDebugMode = inDebugMode();
+ }
+
+ public RouterServiceValidator(Context context, ComponentName service){
+ this.context = context;
+ inDebugMode = inDebugMode();
+ this.service = service;
+ }
+ /**
+ * Main function to call to ensure we are connecting to a validated router service
+ * @return whether or not the currently running router service can be trusted.
+ */
+ public boolean validate(){
+ PackageManager pm = context.getPackageManager();
+ //Grab the package for the currently running router service. We need this call regardless of if we are in debug mode or not.
+ String packageName = null;
+
+ if(this.service != null){
+ Log.d(TAG, "Supplied service name of " + this.service.getClassName());
+ if(!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.");
+ }
+ }
+ 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
+ wakeUpRouterServices();
+ return false;
+ }
+ }
+
+ Log.d(TAG, "Checking app package: " + service.getClassName());
+ packageName = this.appPackageForComponentName(service, pm);
+
+
+ if(packageName!=null){//Make sure there is a service running
+ if(wasInstalledByAppStore(packageName)){ //Was this package installed from a trusted app store
+ if( isTrustedPackage(packageName, pm)){//Is this package on the list of trusted apps.
+ return true;
+ }
+ }
+ }//No running service found. Might need to attempt to start one
+ //TODO spin up a known good router service
+
+ if(context.getPackageName().equalsIgnoreCase(packageName)){
+ Log.d(TAG, "It's our router service running, so time to shut it down");
+ Intent intent = new Intent();
+ intent.setComponent(service);
+ try{context.stopService(intent);}catch(Exception e){}
+ }
+ wakeUpRouterServices();
+ return false;
+ }
+
+ /**
+ * This will ensure that all router services are aware that there are no valid router services running and should start up
+ */
+ private void wakeUpRouterServices(){
+ if(BluetoothAdapter.getDefaultAdapter()!=null && BluetoothAdapter.getDefaultAdapter().isEnabled()){
+ Intent intent = new Intent(TransportConstants.START_ROUTER_SERVICE_ACTION);
+ intent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
+ context.sendBroadcast(intent);
+ }
+ }
+ public ComponentName getService(){
+ return this.service;
+ }
+
+ private boolean shouldOverrideVersionCheck(){
+ return (this.inDebugMode && ((this.flags & FLAG_DEBUG_VERSION_CHECK) != FLAG_DEBUG_VERSION_CHECK));
+ }
+
+ private boolean shouldOverridePackageName(){
+ return (this.inDebugMode && ((this.flags & FLAG_DEBUG_PACKAGE_CHECK) != FLAG_DEBUG_PACKAGE_CHECK));
+ }
+
+ private boolean shouldOverrideInstalledFrom(){
+ return (this.inDebugMode && ((this.flags & FLAG_DEBUG_INSTALLED_FROM_CHECK) != FLAG_DEBUG_INSTALLED_FROM_CHECK));
+ }
+
+ @SuppressWarnings("unused")
+ private boolean shouldOverrideTimeCheck(){
+ return (this.inDebugMode && ((this.flags & FLAG_DEBUG_USE_TIMESTAMP_CHECK) != FLAG_DEBUG_USE_TIMESTAMP_CHECK));
+ }
+
+
+ /**
+ * Use this method if you would like to test your app in a production setting rather than defaulting to a
+ * debug mode where you connect to whatever router service is running.
+ * <br><br><b>These flags are only used in debugging mode. During production they will be ignored.</b>
+ * @param flags
+ */
+ public void setFlags(int flags){
+ this.flags = flags;
+ }
+
+ /**
+ * This method will find which router service is running. Use that info to find out more about that app and service.
+ * It will store the found service for later use and return the package name if found.
+ * @param context
+ * @return
+ */
+ public ComponentName componentNameForServiceRunning(PackageManager pm){
+ if(context==null){
+ return null;
+ }
+ ActivityManager manager = (ActivityManager) context.getSystemService("activity");
+ //PackageManager pm = context.getPackageManager();
+
+
+ for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
+ //Log.d(TAG, service.service.getClassName());
+ //We will check to see if it contains this name, should be pretty specific
+ if ((service.service.getClassName()).toLowerCase(Locale.US).contains(SdlBroadcastReceiver.SDL_ROUTER_SERVICE_CLASS_NAME)){
+ //this.service = service.service; //This is great
+ if(service.started && service.restarting==0){ //If this service has been started and is not crashed
+ return service.service; //appPackageForComponenetName(service.service,pm);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the package name for the component name
+ * @param cn
+ * @param pm
+ * @return
+ */
+ private String appPackageForComponentName(ComponentName cn,PackageManager pm ){
+ if(cn!=null && pm!=null){
+ ServiceInfo info;
+ try {
+ info = pm.getServiceInfo(cn, 0);
+ return info.applicationInfo.packageName;
+ } catch (NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+
+ }
+
+ /**
+ * Check to see if the app was installed from a trusted app store.
+ * @param packageName the package name of the app to be tested
+ * @return whether or not the app was installed from a trusted app store
+ */
+ public boolean wasInstalledByAppStore(String packageName){
+ if(shouldOverrideInstalledFrom()){
+ return true;
+ }
+ PackageManager packageManager = context.getPackageManager();
+ try {
+ final ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
+ if(TrustedAppStore.isTrustedStore(packageManager.getInstallerPackageName(applicationInfo.packageName))){
+ // App was installed by trusted app store
+ return true;
+ }
+ } catch (final NameNotFoundException e) {
+ e.printStackTrace();
+ return false;
+ }
+ return false;
+ }
+
+ /**
+ * This method will check to see if this app is a debug build. If it is, we will attempt to connect to any router service.
+ * If false, it will only connect to approved apps with router services.
+ * @return
+ */
+ public boolean inDebugMode(){
+ return (0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
+ }
+
+
+ private boolean isTrustedPackage(String packageName, PackageManager pm){
+ if(packageName == null){
+ return false;
+ }
+
+ if(shouldOverridePackageName()){ //If we don't care about package names, just return true;
+ return true;
+ }
+
+ int version = -1;
+ try {version = pm.getPackageInfo(packageName,0).versionCode;} catch (NameNotFoundException e1) {e1.printStackTrace(); return false;}
+
+ JSONObject trustedApps = stringToJson(getTrustedList(context));
+ JSONArray versions;
+ JSONObject app = null;
+
+ try {
+ app = trustedApps.getJSONObject(packageName);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ return false;
+ }
+
+ if(app!=null){
+ //At this point, an app object was found in the JSON list that matches the package name
+ if(shouldOverrideVersionCheck()){ //If we don't care about versions, just return true
+ return true;
+ }
+ try { versions = app.getJSONArray(JSON_RESONSE_APP_VERSIONS_TAG); } catch (JSONException e) { e.printStackTrace();return false;}
+ return verifyVersion(version, versions);
+ }
+
+ return false;
+ }
+
+ protected boolean verifyVersion(int version, JSONArray versions){
+ if(version<0){
+ return false;
+ }
+ if(versions == null || versions.length()==0){
+ return true;
+ }
+ for(int i=0;i<versions.length();i++){
+ try {
+ if(version == versions.getInt(i)){
+ return false;
+ }
+ } catch (JSONException e) {
+ continue;
+ }
+ }//We didn't find our version in the black list.
+ return true;
+ }
+
+ /**
+ * Using the knowledge that all SDL enabled apps have an SDL Broadcast Receiver that has an intent filter that includes a specific
+ * intent.
+ * @return
+ */
+ private static List<SdlApp> findAllSdlApps(Context context){
+ List<SdlApp> apps = new ArrayList<SdlApp>();
+ PackageManager packageManager = context.getPackageManager();
+ Intent intent = new Intent();
+ intent.setAction("sdl.router.startservice");
+ List<ResolveInfo> infoList = packageManager.queryBroadcastReceivers(intent, 0);
+ if(infoList!=null){
+ Log.i(TAG, "Number of SDL apps: " + infoList.size());
+ String packageName;
+ for(ResolveInfo info : infoList){
+ Log.i(TAG, "SDL apps: " + info.activityInfo.packageName);
+ packageName = info.activityInfo.packageName;
+ try {
+ apps.add(new SdlApp(packageName,packageManager.getPackageInfo(packageName,0).versionCode));
+ } catch (NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return apps;
+ }else{
+ Log.i(TAG, "No SDL apps, list was null");
+ return null;
+ }
+ }
+
+ /**
+ * Performs a look up against installed SDL apps that support the router service.
+ * When it receives a list back from the server it will store it for later use.
+ * @param context
+ */
+ public static boolean createTrustedListRequest(final Context context, boolean forceRefresh){
+ return createTrustedListRequest(context,forceRefresh,null);
+ }
+
+ protected static boolean createTrustedListRequest(final Context context, boolean forceRefresh,HttpRequestTask.HttpRequestTaskCallback cb ){
+ if(context == null){
+ return false;
+ }
+
+ if(!forceRefresh && (System.currentTimeMillis()-getTrustedAppListTimeStamp(context))<REFRESH_TRUSTED_APP_LIST_TIME){
+ Log.d(TAG, "Don't need to get new list");
+ //Our list should still be ok for now so we will skip the request
+ pendingListRefresh = false;
+ return false;
+ }
+
+ pendingListRefresh = true;
+ //Might want to store a flag letting this class know a request is currently pending
+ StringBuilder builder = new StringBuilder();
+ builder.append(REQUEST_PREFIX);
+
+ List<SdlApp> apps = findAllSdlApps(context);
+
+ JSONObject object = new JSONObject();
+ JSONArray array = new JSONArray();
+ JSONObject jsonApp;
+
+ for(SdlApp app: apps){ //Format all the apps into a JSON object and add it to the JSON array
+ try{
+ jsonApp = new JSONObject();
+ jsonApp.put(JSON_APP_PACKAGE_TAG, app.packageName);
+ jsonApp.put(JSON_APP_VERSION_TAG, app.versionCode);
+ array.put(jsonApp);
+ }catch(JSONException e){
+ e.printStackTrace();
+ continue;
+ }
+ }
+
+ try {object.put(JSON_PUT_ARRAY_TAG, array);} catch (JSONException e) {e.printStackTrace();}
+
+ Log.d(TAG, "Request of apps: " + object.toString());
+
+ if (cb == null) {
+ cb = new HttpRequestTaskCallback() {
+
+ @Override
+ public void httpCallComplete(String response) {
+ // Might want to check if this list is ok
+ Log.d(TAG, "APPS! " + response);
+ setTrustedList(context, response);
+ pendingListRefresh = false;
+ }
+
+ @Override
+ public void httpFailure(int statusCode) {
+ Log.e(TAG, "Error while requesting trusted app list: "
+ + statusCode);
+ pendingListRefresh = false;
+ }
+ };
+ }
+
+ new HttpRequestTask(cb).execute(REQUEST_PREFIX,HttpRequestTask.REQUEST_TYPE_POST,object.toString(),"application/json","application/json");
+
+ return true;
+ }
+
+ /**
+ * This method will determine if our supplied component name is really running.
+ * @param context
+ * @param service
+ * @return
+ */
+ protected boolean isServiceRunning(Context context, ComponentName service){
+ ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ for (RunningServiceInfo serviceInfo : manager.getRunningServices(Integer.MAX_VALUE)) {
+ if (serviceInfo.service.equals(service)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Parses a string into a JSON array
+ * @param json
+ * @return
+ */
+ protected JSONObject stringToJson(String json){
+ if(json==null){
+ return stringToJson(DEFAULT_APP_LIST);
+ }
+ try {
+ JSONObject object = new JSONObject(json);
+ JSONObject trustedApps = object.getJSONObject(JSON_RESPONSE_OBJECT_TAG);
+ return trustedApps;
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ if(!json.equalsIgnoreCase(DEFAULT_APP_LIST)){ //Since we were unable to parse, let's fall back to at least our last known good list. If this list is somehow messed up, just quit.
+ return stringToJson(DEFAULT_APP_LIST);
+ }else{
+ return null;
+ }
+ }
+ }
+
+ public static boolean invalidateList(Context context){
+ if(context == null){
+ return false;
+ }
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ // Write the new prefs
+ SharedPreferences.Editor prefAdd = pref.edit();
+ prefAdd.putLong(SDL_PACKAGE_LIST_TIMESTAMP, 0); //This will be the last time we updated
+ return prefAdd.commit();
+ }
+ /******************************************************************
+ *
+ * Saving the list for later!!!
+ *
+ ******************************************************************/
+
+ /**
+ * Saves the list of available applications into user's shared prefs.
+ * @param context The application's environment
+ * @param jsonString The JSON string to save.
+ */
+ protected static boolean setTrustedList(Context context, String jsonString){
+ if(jsonString!=null && context!=null){
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ // Write the new prefs
+ SharedPreferences.Editor prefAdd = pref.edit();
+ prefAdd.putString(SDL_PACKAGE_LIST, jsonString);
+ prefAdd.putLong(SDL_PACKAGE_LIST_TIMESTAMP, System.currentTimeMillis()); //This will be the last time we updated
+ return prefAdd.commit();
+ }
+ return false;
+ }
+
+ /**
+ * Retrieves the list of available applications from user's shared prefs.
+ * @param context The application's environment.
+ * @return The JSON string that was retrieved.
+ */
+ protected static String getTrustedList(Context context){
+ if(context!=null){
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ return pref.getString(SDL_PACKAGE_LIST, DEFAULT_APP_LIST);
+ }
+ return null;
+ }
+
+ /**
+ * Retrieves the time stamp from the user's shared prefs.
+ * @param context The application's environment.
+ * @return The time stamp that was retrieved.
+ */
+ protected static Long getTrustedAppListTimeStamp(Context context){
+ if(context!=null){
+ SharedPreferences pref = context.getSharedPreferences(SDL, Context.MODE_PRIVATE);
+ return pref.getLong(SDL_PACKAGE_LIST_TIMESTAMP, 0);
+ }
+ return -1L;
+ }
+
+
+
+ /**
+ * Class that holds all the info we want to send/receive from the validation server
+ */
+ public static class SdlApp{
+ String packageName;
+ int versionCode;
+
+ SdlApp(String packageName, int versionCode){
+ this.packageName = packageName;
+ this.versionCode = versionCode;
+ }
+ }
+
+ public static enum TrustedAppStore{
+ PLAY_STORE("com.android.vending"),
+ AMAZON("com.amazon.venezia"),
+ XIAOMI("com.xiaomi.market"),
+ SAMSUNG("com.sec.android.app.samsungapps"),
+ WANDOUJIA("com.wandoujia.phoenix2"),
+ BAIDU_APP_SEARCH("com.baidu.appsearch"),
+ HIAPK("com.hiapk.marketpho"),
+ ;
+
+ String packageString;
+ private TrustedAppStore(String packageString){
+ this.packageString = packageString;
+ }
+
+ /**
+ * Test if the supplied store package is one of the trusted app stores
+ * @param packageString
+ * @return
+ */
+ public static boolean isTrustedStore(String packageString){
+ if(packageString == null){
+ return false;
+ }
+ TrustedAppStore[] stores = TrustedAppStore.values();
+ for(int i =0; i<stores.length; i++){
+ if(packageString.equalsIgnoreCase(stores[i].packageString)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ }
+
+
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/SdlBroadcastReceiver.java b/sdl_android_lib/src/com/smartdevicelink/transport/SdlBroadcastReceiver.java
new file mode 100644
index 000000000..2d268edf0
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/SdlBroadcastReceiver.java
@@ -0,0 +1,274 @@
+package com.smartdevicelink.transport;
+
+import java.util.Locale;
+
+import android.app.ActivityManager;
+import android.app.ActivityManager.RunningServiceInfo;
+import android.bluetooth.BluetoothAdapter;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.util.Log;
+
+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";
+ public static final String LOCAL_ROUTER_SERVICE_DID_START_OWN = "did_start";
+
+ public static final String TRANSPORT_GLOBAL_PREFS = "SdlTransportPrefs";
+ public static final String IS_TRANSPORT_CONNECTED = "isTransportConnected";
+
+ public static ComponentName runningBluetoothServicePackage = null;
+
+ @SuppressWarnings("rawtypes")
+ private static Class localRouterClass;
+
+ private static final Object QUEUED_SERVICE_LOCK = new Object();
+ private static ComponentName queuedService = null;
+
+ public int getRouterServiceVersion(){
+ return SdlRouterService.ROUTER_SERVICE_VERSION_NUMBER;
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ //Log.i(TAG, "Sdl Receiver Activated");
+ String action = intent.getAction();
+
+ if(action.equalsIgnoreCase(Intent.ACTION_PACKAGE_ADDED)
+ || action.equalsIgnoreCase(Intent.ACTION_PACKAGE_REPLACED)){
+ //The package manager has sent out a new broadcast.
+ RouterServiceValidator.invalidateList(context);
+ return;
+ }
+
+ if(!(action.equalsIgnoreCase(BOOT_COMPLETE)
+ || action.equalsIgnoreCase(ACL_CONNECTED)
+ || action.equalsIgnoreCase(STATE_CHANGED)
+ || action.equalsIgnoreCase(TransportConstants.START_ROUTER_SERVICE_ACTION))){
+ //We don't want anything else here if the child class called super and has different intent filters
+ //Log.i(TAG, "Unwanted intent from child class");
+ return;
+ }
+
+ boolean didStart = false;
+ localRouterClass = defineLocalSdlRouterClass();
+
+ //This will only be true if we are being told to reopen our SDL service because SDL is enabled
+ if(action.equalsIgnoreCase(TransportConstants.START_ROUTER_SERVICE_ACTION)){
+ if(intent.hasExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA)){
+ if(intent.getBooleanExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA, false)){
+ String packageName = intent.getStringExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE);
+ ComponentName componentName = intent.getParcelableExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME);
+ if(componentName!=null){
+ Log.v(TAG, "SDL enabled by router service from " + packageName + " compnent package " + componentName.getPackageName() + " - " + componentName.getClassName());
+ RouterServiceValidator vlad = new RouterServiceValidator(context,componentName);
+ if(vlad.validate()){
+ Log.d(TAG, "Router service trusted!");
+ queuedService = componentName;
+ intent.setAction("com.sdl.noaction"); //Replace what's there so we do go into some unintended loop
+ onSdlEnabled(context, intent);
+ }else{
+ Log.e(TAG, "RouterService was not trusted. Ignoring intent from : "+ componentName.getClassName());
+ }
+
+ }
+
+
+ }else{
+ //This was previously not hooked up, so let's leave it commented out
+ //onSdlDisabled(context);
+ }
+ return;
+ }else if(intent.getBooleanExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, false)){
+ //We were told to wake up our router services
+ Log.d(TAG, "Starting router service off ping");
+ boolean altServiceWake = intent.getBooleanExtra(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT, false);
+ didStart = wakeUpRouterService(context, false,altServiceWake );
+
+ }
+
+ }
+
+ if (intent.getAction().contains("android.bluetooth.adapter.action.STATE_CHANGED")){
+
+ int state = intent.getExtras().getInt("android.bluetooth.adapter.extra.STATE");
+ 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;
+ }else if(state == BluetoothAdapter.STATE_TURNING_ON){
+ //We started bluetooth, we should check for a new valid router list
+ Log.d(TAG, "Attempting to get list of approved router services");
+ RouterServiceValidator.createTrustedListRequest(context,true);
+ }
+ }
+
+ if(localRouterClass!=null){ //If there is a supplied router service lets run some logic regarding starting one
+
+ if(!didStart){
+ Log.d(TAG, "Waking up router service");
+ didStart = wakeUpRouterService(context, true,false);
+ }
+
+ //So even though we started our own version, on some older phones we find that two services are started up so we want to make sure we send our version that we are working with
+ //We will send it an intent with the version number of the local instance and an intent to start this instance
+
+ Intent serviceIntent = new Intent(context, localRouterClass);
+ SdlRouterService.LocalRouterService self = SdlRouterService.getLocalRouterService(serviceIntent, serviceIntent.getComponent());
+ Intent restart = new Intent(SdlRouterService.REGISTER_NEWER_SERVER_INSTANCE_ACTION);
+ restart.putExtra(LOCAL_ROUTER_SERVICE_EXTRA, self);
+ restart.putExtra(LOCAL_ROUTER_SERVICE_DID_START_OWN, didStart);
+ context.sendBroadcast(restart);
+ }
+ }
+
+ private boolean wakeUpRouterService(Context context, boolean ping, boolean altTransportWake){
+ Log.d(TAG, "Waking up router service");
+ if(!isRouterServiceRunning(context, ping)){
+ //If there isn't a service running we should try to start one
+ Log.i(TAG, "Attempting to start an instance of the Router Service");
+ //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);
+ }
+ context.startService(serviceIntent);
+ return true;
+ }else{
+ Log.i(TAG, "An instance of the Router Service is already running");
+ if(altTransportWake){
+ Intent serviceIntent = new Intent();
+ serviceIntent.setComponent(runningBluetoothServicePackage);
+ serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
+ context.startService(serviceIntent);
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * Determines if an instance of the Router Service is currently running on the device.
+ * @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.
+ */
+ private static boolean isRouterServiceRunning(Context context, boolean pingService){
+ if(context == null){
+ Log.e(TAG, "Can't look for router service, context supplied was null");
+ return false;
+ }
+ Log.d(TAG, "Looking for Service: "+ SDL_ROUTER_SERVICE_CLASS_NAME);
+ ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
+ //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)) {
+ runningBluetoothServicePackage = service.service; //Store which instance is running
+ if(pingService){
+ Intent intent = new Intent();
+ intent.setClassName(service.service.getPackageName(), service.service.getClassName());
+ intent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, pingService);
+ context.startService(intent);
+ }
+ return true;
+ }
+ }
+
+ return false;
+
+ }
+
+ /**
+ * 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
+ * @return True if a transport connection is established, false otherwise.
+ */
+ public static boolean isTransportConnected(Context context){
+ Log.d(TAG, "Checking to see if router service is transport connected");
+ if(context == null){
+ return false;
+ }
+ if(isRouterServiceRunning(context,false)){ //So there is a service up, let's see if it's connected
+ Context con;
+ try {
+ con = context.createPackageContext(runningBluetoothServicePackage.getPackageName(), 0);
+ if(con==null ){
+ Log.w(TAG, "Unable to check for service connection. Returning false. "+runningBluetoothServicePackage);
+ return false; // =( well that sucks.
+ }
+ SharedPreferences pref = con.getSharedPreferences(
+ con.getPackageName()+TRANSPORT_GLOBAL_PREFS , 4);
+ boolean connected = pref.getBoolean(IS_TRANSPORT_CONNECTED, false);
+ // Log.w(TAG, "Is Connected? Returning " + connected);
+ return connected;
+ } catch (NameNotFoundException e) {
+ e.printStackTrace();
+ return false;
+ }
+
+ }else{
+ Log.w(TAG, "Router service isn't running, returning false.");
+ if(BluetoothAdapter.getDefaultAdapter()!=null && BluetoothAdapter.getDefaultAdapter().isEnabled()){
+ Intent serviceIntent = new Intent();
+ serviceIntent.setAction(TransportConstants.START_ROUTER_SERVICE_ACTION);
+ serviceIntent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
+ context.sendBroadcast(serviceIntent);
+ }
+ }
+
+ return false;
+ }
+
+
+ public static ComponentName consumeQueuedRouterService(){
+ synchronized(QUEUED_SERVICE_LOCK){
+ ComponentName retVal = queuedService;
+ queuedService = null;
+ return retVal;
+ }
+ }
+
+ /**
+ * We need to define this for local copy of the Sdl Router Service class.
+ * It will be the main point of connection for Sdl enabled apps
+ * @return Return the local copy of SdlRouterService.class
+ * {@inheritDoc}
+ */
+ public abstract Class<? extends SdlRouterService> defineLocalSdlRouterClass();
+
+
+
+ /**
+ *
+ * The developer will need to define exactly what should happen when Sdl is enabled.
+ * This method will only get called when a Sdl session is initiated.
+ * <p> The most useful code here would be to start the activity or service that handles most of the Livio
+ * Connect code.
+ * @param context this is the context that was passed to this receiver when it was called.
+ * @param intent this is the intent that alerted this broadcast. Make sure to pass all extra it came with to your service/activity
+ * {@inheritDoc}
+ */
+ public abstract void onSdlEnabled(Context context, Intent intent);
+
+ //public abstract void onSdlDisabled(Context context); //Removing for now until we're able to abstract from developer
+
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/SdlPsm.java b/sdl_android_lib/src/com/smartdevicelink/transport/SdlPsm.java
new file mode 100644
index 000000000..b04b4453b
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/SdlPsm.java
@@ -0,0 +1,247 @@
+package com.smartdevicelink.transport;
+
+import com.smartdevicelink.protocol.SdlPacket;
+
+
+public class SdlPsm{
+ //private static final String TAG = "Sdl PSM";
+ //Each state represents the byte that should be incomming
+
+ public static final int START_STATE = 0x0;
+ public static final int SERVICE_TYPE_STATE = 0x02;
+ public static final int CONTROL_FRAME_INFO_STATE = 0x03;
+ public static final int SESSION_ID_STATE = 0x04;
+ public static final int DATA_SIZE_1_STATE = 0x05;
+ public static final int DATA_SIZE_2_STATE = 0x06;
+ public static final int DATA_SIZE_3_STATE = 0x07;
+ public static final int DATA_SIZE_4_STATE = 0x08;
+ public static final int MESSAGE_1_STATE = 0x09;
+ public static final int MESSAGE_2_STATE = 0x0A;
+ public static final int MESSAGE_3_STATE = 0x0B;
+ public static final int MESSAGE_4_STATE = 0x0C;
+ public static final int DATA_PUMP_STATE = 0x0D;
+ public static final int FINISHED_STATE = 0xFF;
+ public static final int ERROR_STATE = -1;
+
+
+ private static final byte FIRST_FRAME_DATA_SIZE = 0x08;
+
+ private static final int VERSION_MASK = 0xF0; //4 highest bits
+ private static final int COMPRESSION_MASK = 0x08; //4th lowest bit
+ private static final int FRAME_TYPE_MASK = 0x07; //3 lowest bits
+
+
+
+ int state ;
+
+ int version;
+ boolean compression;
+ int frameType;
+ int serviceType;
+ int controlFrameInfo;
+ int sessionId;
+ int dumpSize, dataLength;
+ int messageId = 0;
+
+ byte[] payload;
+
+ public SdlPsm(){
+ reset();
+ }
+
+ public boolean handleByte(byte data) {
+ //Log.trace(TAG, data + " = incomming");
+ state = transitionOnInput(data,state);
+
+ if(state==ERROR_STATE){
+ return false;
+ }
+ return true;
+ }
+
+ private int transitionOnInput(byte rawByte, int state){
+ switch(state){
+ case START_STATE:
+ version = (rawByte&(byte)VERSION_MASK)>>4;
+ //Log.trace(TAG, "Version: " + version);
+ if(version==0){ //It should never be 0
+ return ERROR_STATE;
+ }
+ compression = (1 == ((rawByte&(byte)COMPRESSION_MASK)>>3));
+
+
+ frameType = rawByte&(byte)FRAME_TYPE_MASK;
+ //Log.trace(TAG, rawByte + " = Frame Type: " + frameType);
+
+ if((version < 1 || version > 4) //These are known versions supported by this library.
+ && frameType!=SdlPacket.FRAME_TYPE_CONTROL){
+ return ERROR_STATE;
+ }
+
+ if(frameType<SdlPacket.FRAME_TYPE_CONTROL || frameType > SdlPacket.FRAME_TYPE_CONSECUTIVE){
+ return ERROR_STATE;
+ }
+
+ return SERVICE_TYPE_STATE;
+
+ case SERVICE_TYPE_STATE:
+ serviceType = (int)(rawByte&0xFF);
+ return CONTROL_FRAME_INFO_STATE;
+
+ case CONTROL_FRAME_INFO_STATE:
+ controlFrameInfo = (int)(rawByte&0xFF);
+ //Log.trace(TAG,"Frame Info: " + controlFrameInfo);
+ switch(frameType){
+ case SdlPacket.FRAME_TYPE_CONTROL:
+ /*if(frameInfo<FRAME_INFO_HEART_BEAT
+ || (frameInfo>FRAME_INFO_END_SERVICE_ACK
+ && (frameInfo!=FRAME_INFO_SERVICE_DATA_ACK || frameInfo!=FRAME_INFO_HEART_BEAT_ACK))){
+ return ERROR_STATE;
+ }*/ //Although some bits are reserved...whatever
+ break;
+ case SdlPacket.FRAME_TYPE_SINGLE: //Fall through since they are both the same
+ case SdlPacket.FRAME_TYPE_FIRST:
+ if(controlFrameInfo!=0x00){
+ return ERROR_STATE;
+ }
+ break;
+ case SdlPacket.FRAME_TYPE_CONSECUTIVE:
+ //It might be a good idea to check packet sequence numbers here
+ break;
+
+ default:
+ return ERROR_STATE;
+ }
+ return SESSION_ID_STATE;
+
+ case SESSION_ID_STATE:
+ sessionId = (int)(rawByte&0xFF);
+ return DATA_SIZE_1_STATE;
+
+ case DATA_SIZE_1_STATE:
+ //First data size byte
+ //Log.d(TAG, "Data byte 1: " + rawByte);
+ dataLength += ((int)(rawByte& 0xFF))<<24; //3 bytes x 8 bits
+ //Log.d(TAG, "Data Size 1 : " + dataLength);
+ return DATA_SIZE_2_STATE;
+
+ case DATA_SIZE_2_STATE:
+ //Log.d(TAG, "Data byte 2: " + rawByte);
+ dataLength += ((int)(rawByte& 0xFF))<<16; //2 bytes x 8 bits
+ //Log.d(TAG, "Data Size 2 : " + dataLength);
+ return DATA_SIZE_3_STATE;
+
+ case DATA_SIZE_3_STATE:
+ //Log.d(TAG, "Data byte 3: " + rawByte);
+ dataLength += ((int)(rawByte& 0xFF))<<8; //1 byte x 8 bits
+ //Log.d(TAG, "Data Size 3 : " + dataLength);
+ return DATA_SIZE_4_STATE;
+
+ case DATA_SIZE_4_STATE:
+ //Log.d(TAG, "Data byte 4: " + rawByte);
+ dataLength+=((int)rawByte) & 0xFF;
+ //Log.trace(TAG, "Data Size: " + dataLength);
+ //We should have data length now for the pump state
+ switch(frameType){ //If all is correct we should break out of this switch statement
+ case SdlPacket.FRAME_TYPE_SINGLE:
+ case SdlPacket.FRAME_TYPE_CONSECUTIVE:
+ break;
+ case SdlPacket.FRAME_TYPE_CONTROL:
+ //Ok, well here's some interesting bit of knowledge. Because the start session request is from the phone with no knowledge of version it sends out
+ //a v1 packet. THEREFORE there is no message id field. **** Now you know and knowing is half the battle ****
+ if(version==1 && controlFrameInfo == SdlPacket.FRAME_INFO_START_SERVICE){
+ if(dataLength==0){
+ return FINISHED_STATE; //We are done if we don't have any payload
+ }
+ payload = new byte[dataLength];
+ dumpSize = dataLength;
+ return DATA_PUMP_STATE;
+ }
+ break;
+
+ case SdlPacket.FRAME_TYPE_FIRST:
+ if(dataLength==FIRST_FRAME_DATA_SIZE){
+ break;
+ }
+ default:
+ return ERROR_STATE;
+ }
+ if(version==1){ //Version 1 packets will not have message id's
+ if(dataLength == 0){
+ return FINISHED_STATE; //We are done if we don't have any payload
+ }
+ payload = new byte[dataLength];
+ dumpSize = dataLength;
+ return DATA_PUMP_STATE;
+ }else{
+ return MESSAGE_1_STATE;
+ }
+
+ case MESSAGE_1_STATE:
+ messageId += ((int)(rawByte& 0xFF))<<24; //3 bytes x 8 bits
+ return MESSAGE_2_STATE;
+
+ case MESSAGE_2_STATE:
+ messageId += ((int)(rawByte& 0xFF))<<16; //2 bytes x 8 bits
+ return MESSAGE_3_STATE;
+
+ case MESSAGE_3_STATE:
+ messageId += ((int)(rawByte& 0xFF))<<8; //1 byte x 8 bits
+ return MESSAGE_4_STATE;
+
+ case MESSAGE_4_STATE:
+ messageId+=((int)rawByte) & 0xFF;
+
+ if(dataLength==0){
+ return FINISHED_STATE; //We are done if we don't have any payload
+ }
+ payload = new byte[dataLength];
+ dumpSize = dataLength;
+ return DATA_PUMP_STATE;
+
+ case DATA_PUMP_STATE:
+ payload[dataLength-dumpSize] = rawByte;
+ dumpSize--;
+ //Log.trace(TAG,rawByte + " read. Data Length remaining: " + dumpSize);
+ //Do we have any more bytes to read in?
+ if(dumpSize>0){
+ return DATA_PUMP_STATE;
+ }
+ else if(dumpSize==0){
+ return FINISHED_STATE;
+ }else{
+ return ERROR_STATE;
+ }
+ case FINISHED_STATE: //We shouldn't be here...Should have been reset
+ default:
+ return ERROR_STATE;
+
+ }
+
+ }
+
+ public SdlPacket getFormedPacket(){
+ if(state==FINISHED_STATE){
+ //Log.trace(TAG, "Finished packet.");
+ return new SdlPacket(version, compression, frameType,
+ serviceType, controlFrameInfo, sessionId,
+ dataLength, messageId, payload);
+ }else{
+ return null;
+ }
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public void reset() {
+ version = 0;
+ state = START_STATE;
+ messageId = 0;
+ dataLength = 0;
+ frameType = 0x00; //Set it to null
+ payload = null;
+ }
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/SdlRouterService.java b/sdl_android_lib/src/com/smartdevicelink/transport/SdlRouterService.java
new file mode 100644
index 000000000..5dffb1e44
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/SdlRouterService.java
@@ -0,0 +1,2451 @@
+package com.smartdevicelink.transport;
+
+import static com.smartdevicelink.transport.TransportConstants.CONNECTED_DEVICE_STRING_EXTRA_NAME;
+import static com.smartdevicelink.transport.TransportConstants.FORMED_PACKET_EXTRA_NAME;
+import static com.smartdevicelink.transport.TransportConstants.HARDWARE_DISCONNECTED;
+import static com.smartdevicelink.transport.TransportConstants.SEND_PACKET_TO_APP_LOCATION_EXTRA_NAME;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Set;
+import java.util.Vector;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
+import android.app.ActivityManager;
+import android.app.ActivityManager.RunningAppProcessInfo;
+import android.app.Notification;
+import android.app.Service;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.SharedPreferences;
+import android.content.pm.ApplicationInfo;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Bundle;
+import android.os.DeadObjectException;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.IBinder.DeathRecipient;
+import android.os.Build;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.os.RemoteException;
+import android.util.Log;
+import android.util.SparseArray;
+
+import com.smartdevicelink.R;
+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.FrameType;
+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 com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.transport.utl.ByteAraryMessageAssembler;
+import com.smartdevicelink.transport.utl.ByteArrayMessageSpliter;
+import com.smartdevicelink.util.BitConverter;
+
+/**
+ * <b>This class should not be modified by anyone outside of the approved contributors of the SmartDeviceLink project.</b>
+ * This service is a central point of communication between hardware and the registered clients. It will multiplex a single transport
+ * to provide a connection for a theoretical infinite amount of SDL sessions.
+ * @author Joey Grover
+ *
+ */
+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 = 1;
+
+ private static final String ROUTER_SERVICE_PROCESS = "com.smartdevicelink.router";
+
+ private static final int FOREGROUND_SERVICE_ID = 849;
+
+ private static final long CLIENT_PING_DELAY = 1000;
+
+ public static final String REGISTER_NEWER_SERVER_INSTANCE_ACTION = "com.sdl.android.newservice";
+ public static final String START_SERVICE_ACTION = "sdl.router.startservice";
+ 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;
+ 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;
+
+ private static boolean connectAsClient = false;
+ private static boolean closing = false;
+ private boolean isTarnsportConnected = false;
+ private static Context currentContext = null;
+
+ private Handler versionCheckTimeOutHandler, altTransportTimerHandler;
+ private Runnable versionCheckRunable, altTransportTimerRunnable;
+ private LocalRouterService localCompareTo = null;
+ private final static int VERSION_TIMEOUT_RUNNABLE = 750;
+ private final static int ALT_TRANSPORT_TIMEOUT_RUNNABLE = 30000;
+
+ private boolean wrongProcess = false;
+
+ private Intent lastReceivedStartIntent = null;
+ public static HashMap<Long,RegisteredApp> registeredApps;
+ private SparseArray<Long> sessionMap;
+ private SparseArray<Integer> sessionHashIdMap;
+ private final Object SESSION_LOCK = new Object(), REGISTERED_APPS_LOCK = new Object(), PING_COUNT_LOCK = new Object();
+
+ private static Messenger altTransportService = null;
+
+ private String connectedDeviceName = ""; //The name of the connected Device
+ private boolean startSequenceComplete = false;
+
+ private ExecutorService packetExecuter = null;
+ PacketWriteTaskMaster packetWriteTaskMaster = null;
+
+ private static LocalRouterService selfRouterService;
+
+ /**
+ * This flag is to keep track of if we are currently acting as a foreground service
+ */
+ private boolean isForeground = false;
+
+ private int cachedModuleVersion = -1;
+
+ /**
+ * Executor for making sure clients are still running during trying times
+ */
+ private ScheduledExecutorService clientPingExecutor = null;
+ Intent pingIntent = null;
+ private boolean isPingingClients = false;
+ int pingCount = 0;
+
+
+ /* **************************************************************************************************************************************
+ ****************************************************************************************************************************************
+ *********************************************** Broadcast Receivers START **************************************************************
+ ****************************************************************************************************************************************
+ ****************************************************************************************************************************************/
+
+ /** create our receiver from the router service */
+ BroadcastReceiver mainServiceReceiver = new BroadcastReceiver()
+ {
+ @Override
+ public void onReceive(Context context, Intent intent)
+ {
+ //Let's grab where to reply to this intent at. We will keep it temp right now because we may have to deny registration
+ String action =intent.getStringExtra(SEND_PACKET_TO_APP_LOCATION_EXTRA_NAME);
+ sendBroadcast(prepareRegistrationIntent(action));
+ }
+ };
+
+ private Intent prepareRegistrationIntent(String action){
+ Intent registrationIntent = new Intent();
+ registrationIntent.setAction(action);
+ registrationIntent.putExtra(TransportConstants.BIND_LOCATION_PACKAGE_NAME_EXTRA, this.getPackageName());
+ registrationIntent.putExtra(TransportConstants.BIND_LOCATION_CLASS_NAME_EXTRA, this.getClass().getName());
+ 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(startSequenceComplete &&
+ !connectAsClient && (mSerialService ==null
+ || mSerialService.getState() == MultiplexBluetoothTransport.STATE_NONE)){
+ Log.e(TAG, "Serial service not initliazed 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);
+
+ }
+ }
+ 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 && (localCompareTo == null || localCompareTo.isNewer(tempService))){
+ 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(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");
+ //notifyStartedService(context);
+ }
+
+ }
+ @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()
+ {
+ @Override
+ 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);
+ }
+ else{//So we just got d/c'ed from the bluetooth...alright...Let the client know
+ if(legacyModeEnabled){
+ Log.d(TAG, "Legacy mode enabled and bluetooth d/c'ed, restarting router service bluetooth.");
+ enableLegacyMode(false);
+ onTransportDisconnected(TransportType.BLUETOOTH);
+ initBluetoothSerialService();
+ }
+ }
+ }
+ };
+
+/* **************************************************************************************************************************************
+*********************************************** Broadcast Receivers End **************************************************************
+****************************************************************************************************************************************/
+
+ /* **************************************************************************************************************************************
+ *********************************************** Handlers for bound clients **************************************************************
+ ****************************************************************************************************************************************/
+
+
+ /**
+ * Target we publish for clients to send messages to RouterHandler.
+ */
+ final Messenger routerMessenger = new Messenger(new RouterHandler());
+
+ /**
+ * Handler of incoming messages from clients.
+ */
+ class RouterHandler extends Handler {
+ @Override
+ public void handleMessage(Message msg) {
+ final Bundle receivedBundle = msg.getData();
+ Bundle returnBundle;
+
+ switch (msg.what) {
+ case TransportConstants.ROUTER_REQUEST_BT_CLIENT_CONNECT:
+ if(receivedBundle.getBoolean(TransportConstants.CONNECT_AS_CLIENT_BOOLEAN_EXTRA, false)
+ && !connectAsClient){ //We check this flag to make sure we don't try to connect over and over again. On D/C we should set to false
+ //Log.d(TAG,"Attempting to connect as bt client");
+ BluetoothDevice device = receivedBundle.getParcelable(BluetoothDevice.EXTRA_DEVICE);
+ connectAsClient = true;
+ if(device==null || !bluetoothConnect(device)){
+ Log.e(TAG, "Unable to connect to bluetooth device");
+ connectAsClient = false;
+ }
+ }
+ //**************** We don't break here so we can let the app register as well
+ case TransportConstants.ROUTER_REGISTER_CLIENT: //msg.arg1 is appId
+ pingClients();
+ Message message = Message.obtain();
+ message.what = TransportConstants.ROUTER_REGISTER_CLIENT_RESPONSE;
+ long appId = receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
+ if(appId<0 || msg.replyTo == null){
+ Log.w(TAG, "Unable to requster app as no id or messenger was included");
+ if(msg.replyTo!=null){
+ message.arg1 = TransportConstants.REGISTRATION_RESPONSE_DENIED_APP_ID_NOT_INCLUDED;
+ try {
+ msg.replyTo.send(message);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ break;
+ }
+ if(SdlRouterService.this.legacyModeEnabled){
+ Log.w(TAG, "Unable to register app as legacy mode is enabled");
+ if(msg.replyTo!=null){
+ message.arg1 = TransportConstants.REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED;
+ try {
+ msg.replyTo.send(message);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ break;
+ }
+
+ RegisteredApp app = new RegisteredApp(appId,msg.replyTo);
+ synchronized(REGISTERED_APPS_LOCK){
+ RegisteredApp old = registeredApps.put(app.getAppId(), app);
+ if(old!=null){
+ Log.w(TAG, "Replacing already existing app with this app id");
+ removeAllSessionsForApp(old, true);
+ old.close();
+ }
+ }
+ onAppRegistered(app);
+
+ returnBundle = new Bundle();
+
+ if(MultiplexBluetoothTransport.currentlyConnectedDevice!=null){
+ returnBundle.putString(CONNECTED_DEVICE_STRING_EXTRA_NAME, MultiplexBluetoothTransport.currentlyConnectedDevice);
+ }
+ if(!returnBundle.isEmpty()){
+ message.setData(returnBundle);
+ }
+ int result = app.sendMessage(message);
+ if(result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT){
+ synchronized(REGISTERED_APPS_LOCK){
+ registeredApps.remove(appId);
+ }
+ }
+
+ break;
+ case TransportConstants.ROUTER_UNREGISTER_CLIENT:
+ long appIdToUnregister = receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
+ Log.i(TAG, "Unregistering client: " + appIdToUnregister);
+ RegisteredApp unregisteredApp = null;
+ synchronized(REGISTERED_APPS_LOCK){
+ unregisteredApp = registeredApps.remove(appIdToUnregister);
+ }
+ Message response = Message.obtain();
+ response.what = TransportConstants.ROUTER_UNREGISTER_CLIENT_RESPONSE;
+ if(unregisteredApp == null){
+ response.arg1 = TransportConstants.UNREGISTRATION_RESPONSE_FAILED_APP_ID_NOT_FOUND;
+ removeAllSessionsWithAppId(appIdToUnregister);
+ }else{
+ response.arg1 = TransportConstants.UNREGISTRATION_RESPONSE_SUCESS;
+ removeAllSessionsForApp(unregisteredApp,false);
+ }
+ Log.i(TAG, "Unregistering client response: " + response.arg1 );
+ try {
+ msg.replyTo.send(response); //We do this because we aren't guaranteed to find the correct registeredApp to send the message through
+ } catch (RemoteException e) {
+ e.printStackTrace();
+
+ }catch(NullPointerException e2){
+ Log.e(TAG, "No reply address included, can't send a reply");
+ }
+
+ break;
+ case TransportConstants.ROUTER_SEND_PACKET:
+ Log.d(TAG, "Received packet to send");
+ if(receivedBundle!=null){
+ Runnable packetRun = new Runnable(){
+ @Override
+ public void run() {
+ if(receivedBundle!=null){
+
+ Long buffAppId = receivedBundle.getLong(TransportConstants.APP_ID_EXTRA);
+ RegisteredApp buffApp = null;
+ if(buffAppId!=null){
+ synchronized(REGISTERED_APPS_LOCK){
+ buffApp = registeredApps.get(buffAppId);
+ }
+ }
+
+ if(buffApp !=null){
+ buffApp.handleIncommingClientMessage(receivedBundle);
+ }else{
+ writeBytesToTransport(receivedBundle);
+ }
+ }
+ }
+ };
+ if(packetExecuter!=null){
+ packetExecuter.execute(packetRun);
+ }
+ }
+ break;
+ case TransportConstants.ROUTER_REQUEST_NEW_SESSION:
+ long appIdRequesting = receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1); Log.i(TAG, "App requesting new session: " + appIdRequesting);
+ Message extraSessionResponse = Message.obtain();
+ extraSessionResponse.what = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE;
+ if(appIdRequesting>0){
+ synchronized(REGISTERED_APPS_LOCK){
+ if(registeredApps!=null){
+ RegisteredApp appRequesting = registeredApps.get(appIdRequesting);
+ if(appRequesting!=null){
+ appRequesting.getSessionIds().add((long)-1); //Adding an extra session
+ extraSessionResponse.arg1 = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE_SUCESS;
+ }else{
+ extraSessionResponse.arg1 = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_NOT_FOUND;
+ }
+ }
+ }
+ }else{
+ extraSessionResponse.arg1 = TransportConstants.ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL;
+ }
+ try {
+ msg.replyTo.send(extraSessionResponse); //We do this because we aren't guaranteed to find the correct registeredApp to send the message through
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }catch(NullPointerException e2){
+ Log.e(TAG, "No reply address included, can't send a reply");
+ }
+ break;
+ case TransportConstants.ROUTER_REMOVE_SESSION:
+ long appIdWithSession = receivedBundle.getLong(TransportConstants.APP_ID_EXTRA, -1);
+ long sessionId = receivedBundle.getLong(TransportConstants.SESSION_ID_EXTRA, -1);
+ removeSessionFromMap((int)sessionId);
+ Message removeSessionResponse = Message.obtain();
+ removeSessionResponse.what = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE;
+ if(appIdWithSession>0){
+ if(sessionId>=0){
+ synchronized(REGISTERED_APPS_LOCK){
+ if(registeredApps!=null){
+ RegisteredApp appRequesting = registeredApps.get(appIdWithSession);
+ if(appRequesting!=null){
+ if(appRequesting.removeSession(sessionId)){
+ removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_SUCESS;
+ }else{
+ removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_NOT_FOUND;
+ }
+ }else{
+ removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_NOT_FOUND;
+ }
+ }
+ }
+ }else{
+ removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_ID_NOT_INCL;
+ }
+ }else{
+ removeSessionResponse.arg1 = TransportConstants.ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL;
+ }
+ try {
+ msg.replyTo.send(removeSessionResponse); //We do this because we aren't guaranteed to find the correct registeredApp to send the message through
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }catch(NullPointerException e2){
+ Log.e(TAG, "No reply address included, can't send a reply");
+ }
+ break;
+ default:
+ super.handleMessage(msg);
+ }
+ }
+ }
+
+
+ /**
+ * Target we publish for alternative transport (USB) clients to send messages to RouterHandler.
+ */
+ final Messenger altTransportMessenger = new Messenger(new AltTransportHandler());
+
+ /**
+ * Handler of incoming messages from an alternative transport (USB).
+ */
+ class AltTransportHandler extends Handler {
+ ClassLoader loader = getClass().getClassLoader();
+ @Override
+ public void handleMessage(Message msg) {
+ Bundle receivedBundle = msg.getData();
+ switch(msg.what){
+ case TransportConstants.HARDWARE_CONNECTION_EVENT:
+ if(receivedBundle.containsKey(TransportConstants.HARDWARE_DISCONNECTED)){
+ //We should shut down, so call
+ if(altTransportService != null
+ && altTransportService.equals(msg.replyTo)){
+ //The same transport that was connected to the router service is now telling us it's disconnected. Let's inform clients and clear our saved messenger
+ altTransportService = null;
+ storeConnectedStatus(false);
+ onTransportDisconnected(TransportType.valueOf(receivedBundle.getString(TransportConstants.HARDWARE_DISCONNECTED)));
+ shouldServiceRemainOpen(null); //this will close the service if bluetooth is not available
+ }
+ }else if(receivedBundle.containsKey(TransportConstants.HARDWARE_CONNECTED)){
+ Message retMsg = Message.obtain();
+ retMsg.what = TransportConstants.ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE;
+ if(altTransportService == null){ //Ok no other transport is connected, this is good
+ Log.d(TAG, "Alt transport connected.");
+ if(msg.replyTo == null){
+ break;
+ }
+ altTransportService = msg.replyTo;
+ //Clear out the timer to make sure the service knows we're good to go
+ if(altTransportTimerHandler!=null && altTransportTimerRunnable!=null){
+ altTransportTimerHandler.removeCallbacks(altTransportTimerRunnable);
+ }
+ altTransportTimerHandler = null;
+ altTransportTimerRunnable = null;
+
+ storeConnectedStatus(true);
+ //Let the alt transport know they are good to go
+ retMsg.arg1 = TransportConstants.ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE_SUCESS;
+ onTransportConnected(TransportType.valueOf(receivedBundle.getString(TransportConstants.HARDWARE_CONNECTED)));
+ }else{ //There seems to be some other transport connected
+ //Error
+ retMsg.arg1 = TransportConstants.ROUTER_REGISTER_ALT_TRANSPORT_ALREADY_CONNECTED;
+ }
+ if(msg.replyTo!=null){
+ try {msg.replyTo.send(retMsg);} catch (RemoteException e) {e.printStackTrace();}
+ }
+ }
+ break;
+ case TransportConstants.ROUTER_RECEIVED_PACKET:
+ if(receivedBundle!=null){
+ receivedBundle.setClassLoader(loader);//We do this because loading a custom parceable object isn't possible without it
+ }else{
+ Log.e(TAG, "Bundle was null while sending packet to router service from alt transport");
+ }
+ if(receivedBundle.containsKey(TransportConstants.FORMED_PACKET_EXTRA_NAME)){
+ SdlPacket packet = receivedBundle.getParcelable(TransportConstants.FORMED_PACKET_EXTRA_NAME);
+ if(packet!=null){
+ onPacketRead(packet);
+ }else{
+ Log.w(TAG, "Received null packet from alt transport service");
+ }
+ }else{
+ Log.w(TAG, "Flase positive packet reception");
+ }
+ break;
+ default:
+ super.handleMessage(msg);
+ }
+
+ }
+ };
+
+/* **************************************************************************************************************************************
+*********************************************** Life Cycle **************************************************************
+****************************************************************************************************************************************/
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ //Check intent to send back the correct binder (client binding vs alt transport)
+ if(intent!=null){
+ if(closing){
+ Log.w(TAG, "Denying bind request due to service shutting down.");
+ return null;
+ }
+ String requestType = intent.getAction();//intent.getIntExtra(TransportConstants.ROUTER_BIND_REQUEST_TYPE_EXTRA, TransportConstants.BIND_REQUEST_TYPE_CLIENT);
+ if(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT.equals(requestType)){
+ return this.altTransportMessenger.getBinder();
+ }else if(TransportConstants.BIND_REQUEST_TYPE_CLIENT.equals(requestType)){
+ return this.routerMessenger.getBinder();
+ }else{
+ Log.w(TAG, "Uknown bind request type");
+ }
+
+ }
+ return null;
+ }
+
+
+
+ @Override
+ public boolean onUnbind(Intent intent) {
+ Log.d(TAG, "Unbind being called.");
+ return super.onUnbind(intent);
+ }
+
+
+ private void notifyClients(Message message){
+ if(message==null){
+ Log.w(TAG, "Can't notify clients, message was null");
+ return;
+ }
+ Log.d(TAG, "Notifying "+ registeredApps.size()+ " clients");
+ int result;
+ synchronized(REGISTERED_APPS_LOCK){
+ Collection<RegisteredApp> apps = registeredApps.values();
+ Iterator<RegisteredApp> it = apps.iterator();
+ while(it.hasNext()){
+ RegisteredApp app = it.next();
+ result = app.sendMessage(message);
+ if(result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT){
+ app.close();
+ it.remove();
+ }
+ }
+ }
+ }
+
+ private void pingClients(){
+ Message message = Message.obtain();
+ Log.d(TAG, "Pinging "+ registeredApps.size()+ " clients");
+ int result;
+ synchronized(REGISTERED_APPS_LOCK){
+ Collection<RegisteredApp> apps = registeredApps.values();
+ Iterator<RegisteredApp> it = apps.iterator();
+ while(it.hasNext()){
+ RegisteredApp app = it.next();
+ result = app.sendMessage(message);
+ if(result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT){
+ app.close();
+ Vector<Long> sessions = app.getSessionIds();
+ for(Long session:sessions){
+ if(session !=null && session != -1){
+ attemptToCleanUpModule(session.intValue(), cachedModuleVersion);
+ }
+ }
+ it.remove();
+ }
+ }
+ }
+ }
+
+ /**
+ * We want to make sure we are in the right process here. If there is somesort of developer error
+ * we want to just close out right away.
+ * @return
+ */
+ private boolean processCheck(){
+ int myPid = android.os.Process.myPid();
+ ActivityManager am = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE);
+ for (RunningAppProcessInfo processInfo : am.getRunningAppProcesses())
+ {
+ if (processInfo.pid == myPid)
+ {
+ return ROUTER_SERVICE_PROCESS.equals(processInfo.processName);
+ }
+ }
+ return false;
+
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+ if(!processCheck()){
+ Log.e(TAG, "Not using correct process. Shutting down");
+ wrongProcess = true;
+ stopSelf();
+ return;
+ }
+ else{Log.d(TAG, "We are in the correct process");}
+ synchronized(REGISTERED_APPS_LOCK){
+ registeredApps = new HashMap<Long,RegisteredApp>();
+ }
+ closing = false;
+ currentContext = getBaseContext();
+ storeConnectedStatus(false);
+
+ startVersionCheck();
+ Log.i(TAG, "SDL Router Service has been created");
+
+
+ synchronized(SESSION_LOCK){
+ this.sessionMap = new SparseArray<Long>();
+ this.sessionHashIdMap = new SparseArray<Integer>();
+ }
+ packetExecuter = Executors.newSingleThreadExecutor();
+ }
+
+ public void startVersionCheck(){
+ registerReceiver(registerAnInstanceOfSerialServer, new IntentFilter(REGISTER_NEWER_SERVER_INSTANCE_ACTION));
+ newestServiceCheck(currentContext);
+ }
+
+ public void startUpSequence(){
+ IntentFilter stateChangeFilter = new IntentFilter("android.bluetooth.adapter.action.STATE_CHANGED");
+ stateChangeFilter.addAction("android.bluetooth.device.action.CLASS_CHANGED");
+ IntentFilter disconnectFilter1 = new IntentFilter("android.bluetooth.device.action.ACL_DISCONNECTED");
+ IntentFilter disconnectFilter2 = new IntentFilter("android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED");
+
+ registerReceiver(mListenForDisconnect,stateChangeFilter );
+ registerReceiver(mListenForDisconnect,disconnectFilter1 );
+ registerReceiver(mListenForDisconnect,disconnectFilter2 );
+
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(REGISTER_WITH_ROUTER_ACTION);
+ registerReceiver(mainServiceReceiver,filter);
+
+ if(!connectAsClient){
+ if(bluetoothAvailable()){
+ initBluetoothSerialService();
+ }
+ }
+
+ if(altTransportTimerHandler!=null){
+ //There's an alt transport waiting for this service to be started
+ Intent intent = new Intent(TransportConstants.ALT_TRANSPORT_RECEIVER);
+ sendBroadcast(intent);
+ }
+
+ startSequenceComplete= true;
+ }
+
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ if(registeredApps == null){
+ synchronized(REGISTERED_APPS_LOCK){
+ registeredApps = new HashMap<Long,RegisteredApp>();
+ }
+ }
+ if(intent != null ){
+ 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
+ Log.i(TAG, "Received ping, making sure we are listening to bluetooth rfcomm");
+ initBluetoothSerialService();
+ }
+ }
+ }
+ shouldServiceRemainOpen(intent);
+ return super.onStartCommand(intent, flags, startId);
+ }
+
+ @Override
+ public void onDestroy(){
+ stopClientPings();
+ if(versionCheckTimeOutHandler!=null){versionCheckTimeOutHandler.removeCallbacks(versionCheckRunable);}
+ if(altTransportTimerHandler!=null){
+ altTransportTimerHandler.removeCallbacks(versionCheckRunable);
+ altTransportTimerHandler = null;
+ versionCheckRunable = null;
+ }
+ Log.w(TAG, "Sdl Router Service Destroyed");
+ closing = true;
+ currentContext = null;
+ //No need for this Broadcast Receiver anymore
+ unregisterAllReceivers();
+ closeBluetoothSerialServer();
+ if(registeredApps!=null){
+ synchronized(REGISTERED_APPS_LOCK){
+ registeredApps.clear();
+ registeredApps = null;
+ }
+ }
+ synchronized(SESSION_LOCK){
+ if(this.sessionMap!=null){
+ this.sessionMap.clear();
+ this.sessionMap = null;
+ }
+ if(this.sessionHashIdMap!=null){
+ this.sessionHashIdMap.clear();
+ this.sessionHashIdMap = null;
+ }
+ }
+
+ //SESSION_LOCK = null;
+
+ startSequenceComplete=false;
+ if(packetExecuter!=null){
+ packetExecuter.shutdownNow();
+ packetExecuter = null;
+ }
+
+ exitForeground();
+
+ if(packetWriteTaskMaster!=null){
+ packetWriteTaskMaster.close();
+ packetWriteTaskMaster = null;
+ }
+
+ super.onDestroy();
+ System.gc(); //Lower end phones need this hint
+ if(!wrongProcess){
+ try{
+ android.os.Process.killProcess(android.os.Process.myPid());
+ }catch(Exception e){}
+ }
+ }
+
+ private void unregisterAllReceivers(){
+ 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){}
+ }
+
+ private void notifyAltTransportOfClose(int reason){
+ if(altTransportService!=null){
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_SHUTTING_DOWN_NOTIFICATION;
+ msg.arg1 = reason;
+ try {
+ altTransportService.send(msg);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @SuppressLint("NewApi")
+ @SuppressWarnings("deprecation")
+ private void enterForeground() {
+ 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("sdl_128", "drawable", getPackageName());
+
+ if ( resourcesIncluded != 0 ) { //No additional pylons required
+ icon = BitmapFactory.decodeResource(getResources(), R.drawable.sdl_128);
+ }
+ else {
+ icon = BitmapFactory.decodeResource(getResources(), android.R.drawable.stat_sys_data_bluetooth);
+ }
+ // Bitmap icon = BitmapFactory.decodeByteArray(SdlLogo.SDL_LOGO_STRING, 0, SdlLogo.SDL_LOGO_STRING.length);
+
+ Notification.Builder builder = new Notification.Builder(this);
+ if(0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)){ //If we are in debug mode, include what app has the router service open
+ ComponentName name = new ComponentName(this, this.getClass());
+ builder.setContentTitle("SDL: " + name.getPackageName());
+ }else{
+ builder.setContentTitle("SmartDeviceLink");
+ }
+ builder.setTicker("SmartDeviceLink Connected");
+ builder.setContentText("Connected to " + this.getConnectedDeviceName());
+
+ //We should use icon from library resources if available
+ builder.setSmallIcon(android.R.drawable.stat_sys_data_bluetooth);
+ builder.setLargeIcon(icon);
+ builder.setOngoing(true);
+
+ Notification notification;
+ if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN){
+ notification = builder.getNotification();
+
+ }else{
+ notification = builder.build();
+ }
+ if(notification == null){
+ Log.e(TAG, "Notification was null");
+ }
+ startForeground(FOREGROUND_SERVICE_ID, notification);
+ isForeground = true;
+
+ }
+
+ private void exitForeground(){
+ if(isForeground){
+ this.stopForeground(true);
+ }
+ }
+
+
+ /* **************************************************************************************************************************************
+ *********************************************** Helper Methods **************************************************************
+ ****************************************************************************************************************************************/
+
+ public String getConnectedDeviceName(){
+ return connectedDeviceName;
+ }
+
+ /**
+ * Checks to make sure bluetooth adapter is available and on
+ * @return
+ */
+ private boolean bluetoothAvailable(){
+ boolean retVal = (!(BluetoothAdapter.getDefaultAdapter()==null) && BluetoothAdapter.getDefaultAdapter().isEnabled());
+ //Log.d(TAG, "Bluetooth Available? - " + retVal);
+ return retVal;
+ }
+
+ /**
+ *
+ * 1. If the app has SDL shut off, shut down
+ * 2. if The app has an Alt Transport address or was started by one, stay open
+ * 3. If Bluetooth is off/NA shut down
+ * 4. Anything else
+ */
+ public boolean shouldServiceRemainOpen(Intent intent){
+ //Log.d(TAG, "Determining if this service should remain open");
+
+ if(altTransportService!=null || altTransportTimerHandler !=null){
+ //We have been started by an alt transport, we must remain open. "My life for Auir...."
+ Log.d(TAG, "Alt Transport connected, remaining open");
+ 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.");
+ startAltTransportTimer();
+ return true;
+ }else if(!bluetoothAvailable()){//If bluetooth isn't on...there's nothing to see here
+ //Bluetooth is off, we should shut down
+ Log.d(TAG, "Bluetooth not available, shutting down service");
+ closeSelf();
+ return false;
+ }else{
+ Log.d(TAG, "Service to remain open");
+ return true;
+ }
+ }
+ /**
+ * This method is needed so that apps that choose not to implement this as a service as defined by Android, but rather
+ * just a simple class we have to know how to shut down.
+ */
+ public void closeSelf(){
+ closing = true;
+ storeConnectedStatus(false);
+ if(getBaseContext()!=null){
+ stopSelf();
+ }else{
+ onDestroy();
+ }
+ }
+ private synchronized void initBluetoothSerialService(){
+ if(legacyModeEnabled){
+ Log.d(TAG, "Not starting own bluetooth during legacy mode");
+ return;
+ }
+ Log.i(TAG, "Iniitializing Bluetooth Serial Class");
+ //init serial service
+ if(mSerialService ==null){
+ Log.d(TAG, "Local copy of BT Server is null");
+ mSerialService = MultiplexBluetoothTransport.getBluetoothSerialServerInstance();
+ if(mSerialService==null){
+ Log.d(TAG, "Local copy of BT Server is still null and so is global");
+ mSerialService = MultiplexBluetoothTransport.getBluetoothSerialServerInstance(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) {
+ // Start the Bluetooth services
+ mSerialService.start();
+ }
+
+ }
+ }
+
+ public void onTransportConnected(final TransportType type){
+ isTarnsportConnected = true;
+ enterForeground();
+ if(packetWriteTaskMaster!=null){
+ packetWriteTaskMaster.close();
+ packetWriteTaskMaster = null;
+ }
+ packetWriteTaskMaster = new PacketWriteTaskMaster();
+ packetWriteTaskMaster.start();
+
+ Intent startService = new Intent();
+ startService.setAction(START_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);
+ //HARDWARE_CONNECTED
+ }
+
+ public void onTransportDisconnected(TransportType type){
+ if(altTransportService!=null){ //If we still have an alt transport open, then we don't need to tell the clients to close
+ return;
+ }
+ Log.e(TAG, "Notifying client service of hardware disconnect.");
+
+ isTarnsportConnected = false;
+ stopClientPings();
+
+ exitForeground();//Leave our foreground state as we don't have a connection anymore
+
+ if(packetWriteTaskMaster!=null){
+ packetWriteTaskMaster.close();
+ packetWriteTaskMaster = null;
+ }
+
+ cachedModuleVersion = -1; //Reset our cached version
+ if(registeredApps== null || registeredApps.isEmpty()){
+ Log.w(TAG, "No clients to notify. Sending global notification.");
+ 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{
+ Message message = Message.obtain();
+ message.what = TransportConstants.HARDWARE_CONNECTION_EVENT;
+ Bundle bundle = new Bundle();
+ bundle.putString(HARDWARE_DISCONNECTED, type.name());
+ bundle.putBoolean(TransportConstants.ENABLE_LEGACY_MODE_EXTRA, legacyModeEnabled);
+ message.setData(bundle);
+ notifyClients(message);
+ }
+ //We've notified our clients, less clean up the mess now.
+ synchronized(SESSION_LOCK){
+ this.sessionMap.clear();
+ this.sessionHashIdMap.clear();
+ }
+ synchronized(REGISTERED_APPS_LOCK){
+ if(registeredApps==null){
+ return;
+ }
+ registeredApps.clear();
+ }
+ }
+
+ public void onPacketRead(SdlPacket packet){
+ try {
+ //Log.i(TAG, "******** Read packet with header: " +(packet).toString());
+ if(packet.getVersion() == 1){
+ if( packet.getFrameType() == FrameType.Control && packet.getFrameInfo() == SdlPacket.FRAME_INFO_START_SERVICE_ACK){
+ //We received a v1 packet from the head unit, this means we can't use the router service.
+ //Enable legacy mode
+ enableLegacyMode(true);
+ return;
+ }
+ }else if(cachedModuleVersion == -1){
+ cachedModuleVersion = packet.getVersion();
+ }
+ //Send the received packet to the registered app
+ sendPacketToRegisteredApp(packet);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private final Handler mHandlerBT = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MESSAGE_DEVICE_NAME:
+ connectedDeviceName = msg.getData().getString(MultiplexBluetoothTransport.DEVICE_NAME);
+ break;
+ case MESSAGE_STATE_CHANGE:
+ switch (msg.arg1) {
+ case MultiplexBluetoothTransport.STATE_CONNECTED:
+ storeConnectedStatus(true);
+ onTransportConnected(TransportType.BLUETOOTH);
+ break;
+ case MultiplexBluetoothTransport.STATE_CONNECTING:
+ // Currently attempting to connect - update UI?
+ break;
+ case MultiplexBluetoothTransport.STATE_LISTEN:
+ storeConnectedStatus(false);
+ break;
+ case MultiplexBluetoothTransport.STATE_NONE:
+ // We've just lost the connection
+ storeConnectedStatus(false);
+ if(!connectAsClient ){
+ if(!legacyModeEnabled && !closing){
+ initBluetoothSerialService();
+ }
+ onTransportDisconnected(TransportType.BLUETOOTH);
+ }
+ break;
+ case MultiplexBluetoothTransport.STATE_ERROR:
+ if(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;
+ }
+ break;
+ }
+ break;
+
+ case MESSAGE_READ:
+ 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){
+ if(bundle == null){
+ 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.
+ if(packet!=null){
+ mSerialService.write(packet,offset,count); Log.i(TAG, "Wrote out bytes");
+ return true;
+ }
+ return false;
+ }else if(sendThroughAltTransport(bundle)){
+ return true;
+ }
+ else{
+ Log.e(TAG, "Can't send data, no transport connected");
+ return false;
+ }
+ }
+
+ private boolean manuallyWriteBytes(byte[] bytes, int offset, int count){
+ if(mSerialService !=null && mSerialService.getState()==MultiplexBluetoothTransport.STATE_CONNECTED){
+ if(bytes!=null){
+ mSerialService.write(bytes,offset,count);Log.i(TAG, "Wrote out bytes manually");
+ return true;
+ }
+ return false;
+ }else if(sendThroughAltTransport(bytes,offset,count)){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+
+ /**
+ * This Method will send the packets through the alt transport that is connected
+ * @param array The byte array of data to be wrote out
+ * @return If it was possible to send the packet off.
+ * <p><b>NOTE: This is not guaranteed. It is a best attempt at sending the packet, it may fail.</b>
+ */
+ private boolean sendThroughAltTransport(Bundle bundle){
+ if(altTransportService!=null){
+ Log.d(TAG, "Sending packet through alt transport");
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_SEND_PACKET;
+ msg.setData(bundle);
+ try {
+ altTransportService.send(msg);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to send through alt transport!");
+ e.printStackTrace();
+ }
+ return true;
+ }else{
+ Log.w(TAG, "Unable to send packet through alt transport, it was null");
+ }
+ return false;
+ }
+
+ /** This Method will send the packets through the alt transport that is connected
+ * @param array The byte array of data to be wrote out
+ * @return If it was possible to send the packet off.
+ * <p><b>NOTE: This is not guaranteed. It is a best attempt at sending the packet, it may fail.</b>
+ */
+ private boolean sendThroughAltTransport(byte[] bytes, int offset, int count){
+ if(altTransportService!=null){
+ Log.d(TAG, "Sending packet through alt transport");
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_SEND_PACKET;
+ Bundle bundle = new Bundle();
+ bundle.putByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME,bytes);
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, offset);
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, count);
+ msg.setData(bundle);
+ try {
+ altTransportService.send(msg);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to send through alt transport!");
+ e.printStackTrace();
+ }
+ return true;
+ }else{
+ Log.w(TAG, "Unable to send packet through alt transport, it was null");
+ }
+ return false;
+ }
+ /**
+ * This will send the received packet to the registered service. It will default to the single registered "foreground" app.
+ * This can be overridden to provide more specific functionality.
+ * @param packet the packet that is received
+ * @return whether or not the sending was successful
+ */
+ public boolean sendPacketToRegisteredApp(SdlPacket packet) {
+ if(registeredApps!=null && (registeredApps.size()>0)){
+ int session = packet.getSessionId();
+ boolean shouldAssertNewSession = packet.getFrameType() == FrameType.Control && (packet.getFrameInfo() == SdlPacket.FRAME_INFO_START_SERVICE_ACK || packet.getFrameInfo() == SdlPacket.FRAME_INFO_START_SERVICE_NAK);
+ Long appid = getAppIDForSession(session, shouldAssertNewSession); //Find where this packet should go
+ if(appid!=null){
+ RegisteredApp app = null;
+ 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.");
+ //We have no app to match the app id tied to this session
+ removeSessionFromMap(session);
+ byte[] uai = createForceUnregisterApp((byte)session, (byte)packet.getVersion());
+ manuallyWriteBytes(uai,0,uai.length);
+ int hashId = 0;
+ synchronized(this.SESSION_LOCK){
+ if(this.sessionHashIdMap.indexOfKey(session)>=0){
+ hashId = this.sessionHashIdMap.get(session);
+ this.sessionHashIdMap.remove(session);
+ }
+ }
+ byte[] stopService = (SdlPacketFactory.createEndSession(SessionType.RPC, (byte)session, 0, (byte)packet.getVersion(),BitConverter.intToByteArray(hashId))).constructPacket();
+ manuallyWriteBytes(stopService,0,stopService.length);
+ return false;
+ }
+ byte version = (byte)packet.getVersion();
+
+ if(shouldAssertNewSession && version>1 && packet.getFrameInfo() == SdlPacket.FRAME_INFO_START_SERVICE_ACK){ //we know this was a start session response
+ if (packet.getPayload() != null && packet.getDataSize() == 4){ //hashid will be 4 bytes in length
+ synchronized(SESSION_LOCK){
+ this.sessionHashIdMap.put(session, (BitConverter.intFromByteArray(packet.getPayload(), 0)));
+ }
+ }
+ }
+
+ int packetSize = (int) (packet.getDataSize() + SdlPacket.HEADER_SIZE);
+ //Log.i(TAG, "Checking packet size: " + packetSize);
+ Message message = Message.obtain();
+ Bundle bundle = new Bundle();
+
+ if(packetSize < ByteArrayMessageSpliter.MAX_BINDER_SIZE){ //This is a small enough packet just send on through
+ //Log.w(TAG, " Packet size is just right " + packetSize + " is smaller than " + ByteArrayMessageSpliter.MAX_BINDER_SIZE + " = " + (packetSize<ByteArrayMessageSpliter.MAX_BINDER_SIZE));
+ message.what = TransportConstants.ROUTER_RECEIVED_PACKET;
+ bundle.putParcelable(FORMED_PACKET_EXTRA_NAME, packet);
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_NONE);
+ message.setData(bundle);
+ return sendPacketMessageToClient(app,message, version);
+ }else{
+ //Log.w(TAG, "Packet too big for IPC buffer. Breaking apart and then sending to client.");
+ //We need to churn through the packet payload and send it in chunks
+ byte[] bytes = packet.getPayload();
+ SdlPacket copyPacket = new SdlPacket(packet.getVersion(),packet.isEncrypted(),
+ (int)packet.getFrameType().getValue(),
+ packet.getServiceType(),packet.getFrameInfo(), session,
+ (int)packet.getDataSize(),packet.getMessageId(),null);
+ message.what = TransportConstants.ROUTER_RECEIVED_PACKET;
+ bundle.putParcelable(FORMED_PACKET_EXTRA_NAME, copyPacket);
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_SDL_PACKET_INCLUDED);
+ message.setData(bundle);
+ Log.d(TAG, "First packet before sending: " + message.getData().toString());
+ if(!sendPacketMessageToClient(app, message, version)){
+ Log.w(TAG, "Error sending first message of split packet to client " + app.appId);
+ return false;
+ }
+ //Log.w(TAG, "Message too big for single IPC transaction. Breaking apart. Size - " + packet.getDataSize());
+ ByteArrayMessageSpliter splitter = new ByteArrayMessageSpliter(appid,TransportConstants.ROUTER_RECEIVED_PACKET,bytes,0);
+ while(splitter.isActive()){
+ if(!sendPacketMessageToClient(app,splitter.nextMessage(),version)){
+ Log.w(TAG, "Error sending first message of split packet to client " + app.appId);
+ splitter.close();
+ return false;
+ }
+ }
+ Log.i(TAG, "Large packet finished being sent");
+ }
+
+ }else{ //If we can't find a session for this packet we just drop the packet
+ Log.e(TAG, "App Id was NULL for session!");
+ if(removeSessionFromMap(session)){ //If we found the session id still tied to an app in our map we need to remove it and send the proper shutdown sequence.
+ Log.i(TAG, "Removed session from map. Sending unregister request to module.");
+ attemptToCleanUpModule(session, packet.getVersion());
+ }else{ //There was no mapping so let's try to resolve this
+
+ if(packet.getFrameType() == FrameType.Single && packet.getServiceType() == SdlPacket.SERVICE_TYPE_RPC){
+ BinaryFrameHeader binFrameHeader = BinaryFrameHeader.parseBinaryHeader(packet.getPayload());
+ if(binFrameHeader!=null && FunctionID.UNREGISTER_APP_INTERFACE.getId() == binFrameHeader.getFunctionID()){
+ Log.d(TAG, "Received an unregister app interface with no where to send it, dropping the packet.");
+ }else{
+ attemptToCleanUpModule(session, packet.getVersion());
+ }
+ }else if((packet.getFrameType() == FrameType.Control
+ && (packet.getFrameInfo() == SdlPacket.FRAME_INFO_END_SERVICE_ACK || packet.getFrameInfo() == SdlPacket.FRAME_INFO_END_SERVICE_NAK))){
+ //We want to ignore this
+ Log.d(TAG, "Received a stop service ack/nak with no where to send it, dropping the packet.");
+ }else{
+ attemptToCleanUpModule(session, packet.getVersion());
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This method is an all else fails situation. If the head unit is out of synch with the apps on the phone
+ * this method will clear out an unwanted or out of date session.
+ * @param session
+ * @param version
+ */
+ private void attemptToCleanUpModule(int session, int version){
+ Log.i(TAG, "Attempting to stop session " + session);
+ byte[] uai = createForceUnregisterApp((byte)session, (byte)version);
+ manuallyWriteBytes(uai,0,uai.length);
+ int hashId = 0;
+ synchronized(this.SESSION_LOCK){
+ if(this.sessionHashIdMap.indexOfKey(session)>=0){
+ hashId = this.sessionHashIdMap.get(session);
+ this.sessionHashIdMap.remove(session);
+ }
+ }
+ byte[] stopService = (SdlPacketFactory.createEndSession(SessionType.RPC, (byte)session, 0, (byte)version,BitConverter.intToByteArray(hashId))).constructPacket();
+ manuallyWriteBytes(stopService,0,stopService.length);
+ }
+
+ private boolean sendPacketMessageToClient(RegisteredApp app, Message message, byte version){
+ int result = app.sendMessage(message);
+ if(result == RegisteredApp.SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT){
+ Log.d(TAG, "Dead object, removing app and sessions");
+ //Get all their sessions and send out unregister info
+ //Use the version in this packet as a best guess
+ app.close();
+ Vector<Long> sessions = app.getSessionIds();
+ byte[] unregister,stopService;
+ int size = sessions.size(), sessionId;
+ for(int i=0; i<size;i++){
+ sessionId = sessions.get(i).intValue();
+ unregister = createForceUnregisterApp((byte)sessionId,version);
+ manuallyWriteBytes(unregister,0,unregister.length);
+ int hashId = 0;
+ synchronized(this.SESSION_LOCK){
+ if(this.sessionHashIdMap.indexOfKey(sessionId)>=0){
+ hashId = this.sessionHashIdMap.get(sessionId);
+ }
+ }
+ stopService = (SdlPacketFactory.createEndSession(SessionType.RPC, (byte)sessionId, 0, version,BitConverter.intToByteArray(hashId))).constructPacket();
+
+ manuallyWriteBytes(stopService,0,stopService.length);
+ synchronized(SESSION_LOCK){
+ this.sessionMap.remove(sessionId);
+ this.sessionHashIdMap.remove(sessionId);
+ }
+ }
+ synchronized(REGISTERED_APPS_LOCK){
+ registeredApps.remove(app.appId);
+ }
+ return false;//We did our best to correct errors
+ }
+ return true;//We should have sent our packet, so we can return true now
+ }
+
+ private synchronized void closeBluetoothSerialServer(){
+ if(mSerialService != null){
+ mSerialService.stop();
+ mSerialService = null;
+ }
+ }
+
+ /**
+ * 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
+ */
+ public synchronized boolean bluetoothQuerryAndConnect(){
+ if( BluetoothAdapter.getDefaultAdapter().isEnabled()){
+ Set<BluetoothDevice> pairedBT= BluetoothAdapter.getDefaultAdapter().getBondedDevices();
+ Log.d(TAG, "Querry 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")){
+ bluetoothConnect(device);
+ return true;
+ }
+ }
+ }
+ }
+ else{
+ Log.e(TAG, "There was an issue with connecting as client");
+ }
+ return false;
+ }
+
+ private synchronized boolean bluetoothConnect(BluetoothDevice device){
+ Log.d(TAG,"Connecting to device: " + device.getName().toString());
+ if(mSerialService == null || !mSerialService.isConnected())
+ { // Set up the Bluetooth serial object
+ mSerialService = MultiplexBluetoothTransport.getBluetoothSerialServerInstance(mHandlerBT);
+ }
+ // We've been given a device - let's connect to it
+ if(mSerialService.getState()!=MultiplexBluetoothTransport.STATE_CONNECTING){//mSerialService.stop();
+ mSerialService.connect(device);
+ if(mSerialService.getState() == MultiplexBluetoothTransport.STATE_CONNECTING){
+ return true;
+ }
+ }
+
+ Log.d(TAG, "Bluetooth SPP Connect Attempt Completed");
+ return false;
+ }
+
+
+ //**************************************************************************************************************************************
+ //********************************************************* PREFERENCES ****************************************************************
+ //**************************************************************************************************************************************
+
+ @SuppressLint("WorldReadableFiles")
+ @SuppressWarnings("deprecation")
+ private void storeConnectedStatus(boolean isConnected){
+ SharedPreferences prefs = getApplicationContext().getSharedPreferences(getApplicationContext().getPackageName()+SdlBroadcastReceiver.TRANSPORT_GLOBAL_PREFS,
+ Context.MODE_WORLD_READABLE);
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putBoolean(SdlBroadcastReceiver.IS_TRANSPORT_CONNECTED, isConnected);
+ editor.commit();
+ }
+
+ /**
+ * 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();
+ }
+
+ public final static int getBluetoothPrefs(String prefLocation)
+ {
+ if(currentContext==null){
+ return 0;
+ }
+ SharedPreferences mBluetoothPrefs = currentContext.getSharedPreferences(prefLocation, Context.MODE_PRIVATE);
+ return mBluetoothPrefs.getInt("level", 0);
+ }
+
+ /* ***********************************************************************************************************************************************************************
+ * ***************************************************************** CUSTOM ADDITIONS ************************************************************************************
+ *************************************************************************************************************************************************************************/
+
+ private LocalRouterService getLocalBluetoothServiceComapre(){
+ return this.localCompareTo;
+ }
+
+ 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;
+ }
+
+ 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)){
+ Log.d(TAG, "There is a newer version of the Router Service, starting it up");
+ closing = true;
+ closeBluetoothSerialServer();
+ Intent serviceIntent = newestServiceReceived.launchIntent;
+ if(getLastReceivedStartIntent()!=null){
+ serviceIntent.putExtras(getLastReceivedStartIntent());
+ }
+ if(newestServiceReceived.launchIntent == null){
+ Log.e(TAG, "Service didn't include launch intent");
+ }
+ 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 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();
+ altTransportTimerRunnable = new Runnable() {
+ public void run() {
+ altTransportTimerHandler = null;
+ altTransportTimerRunnable = null;
+ shouldServiceRemainOpen(null);
+ }
+ };
+ altTransportTimerHandler.postDelayed(altTransportTimerRunnable, ALT_TRANSPORT_TIMEOUT_RUNNABLE);
+ }
+
+ private Intent getLastReceivedStartIntent(){
+ return lastReceivedStartIntent;
+ }
+
+ /**
+ * Removes session from map if the key is found.
+ * @param sessionId
+ * @return if the key was found
+ */
+ private boolean removeSessionFromMap(int sessionId){
+ synchronized(SESSION_LOCK){
+ if(sessionMap!=null){
+ if(sessionMap.indexOfKey(sessionId)>=0){
+ sessionMap.remove(sessionId);
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+ private boolean removeAllSessionsWithAppId(long appId){
+ synchronized(SESSION_LOCK){
+ if(sessionMap!=null){
+ SparseArray<Long> 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(((Long)iter.valueAt(i)).compareTo(appId) == 0){
+ sessionHashIdMap.remove(iter.keyAt(i));
+ sessionMap.removeAt(i);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Removes all sessions from the sessions map for this given app id
+ * @param app
+ */
+ private void removeAllSessionsForApp(RegisteredApp app, boolean cleanModule){
+ Vector<Long> sessions = app.getSessionIds();
+ int size = sessions.size(), sessionId;
+ for(int i=0; i<size;i++){
+ Log.d(TAG, "Investigating session " +sessions.get(i).intValue());
+ Log.d(TAG, "App id is: " + sessionMap.get(sessions.get(i).intValue()));
+ sessionId = sessions.get(i).intValue();
+ removeSessionFromMap(sessionId);
+ if(cleanModule){
+ attemptToCleanUpModule(sessionId, cachedModuleVersion);
+ }
+ }
+ }
+
+ private boolean removeAppFromMap(RegisteredApp app){
+ synchronized(REGISTERED_APPS_LOCK){
+ RegisteredApp old = registeredApps.remove(app);
+ if(old!=null){
+ old.close();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private Long getAppIDForSession(int sessionId, boolean shouldAssertNewSession){
+ synchronized(SESSION_LOCK){
+ //Log.d(TAG, "Looking for session: " + sessionId);
+ if(sessionMap == null){
+ Log.w(TAG, "Session map was null during look up. Creating one on the fly");
+ sessionMap = new SparseArray<Long>(); //THIS SHOULD NEVER BE NULL! WHY IS THIS HAPPENING?!?!?!
+ }
+ Long appId = sessionMap.get(sessionId);// SdlRouterService.this.sessionMap.get(sessionId);
+ if(appId==null && shouldAssertNewSession){
+ int pos;
+ synchronized(REGISTERED_APPS_LOCK){
+ for (RegisteredApp app : registeredApps.values()) {
+ pos = app.containsSessionId(-1);
+ if(pos != -1){
+ app.setSessionId(pos,sessionId);
+ appId = app.getAppId();
+ sessionMap.put(sessionId, appId);
+ break;
+ }
+ }
+ }
+ }
+ Log.d(TAG, sessionId + " session returning App Id: " + appId);
+ return appId;
+ }
+ }
+
+ /* ****************************************************************************************************************************************
+ // *********************************************************** LEGACY ****************************************************************
+ //*****************************************************************************************************************************************/
+ private boolean legacyModeEnabled = false;
+
+ private void enableLegacyMode(boolean enable){
+ Log.d(TAG, "Enable legacy mode: " + enable);
+ legacyModeEnabled = enable; //We put this at the end to avoid a race condition between the bluetooth d/c and notify of legacy mode enabled
+
+ if(legacyModeEnabled){
+ //So we need to let the clients know they need to host their own bluetooth sessions because the currently connected head unit only supports a very old version of SDL/Applink
+ //Start by closing our own bluetooth connection. The following calls will handle actually notifying the clients of legacy mode
+ closeBluetoothSerialServer();
+ //Now wait until we get a d/c, then the apps should shut their bluetooth down and go back to normal
+
+ }//else{}
+
+ }
+
+ /* ****************************************************************************************************************************************
+ // *********************************************************** UTILITY ****************************************************************
+ //*****************************************************************************************************************************************/
+
+ @SuppressWarnings("unused")
+ private void debugPacket(byte[] bytes){
+ //DEBUG
+
+ if(bytes[0] != 0x00){
+ Log.d(TAG, "Writing packet with header: " + BitConverter.bytesToHex(bytes, 12)); //just want the header
+ }else{
+
+ //Log.d(TAG, "Writing packet with binary header: " + BitConverter.bytesToHex(bytes, 12)); //just want the header
+ //int length = bytes.length-12;
+ if(bytes.length<=8){
+ Log.w(TAG, "No payload to debug or too small");
+ return;
+ }
+ //Check first byte if 0, make to json
+ char[] buffer = new char[bytes.length];
+ for(int i = 12;i<bytes.length;i++){
+ buffer[i-12] = (char)(bytes[i] & 0xFF);
+ }
+ try {
+
+ JSONObject object = new JSONObject(new String(buffer));
+ Log.d(TAG, "JSON: " + object.toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ /**
+ * If an app crashes the only way we can handle it being on the head unit is to send an unregister app interface rpc.
+ * This method should only be called when the router service recognizes the client is no longer valid
+ * @param sessionId
+ * @param version
+ * @return
+ */
+ private byte[] createForceUnregisterApp(byte sessionId,byte version){
+ UnregisterAppInterface request = new UnregisterAppInterface();
+ request.setCorrelationID(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
+ byte[] msgBytes = JsonRPCMarshaller.marshall(request, version);
+ ProtocolMessage pm = new ProtocolMessage();
+ pm.setData(msgBytes);
+ pm.setSessionID(sessionId);
+ pm.setMessageType(MessageType.RPC);
+ pm.setSessionType(SessionType.RPC);
+ pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
+ pm.setCorrID(request.getCorrelationID());
+ if (request.getBulkData() != null)
+ pm.setBulkData(request.getBulkData());
+ byte[] data = null;
+ if (version > 1) {
+ data = new byte[12 + pm.getJsonSize()];
+ } else {
+ data = pm.getData();
+ }
+ BinaryFrameHeader binFrameHeader = new 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());
+
+ SdlPacket packet = new SdlPacket(version,false,SdlPacket.FRAME_TYPE_SINGLE,SdlPacket.SERVICE_TYPE_RPC,0,sessionId,data.length,data.length+100,data);
+ return packet.constructPacket();
+ }
+
+
+ /**
+ * Method for finding the next, highest priority write task from all connected apps.
+ * @return
+ */
+ protected PacketWriteTask getNextTask(){
+ final long currentTime = System.currentTimeMillis();
+ RegisteredApp priorityApp = null;
+ long currentPriority = -Long.MAX_VALUE, peekWeight;
+ synchronized(REGISTERED_APPS_LOCK){
+ PacketWriteTask peekTask = null;
+ for (RegisteredApp app : registeredApps.values()) {
+ peekTask = app.peekNextTask();
+ if(peekTask!=null){
+ peekWeight = peekTask.getWeight(currentTime);
+ Log.v(TAG, "App " + app.appId +" has a task with weight "+ peekWeight);
+ if(peekWeight>currentPriority){
+ if(app.queuePaused){
+ app.notIt();//Reset the timer
+ continue;
+ }
+ if(priorityApp!=null){
+ priorityApp.notIt();
+ }
+ currentPriority = peekWeight;
+ priorityApp = app;
+ }
+ }
+ }
+ if(priorityApp!=null){
+ return priorityApp.getNextTask();
+ }
+ }
+ return null;
+ }
+
+ private void startClientPings(){
+ synchronized(this){
+ if(!isTarnsportConnected){ //If we aren't connected, bail
+ return;
+ }
+ if(isPingingClients){
+ Log.w(TAG, "Already pinging clients. Resting count");
+ synchronized(PING_COUNT_LOCK){
+ pingCount = 0;
+ }
+ return;
+ }
+ if(clientPingExecutor == null){
+ clientPingExecutor = Executors.newSingleThreadScheduledExecutor();
+ }
+ isPingingClients = true;
+ synchronized(PING_COUNT_LOCK){
+ pingCount = 0;
+ }
+ clientPingExecutor.scheduleAtFixedRate(new Runnable(){
+
+ @Override
+ public void run() {
+ if(getPingCount()>=10){
+ Log.d(TAG, "Hit ping limit");
+ stopClientPings();
+ return;
+ }
+ if(pingIntent == null){
+ pingIntent = new Intent();
+ pingIntent.setAction(START_SERVICE_ACTION);
+ pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA, true);
+ pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE, getBaseContext().getPackageName());
+ pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME, new ComponentName(SdlRouterService.this, SdlRouterService.this.getClass()));
+ pingIntent.putExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_PING, true);
+ }
+ getBaseContext().sendBroadcast(pingIntent);
+ synchronized(PING_COUNT_LOCK){
+ pingCount++;
+ }
+
+ }
+ }, CLIENT_PING_DELAY, CLIENT_PING_DELAY, TimeUnit.MILLISECONDS); //Give a little delay for first call
+ }
+ }
+
+ private int getPingCount(){
+ synchronized(PING_COUNT_LOCK){
+ return pingCount;
+ }
+ }
+
+ private void stopClientPings(){
+ if(clientPingExecutor!=null && !clientPingExecutor.isShutdown()){
+ clientPingExecutor.shutdownNow();
+ clientPingExecutor = null;
+ isPingingClients = false;
+ }
+ pingIntent = null;
+ }
+
+ /* ****************************************************************************************************************************************
+ // ********************************************************** TINY CLASSES ************************************************************
+ //*****************************************************************************************************************************************/
+
+ /**
+ *This class enables us to compare two router services
+ * from different apps and determine which is the newest
+ * and therefore which one should be the one spun up.
+ * @author Joey Grover
+ *
+ */
+ static class LocalRouterService implements Parcelable{
+ Intent launchIntent = null;
+ int version = 0;
+ long timestamp;
+ ComponentName name;
+
+ private LocalRouterService(Intent intent, int version, long timeStamp,ComponentName name ){
+ this.launchIntent = intent;
+ this.version = version;
+ this.timestamp = timeStamp;
+ this.name = name;
+ }
+ /**
+ * Check if input is newer than this version
+ * @param service
+ * @return
+ */
+ public boolean isNewer(LocalRouterService service){
+ if(service.version>this.version){
+ return true;
+ }else if(service.version == this.version){ //If we have the same version, we will use a timestamp
+ return service.timestamp<this.timestamp;
+ }
+ return false;
+ }
+
+
+ public boolean isEqual(LocalRouterService service) {
+ if(service != null && service.name!= null
+ && this.name !=null){
+ return (this.name.equals(service.name));
+ }
+ return false;
+ }
+ @Override
+ public String toString() {
+ StringBuilder build = new StringBuilder();
+ build.append("Intent action: ");
+ if(launchIntent!=null){
+ build.append(launchIntent.getComponent().getClassName());
+ }else if(name!=null){
+ build.append(name.getClassName());
+ }
+
+ build.append(" Version: ");
+ build.append(version);
+ build.append(" Timestamp: ");
+ build.append(timestamp);
+
+ return build.toString();
+ }
+ public LocalRouterService(Parcel p) {
+ this.version = p.readInt();
+ this.timestamp = p.readLong();
+ this.launchIntent = p.readParcelable(Intent.class.getClassLoader());
+ this.name = p.readParcelable(ComponentName.class.getClassLoader());
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(version);
+ dest.writeLong(timestamp);
+ dest.writeParcelable(launchIntent, 0);
+ dest.writeParcelable(name, 0);
+
+ }
+
+ public static final Parcelable.Creator<LocalRouterService> CREATOR = new Parcelable.Creator<LocalRouterService>() {
+ public LocalRouterService createFromParcel(Parcel in) {
+ return new LocalRouterService(in);
+ }
+
+ @Override
+ public LocalRouterService[] newArray(int size) {
+ 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
+ *
+ */
+ class RegisteredApp {
+ protected static final int SEND_MESSAGE_SUCCESS = 0x00;
+ protected static final int SEND_MESSAGE_ERROR_MESSAGE_NULL = 0x01;
+ protected static final int SEND_MESSAGE_ERROR_MESSENGER_NULL = 0x02;
+ protected static final int SEND_MESSAGE_ERROR_MESSENGER_GENERIC_EXCEPTION = 0x03;
+ protected static final int SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT = 0x04;
+
+ protected static final int PAUSE_TIME_FOR_QUEUE = 1500;
+
+ long appId;
+ Messenger messenger;
+ Vector<Long> sessionIds;
+ ByteAraryMessageAssembler buffer;
+ int prioirtyForBuffingMessage;
+ DeathRecipient deathNote = null;
+ //Packey queue vars
+ PacketWriteTaskBlockingQueue queue;
+ Handler queueWaitHandler= null;
+ Runnable queueWaitRunnable = null;
+ boolean queuePaused = false;
+
+ /**
+ * This is a simple class to hold onto a reference of a registered app.
+ * @param appId
+ * @param messenger
+ */
+ 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.
+ */
+ public void close(){
+ clearDeathNote();
+ clearBuffer();
+ if(this.queue!=null){
+ this.queue.clear();
+ queue = null;
+ }
+ if(queueWaitHandler!=null){
+ if(queueWaitRunnable!=null){
+ queueWaitHandler.removeCallbacks(queueWaitRunnable);
+ }
+ queueWaitHandler = null;
+ }
+ }
+
+ public long getAppId() {
+ return appId;
+ }
+
+ /**
+ * This is a convenience variable and may not be used or useful in different protocols
+ * @return
+ */
+ public Vector<Long> getSessionIds() {
+ return sessionIds;
+ }
+
+ /**
+ * Returns the position of the desired object if it is contained in the vector. If not it will return -1.
+ * @param id
+ * @return
+ */
+ public int containsSessionId(long id){
+ return sessionIds.indexOf(id);
+ }
+ /**
+ * This will remove a session from the session id list
+ * @param sessionId
+ * @return
+ */
+ 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;
+ }
+ }else{
+ return false;
+ }
+ }
+ /**
+ * @param sessionId
+ */
+ public void setSessionId(int position,long sessionId) throws ArrayIndexOutOfBoundsException {
+ this.sessionIds.set(position, (long)sessionId);
+ }
+
+ public void clearSessionIds(){
+ this.sessionIds.clear();
+ }
+
+ 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);
+ }
+ handleMessage(flags, packet);
+ }else{
+ //Add the write task on the stack
+ if(queue!=null){
+ queue.add(new PacketWriteTask(receivedBundle));
+ if(packetWriteTaskMaster!=null){
+ packetWriteTaskMaster.alert();
+ }
+ }
+ }
+ return true;
+ }
+
+ public int sendMessage(Message message){
+ if(this.messenger == null){return SEND_MESSAGE_ERROR_MESSENGER_NULL;}
+ if(message == null){return SEND_MESSAGE_ERROR_MESSAGE_NULL;}
+ try {
+ this.messenger.send(message);
+ return SEND_MESSAGE_SUCCESS;
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ if(e instanceof DeadObjectException){
+ return SEND_MESSAGE_ERROR_MESSENGER_DEAD_OBJECT;
+ }else{
+ return SEND_MESSAGE_ERROR_MESSENGER_GENERIC_EXCEPTION;
+ }
+ }
+ }
+
+ public void handleMessage(int flags, byte[] packet){
+ if(flags == TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START){
+ clearBuffer();
+ buffer = new ByteAraryMessageAssembler();
+ buffer.init();
+ }
+ if(buffer == null){
+ Log.e(TAG, "Unable to assemble message as buffer was null/not started");
+ }
+ if(!buffer.handleMessage(flags, packet)){ //If this returns false
+ Log.e(TAG, "Error handling bytes");
+ }
+ 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));
+ if(packetWriteTaskMaster!=null){
+ packetWriteTaskMaster.alert();
+ }
+ }
+ buffer.close();
+ }
+ }
+
+ protected PacketWriteTask peekNextTask(){
+ if(queue !=null){
+ return queue.peek();
+ }
+ return null;
+ }
+
+ protected PacketWriteTask getNextTask(){
+ if(queue !=null){
+ return queue.poll();
+ }
+ return null;
+ }
+
+ /**
+ * This will inform the local app object that it was not picked to have the highest priority. This will allow the user to continue to perform interactions
+ * with the module and not be bogged down by large packet requests.
+ */
+ protected void notIt(){
+ if(queue!=null && queue.peek().priorityCoefficient>0){ //If this has any sort of priority coefficient we want to make it wait.
+ //Flag to wait
+ if(queueWaitHandler == null){
+ Log.e(TAG, "Unable to pause queue, handler was null");
+ }
+ if(queueWaitRunnable == null){
+ queueWaitRunnable = new Runnable(){
+
+ @Override
+ public void run() {
+ pauseQueue(false);
+ if(packetWriteTaskMaster!=null){
+ packetWriteTaskMaster.alert();
+ }
+
+ }
+
+ };
+ }
+ if(queuePaused){
+ queueWaitHandler.removeCallbacks(queueWaitRunnable);
+ }
+ pauseQueue(queueWaitHandler.postDelayed(queueWaitRunnable, PAUSE_TIME_FOR_QUEUE));
+ }
+ }
+ private void pauseQueue(boolean paused){
+ this.queuePaused = paused;
+ }
+ protected void clearBuffer(){
+ if(buffer!=null){
+ buffer.close();
+ buffer = null;
+ }
+ }
+
+ protected boolean setDeathNote(){
+ if(messenger!=null){
+ if(deathNote == null){
+ deathNote = new DeathRecipient(){
+ @Override
+ public void binderDied() {
+ Log.w(TAG, "Binder died");
+ removeAllSessionsForApp(RegisteredApp.this,true);
+ removeAppFromMap(RegisteredApp.this);
+ startClientPings();
+ }
+ };
+ }
+ try {
+ messenger.getBinder().linkToDeath(deathNote, 0);
+ return true;
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+ return false;
+ }
+
+ protected boolean clearDeathNote(){
+ if(messenger!=null && messenger.getBinder()!=null && deathNote!=null){
+ return messenger.getBinder().unlinkToDeath(deathNote, 0);
+ }
+ return false;
+ }
+ }
+
+ /**
+ * A runnable task for writing out packets.
+ * @author Joey Grover
+ *
+ */
+ public class PacketWriteTask implements Runnable{
+ private static final long DELAY_CONSTANT = 500; //250ms
+ private static final long SIZE_CONSTANT = 1000; //1kb
+ private static final long PRIORITY_COEF_CONSTATNT = 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 long timestamp;
+ final Bundle receivedBundle;
+
+ public PacketWriteTask(byte[] bytes, int offset, int size, int priorityCoefficient){
+ timestamp = System.currentTimeMillis();
+ bytesToWrite = bytes;
+ this.offset = offset;
+ this.size = size;
+ this.priorityCoefficient = priorityCoefficient;
+ receivedBundle = null;
+ }
+
+ public PacketWriteTask(Bundle bundle){
+ this.receivedBundle = bundle;
+ timestamp = System.currentTimeMillis();
+ bytesToWrite = bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
+ offset = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0); //If nothing, start at the begining 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);
+ }
+
+ @Override
+ public void run() {
+ if(receivedBundle!=null){
+ writeBytesToTransport(receivedBundle);
+ }else if(bytesToWrite !=null){
+ manuallyWriteBytes(bytesToWrite, offset, size);
+ }
+ }
+
+ 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));
+ }
+ }
+
+ /**
+ * Extends thread to consume PacketWriteTasks in a priority queue fashion. It will attempt to look
+ * at all apps serial queue of tasks and compare them
+ * @author Joey Grover
+ *
+ */
+ private class PacketWriteTaskMaster extends Thread{
+ protected final Object QUEUE_LOCK = new Object();
+ private boolean isHalted = false, isWaiting = false;
+
+ public PacketWriteTaskMaster(){
+ this.setName("PacketWriteTaskMaster");
+ }
+
+ @Override
+ public void run() {
+ while(!isHalted){
+ try{
+ PacketWriteTask task = null;
+ synchronized(QUEUE_LOCK){
+ task = getNextTask();
+ if(task != null){
+ task.run();
+ }else{
+ isWaiting = true;
+ QUEUE_LOCK.wait();
+ isWaiting = false;
+ }
+ }
+ }catch(InterruptedException e){
+ break;
+ }
+ }
+ }
+
+ private void alert(){
+ if(isWaiting){
+ synchronized(QUEUE_LOCK){
+ QUEUE_LOCK.notify();
+ }
+ }
+ }
+
+ private void close(){
+ this.isHalted = true;
+ }
+ }
+
+ /**
+ * Custom queue to prioritize packet write tasks based on their priority coefficient.<br> The queue is a doubly linked list.<br><br>
+ * When a tasks is added to the queue, it will be evaluated using it's priority coefficient. If the coefficient is greater than 0, it will simply
+ * be placed at the end of the queue. If the coefficient is equal to 0, the queue will begin to iterate at the head and work it's way back. Once it is found that the current
+ * tasks has a priority coefficient greater than 0, it will be placed right before that task. The idea is to keep a semi-serial queue but creates a priority that allows urgent
+ * tasks such as UI related to skip near the front. However, it is assumed those tasks of higher priority should also be handled in a serial fashion.
+ *
+ * @author Joey Grover
+ *
+ */
+ private class PacketWriteTaskBlockingQueue{
+ final class Node<E> {
+ E item;
+ Node<E> prev;
+ Node<E> next;
+ Node(E item, Node<E> previous, Node<E> next) {
+ this.item = item;
+ this.prev = previous;
+ this.next = next;
+ }
+ }
+
+ private Node<PacketWriteTask> head;
+ private Node<PacketWriteTask> tail;
+
+ /**
+ * This will take the given task and insert it at the tail of the queue
+ * @param task the task to be inserted at the tail of the queue
+ */
+ private void insertAtTail(PacketWriteTask task){
+ if (task == null){
+ throw new NullPointerException();
+ }
+ Node<PacketWriteTask> oldTail = tail;
+ Node<PacketWriteTask> newTail = new Node<PacketWriteTask>(task, oldTail, null);
+ tail = newTail;
+ if (head == null){
+ head = newTail;
+ }else{
+ oldTail.next = newTail;
+ }
+
+ }
+
+ /**
+ * This will take the given task and insert it at the head of the queue
+ * @param task the task to be inserted at the head of the queue
+ */
+ private void insertAtHead(PacketWriteTask task){
+ if (task == null){
+ throw new NullPointerException();
+ }
+ Node<PacketWriteTask> oldHead = head;
+ Node<PacketWriteTask> newHead = new Node<PacketWriteTask>(task, null, oldHead);
+ head = newHead;
+ if (tail == null){
+ tail = newHead;
+ }else{
+ if(oldHead!=null){
+ oldHead.prev = newHead;
+ }
+ }
+ }
+
+ /**
+ * Insert the task in the queue where it belongs
+ * @param task
+ */
+ public void add(PacketWriteTask task){
+ synchronized(this){
+ if (task == null){
+ throw new NullPointerException();
+ }
+
+ //If we currently don't have anything in our queue
+ if(head == null || tail == null){
+ Node<PacketWriteTask> taskNode = new Node<PacketWriteTask>(task, head, tail);
+ head = taskNode;
+ tail = taskNode;
+ 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
+ insertAtTail(task);
+ return;
+ }
+ Node<PacketWriteTask> currentPlace = head;
+ while(true){
+ if(currentPlace.item.priorityCoefficient==0){
+ if(currentPlace.next==null){
+ //We've reached the end of the list
+ insertAtTail(task);
+ return;
+ }else{
+ currentPlace = currentPlace.next;
+ continue;
+ }
+ }else{
+ //We've found where this task should be inserted
+ Node<PacketWriteTask> previous = currentPlace.prev;
+ Node<PacketWriteTask> taskNode = new Node<PacketWriteTask>(task, previous, currentPlace);
+ previous.next = taskNode;
+ currentPlace.prev = taskNode;
+ return;
+
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Peek at the current head of the queue
+ * @return the task at the head of the queue but does not remove it from the queue
+ */
+ public PacketWriteTask peek(){
+ synchronized(this){
+ if(head == null){
+ return null;
+ }else{
+ return head.item;
+ }
+ }
+ }
+
+ /**
+ * Remove the head of the queue
+ * @return the old head of the queue
+ */
+ public PacketWriteTask poll(){
+ synchronized(this){
+ if(head == null){
+ return null;
+ }else{
+ Node<PacketWriteTask> retValNode = head;
+ Node<PacketWriteTask> newHead = head.next;
+ if(newHead == null){
+ tail = null;
+ }
+ head = newHead;
+
+ return retValNode.item;
+ }
+ }
+ }
+
+ /**
+ * Currently only clears the head and the tail of the queue.
+ */
+ public void clear(){
+ //Should probably go through the linked list and clear elements, but gc should clear them out automatically.
+ head = null;
+ tail = null;
+ }
+ }
+
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/SdlTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/SdlTransport.java
index 1f76b0af4..27c87bcef 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/SdlTransport.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/SdlTransport.java
@@ -1,6 +1,7 @@
package com.smartdevicelink.transport;
import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.trace.SdlTrace;
import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
import com.smartdevicelink.transport.enums.TransportType;
@@ -30,15 +31,15 @@ public abstract class SdlTransport {
// This method is called by the subclass to indicate that data has arrived from
// the transport.
- protected void handleReceivedBytes(byte[] receivedBytes, int receivedBytesLength) {
+ protected void handleReceivedPacket(SdlPacket packet) {
try {
// Trace received data
- if (receivedBytesLength > 0) {
+ if (packet!=null) {
// Send transport data to the siphon server
- SiphonServer.sendBytesFromSDL(receivedBytes, 0, receivedBytesLength);
- SdlTrace.logTransportEvent("", null, InterfaceActivityDirection.Receive, receivedBytes, receivedBytesLength, SDL_LIB_TRACE_KEY);
+ //FIXME SiphonServer.sendBytesFromSDL(receivedBytes, 0, receivedBytesLength);
+ //SdlTrace.logTransportEvent("", null, InterfaceActivityDirection.Receive, receivedBytes, receivedBytesLength, SDL_LIB_TRACE_KEY);
- _transportListener.onTransportBytesReceived(receivedBytes, receivedBytesLength);
+ _transportListener.onTransportPacketReceived(packet);
} // end-if
} catch (Exception excp) {
DebugTool.logError(FailurePropagating_Msg + "handleBytesFromTransport: " + excp.toString(), excp);
@@ -49,25 +50,25 @@ public abstract class SdlTransport {
// This method must be implemented by transport subclass, and is called by this
// base class to actually send an array of bytes out over the transport. This
// method is meant to only be callable within the class hierarchy.
- protected abstract boolean sendBytesOverTransport(byte[] msgBytes, int offset, int length);
+ protected abstract boolean sendBytesOverTransport(SdlPacket packet);
// This method is called by whomever has reference to transport to have bytes
// sent out over transport.
- public boolean sendBytes(byte[] message) {
+ /* public boolean sendBytes(byte[] message) {
return sendBytes(message, 0, message.length);
- } // end-method
+ }*/ // end-method
// This method is called by whomever has reference to transport to have bytes
// sent out over transport.
- public boolean sendBytes(byte[] message, int offset, int length) {
+ public boolean sendBytes(SdlPacket packet) {
boolean bytesWereSent = false;
synchronized (_sendLockObj) {
- bytesWereSent = sendBytesOverTransport(message, offset, length);
+ bytesWereSent = sendBytesOverTransport(packet);//message, offset, length);
} // end-lock
// Send transport data to the siphon server
- SiphonServer.sendBytesFromAPP(message, offset, length);
+ //FIXME SiphonServer.sendBytesFromAPP(message, offset, length);
- SdlTrace.logTransportEvent("", null, InterfaceActivityDirection.Transmit, message, offset, length, SDL_LIB_TRACE_KEY);
+ //FIXME SdlTrace.logTransportEvent("", null, InterfaceActivityDirection.Transmit, message, offset, length, SDL_LIB_TRACE_KEY);
return bytesWereSent;
} // end-method
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransport.java
index 69500bf6b..9ba789ef8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransport.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransport.java
@@ -1,17 +1,18 @@
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.util.Log;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
+import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.transport.enums.TransportType;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-
/**
* General comments:
*
@@ -107,10 +108,11 @@ public class TCPTransport extends SdlTransport {
* @return True if data was sent successfully, False otherwise
*/
@Override
- protected boolean sendBytesOverTransport(byte[] msgBytes, int offset, int length) {
+ protected boolean sendBytesOverTransport(SdlPacket packet) {
TCPTransportState currentState = getCurrentState();
+ byte[] msgBytes = packet.constructPacket();
logInfo(String.format("TCPTransport: sendBytesOverTransport requested. Size: %d, Offset: %d, Length: %d, Current state is: %s"
- , msgBytes.length, offset, length, currentState.name()));
+ , msgBytes.length, 0, msgBytes.length, currentState.name()));
boolean bResult = false;
@@ -118,7 +120,7 @@ public class TCPTransport extends SdlTransport {
if (mOutputStream != null) {
logInfo("TCPTransport: sendBytesOverTransport request accepted. Trying to send data");
try {
- mOutputStream.write(msgBytes, offset, length);
+ mOutputStream.write(msgBytes, 0, msgBytes.length);
bResult = true;
logInfo("TCPTransport.sendBytesOverTransport: successfully send data");
} catch (IOException e) {
@@ -288,7 +290,10 @@ public class TCPTransport extends SdlTransport {
* Internal class that represents separate thread, that does actual work, related to connecting/reading/writing data
*/
private class TCPTransportThread extends Thread {
-
+ SdlPsm psm;
+ public TCPTransportThread(){
+ psm = new SdlPsm();
+ }
/**
* Represents current thread state - halted or not. This flag is used to change internal behavior depending
* on current state.
@@ -313,7 +318,7 @@ public class TCPTransport extends SdlTransport {
private boolean connect() {
boolean bConnected;
int remainingRetry = RECONNECT_RETRY_COUNT;
-
+
synchronized (TCPTransport.this) {
do {
try {
@@ -359,7 +364,7 @@ public class TCPTransport extends SdlTransport {
@Override
public void run() {
logInfo("TCPTransport.run: transport thread created. Starting connect stage");
-
+ psm.reset();
while(!isHalted) {
setCurrentState(TCPTransportState.CONNECTING);
if(!connect()){
@@ -377,13 +382,13 @@ public class TCPTransport extends SdlTransport {
handleTransportConnected();
}
- byte[] buffer = new byte[READ_BUFFER_SIZE];
-
+ byte input;
+ boolean stateProgress = false;
while (!isHalted) {
logInfo("TCPTransport.run: Waiting for data...");
- int bytesRead;
try {
- bytesRead = mInputStream.read(buffer);
+ input = (byte) mInputStream.read();
+ //bytesRead = mInputStream.read(buffer);
} catch (IOException e) {
internalHandleStreamReadError();
break;
@@ -397,17 +402,25 @@ public class TCPTransport extends SdlTransport {
}
logInfo("TCPTransport.run: Got new data");
- if (-1 == bytesRead) {
- internalHandleTCPDisconnect();
- break;
- } else if (0 == bytesRead) {
- logInfo("TCPTransport.run: Received zero bytes");
- } else {
- logInfo(String.format("TCPTransport.run: Received %d bytes", bytesRead));
- synchronized (TCPTransport.this) {
- handleReceivedBytes(buffer, bytesRead);
+ // Send the response of what we received
+ stateProgress = psm.handleByte(input);
+ if(!stateProgress){//We are trying to weed through the bad packet info until we get something
+
+ //Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
+ psm.reset();
}
- }
+
+ if(psm.getState() == SdlPsm.FINISHED_STATE)
+ {
+ synchronized (TCPTransport.this) {
+ //Log.d(TAG, "Packet formed, sending off");
+ handleReceivedPacket((SdlPacket)psm.getFormedPacket());
+ }
+ //We put a trace statement in the message read so we can avoid all the extra bytes
+ psm.reset();
+ }
+ //FIXME logInfo(String.format("TCPTransport.run: Received %d bytes", bytesRead));
+
}
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java b/sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java
new file mode 100644
index 000000000..90e066baf
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/TransportBroker.java
@@ -0,0 +1,597 @@
+package com.smartdevicelink.transport;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+import android.annotation.SuppressLint;
+import android.app.ActivityManager;
+import android.app.ActivityManager.RunningServiceInfo;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.Parcelable;
+import android.os.RemoteException;
+import android.os.TransactionTooLargeException;
+import android.util.Log;
+
+import com.smartdevicelink.protocol.SdlPacket;
+import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.transport.utl.ByteAraryMessageAssembler;
+import com.smartdevicelink.transport.utl.ByteArrayMessageSpliter;
+
+
+public class TransportBroker {
+
+ private static final String TAG = "SdlTransportBroker";
+ private final String WHERE_TO_REPLY_PREFIX = "com.sdl.android.";
+ private Long appId = null;
+ private String whereToReply = null;
+ private Context currentContext = null;
+
+ private final Object INIT_LOCK = new Object();
+
+ private TransportType queuedOnTransportConnect = null;
+
+ Messenger routerServiceMessenger = null;
+ final Messenger clientMessenger = new Messenger(new ClientHandler());
+
+ boolean isBound = false, registeredWithRouterService = false;
+ private String routerPackage = null, routerClassName = null;
+ private ComponentName routerService = null;
+
+
+ private SdlPacket bufferedPacket = null;
+ private ByteAraryMessageAssembler bufferedPayloadAssembler = null;
+
+ private ServiceConnection routerConnection;
+
+ private void initRouterConnection(){
+ routerConnection= new ServiceConnection() {
+
+ public void onServiceConnected(ComponentName className, IBinder service) {
+ Log.d(TAG, "Bound to service " + className.toString());
+ routerServiceMessenger = new Messenger(service);
+ isBound = true;
+ //So we just established our connection
+ //Register with router service
+ sendRegistrationMessage();
+ }
+
+ public void onServiceDisconnected(ComponentName className) {
+ Log.d(TAG, "UN-Bound from service " + className.getClassName());
+ routerServiceMessenger = null;
+ registeredWithRouterService = false;
+ isBound = false;
+ onHardwareDisconnected(null);
+ }
+ };
+ }
+
+ protected synchronized boolean sendMessageToRouterService(Message message){
+ return sendMessageToRouterService(message,0);
+ }
+
+ protected synchronized boolean sendMessageToRouterService(Message message, int retryCount){
+ if(message == null){
+ Log.w(TAG, "Attempted to send null message");
+ return false;
+ }
+ //Log.i(TAG, "Attempting to send message type - " + message.what);
+ if(isBound && routerServiceMessenger !=null){
+ if(registeredWithRouterService
+ || message.what == TransportConstants.ROUTER_REGISTER_CLIENT){ //We can send a message if we are registered or are attempting to register
+ try {
+ routerServiceMessenger.send(message);
+ return true;
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ //Let's check to see if we should retry
+ if(e instanceof TransactionTooLargeException
+ || (retryCount<5 && routerServiceMessenger.getBinder().isBinderAlive() && routerServiceMessenger.getBinder().pingBinder())){ //We probably just failed on a small transaction =\
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ return sendMessageToRouterService(message, retryCount++);
+ }else{
+ //DeadObject, time to kill our connection
+ Log.d(TAG, "Dead object while attempting to send packet");
+ routerServiceMessenger = null;
+ registeredWithRouterService = false;
+ isBound = false;
+ onHardwareDisconnected(null);
+ return false;
+ }
+ }
+ }else{
+ Log.e(TAG, "Unable to send message to router service. Not registered.");
+ return false;
+ }
+ }else{
+ Log.e(TAG, "Unable to send message to router service. Not bound.");
+ return false;
+ }
+ }
+
+
+ /**
+ * Handler of incoming messages from service.
+ */
+ @SuppressLint("HandlerLeak")
+ class ClientHandler extends Handler {
+ ClassLoader loader = getClass().getClassLoader();
+ @Override
+ public void handleMessage(Message msg) {
+
+ Bundle bundle = msg.getData();
+
+ if(bundle!=null){
+ bundle.setClassLoader(loader);
+ }
+ //Log.d(TAG, "Bundle: " + bundle.toString());
+ /* DO NOT MOVE
+ * This needs to be first to make sure we already know if we are attempting to enter legacy mode or not
+ */
+ if(bundle !=null
+ && bundle.containsKey(TransportConstants.ENABLE_LEGACY_MODE_EXTRA)){
+ boolean enableLegacy = bundle.getBoolean(TransportConstants.ENABLE_LEGACY_MODE_EXTRA, false);
+ Log.d(TAG, "Setting legacy mode: " +enableLegacy );
+ enableLegacyMode(enableLegacy);
+ }
+
+ //Find out what message we have and what to do with it
+ switch (msg.what) {
+ case TransportConstants.ROUTER_REGISTER_CLIENT_RESPONSE:
+ switch(msg.arg1){
+ case TransportConstants.REGISTRATION_RESPONSE_SUCESS:
+ // yay! we have been registered. Now what?
+ registeredWithRouterService = true;
+ if(bundle!=null && bundle.containsKey(TransportConstants.CONNECTED_DEVICE_STRING_EXTRA_NAME)){
+ //Keep track if we actually get this
+ }
+ if(queuedOnTransportConnect!=null){
+ onHardwareConnected(queuedOnTransportConnect);
+ queuedOnTransportConnect = null;
+ }else if(SdlBroadcastReceiver.isTransportConnected(getContext())){
+ onHardwareConnected(null); //FIXME to include type
+ }
+ break;
+ case TransportConstants.REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED:
+ Log.d(TAG, "Denied registration because router is in legacy mode" );
+ registeredWithRouterService = false;
+ enableLegacyMode(true);
+ //We call this so we can start the process of legacy connection
+ //onHardwareDisconnected(TransportType.BLUETOOTH);
+ onLegacyModeEnabled();
+ break;
+ default:
+ registeredWithRouterService = false;
+ Log.w(TAG, "Registration denied from router service. Reason - " + msg.arg1);
+ break;
+ };
+
+
+ break;
+ case TransportConstants.ROUTER_UNREGISTER_CLIENT_RESPONSE:
+ if(msg.arg1==TransportConstants.UNREGISTRATION_RESPONSE_SUCESS){
+ // We've been unregistered. Now what?
+
+
+ }else{ //We were denied our unregister request to the router service, let's see why
+ Log.w(TAG, "Unregister request denied from router service. Reason - " + msg.arg1);
+ //Do we care?
+ }
+
+ break;
+ case TransportConstants.ROUTER_RECEIVED_PACKET:
+ //So the intent has a packet with it. PEFRECT! Let's send it through the library
+ int flags = bundle.getInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_NONE);
+
+ if(bundle.containsKey(TransportConstants.FORMED_PACKET_EXTRA_NAME)){
+ Parcelable packet = bundle.getParcelable(TransportConstants.FORMED_PACKET_EXTRA_NAME);
+
+ if(flags == TransportConstants.BYTES_TO_SEND_FLAG_NONE){
+ if(packet!=null){ Log.i(TAG, "received packet to process "+ packet.toString());
+ onPacketReceived(packet);
+ }else{
+ Log.w(TAG, "Received null packet from router service, not passing along");
+ }
+ }else if(flags == TransportConstants.BYTES_TO_SEND_FLAG_SDL_PACKET_INCLUDED){
+ Log.i(TAG, "Starting a buffered split packet");
+ bufferedPacket = (SdlPacket) packet;
+ if(bufferedPayloadAssembler !=null){
+ bufferedPayloadAssembler.close();
+ bufferedPayloadAssembler = null;
+ }
+
+ bufferedPayloadAssembler = new ByteAraryMessageAssembler();
+ bufferedPayloadAssembler.init();
+ }
+ }else if(bundle.containsKey(TransportConstants.BYTES_TO_SEND_EXTRA_NAME)){
+ //This should contain the payload
+ if(bufferedPayloadAssembler!=null){
+ byte[] chunk = bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
+ if(!bufferedPayloadAssembler.handleMessage(flags, chunk)){
+ //If there was a problem
+ Log.e(TAG, "Error handling bytes for split packet");
+ }
+ if(bufferedPayloadAssembler.isFinished()){
+ bufferedPacket.setPayload(bufferedPayloadAssembler.getBytes());
+
+ bufferedPayloadAssembler.close();
+ bufferedPayloadAssembler = null;
+ Log.i(TAG, "Split packet finished from router service = " + bufferedPacket.toString());
+ onPacketReceived(bufferedPacket);
+ bufferedPacket = null;
+ }
+ }
+ //}
+ //}
+ }else{
+ Log.w(TAG, "Flase positive packet reception");
+ }
+ break;
+ case TransportConstants.HARDWARE_CONNECTION_EVENT:
+ if(bundle.containsKey(TransportConstants.HARDWARE_DISCONNECTED)){
+ //We should shut down, so call
+ Log.d(TAG, "Hardware disconnected");
+ if(isLegacyModeEnabled()){
+ onLegacyModeEnabled();
+ }else{
+ onHardwareDisconnected(TransportType.valueOf(bundle.getString(TransportConstants.HARDWARE_DISCONNECTED)));
+ }
+ break;
+ }
+
+ if(bundle.containsKey(TransportConstants.HARDWARE_CONNECTED)){
+ onHardwareConnected(TransportType.valueOf(bundle.getString(TransportConstants.HARDWARE_CONNECTED)));
+ break;
+ }
+ break;
+ default:
+ super.handleMessage(msg);
+ }
+
+ }
+ }
+
+
+
+ /***************************************************************************************************************************************
+ *********************************************** Life Cycle **************************************************************
+ ****************************************************************************************************************************************/
+
+
+ @SuppressLint("SimpleDateFormat")
+ public TransportBroker(Context context, String appId, ComponentName service){
+ synchronized(INIT_LOCK){
+ initRouterConnection();
+ //So the user should have set the AppId, lets define where the intents need to be sent
+ SimpleDateFormat s = new SimpleDateFormat("hhmmssss"); //So we have a time stamp of the event
+ String timeStamp = s.format(new Date(System.currentTimeMillis()));
+ if(whereToReply==null){
+ if(appId==null){ //This should really just throw an error
+ whereToReply = WHERE_TO_REPLY_PREFIX + "."+ timeStamp;
+ }else{
+ whereToReply = WHERE_TO_REPLY_PREFIX + appId +"."+ timeStamp;
+ }
+ }
+ this.appId = Long.valueOf(appId.concat(timeStamp));
+ queuedOnTransportConnect = null;
+ currentContext = context;
+ //Log.d(TAG, "Registering our reply receiver: " + whereToReply);
+ this.routerService = service;
+ }
+ }
+
+ /**
+ * This beings the initial connection with the router service.
+ */
+ public boolean start(){
+ Log.d(TAG, "Starting up transport broker for " + whereToReply);
+ synchronized(INIT_LOCK){
+ if(currentContext==null){
+ throw new IllegalStateException("This instance can't be started since it's local reference of context is null. Ensure when suppling a context to the TransportBroker that it is valid");
+ }
+ if(routerConnection==null){
+ initRouterConnection();
+ }
+ //Log.d(TAG, "Registering our reply receiver: " + whereToReply);
+ if(!isBound){
+ return registerWithRouterService();
+ }else{
+ return false;
+ }
+ }
+ }
+
+ public void resetSession(){
+ Log.d(TAG, "RESETING transport broker for " + whereToReply);
+ synchronized(INIT_LOCK){
+ unregisterWithRouterService();
+ routerServiceMessenger = null;
+ queuedOnTransportConnect = null;
+ unBindFromRouterService();
+ }
+ }
+ /**
+ * This method will end our communication with the router service.
+ */
+ public void stop(){
+ Log.d(TAG, "STOPPING transport broker for " + whereToReply);
+ synchronized(INIT_LOCK){
+ unregisterWithRouterService();
+ unBindFromRouterService();
+ routerServiceMessenger = null;
+ queuedOnTransportConnect = null;
+ currentContext = null;
+
+ }
+ }
+
+ private void unBindFromRouterService(){
+ try{
+ if(getContext()!=null && routerConnection!=null){
+ getContext().unbindService(routerConnection);
+ }else{
+ Log.w(TAG, "Unable to unbind from router service, context was null");
+ }
+
+ }catch(IllegalArgumentException e){
+ //This is ok
+ }
+ }
+ /***************************************************************************************************************************************
+ *********************************************** Event Callbacks **************************************************************
+ ****************************************************************************************************************************************/
+
+
+ public void onServiceUnregsiteredFromRouterService(int unregisterCode){
+ queuedOnTransportConnect = null;
+ }
+
+ public void onHardwareDisconnected(TransportType type){
+ synchronized(INIT_LOCK){Log.d(TAG, "onHardwareDisconnect");
+ unBindFromRouterService();
+ routerServiceMessenger = null;
+ routerConnection = null;
+ queuedOnTransportConnect = null;
+ }
+ }
+
+ public boolean onHardwareConnected(TransportType type){
+ synchronized(INIT_LOCK){
+ if(routerServiceMessenger==null){
+ queuedOnTransportConnect = type;
+ return false;
+ }
+ return true;
+ }
+
+ }
+
+ public void onPacketReceived(Parcelable packet){
+
+ }
+
+ public void onLegacyModeEnabled(){
+
+ }
+
+ /**
+ * We want to check to see if the Router service is already up and running
+ * @param context
+ * @return
+ */
+ private boolean isRouterServiceRunning(Context context){
+ Log.d(TAG,whereToReply + " checking if a bluetooth service is running");
+ if(context==null){
+
+ return false;
+ }
+ ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
+ //We will check to see if it contains this name, should be pretty specific
+ if ((service.service.getClassName()).toLowerCase(Locale.US).contains(SdlBroadcastReceiver.SDL_ROUTER_SERVICE_CLASS_NAME)) {
+ this.routerClassName = service.service.getClassName();
+ this.routerPackage = service.service.getPackageName();
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ public boolean sendPacketToRouterService(SdlPacket packet){ //We use ints because that is all that is supported by the outputstream class
+ //Log.d(TAG,whereToReply + "Sending packet to router service");
+
+ if(routerServiceMessenger==null){
+ Log.d(TAG,whereToReply + " tried to send packet, but no where to send");
+ return false;
+ }
+ if(packet == null
+ //|| offset<0
+ //|| count<0
+ ){//|| count>(bytes.length-offset)){
+ Log.w(TAG,whereToReply + "incorrect params supplied");
+ return false;
+ }
+ byte[] bytes = packet.constructPacket();
+ if(bytes.length<ByteArrayMessageSpliter.MAX_BINDER_SIZE){//Determine if this is under the packet length.
+ Message message = Message.obtain(); //Do we need to always obtain new? or can we just swap bundles?
+ message.what = TransportConstants.ROUTER_SEND_PACKET;
+ Bundle bundle = new Bundle();
+ bundle.putLong(TransportConstants.APP_ID_EXTRA, appId);
+ bundle.putByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME, bytes); //Do we just change this to the args and objs
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0);
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, bytes.length);
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_NONE);
+ bundle.putInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT, packet.getPrioirtyCoefficient());
+ message.setData(bundle);
+
+ sendMessageToRouterService(message);
+ return true;
+ }else{ //Message is too big for IPC transaction
+ Log.w(TAG, "Message too big for single IPC transaction. Breaking apart. Size - " + bytes.length);
+ ByteArrayMessageSpliter splitter = new ByteArrayMessageSpliter(appId,TransportConstants.ROUTER_SEND_PACKET,bytes,packet.getPrioirtyCoefficient() );
+ while(splitter.isActive()){
+ sendMessageToRouterService(splitter.nextMessage());
+ }
+ return splitter.close();
+ }
+
+ }
+
+ /**
+ * This registers this service with the router service
+ */
+ private boolean registerWithRouterService(){
+ if(getContext()==null){
+ Log.e(TAG, "Context set to null, failing out");
+ return false;
+ }
+
+ if(routerServiceMessenger!=null){
+ Log.w(TAG, "Already registered with router service");
+ return false;
+ }
+ //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
+ Log.d(TAG,whereToReply + " found no router service. Shutting down.");
+ this.onHardwareDisconnected(null);
+ return false;
+ }
+ }else{//We were already told where to bind. This should be the case.
+ this.routerClassName = this.routerService.getClassName();
+ this.routerPackage = this.routerService.getPackageName();
+ }
+
+ if(!sendBindingIntent()){
+ Log.e(TAG, "Something went wrong while trying to bind with the router service.");
+ return false;
+ }
+ return true;
+
+ }
+
+ @SuppressLint("InlinedApi")
+ private boolean sendBindingIntent(){
+ if(this.routerPackage !=null && this.routerClassName !=null){
+ Log.d(TAG, "Sending bind request to " + this.routerPackage + " - " + this.routerClassName);
+ Intent bindingIntent = new Intent();
+ bindingIntent.setClassName(this.routerPackage, this.routerClassName);//This sets an explicit intent
+ //Quickly make sure it's just up and running
+ getContext().startService(bindingIntent);
+ bindingIntent.setAction( TransportConstants.BIND_REQUEST_TYPE_CLIENT);
+ return getContext().bindService(bindingIntent, routerConnection, Context.BIND_AUTO_CREATE);
+ }else{
+ return false;
+ }
+ }
+
+ private void sendRegistrationMessage(){
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_REGISTER_CLIENT;
+ msg.replyTo = this.clientMessenger;
+ Bundle bundle = new Bundle();
+ bundle.putLong(TransportConstants.APP_ID_EXTRA, appId);
+ msg.setData(bundle);
+ sendMessageToRouterService(msg);
+ }
+
+ private void unregisterWithRouterService(){
+ Log.i(TAG, "Attempting to unregister with Sdl Router Service");
+ if(isBound && routerServiceMessenger!=null){
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_UNREGISTER_CLIENT;
+ msg.replyTo = this.clientMessenger; //Including this in case this app isn't actually registered with the router service
+ Bundle bundle = new Bundle();
+ bundle.putLong(TransportConstants.APP_ID_EXTRA, appId);
+ msg.setData(bundle);
+ sendMessageToRouterService(msg);
+ }else{
+ Log.w(TAG, "Unable to unregister, not bound to router service");
+ }
+
+ routerServiceMessenger = null;
+ }
+
+
+
+ /**
+ * Since it doesn't always make sense to add another service, use this method to get
+ * the appropriate context that the rest of this class is using.
+ * @return The currently used context for this class
+ */
+ private Context getContext(){
+ return currentContext;
+ }
+
+ /***************************************************************************************************************************************
+ *********************************************** LEGACY *******************************************************************************
+ ****************************************************************************************************************************************/
+ /*
+ * Due to old implementations of SDL/Applink, old versions can't support multiple sessions per RFCOMM channel.
+ * This causes a race condition in the router service where only the first app registered will be able to communicate with the
+ * head unit. With this additional code, the router service will:
+ * 1) Acknowledge it's connected to an old system
+ * 2) d/c its bluetooth
+ * 3) Send a message to all clients connected that legacy mode is enabled
+ * 4) Each client spins up their own bluetooth RFCOMM listening channel
+ * 5) Head unit will need to query apps again
+ * 6) HU should then connect to each app by their own RFCOMM channel bypassing the router service
+ * 7) When the phone is D/C from the head unit the router service will reset and tell clients legacy mode is now off
+ */
+
+ private static boolean legacyModeEnabled = false;
+ private static Object LEGACY_LOCK = new Object();
+
+ protected void enableLegacyMode(boolean enable){
+ synchronized(LEGACY_LOCK){
+ legacyModeEnabled = enable;
+ }
+ }
+ protected static boolean isLegacyModeEnabled(){
+ synchronized(LEGACY_LOCK){
+ return legacyModeEnabled;
+ }
+
+ }
+
+ /***************************************************************************************************************************************
+ **************************************************** LEGACY END ***********************************************************************
+ ****************************************************************************************************************************************/
+
+ /**
+ * Use this method to let the router service know that you are requesting a new session from the head unit.
+ */
+ public void requestNewSession(){
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_REQUEST_NEW_SESSION;
+ msg.replyTo = this.clientMessenger; //Including this in case this app isn't actually registered with the router service
+ Bundle bundle = new Bundle();
+ bundle.putLong(TransportConstants.APP_ID_EXTRA, appId);
+ msg.setData(bundle);
+ this.sendMessageToRouterService(msg);
+ }
+
+ public void removeSession(long sessionId){
+ Message msg = Message.obtain();
+ msg.what = TransportConstants.ROUTER_REMOVE_SESSION;
+ msg.replyTo = this.clientMessenger; //Including this in case this app isn't actually registered with the router service
+ Bundle bundle = new Bundle();
+ bundle.putLong(TransportConstants.APP_ID_EXTRA, appId);
+ bundle.putLong(TransportConstants.SESSION_ID_EXTRA, sessionId);
+ msg.setData(bundle);
+ this.sendMessageToRouterService(msg);
+ }
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/TransportConstants.java b/sdl_android_lib/src/com/smartdevicelink/transport/TransportConstants.java
new file mode 100644
index 000000000..00b7e54b0
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/TransportConstants.java
@@ -0,0 +1,196 @@
+package com.smartdevicelink.transport;
+
+
+/**
+ * These constants are shared between the router service and the SDL base service.
+ * They are defined as strings/actions/values that both of them can understand.
+ * Attempting to use standard HTTP error codes as definitions.
+ * @author Joey Grover
+ *
+ */
+public class TransportConstants {
+ public static final String START_ROUTER_SERVICE_ACTION ="sdl.router.startservice";
+
+ public static final String UNREGISTER_WITH_ROUTER_ACTION = "com.sdl.android.unregister";
+ public static final String SEND_PACKET_ACTION = "com.sdl.android.sendpacket";
+ public static final String SEND__GLOBAL_PACKET_ACTION = "com.sdl.android.sendglobalpacket";
+
+ public static final String BIND_LOCATION_PACKAGE_NAME_EXTRA = "BIND_LOCATION_PACKAGE_NAME_EXTRA";
+ public static final String BIND_LOCATION_CLASS_NAME_EXTRA = "BIND_LOCATION_CLASS_NAME_EXTRA";
+
+ public static final String ALT_TRANSPORT_RECEIVER = "com.sdl.android.alttransport";
+ public static final String ALT_TRANSPORT_CONNECTION_STATUS_EXTRA = "connection_status";
+ public static final int ALT_TRANSPORT_DISCONNECTED = 0;
+ public static final int ALT_TRANSPORT_CONNECTED = 1;
+ public static final String ALT_TRANSPORT_READ = "read";//Read from the alt transport, goes to the app
+ public static final String ALT_TRANSPORT_WRITE = "write";//Write to the alt transport, comes from the app
+ public static final String ALT_TRANSPORT_ADDRESS_EXTRA = "altTransportAddress";
+
+ public static final String START_ROUTER_SERVICE_SDL_ENABLED_EXTRA = "sdl_enabled";
+ public static final String START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE = "package_name";
+ public static final String START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME = "component_name";
+ public static final String START_ROUTER_SERVICE_SDL_ENABLED_PING = "ping";
+ public static final String FORCE_TRANSPORT_CONNECTED = "force_connect"; //This is legacy, do not refactor this.
+
+ public static final String REPLY_TO_INTENT_EXTRA = "ReplyAddress";
+ public static final String CONNECT_AS_CLIENT_BOOLEAN_EXTRA = "connectAsClient";
+ public static final String PACKAGE_NAME_STRING = "package.name";
+ public static final String APP_ID_EXTRA = "app.id";
+ public static final String SESSION_ID_EXTRA = "session.id";
+
+ public static final String LOG_BASIC_DEBUG_BOOLEAN_EXTRA = "basicDebugBool";
+ public static final String LOG_TRACE_BT_DEBUG_BOOLEAN_EXTRA = "btTraceBool";
+
+
+ public static final String ENABLE_LEGACY_MODE_EXTRA = "ENABLE_LEGACY_MODE_EXTRA";
+
+ public static final String HARDWARE_DISCONNECTED = "hardware.disconect";
+ public static final String HARDWARE_CONNECTED = "hardware.connected";
+
+ public static final String SEND_PACKET_TO_APP_LOCATION_EXTRA_NAME = "senderintent";
+ public static final String SEND_PACKET_TO_ROUTER_LOCATION_EXTRA_NAME = "routerintent";
+
+
+ public static final String BIND_REQUEST_TYPE_CLIENT = "BIND_REQUEST_TYPE_CLIENT";
+ public static final String BIND_REQUEST_TYPE_ALT_TRANSPORT = "BIND_REQUEST_TYPE_ALT_TRANSPORT";
+
+
+ public static final String PING_ROUTER_SERVICE_EXTRA = "ping.router.service";
+ /**
+ * Alt transport
+ *
+ */
+ /**
+ * This will be the response when a hardware connect event comes through from an alt transport.
+ * This is because it only makes sense to register an alt transport when a connection is established with that
+ * transport, not waiting for one.
+ */
+ public static final int ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE = 0x02;
+ public static final int ROUTER_REGISTER_ALT_TRANSPORT_RESPONSE_SUCESS = 0x00;
+ /**
+ * There is already another alt transport connected, so we are unable to register this one
+ */
+ public static final int ROUTER_REGISTER_ALT_TRANSPORT_ALREADY_CONNECTED = 0x01;
+
+ /**
+ * This means the router service is shutting down for some reason. Most likely
+ */
+ public static final int ROUTER_SHUTTING_DOWN_NOTIFICATION = 0x0F;
+
+ /**
+ * There is a newer service to start up, so this one is shutting down
+ */
+ public static final int ROUTER_SHUTTING_DOWN_REASON_NEWER_SERVICE = 0x00;
+
+ /**
+ * Router to Client binding service
+ *
+ */
+
+ //WHATS
+ /**
+ * Command to the service to register a client, receiving callbacks
+ * from the service. The Message's replyTo field must be a Messenger of
+ * the client where callbacks should be sent.
+ */
+ public static final int ROUTER_REGISTER_CLIENT = 0x01;
+ /**
+ * This response message will contain if the registration request was successful or not. If not, the reason will be
+ * great or equal to 1 and be descriptive of why it was denied.
+ */
+ public static final int ROUTER_REGISTER_CLIENT_RESPONSE = 0x02;
+ //Response arguments
+ public static final int REGISTRATION_RESPONSE_SUCESS = 0x00;
+ public static final int REGISTRATION_RESPONSE_DENIED_AUTHENTICATION_FAILED = 0x01;
+ public static final int REGISTRATION_RESPONSE_DENIED_NO_CONNECTION = 0x02;
+ public static final int REGISTRATION_RESPONSE_DENIED_APP_ID_NOT_INCLUDED = 0x03;
+ public static final int REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED = 0x04;
+ public static final int REGISTRATION_RESPONSE_DENIED_UNKNOWN = 0xFF;
+
+ /**
+ * Command to the service to unregister a client, to stop receiving callbacks
+ * from the service. The Message's replyTo field must be a Messenger of
+ * the client as previously given with MSG_REGISTER_CLIENT. Also include the app id as arg1.
+ */
+ public static final int ROUTER_UNREGISTER_CLIENT = 0x03;
+ public static final int ROUTER_UNREGISTER_CLIENT_RESPONSE = 0x04;
+ //Response arguments
+ public static final int UNREGISTRATION_RESPONSE_SUCESS = 0x00;
+ public static final int UNREGISTRATION_RESPONSE_FAILED_APP_ID_NOT_FOUND = 0x01;
+
+
+ /**
+ * what message type to notify apps of a hardware connection event. The connection event will be placed in the bundle
+ * attached to the message
+ */
+ public static final int HARDWARE_CONNECTION_EVENT = 0x05;
+
+
+ public static final int ROUTER_REQUEST_BT_CLIENT_CONNECT = 0x10;
+ public static final int ROUTER_REQUEST_BT_CLIENT_CONNECT_RESPONSE = 0x11;
+
+ /**
+ * This provides the app with an ability to request another session within the router service.
+ * A replyTo must be provided or else there won't be a response
+ */
+ public static final int ROUTER_REQUEST_NEW_SESSION = 0x12;
+ public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE = 0x13;
+ //Response arguments
+ public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE_SUCESS = 0x00;
+ public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_NOT_FOUND = 0x01;
+ public static final int ROUTER_REQUEST_NEW_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL = 0x02;
+
+ /**
+ * This provides the app with an ability to request another session within the router service.
+ * A replyTo must be provided or else there won't be a response
+ */
+ public static final int ROUTER_REMOVE_SESSION = 0x14;
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE = 0x15;
+ //Response arguments
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE_SUCESS = 0x00;
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_NOT_FOUND = 0x01;
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_APP_ID_NOT_INCL = 0x02;
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_NOT_FOUND = 0x03;
+ public static final int ROUTER_REMOVE_SESSION_RESPONSE_FAILED_SESSION_ID_NOT_INCL = 0x04;
+ /**
+ * Command to have router service to send a packet
+ */
+ public static final int ROUTER_SEND_PACKET = 0x20;
+
+
+
+ //response
+ /**
+ * Router has received a packet and sent it to the client
+ */
+ public static final int ROUTER_RECEIVED_PACKET = 0x26;
+ //response
+
+ //BUNDLE EXTRAS
+
+ public static final String FORMED_PACKET_EXTRA_NAME = "packet";
+
+ public static final String BYTES_TO_SEND_EXTRA_NAME = "bytes";
+ public static final String BYTES_TO_SEND_EXTRA_OFFSET = "offset";
+ public static final String BYTES_TO_SEND_EXTRA_COUNT = "count";
+ public static final String BYTES_TO_SEND_FLAGS = "flags";
+
+ public static final String PACKET_PRIORITY_COEFFICIENT = "priority_coefficient";
+
+ public static final int BYTES_TO_SEND_FLAG_NONE = 0x00;
+ public static final int BYTES_TO_SEND_FLAG_SDL_PACKET_INCLUDED = 0x01;
+ public static final int BYTES_TO_SEND_FLAG_LARGE_PACKET_START = 0x02;
+ public static final int BYTES_TO_SEND_FLAG_LARGE_PACKET_CONT = 0x04;
+ public static final int BYTES_TO_SEND_FLAG_LARGE_PACKET_END = 0x08;
+
+ public static final String CONNECTED_DEVICE_STRING_EXTRA_NAME = "devicestring";
+
+ public static final int PACKET_SENDING_ERROR_NOT_REGISTERED_APP = 0x00;
+ public static final int PACKET_SENDING_ERROR_NOT_CONNECTED = 0x01;
+ public static final int PACKET_SENDING_ERROR_UKNOWN = 0xFF;
+
+
+
+
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/USBTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/USBTransport.java
index eecd91cfc..72616084a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/USBTransport.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/USBTransport.java
@@ -1,5 +1,12 @@
package com.smartdevicelink.transport;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -8,24 +15,17 @@ import android.content.IntentFilter;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbManager;
import android.os.ParcelFileDescriptor;
-
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
+import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.trace.SdlTrace;
-import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
+import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
import com.smartdevicelink.transport.ITransportListener;
import com.smartdevicelink.transport.SdlTransport;
import com.smartdevicelink.transport.SiphonServer;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.DebugTool;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
/**
* Class that implements USB transport.
*
@@ -35,6 +35,7 @@ import java.io.OutputStream;
* the other side will NOT be notified and unblocked from reading data until
* some data is sent again or the USB is physically disconnected.
*/
+@SuppressLint("NewApi")
public class USBTransport extends SdlTransport {
/**
* Broadcast action: sent when a USB accessory is attached.
@@ -204,10 +205,10 @@ public class USBTransport extends SdlTransport {
* @return true if the bytes are sent successfully
*/
@Override
- protected boolean sendBytesOverTransport(byte[] msgBytes, int offset,
- int length) {
- logD("SendBytes: array size " + msgBytes.length + ", offset " + offset +
- ", length " + length);
+ protected boolean sendBytesOverTransport(SdlPacket packet) {
+ byte[] msgBytes = packet.constructPacket();
+ logD("SendBytes: array size " + msgBytes.length + ", offset " + 0 +
+ ", length " + msgBytes.length);
boolean result = false;
final State state = getState();
@@ -215,13 +216,13 @@ public class USBTransport extends SdlTransport {
case CONNECTED:
if (mOutputStream != null) {
try {
- mOutputStream.write(msgBytes, offset, length);
+ mOutputStream.write(msgBytes, 0, msgBytes.length);
result = true;
logI("Bytes successfully sent");
SdlTrace.logTransportEvent(TAG + ": bytes sent",
null, InterfaceActivityDirection.Transmit,
- msgBytes, offset, length,
+ msgBytes, 0, msgBytes.length,
SDL_LIB_TRACE_KEY);
} catch (IOException e) {
final String msg = "Failed to send bytes over USB";
@@ -650,6 +651,8 @@ public class USBTransport extends SdlTransport {
*/
private final String TAG = USBTransportReader.class.getSimpleName();
+ SdlPsm psm;
+
/**
* Checks if the thread has been interrupted.
*
@@ -667,7 +670,8 @@ public class USBTransport extends SdlTransport {
@Override
public void run() {
logD("USB reader started!");
-
+ psm = new SdlPsm();
+ psm.reset();
if (connect()) {
readFromTransport();
}
@@ -742,11 +746,13 @@ public class USBTransport extends SdlTransport {
final int READ_BUFFER_SIZE = 4096;
byte[] buffer = new byte[READ_BUFFER_SIZE];
int bytesRead;
+ // byte input;
+ boolean stateProgress = false;
// read loop
while (!isInterrupted()) {
try {
- bytesRead = mInputStream.read(buffer);
+ bytesRead = mInputStream.read(buffer);
if (bytesRead == -1) {
if (isInterrupted()) {
logI("EOF reached, and thread is interrupted");
@@ -767,19 +773,34 @@ public class USBTransport extends SdlTransport {
}
logD("Read " + bytesRead + " bytes");
- SdlTrace.logTransportEvent(TAG + ": read bytes", null,
- InterfaceActivityDirection.Receive, buffer, bytesRead,
- SDL_LIB_TRACE_KEY);
+ //FIXME SdlTrace.logTransportEvent(TAG + ": read bytes", null,
+ // InterfaceActivityDirection.Receive, buffer, bytesRead,
+ // SDL_LIB_TRACE_KEY);
if (isInterrupted()) {
logI("Read some data, but thread is interrupted");
return;
}
-
- if (bytesRead > 0) {
- synchronized (USBTransport.this) {
- handleReceivedBytes(buffer, bytesRead);
- }
+ byte input;
+ for(int i=0;i<bytesRead; i++){
+ input=buffer[i];
+ stateProgress = psm.handleByte(input);
+ if(!stateProgress){//We are trying to weed through the bad packet info until we get something
+ //Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
+ psm.reset();
+ buffer = new byte[READ_BUFFER_SIZE];
+ }
+
+ if(psm.getState() == SdlPsm.FINISHED_STATE){
+ synchronized (USBTransport.this) {
+ //Log.d(TAG, "Packet formed, sending off");
+ handleReceivedPacket((SdlPacket)psm.getFormedPacket());
+ }
+ //We put a trace statement in the message read so we can avoid all the extra bytes
+ psm.reset();
+ buffer = new byte[READ_BUFFER_SIZE]; //FIXME just do an array copy and send off
+
+ }
}
}
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/enums/TransportType.java b/sdl_android_lib/src/com/smartdevicelink/transport/enums/TransportType.java
index 46e0c49ab..2283d8d01 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/enums/TransportType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/enums/TransportType.java
@@ -4,7 +4,10 @@ package com.smartdevicelink.transport.enums;
* Defines available types of the transports.
*/
public enum TransportType {
-
+ /**
+ * Experimental multiplexing (only supports bluetooth at the moment)
+ */
+ MULTIPLEX,
/**
* Transport type is Bluetooth.
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java b/sdl_android_lib/src/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
new file mode 100644
index 000000000..98b8b666e
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
@@ -0,0 +1,71 @@
+package com.smartdevicelink.transport.utl;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import android.util.Log;
+
+import com.smartdevicelink.transport.TransportConstants;
+
+public class ByteAraryMessageAssembler {
+ private static final String TAG = "ByteAraryMessageAssembler";
+ ByteArrayOutputStream buffer;
+ boolean isFinished;
+
+ public void init(){
+ close();
+ this.isFinished = false;
+ buffer = new ByteArrayOutputStream();
+ }
+
+ public boolean close(){
+ if(buffer!=null){
+ try {
+ buffer.close();
+ buffer = null;
+ return true;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+ return false;
+ }
+
+ public void append(byte[] bytes){
+ try {
+ buffer.write(bytes);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public synchronized boolean handleMessage(int flags, byte[] packet){
+ switch(flags){
+ case TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START: //Fall through to write the bytes after they buffer was init'ed
+ case TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_CONT:
+ append(packet);
+ break;
+ case TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_END:
+ append(packet);
+ this.isFinished = true;
+ break;
+ default:
+ Log.e(TAG, "Error handling message");
+ return false;
+ }
+
+ return true;
+ }
+
+ public byte[] getBytes(){
+ if(buffer == null){
+ return null;
+ }
+ return this.buffer.toByteArray();
+ }
+
+ public boolean isFinished(){
+ return this.isFinished;
+ }
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java b/sdl_android_lib/src/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java
new file mode 100644
index 000000000..b8c33c614
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/utl/ByteArrayMessageSpliter.java
@@ -0,0 +1,107 @@
+package com.smartdevicelink.transport.utl;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import com.smartdevicelink.transport.TransportConstants;
+
+import android.os.Bundle;
+import android.os.Message;
+import android.util.Log;
+
+public class ByteArrayMessageSpliter {
+ private static final String TAG = "ByteArrayMessageSpliter";
+
+ //To test set this value to something very small (eg, 50)
+ public static final int MAX_BINDER_SIZE = 1000000/4; //~1MB/4 We do this as a safety measure. IPC only allows 1MB for everything. We should never fill more than 25% of the buffer so here we make sure we stay under that
+
+ boolean firstPacket;
+ ByteArrayInputStream stream;
+ int bytesRead;
+ int what;
+ Long appId;
+ byte[] buffer;
+ int orginalSize;
+ int priorityCoef;
+
+ public ByteArrayMessageSpliter(String appId,int what, byte[] bytes, int priorityCoef){
+ this.appId = Long.valueOf(appId);
+ this.what = what;
+ stream = new ByteArrayInputStream(bytes);
+ orginalSize = stream.available();
+ bytesRead = 0;
+ firstPacket = true;
+ this.priorityCoef = priorityCoef;
+ }
+
+ public ByteArrayMessageSpliter(Long appId,int what, byte[] bytes, int priorityCoef){
+ this.appId = appId;
+ this.what = what;
+ stream = new ByteArrayInputStream(bytes);
+ orginalSize = stream.available();
+ bytesRead = 0;
+ firstPacket = true;
+ this.priorityCoef = priorityCoef;
+ }
+
+ public boolean isActive(){
+ if(stream!=null){
+ return stream.available()>0;
+ }
+ return false;
+ }
+
+ public boolean close(){
+ if(stream == null){
+ return false;
+ }
+ try {
+ stream.close();
+ stream = null;
+ return true;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return false;
+ }
+
+ }
+
+ public Message nextMessage(){
+ if(stream == null || stream.available()<=0){
+ return null;
+ }
+
+ Message message = Message.obtain(); //Do we need to always obtain new? or can we just swap bundles?
+ message.what = this.what;// TransportConstants.ROUTER_SEND_PACKET;
+ Bundle bundle = new Bundle();
+
+
+ if(stream.available()>=MAX_BINDER_SIZE){
+ buffer = new byte[MAX_BINDER_SIZE];
+ bytesRead = stream.read(buffer, 0, MAX_BINDER_SIZE);
+ }else{
+ buffer = new byte[stream.available()];
+ bytesRead = stream.read(buffer, 0, stream.available());
+ }
+
+ bundle.putByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME, buffer); //Do we just change this to the args and objs
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0);
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, bytesRead);
+
+ //Determine which flag should be sent for this division of the packet
+ if(firstPacket){
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_START);
+ bundle.putInt(TransportConstants.PACKET_PRIORITY_COEFFICIENT, this.priorityCoef);
+ firstPacket = false;
+ }else if(stream.available()<=0){ //We are at the end of the stream so let the flag reflect that
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_END);
+ }else{
+ bundle.putInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_LARGE_PACKET_CONT);
+ }
+
+ bundle.putLong(TransportConstants.APP_ID_EXTRA, appId);
+ message.setData(bundle);
+ Log.i(TAG, ((100 - ((stream.available()*100)/orginalSize) ))+ " percent complete.");
+ return message;
+ }
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/util/BitConverter.java b/sdl_android_lib/src/com/smartdevicelink/util/BitConverter.java
index 4cb1927b1..c844e49a4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/util/BitConverter.java
+++ b/sdl_android_lib/src/com/smartdevicelink/util/BitConverter.java
@@ -69,4 +69,22 @@ public class BitConverter {
}
return ret;
}
+
+ /**
+ * Converts the byte array into a string of hex values.
+ * @param bytes
+ * @param end EXCLUSIVE so if it it receives 10 it will print 0-9
+ * @return
+ */
+ public static String bytesToHex(byte[] bytes,int end){
+ if(bytes.length<end){
+ end = bytes.length;
+ }
+ StringBuilder sb = new StringBuilder();
+ for(int i=0;i<end;i++){
+ sb.append(" ");
+ sb.append(String.format("%02X ", bytes[i]));
+ }
+ return sb.toString();
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/util/HttpRequestTask.java b/sdl_android_lib/src/com/smartdevicelink/util/HttpRequestTask.java
new file mode 100644
index 000000000..f5f56ece4
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/util/HttpRequestTask.java
@@ -0,0 +1,172 @@
+package com.smartdevicelink.util;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import android.os.AsyncTask;
+import android.util.Log;
+
+public class HttpRequestTask extends AsyncTask<String, String, String> {
+ private static final String TAG = "Http Request Task";
+
+ public static final String REQUEST_TYPE_POST = "POST";
+ public static final String REQUEST_TYPE_GET = "GET";
+ public static final String REQUEST_TYPE_DELETE = "DELETE";
+
+ HttpRequestTaskCallback cb;
+
+ /**
+ * @param HttpRequestTaskCallback callback for when this task finishes
+ * <br><br><b> - When calling execute, params as followed: </b><br>
+ * 1. Url String<br>
+ * 2. Request type (Defined in this class) REQUEST_TYPE_POST, REQUEST_TYPE_GET, REQUEST_TYPE_DELETE<br>
+ * 3. (Optional) Data to be sent. <br>
+ * 4. (Optional) Content Type Default will be application/json<br>
+ * 5. (Optional) Accept Type default will be application/json
+ *
+ */
+ public HttpRequestTask( HttpRequestTaskCallback hcb){
+ this.cb = hcb;
+ }
+
+ @Override
+ protected String doInBackground(String... params) {
+ int length = params.length;
+ String urlString = params[0];
+ String request_type = params[1];
+
+ //Grab and set data to be written if included
+ String data;
+ if(length>2){
+ data = params[2];
+ }else{
+ data = null;
+ }
+
+ //Grab and set content type for the header if included
+ String contentType;
+ if(length>3){
+ contentType = params[3];
+ }else{
+ contentType = "application/json";
+ }
+ //Grab and set accept type for the header if included
+ String acceptType;
+ if(length>4){
+ acceptType = params[4];
+ }else{
+ acceptType = "application/json";
+ }
+
+ if(urlString == null || request_type == null){
+ Log.e(TAG, "Can't process request, param error");
+ if(cb!=null){
+ cb.httpFailure(-1);
+ }
+ return "Error";
+ }
+
+ HttpURLConnection urlConnection = null;
+ BufferedReader reader = null;
+ try {
+ URL url = new URL(urlString);
+ urlConnection = (HttpURLConnection) url.openConnection();
+ urlConnection.setDoOutput(true);
+ urlConnection.setRequestMethod(request_type);
+ urlConnection.setRequestProperty("Content-Type", contentType);
+ urlConnection.setRequestProperty("Accept", acceptType);
+ //If we have data, we should write it out
+ if(data !=null){
+ Writer writer = new BufferedWriter(new OutputStreamWriter(urlConnection.getOutputStream(), "UTF-8"));
+ writer.write(data);
+ writer.close();
+ }
+ InputStream inputStream = urlConnection.getInputStream();
+
+ int responseCode = urlConnection.getResponseCode();
+ if (responseCode == 200) { //Success
+ //input stream
+ StringBuffer buffer = new StringBuffer();
+ if (inputStream == null) {
+ // Nothing to do.
+ if(cb!=null){
+ cb.httpCallComplete(null);
+ }
+ return null;
+ }
+ reader = new BufferedReader(new InputStreamReader(inputStream));
+
+ String inputLine;
+ while ((inputLine = reader.readLine()) != null)
+ buffer.append(inputLine + "\n");
+ if (buffer.length() == 0) {
+ // Stream was empty. No point in parsing.
+ if(cb!=null){
+ cb.httpCallComplete(null);
+ }
+ return null;
+ }
+ String response = null;
+
+ response = buffer.toString();
+ //send to post execute
+ if(cb!=null){
+ cb.httpCallComplete(response);
+ }
+ return response;
+ }else{
+ if(cb!=null){
+ cb.httpFailure(responseCode);
+ }
+ Log.e(TAG, "Failed to download file - " + responseCode);
+ return null;
+ }
+
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ finally {
+ if (urlConnection != null) {
+ urlConnection.disconnect();
+ }
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (final IOException e) {
+ Log.e(TAG, "Error closing stream", e);
+ }
+ }
+ if(cb!=null){
+ cb.httpFailure(-1);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Callback interface for HTTP requests.
+ * @author Joey Grover
+ *
+ */
+ public interface HttpRequestTaskCallback{
+ /**
+ * Called when HTTP request is successfully completed.
+ * @param response The response to the HTTP request.
+ */
+ public abstract void httpCallComplete(String response);
+ /**
+ * Called when HTTP request failed.
+ * @param statusCode The HTTP failure code.
+ */
+ public abstract void httpFailure(int statusCode);
+ }
+
+}