summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2015-09-15 15:52:06 -0400
committerJoey Grover <joeygrover@gmail.com>2015-09-15 15:52:06 -0400
commite5e79617a59d99cff1aee5773fa181101a9451d2 (patch)
treee61216f07b4ff0f27dbe181d1074e170f862ad56
parenta3bf4decd9fbddc42a0e2f82c14db8ff525773ee (diff)
parentdf74151fd6a18427dd45b4498bbfdf863cb8bb8c (diff)
downloadsdl_android-e5e79617a59d99cff1aee5773fa181101a9451d2.tar.gz
Merge branch 'develop'4.0.0
-rw-r--r--CHANGELOG.md79
-rw-r--r--sdl_android_lib/AndroidManifest.xml2
-rw-r--r--sdl_android_lib/project.properties2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/Dispatcher/IncomingProtocolMessageComparitor.java14
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/Dispatcher/InternalProxyMessageComparitor.java14
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/Dispatcher/OutgoingProtocolMessageComparitor.java15
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/Dispatcher/ProxyMessageDispatcher.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java338
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlSession.java50
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/encoder/SdlEncoder.java170
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/exception/SdlExceptionCause.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/AbstractProtocol.java38
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/IProtocolListener.java17
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/ProtocolMessage.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/WiProProtocol.java110
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameData.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameDataControlFrameType.java11
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameType.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/enums/FunctionID.java287
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/enums/SessionType.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/heartbeat/HeartbeatMonitor.java276
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitor.java7
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/LockScreenManager.java33
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/RPCMessage.java19
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/RPCNotification.java14
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java73
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/RPCResponse.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/RPCStreamController.java32
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java37
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java1245
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBuilder.java129
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/InternalProxyMessage.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/OnServiceEnded.java21
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/OnServiceNACKed.java21
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java31
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/interfaces/IPutFileResponseListener.java9
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommand.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommandResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenu.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Alert.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuver.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistration.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommand.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFile.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java3
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumber.java51
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumberResponse.java23
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GenericResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCs.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleData.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java22
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HMICapabilities.java49
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFiles.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFilesResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonEvent.java2
-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.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHMIStatus.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHashChange.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLanguageChange.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLockScreenStatus.java3
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSdlChoiceChosen.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnStreamRPC.java47
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSystemRequest.java50
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTBTClientState.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTouchEvent.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnVehicleData.java22
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteraction.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java45
-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.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java3
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java78
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessage.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java29
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocationResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIcon.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java2
-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.java2
-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.java2
-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.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Slider.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SliderResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Speak.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SpeakResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/StreamRPCResponse.java41
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButton.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java21
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequest.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEvent.java31
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java2
-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.java2
-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.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java21
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnList.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java9
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/GearShiftAdviceStatus.java18
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java9
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/KeyboardEvent.java7
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LightSwitchStatus.java16
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java16
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MessageType.java15
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java25
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/RequestType.java59
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/Result.java44
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java27
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TirePressureTellTale.java15
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java17
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataResultCode.java6
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/streaming/AbstractPacketizer.java17
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/streaming/StreamPacketizer.java76
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java213
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/trace/Mime.java137
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/trace/SdlTrace.java121
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java1
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/BTTransportConfig.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/BaseTransportConfig.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/SdlTransport.java1
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/TCPTransport.java4
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/TCPTransportConfig.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/USBTransport.java10
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/USBTransportConfig.java2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/enums/TransportType.java (renamed from sdl_android_lib/src/com/smartdevicelink/transport/TransportType.java)2
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/util/Base64.java111
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/util/ByteEnumer.java18
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/util/HttpUtils.java22
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/util/Mime.java183
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/util/NativeLogTool.java54
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/util/SdlDataTypeConverter.java33
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/util/StringEnumer.java47
173 files changed, 3493 insertions, 1737 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 000000000..387e19d5e
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,79 @@
+# 4.0.0 Release Notes
+
+### API New Features & Breaking Changes
+* Updated to v4.0 RPCs and enums.
+ * Enums updated:
+ * LayoutMode (Add and deprecate)
+ * AppInterfaceUnregisteredReason
+ * TextFieldName
+ * ImageFieldName
+ * VehicleDataResultCode
+ * KeyboardEvent
+ * RequestType
+ * RPCs updated
+ * TouchEvent - Changed timestamp (ts) to use Long instead of Integers
+ * HMICapabilities (new)
+ * RegisterAppInterface (response)
+ * PutFile (request) - Changed offset and length to use Long instead of Integers
+ * DialNumber (new - request, response)
+ * OnSystemRequest (notification) (Changed offset and length to use Long instead of Integers)
+* Removed unused classes StringEnumer, Base64, and utl/Mime
+* Removed unused methods including these public/protected methods:
+ * `com/smartDeviceLink/streaming/AbstractPacketizer`
+ * printBuffer(byte[],int,int)
+ * `com/smartDeviceLink/trace/Mime`
+ * base64Decode(String)
+ * `com/smartDeviceLink/trace/SdlTrace`
+ * setTracingEnable(Boolean)
+* Moved TransportType enum to new package which will contain all new enums for the transport package, `com/smartDeviceLink/transport/enums`
+* Removed unused enums
+ * GearShiftAdviceStatus
+ * LightSwitchStatus
+ * MaintenanceModeStatus
+ * MessageType
+ * PermissionStatus
+ * TirePressureTellTale
+ * VehicleDataActiveStatus
+* Video/Audio streaming are now enabled. *[(See spec for more detail)](https://github.com/smartdevicelink/protocol_spec)*
+* Changed the USB metadata information to use SDL as the manufacturer and Core as the model
+
+
+### Enhancements
+* Modified generics to follow Java convention
+* Made FunctionID an enum rather than class with constants
+* Added more robust parameter checking
+* Changed some logging methods to return boolean for easier unit tests
+* Changed putFile building methods to accept Longs instead of ints. Old methods were deprecated.
+* Cleaned up SdlDataTypeConverter in terms of readability.
+* MTU size increased to 128kb up from 1.5k for v4. This will be the expected MTU for this version.
+* Added a SDL Proxy builder that will enable simpler building of proxy objects as the large amount of constructors could be confusing.
+* Changed the outgoing message queues to actually be FIFO queues.
+* Heartbeat is now fully implemented which is needed for audio and video streaming. *[(See spec for more details)](https://github.com/smartdevicelink/protocol_spec).*
+* Device info will now automatically populate in the Register App Interface RPC.
+
+
+### Bugfixes
+* Fixed issue with onProxyClosed not always called in multiple session scenario
+* Removed recursion from HandleReceivedBytes
+* Fixed wrong key issue in UpdateTurnList during turn list retrieval
+* Fixed class cast exception caused by calling toArray from enums:
+ * FrameData
+ * FrameDataControlFrameType
+ * FrameType
+ * SessionType
+* Redirected deprecated methods to new methods when available for following classes:
+ * GetVehicleData
+ * GetVehicleDataResponse
+ * OnVehicleData
+ * SubscribeVehicleData
+ * SubscribeVehicleDataResponse
+ * UnsubscribeVehicleData
+ * UnsubscribeVehicleDataResponse
+* Fixed incorrect naming conventions of variables (SdlTrace)
+* Fixed an issue RPC base classes that allowed for null values to be passed and cause issues with the underlying hashtable.
+* Fixed issue where different types of RPC’s (response, request, notification) could be used in their parent class (RPCMessage) state to create other children of that class.
+* Fixed SendLocation to use Doubles instead of Floats for degrees
+* Fixed naming of SessionTypes to reflect spec and Sava naming conventions
+* Fixed ByteEnumer to catch class cast exceptions
+* Removed outdated logging.
+* Implemented missing callbacks for turn by turn RPCs.
diff --git a/sdl_android_lib/AndroidManifest.xml b/sdl_android_lib/AndroidManifest.xml
index 8c2db539b..190e6d678 100644
--- a/sdl_android_lib/AndroidManifest.xml
+++ b/sdl_android_lib/AndroidManifest.xml
@@ -1,5 +1,5 @@
<manifest package="com.smartdevicelink" xmlns:android="http://schemas.android.com/apk/res/android">
- <uses-sdk android:minSdkVersion="12"/>
+ <uses-sdk android:minSdkVersion="8"/>
<!-- Required to use the USB Accessory mode -->
<uses-feature android:name="android.hardware.usb.accessory"/>
<application android:debuggable="true"/>
diff --git a/sdl_android_lib/project.properties b/sdl_android_lib/project.properties
index e61077f79..7002f279d 100644
--- a/sdl_android_lib/project.properties
+++ b/sdl_android_lib/project.properties
@@ -8,5 +8,5 @@
# project structure.
# Project target.
-target=android-17
+target=android-18
android.library=true
diff --git a/sdl_android_lib/src/com/smartdevicelink/Dispatcher/IncomingProtocolMessageComparitor.java b/sdl_android_lib/src/com/smartdevicelink/Dispatcher/IncomingProtocolMessageComparitor.java
deleted file mode 100644
index fd80a5e15..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/Dispatcher/IncomingProtocolMessageComparitor.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.smartdevicelink.Dispatcher;
-
-import java.util.Comparator;
-
-import com.smartdevicelink.protocol.ProtocolMessage;
-
-public class IncomingProtocolMessageComparitor implements Comparator<ProtocolMessage> {
-
- @Override
- public int compare(ProtocolMessage arg0, ProtocolMessage arg1) {
- // Always return 0, turning the priority queue into a FIFO queue.
- return 0;
- }
-}
diff --git a/sdl_android_lib/src/com/smartdevicelink/Dispatcher/InternalProxyMessageComparitor.java b/sdl_android_lib/src/com/smartdevicelink/Dispatcher/InternalProxyMessageComparitor.java
deleted file mode 100644
index 36e439408..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/Dispatcher/InternalProxyMessageComparitor.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.smartdevicelink.Dispatcher;
-
-import java.util.Comparator;
-
-import com.smartdevicelink.proxy.callbacks.InternalProxyMessage;
-
-public class InternalProxyMessageComparitor implements Comparator<InternalProxyMessage> {
-
- @Override
- public int compare(InternalProxyMessage arg0, InternalProxyMessage arg1) {
- // Always return 0, turning the priority queue into a FIFO queue.
- return 0;
- }
-}
diff --git a/sdl_android_lib/src/com/smartdevicelink/Dispatcher/OutgoingProtocolMessageComparitor.java b/sdl_android_lib/src/com/smartdevicelink/Dispatcher/OutgoingProtocolMessageComparitor.java
deleted file mode 100644
index 2e3d45134..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/Dispatcher/OutgoingProtocolMessageComparitor.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.smartdevicelink.Dispatcher;
-
-import java.util.Comparator;
-
-import com.smartdevicelink.protocol.ProtocolMessage;
-
-public class OutgoingProtocolMessageComparitor implements Comparator<ProtocolMessage> {
-
- @Override
- public int compare(ProtocolMessage arg0, ProtocolMessage arg1) {
- // Always return 0, turning the priority queue into a FIFO queue.
- return 0;
- }
-}
-
diff --git a/sdl_android_lib/src/com/smartdevicelink/Dispatcher/ProxyMessageDispatcher.java b/sdl_android_lib/src/com/smartdevicelink/Dispatcher/ProxyMessageDispatcher.java
index dc964fccd..8db6f51e7 100644
--- a/sdl_android_lib/src/com/smartdevicelink/Dispatcher/ProxyMessageDispatcher.java
+++ b/sdl_android_lib/src/com/smartdevicelink/Dispatcher/ProxyMessageDispatcher.java
@@ -1,21 +1,19 @@
package com.smartdevicelink.Dispatcher;
-import java.util.Comparator;
-import java.util.concurrent.PriorityBlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
import com.smartdevicelink.util.DebugTool;
public class ProxyMessageDispatcher<T> {
- PriorityBlockingQueue<T> _queue = null;
+ LinkedBlockingQueue<T> _queue = null;
private Thread _messageDispatchingThread = null;
IDispatchingStrategy<T> _strategy = null;
// Boolean to track if disposed
private Boolean dispatcherDisposed = false;
- public ProxyMessageDispatcher(String THREAD_NAME, Comparator<T> messageComparator,
- IDispatchingStrategy<T> strategy) {
- _queue = new PriorityBlockingQueue<T>(10, messageComparator);
+ public ProxyMessageDispatcher(String THREAD_NAME, IDispatchingStrategy<T> strategy) {
+ _queue = new LinkedBlockingQueue<T>();
_strategy = strategy;
diff --git a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
index 7ccf2d939..57fb15e50 100644
--- a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
+++ b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
@@ -3,6 +3,7 @@ package com.smartdevicelink.SdlConnection;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
+
public interface ISdlConnectionListener {
public void onTransportDisconnected(String info);
@@ -10,7 +11,7 @@ public interface ISdlConnectionListener {
public void onProtocolMessageReceived(ProtocolMessage msg);
- public void onProtocolSessionNACKed(SessionType sessionType,
+ public void onProtocolSessionStartedNACKed(SessionType sessionType,
byte sessionID, byte version, String correlationID);
public void onProtocolSessionStarted(SessionType sessionType,
@@ -19,7 +20,12 @@ public interface ISdlConnectionListener {
public void onProtocolSessionEnded(SessionType sessionType,
byte sessionID, String correlationID);
+ public void onProtocolSessionEndedNACKed(SessionType sessionType,
+ byte sessionID, String correlationID);
+
public void onProtocolError(String info, Exception e);
- public void onHeartbeatTimedOut(byte sessionID);
+ public void onHeartbeatTimedOut(byte sessionID);
+
+ public void onProtocolServiceDataACK(SessionType sessionType, byte sessionID);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java
index ab275b919..384499228 100644
--- a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java
+++ b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java
@@ -1,12 +1,19 @@
package com.smartdevicelink.SdlConnection;
+import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
-import java.util.Vector;
-import android.util.Log;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import android.annotation.SuppressLint;
+import android.os.Build;
+import android.util.Log;
+import android.view.Surface;
+
+import com.smartdevicelink.encoder.SdlEncoder;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.protocol.AbstractProtocol;
import com.smartdevicelink.protocol.IProtocolListener;
@@ -14,25 +21,30 @@ import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.WiProProtocol;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.streaming.AbstractPacketizer;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamPacketizer;
import com.smartdevicelink.streaming.StreamRPCPacketizer;
import com.smartdevicelink.transport.*;
+import com.smartdevicelink.transport.enums.TransportType;
public class SdlConnection implements IProtocolListener, ITransportListener, IStreamListener {
SdlTransport _transport = null;
AbstractProtocol _protocol = null;
ISdlConnectionListener _connectionListener = null;
- AbstractPacketizer mPacketizer = null;
+
+ StreamRPCPacketizer mRPCPacketizer = null;
+ StreamPacketizer mVideoPacketizer = null;
+ StreamPacketizer mAudioPacketizer = null;
+ SdlEncoder mSdlEncoder = null;
// Thread safety locks
Object TRANSPORT_REFERENCE_LOCK = new Object();
Object PROTOCOL_REFERENCE_LOCK = new Object();
- private Object SESSION_LOCK = new Object();
- private Vector<SdlSession> listenerList = new Vector<SdlSession>();
+ private CopyOnWriteArrayList<SdlSession> listenerList = new CopyOnWriteArrayList<SdlSession>();
+
+ private final static int BUFF_READ_SIZE = 1000000;
/**
* Constructor.
@@ -205,7 +217,7 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
@Override
public void onProtocolSessionNACKed(SessionType sessionType,
byte sessionID, byte version, String correlationID) {
- _connectionListener.onProtocolSessionNACKed(sessionType, sessionID, version, correlationID);
+ _connectionListener.onProtocolSessionStartedNACKed(sessionType, sessionID, version, correlationID);
}
@Override
@@ -229,34 +241,54 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
public TransportType getCurrentTransportType() {
return _transport.getTransportType();
}
- public void startStream(InputStream is, SessionType sType, byte rpcSessionID) {
- try {
- mPacketizer = new StreamPacketizer(this, is, sType, rpcSessionID);
- mPacketizer.start();
- } catch (Exception e) {
- Log.e("SdlConnection", "Unable to start streaming:" + e.toString());
- }
+ public void startStream(InputStream is, SessionType sType, byte rpcSessionID) throws IOException {
+ if (sType.equals(SessionType.NAV))
+ {
+ mVideoPacketizer = new StreamPacketizer(this, is, sType, rpcSessionID);
+ mVideoPacketizer.sdlConnection = this;
+ mVideoPacketizer.start();
+ }
+ else if (sType.equals(SessionType.PCM))
+ {
+ mAudioPacketizer = new StreamPacketizer(this, is, sType, rpcSessionID);
+ mAudioPacketizer.sdlConnection = this;
+ mAudioPacketizer.start();
+ }
}
- public OutputStream startStream(SessionType sType, byte rpcSessionID) {
- try {
+ @SuppressLint("NewApi") public OutputStream startStream(SessionType sType, byte rpcSessionID) throws IOException {
OutputStream os = new PipedOutputStream();
- InputStream is = new PipedInputStream((PipedOutputStream) os);
- mPacketizer = new StreamPacketizer(this, is, sType, rpcSessionID);
- mPacketizer.start();
+ InputStream is = null;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
+ is = new PipedInputStream((PipedOutputStream) os, BUFF_READ_SIZE);
+ } else {
+ is = new PipedInputStream((PipedOutputStream) os);
+ }
+ if (sType.equals(SessionType.NAV))
+ {
+ mVideoPacketizer = new StreamPacketizer(this, is, sType, rpcSessionID);
+ mVideoPacketizer.sdlConnection = this;
+ mVideoPacketizer.start();
+ }
+ else if (sType.equals(SessionType.PCM))
+ {
+ mAudioPacketizer = new StreamPacketizer(this, is, sType, rpcSessionID);
+ mAudioPacketizer.sdlConnection = this;
+ mAudioPacketizer.start();
+ }
+ else
+ {
+ os.close();
+ is.close();
+ return null;
+ }
return os;
- } catch (Exception e) {
- Log.e("SdlConnection", "Unable to start streaming:" + e.toString());
- }
- return null;
}
-
-
-
+
public void startRPCStream(InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion) {
- try {
- mPacketizer = new StreamRPCPacketizer(this, is, request, sType, rpcSessionID, wiproVersion);
- mPacketizer.start();
+ try {
+ mRPCPacketizer = new StreamRPCPacketizer(null, this, is, request, sType, rpcSessionID, wiproVersion, 0);
+ mRPCPacketizer.start();
} catch (Exception e) {
Log.e("SdlConnection", "Unable to start streaming:" + e.toString());
}
@@ -264,26 +296,137 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
public OutputStream startRPCStream(RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion) {
try {
- OutputStream os = new PipedOutputStream();
+ OutputStream os = new PipedOutputStream();
InputStream is = new PipedInputStream((PipedOutputStream) os);
- mPacketizer = new StreamRPCPacketizer(this, is, request, sType, rpcSessionID, wiproVersion);
- mPacketizer.start();
+ mRPCPacketizer = new StreamRPCPacketizer(null, this, is, request, sType, rpcSessionID, wiproVersion, 0);
+ mRPCPacketizer.start();
return os;
} catch (Exception e) {
Log.e("SdlConnection", "Unable to start streaming:" + e.toString());
}
return null;
}
+
+ public void pauseRPCStream()
+ {
+ if (mRPCPacketizer != null)
+ {
+ mRPCPacketizer.pause();
+ }
+ }
+
+ public void resumeRPCStream()
+ {
+ if (mRPCPacketizer != null)
+ {
+ mRPCPacketizer.resume();
+ }
+ }
+
+ public void stopRPCStream()
+ {
+ if (mRPCPacketizer != null)
+ {
+ mRPCPacketizer.stop();
+ }
+ }
+
+ public boolean stopAudioStream()
+ {
+ if (mAudioPacketizer != null)
+ {
+ mAudioPacketizer.stop();
+ return true;
+ }
+ return false;
+ }
- public void stopStream()
+ public boolean stopVideoStream()
+ {
+ if (mVideoPacketizer != null)
+ {
+ mVideoPacketizer.stop();
+ return true;
+ }
+ return false;
+ }
+
+ public boolean pauseAudioStream()
{
- if (mPacketizer != null)
+ if (mAudioPacketizer != null)
{
- mPacketizer.stop();
+ mAudioPacketizer.pause();
+ return true;
+ }
+ return false;
+ }
+
+ public boolean pauseVideoStream()
+ {
+ if (mVideoPacketizer != null)
+ {
+ mVideoPacketizer.pause();
+ return true;
+ }
+ return false;
+ }
+
+ public boolean resumeAudioStream()
+ {
+ if (mAudioPacketizer != null)
+ {
+ mAudioPacketizer.resume();
+ return true;
+ }
+ return false;
+ }
+
+ public boolean resumeVideoStream()
+ {
+ if (mVideoPacketizer != null)
+ {
+ mVideoPacketizer.resume();
+ return true;
+ }
+ return false;
+ }
+
+ public Surface createOpenGLInputSurface(int frameRate, int iFrameInterval, int width,
+ int height, int bitrate, SessionType sType, byte rpcSessionID) {
+ try {
+ PipedOutputStream stream = (PipedOutputStream) startStream(sType, rpcSessionID);
+ if (stream == null) return null;
+ mSdlEncoder = new SdlEncoder();
+ mSdlEncoder.setFrameRate(frameRate);
+ mSdlEncoder.setFrameInterval(iFrameInterval);
+ mSdlEncoder.setFrameWidth(width);
+ mSdlEncoder.setFrameHeight(height);
+ mSdlEncoder.setBitrate(bitrate);
+ mSdlEncoder.setOutputStream(stream);
+ } catch (IOException e) {
+ return null;
}
+ return mSdlEncoder.prepareEncoder();
}
+ public void startEncoder () {
+ if(mSdlEncoder != null) {
+ mSdlEncoder.startEncoder();
+ }
+ }
+
+ public void releaseEncoder() {
+ if(mSdlEncoder != null) {
+ mSdlEncoder.releaseEncoder();
+ }
+ }
+ public void drainEncoder(boolean endOfStream) {
+ if(mSdlEncoder != null) {
+ mSdlEncoder.drainEncoder(endOfStream);
+ }
+ }
+
@Override
public void sendStreamPacket(ProtocolMessage pm) {
sendMessage(pm);
@@ -305,11 +448,7 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
}
}
void registerSession(SdlSession registerListener) throws SdlException {
- synchronized (SESSION_LOCK) {
- if (!listenerList.contains(registerListener)) {
- listenerList.add(registerListener); //TODO: check if we need to sort the list.
- }
- }
+ listenerList.addIfAbsent(registerListener);
if (!this.getIsConnected()) {
this.startTransport();
@@ -324,12 +463,8 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
}
public void unregisterSession(SdlSession registerListener) {
- synchronized (SESSION_LOCK) {
- listenerList.remove(registerListener);
-
-
+ listenerList.remove(registerListener);
closeConnection(listenerList.size() == 0, registerListener.getSessionId());
- }
}
@@ -353,13 +488,9 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
@Override
public void onTransportError(String info, Exception e) {
- SdlSession mySession = null;
- for (int z=0; z<listenerList.size(); z++) {
-
- mySession = listenerList.get(0);
- if (mySession == null) continue;
- mySession.onTransportError(info, e);
- }
+ for (SdlSession session : listenerList) {
+ session.onTransportError(info, e);
+ }
}
@Override
@@ -374,9 +505,15 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
public void onProtocolSessionStarted(SessionType sessionType,
byte sessionID, byte version, String correlationID) {
for (SdlSession session : listenerList) {
- if (session.getSessionId() == 0 || sessionType == SessionType.NAV) {
+ if (session.getSessionId() == 0) {
+ session.onProtocolSessionStarted(sessionType, sessionID, version, correlationID);
+ break;
+ }
+ }
+ if (sessionType.equals(SessionType.NAV) || sessionType.equals(SessionType.PCM)){
+ SdlSession session = findSessionById(sessionID);
+ if (session != null) {
session.onProtocolSessionStarted(sessionType, sessionID, version, correlationID);
- break; //FIXME: need changes on SDL side, as the sessionID is devided by SDL.
}
}
}
@@ -398,47 +535,104 @@ public class SdlConnection implements IProtocolListener, ITransportListener, ISt
}
@Override
- public void onProtocolSessionNACKed(SessionType sessionType,
+ public void onProtocolSessionStartedNACKed(SessionType sessionType,
byte sessionID, byte version, String correlationID) {
- for (SdlSession session : listenerList) {
- session.onProtocolSessionNACKed(sessionType, sessionID, version, correlationID);
+ SdlSession session = findSessionById(sessionID);
+ if (session != null) {
+ session.onProtocolSessionStartedNACKed(sessionType, sessionID, version, correlationID);
}
}
@Override
public void onHeartbeatTimedOut(byte sessionID) {
- for (SdlSession session : listenerList) {
- session.onHeartbeatTimedOut(sessionID);
- }
+ SdlSession session = findSessionById(sessionID);
+ if (session != null) {
+ session.onHeartbeatTimedOut(sessionID);
+ }
+ }
+
+ @Override
+ public void onProtocolSessionEndedNACKed(SessionType sessionType, byte sessionID, String correlationID) {
+ SdlSession session = findSessionById(sessionID);
+ if (session != null) {
+ session.onProtocolSessionEndedNACKed(sessionType, sessionID, correlationID);
+ }
+ }
+
+ @Override
+ public void onProtocolServiceDataACK(SessionType sessionType,
+ byte sessionID) {
+ // TODO Auto-generated method stub
- }
- }
+ }
+
+ }
+
+ @Override
+ public void onProtocolServiceDataACK(SessionType sessionType,
+ byte sessionID) {
+ SdlSession session = findSessionById(sessionID);
+ if (session != null) {
+ session.onProtocolServiceDataACK(sessionType, sessionID);
+ }
+ }
public int getRegisterCount() {
return listenerList.size();
}
-
- @Override
+
+ @Override
+ public void onProtocolHeartbeat(SessionType sessionType, byte sessionID) {
+ SdlSession mySession = findSessionById(sessionID);
+ if (mySession == null) return;
+
+ if (mySession._outgoingHeartbeatMonitor != null) {
+ mySession._outgoingHeartbeatMonitor.heartbeatReceived();
+ }
+ if (mySession._incomingHeartbeatMonitor != null) {
+ mySession._incomingHeartbeatMonitor.heartbeatReceived();
+ }
+ }
+
+ @Override
public void onProtocolHeartbeatACK(SessionType sessionType, byte sessionID) {
-
SdlSession mySession = findSessionById(sessionID);
if (mySession == null) return;
- if (mySession._heartbeatMonitor != null) {
- mySession._heartbeatMonitor.heartbeatACKReceived();
+ if (mySession._outgoingHeartbeatMonitor != null) {
+ mySession._outgoingHeartbeatMonitor.heartbeatACKReceived();
+ }
+ if (mySession._incomingHeartbeatMonitor != null) {
+ mySession._incomingHeartbeatMonitor.heartbeatACKReceived();
}
}
- @Override
- public void onResetHeartbeat(SessionType sessionType, byte sessionID){
+ @Override
+ public void onResetOutgoingHeartbeat(SessionType sessionType, byte sessionID){
SdlSession mySession = findSessionById(sessionID);
if (mySession == null) return;
- if (mySession._heartbeatMonitor != null) {
- mySession._heartbeatMonitor.notifyTransportActivity();
+ if (mySession._outgoingHeartbeatMonitor != null) {
+ mySession._outgoingHeartbeatMonitor.notifyTransportActivity();
}
}
-
+ @Override
+ public void onResetIncomingHeartbeat(SessionType sessionType, byte sessionID){
+
+ SdlSession mySession = findSessionById(sessionID);
+ if (mySession == null) return;
+
+ if (mySession._incomingHeartbeatMonitor != null) {
+ mySession._incomingHeartbeatMonitor.notifyTransportActivity();
+ }
+ }
+
+ @Override
+ public void onProtocolSessionEndedNACKed(SessionType sessionType,
+ byte sessionID, String correlationID) {
+ _connectionListener.onProtocolSessionEndedNACKed(sessionType, sessionID, correlationID);
+
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlSession.java b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlSession.java
index c90ce2318..dbc87b792 100644
--- a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlSession.java
+++ b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlSession.java
@@ -11,7 +11,7 @@ import com.smartdevicelink.protocol.heartbeat.IHeartbeatMonitor;
import com.smartdevicelink.protocol.heartbeat.IHeartbeatMonitorListener;
import com.smartdevicelink.proxy.LockScreenManager;
import com.smartdevicelink.transport.BaseTransportConfig;
-import com.smartdevicelink.transport.TransportType;
+import com.smartdevicelink.transport.enums.TransportType;
public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorListener {
private static CopyOnWriteArrayList<SdlConnection> shareConnections = new CopyOnWriteArrayList<SdlConnection>();
@@ -22,7 +22,8 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
private byte wiproProcolVer;
private ISdlConnectionListener sessionListener;
private BaseTransportConfig transportConfig;
- IHeartbeatMonitor _heartbeatMonitor = null;
+ IHeartbeatMonitor _outgoingHeartbeatMonitor = null;
+ IHeartbeatMonitor _incomingHeartbeatMonitor = null;
private static final String TAG = "SdlSession";
private LockScreenManager lockScreenMan = new LockScreenManager();
@@ -50,13 +51,22 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
private SdlSession() {
}
- public IHeartbeatMonitor getHeartbeatMonitor() {
- return _heartbeatMonitor;
+ public IHeartbeatMonitor getOutgoingHeartbeatMonitor() {
+ return _outgoingHeartbeatMonitor;
}
+
+ public IHeartbeatMonitor getIncomingHeartbeatMonitor() {
+ return _incomingHeartbeatMonitor;
+ }
+
+ public void setOutgoingHeartbeatMonitor(IHeartbeatMonitor outgoingHeartbeatMonitor) {
+ this._outgoingHeartbeatMonitor = outgoingHeartbeatMonitor;
+ _outgoingHeartbeatMonitor.setListener(this);
+ }
- public void setHeartbeatMonitor(IHeartbeatMonitor heartbeatMonitor) {
- this._heartbeatMonitor = heartbeatMonitor;
- _heartbeatMonitor.setListener(this);
+ public void setIncomingHeartbeatMonitor(IHeartbeatMonitor incomingHeartbeatMonitor) {
+ this._incomingHeartbeatMonitor = incomingHeartbeatMonitor;
+ _incomingHeartbeatMonitor.setListener(this);
}
@@ -113,8 +123,11 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
}
private void initialiseSession() {
- if (_heartbeatMonitor != null) {
- _heartbeatMonitor.start();
+ if (_outgoingHeartbeatMonitor != null) {
+ _outgoingHeartbeatMonitor.start();
+ }
+ if (_incomingHeartbeatMonitor != null) {
+ _incomingHeartbeatMonitor.start();
}
}
@@ -209,12 +222,21 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
return connection;
}
- @Override
- public void onProtocolSessionNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID) {
- this.sessionListener.onProtocolSessionNACKed(sessionType, sessionID, version, correlationID);
+ @Override
+ public void onProtocolSessionStartedNACKed(SessionType sessionType,
+ byte sessionID, byte version, String correlationID) {
+ this.sessionListener.onProtocolSessionStartedNACKed(sessionType, sessionID, version, correlationID);
}
+ @Override
+ public void onProtocolSessionEndedNACKed(SessionType sessionType,
+ byte sessionID, String correlationID) {
+ this.sessionListener.onProtocolSessionEndedNACKed(sessionType, sessionID, correlationID);
+
+ }
-
+ @Override
+ public void onProtocolServiceDataACK(SessionType sessionType, byte sessionID) {
+ this.sessionListener.onProtocolServiceDataACK(sessionType, sessionID);
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/encoder/SdlEncoder.java b/sdl_android_lib/src/com/smartdevicelink/encoder/SdlEncoder.java
new file mode 100644
index 000000000..81e344840
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/encoder/SdlEncoder.java
@@ -0,0 +1,170 @@
+package com.smartdevicelink.encoder;
+
+import java.io.IOException;
+import java.io.PipedOutputStream;
+import java.nio.ByteBuffer;
+
+import android.annotation.TargetApi;
+import android.media.MediaCodec;
+import android.media.MediaCodecInfo;
+import android.media.MediaFormat;
+import android.os.Build;
+import android.view.Surface;
+
+@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
+public class SdlEncoder {
+
+ // parameters for the encoder
+ private static final String _MIME_TYPE = "video/avc"; // H.264/AVC video
+ // private static final String MIME_TYPE = "video/mp4v-es"; //MPEG4 video
+ private int frameRate = 30;
+ private int frameInterval = 5;
+ private int frameWidth = 800;
+ private int frameHeight = 480;
+ private int bitrate = 6000000;
+
+ // encoder state
+ private MediaCodec mEncoder;
+ private PipedOutputStream mOutputStream;
+
+ // allocate one of these up front so we don't need to do it every time
+ private MediaCodec.BufferInfo mBufferInfo;
+
+
+ public SdlEncoder () {
+ }
+ public void setFrameRate(int iVal){
+ frameRate = iVal;
+ }
+ public void setFrameInterval(int iVal){
+ frameInterval = iVal;
+ }
+ public void setFrameWidth(int iVal){
+ frameWidth = iVal;
+ }
+ public void setFrameHeight(int iVal){
+ frameHeight = iVal;
+ }
+ public void setBitrate(int iVal){
+ bitrate = iVal;
+ }
+ public void setOutputStream(PipedOutputStream mStream){
+ mOutputStream = mStream;
+ }
+ public Surface prepareEncoder () {
+
+ mBufferInfo = new MediaCodec.BufferInfo();
+
+ MediaFormat format = MediaFormat.createVideoFormat(_MIME_TYPE, frameWidth,
+ frameHeight);
+
+ // Set some properties. Failing to specify some of these can cause the
+ // MediaCodec
+ // configure() call to throw an unhelpful exception.
+ format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
+ MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
+ format.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
+ format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
+ format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, frameInterval);
+
+ // Create a MediaCodec encoder, and configure it with our format. Get a
+ // Surface
+ // we can use for input and wrap it with a class that handles the EGL
+ // work.
+ //
+ // If you want to have two EGL contexts -- one for display, one for
+ // recording --
+ // you will likely want to defer instantiation of CodecInputSurface
+ // until after the
+ // "display" EGL context is created, then modify the eglCreateContext
+ // call to
+ // take eglGetCurrentContext() as the share_context argument.
+ try {
+ mEncoder = MediaCodec.createEncoderByType(_MIME_TYPE);
+ } catch (Exception e) {e.printStackTrace();}
+
+ if(mEncoder != null) {
+ mEncoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
+ return mEncoder.createInputSurface();
+ } else {
+ return null;
+ }
+ }
+
+ public void startEncoder () {
+ if(mEncoder != null) {
+ mEncoder.start();
+ }
+ }
+
+ /**
+ * Releases encoder resources.
+ */
+ public void releaseEncoder() {
+ if (mEncoder != null) {
+ mEncoder.stop();
+ mEncoder.release();
+ mEncoder = null;
+ }
+ if (mOutputStream != null) {
+ try {
+ mOutputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ mOutputStream = null;
+ }
+ }
+
+ /**
+ * Extracts all pending data from the encoder
+ * <p>
+ * If endOfStream is not set, this returns when there is no more data to
+ * drain. If it is set, we send EOS to the encoder, and then iterate until
+ * we see EOS on the output. Calling this with endOfStream set should be
+ * done once, right before stopping the muxer.
+ */
+ public void drainEncoder(boolean endOfStream) {
+ final int TIMEOUT_USEC = 10000;
+
+ if(mEncoder == null || mOutputStream == null) {
+ return;
+ }
+ if (endOfStream) {
+ mEncoder.signalEndOfInputStream();
+ }
+
+ ByteBuffer[] encoderOutputBuffers = mEncoder.getOutputBuffers();
+ while (true) {
+ int encoderStatus = mEncoder.dequeueOutputBuffer(mBufferInfo,
+ TIMEOUT_USEC);
+ if (encoderStatus == MediaCodec.INFO_TRY_AGAIN_LATER) {
+ // no output available yet
+ if (!endOfStream) {
+ break; // out of while
+ }
+ } else if (encoderStatus == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
+ // not expected for an encoder
+ encoderOutputBuffers = mEncoder.getOutputBuffers();
+ } else if (encoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
+ } else if (encoderStatus < 0) {
+ } else {
+ if (mBufferInfo.size != 0) {
+ byte[] dataToWrite = new byte[mBufferInfo.size];
+ encoderOutputBuffers[encoderStatus].get(dataToWrite,
+ mBufferInfo.offset, mBufferInfo.size);
+
+ try {
+ mOutputStream.write(dataToWrite, 0, mBufferInfo.size);
+ } catch (Exception e) {}
+ }
+
+ mEncoder.releaseOutputBuffer(encoderStatus, false);
+
+ if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
+ break; // out of while
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/exception/SdlExceptionCause.java b/sdl_android_lib/src/com/smartdevicelink/exception/SdlExceptionCause.java
index 34333e4b6..4894ceca3 100644
--- a/sdl_android_lib/src/com/smartdevicelink/exception/SdlExceptionCause.java
+++ b/sdl_android_lib/src/com/smartdevicelink/exception/SdlExceptionCause.java
@@ -19,5 +19,7 @@ public enum SdlExceptionCause {
INVALID_HEADER,
DATA_BUFFER_NULL,
SDL_USB_DETACHED,
- SDL_USB_PERMISSION_DENIED;
+ SDL_USB_PERMISSION_DENIED,
+ LOCK_SCREEN_ICON_NOT_SUPPORTED,
+ ;
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/AbstractProtocol.java b/sdl_android_lib/src/com/smartdevicelink/protocol/AbstractProtocol.java
index 8a58b51c8..e9439b5b1 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/AbstractProtocol.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/AbstractProtocol.java
@@ -57,6 +57,8 @@ public abstract class AbstractProtocol {
public abstract void SetHeartbeatReceiveInterval(int heartbeatReceiveInterval_ms);
public abstract void SendHeartBeat(byte sessionID);
+
+ 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) {
@@ -65,10 +67,16 @@ public abstract class AbstractProtocol {
assembler.handleFrame(header, data);
}
+
+ private synchronized void resetOutgoingHeartbeat(SessionType sessionType, byte sessionID) {
+ if (_protocolListener != null) {
+ _protocolListener.onResetOutgoingHeartbeat(sessionType,sessionID);
+ }
+ }
- private synchronized void resetHeartbeat(SessionType sessionType, byte sessionID) {
+ private synchronized void resetIncomingHeartbeat(SessionType sessionType, byte sessionID) {
if (_protocolListener != null) {
- _protocolListener.onResetHeartbeat(sessionType,sessionID);
+ _protocolListener.onResetIncomingHeartbeat(sessionType,sessionID);
}
}
@@ -76,7 +84,7 @@ public abstract class AbstractProtocol {
protected void handleProtocolFrameToSend(ProtocolFrameHeader header, byte[] data, int offset, int length) {
SdlTrace.logProtocolEvent(InterfaceActivityDirection.Transmit, header, data,
offset, length, SDL_LIB_TRACE_KEY);
- resetHeartbeat(header.getSessionType(), header.getSessionID());
+ resetOutgoingHeartbeat(header.getSessionType(), header.getSessionID());
synchronized(_frameLock) {
byte[] frameHeader = header.assembleHeaderBytes();
handleProtocolMessageBytesToSend(frameHeader, 0, frameHeader.length);
@@ -96,14 +104,18 @@ public abstract class AbstractProtocol {
// This method handles received protocol messages.
protected void handleProtocolMessageReceived(ProtocolMessage message) {
-
- //uncomment when SDL Core supports
- //resetHeartbeat(message.getSessionType(), message.getSessionID());
_protocolListener.onProtocolMessageReceived(message);
}
// This method handles the end of a protocol session. A callback is
// sent to the protocol listener.
+ protected void handleProtocolSessionEndedNACK(SessionType sessionType,
+ byte sessionID, String correlationID) {
+ _protocolListener.onProtocolSessionEndedNACKed(sessionType, sessionID, correlationID);
+ }
+
+ // This method handles the end of a protocol session. A callback is
+ // sent to the protocol listener.
protected void handleProtocolSessionEnded(SessionType sessionType,
byte sessionID, String correlationID) {
_protocolListener.onProtocolSessionEnded(sessionType, sessionID, correlationID);
@@ -125,8 +137,18 @@ public abstract class AbstractProtocol {
// listener.
protected void handleProtocolError(String string, Exception ex) {
_protocolListener.onProtocolError(string, ex);
- }
- protected void handleProtocolHeartbeatACK(SessionType sessionType, byte sessionID) {
+ }
+ protected void handleProtocolHeartbeat(SessionType sessionType, byte sessionID) {
+ SendHeartBeatACK(sessionID);
+ _protocolListener.onProtocolHeartbeat(sessionType, sessionID);
+ }
+ protected void handleProtocolHeartbeatACK(SessionType sessionType, byte sessionID) {
_protocolListener.onProtocolHeartbeatACK(sessionType, sessionID);
}
+ protected void handleProtocolServiceDataACK(SessionType sessionType, byte sessionID) {
+ _protocolListener.onProtocolServiceDataACK(sessionType, sessionID);
+ }
+ protected void onResetIncomingHeartbeat(SessionType sessionType, byte sessionID) {
+ resetIncomingHeartbeat(sessionType, sessionID);
+ }
} // end-class
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/IProtocolListener.java b/sdl_android_lib/src/com/smartdevicelink/protocol/IProtocolListener.java
index c9613dcfa..56dd88160 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/IProtocolListener.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/IProtocolListener.java
@@ -17,14 +17,23 @@ public interface IProtocolListener {
void onProtocolSessionNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID);
// Called to indicate that a protocol session has ended (from either side)
- void onProtocolSessionEnded(SessionType sessionType, byte sessionID, String correlationID /*, String info, Exception ex*/);
- /**
+ void onProtocolSessionEnded(SessionType sessionType, byte sessionID, String correlationID /*, String info, Exception ex*/);
+
+ void onProtocolSessionEndedNACKed(SessionType sessionType, byte sessionID, String correlationID /*, String info, Exception ex*/);
+
+ void onProtocolHeartbeat(SessionType sessionType, byte sessionID);
+
+ /**
* Called when a protocol heartbeat ACK message has been received from SDL.
*/
void onProtocolHeartbeatACK(SessionType sessionType, byte sessionID);
+
+ void onProtocolServiceDataACK(SessionType sessionType, byte sessionID);
+
+ void onResetOutgoingHeartbeat(SessionType sessionType, byte sessionID);
- void onResetHeartbeat(SessionType sessionType, byte sessionID);
+ void onResetIncomingHeartbeat(SessionType sessionType, byte sessionID);
// Called to indicate that a protocol error was detected in received data.
void onProtocolError(String info, Exception e);
-} // end-interfCe \ No newline at end of file
+} // end-interfCe
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/ProtocolMessage.java b/sdl_android_lib/src/com/smartdevicelink/protocol/ProtocolMessage.java
index b33c89631..c63f560d5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/ProtocolMessage.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/ProtocolMessage.java
@@ -55,6 +55,10 @@ public class ProtocolMessage {
return _bulkData;
}
+ public void setBulkDataNoCopy(byte[] bulkData) {
+ this._bulkData = bulkData;
+ }
+
public void setBulkData(byte[] bulkData) {
if (this._bulkData != null)
this._bulkData = null;
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/WiProProtocol.java b/sdl_android_lib/src/com/smartdevicelink/protocol/WiProProtocol.java
index 2f591fdb2..3ac165fee 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/WiProProtocol.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/WiProProtocol.java
@@ -14,9 +14,10 @@ public class WiProProtocol extends AbstractProtocol {
byte _version = 1;
private final static String FailurePropagating_Msg = "Failure propagating ";
- private static final int MTU_SIZE = 1500;
+ private static final int V1_V2_MTU_SIZE = 1500;
+ private static final int V3_V4_MTU_SIZE = 131072;
private static int HEADER_SIZE = 8;
- private static int MAX_DATA_SIZE = MTU_SIZE - HEADER_SIZE;
+ private static int MAX_DATA_SIZE = V1_V2_MTU_SIZE - HEADER_SIZE;
boolean _haveHeader = false;
byte[] _headerBuf = new byte[HEADER_SIZE];
@@ -50,21 +51,34 @@ public class WiProProtocol extends AbstractProtocol {
return this._version;
}
- public void setVersion(byte version) {
- this._version = version;
- if (version > 1) {
- this._version = 2;
- HEADER_SIZE = 12;
- MAX_DATA_SIZE = MTU_SIZE - HEADER_SIZE;
- _headerBuf = new byte[HEADER_SIZE];
- }
- else if (version == 1){
- HEADER_SIZE = 8;
- MAX_DATA_SIZE = MTU_SIZE - HEADER_SIZE;
- _headerBuf = new byte[HEADER_SIZE];
- }
-
- }
+ 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);
@@ -90,10 +104,10 @@ public class WiProProtocol extends AbstractProtocol {
byte sessionID = protocolMsg.getSessionID();
byte[] data = null;
- if (_version > 1 && sessionType != SessionType.NAV) {
+ if (_version > 1 && sessionType != SessionType.NAV && sessionType != SessionType.PCM) {
if (protocolMsg.getBulkData() != null) {
data = new byte[12 + protocolMsg.getJsonSize() + protocolMsg.getBulkData().length];
- sessionType = SessionType.Bulk_Data;
+ sessionType = SessionType.BULK_DATA;
} else data = new byte[12 + protocolMsg.getJsonSize()];
BinaryFrameHeader binFrameHeader = new BinaryFrameHeader();
binFrameHeader = ProtocolFrameHeaderFactory.createBinaryFrameHeader(protocolMsg.getRPCType(), protocolMsg.getFunctionID(), protocolMsg.getCorrID(), protocolMsg.getJsonSize());
@@ -172,6 +186,15 @@ public class WiProProtocol extends AbstractProtocol {
}
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;
//Check for a version difference
@@ -200,7 +223,7 @@ public class WiProProtocol extends AbstractProtocol {
System.arraycopy(receivedBytes, receivedBytesReadPos,
_headerBuf, _headerBufWritePos, receivedBytesLength);
_headerBufWritePos += receivedBytesLength;
- return;
+ return null;
} else {
// If I got the size, allocate the buffer
System.arraycopy(receivedBytes, receivedBytesReadPos,
@@ -212,13 +235,10 @@ public class WiProProtocol extends AbstractProtocol {
int iDataSize = _currentHeader.getDataSize();
-
- if (iDataSize <= 4000)
- {
+ if (iDataSize <= MAX_DATA_SIZE) {
_dataBuf = new byte[iDataSize];
}
- else
- {
+ 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());
@@ -229,7 +249,7 @@ public class WiProProtocol extends AbstractProtocol {
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;
+ return null;
}
_dataBufWritePos = 0;
}
@@ -254,8 +274,10 @@ public class WiProProtocol extends AbstractProtocol {
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;
+ return null;
}
+
+ onResetIncomingHeartbeat(_currentHeader.getSessionType(), _currentHeader.getSessionID());
int bytesLeft = receivedBytesLength - receivedBytesReadPos;
int bytesNeeded = _dataBuf.length - _dataBufWritePos;
@@ -264,7 +286,7 @@ public class WiProProtocol extends AbstractProtocol {
System.arraycopy(receivedBytes, receivedBytesReadPos, _dataBuf,
_dataBufWritePos, bytesLeft);
_dataBufWritePos += bytesLeft;
- return;
+ return null;
} else {
// Fill the buffer and call the handler!
System.arraycopy(receivedBytes, receivedBytesReadPos, _dataBuf, _dataBufWritePos, bytesNeeded);
@@ -287,9 +309,10 @@ public class WiProProtocol extends AbstractProtocol {
byte[] moreBytes = new byte[moreBytesLeft];
System.arraycopy(receivedBytes, receivedBytesReadPos,
moreBytes, 0, moreBytesLeft);
- HandleReceivedBytes(moreBytes, moreBytesLeft);
+ return moreBytes;
}
}
+ return null;
}
protected MessageFrameAssembler getFrameAssemblerForFrame(ProtocolFrameHeader header) {
@@ -402,16 +425,22 @@ public class WiProProtocol extends AbstractProtocol {
} // end-if
} // end-method
+ private void handleProtocolHeartbeat(ProtocolFrameHeader header,
+ byte[] data) {
+ WiProProtocol.this.handleProtocolHeartbeat(header.getSessionType(),header.getSessionID());
+ } // end-method
+
private void handleProtocolHeartbeatACK(ProtocolFrameHeader header,
byte[] data) {
WiProProtocol.this.handleProtocolHeartbeatACK(header.getSessionType(),header.getSessionID());
} // end-method
private void handleControlFrame(ProtocolFrameHeader header, byte[] data) {
- if (header.getFrameData() == FrameDataControlFrameType.HeartbeatACK.getValue()) {
+ 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()) {
+ } else if (header.getFrameData() == FrameDataControlFrameType.StartSession.getValue()) {
sendStartProtocolSessionACK(header.getSessionType(), header.getSessionID());
} else if (header.getFrameData() == FrameDataControlFrameType.StartSessionACK.getValue()) {
// Use this sessionID to create a message lock
@@ -424,7 +453,7 @@ public class WiProProtocol extends AbstractProtocol {
if (_version > 1) hashID = header.getMessageID();
handleProtocolSessionStarted(header.getSessionType(), header.getSessionID(), _version, "");
} else if (header.getFrameData() == FrameDataControlFrameType.StartSessionNACK.getValue()) {
- if (header.getSessionType().eq(SessionType.NAV)) {
+ if (header.getSessionType().eq(SessionType.NAV) || header.getSessionType().eq(SessionType.PCM)) {
handleProtocolSessionNACKed(header.getSessionType(), header.getSessionID(), _version, "");
} else {
handleProtocolError("Got StartSessionNACK for protocol sessionID=" + header.getSessionID(), null);
@@ -437,14 +466,19 @@ public class WiProProtocol extends AbstractProtocol {
} 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()) {
+ handleProtocolServiceDataACK(header.getSessionType(), header.getSessionID());
}
+
} // end-method
private void handleSingleFrameMessageFrame(ProtocolFrameHeader header, byte[] data) {
ProtocolMessage message = new ProtocolMessage();
if (header.getSessionType() == SessionType.RPC) {
message.setMessageType(MessageType.RPC);
- } else if (header.getSessionType() == SessionType.Bulk_Data) {
+ } else if (header.getSessionType() == SessionType.BULK_DATA) {
message.setMessageType(MessageType.BULK);
} // end-if
message.setSessionType(header.getSessionType());
@@ -493,7 +527,13 @@ public class WiProProtocol extends AbstractProtocol {
@Override
public void SendHeartBeat(byte sessionID) {
- final ProtocolFrameHeader heartbeat = ProtocolFrameHeaderFactory.createHeartbeat(SessionType.Heartbeat, sessionID, _version);
+ final ProtocolFrameHeader heartbeat = ProtocolFrameHeaderFactory.createHeartbeat(SessionType.CONTROL, sessionID, _version);
+ sendFrameToTransport(heartbeat);
+ }
+
+ @Override
+ public void SendHeartBeatACK(byte sessionID) {
+ final ProtocolFrameHeader heartbeat = ProtocolFrameHeaderFactory.createHeartbeatACK(SessionType.CONTROL, sessionID, _version);
sendFrameToTransport(heartbeat);
}
} // end-class \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameData.java b/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameData.java
index 6dbdcc9b7..ee83215a5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameData.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameData.java
@@ -34,6 +34,6 @@ public class FrameData extends ByteEnumer {
}
public static FrameData[] values() {
- return (FrameData[]) theList.toArray();
+ return theList.toArray(new FrameData[theList.size()]);
}
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameDataControlFrameType.java b/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameDataControlFrameType.java
index 50db24803..88c92b716 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameDataControlFrameType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameDataControlFrameType.java
@@ -19,6 +19,7 @@ public class FrameDataControlFrameType extends ByteEnumer {
public final static FrameDataControlFrameType EndSession = new FrameDataControlFrameType((byte)0x04, "EndSession");
public final static FrameDataControlFrameType EndSessionACK = new FrameDataControlFrameType((byte)0x05, "EndSessionACK");
public final static FrameDataControlFrameType EndSessionNACK = new FrameDataControlFrameType((byte)0x06, "EndSessionNACK");
+ public final static FrameDataControlFrameType ServiceDataACK = new FrameDataControlFrameType((byte)0xFE, "ServiceDataACK");
public final static FrameDataControlFrameType HeartbeatACK = new FrameDataControlFrameType((byte)0xFF, "HeartbeatACK");
static {
@@ -29,14 +30,16 @@ public class FrameDataControlFrameType extends ByteEnumer {
theList.addElement(EndSession);
theList.addElement(EndSessionACK);
theList.addElement(EndSessionNACK);
+ theList.addElement(ServiceDataACK);
theList.addElement(HeartbeatACK);
}
public static FrameDataControlFrameType valueOf(String passedButton) {
return (FrameDataControlFrameType) get(theList, passedButton);
- } // end-method
+ }
public static FrameDataControlFrameType[] values() {
- return (FrameDataControlFrameType[]) theList.toArray();
- } // end-method
-} // end-class \ No newline at end of file
+ return theList.toArray(new FrameDataControlFrameType[theList.size()]);
+ }
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameType.java b/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameType.java
index fc037e930..8f8abedf2 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FrameType.java
@@ -29,6 +29,6 @@ public class FrameType extends ByteEnumer {
}
public static FrameType[] values() {
- return (FrameType[]) theList.toArray();
+ return theList.toArray(new FrameType[theList.size()]);
}
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FunctionID.java b/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FunctionID.java
index e3e017114..04517d329 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -1,186 +1,135 @@
package com.smartdevicelink.protocol.enums;
+import java.util.EnumSet;
import java.util.HashMap;
-import java.util.Map;
-
-public class FunctionID {
- private static Map<String, Integer> functionIDMap = null;
- public static final String SYNC_P_DATA = "SyncPData";
- public static final String SHOW_CONSTANT_TBT = "ShowConstantTBT";
- public static final String ALERT_MANEUVER = "AlertManeuver";
- public static final String UPDATE_TURN_LIST = "UpdateTurnList";
- public static final String ON_SYNC_P_DATA = "OnSyncPData";
- public static final String REGISTER_APP_INTERFACE = "RegisterAppInterface";
- public static final String UNREGISTER_APP_INTERFACE = "UnregisterAppInterface";
- public static final String ALERT = "Alert";
- public static final String SHOW = "Show";
- public static final String SPEAK = "Speak";
- public static final String ADD_COMMAND = "AddCommand";
- public static final String DELETE_COMMAND = "DeleteCommand";
- public static final String ADD_SUB_MENU = "AddSubMenu";
- public static final String DELETE_SUB_MENU = "DeleteSubMenu";
- public static final String CREATE_INTERACTION_CHOICE_SET = "CreateInteractionChoiceSet";
- public static final String DELETE_INTERACTION_CHOICE_SET = "DeleteInteractionChoiceSet";
- public static final String PERFORM_INTERACTION = "PerformInteraction";
- public static final String ENCODED_SYNC_P_DATA = "EncodedSyncPData";
- public static final String SUBSCRIBE_BUTTON = "SubscribeButton";
- public static final String UNSUBSCRIBE_BUTTON = "UnsubscribeButton";
- public static final String SUBSCRIBE_VEHICLE_DATA = "SubscribeVehicleData";
- public static final String UNSUBSCRIBE_VEHICLE_DATA = "UnsubscribeVehicleData";
- public static final String SET_MEDIA_CLOCK_TIMER = "SetMediaClockTimer";
- public static final String SET_GLOBAL_PROPERTIES = "SetGlobalProperties";
- public static final String GENERIC_RESPONSE = "GenericResponse";
- public static final String SCROLLABLE_MESSAGE = "ScrollableMessage";
- public static final String GET_DTCS = "GetDTCs";
- public static final String DIAGNOSTIC_MESSAGE = "DiagnosticMessage";
- public static final String SYSTEM_REQUEST = "SystemRequest";
- public static final String READ_DID = "ReadDID";
- public static final String ON_VEHICLE_DATA = "OnVehicleData";
- public static final String PUT_FILE = "PutFile";
- public static final String DELETE_FILE = "DeleteFile";
- public static final String LIST_FILES = "ListFiles";
- public static final String GET_VEHICLE_DATA = "GetVehicleData";
- public static final String RESET_GLOBAL_PROPERTIES = "ResetGlobalProperties";
- public static final String SET_APP_ICON = "SetAppIcon";
- public static final String CHANGE_REGISTRATION = "ChangeRegistration";
- public static final String SET_DISPLAY_LAYOUT = "SetDisplayLayout";
- public static final String ON_LANGUAGE_CHANGE = "OnLanguageChange";
- public static final String PERFORM_AUDIO_PASS_THRU = "PerformAudioPassThru";
- public static final String END_AUDIO_PASS_THRU = "EndAudioPassThru";
- public static final String ON_AUDIO_PASS_THRU = "OnAudioPassThru";
- public static final String ON_COMMAND = "OnCommand";
- public static final String ON_BUTTON_PRESS = "OnButtonPress";
- public static final String ON_BUTTON_EVENT = "OnButtonEvent";
- public static final String ON_HMI_STATUS = "OnHMIStatus";
- public static final String ON_TBT_CLIENT_STATE = "OnTBTClientState";
- public static final String ON_ENCODED_SYNC_P_DATA = "OnEncodedSyncPData";
- public static final String ON_DRIVER_DISTRACTION = "OnDriverDistraction";
- public static final String ON_APP_INTERFACE_UNREGISTERED = "OnAppInterfaceUnregistered";
- public static final String ON_KEYBOARD_INPUT = "OnKeyboardInput";
- public static final String ON_TOUCH_EVENT = "OnTouchEvent";
- public static final String ON_SYSTEM_REQUEST = "OnSystemRequest";
- public static final String ON_HASH_CHANGE = "OnHashChange";
- public static final String ON_PERMISSIONS_CHANGE = "OnPermissionsChange";
- public static final String SLIDER = "Slider";
- public static final String ON_LOCK_SCREEN_STATUS = "OnLockScreenStatus";
- public static final String ON_SDL_CHOICE_CHOSEN = "OnSdlChoiceChosen";
-
- public static final String SEND_LOCATION = "SendLocation";
-
- public FunctionID() {
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+public enum FunctionID{
+ // DEPRECATED FUNCTIONS
+ SYNC_P_DATA(65537, "SyncPData"),
+ ON_SYNC_P_DATA(98305, "OnSyncPData"),
+ ENCODED_SYNC_P_DATA(65536, "EncodedSyncPData"),
+ ON_ENCODED_SYNC_P_DATA(98304, "OnEncodedSyncPData"),
+
+ // REQUESTS & RESPONSES
+ REGISTER_APP_INTERFACE(1, "RegisterAppInterface"),
+ UNREGISTER_APP_INTERFACE(2, "UnregisterAppInterface"),
+ SET_GLOBAL_PROPERTIES(3, "SetGlobalProperties"),
+ RESET_GLOBAL_PROPERTIES(4, "ResetGlobalProperties"),
+ ADD_COMMAND(5, "AddCommand"),
+ DELETE_COMMAND(6, "DeleteCommand"),
+ ADD_SUB_MENU(7, "AddSubMenu"),
+ DELETE_SUB_MENU(8, "DeleteSubMenu"),
+ CREATE_INTERACTION_CHOICE_SET(9, "CreateInteractionChoiceSet"),
+ PERFORM_INTERACTION(10, "PerformInteraction"),
+ DELETE_INTERACTION_CHOICE_SET(11, "DeleteInteractionChoiceSet"),
+ ALERT(12, "Alert"),
+ SHOW(13, "Show"),
+ SPEAK(14, "Speak"),
+ SET_MEDIA_CLOCK_TIMER(15, "SetMediaClockTimer"),
+ PERFORM_AUDIO_PASS_THRU(16, "PerformAudioPassThru"),
+ END_AUDIO_PASS_THRU(17, "EndAudioPassThru"),
+ SUBSCRIBE_BUTTON(18, "SubscribeButton"),
+ UNSUBSCRIBE_BUTTON(19, "UnsubscribeButton"),
+ SUBSCRIBE_VEHICLE_DATA(20, "SubscribeVehicleData"),
+ UNSUBSCRIBE_VEHICLE_DATA(21, "UnsubscribeVehicleData"),
+ GET_VEHICLE_DATA(22, "GetVehicleData"),
+ READ_DID(23, "ReadDID"),
+ GET_DTCS(24, "GetDTCs"),
+ SCROLLABLE_MESSAGE(25, "ScrollableMessage"),
+ SLIDER(26, "Slider"),
+ SHOW_CONSTANT_TBT(27, "ShowConstantTBT"),
+ ALERT_MANEUVER(28, "AlertManeuver"),
+ UPDATE_TURN_LIST(29, "UpdateTurnList"),
+ CHANGE_REGISTRATION(30, "ChangeRegistration"),
+ GENERIC_RESPONSE(31, "GenericResponse"),
+ PUT_FILE(32, "PutFile"),
+ DELETE_FILE(33, "DeleteFile"),
+ LIST_FILES(34, "ListFiles"),
+ SET_APP_ICON(35, "SetAppIcon"),
+ SET_DISPLAY_LAYOUT(36, "SetDisplayLayout"),
+ DIAGNOSTIC_MESSAGE(37, "DiagnosticMessage"),
+ SYSTEM_REQUEST(38, "SystemRequest"),
+ SEND_LOCATION(39, "SendLocation"),
+ DIAL_NUMBER(40, "DialNumber"),
+
+ // NOTIFICATIONS
+ ON_HMI_STATUS(32768, "OnHMIStatus"),
+ ON_APP_INTERFACE_UNREGISTERED(32769, "OnAppInterfaceUnregistered"),
+ ON_BUTTON_EVENT(32770, "OnButtonEvent"),
+ ON_BUTTON_PRESS(32771, "OnButtonPress"),
+ ON_VEHICLE_DATA(32772, "OnVehicleData"),
+ ON_COMMAND(32773, "OnCommand"),
+ ON_TBT_CLIENT_STATE(32774, "OnTBTClientState"),
+ ON_DRIVER_DISTRACTION(32775, "OnDriverDistraction"),
+ ON_PERMISSIONS_CHANGE(32776, "OnPermissionsChange"),
+ ON_AUDIO_PASS_THRU(32777, "OnAudioPassThru"),
+ ON_LANGUAGE_CHANGE(32778, "OnLanguageChange"),
+ ON_KEYBOARD_INPUT(32779, "OnKeyboardInput"),
+ ON_TOUCH_EVENT(32780, "OnTouchEvent"),
+ ON_SYSTEM_REQUEST(32781, "OnSystemRequest"),
+ ON_HASH_CHANGE(32782, "OnHashChange"),
+
+ // MOCKED FUNCTIONS (NOT SENT FROM HEAD-UNIT)
+ ON_LOCK_SCREEN_STATUS(-1, "OnLockScreenStatus"),
+ ON_SDL_CHOICE_CHOSEN(-1, "OnSdlChoiceChosen"),
+ ON_STREAM_RPC(-1, "OnStreamRPC"),
+ STREAM_RPC(-1, "StreamRPC"),
+
+ ;
+
+ public static final int INVALID_ID = -1;
+
+ private static HashMap<String, Integer> functionMap;
+
+ private final int ID;
+ private final String JSON_NAME;
+
+ private FunctionID(int id, String jsonName){
+ this.ID = id;
+ this.JSON_NAME = jsonName;
}
- static public String getFunctionName(int i) {
- if (null == functionIDMap) {
- initFunctionIds();
+ public int getId(){
+ return this.ID;
+ }
+
+ @Override
+ public String toString(){
+ return this.JSON_NAME;
+ }
+
+ private static void initFunctionMap(){
+ functionMap = new HashMap<String, Integer>(values().length);
+
+ for(FunctionID value : EnumSet.allOf(FunctionID.class)){
+ functionMap.put(value.toString(), value.getId());
}
+ }
- for (Map.Entry<String, Integer> entry : functionIDMap.entrySet()) {
- if (i == entry.getValue()) {
- return entry.getKey();
+ public static String getFunctionName(int i){
+ if(functionMap == null){
+ initFunctionMap();
+ }
+
+ Iterator<Entry<String, Integer>> iterator = functionMap.entrySet().iterator();
+ while(iterator.hasNext()){
+ Entry<String, Integer> thisEntry = iterator.next();
+ if(Integer.valueOf(i).equals(thisEntry.getValue())){
+ return thisEntry.getKey();
}
}
return null;
}
- static public int getFunctionID(String functionName) {
- if (null == functionIDMap) {
- initFunctionIds();
+ public static int getFunctionId(String functionName){
+ if(functionMap == null){
+ initFunctionMap();
}
- final Integer functionID = functionIDMap.get(functionName);
- return (functionID != null) ? functionID : -1;
- }
-
- static public void initFunctionIds() {
-
- functionIDMap = new HashMap<String, Integer>(60) {/**
- *
- */
- private static final long serialVersionUID = 6301013743706264910L;
-
- {
- /*
- Base Request / Response RPCs
- Range = 0x 0000 0001 - 0x 0000 7FFF
- */
- put(FunctionID.REGISTER_APP_INTERFACE, 1);
- put(FunctionID.UNREGISTER_APP_INTERFACE, 2);
- put(FunctionID.SET_GLOBAL_PROPERTIES, 3);
- put(FunctionID.RESET_GLOBAL_PROPERTIES, 4);
- put(FunctionID.ADD_COMMAND, 5);
- put(FunctionID.DELETE_COMMAND, 6);
- put(FunctionID.ADD_SUB_MENU, 7);
- put(FunctionID.DELETE_SUB_MENU, 8);
- put(FunctionID.CREATE_INTERACTION_CHOICE_SET, 9);
- put(FunctionID.PERFORM_INTERACTION, 10);
- put(FunctionID.DELETE_INTERACTION_CHOICE_SET, 11);
- put(FunctionID.ALERT, 12);
- put(FunctionID.SHOW, 13);
- put(FunctionID.SPEAK, 14);
- put(FunctionID.SET_MEDIA_CLOCK_TIMER, 15);
- put(FunctionID.PERFORM_AUDIO_PASS_THRU, 16);
- put(FunctionID.END_AUDIO_PASS_THRU, 17);
- put(FunctionID.SUBSCRIBE_BUTTON, 18);
- put(FunctionID.UNSUBSCRIBE_BUTTON, 19);
- put(FunctionID.SUBSCRIBE_VEHICLE_DATA, 20);
- put(FunctionID.UNSUBSCRIBE_VEHICLE_DATA, 21);
- put(FunctionID.GET_VEHICLE_DATA, 22);
- put(FunctionID.READ_DID, 23);
- put(FunctionID.GET_DTCS, 24);
- put(FunctionID.SCROLLABLE_MESSAGE, 25);
- put(FunctionID.SLIDER, 26);
- put(FunctionID.SHOW_CONSTANT_TBT, 27);
- put(FunctionID.ALERT_MANEUVER, 28);
- put(FunctionID.UPDATE_TURN_LIST, 29);
- put(FunctionID.CHANGE_REGISTRATION, 30);
- put(FunctionID.GENERIC_RESPONSE, 31);
- put(FunctionID.PUT_FILE, 32);
- put(FunctionID.DELETE_FILE, 33);
- put(FunctionID.LIST_FILES, 34);
- put(FunctionID.SET_APP_ICON, 35);
- put(FunctionID.SET_DISPLAY_LAYOUT, 36);
- put(FunctionID.DIAGNOSTIC_MESSAGE, 37);
- put(FunctionID.SYSTEM_REQUEST, 38);
- put(FunctionID.SEND_LOCATION, 39);
-
- /*
- Base Notifications
- Range = 0x 0000 8000 - 0x 0000 FFFF
- */
- put(FunctionID.ON_HMI_STATUS, 32768);
- put(FunctionID.ON_APP_INTERFACE_UNREGISTERED, 32769);
- put(FunctionID.ON_BUTTON_EVENT, 32770);
- put(FunctionID.ON_BUTTON_PRESS, 32771);
- put(FunctionID.ON_VEHICLE_DATA, 32772);
- put(FunctionID.ON_COMMAND, 32773);
- put(FunctionID.ON_TBT_CLIENT_STATE, 32774);
- put(FunctionID.ON_DRIVER_DISTRACTION, 32775);
- put(FunctionID.ON_PERMISSIONS_CHANGE, 32776);
- put(FunctionID.ON_AUDIO_PASS_THRU, 32777);
- put(FunctionID.ON_LANGUAGE_CHANGE, 32778);
- put(FunctionID.ON_SYSTEM_REQUEST, 32781);
- put(FunctionID.ON_HASH_CHANGE, 32782);
-
- /*
- Ford Specific Request / Response RPCs
- Range = 0x 0001 0000 - 0x 0001 7FFF
- */
- put(FunctionID.ENCODED_SYNC_P_DATA, 65536);
- put(FunctionID.SYNC_P_DATA, 65537);
-
- /*
- Ford Specific Notifications
- Range = 0x 0001 8000 - 0x 0001 FFFF
- */
- put(FunctionID.ON_ENCODED_SYNC_P_DATA, 98304);
- put(FunctionID.ON_SYNC_P_DATA, 98305);
-
- // OnKeyboardInput
- put(FunctionID.ON_KEYBOARD_INPUT, 32779);
- // OnTouchEvent
- put(FunctionID.ON_TOUCH_EVENT, 32780);
- }};
+ Integer result = functionMap.get(functionName);
+ return ( result == null ) ? INVALID_ID : result;
}
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/enums/SessionType.java b/sdl_android_lib/src/com/smartdevicelink/protocol/enums/SessionType.java
index 433eb8527..f6cd888b4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/enums/SessionType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/enums/SessionType.java
@@ -13,18 +13,18 @@ public class SessionType extends ByteEnumer {
byte i = 0x00;
protected SessionType(byte value, String name) {super(value, name);}
- public final static SessionType Heartbeat = new SessionType((byte) 0, "Heartbeat_Service");
+ public final static SessionType CONTROL = new SessionType((byte) 0, "CONTROL");
public final static SessionType RPC = new SessionType((byte)0x07, "RPC");
public final static SessionType PCM = new SessionType((byte)0x0A, "PCM");
public final static SessionType NAV = new SessionType((byte)0x0B, "NAV");
- public final static SessionType Bulk_Data = new SessionType((byte)0xF, "Bulk_Data");
+ public final static SessionType BULK_DATA = new SessionType((byte)0xF, "BULK_DATA");
static {
theList.addElement(RPC);
theList.addElement(PCM);
theList.addElement(NAV);
- theList.addElement(Bulk_Data);
- theList.addElement(Heartbeat);
+ theList.addElement(BULK_DATA);
+ theList.addElement(CONTROL);
}
public static SessionType valueOf(byte passedButton) {
@@ -32,6 +32,6 @@ public class SessionType extends ByteEnumer {
}
public static SessionType[] values() {
- return (SessionType[]) theList.toArray();
+ return theList.toArray(new SessionType[theList.size()]);
}
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/heartbeat/HeartbeatMonitor.java b/sdl_android_lib/src/com/smartdevicelink/protocol/heartbeat/HeartbeatMonitor.java
index f5d4e9c84..e74fdf17e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/heartbeat/HeartbeatMonitor.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/heartbeat/HeartbeatMonitor.java
@@ -1,67 +1,99 @@
package com.smartdevicelink.protocol.heartbeat;
+
import android.os.Handler;
import android.os.Looper;
-import android.util.Log;
+
public class HeartbeatMonitor implements IHeartbeatMonitor {
- private static final String TAG = HeartbeatMonitor.class.getSimpleName();
- private final Object HeartbeatThreadHandler_Lock = new Object();
- private final Object Listener_Lock = new Object();
- //
- private int interval;
- private IHeartbeatMonitorListener listener;
- private boolean ackReceived;
- private Thread heartbeatThread;
- private Looper heartbeatThreadLooper;
- private Handler heartbeatThreadHandler;
-
+
+ public static final int HEARTBEAT_INTERVAL = 5000;
+ public static final int HEARTBEAT_INTERVAL_MAX = Integer.MAX_VALUE;
+
+ private final Object heartbeatThreadHandlerLock = new Object();
+ private final Object listenerLock = new Object();
+
+ private int mHeartBeatInterval = HEARTBEAT_INTERVAL;
+ private boolean mHeartBeatAck = true;
+
+ private IHeartbeatMonitorListener mListener;
+ private volatile boolean mIsAckReceived;
+ private volatile boolean isHeartbeatReceived;
+ private Thread mHeartbeatThread;
+ private Looper mHeartbeatThreadLooper;
+ private Handler mHeartbeatThreadHandler;
+
+ public HeartbeatMonitor() {
+ }
+
private Runnable heartbeatTimeoutRunnable = new Runnable() {
+
+ @Override
+ public void run() {
+ try{
+ synchronized (listenerLock) {
+ if (isHeartbeatReceived) {
+ if (mListener != null) {
+ mListener.sendHeartbeat(HeartbeatMonitor.this);
+ } else {
+
+ }
+ isHeartbeatReceived = false;
+ } else {
+ if (mListener != null) {
+ mListener.heartbeatTimedOut(HeartbeatMonitor.this);
+ }
+ }
+ }
+ }
+ catch(Exception ex)
+ {
+ stop();
+ }
+ }
+ };
+
+ private Runnable heartbeatAckTimeoutRunnable = new Runnable() {
+
@Override
public void run() {
- synchronized (Listener_Lock) {
- Log.d(TAG, "run()");
-
- if (ackReceived) {
- Log.d(TAG,
- "ACK has been received, sending and scheduling heartbeat");
- if (listener != null) {
- listener.sendHeartbeat(HeartbeatMonitor.this);
- } else {
- Log.w(TAG,
- "Delegate is not set, scheduling heartbeat anyway");
- }
- ackReceived = false;
- } else {
- Log.d(TAG, "ACK has not been received");
- if (listener != null) {
- stop();
- listener.heartbeatTimedOut(HeartbeatMonitor.this);
- }
- // TODO stop?
- }
- }
+ try
+ {
+ synchronized (listenerLock) {
+ if (mIsAckReceived) {
+ if (mListener != null) {
+ mListener.sendHeartbeat(HeartbeatMonitor.this);
+ } else {
+ }
+ mIsAckReceived = false;
+ } else {
+ if (mListener != null) {
+ mListener.heartbeatTimedOut(HeartbeatMonitor.this);
+ }
+ stop();
+ }
+ }
+
+ }
+ catch(Exception ex)
+ {
+ stop();
+ }
+
rescheduleHeartbeat();
}
private void rescheduleHeartbeat() {
- synchronized (HeartbeatThreadHandler_Lock) {
- if (heartbeatThreadHandler != null) {
+ synchronized (heartbeatThreadHandlerLock) {
+ if (mHeartbeatThreadHandler != null) {
if (!Thread.interrupted()) {
- Log.d(TAG, "Rescheduling run()");
- if (!heartbeatThreadHandler.postDelayed(this,
- interval)) {
- Log.e(TAG, "Couldn't reschedule run()");
+ if (!mHeartbeatThreadHandler.postDelayed(this, mHeartBeatInterval)) {
}
} else {
- Log.i(TAG,
- "The thread is interrupted; not scheduling heartbeat");
}
} else {
- Log.e(TAG,
- "HeartbeatThread handler is not set; not scheduling heartbeat");
- HeartbeatMonitor.this.stop();
+ stop();
}
}
}
@@ -69,109 +101,123 @@ public class HeartbeatMonitor implements IHeartbeatMonitor {
@Override
public void start() {
- synchronized (HeartbeatThreadHandler_Lock) {
- if (heartbeatThread == null) {
- heartbeatThread = new Thread(new Runnable() {
- @Override
- public void run() {
- if (!Thread.interrupted()) {
- Looper.prepare();
- heartbeatThreadLooper = Looper.myLooper();
-
- heartbeatThreadHandler = new Handler();
- Log.d(TAG, "scheduling run()");
- ackReceived = true;
- if (!heartbeatThreadHandler.postDelayed(
- heartbeatTimeoutRunnable, interval)) {
- Log.e(TAG, "Couldn't schedule run()");
- }
-
- Log.d(TAG, "Starting looper");
- Looper.loop();
- Log.d(TAG, "Looper stopped, exiting thread");
- } else {
- Log.i(TAG,
- "HeartbeatThread is run, but already interrupted");
+
+ synchronized (heartbeatThreadHandlerLock) {
+
+ if (mHeartbeatThread != null) {
+ return;
+ }
+
+ mHeartbeatThread = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+
+ while (!Thread.interrupted()) {
+ Looper.prepare();
+ mHeartbeatThreadLooper = Looper.myLooper();
+
+ mHeartbeatThreadHandler = new Handler();
+ mIsAckReceived = true;
+ isHeartbeatReceived = true;
+
+ if (!mHeartbeatThreadHandler.postDelayed(
+ heartbeatAckTimeoutRunnable, mHeartBeatInterval)) {
}
+ Looper.loop();
}
- }, "HeartbeatThread");
- heartbeatThread.start();
- } else {
- Log.d(TAG, "HeartbeatThread is already started; doing nothing");
- }
+ }
+
+ }, "HeartbeatThread");
+ mHeartbeatThread.setPriority(Thread.MAX_PRIORITY);
+ mHeartbeatThread.start();
}
}
@Override
public void stop() {
- synchronized (HeartbeatThreadHandler_Lock) {
-
- if (heartbeatThread != null) {
- heartbeatThread.interrupt();
- heartbeatThread = null;
-
- if (heartbeatThreadHandler != null) {
- heartbeatThreadHandler.removeCallbacks(
- heartbeatTimeoutRunnable);
- heartbeatThreadHandler = null;
- } else {
- Log.e(TAG, "HeartbeatThread's handler is null");
- }
- if (heartbeatThreadLooper != null) {
- heartbeatThreadLooper.quit();
- heartbeatThreadLooper = null;
- } else {
- Log.e(TAG, "HeartbeatThread's looper is null");
- }
+
+ synchronized (heartbeatThreadHandlerLock) {
+
+ if (mHeartbeatThread == null) {
+ mHeartbeatThreadHandler = null;
+ mHeartbeatThreadLooper = null;
+ return;
+ }
+
+ mHeartbeatThread.interrupt();
+ mHeartbeatThread = null;
+
+ if (mHeartbeatThreadHandler != null) {
+ mHeartbeatThreadHandler.removeCallbacks(heartbeatAckTimeoutRunnable);
+ mHeartbeatThreadHandler.removeCallbacks(heartbeatTimeoutRunnable);
+ mHeartbeatThreadHandler = null;
+ } else {
+ }
+
+ if (mHeartbeatThreadLooper != null) {
+ mHeartbeatThreadLooper.quit();
+ mHeartbeatThreadLooper = null;
} else {
- Log.d(TAG, "HeartbeatThread is not started");
- // just in case
- heartbeatThreadHandler = null;
- heartbeatThreadLooper = null;
}
}
}
@Override
public int getInterval() {
- return interval;
+ return mHeartBeatInterval;
}
@Override
- public void setInterval(int interval) {
- this.interval = interval;
+ public void setInterval(int value) {
+ mHeartBeatInterval = value;
}
@Override
public IHeartbeatMonitorListener getListener() {
- return listener;
+ return mListener;
}
@Override
- public void setListener(IHeartbeatMonitorListener listener) {
- this.listener = listener;
+ public void setListener(IHeartbeatMonitorListener value) {
+ mListener = value;
}
@Override
public void notifyTransportActivity() {
- synchronized (HeartbeatThreadHandler_Lock) {
- if (heartbeatThreadHandler != null) {
- heartbeatThreadHandler.removeCallbacks(
- heartbeatTimeoutRunnable);
- if (!heartbeatThreadHandler.postDelayed(
- heartbeatTimeoutRunnable, interval)) {
- Log.e(TAG, "Couldn't reschedule run()");
- }
+ if (mHeartbeatThreadHandler == null) {
+ return;
+ }
+ synchronized (heartbeatThreadHandlerLock) {
+ if (mHeartbeatThreadHandler == null) {
+ return;
+ }
+ mHeartbeatThreadHandler.removeCallbacks(heartbeatAckTimeoutRunnable);
+ if (!mHeartbeatThreadHandler.postDelayed(heartbeatAckTimeoutRunnable, mHeartBeatInterval)) {
}
}
}
+
+ @Override
+ public synchronized void heartbeatACKReceived() {
+ synchronized (listenerLock) {
+ mIsAckReceived = true;
+ }
+ }
+
@Override
- public void heartbeatACKReceived() {
- synchronized (Listener_Lock) {
- Log.d(TAG, "ACK received");
- ackReceived = true;
+ public void heartbeatReceived() {
+ if (mHeartbeatThreadHandler == null) {
+ return;
+ }
+ synchronized (listenerLock) {
+ if (mHeartBeatAck) {
+ isHeartbeatReceived = true;
+ if (!mHeartbeatThreadHandler.post(heartbeatTimeoutRunnable)) {
+ }
+ }
}
}
-}
+} \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitor.java b/sdl_android_lib/src/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitor.java
index a8203e7d5..ff4feb9cb 100644
--- a/sdl_android_lib/src/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitor.java
+++ b/sdl_android_lib/src/com/smartdevicelink/protocol/heartbeat/IHeartbeatMonitor.java
@@ -51,4 +51,9 @@ public interface IHeartbeatMonitor {
* Notifies the monitor about a received heartbeat ACK message.
*/
public void heartbeatACKReceived();
-}
+
+ /**
+ * Notifies the monitor about a received heartbeat message.
+ */
+ public void heartbeatReceived();
+} \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/LockScreenManager.java b/sdl_android_lib/src/com/smartdevicelink/proxy/LockScreenManager.java
index 13586afc3..1188d28b9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/LockScreenManager.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/LockScreenManager.java
@@ -1,11 +1,22 @@
package com.smartdevicelink.proxy;
+import java.io.IOException;
+
+import android.graphics.Bitmap;
+
import com.smartdevicelink.proxy.rpc.OnLockScreenStatus;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus;
+import com.smartdevicelink.util.HttpUtils;
public class LockScreenManager {
+ public interface OnLockScreenIconDownloadedListener{
+ public void onLockScreenIconDownloaded(Bitmap icon);
+ public void onLockScreenIconDownloadError(Exception e);
+ }
+
+ private Bitmap lockScreenIcon;
private Boolean bUserSelected = false;
private Boolean bDriverDistStatus = null;
private HMILevel hmiLevel = null;
@@ -90,4 +101,26 @@ public class LockScreenManager {
}
return LockScreenStatus.OFF;
}
+
+ public void downloadLockScreenIcon(final String url, final OnLockScreenIconDownloadedListener l){
+ new Thread(new Runnable(){
+ @Override
+ public void run(){
+ try{
+ lockScreenIcon = HttpUtils.downloadImage(url);
+ if(l != null){
+ l.onLockScreenIconDownloaded(lockScreenIcon);
+ }
+ }catch(IOException e){
+ if(l != null){
+ l.onLockScreenIconDownloadError(e);
+ }
+ }
+ }
+ }).start();
+ }
+
+ public Bitmap getLockScreenIcon(){
+ return this.lockScreenIcon;
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCMessage.java b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCMessage.java
index f0db617b3..8f68a1ebe 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCMessage.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCMessage.java
@@ -25,12 +25,16 @@ public class RPCMessage extends RPCStruct {
}
public RPCMessage(String functionName, String messageType) {
- function = new Hashtable<String, Object>();
- this.messageType = messageType;
- store.put(messageType, function);
+ function = new Hashtable<String, Object>();
parameters = new Hashtable<String, Object>();
+
+ this.messageType = messageType;
function.put(KEY_PARAMETERS, parameters);
- function.put(KEY_FUNCTION_NAME, functionName);
+
+ if (messageType != null)
+ store.put(messageType, function);
+ if (functionName != null)
+ function.put(KEY_FUNCTION_NAME, functionName);
}
@SuppressWarnings("unchecked")
@@ -57,7 +61,12 @@ public class RPCMessage extends RPCStruct {
}
public String getMessageType() {
- return messageType;
+ if (messageType.equals(KEY_REQUEST) ||
+ messageType.equals(KEY_RESPONSE) ||
+ messageType.equals(KEY_NOTIFICATION)) {
+ return messageType;
+ }
+ return null;
}
public void setParameters(String functionName, Object value) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCNotification.java b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCNotification.java
index 063cd7505..b9992e78b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCNotification.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCNotification.java
@@ -8,7 +8,7 @@ import java.util.Hashtable;
public class RPCNotification extends RPCMessage {
public RPCNotification(String functionName) {
- super(functionName, "notification");
+ super(functionName, RPCMessage.KEY_NOTIFICATION);
}
public RPCNotification(Hashtable<String, Object> hash) {
@@ -16,6 +16,14 @@ public class RPCNotification extends RPCMessage {
}
public RPCNotification(RPCMessage rpcMsg) {
- super(rpcMsg);
+ super(preprocessMsg(rpcMsg));
}
-} // end-class \ No newline at end of file
+
+ static RPCMessage preprocessMsg (RPCMessage rpcMsg) {
+ if (rpcMsg.getMessageType() != RPCMessage.KEY_NOTIFICATION) {
+ rpcMsg.messageType = RPCMessage.KEY_NOTIFICATION;
+ }
+
+ return rpcMsg;
+ }
+} \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java
index b2b8d0c7e..87dea9709 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCRequestFactory.java
@@ -2,6 +2,8 @@ package com.smartdevicelink.proxy;
import java.util.Vector;
+import android.os.Build;
+
import com.smartdevicelink.proxy.rpc.AddCommand;
import com.smartdevicelink.proxy.rpc.AddSubMenu;
import com.smartdevicelink.proxy.rpc.Alert;
@@ -12,6 +14,7 @@ import com.smartdevicelink.proxy.rpc.DeleteCommand;
import com.smartdevicelink.proxy.rpc.DeleteFile;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
import com.smartdevicelink.proxy.rpc.DeleteSubMenu;
+import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.EndAudioPassThru;
import com.smartdevicelink.proxy.rpc.GetVehicleData;
import com.smartdevicelink.proxy.rpc.Image;
@@ -57,7 +60,6 @@ public class RPCRequestFactory {
public static final int SDL_MSG_MAJOR_VERSION = 1;
public static final int SDL_MSG_MINOR_VERSION = 0;
-
public static SystemRequest buildSystemRequest(
String data, Integer correlationID) {
@@ -504,6 +506,7 @@ public class RPCRequestFactory {
return putFile;
}
+ @Deprecated
public static PutFile buildPutFile(String sdlFileName, Integer iOffset, Integer iLength) {
PutFile putFile = new PutFile();
putFile.setCorrelationID(10000);
@@ -513,8 +516,20 @@ public class RPCRequestFactory {
putFile.setOffset(iOffset);
putFile.setLength(iLength);
return putFile;
- }
+ }
+
+ public static PutFile buildPutFile(String sdlFileName, Long iOffset, Long iLength) {
+ PutFile putFile = new PutFile();
+ putFile.setCorrelationID(10000);
+ putFile.setSdlFileName(sdlFileName);
+ putFile.setFileType(FileType.BINARY);
+ putFile.setSystemFile(true);
+ putFile.setOffset(iOffset);
+ putFile.setLength(iLength);
+ return putFile;
+ }
+ @Deprecated
public static PutFile buildPutFile(String syncFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) {
PutFile putFile = new PutFile();
putFile.setCorrelationID(10000);
@@ -526,6 +541,43 @@ public class RPCRequestFactory {
putFile.setLength(iLength);
return putFile;
}
+
+ public static PutFile buildPutFile(String syncFileName, Long iOffset, Long iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) {
+ PutFile putFile = new PutFile();
+ putFile.setCorrelationID(10000);
+ putFile.setSdlFileName(syncFileName);
+ putFile.setFileType(fileType);
+ putFile.setPersistentFile(bPersistentFile);
+ putFile.setSystemFile(bSystemFile);
+ putFile.setOffset(iOffset);
+ putFile.setLength(iLength);
+ return putFile;
+ }
+
+ @Deprecated
+ public static PutFile buildPutFile(String sdlFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) {
+ PutFile putFile = new PutFile();
+ putFile.setCorrelationID(iCorrelationID);
+ putFile.setSdlFileName(sdlFileName);
+ putFile.setFileType(fileType);
+ putFile.setPersistentFile(bPersistentFile);
+ putFile.setSystemFile(bSystemFile);
+ putFile.setOffset(iOffset);
+ putFile.setLength(iLength);
+ return putFile;
+ }
+
+ public static PutFile buildPutFile(String sdlFileName, Long iOffset, Long iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) {
+ PutFile putFile = new PutFile();
+ putFile.setCorrelationID(iCorrelationID);
+ putFile.setSdlFileName(sdlFileName);
+ putFile.setFileType(fileType);
+ putFile.setPersistentFile(bPersistentFile);
+ putFile.setSystemFile(bSystemFile);
+ putFile.setOffset(iOffset);
+ putFile.setLength(iLength);
+ return putFile;
+ }
public static RegisterAppInterface buildRegisterAppInterface(String appName, String appID) {
return buildRegisterAppInterface(appName, false, appID);
@@ -535,14 +587,14 @@ public class RPCRequestFactory {
String appName, Boolean isMediaApp, String appID) {
return buildRegisterAppInterface(null, appName, null, null, null, isMediaApp,
- null, null, null, appID, null);
+ null, null, null, appID, null, null);
}
public static RegisterAppInterface buildRegisterAppInterface(
SdlMsgVersion sdlMsgVersion, String appName, Vector<TTSChunk> ttsName,
String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, Integer correlationID) {
+ String appID, Integer correlationID, DeviceInfo deviceInfo) {
RegisterAppInterface msg = new RegisterAppInterface();
if (correlationID == null) {
@@ -556,7 +608,7 @@ public class RPCRequestFactory {
sdlMsgVersion.setMinorVersion(Integer.valueOf(SDL_MSG_MINOR_VERSION));
}
msg.setSdlMsgVersion(sdlMsgVersion);
-
+ msg.setDeviceInfo(deviceInfo);
msg.setAppName(appName);
msg.setTtsName(ttsName);
@@ -936,5 +988,14 @@ public class RPCRequestFactory {
return msg;
}
-
+
+ public static DeviceInfo BuildDeviceInfo(String carrierName)
+ {
+ DeviceInfo msg = new DeviceInfo();
+ msg.setHardware(android.os.Build.MODEL);
+ msg.setOs(DeviceInfo.DEVICE_OS);
+ msg.setOsVersion(Build.VERSION.RELEASE);
+ msg.setCarrier(carrierName);
+ return msg;
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCResponse.java
index 1cde8cdb3..4527602a3 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCResponse.java
@@ -66,7 +66,15 @@ public class RPCResponse extends RPCMessage {
*@param rpcMsg The {@linkplain RPCMessage} to use
*/
public RPCResponse(RPCMessage rpcMsg) {
- super(rpcMsg);
+ super(preprocessMsg(rpcMsg));
+ }
+
+ static RPCMessage preprocessMsg (RPCMessage rpcMsg) {
+ if (rpcMsg.getMessageType() != RPCMessage.KEY_RESPONSE) {
+ rpcMsg.messageType = RPCMessage.KEY_RESPONSE;
+ }
+
+ return rpcMsg;
}
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/RPCStreamController.java b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCStreamController.java
new file mode 100644
index 000000000..0e2af0bc6
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/RPCStreamController.java
@@ -0,0 +1,32 @@
+package com.smartdevicelink.proxy;
+
+import com.smartdevicelink.streaming.StreamRPCPacketizer;
+
+public class RPCStreamController {
+ private StreamRPCPacketizer rpcPacketizer;
+ private Integer iCorrelationID;
+
+ public RPCStreamController(StreamRPCPacketizer rpcPacketizer, Integer iCorrelationID)
+ {
+ this.rpcPacketizer = rpcPacketizer;
+ this.iCorrelationID = iCorrelationID;
+ }
+
+ public Integer getCorrelationID()
+ {
+ return iCorrelationID;
+ }
+
+ public void pause()
+ {
+ rpcPacketizer.pause();
+ }
+ public void resume()
+ {
+ rpcPacketizer.resume();
+ }
+ public void stop()
+ {
+ rpcPacketizer.onPutFileStreamError(null, "Stop Putfile Stream Requested");
+ }
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java
index e8f45b7e3..7b97bcd21 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyALM.java
@@ -27,7 +27,7 @@ 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.TransportType;
+import com.smartdevicelink.transport.enums.TransportType;
public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
@@ -605,6 +605,41 @@ public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
"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 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(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 BTTransportConfig());
+
+ 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,
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java
index 31df008de..1afca92c0 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -1,14 +1,8 @@
package com.smartdevicelink.proxy;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
import java.io.BufferedReader;
import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -21,22 +15,27 @@ import java.net.URL;
import java.util.Hashtable;
import java.util.List;
import java.util.Vector;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.ScheduledExecutorService;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
-import android.os.Environment;
+import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Looper;
import android.telephony.TelephonyManager;
import android.util.Log;
+import android.view.Surface;
-import com.smartdevicelink.proxy.RPCRequestFactory;
-import com.smartdevicelink.proxy.rpc.PutFile;
import com.smartdevicelink.Dispatcher.IDispatchingStrategy;
-import com.smartdevicelink.Dispatcher.IncomingProtocolMessageComparitor;
-import com.smartdevicelink.Dispatcher.InternalProxyMessageComparitor;
-import com.smartdevicelink.Dispatcher.OutgoingProtocolMessageComparitor;
import com.smartdevicelink.Dispatcher.ProxyMessageDispatcher;
import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
import com.smartdevicelink.SdlConnection.SdlConnection;
@@ -49,11 +48,15 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.MessageType;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.protocol.heartbeat.HeartbeatMonitor;
+import com.smartdevicelink.proxy.LockScreenManager.OnLockScreenIconDownloadedListener;
import com.smartdevicelink.proxy.callbacks.InternalProxyMessage;
import com.smartdevicelink.proxy.callbacks.OnError;
import com.smartdevicelink.proxy.callbacks.OnProxyClosed;
+import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
+import com.smartdevicelink.proxy.callbacks.OnServiceNACKed;
import com.smartdevicelink.proxy.interfaces.IProxyListenerALM;
import com.smartdevicelink.proxy.interfaces.IProxyListenerBase;
+import com.smartdevicelink.proxy.interfaces.IPutFileResponseListener;
import com.smartdevicelink.proxy.rpc.*;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.AudioStreamingState;
@@ -80,12 +83,13 @@ import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
+import com.smartdevicelink.streaming.StreamRPCPacketizer;
import com.smartdevicelink.trace.SdlTrace;
import com.smartdevicelink.trace.TraceDeviceInfo;
import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.SiphonServer;
-import com.smartdevicelink.transport.TransportType;
+import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.DebugTool;
public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> {
@@ -114,13 +118,15 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private Object APP_INTERFACE_REGISTERED_LOCK = new Object();
private int iFileCount = 0;
-
- private boolean navServiceResponseReceived = false;
- private boolean navServiceResponse = false;
- @SuppressWarnings("unused")
- private boolean pcmServiceResponseReceived = false;
- @SuppressWarnings("unused")
- private boolean pcmServiceResponse = false;
+
+ private boolean navServiceStartResponseReceived = false;
+ private boolean navServiceStartResponse = false;
+ private boolean pcmServiceStartResponseReceived = false;
+ private boolean pcmServiceStartResponse = false;
+ private boolean navServiceEndResponseReceived = false;
+ private boolean navServiceEndResponse = false;
+ private boolean pcmServiceEndResponseReceived = false;
+ private boolean pcmServiceEndResponse = false;
// Device Info for logging
private TraceDeviceInfo _traceDeviceInterrogator = null;
@@ -154,7 +160,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private SdlMsgVersion _sdlMsgVersionRequest = null;
private Vector<String> _vrSynonyms = null;
private boolean _bAppResumeEnabled = false;
-
+ private OnSystemRequest lockScreenIconRequest = null;
+ private TelephonyManager telephonyManager = null;
+ private DeviceInfo deviceInfo = null;
+
/**
* Contains current configuration for the transport that was selected during
* construction of this object
@@ -192,14 +201,40 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
protected List<AudioPassThruCapabilities> _audioPassThruCapabilities = null;
protected List<Integer> _diagModes = null;
protected Boolean firstTimeFull = true;
- protected String _proxyVersionInfo = null;
- protected Boolean _bResumeSuccess = false;
+ protected String _proxyVersionInfo = null;
+ protected Boolean _bResumeSuccess = false;
+ private CopyOnWriteArrayList<IPutFileResponseListener> _putFileListenerList = new CopyOnWriteArrayList<IPutFileResponseListener>();
+
protected byte _wiproVersion = 1;
// Interface broker
private SdlInterfaceBroker _interfaceBroker = null;
+ private void notifyPutFileStreamError(Exception e, String info)
+ {
+ for (IPutFileResponseListener _putFileListener : _putFileListenerList) {
+ _putFileListener.onPutFileStreamError(e, info);
+ }
+ }
+
+ private void notifyPutFileStreamResponse(PutFileResponse msg)
+ {
+ for (IPutFileResponseListener _putFileListener : _putFileListenerList) {
+ _putFileListener.onPutFileResponse(msg);
+ }
+ }
+
+ public void addPutFileResponseListener(IPutFileResponseListener _putFileListener)
+ {
+ _putFileListenerList.addIfAbsent(_putFileListener);
+ }
+
+ public void remPutFileResponseListener(IPutFileResponseListener _putFileListener)
+ {
+ _putFileListenerList.remove(_putFileListener);
+ }
+
// Private Class to Interface with SdlConnection
private class SdlInterfaceBroker implements ISdlConnectionListener {
@@ -207,6 +242,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public void onTransportDisconnected(String info) {
// proxyOnTransportDisconnect is called to alert the proxy that a requested
// disconnect has completed
+ notifyPutFileStreamError(null, info);
if (_advancedLifecycleManagementEnabled) {
// If ALM, nothing is required to be done here
@@ -220,6 +256,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public void onTransportError(String info, Exception e) {
DebugTool.logError("Transport failure: " + info, e);
+ notifyPutFileStreamError(e, info);
+
if (_advancedLifecycleManagementEnabled) {
// Cycle the proxy
cycleProxy(SdlDisconnectedReason.TRANSPORT_ERROR);
@@ -246,23 +284,31 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
Intent sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionStarted");
updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
- updateBroadcastIntent(sendIntent, "COMMENT2", " SessionType: " + sessionType.getName());
- sendBroadcastIntent(sendIntent);
+ updateBroadcastIntent(sendIntent, "COMMENT2", " ServiceType: " + sessionType.getName());
+ sendBroadcastIntent(sendIntent);
- setWiProVersion(version);
-
- if ( (_transportConfig.getHeartBeatTimeout() != Integer.MAX_VALUE) && (version > 2) )
- {
- HeartbeatMonitor heartbeatMonitor = new HeartbeatMonitor();
- heartbeatMonitor.setInterval(_transportConfig.getHeartBeatTimeout());
- sdlSession.setHeartbeatMonitor(heartbeatMonitor);
- }
+ setWiProVersion(version);
- if (sessionType.eq(SessionType.RPC)) {
+ if (sessionType.eq(SessionType.RPC)) {
+
+ if ( (_transportConfig.getHeartBeatTimeout() != Integer.MAX_VALUE) && (version > 2))
+ {
+ HeartbeatMonitor outgoingHeartbeatMonitor = new HeartbeatMonitor();
+ outgoingHeartbeatMonitor.setInterval(_transportConfig.getHeartBeatTimeout());
+ sdlSession.setOutgoingHeartbeatMonitor(outgoingHeartbeatMonitor);
+
+ HeartbeatMonitor incomingHeartbeatMonitor = new HeartbeatMonitor();
+ incomingHeartbeatMonitor.setInterval(_transportConfig.getHeartBeatTimeout());
+ sdlSession.setIncomingHeartbeatMonitor(incomingHeartbeatMonitor);
+ }
+
startRPCProtocolSession(sessionID, correlationID);
} else if (sessionType.eq(SessionType.NAV)) {
NavServiceStarted();
- } else if (_wiproVersion > 1) {
+ } else if (sessionType.eq(SessionType.PCM)) {
+ AudioServiceStarted();
+ }
+ else if (_wiproVersion > 1) {
//If version is 2 or above then don't need to specify a Session Type
startRPCProtocolSession(sessionID, correlationID);
} else {
@@ -271,22 +317,62 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
@Override
- public void onProtocolSessionNACKed(SessionType sessionType,
+ public void onProtocolSessionStartedNACKed(SessionType sessionType,
byte sessionID, byte version, String correlationID) {
+ OnServiceNACKed message = new OnServiceNACKed(sessionType);
+ queueInternalMessage(message);
+
if (sessionType.eq(SessionType.NAV)) {
- NavServiceEnded();
+
+ Intent sendIntent = createBroadcastIntent();
+ updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionStartedNACKed");
+ updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
+ updateBroadcastIntent(sendIntent, "COMMENT2", " NACK ServiceType: " + sessionType.getName());
+ sendBroadcastIntent(sendIntent);
+
+ NavServiceStartedNACK();
+ }
+ else if (sessionType.eq(SessionType.PCM)) {
+ Intent sendIntent = createBroadcastIntent();
+ updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionStartedNACKed");
+ updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
+ updateBroadcastIntent(sendIntent, "COMMENT2", " NACK ServiceType: " + sessionType.getName());
+ sendBroadcastIntent(sendIntent);
+
+ AudioServiceStartedNACK();
}
}
@Override
public void onProtocolSessionEnded(SessionType sessionType,
byte sessionID, String correlationID) {
- // How to handle protocol session ended?
- // How should protocol session management occur?
+ OnServiceEnded message = new OnServiceEnded(sessionType);
+ queueInternalMessage(message);
+
+ if (sessionType.eq(SessionType.NAV)) {
+
+ Intent sendIntent = createBroadcastIntent();
+ updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionEnded");
+ updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
+ updateBroadcastIntent(sendIntent, "COMMENT2", " End ServiceType: " + sessionType.getName());
+ sendBroadcastIntent(sendIntent);
+
+ NavServiceEnded();
+ }
+ else if (sessionType.eq(SessionType.PCM)) {
+ Intent sendIntent = createBroadcastIntent();
+ updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionEnded");
+ updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
+ updateBroadcastIntent(sendIntent, "COMMENT2", " End ServiceType: " + sessionType.getName());
+ sendBroadcastIntent(sendIntent);
+
+ AudioServiceEnded();
+ }
}
@Override
public void onProtocolError(String info, Exception e) {
+ notifyPutFileStreamError(e, info);
passErrorToProxyListener(info, e);
}
@@ -303,8 +389,47 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
notifyProxyClosed(msg, new SdlException(msg, SdlExceptionCause.HEARTBEAT_PAST_DUE), SdlDisconnectedReason.HB_TIMEOUT);
}
- }
+ @Override
+ public void onProtocolSessionEndedNACKed(SessionType sessionType,
+ byte sessionID, String correlationID) {
+ if (sessionType.eq(SessionType.NAV)) {
+
+ Intent sendIntent = createBroadcastIntent();
+ updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionEndedNACKed");
+ updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
+ updateBroadcastIntent(sendIntent, "COMMENT2", " End NACK ServiceType: " + sessionType.getName());
+ sendBroadcastIntent(sendIntent);
+
+ NavServiceEndedNACK();
+ }
+ else if (sessionType.eq(SessionType.PCM)) {
+ Intent sendIntent = createBroadcastIntent();
+ updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionEndedNACKed");
+ updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
+ updateBroadcastIntent(sendIntent, "COMMENT2", " End NACK ServiceType: " + sessionType.getName());
+ sendBroadcastIntent(sendIntent);
+
+ AudioServiceEndedNACK();
+ }
+
+ }
+ public void onProtocolServiceDataACK(SessionType sessionType,
+ byte sessionID) {
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onServiceDataACK();
+ }
+ });
+ } else {
+ _proxyListener.onServiceDataACK();
+ }
+ }
+ }
+
/**
* Constructor.
*
@@ -399,7 +524,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener = listener;
// Get information from sdlProxyConfigurationResources
- TelephonyManager telephonyManager = null;
if (sdlProxyConfigurationResources != null) {
telephonyManager = sdlProxyConfigurationResources.getTelephonyManager();
}
@@ -412,6 +536,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (_traceDeviceInterrogator == null) {
_traceDeviceInterrogator = new TraceDeviceInfo(sdlProxyConfigurationResources.getTelephonyManager());
} // end-if
+
} // end-if
// Setup Internal ProxyMessage Dispatcher
@@ -422,9 +547,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_internalProxyMessageDispatcher = null;
}
- _internalProxyMessageDispatcher = new ProxyMessageDispatcher<InternalProxyMessage>("INTERNAL_MESSAGE_DISPATCHER",
- new InternalProxyMessageComparitor(),
- new IDispatchingStrategy<InternalProxyMessage>() {
+ _internalProxyMessageDispatcher = new ProxyMessageDispatcher<InternalProxyMessage>("INTERNAL_MESSAGE_DISPATCHER", new IDispatchingStrategy<InternalProxyMessage>() {
@Override
public void dispatch(InternalProxyMessage message) {
@@ -451,9 +574,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_incomingProxyMessageDispatcher = null;
}
- _incomingProxyMessageDispatcher = new ProxyMessageDispatcher<ProtocolMessage>("INCOMING_MESSAGE_DISPATCHER",
- new IncomingProtocolMessageComparitor(),
- new IDispatchingStrategy<ProtocolMessage>() {
+ _incomingProxyMessageDispatcher = new ProxyMessageDispatcher<ProtocolMessage>("INCOMING_MESSAGE_DISPATCHER",new IDispatchingStrategy<ProtocolMessage>() {
@Override
public void dispatch(ProtocolMessage message) {
dispatchIncomingMessage((ProtocolMessage)message);
@@ -479,9 +600,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_outgoingProxyMessageDispatcher = null;
}
- _outgoingProxyMessageDispatcher = new ProxyMessageDispatcher<ProtocolMessage>("OUTGOING_MESSAGE_DISPATCHER",
- new OutgoingProtocolMessageComparitor(),
- new IDispatchingStrategy<ProtocolMessage>() {
+ _outgoingProxyMessageDispatcher = new ProxyMessageDispatcher<ProtocolMessage>("OUTGOING_MESSAGE_DISPATCHER",new IDispatchingStrategy<ProtocolMessage>() {
@Override
public void dispatch(ProtocolMessage message) {
dispatchOutgoingMessage((ProtocolMessage)message);
@@ -635,47 +754,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
//If the service or context has become unavailable unexpectedly, catch the exception and move on -- no broadcast log will occur.
}
}
-
- private void writeToFile(Object writeME, String fileName) {
- Intent sendIntent = createBroadcastIntent();
- try {
- updateBroadcastIntent(sendIntent,"FUNCTION_NAME", "writeToFile");
- updateBroadcastIntent(sendIntent, "SHOW_ON_UI", false);
-
- String sFileName = fileName + "_" + iFileCount + ".txt";
- String outFile = Environment.getExternalStorageDirectory().getPath() + "/" + sFileName;
- File out = new File(outFile);
- FileWriter writer = new FileWriter(out);
- writer.flush();
- writer.write(writeME.toString());
- writer.close();
- updateBroadcastIntent(sendIntent, "COMMENT1", outFile);
- } catch (FileNotFoundException e) {
- updateBroadcastIntent(sendIntent, "COMMENT2", "writeToFile FileNotFoundException " + e);
- Log.i("sdlp", "FileNotFoundException: " + e);
- e.printStackTrace();
- } catch (IOException e) {
- updateBroadcastIntent(sendIntent, "COMMENT2", "writeToFile IOException " + e);
- Log.i("sdlp", "IOException: " + e);
- e.printStackTrace();
- }
- finally
- {
- sendBroadcastIntent(sendIntent);
- }
- }
-
- private void LogHeader(String sType, final String myObject, String sFuncName)
- {
- Intent sendIntent = createBroadcastIntent();
-
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", sFuncName);
-
- updateBroadcastIntent(sendIntent, "COMMENT1", sType + "\r\n");
- updateBroadcastIntent(sendIntent, "DATA", myObject);
- sendBroadcastIntent(sendIntent);
- }
-
private HttpURLConnection getURLConnection(Headers myHeader, String sURLString, int Timeout, int iContentLen)
{
@@ -764,8 +842,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (iTimeout == null)
iTimeout = 2000;
- Headers myHeader = msg.getHeader();
- String sFunctionName = "SYSTEM_REQUEST";
+ Headers myHeader = msg.getHeader();
updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "sendOnSystemRequestToUrl");
updateBroadcastIntent(sendIntent, "COMMENT5", "\r\nCloud URL: " + sURLString);
@@ -787,7 +864,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
jsonObjectToSendToServer = new JSONObject();
jsonObjectToSendToServer.put("data", jsonArrayOfSdlPPackets);
bLegacy = true;
- sFunctionName = "SYSTEM_REQUEST_LEGACY";
updateBroadcastIntent(sendIntent, "COMMENT6", "\r\nLegacy SystemRequest: true");
valid_json = jsonObjectToSendToServer.toString().replace("\\", "");
}
@@ -799,9 +875,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sendBroadcastIntent(sendIntent3);
valid_json = sBodyString.replace("\\", "");
}
-
- writeToFile(valid_json, "requestToCloud");
- LogHeader("Cloud Request", valid_json, sFunctionName);
urlConnection = getURLConnection(myHeader, sURLString, iTimeout, valid_json.getBytes("UTF-8").length);
@@ -846,11 +919,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
response.append('\r');
}
rd.close();
- Log.i(TAG, "response: " + response.toString());
-
- writeToFile(response.toString(), "responseFromCloud");
-
- LogHeader("Cloud Response", response.toString(), sFunctionName);
Vector<String> cloudDataReceived = new Vector<String>();
@@ -902,7 +970,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sendRPCRequestPrivate(mySystemRequest);
Log.i("sendOnSystemRequestToUrl", "sent to sdl");
- updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.SYSTEM_REQUEST);
+ updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
updateBroadcastIntent(sendIntent2, "CORRID", mySystemRequest.getCorrelationID());
}
@@ -1012,6 +1080,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
else
_appInterfaceRegisterd = false;
+ _putFileListenerList.clear();
+
_sdlIntefaceAvailablity = SdlInterfaceAvailability.SDL_INTERFACE_UNAVAILABLE;
// Setup SdlConnection
@@ -1259,7 +1329,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (functionName != null) {
hashTemp.put(RPCMessage.KEY_FUNCTION_NAME, functionName);
} else {
- DebugTool.logWarning("Dispatch Incoming Message - function name is null unknown RPC. FunctionID: " + message.getFunctionID());
+ DebugTool.logWarning("Dispatch Incoming Message - function name is null unknown RPC. FunctionId: " + message.getFunctionID());
return;
}
if (message.getRPCType() == 0x00) {
@@ -1345,6 +1415,33 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onError(msg.getInfo(), msg.getException());
}
+ } else if (message.getFunctionName().equals(InternalProxyMessage.OnServiceEnded)) {
+ final OnServiceEnded msg = (OnServiceEnded)message;
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onServiceEnded(msg);
+ }
+ });
+ } else {
+ _proxyListener.onServiceEnded(msg);
+ }
+ } else if (message.getFunctionName().equals(InternalProxyMessage.OnServiceNACKed)) {
+ final OnServiceNACKed msg = (OnServiceNACKed)message;
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onServiceNACKed(msg);
+ }
+ });
+ } else {
+ _proxyListener.onServiceNACKed(msg);
+ }
+
/**************Start Legacy Specific Call-backs************/
} else if (message.getFunctionName().equals(InternalProxyMessage.OnProxyOpened)) {
if (_callbackToUIThread) {
@@ -1425,7 +1522,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
pm.setSessionID(sdlSession.getSessionId());
pm.setMessageType(MessageType.RPC);
pm.setSessionType(SessionType.RPC);
- pm.setFunctionID(FunctionID.getFunctionID(request.getFunctionName()));
+ pm.setFunctionID(FunctionID.getFunctionId(request.getFunctionName()));
if (request.getCorrelationID() == null)
{
//Log error here
@@ -1461,14 +1558,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// The app should not receive a response for a request it did not send
if ((new RPCResponse(hash)).getCorrelationID() == REGISTER_APP_INTERFACE_CORRELATION_ID
&& _advancedLifecycleManagementEnabled
- && functionName.equals(FunctionID.REGISTER_APP_INTERFACE)) {
+ && functionName.equals(FunctionID.REGISTER_APP_INTERFACE.toString())) {
final RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse(hash);
if (msg.getSuccess()) {
_appInterfaceRegisterd = true;
}
Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.REGISTER_APP_INTERFACE);
+ updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.REGISTER_APP_INTERFACE.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
@@ -1551,7 +1648,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
} else if ((new RPCResponse(hash)).getCorrelationID() == POLICIES_CORRELATION_ID
- && functionName.equals(FunctionID.ON_ENCODED_SYNC_P_DATA)) {
+ && functionName.equals(FunctionID.ON_ENCODED_SYNC_P_DATA.toString())) {
Log.i("pt", "POLICIES_CORRELATION_ID SystemRequest Notification (Legacy)");
@@ -1572,13 +1669,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
else if ((new RPCResponse(hash)).getCorrelationID() == POLICIES_CORRELATION_ID
- && functionName.equals(FunctionID.ENCODED_SYNC_P_DATA)) {
+ && functionName.equals(FunctionID.ENCODED_SYNC_P_DATA.toString())) {
Log.i("pt", "POLICIES_CORRELATION_ID SystemRequest Response (Legacy)");
final SystemRequestResponse msg = new SystemRequestResponse(hash);
Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.SYSTEM_REQUEST);
+ updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
@@ -1587,11 +1684,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sendBroadcastIntent(sendIntent);
}
else if ((new RPCResponse(hash)).getCorrelationID() == POLICIES_CORRELATION_ID
- && functionName.equals(FunctionID.SYSTEM_REQUEST)) {
+ && functionName.equals(FunctionID.SYSTEM_REQUEST.toString())) {
final SystemRequestResponse msg = new SystemRequestResponse(hash);
Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.SYSTEM_REQUEST);
+ updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
@@ -1600,7 +1697,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
updateBroadcastIntent(sendIntent, "DATA", serializeJSON(msg));
sendBroadcastIntent(sendIntent);
}
- else if (functionName.equals(FunctionID.UNREGISTER_APP_INTERFACE)) {
+ else if (functionName.equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
// UnregisterAppInterface
_appInterfaceRegisterd = false;
synchronized(APP_INTERFACE_REGISTERED_LOCK) {
@@ -1608,7 +1705,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
final UnregisterAppInterfaceResponse msg = new UnregisterAppInterfaceResponse(hash);
Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE);
+ updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
@@ -1620,7 +1717,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
return;
}
- if (functionName.equals(FunctionID.REGISTER_APP_INTERFACE)) {
+ if (functionName.equals(FunctionID.REGISTER_APP_INTERFACE.toString())) {
final RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse(hash);
if (msg.getSuccess()) {
_appInterfaceRegisterd = true;
@@ -1697,7 +1794,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
}
- } else if (functionName.equals(FunctionID.SPEAK)) {
+ } else if (functionName.equals(FunctionID.SPEAK.toString())) {
// SpeakResponse
final SpeakResponse msg = new SpeakResponse(hash);
@@ -1712,7 +1809,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onSpeakResponse(msg);
}
- } else if (functionName.equals(FunctionID.ALERT)) {
+ } else if (functionName.equals(FunctionID.ALERT.toString())) {
// AlertResponse
final AlertResponse msg = new AlertResponse(hash);
@@ -1727,7 +1824,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onAlertResponse(msg);
}
- } else if (functionName.equals(FunctionID.SHOW)) {
+ } else if (functionName.equals(FunctionID.SHOW.toString())) {
// ShowResponse
final ShowResponse msg = new ShowResponse(hash);
@@ -1742,7 +1839,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onShowResponse((ShowResponse)msg);
}
- } else if (functionName.equals(FunctionID.ADD_COMMAND)) {
+ } else if (functionName.equals(FunctionID.ADD_COMMAND.toString())) {
// AddCommand
final AddCommandResponse msg = new AddCommandResponse(hash);
@@ -1757,7 +1854,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onAddCommandResponse((AddCommandResponse)msg);
}
- } else if (functionName.equals(FunctionID.DELETE_COMMAND)) {
+ } else if (functionName.equals(FunctionID.DELETE_COMMAND.toString())) {
// DeleteCommandResponse
final DeleteCommandResponse msg = new DeleteCommandResponse(hash);
@@ -1772,7 +1869,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onDeleteCommandResponse((DeleteCommandResponse)msg);
}
- } else if (functionName.equals(FunctionID.ADD_SUB_MENU)) {
+ } else if (functionName.equals(FunctionID.ADD_SUB_MENU.toString())) {
// AddSubMenu
final AddSubMenuResponse msg = new AddSubMenuResponse(hash);
@@ -1787,7 +1884,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onAddSubMenuResponse((AddSubMenuResponse)msg);
}
- } else if (functionName.equals(FunctionID.DELETE_SUB_MENU)) {
+ } else if (functionName.equals(FunctionID.DELETE_SUB_MENU.toString())) {
// DeleteSubMenu
final DeleteSubMenuResponse msg = new DeleteSubMenuResponse(hash);
@@ -1802,7 +1899,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onDeleteSubMenuResponse((DeleteSubMenuResponse)msg);
}
- } else if (functionName.equals(FunctionID.SUBSCRIBE_BUTTON)) {
+ } else if (functionName.equals(FunctionID.SUBSCRIBE_BUTTON.toString())) {
// SubscribeButton
final SubscribeButtonResponse msg = new SubscribeButtonResponse(hash);
@@ -1817,7 +1914,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onSubscribeButtonResponse((SubscribeButtonResponse)msg);
}
- } else if (functionName.equals(FunctionID.UNSUBSCRIBE_BUTTON)) {
+ } else if (functionName.equals(FunctionID.UNSUBSCRIBE_BUTTON.toString())) {
// UnsubscribeButton
final UnsubscribeButtonResponse msg = new UnsubscribeButtonResponse(hash);
@@ -1832,7 +1929,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onUnsubscribeButtonResponse((UnsubscribeButtonResponse)msg);
}
- } else if (functionName.equals(FunctionID.SET_MEDIA_CLOCK_TIMER)) {
+ } else if (functionName.equals(FunctionID.SET_MEDIA_CLOCK_TIMER.toString())) {
// SetMediaClockTimer
final SetMediaClockTimerResponse msg = new SetMediaClockTimerResponse(hash);
@@ -1847,12 +1944,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onSetMediaClockTimerResponse((SetMediaClockTimerResponse)msg);
}
- } else if (functionName.equals(FunctionID.ENCODED_SYNC_P_DATA)) {
+ } else if (functionName.equals(FunctionID.ENCODED_SYNC_P_DATA.toString())) {
final SystemRequestResponse msg = new SystemRequestResponse(hash);
Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.SYSTEM_REQUEST);
+ updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
@@ -1871,7 +1968,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onSystemRequestResponse(msg);
}
- } else if (functionName.equals(FunctionID.CREATE_INTERACTION_CHOICE_SET)) {
+ } else if (functionName.equals(FunctionID.CREATE_INTERACTION_CHOICE_SET.toString())) {
// CreateInteractionChoiceSet
final CreateInteractionChoiceSetResponse msg = new CreateInteractionChoiceSetResponse(hash);
@@ -1886,7 +1983,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onCreateInteractionChoiceSetResponse((CreateInteractionChoiceSetResponse)msg);
}
- } else if (functionName.equals(FunctionID.DELETE_INTERACTION_CHOICE_SET)) {
+ } else if (functionName.equals(FunctionID.DELETE_INTERACTION_CHOICE_SET.toString())) {
// DeleteInteractionChoiceSet
final DeleteInteractionChoiceSetResponse msg = new DeleteInteractionChoiceSetResponse(hash);
@@ -1901,7 +1998,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onDeleteInteractionChoiceSetResponse((DeleteInteractionChoiceSetResponse)msg);
}
- } else if (functionName.equals(FunctionID.PERFORM_INTERACTION)) {
+ } else if (functionName.equals(FunctionID.PERFORM_INTERACTION.toString())) {
// PerformInteraction
final PerformInteractionResponse msg = new PerformInteractionResponse(hash);
@@ -1916,7 +2013,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onPerformInteractionResponse((PerformInteractionResponse)msg);
}
- } else if (functionName.equals(FunctionID.SET_GLOBAL_PROPERTIES)) {
+ } else if (functionName.equals(FunctionID.SET_GLOBAL_PROPERTIES.toString())) {
// SetGlobalPropertiesResponse
final SetGlobalPropertiesResponse msg = new SetGlobalPropertiesResponse(hash);
@@ -1931,7 +2028,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onSetGlobalPropertiesResponse((SetGlobalPropertiesResponse)msg);
}
- } else if (functionName.equals(FunctionID.RESET_GLOBAL_PROPERTIES)) {
+ } else if (functionName.equals(FunctionID.RESET_GLOBAL_PROPERTIES.toString())) {
// ResetGlobalProperties
final ResetGlobalPropertiesResponse msg = new ResetGlobalPropertiesResponse(hash);
@@ -1946,7 +2043,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onResetGlobalPropertiesResponse((ResetGlobalPropertiesResponse)msg);
}
- } else if (functionName.equals(FunctionID.UNREGISTER_APP_INTERFACE)) {
+ } else if (functionName.equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
// UnregisterAppInterface
_appInterfaceRegisterd = false;
@@ -1957,7 +2054,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
final UnregisterAppInterfaceResponse msg = new UnregisterAppInterfaceResponse(hash);
Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE);
+ updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
@@ -1987,7 +2084,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
notifyProxyClosed("UnregisterAppInterfaceResponse", null, SdlDisconnectedReason.APP_INTERFACE_UNREG);
- } else if (functionName.equals(FunctionID.GENERIC_RESPONSE)) {
+ } else if (functionName.equals(FunctionID.GENERIC_RESPONSE.toString())) {
// GenericResponse (Usually and error)
final GenericResponse msg = new GenericResponse(hash);
if (_callbackToUIThread) {
@@ -2001,7 +2098,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onGenericResponse((GenericResponse)msg);
}
- } else if (functionName.equals(FunctionID.SLIDER)) {
+ } else if (functionName.equals(FunctionID.SLIDER.toString())) {
// Slider
final SliderResponse msg = new SliderResponse(hash);
if (_callbackToUIThread) {
@@ -2015,7 +2112,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onSliderResponse((SliderResponse)msg);
}
- } else if (functionName.equals(FunctionID.PUT_FILE)) {
+ } else if (functionName.equals(FunctionID.PUT_FILE.toString())) {
// PutFile
final PutFileResponse msg = new PutFileResponse(hash);
if (_callbackToUIThread) {
@@ -2024,12 +2121,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void run() {
_proxyListener.onPutFileResponse((PutFileResponse)msg);
+ notifyPutFileStreamResponse(msg);
}
});
} else {
_proxyListener.onPutFileResponse((PutFileResponse)msg);
+ notifyPutFileStreamResponse(msg);
}
- } else if (functionName.equals(FunctionID.DELETE_FILE)) {
+ } else if (functionName.equals(FunctionID.DELETE_FILE.toString())) {
// DeleteFile
final DeleteFileResponse msg = new DeleteFileResponse(hash);
if (_callbackToUIThread) {
@@ -2043,7 +2142,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onDeleteFileResponse((DeleteFileResponse)msg);
}
- } else if (functionName.equals(FunctionID.LIST_FILES)) {
+ } else if (functionName.equals(FunctionID.LIST_FILES.toString())) {
// ListFiles
final ListFilesResponse msg = new ListFilesResponse(hash);
if (_callbackToUIThread) {
@@ -2057,7 +2156,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onListFilesResponse((ListFilesResponse)msg);
}
- } else if (functionName.equals(FunctionID.SET_APP_ICON)) {
+ } else if (functionName.equals(FunctionID.SET_APP_ICON.toString())) {
// SetAppIcon
final SetAppIconResponse msg = new SetAppIconResponse(hash);
if (_callbackToUIThread) {
@@ -2071,7 +2170,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onSetAppIconResponse((SetAppIconResponse)msg);
}
- } else if (functionName.equals(FunctionID.SCROLLABLE_MESSAGE)) {
+ } else if (functionName.equals(FunctionID.SCROLLABLE_MESSAGE.toString())) {
// ScrollableMessage
final ScrollableMessageResponse msg = new ScrollableMessageResponse(hash);
if (_callbackToUIThread) {
@@ -2085,7 +2184,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onScrollableMessageResponse((ScrollableMessageResponse)msg);
}
- } else if (functionName.equals(FunctionID.CHANGE_REGISTRATION)) {
+ } else if (functionName.equals(FunctionID.CHANGE_REGISTRATION.toString())) {
// ChangeLanguageRegistration
final ChangeRegistrationResponse msg = new ChangeRegistrationResponse(hash);
if (_callbackToUIThread) {
@@ -2099,7 +2198,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onChangeRegistrationResponse((ChangeRegistrationResponse)msg);
}
- } else if (functionName.equals(FunctionID.SET_DISPLAY_LAYOUT)) {
+ } else if (functionName.equals(FunctionID.SET_DISPLAY_LAYOUT.toString())) {
// SetDisplayLayout
final SetDisplayLayoutResponse msg = new SetDisplayLayoutResponse(hash);
@@ -2122,7 +2221,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onSetDisplayLayoutResponse((SetDisplayLayoutResponse)msg);
}
- } else if (functionName.equals(FunctionID.PERFORM_AUDIO_PASS_THRU)) {
+ } else if (functionName.equals(FunctionID.PERFORM_AUDIO_PASS_THRU.toString())) {
// PerformAudioPassThru
final PerformAudioPassThruResponse msg = new PerformAudioPassThruResponse(hash);
if (_callbackToUIThread) {
@@ -2136,7 +2235,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onPerformAudioPassThruResponse((PerformAudioPassThruResponse)msg);
}
- } else if (functionName.equals(FunctionID.END_AUDIO_PASS_THRU)) {
+ } else if (functionName.equals(FunctionID.END_AUDIO_PASS_THRU.toString())) {
// EndAudioPassThru
final EndAudioPassThruResponse msg = new EndAudioPassThruResponse(hash);
if (_callbackToUIThread) {
@@ -2150,7 +2249,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onEndAudioPassThruResponse((EndAudioPassThruResponse)msg);
}
- } else if (functionName.equals(FunctionID.SUBSCRIBE_VEHICLE_DATA)) {
+ } else if (functionName.equals(FunctionID.SUBSCRIBE_VEHICLE_DATA.toString())) {
// SubscribeVehicleData
final SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse(hash);
if (_callbackToUIThread) {
@@ -2164,7 +2263,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onSubscribeVehicleDataResponse((SubscribeVehicleDataResponse)msg);
}
- } else if (functionName.equals(FunctionID.UNSUBSCRIBE_VEHICLE_DATA)) {
+ } else if (functionName.equals(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString())) {
// UnsubscribeVehicleData
final UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse(hash);
if (_callbackToUIThread) {
@@ -2178,7 +2277,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onUnsubscribeVehicleDataResponse((UnsubscribeVehicleDataResponse)msg);
}
- } else if (functionName.equals(FunctionID.GET_VEHICLE_DATA)) {
+ } else if (functionName.equals(FunctionID.GET_VEHICLE_DATA.toString())) {
// GetVehicleData
final GetVehicleDataResponse msg = new GetVehicleDataResponse(hash);
if (_callbackToUIThread) {
@@ -2192,7 +2291,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onGetVehicleDataResponse((GetVehicleDataResponse)msg);
}
- } else if (functionName.equals(FunctionID.READ_DID)) {
+ } else if (functionName.equals(FunctionID.READ_DID.toString())) {
final ReadDIDResponse msg = new ReadDIDResponse(hash);
if (_callbackToUIThread) {
// Run in UI thread
@@ -2205,7 +2304,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onReadDIDResponse((ReadDIDResponse)msg);
}
- } else if (functionName.equals(FunctionID.GET_DTCS)) {
+ } else if (functionName.equals(FunctionID.GET_DTCS.toString())) {
final GetDTCsResponse msg = new GetDTCsResponse(hash);
if (_callbackToUIThread) {
// Run in UI thread
@@ -2218,7 +2317,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onGetDTCsResponse((GetDTCsResponse)msg);
}
- } else if (functionName.equals(FunctionID.DIAGNOSTIC_MESSAGE)) {
+ } else if (functionName.equals(FunctionID.DIAGNOSTIC_MESSAGE.toString())) {
final DiagnosticMessageResponse msg = new DiagnosticMessageResponse(hash);
if (_callbackToUIThread) {
// Run in UI thread
@@ -2232,7 +2331,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onDiagnosticMessageResponse((DiagnosticMessageResponse)msg);
}
}
- else if (functionName.equals(FunctionID.SYSTEM_REQUEST)) {
+ else if (functionName.equals(FunctionID.SYSTEM_REQUEST.toString())) {
final SystemRequestResponse msg = new SystemRequestResponse(hash);
if (_callbackToUIThread) {
@@ -2247,6 +2346,74 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onSystemRequestResponse((SystemRequestResponse)msg);
}
}
+ else if (functionName.equals(FunctionID.SEND_LOCATION.toString())) {
+
+ final SendLocationResponse msg = new SendLocationResponse(hash);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onSendLocationResponse(msg);
+ }
+ });
+ } else {
+ _proxyListener.onSendLocationResponse(msg);
+ }
+ }
+ else if (functionName.equals(FunctionID.DIAL_NUMBER.toString())) {
+
+ final DialNumberResponse msg = new DialNumberResponse(hash);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onDialNumberResponse(msg);
+ }
+ });
+ } else {
+ _proxyListener.onDialNumberResponse(msg);
+ }
+ }
+ else if (functionName.equals(FunctionID.SHOW_CONSTANT_TBT.toString())) {
+ final ShowConstantTbtResponse msg = new ShowConstantTbtResponse(hash);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onShowConstantTbtResponse(msg);
+ }
+ });
+ } else {
+ _proxyListener.onShowConstantTbtResponse(msg);
+ }
+ }
+ else if (functionName.equals(FunctionID.ALERT_MANEUVER.toString())) {
+ final AlertManeuverResponse msg = new AlertManeuverResponse(hash);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onAlertManeuverResponse(msg);
+ }
+ });
+ } else {
+ _proxyListener.onAlertManeuverResponse(msg);
+ }
+ } else if (functionName.equals(FunctionID.UPDATE_TURN_LIST.toString())) {
+ final UpdateTurnListResponse msg = new UpdateTurnListResponse(hash);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onUpdateTurnListResponse(msg);
+ }
+ });
+ } else {
+ _proxyListener.onUpdateTurnListResponse(msg);
+ }
+ }
else {
if (_sdlMsgVersion != null) {
DebugTool.logError("Unrecognized response Message: " + functionName.toString() +
@@ -2257,7 +2424,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} // end-if
} else if (messageType.equals(RPCMessage.KEY_NOTIFICATION)) {
SdlTrace.logRPCEvent(InterfaceActivityDirection.Receive, new RPCNotification(rpcMsg), SDL_LIB_TRACE_KEY);
- if (functionName.equals(FunctionID.ON_HMI_STATUS)) {
+ if (functionName.equals(FunctionID.ON_HMI_STATUS.toString())) {
// OnHMIStatus
final OnHMIStatus msg = new OnHMIStatus(hash);
@@ -2286,7 +2453,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
}
}
- } else if (functionName.equals(FunctionID.ON_COMMAND)) {
+ } else if (functionName.equals(FunctionID.ON_COMMAND.toString())) {
// OnCommand
final OnCommand msg = new OnCommand(hash);
@@ -2301,7 +2468,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onOnCommand((OnCommand)msg);
}
- } else if (functionName.equals(FunctionID.ON_DRIVER_DISTRACTION)) {
+ } else if (functionName.equals(FunctionID.ON_DRIVER_DISTRACTION.toString())) {
// OnDriverDistration
final OnDriverDistraction msg = new OnDriverDistraction(hash);
@@ -2331,12 +2498,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onOnDriverDistraction(msg);
_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
}
- } else if (functionName.equals(FunctionID.ON_ENCODED_SYNC_P_DATA)) {
+ } else if (functionName.equals(FunctionID.ON_ENCODED_SYNC_P_DATA.toString())) {
final OnSystemRequest msg = new OnSystemRequest(hash);
Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.ON_SYSTEM_REQUEST);
+ updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.ON_SYSTEM_REQUEST.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_NOTIFICATION);
// If url is null, then send notification to the app, otherwise, send to URL
@@ -2372,7 +2539,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
handleOffboardTransmissionThread.start();
}
}
- } else if (functionName.equals(FunctionID.ON_PERMISSIONS_CHANGE)) {
+ } else if (functionName.equals(FunctionID.ON_PERMISSIONS_CHANGE.toString())) {
//OnPermissionsChange
final OnPermissionsChange msg = new OnPermissionsChange(hash);
@@ -2387,7 +2554,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onOnPermissionsChange(msg);
}
- } else if (functionName.equals(FunctionID.ON_TBT_CLIENT_STATE)) {
+ } else if (functionName.equals(FunctionID.ON_TBT_CLIENT_STATE.toString())) {
// OnTBTClientState
final OnTBTClientState msg = new OnTBTClientState(hash);
@@ -2402,7 +2569,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onOnTBTClientState(msg);
}
- } else if (functionName.equals(FunctionID.ON_BUTTON_PRESS)) {
+ } else if (functionName.equals(FunctionID.ON_BUTTON_PRESS.toString())) {
// OnButtonPress
final OnButtonPress msg = new OnButtonPress(hash);
@@ -2417,7 +2584,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onOnButtonPress((OnButtonPress)msg);
}
- } else if (functionName.equals(FunctionID.ON_BUTTON_EVENT)) {
+ } else if (functionName.equals(FunctionID.ON_BUTTON_EVENT.toString())) {
// OnButtonEvent
final OnButtonEvent msg = new OnButtonEvent(hash);
@@ -2432,7 +2599,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onOnButtonEvent((OnButtonEvent)msg);
}
- } else if (functionName.equals(FunctionID.ON_LANGUAGE_CHANGE)) {
+ } else if (functionName.equals(FunctionID.ON_LANGUAGE_CHANGE.toString())) {
// OnLanguageChange
final OnLanguageChange msg = new OnLanguageChange(hash);
@@ -2447,7 +2614,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onOnLanguageChange((OnLanguageChange)msg);
}
- } else if (functionName.equals(FunctionID.ON_HASH_CHANGE)) {
+ } else if (functionName.equals(FunctionID.ON_HASH_CHANGE.toString())) {
// OnLanguageChange
final OnHashChange msg = new OnHashChange(hash);
@@ -2470,7 +2637,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_lastHashID = msg.getHashID();
}
}
- } else if (functionName.equals(FunctionID.ON_SYSTEM_REQUEST)) {
+ } else if (functionName.equals(FunctionID.ON_SYSTEM_REQUEST.toString())) {
// OnSystemRequest
final OnSystemRequest msg = new OnSystemRequest(hash);
@@ -2490,6 +2657,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
+ if(msg.getRequestType() == RequestType.LOCK_SCREEN_ICON_URL &&
+ msg.getUrl() != null){
+ lockScreenIconRequest = msg;
+ }
+
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2501,7 +2673,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onOnSystemRequest((OnSystemRequest)msg);
}
- } else if (functionName.equals(FunctionID.ON_AUDIO_PASS_THRU)) {
+ } else if (functionName.equals(FunctionID.ON_AUDIO_PASS_THRU.toString())) {
// OnAudioPassThru
final OnAudioPassThru msg = new OnAudioPassThru(hash);
if (_callbackToUIThread) {
@@ -2515,7 +2687,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else {
_proxyListener.onOnAudioPassThru((OnAudioPassThru)msg);
}
- } else if (functionName.equals(FunctionID.ON_VEHICLE_DATA)) {
+ } else if (functionName.equals(FunctionID.ON_VEHICLE_DATA.toString())) {
// OnVehicleData
final OnVehicleData msg = new OnVehicleData(hash);
if (_callbackToUIThread) {
@@ -2530,7 +2702,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onOnVehicleData((OnVehicleData)msg);
}
}
- else if (functionName.equals(FunctionID.ON_APP_INTERFACE_UNREGISTERED)) {
+ else if (functionName.equals(FunctionID.ON_APP_INTERFACE_UNREGISTERED.toString())) {
// OnAppInterfaceUnregistered
_appInterfaceRegisterd = false;
@@ -2541,7 +2713,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
final OnAppInterfaceUnregistered msg = new OnAppInterfaceUnregistered(hash);
Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.ON_APP_INTERFACE_UNREGISTERED);
+ updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.ON_APP_INTERFACE_UNREGISTERED.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_NOTIFICATION);
updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
sendBroadcastIntent(sendIntent);
@@ -2564,7 +2736,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
notifyProxyClosed("OnAppInterfaceUnregistered", null, SdlDisconnectedReason.APP_INTERFACE_UNREG);
}
}
- else if (functionName.equals(FunctionID.ON_KEYBOARD_INPUT)) {
+ else if (functionName.equals(FunctionID.ON_KEYBOARD_INPUT.toString())) {
final OnKeyboardInput msg = new OnKeyboardInput(hash);
if (_callbackToUIThread) {
// Run in UI thread
@@ -2578,7 +2750,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onOnKeyboardInput((OnKeyboardInput)msg);
}
}
- else if (functionName.equals(FunctionID.ON_TOUCH_EVENT)) {
+ else if (functionName.equals(FunctionID.ON_TOUCH_EVENT.toString())) {
final OnTouchEvent msg = new OnTouchEvent(hash);
if (_callbackToUIThread) {
// Run in UI thread
@@ -2641,15 +2813,15 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
// Throw exception if RPCRequest is sent when SDL is unavailable
- if (!_appInterfaceRegisterd && !request.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE)) {
+ if (!_appInterfaceRegisterd && !request.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE.toString())) {
SdlTrace.logProxyEvent("Application attempted to send an RPCRequest (non-registerAppInterface), before the interface was registerd.", SDL_LIB_TRACE_KEY);
throw new SdlException("SDL is currently unavailable. RPC Requests cannot be sent.", SdlExceptionCause.SDL_UNAVAILABLE);
}
if (_advancedLifecycleManagementEnabled) {
- if (request.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE)
- || request.getFunctionName().equals(FunctionID.UNREGISTER_APP_INTERFACE)) {
+ if (request.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE.toString())
+ || request.getFunctionName().equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
SdlTrace.logProxyEvent("Application attempted to send a RegisterAppInterface or UnregisterAppInterface while using ALM.", SDL_LIB_TRACE_KEY);
throw new SdlException("The RPCRequest, " + request.getFunctionName() +
@@ -2718,7 +2890,116 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
}
+
+ private FileInputStream getFileInputStream(String sLocalFile)
+ {
+ FileInputStream is = null;
+ try
+ {
+ is = new FileInputStream(sLocalFile);
+ }
+ catch (IOException e1)
+ {
+ e1.printStackTrace();
+ }
+ return is;
+ }
+
+ private Long getFileInputStreamSize(FileInputStream is)
+ {
+ Long lSize = null;
+
+ try
+ {
+ lSize = is.getChannel().size();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return lSize;
+ }
+ private void closeFileInputStream(FileInputStream is)
+ {
+ try
+ {
+ is.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private RPCStreamController startRPCStream(String sLocalFile, PutFile request, SessionType sType, byte rpcSessionID, byte wiproVersion)
+ {
+ if (sdlSession == null) return null;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return null;
+
+ FileInputStream is = getFileInputStream(sLocalFile);
+ if (is == null) return null;
+
+ Integer iSize = Integer.valueOf(getFileInputStreamSize(is).intValue());
+ if (iSize == null)
+ {
+ closeFileInputStream(is);
+ return null;
+ }
+
+ try {
+ StreamRPCPacketizer rpcPacketizer = new StreamRPCPacketizer((SdlProxyBase<IProxyListenerBase>) this, sdlConn, is, request, sType, rpcSessionID, wiproVersion, iSize);
+ rpcPacketizer.start();
+ RPCStreamController streamController = new RPCStreamController(rpcPacketizer, request.getCorrelationID());
+ return streamController;
+ } catch (Exception e) {
+ Log.e("SyncConnection", "Unable to start streaming:" + e.toString());
+ return null;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private RPCStreamController startRPCStream(InputStream is, PutFile request, SessionType sType, byte rpcSessionID, byte wiproVersion)
+ {
+ if (sdlSession == null) return null;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return null;
+ Long iSize = request.getLength();
+
+ if (request.getLength() == null)
+ {
+ return null;
+ }
+
+ try {
+ StreamRPCPacketizer rpcPacketizer = new StreamRPCPacketizer((SdlProxyBase<IProxyListenerBase>) this, sdlConn, is, request, sType, rpcSessionID, wiproVersion, iSize);
+ rpcPacketizer.start();
+ RPCStreamController streamController = new RPCStreamController(rpcPacketizer, request.getCorrelationID());
+ return streamController;
+ } catch (Exception e) {
+ Log.e("SyncConnection", "Unable to start streaming:" + e.toString());
+ return null;
+ }
+ }
+
+ private RPCStreamController startPutFileStream(String sPath, PutFile msg) {
+ if (sdlSession == null) return null;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return null;
+ return startRPCStream(sPath, msg, SessionType.RPC, sdlSession.getSessionId(), _wiproVersion);
+ }
+
+ private RPCStreamController startPutFileStream(InputStream is, PutFile msg) {
+ if (sdlSession == null) return null;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return null;
+ if (is == null) return null;
+ startRPCStream(is, msg, SessionType.RPC, sdlSession.getSessionId(), _wiproVersion);
+ return null;
+ }
+
public boolean startRPCStream(InputStream is, RPCRequest msg) {
if (sdlSession == null) return false;
SdlConnection sdlConn = sdlSession.getSdlConnection();
@@ -2736,133 +3017,395 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public void endRPCStream() {
if (sdlSession == null) return;
- SdlConnection sdlConn = sdlSession.getSdlConnection();
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
if (sdlConn == null) return;
- sdlConn.stopStream();
+ sdlConn.stopRPCStream();
}
-
+ private class CallableMethod implements Callable<Void> {
+ private long waitTime;
+
+ public CallableMethod(int timeInMillis){
+ this.waitTime=timeInMillis;
+ }
+ @Override
+ public Void call() {
+ try {
+ Thread.sleep(waitTime);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ }
+ public FutureTask<Void> createFutureTask(CallableMethod callMethod){
+ return new FutureTask<Void>(callMethod);
+ }
+ public ScheduledExecutorService createScheduler(){
+ return Executors.newSingleThreadScheduledExecutor();
+ }
+
+ /**
+ *Opens the video service (serviceType 11) and subsequently streams raw H264 video from an InputStream provided by the app
+ *@return true if service is opened successfully and stream is started, return false otherwise
+ */
+
public boolean startH264(InputStream is) {
if (sdlSession == null) return false;
SdlConnection sdlConn = sdlSession.getSdlConnection();
if (sdlConn == null) return false;
-
- navServiceResponseReceived = false;
- navServiceResponse = false;
+
+ navServiceStartResponseReceived = false;
+ navServiceStartResponse = false;
sdlConn.startService(SessionType.NAV, sdlSession.getSessionId());
- int infiniteLoopKiller = 0;
- while (!navServiceResponseReceived && infiniteLoopKiller<2147483647) {
- infiniteLoopKiller++;
- }
- if (navServiceResponse) {
- sdlConn.startStream(is, SessionType.NAV, sdlSession.getSessionId());
- return true;
+
+ 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) {
+ try {
+ sdlConn.startStream(is, SessionType.NAV, sdlSession.getSessionId());
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
} else {
return false;
}
}
+ /**
+ *Opens the video service (serviceType 11) and subsequently provides an OutputStream to the app to use for a raw H264 video stream
+ *@return OutputStream if service is opened successfully and stream is started, return null otherwise
+ */
public OutputStream startH264() {
if (sdlSession == null) return null;
SdlConnection sdlConn = sdlSession.getSdlConnection();
if (sdlConn == null) return null;
- navServiceResponseReceived = false;
- navServiceResponse = false;
+ navServiceStartResponseReceived = false;
+ navServiceStartResponse = false;
sdlConn.startService(SessionType.NAV, sdlSession.getSessionId());
- int infiniteLoopKiller = 0;
- while (!navServiceResponseReceived && infiniteLoopKiller<2147483647) {
- infiniteLoopKiller++;
- }
- if (navServiceResponse) {
- return sdlConn.startStream(SessionType.NAV, sdlSession.getSessionId());
+
+ 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) {
+ try {
+ return sdlConn.startStream(SessionType.NAV, sdlSession.getSessionId());
+ } catch (Exception e) {
+ return null;
+ }
} else {
return null;
}
}
- public void endH264() {
- if (sdlSession == null) return;
+ /**
+ *Closes the opened video service (serviceType 11)
+ *@return true if the video service is closed successfully, return false otherwise
+ */
+ public boolean endH264() {
+ if (sdlSession == null) return false;
SdlConnection sdlConn = sdlSession.getSdlConnection();
- if (sdlConn == null) return;
- sdlConn.endService(SessionType.NAV, sdlSession.getSessionId());
+ if (sdlConn == null) return false;
+
+ navServiceEndResponseReceived = false;
+ navServiceEndResponse = false;
+ sdlConn.stopVideoStream();
+
+ FutureTask<Void> fTask = createFutureTask(new CallableMethod(2000));
+ ScheduledExecutorService scheduler = createScheduler();
+ scheduler.execute(fTask);
+
+ while (!navServiceEndResponseReceived && !fTask.isDone());
+ scheduler.shutdown();
+ scheduler = null;
+ fTask = null;
+
+ if (navServiceEndResponse) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ *Pauses the stream for the opened audio service (serviceType 10)
+ *@return true if the audio service stream is paused successfully, return false otherwise
+ */
+ public boolean pausePCM()
+ {
+ if (sdlSession == null) return false;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return false;
+ return sdlConn.pauseAudioStream();
+ }
+
+ /**
+ *Pauses the stream for the opened video service (serviceType 11)
+ *@return true if the video service stream is paused successfully, return false otherwise
+ */
+ public boolean pauseH264()
+ {
+ if (sdlSession == null) return false;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return false;
+ return sdlConn.pauseVideoStream();
+ }
+
+ /**
+ *Resumes the stream for the opened audio service (serviceType 10)
+ *@return true if the audio service stream is resumed successfully, return false otherwise
+ */
+ public boolean resumePCM()
+ {
+ if (sdlSession == null) return false;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return false;
+ return sdlConn.resumeAudioStream();
+ }
+
+ /**
+ *Resumes the stream for the opened video service (serviceType 11)
+ *@return true if the video service is resumed successfully, return false otherwise
+ */
+ public boolean resumeH264()
+ {
+ if (sdlSession == null) return false;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return false;
+ return sdlConn.resumeVideoStream();
}
+
+ /**
+ *Opens the audio service (serviceType 10) and subsequently streams raw PCM audio from an InputStream provided by the app
+ *@return true if service is opened successfully and stream is started, return false otherwise
+ */
+
public boolean startPCM(InputStream is) {
if (sdlSession == null) return false;
SdlConnection sdlConn = sdlSession.getSdlConnection();
if (sdlConn == null) return false;
-
- navServiceResponseReceived = false;
- navServiceResponse = false;
+
+ pcmServiceStartResponseReceived = false;
+ pcmServiceStartResponse = false;
+ sdlConn.startService(SessionType.PCM, sdlSession.getSessionId());
sdlConn.startService(SessionType.PCM, sdlSession.getSessionId());
- int infiniteLoopKiller = 0;
- while (!navServiceResponseReceived && infiniteLoopKiller<2147483647) {
- infiniteLoopKiller++;
- }
- if (navServiceResponse) {
- sdlConn.startStream(is, SessionType.PCM, sdlSession.getSessionId());
- return true;
+ FutureTask<Void> fTask = createFutureTask(new CallableMethod(2000));
+ ScheduledExecutorService scheduler = createScheduler();
+ scheduler.execute(fTask);
+
+ while (!pcmServiceStartResponseReceived && !fTask.isDone());
+ scheduler.shutdown();
+ scheduler = null;
+ fTask = null;
+
+ if (pcmServiceStartResponse) {
+ try {
+ sdlConn.startStream(is, SessionType.PCM, sdlSession.getSessionId());
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
} else {
return false;
}
}
+ /**
+ *Opens the audio service (serviceType 10) and subsequently provides an OutputStream to the app
+ *@return OutputStream if service is opened successfully and stream is started, return null otherwise
+ */
public OutputStream startPCM() {
if (sdlSession == null) return null;
SdlConnection sdlConn = sdlSession.getSdlConnection();
if (sdlConn == null) return null;
- navServiceResponseReceived = false;
- navServiceResponse = false;
+ pcmServiceStartResponseReceived = false;
+ pcmServiceStartResponse = false;
sdlConn.startService(SessionType.PCM, sdlSession.getSessionId());
- int infiniteLoopKiller = 0;
- while (!navServiceResponseReceived && infiniteLoopKiller<2147483647) {
- infiniteLoopKiller++;
- }
- if (navServiceResponse) {
- return sdlConn.startStream(SessionType.PCM, sdlSession.getSessionId());
+ FutureTask<Void> fTask = createFutureTask(new CallableMethod(2000));
+ ScheduledExecutorService scheduler = createScheduler();
+ scheduler.execute(fTask);
+
+ while (!pcmServiceStartResponseReceived && !fTask.isDone());
+ scheduler.shutdown();
+ scheduler = null;
+ fTask = null;
+
+ if (pcmServiceStartResponse) {
+ try {
+ return sdlConn.startStream(SessionType.PCM, sdlSession.getSessionId());
+ } catch (Exception e) {
+ return null;
+ }
} else {
return null;
}
}
- public void endPCM() {
- if (sdlSession == null) return;
+
+ /**
+ *Closes the opened audio service (serviceType 10)
+ *@return true if the audio service is closed successfully, return false otherwise
+ */
+ public boolean endPCM() {
+ if (sdlSession == null) return false;
SdlConnection sdlConn = sdlSession.getSdlConnection();
- if (sdlConn == null) return;
+ if (sdlConn == null) return false;
- sdlConn.endService(SessionType.PCM, sdlSession.getSessionId());
- }
+ pcmServiceEndResponseReceived = false;
+ pcmServiceEndResponse = false;
+ sdlConn.stopAudioStream();
+
+ FutureTask<Void> fTask = createFutureTask(new CallableMethod(2000));
+ ScheduledExecutorService scheduler = createScheduler();
+ scheduler.execute(fTask);
+
+ while (!pcmServiceEndResponseReceived && !fTask.isDone());
+ scheduler.shutdown();
+ scheduler = null;
+ fTask = null;
+
+ if (pcmServiceEndResponse) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public Surface createOpenGLInputSurface(int frameRate, int iFrameInterval, int width,
+ int height, int bitrate) {
+
+ if (sdlSession == null) return null;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return null;
+
+ navServiceStartResponseReceived = false;
+ navServiceStartResponse = false;
+ sdlConn.startService(SessionType.NAV, sdlSession.getSessionId());
+
+ 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 sdlConn.createOpenGLInputSurface(frameRate, iFrameInterval, width,
+ height, bitrate, SessionType.NAV, sdlSession.getSessionId());
+ } else {
+ return null;
+ }
+ }
+
+ public void startEncoder () {
+ if (sdlSession == null) return;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return;
+
+ sdlConn.startEncoder();
+ }
+
+ public void releaseEncoder() {
+ if (sdlSession == null) return;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return;
+
+ sdlConn.releaseEncoder();
+ }
+
+ public void drainEncoder(boolean endOfStream) {
+ if (sdlSession == null) return;
+ SdlConnection sdlConn = sdlSession.getSdlConnection();
+ if (sdlConn == null) return;
+
+ sdlConn.drainEncoder(endOfStream);
+ }
private void NavServiceStarted() {
- navServiceResponseReceived = true;
- navServiceResponse = true;
+ navServiceStartResponseReceived = true;
+ navServiceStartResponse = true;
}
- private void NavServiceEnded() {
- navServiceResponseReceived = true;
- navServiceResponse = false;
+ private void NavServiceStartedNACK() {
+ navServiceStartResponseReceived = true;
+ navServiceStartResponse = false;
}
- @SuppressWarnings("unused")
private void AudioServiceStarted() {
- pcmServiceResponseReceived = true;
- pcmServiceResponse = true;
+ pcmServiceStartResponseReceived = true;
+ pcmServiceStartResponse = true;
+ }
+
+ private void AudioServiceStartedNACK() {
+ pcmServiceStartResponseReceived = true;
+ pcmServiceStartResponse = false;
+ }
+
+ private void NavServiceEnded() {
+ navServiceEndResponseReceived = true;
+ navServiceEndResponse = true;
+ }
+
+ private void NavServiceEndedNACK() {
+ navServiceEndResponseReceived = true;
+ navServiceEndResponse = false;
}
- @SuppressWarnings("unused")
private void AudioServiceEnded() {
- pcmServiceResponseReceived = true;
- pcmServiceResponse = false;
+ pcmServiceEndResponseReceived = true;
+ pcmServiceEndResponse = true;
+ }
+
+ private void AudioServiceEndedNACK() {
+ pcmServiceEndResponseReceived = true;
+ pcmServiceEndResponse = false;
}
public void setAppService(Service mService)
{
_appService = mService;
}
+
+ public void getLockScreenIcon(final OnLockScreenIconDownloadedListener l){
+ if(lockScreenIconRequest == null){
+ l.onLockScreenIconDownloadError(new SdlException("This version of SDL core may not support lock screen icons.",
+ SdlExceptionCause.LOCK_SCREEN_ICON_NOT_SUPPORTED));
+ return;
+ }
+
+ LockScreenManager lockMan = sdlSession.getLockScreenMan();
+ Bitmap bitmap = lockMan.getLockScreenIcon();
+
+ // read bitmap if it was already downloaded so we don't have to download it every time
+ if(bitmap != null){
+ l.onLockScreenIconDownloaded(bitmap);
+ }
+ else{
+ String url = lockScreenIconRequest.getUrl();
+ sdlSession.getLockScreenMan().downloadLockScreenIcon(url, l);
+ }
+ }
/******************** Public Helper Methods *************************/
@@ -3591,10 +4134,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
String appID, String autoActivateID, Integer correlationID)
throws SdlException {
-
+ String carrierName = null;
+ if(telephonyManager != null){
+ carrierName = telephonyManager.getNetworkOperatorName();
+ }
+ deviceInfo = RPCRequestFactory.BuildDeviceInfo(carrierName);
RegisterAppInterface msg = RPCRequestFactory.buildRegisterAppInterface(
sdlMsgVersion, appName, ttsName, ngnMediaScreenAppName, vrSynonyms, isMediaApp,
- languageDesired, hmiDisplayLanguageDesired, appType, appID, correlationID);
+ languageDesired, hmiDisplayLanguageDesired, appType, appID, correlationID, deviceInfo);
if (_bAppResumeEnabled)
{
@@ -3603,7 +4150,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.REGISTER_APP_INTERFACE);
+ updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.REGISTER_APP_INTERFACE.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_REQUEST);
updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
@@ -3918,7 +4465,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
RPCRequestFactory.buildUnregisterAppInterface(correlationID);
Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE);
+ updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_REQUEST);
updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
@@ -4151,19 +4698,38 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* Used to push a binary stream of file data onto the module from a mobile device.
* Responses are captured through callback on IProxyListener.
*
- * @param is - The input stream of byte data that PutFileStream will read from
+ * @param is - The input stream of byte data that putFileStream will read from
* @param sdlFileName - The file reference name used by the putFile RPC.
* @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of the file.
* A value greater than zero is used for resuming partial data chunks.
* @param iLength - The total length of the file being sent.
* @throws SdlException
+ * @see {@link#putFileStream(InputStream, String, Long, Long)}
*/
- public void PutFileStream(InputStream is, String sdlFileName, Integer iOffset, Integer iLength) throws SdlException
+ @Deprecated
+ public void putFileStream(InputStream is, String sdlFileName, Integer iOffset, Integer iLength) throws SdlException
{
PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength);
startRPCStream(is, msg);
}
+ /**
+ * Used to push a binary stream of file data onto the module from a mobile
+ * device. Responses are captured through callback on IProxyListener.
+ *
+ * @param inputStream The input stream of byte data that will be read from.
+ * @param fileName The SDL file reference name used by the RPC.
+ * @param offset The data offset in bytes. A value of zero is used to
+ * indicate data starting from the beginning of the file and a value greater
+ * than zero is used for resuming partial data chunks.
+ * @param length The total length of the file being sent.
+ * @throws SdlException
+ */
+ public void putFileStream(InputStream inputStream, String fileName, Long offset, Long length) throws SdlException {
+ PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length);
+ startRPCStream(inputStream, msg);
+ }
+
/**
* Used to push a binary stream of file data onto the module from a mobile device.
* Responses are captured through callback on IProxyListener.
@@ -4175,38 +4741,81 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
*
* @return OutputStream - The output stream of byte data that is written to by the app developer
* @throws SdlException
- */
- public OutputStream PutFileStream(String sdlFileName, Integer iOffset, Integer iLength) throws SdlException
+ * @see {@link#putFileStream(String, Long, Long)}
+ */
+ @Deprecated
+ public OutputStream putFileStream(String sdlFileName, Integer iOffset, Integer iLength) throws SdlException
{
PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength);
return startRPCStream(msg);
}
+
+ /**
+ * Used to push a binary stream of file data onto the module from a mobile
+ * device. Responses are captured through callback on IProxyListener.
+ *
+ * @param fileName The SDL file reference name used by the RPC.
+ * @param offset The data offset in bytes. A value of zero is used to
+ * indicate data starting from the beginning of the file and a value greater
+ * than zero is used for resuming partial data chunks.
+ * @param length The total length of the file being sent.
+ * @throws SdlException
+ */
+ public OutputStream putFileStream(String fileName, Long offset, Long length) throws SdlException {
+ PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length);
+ return startRPCStream(msg);
+ }
/**
* Used to push a binary stream of file data onto the module from a mobile device.
* Responses are captured through callback on IProxyListener.
*
* @param is - The input stream of byte data that PutFileStream will read from
- * @param syncFileName - The file reference name used by the putFile RPC.
+ * @param sdlFileName - The file reference name used by the putFile RPC.
* @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of the file.
* A value greater than zero is used for resuming partial data chunks.
* @param iLength - The total length of the file being sent.
* @param fileType - The selected file type -- see the FileType enumeration for details
* @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
* @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
- * @throws SyncException
- */
- public void PutFileStream(InputStream is, String syncFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
+ * @throws SdlException
+ * @see {@link#putFileStream(InputStream, String, Long, Long, FileType, Boolean, Boolean)}
+ */
+ @Deprecated
+ public void putFileStream(InputStream is, String sdlFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
{
- PutFile msg = RPCRequestFactory.buildPutFile(syncFileName, iOffset, iLength, fileType, bPersistentFile, bSystemFile);
+ PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength, fileType, bPersistentFile, bSystemFile);
startRPCStream(is, msg);
}
/**
+ * Used to push a binary stream of file data onto the module from a mobile
+ * device. Responses are captured through callback on IProxyListener.
+ *
+ * @param inputStream The input stream of byte data that will be read from.
+ * @param fileName The SDL file reference name used by the RPC.
+ * @param offset The data offset in bytes. A value of zero is used to
+ * indicate data starting from the beginning of the file and a value greater
+ * than zero is used for resuming partial data chunks.
+ * @param length The total length of the file being sent.
+ * @param fileType The selected file type. See the {@link FileType} enum for
+ * details.
+ * @param isPersistentFile Indicates if the file is meant to persist between
+ * sessions / ignition cycles.
+ * @param isSystemFile Indicates if the file is meant to be passed through
+ * core to elsewhere in the system.
+ * @throws SdlException
+ */
+ public void putFileStream(InputStream inputStream, String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile) throws SdlException {
+ PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length);
+ startRPCStream(inputStream, msg);
+ }
+
+ /**
* Used to push a binary stream of file data onto the module from a mobile device.
* Responses are captured through callback on IProxyListener.
*
- * @param syncFileName - The file reference name used by the putFile RPC.
+ * @param sdlFileName - The file reference name used by the putFile RPC.
* @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of a file.
* A value greater than zero is used for resuming partial data chunks.
* @param iLength - The total length of the file being sent.
@@ -4214,17 +4823,139 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
* @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
* @return OutputStream - The output stream of byte data that is written to by the app developer
- * @throws SyncException
- */
- public OutputStream PutFileStream(String syncFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
+ * @throws SdlException
+ * @see {@link#putFileStream(String, Long, Long, FileType, Boolean, Boolean)}
+ */
+ @Deprecated
+ public OutputStream putFileStream(String sdlFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
{
- PutFile msg = RPCRequestFactory.buildPutFile(syncFileName, iOffset, iLength, fileType, bPersistentFile, bSystemFile);
+ PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength, fileType, bPersistentFile, bSystemFile);
+ return startRPCStream(msg);
+ }
+
+ /**
+ * Used to push a binary stream of file data onto the module from a mobile
+ * device. Responses are captured through callback on IProxyListener.
+ *
+ * @param fileName The SDL file reference name used by the RPC.
+ * @param offset The data offset in bytes. A value of zero is used to
+ * indicate data starting from the beginning of the file and a value greater
+ * than zero is used for resuming partial data chunks.
+ * @param length The total length of the file being sent.
+ * @param fileType The selected file type. See the {@link FileType} enum for
+ * details.
+ * @param isPersistentFile Indicates if the file is meant to persist between
+ * sessions / ignition cycles.
+ * @param isSystemFile Indicates if the file is meant to be passed through
+ * core to elsewhere in the system.
+ * @throws SdlException
+ */
+ public OutputStream putFileStream(String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile) throws SdlException {
+ PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length);
return startRPCStream(msg);
}
+
+ /**
+ * Used to push a stream of putfile RPC's containing binary data from a mobile device to the module.
+ * Responses are captured through callback on IProxyListener.
+ *
+ * @param sPath - The physical file path on the mobile device.
+ * @param sdlFileName - The file reference name used by the putFile RPC.
+ * @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of a file.
+ * A value greater than zero is used for resuming partial data chunks.
+ * @param fileType - The selected file type -- see the FileType enumeration for details
+ * @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
+ * @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
+ * @param correlationID - A unique ID that correlates each RPCRequest and RPCResponse.
+ * @return RPCStreamController - If the putFileStream was not started successfully null is returned, otherwise a valid object reference is returned
+ * @throws SdlException
+ * @see {@link#putFileStream(String, String, Long, FileType, Boolean, Boolean, Integer)}
+ */
+ @Deprecated
+ public RPCStreamController putFileStream(String sPath, String sdlFileName, Integer iOffset, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) throws SdlException
+ {
+ PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, 0, fileType, bPersistentFile, bSystemFile, iCorrelationID);
+ return startPutFileStream(sPath, msg);
+ }
+
+ /**
+ * Used to push a binary stream of file data onto the module from a mobile
+ * device. Responses are captured through callback on IProxyListener.
+ *
+ * @param path The physical file path on the mobile device.
+ * @param fileName The SDL file reference name used by the RPC.
+ * @param offset The data offset in bytes. A value of zero is used to
+ * indicate data starting from the beginning of the file and a value greater
+ * than zero is used for resuming partial data chunks.
+ * @param fileType The selected file type. See the {@link FileType} enum for
+ * details.
+ * @param isPersistentFile Indicates if the file is meant to persist between
+ * sessions / ignition cycles.
+ * @param isSystemFile Indicates if the file is meant to be passed through
+ * core to elsewhere in the system.
+ * @param correlationId A unique id that correlates each RPCRequest and
+ * RPCResponse.
+ * @return RPCStreamController If the putFileStream was not started
+ * successfully null is returned, otherwise a valid object reference is
+ * returned .
+ * @throws SdlException
+ */
+ public RPCStreamController putFileStream(String path, String fileName, Long offset, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Integer correlationId) throws SdlException {
+ PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, 0L, fileType, isPersistentFile, isSystemFile, correlationId);
+ return startPutFileStream(path,msg);
+ }
/**
+ * Used to push a stream of putfile RPC's containing binary data from a mobile device to the module.
+ * Responses are captured through callback on IProxyListener.
*
- * Used to end an existing PutFileStream that was previously initiated with any PutFileStream method.
+ * @param is - The input stream of byte data that putFileStream will read from.
+ * @param sdlFileName - The file reference name used by the putFile RPC.
+ * @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of a file.
+ * A value greater than zero is used for resuming partial data chunks.
+ * @param fileType - The selected file type -- see the FileType enumeration for details
+ * @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
+ * @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
+ * @param correlationID - A unique ID that correlates each RPCRequest and RPCResponse.
+ * @return RPCStreamController - If the putFileStream was not started successfully null is returned, otherwise a valid object reference is returned
+ * @throws SdlException
+ * @see {@link#putFileStream(InputStream, String, Long, Long, FileType, Boolean, Boolean, Integer)}
+ */
+ @Deprecated
+ public RPCStreamController putFileStream(InputStream is, String sdlFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) throws SdlException
+ {
+ PutFile msg = RPCRequestFactory.buildPutFile(sdlFileName, iOffset, iLength, fileType, bPersistentFile, bSystemFile, iCorrelationID);
+ return startPutFileStream(is, msg);
+ }
+
+ /**
+ * Used to push a binary stream of file data onto the module from a mobile
+ * device. Responses are captured through callback on IProxyListener.
+ *
+ * @param inputStream The input stream of byte data that will be read from.
+ * @param fileName The SDL file reference name used by the RPC.
+ * @param offset The data offset in bytes. A value of zero is used to
+ * indicate data starting from the beginning of the file and a value greater
+ * than zero is used for resuming partial data chunks.
+ * @param length The total length of the file being sent.
+ * @param fileType The selected file type. See the {@link FileType} enum for
+ * details.
+ * @param isPersistentFile Indicates if the file is meant to persist between
+ * sessions / ignition cycles.
+ * @param isSystemFile Indicates if the file is meant to be passed through
+ * core to elsewhere in the system.
+ * @param correlationId A unique id that correlates each RPCRequest and
+ * RPCResponse.
+ * @throws SdlException
+ */
+ public RPCStreamController putFileStream(InputStream inputStream, String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Integer correlationId) throws SdlException {
+ PutFile msg = RPCRequestFactory.buildPutFile(fileName, offset, length, fileType, isPersistentFile, isSystemFile, correlationId);
+ return startPutFileStream(inputStream, msg);
+ }
+
+ /**
+ *
+ * Used to end an existing putFileStream that was previously initiated with any putFileStream method.
*
*/
public void endPutFileStream()
@@ -4322,6 +5053,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
return sdlSession.getCurrentTransportType();
}
+ public IProxyListenerBase getProxyListener()
+ {
+ return _proxyListener;
+ }
+
public String getAppName()
{
return _applicationName;
@@ -4336,7 +5072,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
{
return _appID;
}
-
+ public DeviceInfo getDeviceInfo()
+ {
+ return deviceInfo;
+ }
public long getInstanceDT()
{
return instanceDateTime;
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBuilder.java b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBuilder.java
new file mode 100644
index 000000000..478b59db6
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/SdlProxyBuilder.java
@@ -0,0 +1,129 @@
+package com.smartdevicelink.proxy;
+
+import java.util.Vector;
+
+import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.proxy.interfaces.IProxyListenerALM;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.TTSChunk;
+import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
+import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.transport.BTTransportConfig;
+import com.smartdevicelink.transport.BaseTransportConfig;
+import android.app.Service;
+
+public class SdlProxyBuilder
+{
+ // Builder Pattern
+ private IProxyListenerALM listener;
+ private String appId;
+ private String appName;
+ private Boolean isMediaApp;
+
+ private Service service;
+ private SdlProxyConfigurationResources sdlProxyConfigurationResources;
+ private Vector<TTSChunk> ttsChunks;
+ private String sShortAppName;
+ private Vector<String>vrSynonyms;
+ private SdlMsgVersion sdlMessageVersion;
+ private Language lang;
+ private Language hmiLang;
+ private Vector<AppHMIType> vrAppHMITypes;
+ private String autoActivateID;
+ private boolean callbackToUIThread;
+ private boolean preRegister;
+ private String sAppResumeHash;
+ private BaseTransportConfig mTransport;
+
+ public static class Builder
+ {
+ // Required parameters
+ private IProxyListenerALM listener;
+ private String appId;
+ private String appName;
+ private Boolean isMediaApp;
+
+ // Optional parameters - initialized to default values
+ private Service service = null;
+ private SdlProxyConfigurationResources sdlProxyConfigurationResources = null;
+ private Vector<TTSChunk> ttsChunks = null;
+ private String sShortAppName = null;
+ private Vector<String>vrSynonyms = null;
+ private SdlMsgVersion sdlMessageVersion = null;
+ private Language lang = Language.EN_US;
+ private Language hmiLang = Language.EN_US;
+ private Vector<AppHMIType> vrAppHMITypes = null;
+ private String autoActivateID = null;
+ private boolean callbackToUIThread = false;
+ private boolean preRegister = false;
+ private String sAppResumeHash = null;
+ private BaseTransportConfig mTransport = new BTTransportConfig();
+
+ public Builder(IProxyListenerALM listener, String appId, String appName, Boolean isMediaApp)
+ {
+ this.listener = listener;
+ this.appId = appId;
+ this.appName = appName;
+ this.isMediaApp = isMediaApp;
+ }
+
+ public Builder setService(Service val)
+ { service = val; return this; }
+ public Builder setSdlProxyConfigurationResources(SdlProxyConfigurationResources val)
+ { sdlProxyConfigurationResources = val; return this; }
+ public Builder setTtsName(Vector<TTSChunk> val)
+ { ttsChunks = val; return this; }
+ public Builder setShortAppName(String val)
+ { sShortAppName = val; return this; }
+ public Builder setVrSynonyms(Vector<String> val)
+ { vrSynonyms = val; return this; }
+ public Builder setSdlMessageVersion(SdlMsgVersion val)
+ { sdlMessageVersion = val; return this; }
+ public Builder setLangDesired(Language val)
+ { lang = val; return this; }
+ public Builder setHMILangDesired(Language val)
+ { hmiLang = val; return this; }
+ public Builder setVrAppHMITypes(Vector<AppHMIType> val)
+ { vrAppHMITypes = val; return this; }
+ public Builder setAutoActivateID(String val)
+ { autoActivateID = val; return this; }
+ public Builder setCallbackToUIThread(boolean val)
+ { callbackToUIThread = val; return this; }
+ public Builder setPreRegister(boolean val)
+ { preRegister = val; return this; }
+ public Builder setAppResumeDataHash(String val)
+ { sAppResumeHash = val; return this; }
+ public Builder setTransportType(BaseTransportConfig val)
+ { mTransport = val; return this; }
+
+ public SdlProxyALM build() throws SdlException
+ {
+ SdlProxyBuilder obj = new SdlProxyBuilder(this);
+ return new SdlProxyALM(obj.service,obj.listener,obj.sdlProxyConfigurationResources,obj.appName,obj.ttsChunks,obj.sShortAppName,obj.vrSynonyms,obj.isMediaApp,obj.sdlMessageVersion,obj.lang,obj.hmiLang,obj.vrAppHMITypes,obj.appId,obj.autoActivateID,obj.callbackToUIThread,obj.preRegister,obj.sAppResumeHash,obj.mTransport);
+ }
+ }
+
+ private SdlProxyBuilder(Builder builder)
+ {
+ listener = builder.listener;
+ appId = builder.appId;
+ appName = builder.appName;
+ isMediaApp = builder.isMediaApp;
+
+ service = builder.service;
+ sdlProxyConfigurationResources = builder.sdlProxyConfigurationResources;
+ ttsChunks = builder.ttsChunks;
+ sShortAppName = builder.sShortAppName;
+ vrSynonyms = builder.vrSynonyms;
+ sdlMessageVersion = builder.sdlMessageVersion;
+ lang = builder.lang;
+ hmiLang = builder.hmiLang;
+ vrAppHMITypes = builder.vrAppHMITypes;
+ autoActivateID = builder.autoActivateID;
+ callbackToUIThread = builder.callbackToUIThread;
+ preRegister = builder.preRegister;
+ sAppResumeHash = builder.sAppResumeHash;
+ mTransport = builder.mTransport;
+ }
+}
+
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/InternalProxyMessage.java b/sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/InternalProxyMessage.java
index 8e24b4c16..dc03f5c72 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/InternalProxyMessage.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/InternalProxyMessage.java
@@ -5,6 +5,8 @@ public class InternalProxyMessage {
public static final String OnProxyError = "OnProxyError";
public static final String OnProxyOpened = "OnProxyOpened";
public static final String OnProxyClosed = "OnProxyClosed";
+ public static final String OnServiceEnded = "OnServiceEnded";
+ public static final String OnServiceNACKed = "OnServiceNACKed";
public InternalProxyMessage(String functionName) {
//this(functionName, null, null);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/OnServiceEnded.java b/sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/OnServiceEnded.java
new file mode 100644
index 000000000..d69802e0f
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/OnServiceEnded.java
@@ -0,0 +1,21 @@
+package com.smartdevicelink.proxy.callbacks;
+
+import com.smartdevicelink.protocol.enums.SessionType;
+
+public class OnServiceEnded extends InternalProxyMessage {
+ private SessionType sessionType;
+
+ public OnServiceEnded() {
+ super(InternalProxyMessage.OnServiceEnded);
+ }
+
+ public OnServiceEnded(SessionType sessionType) {
+ super(InternalProxyMessage.OnServiceEnded);
+ this.sessionType = sessionType;
+ }
+
+ public SessionType getSessionType() {
+ return this.sessionType;
+ }
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/OnServiceNACKed.java b/sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/OnServiceNACKed.java
new file mode 100644
index 000000000..9eae5e4c4
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/callbacks/OnServiceNACKed.java
@@ -0,0 +1,21 @@
+package com.smartdevicelink.proxy.callbacks;
+
+import com.smartdevicelink.protocol.enums.SessionType;
+
+public class OnServiceNACKed extends InternalProxyMessage {
+ private SessionType sessionType;
+
+ public OnServiceNACKed() {
+ super(InternalProxyMessage.OnServiceNACKed);
+ }
+
+ public OnServiceNACKed(SessionType sessionType) {
+ super(InternalProxyMessage.OnServiceNACKed);
+ this.sessionType = sessionType;
+ }
+
+ public SessionType getSessionType() {
+ return this.sessionType;
+ }
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/sdl_android_lib/src/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
index aaacf1665..636ac97c2 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
@@ -1,7 +1,10 @@
package com.smartdevicelink.proxy.interfaces;
+import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
+import com.smartdevicelink.proxy.callbacks.OnServiceNACKed;
import com.smartdevicelink.proxy.rpc.AddCommandResponse;
import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
+import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.proxy.rpc.AlertResponse;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
@@ -10,6 +13,7 @@ import com.smartdevicelink.proxy.rpc.DeleteFileResponse;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSetResponse;
import com.smartdevicelink.proxy.rpc.DeleteSubMenuResponse;
import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
+import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
@@ -28,6 +32,7 @@ import com.smartdevicelink.proxy.rpc.OnLockScreenStatus;
import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
import com.smartdevicelink.proxy.rpc.OnSystemRequest;
import com.smartdevicelink.proxy.rpc.OnTBTClientState;
+import com.smartdevicelink.proxy.rpc.OnStreamRPC;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
import com.smartdevicelink.proxy.rpc.OnVehicleData;
import com.smartdevicelink.proxy.rpc.PerformAudioPassThruResponse;
@@ -36,18 +41,22 @@ import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
+import com.smartdevicelink.proxy.rpc.SendLocationResponse;
import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
+import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.proxy.rpc.SliderResponse;
import com.smartdevicelink.proxy.rpc.SpeakResponse;
+import com.smartdevicelink.proxy.rpc.StreamRPCResponse;
import com.smartdevicelink.proxy.rpc.SubscribeButtonResponse;
import com.smartdevicelink.proxy.rpc.SubscribeVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SystemRequestResponse;
import com.smartdevicelink.proxy.rpc.UnsubscribeButtonResponse;
import com.smartdevicelink.proxy.rpc.UnsubscribeVehicleDataResponse;
+import com.smartdevicelink.proxy.rpc.UpdateTurnListResponse;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
@@ -74,7 +83,15 @@ public interface IProxyListenerBase {
* @param e - The exception that occurred.
*/
public void onProxyClosed(String info, Exception e, SdlDisconnectedReason reason);
-
+
+ public void onServiceEnded(OnServiceEnded serviceEnded);
+
+ public void onServiceNACKed(OnServiceNACKed serviceNACKed);
+
+ public void onOnStreamRPC(OnStreamRPC notification);
+
+ public void onStreamRPCResponse(StreamRPCResponse response);
+
/**
* onProxyError() being called indicates that the SDL Proxy experenced an error.
*
@@ -297,4 +314,16 @@ public interface IProxyListenerBase {
public void onGetDTCsResponse(GetDTCsResponse response);
public void onOnLockScreenNotification(OnLockScreenStatus notification);
+
+ public void onDialNumberResponse(DialNumberResponse response);
+
+ public void onSendLocationResponse(SendLocationResponse response);
+
+ public void onShowConstantTbtResponse(ShowConstantTbtResponse response);
+
+ public void onAlertManeuverResponse(AlertManeuverResponse response);
+
+ public void onUpdateTurnListResponse(UpdateTurnListResponse response);
+
+ public void onServiceDataACK();
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/interfaces/IPutFileResponseListener.java b/sdl_android_lib/src/com/smartdevicelink/proxy/interfaces/IPutFileResponseListener.java
new file mode 100644
index 000000000..7929e86e6
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/interfaces/IPutFileResponseListener.java
@@ -0,0 +1,9 @@
+package com.smartdevicelink.proxy.interfaces;
+
+import com.smartdevicelink.proxy.rpc.PutFileResponse;
+
+public interface IPutFileResponseListener {
+ public void onPutFileResponse(PutFileResponse response);
+
+ public void onPutFileStreamError(Exception e, String info);
+}
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 1f4bd8bea..3ecac23c5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommand.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommand.java
@@ -53,7 +53,7 @@ public class AddCommand extends RPCRequest {
* Constructs a new AddCommand object
*/
public AddCommand() {
- super(FunctionID.ADD_COMMAND);
+ super(FunctionID.ADD_COMMAND.toString());
}
/**
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 26011f2e2..5d64cf6c8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommandResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddCommandResponse.java
@@ -13,7 +13,7 @@ import com.smartdevicelink.proxy.RPCResponse;
public class AddCommandResponse extends RPCResponse {
public AddCommandResponse() {
- super(FunctionID.ADD_COMMAND);
+ super(FunctionID.ADD_COMMAND.toString());
}
public AddCommandResponse(Hashtable<String, Object> hash) {
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 469ae5223..9985fab61 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenu.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenu.java
@@ -29,7 +29,7 @@ public class AddSubMenu extends RPCRequest {
* Constructs a new AddSubMenu object
*/
public AddSubMenu() {
- super(FunctionID.ADD_SUB_MENU);
+ super(FunctionID.ADD_SUB_MENU.toString());
}
/**
* Constructs a new AddSubMenu object indicated by the Hashtable parameter
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 c021ed20f..c43317628 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenuResponse.java
@@ -12,7 +12,7 @@ import com.smartdevicelink.proxy.RPCResponse;
public class AddSubMenuResponse extends RPCResponse {
public AddSubMenuResponse() {
- super(FunctionID.ADD_SUB_MENU);
+ super(FunctionID.ADD_SUB_MENU.toString());
}
public AddSubMenuResponse(Hashtable<String, Object> hash) {
super(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 d65c83084..dad62cad5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Alert.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Alert.java
@@ -52,7 +52,7 @@ public class Alert extends RPCRequest {
* Constructs a new Alert object
*/
public Alert() {
- super(FunctionID.ALERT);
+ super(FunctionID.ALERT.toString());
}
/**
* Constructs a new Alert object indicated by the Hashtable parameter
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 791c89a1b..9aab52589 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuver.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuver.java
@@ -28,7 +28,7 @@ public class AlertManeuver extends RPCRequest{
* Constructs a new AlertManeuver object
*/
public AlertManeuver(){
- super(FunctionID.ALERT_MANEUVER);
+ super(FunctionID.ALERT_MANEUVER.toString());
}
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java
index 24d5dc710..6ed8ca1a4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuverResponse.java
@@ -16,7 +16,7 @@ public class AlertManeuverResponse extends RPCResponse{
* Constructs a new AlertManeuverResponse object
*/
public AlertManeuverResponse() {
- super(FunctionID.ALERT_MANEUVER);
+ super(FunctionID.ALERT_MANEUVER.toString());
}
/**
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 221ae43ca..fc01fbe63 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertResponse.java
@@ -17,7 +17,7 @@ public class AlertResponse extends RPCResponse {
* Constructs a new AlertResponse object
*/
public AlertResponse() {
- super(FunctionID.ALERT);
+ super(FunctionID.ALERT.toString());
}
/**
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 b3a82b1cc..1cf47841e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistration.java
@@ -34,7 +34,7 @@ public class ChangeRegistration extends RPCRequest {
* Constructs a new ChangeRegistration object
*/
public ChangeRegistration() {
- super(FunctionID.CHANGE_REGISTRATION);
+ super(FunctionID.CHANGE_REGISTRATION.toString());
}
/**
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 ad71f6561..0ab62ba49 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ChangeRegistrationResponse.java
@@ -16,7 +16,7 @@ public class ChangeRegistrationResponse extends RPCResponse {
* Constructs a new ChangeRegistrationResponse object
*/
public ChangeRegistrationResponse() {
- super(FunctionID.CHANGE_REGISTRATION);
+ super(FunctionID.CHANGE_REGISTRATION.toString());
}
/**
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 53fee6201..45c2901de 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java
@@ -28,7 +28,7 @@ public class CreateInteractionChoiceSet extends RPCRequest {
* Constructs a new CreateInteractionChoiceSet object
*/
public CreateInteractionChoiceSet() {
- super(FunctionID.CREATE_INTERACTION_CHOICE_SET);
+ super(FunctionID.CREATE_INTERACTION_CHOICE_SET.toString());
}
/**
* Constructs a new CreateInteractionChoiceSet object indicated by the
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 7edc84294..d5a417090 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSetResponse.java
@@ -14,7 +14,7 @@ import com.smartdevicelink.proxy.RPCResponse;
public class CreateInteractionChoiceSetResponse extends RPCResponse {
public CreateInteractionChoiceSetResponse() {
- super(FunctionID.CREATE_INTERACTION_CHOICE_SET);
+ super(FunctionID.CREATE_INTERACTION_CHOICE_SET.toString());
}
public CreateInteractionChoiceSetResponse(Hashtable<String, Object> hash) {
super(hash);
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 2aa701afe..bf32d6996 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommand.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommand.java
@@ -26,7 +26,7 @@ public class DeleteCommand extends RPCRequest {
* Constructs a new DeleteCommand object
*/
public DeleteCommand() {
- super(FunctionID.DELETE_COMMAND);
+ super(FunctionID.DELETE_COMMAND.toString());
}
/**
* Constructs a new DeleteCommand object indicated by the Hashtable
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 ace0f8beb..b6bcc9e7d 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommandResponse.java
@@ -13,7 +13,7 @@ import com.smartdevicelink.proxy.RPCResponse;
public class DeleteCommandResponse extends RPCResponse {
public DeleteCommandResponse() {
- super(FunctionID.DELETE_COMMAND);
+ super(FunctionID.DELETE_COMMAND.toString());
}
public DeleteCommandResponse(Hashtable<String, Object> hash) {
super(hash);
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 ebb134a7a..b2bc91a99 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFile.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFile.java
@@ -21,7 +21,7 @@ public class DeleteFile extends RPCRequest {
* Constructs a new DeleteFile object
*/
public DeleteFile() {
- super(FunctionID.DELETE_FILE);
+ super(FunctionID.DELETE_FILE.toString());
}
/**
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 5d09572b0..ad54b2a14 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteFileResponse.java
@@ -14,7 +14,7 @@ public class DeleteFileResponse extends RPCResponse {
public static final String KEY_SPACE_AVAILABLE = "spaceAvailable";
public DeleteFileResponse() {
- super(FunctionID.DELETE_FILE);
+ super(FunctionID.DELETE_FILE.toString());
}
public DeleteFileResponse(Hashtable<String, Object> hash) {
super(hash);
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 df80e02c2..0d7d610d7 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java
@@ -27,7 +27,7 @@ public class DeleteInteractionChoiceSet extends RPCRequest {
* Constructs a new DeleteInteractionChoiceSet object
*/
public DeleteInteractionChoiceSet() {
- super(FunctionID.DELETE_INTERACTION_CHOICE_SET);
+ super(FunctionID.DELETE_INTERACTION_CHOICE_SET.toString());
}
/**
* Constructs a new DeleteInteractionChoiceSet object indicated by the
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java
index 6c41b23ef..5f29ed567 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSetResponse.java
@@ -13,7 +13,7 @@ import com.smartdevicelink.proxy.RPCResponse;
public class DeleteInteractionChoiceSetResponse extends RPCResponse {
public DeleteInteractionChoiceSetResponse() {
- super(FunctionID.DELETE_INTERACTION_CHOICE_SET);
+ super(FunctionID.DELETE_INTERACTION_CHOICE_SET.toString());
}
public DeleteInteractionChoiceSetResponse(Hashtable<String, Object> hash) {
super(hash);
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 154ba6668..bd7fc216b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java
@@ -25,7 +25,7 @@ public class DeleteSubMenu extends RPCRequest {
* Constructs a new DeleteSubMenu object
*/
public DeleteSubMenu() {
- super(FunctionID.DELETE_SUB_MENU);
+ super(FunctionID.DELETE_SUB_MENU.toString());
}
/**
* Constructs a new DeleteSubMenu object indicated by the Hashtable parameter<p>
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 cf24f0e16..c13e37131 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenuResponse.java
@@ -13,7 +13,7 @@ import com.smartdevicelink.proxy.RPCResponse;
public class DeleteSubMenuResponse extends RPCResponse {
public DeleteSubMenuResponse() {
- super(FunctionID.DELETE_SUB_MENU);
+ super(FunctionID.DELETE_SUB_MENU.toString());
}
public DeleteSubMenuResponse(Hashtable<String, Object> hash) {
super(hash);
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 50c86402d..e57af4159 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeviceInfo.java
@@ -11,13 +11,14 @@ 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 DeviceInfo() { }
public DeviceInfo(Hashtable<String, Object> hash) {
super(hash);
}
-
+
public void setHardware(String hardware) {
if (hardware != null) {
store.put(KEY_HARDWARE, hardware);
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 2aa37445b..e5b8e8c45 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessage.java
@@ -12,7 +12,7 @@ public class DiagnosticMessage extends RPCRequest {
public static final String KEY_MESSAGE_DATA = "messageData";
public DiagnosticMessage() {
- super(FunctionID.DIAGNOSTIC_MESSAGE);
+ super(FunctionID.DIAGNOSTIC_MESSAGE.toString());
}
public DiagnosticMessage(Hashtable<String, Object> hash) {
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 742270845..57e5bc98b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
@@ -10,7 +10,7 @@ public class DiagnosticMessageResponse extends RPCResponse {
public static final String KEY_MESSAGE_DATA_RESULT = "messageDataResult";
public DiagnosticMessageResponse() {
- super(FunctionID.DIAGNOSTIC_MESSAGE);
+ super(FunctionID.DIAGNOSTIC_MESSAGE.toString());
}
public DiagnosticMessageResponse(Hashtable<String, Object> hash) {
super(hash);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumber.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumber.java
new file mode 100644
index 000000000..76fbc02d1
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumber.java
@@ -0,0 +1,51 @@
+package com.smartdevicelink.proxy.rpc;
+
+import java.util.Hashtable;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+/**
+ * Dials a phone number and switches to phone application.
+ *
+ * @since SmartDeviceLink 4.0
+ */
+public class DialNumber extends RPCRequest {
+ public static final String KEY_NUMBER = "number";
+
+
+ public DialNumber(){
+ super(FunctionID.DIAL_NUMBER.toString());
+ }
+
+ public DialNumber(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets a number to dial
+ *
+ * @param number
+ * a phone number is a string, which can be up to 40 chars.
+ * <p>
+ * <b>Notes: </b>Maxlength=40<p>
+ * All characters shall be stripped from string except digits 0-9 and * # , ; +
+ */
+ public void setNumber(String number) {
+ if (number != null) {
+ number = number.replaceAll("[^0-9*#,;+]", ""); //This will sanitize the input
+ parameters.put(KEY_NUMBER, number);
+ } else {
+ parameters.remove(KEY_NUMBER);
+ }
+ }
+
+ /**
+ * Gets a number to dial
+ *
+ * @return String - a String value representing a number to dial
+ */
+ public String getNumber() {
+ return (String) parameters.get(KEY_NUMBER);
+ }
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumberResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumberResponse.java
new file mode 100644
index 000000000..613755442
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DialNumberResponse.java
@@ -0,0 +1,23 @@
+package com.smartdevicelink.proxy.rpc;
+
+import java.util.Hashtable;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+
+/**
+ * Dial Number Response is sent, when DialNumber has been called
+ *
+ * @since SmartDeviceLink 4.0
+ */
+public class DialNumberResponse extends RPCResponse {
+
+ public DialNumberResponse() {
+ super(FunctionID.DIAL_NUMBER.toString());
+ }
+
+ public DialNumberResponse(Hashtable<String, Object> hash) {
+ super(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 1020a4281..8a6793691 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThru.java
@@ -21,7 +21,7 @@ public class EndAudioPassThru extends RPCRequest {
* Constructs a new EndAudioPassThru object
*/
public EndAudioPassThru() {
- super(FunctionID.END_AUDIO_PASS_THRU);
+ super(FunctionID.END_AUDIO_PASS_THRU.toString());
}
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java
index d29cbccfa..4f7a09f7b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/EndAudioPassThruResponse.java
@@ -16,7 +16,7 @@ public class EndAudioPassThruResponse extends RPCResponse {
* Constructs a new EndAudioPassThruResponse object
*/
public EndAudioPassThruResponse() {
- super(FunctionID.END_AUDIO_PASS_THRU);
+ super(FunctionID.END_AUDIO_PASS_THRU.toString());
}
public EndAudioPassThruResponse(Hashtable<String, Object> hash) {
super(hash);
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 4c2b1238e..e231dd04d 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GenericResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GenericResponse.java
@@ -13,7 +13,7 @@ import com.smartdevicelink.proxy.RPCResponse;
public class GenericResponse extends RPCResponse {
public GenericResponse() {
- super(FunctionID.GENERIC_RESPONSE);
+ super(FunctionID.GENERIC_RESPONSE.toString());
}
public GenericResponse(Hashtable<String, Object> hash) {
super(hash);
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 65deeaaa0..967c62cbb 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCs.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCs.java
@@ -22,7 +22,7 @@ public class GetDTCs extends RPCRequest {
* Constructs a new GetDTCs object
*/
public GetDTCs() {
- super(FunctionID.GET_DTCS);
+ super(FunctionID.GET_DTCS.toString());
}
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
index 8d19df40d..b3c49b251 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
@@ -17,7 +17,7 @@ public class GetDTCsResponse extends RPCResponse{
public static final String KEY_DTC = "dtc";
public GetDTCsResponse(){
- super(FunctionID.GET_DTCS);
+ super(FunctionID.GET_DTCS.toString());
}
public GetDTCsResponse(Hashtable<String, Object> hash){
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 42840de97..b3d2e6189 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleData.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleData.java
@@ -33,7 +33,7 @@ public class GetVehicleData extends RPCRequest {
public static final String KEY_MY_KEY = "myKey";
public GetVehicleData() {
- super(FunctionID.GET_VEHICLE_DATA);
+ super(FunctionID.GET_VEHICLE_DATA.toString());
}
public GetVehicleData(Hashtable<String, Object> hash) {
super(hash);
@@ -80,15 +80,11 @@ public class GetVehicleData extends RPCRequest {
}
@Deprecated
public void setFuelLevel_State(Boolean fuelLevel_State) {
- if (fuelLevel_State != null) {
- parameters.put(KEY_FUEL_LEVEL_STATE, fuelLevel_State);
- } else {
- parameters.remove(KEY_FUEL_LEVEL_STATE);
- }
+ setFuelLevelState(fuelLevel_State);
}
@Deprecated
public Boolean getFuelLevel_State() {
- return (Boolean) parameters.get(KEY_FUEL_LEVEL_STATE);
+ return getFuelLevelState();
}
public void setFuelLevelState(Boolean fuelLevelState) {
if (fuelLevelState != null) {
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 6c48a19ed..3ae2b54d8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
@@ -41,7 +41,7 @@ public class GetVehicleDataResponse extends RPCResponse {
public GetVehicleDataResponse() {
- super(FunctionID.GET_VEHICLE_DATA);
+ super(FunctionID.GET_VEHICLE_DATA.toString());
}
public GetVehicleDataResponse(Hashtable<String, Object> hash) {
super(hash);
@@ -103,27 +103,11 @@ public class GetVehicleDataResponse extends RPCResponse {
}
@Deprecated
public void setFuelLevel_State(ComponentVolumeStatus fuelLevel_State) {
- if (fuelLevel_State != null) {
- parameters.put(KEY_FUEL_LEVEL_STATE, fuelLevel_State);
- } else {
- parameters.remove(KEY_FUEL_LEVEL_STATE);
- }
+ setFuelLevelState(fuelLevel_State);
}
@Deprecated
public ComponentVolumeStatus getFuelLevel_State() {
- Object obj = parameters.get(KEY_FUEL_LEVEL_STATE);
- if (obj instanceof ComponentVolumeStatus) {
- return (ComponentVolumeStatus) obj;
- } else if (obj instanceof String) {
- ComponentVolumeStatus theCode = null;
- try {
- theCode = ComponentVolumeStatus.valueForString((String) obj);
- } catch (Exception e) {
- DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + KEY_FUEL_LEVEL_STATE, e);
- }
- return theCode;
- }
- return null;
+ return getFuelLevelState();
}
public void setFuelLevelState(ComponentVolumeStatus fuelLevelState) {
if (fuelLevelState != null) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HMICapabilities.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HMICapabilities.java
new file mode 100644
index 000000000..efc94f57c
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/HMICapabilities.java
@@ -0,0 +1,49 @@
+package com.smartdevicelink.proxy.rpc;
+
+import java.util.Hashtable;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+public class HMICapabilities extends RPCStruct{
+ public static final String KEY_NAVIGATION = "navigation";
+ public static final String KEY_PHONE_CALL = "phoneCall";
+
+ public HMICapabilities() { }
+
+ public HMICapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public boolean isNavigationAvailable(){
+ Object available = store.get(KEY_NAVIGATION);
+ if(available == null){
+ return false;
+ }
+ return (Boolean)available;
+ }
+
+ public void setNavigationAvilable(Boolean available){
+ if (available) {
+ store.put(KEY_NAVIGATION, available);
+ } else {
+ store.remove(KEY_NAVIGATION);
+ }
+ }
+
+ public boolean isPhoneCallAvailable(){
+ Object available = store.get(KEY_PHONE_CALL);
+ if(available == null){
+ return false;
+ }
+ return (Boolean)available;
+ }
+
+ public void setPhoneCallAvilable(Boolean available){
+ if (available) {
+ store.put(KEY_PHONE_CALL, available);
+ } else {
+ store.remove(KEY_PHONE_CALL);
+ }
+ }
+
+}
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 dba3f973e..f135eaa9e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFiles.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFiles.java
@@ -18,7 +18,7 @@ public class ListFiles extends RPCRequest {
* Constructs a new ListFiles object
*/
public ListFiles() {
- super(FunctionID.LIST_FILES);
+ super(FunctionID.LIST_FILES.toString());
}
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFilesResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFilesResponse.java
index 1284f1cbf..2c7a62e3e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFilesResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ListFilesResponse.java
@@ -19,7 +19,7 @@ public class ListFilesResponse extends RPCResponse {
* Constructs a new ListFilesResponse object
*/
public ListFilesResponse() {
- super(FunctionID.LIST_FILES);
+ super(FunctionID.LIST_FILES.toString());
}
public ListFilesResponse(Hashtable<String, Object> hash) {
super(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 87fc1a0e7..21cb9bc52 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java
@@ -46,7 +46,7 @@ public class OnAppInterfaceUnregistered extends RPCNotification {
*Constructs a newly allocated OnAppInterfaceUnregistered object
*/
public OnAppInterfaceUnregistered() {
- super(FunctionID.ON_APP_INTERFACE_UNREGISTERED);
+ super(FunctionID.ON_APP_INTERFACE_UNREGISTERED.toString());
}
/**
*<p>Constructs a newly allocated OnAppInterfaceUnregistered object indicated by the Hashtable parameter</p>
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 3369c4020..421bbd933 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAudioPassThru.java
@@ -45,7 +45,7 @@ public class OnAudioPassThru extends RPCNotification {
*Constructs a newly allocated OnCommand object
*/
public OnAudioPassThru() {
- super(FunctionID.ON_AUDIO_PASS_THRU);
+ super(FunctionID.ON_AUDIO_PASS_THRU.toString());
}
/**
*<p>Constructs a newly allocated OnAudioPassThru object indicated by the Hashtable parameter</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 717a2a10a..3e5bf33f4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonEvent.java
@@ -90,7 +90,7 @@ public class OnButtonEvent extends RPCNotification {
*Constructs a newly allocated OnButtonEvent object
*/
public OnButtonEvent() {
- super(FunctionID.ON_BUTTON_EVENT);
+ super(FunctionID.ON_BUTTON_EVENT.toString());
}
/**
* <p>
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 49241a4d3..2d48b9635 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonPress.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnButtonPress.java
@@ -95,7 +95,7 @@ public class OnButtonPress extends RPCNotification {
*Constructs a newly allocated OnButtonPress object
*/
public OnButtonPress() {
- super(FunctionID.ON_BUTTON_PRESS);
+ super(FunctionID.ON_BUTTON_PRESS.toString());
}
/**
* <p>
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 d262295fc..77632b8b2 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnCommand.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnCommand.java
@@ -58,7 +58,7 @@ public class OnCommand extends RPCNotification {
*Constructs a newly allocated OnCommand object
*/
public OnCommand() {
- super(FunctionID.ON_COMMAND);
+ super(FunctionID.ON_COMMAND.toString());
}
/**
*<p>Constructs a newly allocated OnCommand object indicated by the Hashtable parameter</p>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
index 9b7fb860a..69280ad21 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
@@ -44,7 +44,7 @@ public class OnDriverDistraction extends RPCNotification {
*Constructs a newly allocated OnDriverDistraction object
*/
public OnDriverDistraction() {
- super(FunctionID.ON_DRIVER_DISTRACTION);
+ super(FunctionID.ON_DRIVER_DISTRACTION.toString());
}
/**
*<p>Constructs a newly allocated OnDriverDistraction object indicated by the Hashtable parameter</p>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHMIStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
index 0d0c22001..31161f2f1 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
@@ -72,7 +72,7 @@ public class OnHMIStatus extends RPCNotification {
*Constructs a newly allocated OnHMIStatus object
*/
public OnHMIStatus() {
- super(FunctionID.ON_HMI_STATUS);
+ super(FunctionID.ON_HMI_STATUS.toString());
}
/**
*<p>Constructs a newly allocated OnHMIStatus object indicated by the Hashtable parameter</p>
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 363fb8ee5..e806e5225 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHashChange.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnHashChange.java
@@ -9,7 +9,7 @@ public class OnHashChange extends RPCNotification {
public static final String KEY_HASH_ID = "hashID";
public OnHashChange() {
- super(FunctionID.ON_HASH_CHANGE);
+ super(FunctionID.ON_HASH_CHANGE.toString());
}
public OnHashChange(Hashtable<String, Object> 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 19c7a4446..4de2acf3f 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
@@ -12,7 +12,7 @@ public class OnKeyboardInput extends RPCNotification {
public static final String KEY_EVENT = "event";
public OnKeyboardInput() {
- super(FunctionID.ON_KEYBOARD_INPUT);
+ super(FunctionID.ON_KEYBOARD_INPUT.toString());
}
public OnKeyboardInput(Hashtable<String, Object> hash) {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLanguageChange.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLanguageChange.java
index 012a8f227..4f39d55cb 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLanguageChange.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnLanguageChange.java
@@ -63,7 +63,7 @@ public class OnLanguageChange extends RPCNotification {
*Constructs a newly allocated OnCommand object
*/
public OnLanguageChange() {
- super(FunctionID.ON_LANGUAGE_CHANGE);
+ super(FunctionID.ON_LANGUAGE_CHANGE.toString());
}
/**
*<p>Constructs a newly allocated OnLanguageChange object indicated by the Hashtable parameter</p>
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 02c6d1cf2..1ad23994c 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,6 @@ 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;
public class OnLockScreenStatus extends RPCNotification {
public static final String KEY_DRIVER_DISTRACTION = "driverDistraction";
@@ -12,7 +11,7 @@ public class OnLockScreenStatus extends RPCNotification {
public static final String KEY_USER_SELECTED = "userSelected";
public OnLockScreenStatus() {
- super(FunctionID.ON_LOCK_SCREEN_STATUS);
+ super(FunctionID.ON_LOCK_SCREEN_STATUS.toString());
}
public Boolean getDriverDistractionStatus() {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
index e4ae9d46e..4c88c9baa 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
@@ -54,7 +54,7 @@ public class OnPermissionsChange extends RPCNotification {
*Constructs a newly allocated OnCommand object
*/
public OnPermissionsChange() {
- super(FunctionID.ON_PERMISSIONS_CHANGE);
+ super(FunctionID.ON_PERMISSIONS_CHANGE.toString());
}
/**
*<p>Constructs a newly allocated OnPermissionsChange object indicated by the Hashtable parameter</p>
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSdlChoiceChosen.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSdlChoiceChosen.java
index 3ad14f48c..a878ade77 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSdlChoiceChosen.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSdlChoiceChosen.java
@@ -138,7 +138,7 @@ public class OnSdlChoiceChosen extends RPCNotification {
public OnSdlChoiceChosen() {
- super(FunctionID.ON_SDL_CHOICE_CHOSEN);
+ super(FunctionID.ON_SDL_CHOICE_CHOSEN.toString());
}
public OnSdlChoiceChosen(Hashtable<String, Object> hash){
super(hash);
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnStreamRPC.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnStreamRPC.java
new file mode 100644
index 000000000..bb4bcc324
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnStreamRPC.java
@@ -0,0 +1,47 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCNotification;
+
+public class OnStreamRPC extends RPCNotification {
+ public static final String KEY_FILENAME = "fileName";
+ public static final String KEY_BYTESCOMPLETE = "bytesComplete";
+ public static final String KEY_FILESIZE = "fileSize";
+
+ public OnStreamRPC() {
+ super(FunctionID.ON_STREAM_RPC.toString());
+ }
+
+ public void setFileName(String fileName) {
+ if (fileName != null) {
+ parameters.put(KEY_FILENAME, fileName);
+ } else {
+ parameters.remove(KEY_FILENAME);
+ }
+ }
+ public String getFileName() {
+ return (String) parameters.get(KEY_FILENAME);
+ }
+
+ public void setBytesComplete(Long bytesComplete) {
+ if (bytesComplete != null) {
+ parameters.put(KEY_BYTESCOMPLETE, bytesComplete);
+ } else {
+ parameters.remove(KEY_BYTESCOMPLETE);
+ }
+ }
+ public Long getBytesComplete() {
+ return (Long) parameters.get(KEY_BYTESCOMPLETE);
+ }
+
+ public void setFileSize(Long fileSize) {
+ if (fileSize != null) {
+ parameters.put(KEY_FILESIZE, fileSize);
+ } else {
+ parameters.remove(KEY_FILESIZE);
+ }
+ }
+ public Long getFileSize() {
+ return (Long) parameters.get(KEY_FILESIZE);
+ }
+} \ No newline at end of file
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 d30742b7e..fa96cd1cf 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnSystemRequest.java
@@ -32,7 +32,7 @@ public class OnSystemRequest extends RPCNotification {
private Headers headers;
public OnSystemRequest() {
- super(FunctionID.ON_SYSTEM_REQUEST);
+ super(FunctionID.ON_SYSTEM_REQUEST.toString());
}
public OnSystemRequest(Hashtable<String, Object> hash) {
@@ -207,18 +207,34 @@ public class OnSystemRequest extends RPCNotification {
}
}
- public Integer getOffset() {
+ /**
+ * @deprecated as of SmartDeviceLink 4.0
+ * @param offset
+ */
+ public void setOffset(Integer offset) {
+ if(offset == null){
+ setOffset((Long)null);
+ }else{
+ setOffset(offset.longValue());
+ }
+ }
+
+ public Long getOffset() {
final Object o = parameters.get(KEY_OFFSET);
- if (o == null) return null;
+ if (o == null){
+ return null;
+ }
if (o instanceof Integer) {
- return (Integer) o;
+ return ((Integer) o).longValue();
+ }else if(o instanceof Long){
+ return (Long) o;
}
return null;
}
- public void setOffset(Integer offset) {
+ public void setOffset(Long offset) {
if (offset != null) {
parameters.put(KEY_OFFSET, offset);
} else {
@@ -247,18 +263,34 @@ public class OnSystemRequest extends RPCNotification {
parameters.remove(KEY_TIMEOUT);
}
}
-
- public Integer getLength() {
+
+ public Long getLength() {
final Object o = parameters.get(KEY_LENGTH);
- if (o == null) return null;
+ if (o == null){
+ return null;
+ }
if (o instanceof Integer) {
- return (Integer) o;
+ return ((Integer) o).longValue();
+ }else if(o instanceof Long){
+ return (Long) o;
}
return null;
}
+ /**
+ * @deprecated as of SmartDeviceLink 4.0
+ * @param length
+ */
public void setLength(Integer length) {
+ if(length == null){
+ setLength((Long)null);
+ }else{
+ setLength(length.longValue());
+ }
+ }
+
+ public void setLength(Long length) {
if (length != null) {
parameters.put(KEY_LENGTH, length);
} else {
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTBTClientState.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTBTClientState.java
index 8cfc7edeb..26965c891 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTBTClientState.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTBTClientState.java
@@ -44,7 +44,7 @@ public class OnTBTClientState extends RPCNotification {
*Constructs a newly allocated OnTBTClientState object
*/
public OnTBTClientState() {
- super(FunctionID.ON_TBT_CLIENT_STATE);
+ super(FunctionID.ON_TBT_CLIENT_STATE.toString());
}
/**
*<p>Constructs a newly allocated OnTBTClientState object indicated by the Hashtable parameter</p>
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 ff33e52c3..47ecc30a3 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnTouchEvent.java
@@ -13,7 +13,7 @@ public class OnTouchEvent extends RPCNotification {
public static final String KEY_TYPE = "type";
public OnTouchEvent() {
- super(FunctionID.ON_TOUCH_EVENT);
+ super(FunctionID.ON_TOUCH_EVENT.toString());
}
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 fdb025f05..ec50e659e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnVehicleData.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnVehicleData.java
@@ -39,7 +39,7 @@ public class OnVehicleData extends RPCNotification {
public static final String KEY_MY_KEY = "myKey";
public OnVehicleData() {
- super(FunctionID.ON_VEHICLE_DATA);
+ super(FunctionID.ON_VEHICLE_DATA.toString());
}
public OnVehicleData(Hashtable<String, Object> hash) {
super(hash);
@@ -101,27 +101,11 @@ public class OnVehicleData extends RPCNotification {
}
@Deprecated
public void setFuelLevel_State(ComponentVolumeStatus fuelLevel_State) {
- if (fuelLevel_State != null) {
- parameters.put(KEY_FUEL_LEVEL_STATE, fuelLevel_State);
- } else {
- parameters.remove(KEY_FUEL_LEVEL_STATE);
- }
+ setFuelLevelState(fuelLevel_State);
}
@Deprecated
public ComponentVolumeStatus getFuelLevel_State() {
- Object obj = parameters.get(KEY_FUEL_LEVEL_STATE);
- if (obj instanceof ComponentVolumeStatus) {
- return (ComponentVolumeStatus) obj;
- } else if (obj instanceof String) {
- ComponentVolumeStatus theCode = null;
- try {
- theCode = ComponentVolumeStatus.valueForString((String) obj);
- } catch (Exception e) {
- DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + KEY_FUEL_LEVEL_STATE, e);
- }
- return theCode;
- }
- return null;
+ return getFuelLevelState();
}
public void setFuelLevelState(ComponentVolumeStatus fuelLevelState) {
if (fuelLevelState != null) {
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 a7f913afe..4ba1658b2 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThru.java
@@ -36,7 +36,7 @@ public class PerformAudioPassThru extends RPCRequest {
* Constructs a new PerformAudioPassThru object
*/
public PerformAudioPassThru() {
- super(FunctionID.PERFORM_AUDIO_PASS_THRU);
+ super(FunctionID.PERFORM_AUDIO_PASS_THRU.toString());
}
/**
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 f23513994..7ba905f96 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformAudioPassThruResponse.java
@@ -16,7 +16,7 @@ public class PerformAudioPassThruResponse extends RPCResponse {
* Constructs a new PerformAudioPassThruResponse object
*/
public PerformAudioPassThruResponse() {
- super(FunctionID.PERFORM_AUDIO_PASS_THRU);
+ super(FunctionID.PERFORM_AUDIO_PASS_THRU.toString());
}
/**
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 864cfc029..3c6ed46a5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteraction.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteraction.java
@@ -38,7 +38,7 @@ public class PerformInteraction extends RPCRequest {
* Constructs a new PerformInteraction object
*/
public PerformInteraction() {
- super(FunctionID.PERFORM_INTERACTION);
+ super(FunctionID.PERFORM_INTERACTION.toString());
}
/**
* Constructs a new PerformInteraction object indicated by the Hashtable
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 85b5ad3f6..c0c212a85 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PerformInteractionResponse.java
@@ -20,7 +20,7 @@ public class PerformInteractionResponse extends RPCResponse {
* Constructs a new PerformInteractionResponse object
*/
public PerformInteractionResponse() {
- super(FunctionID.PERFORM_INTERACTION);
+ super(FunctionID.PERFORM_INTERACTION.toString());
}
/**
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 9027a9b33..2f76f862a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFile.java
@@ -28,7 +28,7 @@ public class PutFile extends RPCRequest {
* Constructs a new PutFile object
*/
public PutFile() {
- super(FunctionID.PUT_FILE);
+ super(FunctionID.PUT_FILE.toString());
}
/**
@@ -134,7 +134,19 @@ public class PutFile extends RPCRequest {
return getBulkData();
}
+ /**
+ * @deprecated as of SmartDeviceLink 4.0
+ * @param offset
+ */
public void setOffset(Integer offset) {
+ if(offset == null){
+ setOffset((Long)null);
+ }else{
+ setOffset(offset.longValue());
+ }
+ }
+
+ public void setOffset(Long offset) {
if (offset != null) {
parameters.put(KEY_OFFSET, offset);
} else {
@@ -142,16 +154,34 @@ public class PutFile extends RPCRequest {
}
}
- public Integer getOffset() {
+ public Long getOffset() {
final Object o = parameters.get(KEY_OFFSET);
+ if (o == null){
+ return null;
+ }
if (o instanceof Integer) {
- return (Integer) o;
+ return ((Integer) o).longValue();
+ }else if(o instanceof Long){
+ return (Long) o;
}
+
return null;
}
+ /**
+ * @deprecated as of SmartDeviceLink 4.0
+ * @param length
+ */
public void setLength(Integer length) {
+ if(length == null){
+ setLength((Long)null);
+ }else{
+ setLength(length.longValue());
+ }
+ }
+
+ public void setLength(Long length) {
if (length != null) {
parameters.put(KEY_LENGTH, length);
} else {
@@ -159,10 +189,15 @@ public class PutFile extends RPCRequest {
}
}
- public Integer getLength() {
+ public Long getLength() {
final Object o = parameters.get(KEY_LENGTH);
+ if (o == null){
+ return null;
+ }
if (o instanceof Integer) {
- return (Integer) o;
+ return ((Integer) o).longValue();
+ }else if(o instanceof Long){
+ return (Long) o;
}
return null;
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 d37b5b62e..88c0560b3 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFileResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/PutFileResponse.java
@@ -17,7 +17,7 @@ public class PutFileResponse extends RPCResponse {
* Constructs a new PutFileResponse object
*/
public PutFileResponse() {
- super(FunctionID.PUT_FILE);
+ super(FunctionID.PUT_FILE.toString());
}
/**
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 b3212eb09..f165ae050 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDID.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDID.java
@@ -26,7 +26,7 @@ public class ReadDID extends RPCRequest {
* Constructs a new ReadDID object
*/
public ReadDID() {
- super(FunctionID.READ_DID);
+ super(FunctionID.READ_DID.toString());
}
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java
index 8f3bd0f8a..b21395b48 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ReadDIDResponse.java
@@ -6,7 +6,6 @@ import java.util.List;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.proxy.rpc.DIDResult;
/**
* Read DID Response is sent, when ReadDID has been called
@@ -17,7 +16,7 @@ public class ReadDIDResponse extends RPCResponse {
public static final String KEY_DID_RESULT = "didResult";
public ReadDIDResponse() {
- super(FunctionID.READ_DID);
+ super(FunctionID.READ_DID.toString());
}
public ReadDIDResponse(Hashtable<String, Object> hash) {
super(hash);
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 ea6dc5637..8af901be3 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterface.java
@@ -96,7 +96,7 @@ public class RegisterAppInterface extends RPCRequest {
* Constructs a new RegisterAppInterface object
*/
public RegisterAppInterface() {
- super(FunctionID.REGISTER_APP_INTERFACE);
+ super(FunctionID.REGISTER_APP_INTERFACE.toString());
}
/**
* Constructs a new RegisterAppInterface object indicated by the Hashtable
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 76afbe3c4..05a96160c 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
@@ -19,25 +19,30 @@ import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
* @since SmartDeviceLink 1.0
*/
public class RegisterAppInterfaceResponse extends RPCResponse {
- public static final String KEY_VEHICLE_TYPE = "vehicleType";
- public static final String KEY_SPEECH_CAPABILITIES = "speechCapabilities";
- public static final String KEY_VR_CAPABILITIES = "vrCapabilities";
+ public static final String KEY_VEHICLE_TYPE = "vehicleType";
+ public static final String KEY_SPEECH_CAPABILITIES = "speechCapabilities";
+ public static final String KEY_VR_CAPABILITIES = "vrCapabilities";
public static final String KEY_AUDIO_PASS_THRU_CAPABILITIES = "audioPassThruCapabilities";
- public static final String KEY_HMI_ZONE_CAPABILITIES = "hmiZoneCapabilities";
- public static final String KEY_PRERECORDED_SPEECH = "prerecordedSpeech";
- public static final String KEY_SUPPORTED_DIAG_MODES = "supportedDiagModes";
- public static final String KEY_SDL_MSG_VERSION = "syncMsgVersion";
- public static final String KEY_LANGUAGE = "language";
- public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
- public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
- public static final String KEY_HMI_DISPLAY_LANGUAGE = "hmiDisplayLanguage";
- public static final String KEY_SOFT_BUTTON_CAPABILITIES = "softButtonCapabilities";
- public static final String KEY_PRESET_BANK_CAPABILITIES = "presetBankCapabilities";
+ public static final String KEY_HMI_ZONE_CAPABILITIES = "hmiZoneCapabilities";
+ public static final String KEY_PRERECORDED_SPEECH = "prerecordedSpeech";
+ public static final String KEY_SUPPORTED_DIAG_MODES = "supportedDiagModes";
+ public static final String KEY_SDL_MSG_VERSION = "syncMsgVersion";
+ public static final String KEY_LANGUAGE = "language";
+ public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
+ public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
+ public static final String KEY_HMI_DISPLAY_LANGUAGE = "hmiDisplayLanguage";
+ public static final String KEY_SOFT_BUTTON_CAPABILITIES = "softButtonCapabilities";
+ public static final String KEY_PRESET_BANK_CAPABILITIES = "presetBankCapabilities";
+ public static final String KEY_HMI_CAPABILITIES = "hmiCapabilities"; //As of v4.0
+ public static final String KEY_SDL_VERSION = "sdlVersion"; //As of v4.0
+ public static final String KEY_SYSTEM_SOFTWARE_VERSION = "systemSoftwareVersion"; //As of v4.0
+
+
/**
* Constructs a new RegisterAppInterfaceResponse object
*/
public RegisterAppInterfaceResponse() {
- super(FunctionID.REGISTER_APP_INTERFACE);
+ super(FunctionID.REGISTER_APP_INTERFACE.toString());
}
/**
@@ -533,5 +538,48 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
}
}
return null;
- }
+ }
+
+ public void setHmiCapabilities(HMICapabilities hmiCapabilities) {
+ if (hmiCapabilities != null) {
+ parameters.put(KEY_HMI_CAPABILITIES, hmiCapabilities);
+ }else{
+ parameters.remove(KEY_HMI_CAPABILITIES);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public HMICapabilities getHmiCapabilities() {
+ Object obj = parameters.get(KEY_HMI_CAPABILITIES);
+ if (obj instanceof HMICapabilities) {
+ return (HMICapabilities)obj;
+ } else if (obj instanceof Hashtable) {
+ return new HMICapabilities((Hashtable<String, Object>)obj);
+ }
+ return null;
+ }
+
+ public void setSdlVersion(String sdlVersion) {
+ if (sdlVersion != null) {
+ parameters.put(KEY_SDL_VERSION, sdlVersion);
+ }else{
+ parameters.remove(KEY_SDL_VERSION);
+ }
+ }
+
+ public String getSdlVersion() {
+ return (String) parameters.get(KEY_SDL_VERSION);
+ }
+
+ public void setSystemSoftwareVersion(String systemSoftwareVersion) {
+ if (systemSoftwareVersion != null) {
+ parameters.put(KEY_SYSTEM_SOFTWARE_VERSION, systemSoftwareVersion);
+ }else{
+ parameters.remove(KEY_SYSTEM_SOFTWARE_VERSION);
+ }
+ }
+
+ public String getSystemSoftwareVersion() {
+ return (String) parameters.get(KEY_SYSTEM_SOFTWARE_VERSION);
+ }
}
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 2ccda1100..1121ce2c8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalProperties.java
@@ -29,7 +29,7 @@ public class ResetGlobalProperties extends RPCRequest {
* Constructs a new ResetGlobalProperties object
*/
public ResetGlobalProperties() {
- super(FunctionID.RESET_GLOBAL_PROPERTIES);
+ super(FunctionID.RESET_GLOBAL_PROPERTIES.toString());
}
/**
* Constructs a new ResetGlobalProperties object indicated by the Hashtable
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 0fe7f0d80..3390fb814 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ResetGlobalPropertiesResponse.java
@@ -16,7 +16,7 @@ public class ResetGlobalPropertiesResponse extends RPCResponse {
* Constructs a new ResetGlobalPropertiesResponse object
*/
public ResetGlobalPropertiesResponse() {
- super(FunctionID.RESET_GLOBAL_PROPERTIES);
+ super(FunctionID.RESET_GLOBAL_PROPERTIES.toString());
}
/**
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 22eb073cf..3f9e75cce 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
@@ -25,7 +25,7 @@ public class ScrollableMessage extends RPCRequest {
* Constructs a new ScrollableMessage object
*/
public ScrollableMessage() {
- super(FunctionID.SCROLLABLE_MESSAGE);
+ super(FunctionID.SCROLLABLE_MESSAGE.toString());
}
/**
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 f1f5b8a03..970782f35 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ScrollableMessageResponse.java
@@ -16,7 +16,7 @@ public class ScrollableMessageResponse extends RPCResponse {
* Constructs a new ScrollableMessageResponse object
*/
public ScrollableMessageResponse() {
- super(FunctionID.SCROLLABLE_MESSAGE);
+ super(FunctionID.SCROLLABLE_MESSAGE.toString());
}
/**
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 cd37eea74..0257a4c1c 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java
@@ -5,6 +5,7 @@ import java.util.List;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.util.SdlDataTypeConverter;
/**
@@ -27,7 +28,7 @@ public class SendLocation extends RPCRequest{
* Constructs a new SendLocation object
*/
public SendLocation(){
- super(FunctionID.SEND_LOCATION);
+ super(FunctionID.SEND_LOCATION.toString());
}
/**
@@ -44,17 +45,24 @@ 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,
+ * but cause a ClassCastException if your value is not also a Double type.
+ * @since SmartDeviceLink v4.0
+ *
* @return The longitude of the location
*/
- public Float getLongitudeDegrees(){
- return (Float) parameters.get(KEY_LON_DEGREES);
+ public Double getLongitudeDegrees(){
+ Object value = parameters.get(KEY_LON_DEGREES);
+ return SdlDataTypeConverter.objectToDouble(value);
}
/**
* Setter for longitude of the location to send.
* @param longitudeDegrees
*/
- public void setLongitudeDegrees(Float longitudeDegrees){
+ public void setLongitudeDegrees(Double longitudeDegrees){
if(longitudeDegrees != null){
parameters.put(KEY_LON_DEGREES, longitudeDegrees);
}
@@ -65,17 +73,24 @@ 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,
+ * but cause a ClassCastException if your value is not also a Double type.
+ * @since SmartDeviceLink v4.0
+ *
* @return The latitude of the location
*/
- public Float getLatitudeDegrees(){
- return (Float) parameters.get(KEY_LAT_DEGREES);
+ public Double getLatitudeDegrees(){
+ Object value = parameters.get(KEY_LAT_DEGREES);
+ return SdlDataTypeConverter.objectToDouble(value);
}
/**
* Setter for latitude of the location to send.
* @param latitudeDegrees
*/
- public void setLatitudeDegrees(Float latitudeDegrees){
+ public void setLatitudeDegrees(Double latitudeDegrees){
if(latitudeDegrees != null){
parameters.put(KEY_LAT_DEGREES, latitudeDegrees);
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocationResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocationResponse.java
index 32037188c..dcee04e9a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocationResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocationResponse.java
@@ -13,7 +13,7 @@ import com.smartdevicelink.proxy.RPCResponse;
public class SendLocationResponse extends RPCResponse{
public SendLocationResponse(){
- super(FunctionID.SEND_LOCATION);
+ super(FunctionID.SEND_LOCATION.toString());
}
public SendLocationResponse(Hashtable<String, Object> hash){
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 4eb2ce3ec..1a5d5a22e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIcon.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIcon.java
@@ -19,7 +19,7 @@ public class SetAppIcon extends RPCRequest {
* Constructs a new SetAppIcon object
*/
public SetAppIcon() {
- super(FunctionID.SET_APP_ICON);
+ super(FunctionID.SET_APP_ICON.toString());
}
/**
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 3af51b2a6..9d154bebf 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetAppIconResponse.java
@@ -8,7 +8,7 @@ import com.smartdevicelink.proxy.RPCResponse;
public class SetAppIconResponse extends RPCResponse {
public SetAppIconResponse() {
- super(FunctionID.SET_APP_ICON);
+ super(FunctionID.SET_APP_ICON.toString());
}
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 d62d4f6a4..ec3b1e62e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
@@ -18,7 +18,7 @@ public class SetDisplayLayout extends RPCRequest {
* Constructs a new SetDisplayLayout object
*/
public SetDisplayLayout() {
- super(FunctionID.SET_DISPLAY_LAYOUT);
+ super(FunctionID.SET_DISPLAY_LAYOUT.toString());
}
/**
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 b531b2bc1..787bdd9f7 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
@@ -22,7 +22,7 @@ public class SetDisplayLayoutResponse extends RPCResponse {
* Constructs a new SetDisplayLayoutResponse object
*/
public SetDisplayLayoutResponse() {
- super(FunctionID.SET_DISPLAY_LAYOUT);
+ super(FunctionID.SET_DISPLAY_LAYOUT.toString());
}
/**
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 f4c4dee71..be1f13bb8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
@@ -29,7 +29,7 @@ public class SetGlobalProperties extends RPCRequest {
* Constructs a new SetGlobalProperties object
*/
public SetGlobalProperties() {
- super(FunctionID.SET_GLOBAL_PROPERTIES);
+ super(FunctionID.SET_GLOBAL_PROPERTIES.toString());
}
/**
* Constructs a new SetGlobalProperties object indicated by the Hashtable
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 00d4b9e61..bef494e69 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetGlobalPropertiesResponse.java
@@ -16,7 +16,7 @@ public class SetGlobalPropertiesResponse extends RPCResponse {
* Constructs a new SetGlobalPropertiesResponse object
*/
public SetGlobalPropertiesResponse() {
- super(FunctionID.SET_GLOBAL_PROPERTIES);
+ super(FunctionID.SET_GLOBAL_PROPERTIES.toString());
}
/**
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 3c157c821..2b8f33365 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimer.java
@@ -23,7 +23,7 @@ public class SetMediaClockTimer extends RPCRequest {
* Constructs a new SetMediaClockTimer object
*/
public SetMediaClockTimer() {
- super(FunctionID.SET_MEDIA_CLOCK_TIMER);
+ super(FunctionID.SET_MEDIA_CLOCK_TIMER.toString());
}
/**
* Constructs a new SetMediaClockTimer object indicated by the Hashtable
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 43b10d3db..410b5b68c 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SetMediaClockTimerResponse.java
@@ -16,7 +16,7 @@ public class SetMediaClockTimerResponse extends RPCResponse {
* Constructs a new SetMediaClockTimerResponse object
*/
public SetMediaClockTimerResponse() {
- super(FunctionID.SET_MEDIA_CLOCK_TIMER);
+ super(FunctionID.SET_MEDIA_CLOCK_TIMER.toString());
}
/**
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 57ede4cdb..9782b0e7f 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Show.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Show.java
@@ -49,7 +49,7 @@ public class Show extends RPCRequest {
* Constructs a new Show object
*/
public Show() {
- super(FunctionID.SHOW);
+ super(FunctionID.SHOW.toString());
}
/**
* Constructs a new Show object indicated by the Hashtable parameter
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 e53851e94..293adddbe 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbt.java
@@ -38,7 +38,7 @@ public class ShowConstantTbt extends RPCRequest{
* Constructs a new ShowConstantTbt object
*/
public ShowConstantTbt(){
- super(FunctionID.SHOW_CONSTANT_TBT);
+ super(FunctionID.SHOW_CONSTANT_TBT.toString());
}
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java
index fb00da92e..a3e2dbaf1 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowConstantTbtResponse.java
@@ -13,7 +13,7 @@ import com.smartdevicelink.proxy.RPCResponse;
public class ShowConstantTbtResponse extends RPCResponse{
public ShowConstantTbtResponse() {
- super(FunctionID.SHOW_CONSTANT_TBT);
+ super(FunctionID.SHOW_CONSTANT_TBT.toString());
}
public ShowConstantTbtResponse(Hashtable<String, Object> hash) {
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 8f28e0df7..e12c09029 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ShowResponse.java
@@ -16,7 +16,7 @@ public class ShowResponse extends RPCResponse {
* Constructs a new ShowResponse object
*/
public ShowResponse() {
- super(FunctionID.SHOW);
+ super(FunctionID.SHOW.toString());
}
/**
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 47a6840d9..4cf914f43 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Slider.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Slider.java
@@ -29,7 +29,7 @@ public class Slider extends RPCRequest {
* Constructs a new Slider object
*/
public Slider() {
- super(FunctionID.SLIDER);
+ super(FunctionID.SLIDER.toString());
}
/**
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 8df4fc511..6d168b6ea 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SliderResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SliderResponse.java
@@ -17,7 +17,7 @@ public class SliderResponse extends RPCResponse {
* Constructs a new SliderResponse object
*/
public SliderResponse() {
- super(FunctionID.SLIDER);
+ super(FunctionID.SLIDER.toString());
}
/**
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 5e74da031..27183af86 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Speak.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Speak.java
@@ -79,7 +79,7 @@ public class Speak extends RPCRequest {
* Constructs a new Speak object
*/
public Speak() {
- super(FunctionID.SPEAK);
+ super(FunctionID.SPEAK.toString());
}
/**
* Constructs a new Speak object indicated by the Hashtable parameter
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 700beda0b..3e7be103c 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SpeakResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SpeakResponse.java
@@ -16,7 +16,7 @@ public class SpeakResponse extends RPCResponse {
* Constructs a new SpeakResponse object
*/
public SpeakResponse() {
- super(FunctionID.SPEAK);
+ super(FunctionID.SPEAK.toString());
}
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/StreamRPCResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/StreamRPCResponse.java
new file mode 100644
index 000000000..bd75bef6d
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/StreamRPCResponse.java
@@ -0,0 +1,41 @@
+package com.smartdevicelink.proxy.rpc;
+
+import java.util.Hashtable;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+
+public class StreamRPCResponse extends RPCResponse {
+ public static final String KEY_FILENAME = "fileName";
+ public static final String KEY_FILESIZE = "fileSize";
+
+ public StreamRPCResponse() {
+ super(FunctionID.STREAM_RPC.toString());
+ }
+ public StreamRPCResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public void setFileName(String fileName) {
+ if (fileName != null) {
+ parameters.put(KEY_FILENAME, fileName);
+ } else {
+ parameters.remove(KEY_FILENAME);
+ }
+ }
+ public String getFileName() {
+ return (String) parameters.get(KEY_FILENAME);
+ }
+
+ public void setFileSize(Long fileSize) {
+ if (fileSize != null) {
+ parameters.put(KEY_FILESIZE, fileSize);
+ } else {
+ parameters.remove(KEY_FILESIZE);
+ }
+ }
+ public Long getFileSize() {
+ return (Long) parameters.get(KEY_FILESIZE);
+ }
+
+}
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 f063eecf6..9f09fb5fa 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButton.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButton.java
@@ -62,7 +62,7 @@ public class SubscribeButton extends RPCRequest {
* Constructs a new SubscribeButton object
*/
public SubscribeButton() {
- super(FunctionID.SUBSCRIBE_BUTTON);
+ super(FunctionID.SUBSCRIBE_BUTTON.toString());
}
/**
* Constructs a new SubscribeButton object indicated by the Hashtable
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 cc70b95bd..b51f75eee 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeButtonResponse.java
@@ -16,7 +16,7 @@ public class SubscribeButtonResponse extends RPCResponse {
* Constructs a new SubscribeButtonResponse object
*/
public SubscribeButtonResponse() {
- super(FunctionID.SUBSCRIBE_BUTTON);
+ super(FunctionID.SUBSCRIBE_BUTTON.toString());
}
/**
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 222e1a958..10333d3d0 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
@@ -51,7 +51,7 @@ public class SubscribeVehicleData extends RPCRequest {
* Constructs a new SubscribeVehicleData object
*/
public SubscribeVehicleData() {
- super(FunctionID.SUBSCRIBE_VEHICLE_DATA);
+ super(FunctionID.SUBSCRIBE_VEHICLE_DATA.toString());
}
/**
@@ -171,11 +171,7 @@ public class SubscribeVehicleData extends RPCRequest {
*/
@Deprecated
public void setFuelLevel_State(Boolean fuelLevel_State) {
- if (fuelLevel_State != null) {
- parameters.put(KEY_FUEL_LEVEL_STATE, fuelLevel_State);
- } else {
- parameters.remove(KEY_FUEL_LEVEL_STATE);
- }
+ setFuelLevelState(fuelLevel_State);
}
/**
@@ -187,7 +183,7 @@ public class SubscribeVehicleData extends RPCRequest {
*/
@Deprecated
public Boolean getFuelLevel_State() {
- return (Boolean) parameters.get(KEY_FUEL_LEVEL_STATE);
+ return getFuelLevelState();
}
/**
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 76b62a050..327e0f7d6 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
@@ -41,7 +41,7 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* Constructs a new SubscribeVehicleDataResponse object
*/
public SubscribeVehicleDataResponse() {
- super(FunctionID.SUBSCRIBE_VEHICLE_DATA);
+ super(FunctionID.SUBSCRIBE_VEHICLE_DATA.toString());
}
/**
@@ -177,30 +177,15 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
*/
@Deprecated
public void setFuelLevel_State(VehicleDataResult fuelLevel_State) {
- if (fuelLevel_State != null) {
- parameters.put(KEY_FUEL_LEVEL_STATE, fuelLevel_State);
- } else {
- parameters.remove(KEY_FUEL_LEVEL_STATE);
- }
+ setFuelLevelState(fuelLevel_State);
}
/**
* Gets Fuel Level State
* @return VehicleDataResult
*/
@Deprecated
- @SuppressWarnings("unchecked")
public VehicleDataResult getFuelLevel_State() {
- Object obj = parameters.get(KEY_FUEL_LEVEL_STATE);
- if (obj instanceof VehicleDataResult) {
- return (VehicleDataResult) obj;
- } else if (obj instanceof Hashtable) {
- try {
- return new VehicleDataResult((Hashtable<String, Object>) obj);
- } catch (Exception e) {
- DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + KEY_FUEL_LEVEL_STATE, e);
- }
- }
- return null;
+ return getFuelLevelState();
}
/**
* Sets Fuel Level State
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 0794cb135..94fe62353 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequest.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequest.java
@@ -13,11 +13,11 @@ public class SystemRequest extends RPCRequest {
public static final String KEY_DATA = "data";
public SystemRequest() {
- super(FunctionID.SYSTEM_REQUEST);
+ super(FunctionID.SYSTEM_REQUEST.toString());
}
public SystemRequest(boolean bLegacy) {
- super(FunctionID.ENCODED_SYNC_P_DATA);
+ super(FunctionID.ENCODED_SYNC_P_DATA.toString());
}
public SystemRequest(Hashtable<String, Object> hash) {
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 0f9307258..201c186c8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SystemRequestResponse.java
@@ -1,13 +1,13 @@
package com.smartdevicelink.proxy.rpc;
+import java.util.Hashtable;
+
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
-import java.util.Hashtable;
-
public class SystemRequestResponse extends RPCResponse {
public SystemRequestResponse() {
- super(FunctionID.SYSTEM_REQUEST);
+ super(FunctionID.SYSTEM_REQUEST.toString());
}
public SystemRequestResponse(Hashtable<String, Object> 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 34fa27c53..a204fae8e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEvent.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/TouchEvent.java
@@ -10,41 +10,55 @@ public class TouchEvent extends RPCStruct {
public static final String KEY_ID = "id";
public static final String KEY_TS = "ts";
public static final String KEY_C = "c";
+
public TouchEvent() { }
public TouchEvent(Hashtable<String, Object> hash) {
super(hash);
}
+
public void setId(Integer id) {
if (id != null) {
store.put(KEY_ID, id);
} else {
store.remove(KEY_ID);
}
- }
+ }
+
public Integer getId() {
return (Integer) store.get(KEY_ID);
- }
+ }
+
@SuppressWarnings("unchecked")
- public List<Integer> getTs() {
+ public List<Long> getTs() {
if(store.get(KEY_TS) instanceof List<?>){
List<?> list = (List<?>)store.get(KEY_TS);
if(list != null && list.size()>0){
Object obj = list.get(0);
- if(obj instanceof Integer){
- return (List<Integer>) list;
- }
- }
+ if(obj instanceof Integer){ //Backwards case
+ int size = list.size();
+ List<Integer> listOfInt = (List<Integer>) list;
+ List<Long> listofLongs = new ArrayList<Long>(size);
+ for(int i = 0; i<size;i++){
+ listofLongs.add(listOfInt.get(i).longValue());
+ }
+ return listofLongs;
+ }else if(obj instanceof Long){
+ return (List<Long>) list;
+ }
+ }
}
return null;
}
- public void setTs(List<Integer> ts) {
+
+ public void setTs(List<Long> ts) {
if (ts != null) {
store.put(KEY_TS, ts);
} else {
store.remove(KEY_TS);
}
}
+
@SuppressWarnings("unchecked")
public List<TouchCoord> getC() {
if (store.get(KEY_C) instanceof List<?>) {
@@ -64,6 +78,7 @@ public class TouchEvent extends RPCStruct {
}
return null;
}
+
public void setC( List<TouchCoord> c ) {
if (c != null) {
store.put(KEY_C, c );
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 5990f7a83..aafdb53f9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterface.java
@@ -26,7 +26,7 @@ public class UnregisterAppInterface extends RPCRequest {
* Constructs a new UnregisterAppInterface object
*/
public UnregisterAppInterface() {
- super(FunctionID.UNREGISTER_APP_INTERFACE);
+ super(FunctionID.UNREGISTER_APP_INTERFACE.toString());
}
/**
* Constructs a new UnregisterAppInterface object indicated by the Hashtable
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 d9b56ca79..db425a503 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnregisterAppInterfaceResponse.java
@@ -16,7 +16,7 @@ public class UnregisterAppInterfaceResponse extends RPCResponse {
* Constructs a new UnregisterAppInterfaceResponse object
*/
public UnregisterAppInterfaceResponse() {
- super(FunctionID.UNREGISTER_APP_INTERFACE);
+ super(FunctionID.UNREGISTER_APP_INTERFACE.toString());
}
/**
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 a81db0386..7575fd84a 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButton.java
@@ -26,7 +26,7 @@ public class UnsubscribeButton extends RPCRequest {
* Constructs a new UnsubscribeButton object
*/
public UnsubscribeButton() {
- super(FunctionID.UNSUBSCRIBE_BUTTON);
+ super(FunctionID.UNSUBSCRIBE_BUTTON.toString());
}
/**
* Constructs a new UnsubscribeButton object indicated by the Hashtable
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 1d4c3e23a..58f7326e1 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeButtonResponse.java
@@ -16,7 +16,7 @@ public class UnsubscribeButtonResponse extends RPCResponse {
* Constructs a new UnsubscribeButtonResponse object
*/
public UnsubscribeButtonResponse() {
- super(FunctionID.UNSUBSCRIBE_BUTTON);
+ super(FunctionID.UNSUBSCRIBE_BUTTON.toString());
}
/**
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 20f9e2e84..429049d59 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
@@ -49,7 +49,7 @@ public class UnsubscribeVehicleData extends RPCRequest {
* Constructs a new UnsubscribeVehicleData object
*/
public UnsubscribeVehicleData() {
- super(FunctionID.UNSUBSCRIBE_VEHICLE_DATA);
+ super(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString());
}
/**
@@ -169,11 +169,7 @@ public class UnsubscribeVehicleData extends RPCRequest {
*/
@Deprecated
public void setFuelLevel_State(Boolean fuelLevel_State) {
- if (fuelLevel_State != null) {
- parameters.put(KEY_FUEL_LEVEL_STATE, fuelLevel_State);
- } else {
- parameters.remove(KEY_FUEL_LEVEL_STATE);
- }
+ setFuelLevelState(fuelLevel_State);
}
/**
@@ -185,7 +181,7 @@ public class UnsubscribeVehicleData extends RPCRequest {
*/
@Deprecated
public Boolean getFuelLevel_State() {
- return (Boolean) parameters.get(KEY_FUEL_LEVEL_STATE);
+ return getFuelLevelState();
}
/**
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 1150a755b..9d2cbf5bb 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
@@ -41,7 +41,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
* Constructs a new UnsubscribeVehicleDataResponse object
*/
public UnsubscribeVehicleDataResponse() {
- super(FunctionID.UNSUBSCRIBE_VEHICLE_DATA);
+ super(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString());
}
/**
@@ -177,30 +177,15 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
*/
@Deprecated
public void setFuelLevel_State(VehicleDataResult fuelLevel_State) {
- if (fuelLevel_State != null) {
- parameters.put(KEY_FUEL_LEVEL_STATE, fuelLevel_State);
- } else {
- parameters.remove(KEY_FUEL_LEVEL_STATE);
- }
+ setFuelLevel(fuelLevel_State);
}
/**
* Gets Fuel Level State
* @return VehicleDataResult
*/
@Deprecated
- @SuppressWarnings("unchecked")
public VehicleDataResult getFuelLevel_State() {
- Object obj = parameters.get(KEY_FUEL_LEVEL_STATE);
- if (obj instanceof VehicleDataResult) {
- return (VehicleDataResult) obj;
- } else if (obj instanceof Hashtable) {
- try {
- return new VehicleDataResult((Hashtable<String, Object>) obj);
- } catch (Exception e) {
- DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + KEY_FUEL_LEVEL_STATE, e);
- }
- }
- return null;
+ return getFuelLevelState();
}
/**
* Sets Fuel Level State
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 442c0dee2..fd4f88fa8 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnList.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnList.java
@@ -27,7 +27,7 @@ public class UpdateTurnList extends RPCRequest{
* Constructs a new UpdateTurnList object
*/
public UpdateTurnList() {
- super(FunctionID.UPDATE_TURN_LIST);
+ super(FunctionID.UPDATE_TURN_LIST.toString());
}
/**
@@ -67,8 +67,8 @@ public class UpdateTurnList extends RPCRequest{
*/
@SuppressWarnings("unchecked")
public List<Turn> getTurnList(){
- if(parameters.get(KEY_SOFT_BUTTONS) instanceof List<?>){
- List<?> list = (List<?>) parameters.get(KEY_SOFT_BUTTONS);
+ if(parameters.get(KEY_TURN_LIST) instanceof List<?>){
+ List<?> list = (List<?>) parameters.get(KEY_TURN_LIST);
if(list != null && list.size() > 0){
Object obj = list.get(0);
if(obj instanceof Turn){
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java
index c62315188..add51c5a5 100644
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java
+++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/UpdateTurnListResponse.java
@@ -16,7 +16,7 @@ public class UpdateTurnListResponse extends RPCResponse{
* Constructs a new UpdateTurnListResponse object
*/
public UpdateTurnListResponse() {
- super(FunctionID.UPDATE_TURN_LIST);
+ super(FunctionID.UPDATE_TURN_LIST.toString());
}
public UpdateTurnListResponse(Hashtable<String, Object> hash) {
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 9b20704b5..617fe9796 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
@@ -75,7 +75,14 @@ public enum AppInterfaceUnregisteredReason {
*
* @since SmartDeviceLink 2.0
*/
- APP_UNAUTHORIZED;
+ APP_UNAUTHORIZED,
+ /**
+ * The app has committed a protocol violation.
+ *
+ * @since SmartDeviceLink 4.0
+ */
+ PROTOCOL_VIOLATION,
+ ;
public static AppInterfaceUnregisteredReason valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/GearShiftAdviceStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/GearShiftAdviceStatus.java
deleted file mode 100644
index 58eed6f62..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/GearShiftAdviceStatus.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.smartdevicelink.proxy.rpc.enums;
-
-public enum GearShiftAdviceStatus {
- NO_INDICATION,
- UPSHIFT_FUEL_ECONOMY,
- UPSHIFT_PERFORMANCE,
- UPSHIFT_WARNING,
- DOWNSHIFT_RECOMMENDATION,
- SHIFT_TO_NEUTRAL;
-
- public static GearShiftAdviceStatus valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
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 fb88cec4d..34971d10d 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
@@ -11,7 +11,14 @@ public enum ImageFieldName {
appIcon,
graphic,
showConstantTBTIcon,
- showConstantTBTNextTurnIcon;
+ showConstantTBTNextTurnIcon,
+ /**
+ * The optional image of a destination / location
+ *
+ * @since SmartDeviceLink 4.0
+ */
+ locationImage,
+ ;
public static ImageFieldName valueForString(String value) {
try{
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 89c1c5f7d..524ee632c 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
@@ -5,7 +5,12 @@ public enum KeyboardEvent {
KEYPRESS,
ENTRY_SUBMITTED,
ENTRY_CANCELLED,
- ENTRY_ABORTED;
+ ENTRY_ABORTED,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ ENTRY_VOICE,
+ ;
public static KeyboardEvent valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LightSwitchStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LightSwitchStatus.java
deleted file mode 100644
index 23595da9c..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/LightSwitchStatus.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.smartdevicelink.proxy.rpc.enums;
-
-public enum LightSwitchStatus {
- OFF,
- PARKLAMP,
- HEADLAMP,
- AUTOLAMP;
-
- public static LightSwitchStatus valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java
deleted file mode 100644
index a4e2fcf2f..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.smartdevicelink.proxy.rpc.enums;
-
-public enum MaintenanceModeStatus {
- NORMAL,
- NEAR,
- ACTIVE,
- FEATURE_NOT_PRESENT;
-
- public static MaintenanceModeStatus valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MessageType.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MessageType.java
deleted file mode 100644
index 85da8deb7..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/MessageType.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.smartdevicelink.proxy.rpc.enums;
-
-public enum MessageType {
- request,
- response,
- notification;
-
- public static MessageType valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java
deleted file mode 100644
index e96a03a40..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.smartdevicelink.proxy.rpc.enums;
-
-/**
- * Enumeration that describes possible permission states of a policy table entry.
- * @since SmartDeviceLink 2.0
- */
-public enum PermissionStatus {
- ALLOWED,
- DISALLOWED,
- USER_DISALLOWED,
- USER_CONSENT_PENDING;
-
- /**
- * Convert String to PermissionStatus
- * @param value String
- * @return PermissionStatus
- */
- public static PermissionStatus valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
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 eac743ee4..5d8198884 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
@@ -7,7 +7,64 @@ public enum RequestType {
AUTH_REQUEST,
AUTH_CHALLENGE,
AUTH_ACK,
- PROPRIETARY;
+ PROPRIETARY,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ QUERY_APPS,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ LAUNCH_APP,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ LOCK_SCREEN_ICON_URL,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ TRAFFIC_MESSAGE_CHANNEL,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ DRIVER_PROFILE,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ VOICE_SEARCH,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ NAVIGATION,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ PHONE,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ CLIMATE,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ SETTINGS,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ VEHICLE_DIAGNOSTICS,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ EMERGENCY,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ MEDIA,
+ /**
+ * @since SmartDeviceLink 4.0
+ */
+ FOTA,
+ ;
public static RequestType valueForString(String value) {
try{
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 8cba57e39..557069c15 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
@@ -88,9 +88,12 @@ public enum Result {
*/
IN_USE,
/**
- * There is already an existing subscription for this item
+ *The user has turned off access to vehicle data, and it is globally unavailable to mobile applications.
*/
VEHICLE_DATA_NOT_ALLOWED,
+ /**
+ * The requested vehicle data is not available on this vehicle or is not published.
+ */
VEHICLE_DATA_NOT_AVAILABLE,
/**
* The requested operation was rejected. No attempt was made to perform the
@@ -114,18 +117,57 @@ public enum Result {
* information on supported buttons on the currently connected SDL platform
*/
UNSUPPORTED_RESOURCE,
+ /**
+ * A specified file could not be found on Sync.
+ */
FILE_NOT_FOUND,
+ /**
+ * Provided data is valid but something went wrong in the lower layers.
+ */
GENERIC_ERROR,
+ /**
+ * RPC is not authorized in local policy table.
+ */
DISALLOWED,
+ /**
+ * RPC is included in a functional group explicitly blocked by the user.
+ */
USER_DISALLOWED,
+ /**
+ * Overlay reached the maximum timeout and closed.
+ */
TIMED_OUT,
+ /**
+ * User selected to Cancel Route.
+ */
CANCEL_ROUTE,
+ /**
+ * The RPC (e.g. ReadDID) executed successfully but the data exceeded the platform maximum threshold and thus, only part of the data is available.
+ */
TRUNCATED_DATA,
+ /**
+ * The user interrupted the RPC (e.g. PerformAudioPassThru) and indicated to start over. Note, the app must issue the new RPC.
+ */
RETRY,
+ /**
+ * The RPC (e.g. SubscribeVehicleData) executed successfully but one or more items have a warning or failure.
+ */
WARNINGS,
+ /**
+ * The RPC (e.g. Slider) executed successfully and the user elected to save the current position / value.
+ */
SAVED,
+ /**
+ * The certificate provided during authentication is invalid.
+ */
INVALID_CERT,
+ /**
+ * The certificate provided during authentication is expired.
+ */
EXPIRED_CERT,
+ /**
+ * 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;
public static Result valueForString(String value) {
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 26a3e9de2..073741e3a 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
@@ -24,7 +24,32 @@ public enum TextFieldName {
menuName,
secondaryText,
tertiaryText,
- menuTitle;
+ menuTitle,
+ /**
+ * Optional name / title of intended location for SendLocation.
+ *
+ * @since SmartDeviceLink 4.0
+ */
+ locationName,
+ /**
+ * Optional description of intended location / establishment (if applicable) for SendLocation
+ *
+ * @since SmartDeviceLink 4.0
+ */
+ locationDescription,
+ /**
+ * Optional location address (if applicable) for SendLocation.
+ *
+ * @since SmartDeviceLink 4.0
+ */
+ addressLines,
+ /**
+ * Optional hone number of intended location / establishment (if applicable) for SendLocation.
+ *
+ * @since SmartDeviceLink 4.0
+ */
+ phoneNumber,
+ ;
public static TextFieldName valueForString(String value) {
try{
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TirePressureTellTale.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TirePressureTellTale.java
deleted file mode 100644
index 881cf3575..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/TirePressureTellTale.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.smartdevicelink.proxy.rpc.enums;
-
-public enum TirePressureTellTale {
- OFF,
- ON,
- FLASH;
-
- public static TirePressureTellTale valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java
deleted file mode 100644
index 3238ae667..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.smartdevicelink.proxy.rpc.enums;
-
-public enum VehicleDataActiveStatus {
- INACTIVE_NOT_CONFIRMED,
- INACTIVE_CONFIRMED,
- ACTIVE_NOT_CONFIRMED,
- ACTIVE_CONFIRMED,
- FAULT;
-
- public static VehicleDataActiveStatus valueForString(String value) {
- try{
- return valueOf(value);
- }catch(Exception e){
- return null;
- }
- }
-}
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 2df9f3bae..8de4ca88f 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
@@ -2,6 +2,12 @@ package com.smartdevicelink.proxy.rpc.enums;
public enum VehicleDataResultCode {
SUCCESS,
+ /**
+ *DTC / DID request successful, however, not all active DTCs or full contents of DID location available
+ *
+ * @since SmartDeviceLink 4.0
+ */
+ TRUNCATED_DATA,
DISALLOWED,
USER_DISALLOWED,
INVALID_ID,
diff --git a/sdl_android_lib/src/com/smartdevicelink/streaming/AbstractPacketizer.java b/sdl_android_lib/src/com/smartdevicelink/streaming/AbstractPacketizer.java
index 65795d9de..88a1dea81 100644
--- a/sdl_android_lib/src/com/smartdevicelink/streaming/AbstractPacketizer.java
+++ b/sdl_android_lib/src/com/smartdevicelink/streaming/AbstractPacketizer.java
@@ -9,12 +9,12 @@ import com.smartdevicelink.proxy.RPCRequest;
abstract public class AbstractPacketizer {
protected IStreamListener _streamListener = null;
-
+ private final static int BUFF_READ_SIZE = 1000000;
protected byte _rpcSessionID = 0;
protected SessionType _session = null;
- protected InputStream is = null;
- protected byte[] buffer = new byte[1488];
+ protected InputStream is = null;
+ protected byte[] buffer = new byte[BUFF_READ_SIZE];
protected boolean upts = false;
protected RPCRequest _request = null;
protected byte _wiproVersion = 1;
@@ -42,9 +42,8 @@ abstract public class AbstractPacketizer {
public abstract void stop();
- protected static String printBuffer(byte[] buffer, int start,int end) {
- String str = "";
- for (int i=start;i<end;i++) str+=","+Integer.toHexString(buffer[i]&0xFF);
- return str;
- }
-}
+ public abstract void pause();
+
+ public abstract void resume();
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/streaming/StreamPacketizer.java b/sdl_android_lib/src/com/smartdevicelink/streaming/StreamPacketizer.java
index 36ad712d9..cd807fd8e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/streaming/StreamPacketizer.java
+++ b/sdl_android_lib/src/com/smartdevicelink/streaming/StreamPacketizer.java
@@ -3,17 +3,23 @@ package com.smartdevicelink.streaming;
import java.io.IOException;
import java.io.InputStream;
+import com.smartdevicelink.SdlConnection.SdlConnection;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
public class StreamPacketizer extends AbstractPacketizer implements Runnable{
- public final static String TAG = "StreamPacketizer";
+ public final static String TAG = "StreamPacketizer";
+ private Thread t = null;
- private Thread t = null;
+ public SdlConnection sdlConnection = null;
+ private Object mPauseLock;
+ private boolean mPaused;
public StreamPacketizer(IStreamListener streamListener, InputStream is, SessionType sType, byte rpcSessionID) throws IOException {
super(streamListener, is, sType, rpcSessionID);
+ mPauseLock = new Object();
+ mPaused = false;
}
public void start() throws IOException {
@@ -24,33 +30,75 @@ public class StreamPacketizer extends AbstractPacketizer implements Runnable{
}
public void stop() {
- try {
- is.close();
- } catch (IOException ignore) {}
- t.interrupt();
- t = null;
+
+ if (t != null)
+ {
+ t.interrupt();
+ t = null;
+ }
+
}
public void run() {
int length;
+
+ try
+ {
+ while (t != null && !t.isInterrupted())
+ {
+ synchronized(mPauseLock)
+ {
+ while (mPaused)
+ {
+ try
+ {
+ mPauseLock.wait();
+ }
+ catch (InterruptedException e) {}
+ }
+ }
- try {
- while (!Thread.interrupted()) {
- length = is.read(buffer, 0, 1488);
+ length = is.read(buffer, 0, 1488);
- if (length >= 0) {
+ if (length >= 0)
+ {
ProtocolMessage pm = new ProtocolMessage();
pm.setSessionID(_rpcSessionID);
pm.setSessionType(_session);
pm.setFunctionID(0);
pm.setCorrID(0);
pm.setData(buffer, length);
-
- _streamListener.sendStreamPacket(pm);
+
+ if (t != null && !t.isInterrupted())
+ _streamListener.sendStreamPacket(pm);
}
}
- } catch (IOException e) {
+ } catch (IOException e)
+ {
e.printStackTrace();
}
+ finally
+ {
+ if (sdlConnection != null)
+ {
+ sdlConnection.endService(_session, _rpcSessionID);
+ }
+
+ }
}
+
+ @Override
+ public void pause() {
+ synchronized (mPauseLock) {
+ mPaused = true;
+ }
+ }
+
+ @Override
+ public void resume() {
+ synchronized (mPauseLock) {
+ mPaused = false;
+ mPauseLock.notifyAll();
+ }
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java b/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java
index bac1ea466..a8a2398bd 100644
--- a/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java
+++ b/sdl_android_lib/src/com/smartdevicelink/streaming/StreamRPCPacketizer.java
@@ -2,6 +2,7 @@ package com.smartdevicelink.streaming;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Hashtable;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.ProtocolMessage;
@@ -9,45 +10,174 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.MessageType;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.SdlProxyBase;
+import com.smartdevicelink.proxy.interfaces.IProxyListenerBase;
+import com.smartdevicelink.proxy.interfaces.IPutFileResponseListener;
+import com.smartdevicelink.proxy.rpc.OnStreamRPC;
import com.smartdevicelink.proxy.rpc.PutFile;
+import com.smartdevicelink.proxy.rpc.PutFileResponse;
+import com.smartdevicelink.proxy.rpc.StreamRPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
-public class StreamRPCPacketizer extends AbstractPacketizer implements Runnable{
+public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileResponseListener, Runnable{
- public final static String TAG = "StreamPacketizer";
- public final static int BUFF_READ_SIZE = 1000;
-
- private Thread t = null;
+ private Integer iInitialCorrID = 0;
+ private final static int BUFF_READ_SIZE = 1000000;
+ private Hashtable<Integer, OnStreamRPC> notificationList = new Hashtable<Integer, OnStreamRPC>();
+ private Thread thread = null;
+ private long lFileSize = 0;
+ private String sFileName;
+ private SdlProxyBase<IProxyListenerBase> _proxy;
+ private IProxyListenerBase _proxyListener;
+
+ private Object mPauseLock;
+ private boolean mPaused;
- public StreamRPCPacketizer(IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion) throws IOException {
+ public StreamRPCPacketizer(SdlProxyBase<IProxyListenerBase> proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion, long iLength) throws IOException {
super(streamListener, is, request, sType, rpcSessionID, wiproVersion);
+ lFileSize = iLength;
+ iInitialCorrID = request.getCorrelationID();
+ mPauseLock = new Object();
+ mPaused = false;
+ if (proxy != null)
+ {
+ _proxy = proxy;
+ _proxyListener = _proxy.getProxyListener();
+ _proxy.addPutFileResponseListener(this);
+ }
}
+ @Override
public void start() throws IOException {
- if (t == null) {
- t = new Thread(this);
- t.start();
+ if (thread == null) {
+ thread = new Thread(this);
+ thread.start();
}
}
+ @Override
public void stop() {
try {
is.close();
} catch (IOException ignore) {}
- t.interrupt();
- t = null;
+ if (thread != null)
+ {
+ thread.interrupt();
+ thread = null;
+ }
+ }
+
+ private void handleStreamSuccess(RPCResponse rpc, Long iSize)
+ {
+ StreamRPCResponse result = new StreamRPCResponse();
+ result.setSuccess(rpc.getSuccess());
+ result.setResultCode(rpc.getResultCode());
+ result.setInfo(rpc.getInfo());
+ result.setFileName(sFileName);
+ result.setFileSize(iSize);
+ result.setCorrelationID(iInitialCorrID);
+ if (_proxyListener != null)
+ _proxyListener.onStreamRPCResponse(result);
+ stop();
+ _proxy.remPutFileResponseListener(this);
+ return;
+ }
+
+ private void handleStreamException(RPCResponse rpc, Exception e, String error)
+ {
+ StreamRPCResponse result = new StreamRPCResponse();
+ result.setFileName(sFileName);
+ result.setCorrelationID(iInitialCorrID);
+ if (rpc != null)
+ {
+ result.setSuccess(rpc.getSuccess());
+ result.setResultCode(rpc.getResultCode());
+ result.setInfo(rpc.getInfo());
+ }
+ else
+ {
+ result.setSuccess(false);
+ result.setResultCode(Result.GENERIC_ERROR);
+ String sException = "";
+
+ if (e != null)
+ sException = sException + " " + e.toString();
+
+ sException = sException + " " + error;
+ result.setInfo(sException);
+ }
+ if (_proxyListener != null)
+ _proxyListener.onStreamRPCResponse(result);
+ if (e != null)
+ e.printStackTrace();
+ stop();
+ _proxy.remPutFileResponseListener(this);
+ return;
}
- public void run() {
+ @Override
+ public void pause() {
+ synchronized (mPauseLock) {
+ mPaused = true;
+ }
+ }
+
+ @Override
+ public void resume() {
+ synchronized (mPauseLock) {
+ mPaused = false;
+ mPauseLock.notifyAll();
+ }
+ }
+
+ public void run() {
int length;
+ byte[] msgBytes;
+ ProtocolMessage pm;
+ OnStreamRPC notification;
+ // Moves the current Thread into the background
+ android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
try {
int iCorrID = 0;
PutFile msg = (PutFile) _request;
- int iOffsetCounter = msg.getOffset();
+ long iOffsetCounter = msg.getOffset();
+ sFileName = msg.getSdlFileName();
+
+ 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();
+
+ //start reading from the stream at the given offset
+ long iSkipBytes = is.skip(iOffsetCounter);
+
+ if (iOffsetCounter != iSkipBytes)
+ {
+ handleStreamException(null,null," Error, PutFile offset invalid for file: " + sFileName);
+ }
+
while (!Thread.interrupted()) {
+ synchronized (mPauseLock)
+ {
+ while (mPaused)
+ {
+ try
+ {
+ mPauseLock.wait();
+ }
+ catch (InterruptedException e) {}
+ }
+ }
+
length = is.read(buffer, 0, BUFF_READ_SIZE);
if (length == -1)
@@ -56,30 +186,69 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements Runnable{
if (length >= 0) {
if (msg.getOffset() != 0)
- msg.setLength(null); //only need to send length when offset 0
+ msg.setLength((Long)null); //only need to send length when offset 0
- byte[] msgBytes = JsonRPCMarshaller.marshall(msg, _wiproVersion);
- ProtocolMessage pm = new ProtocolMessage();
+ msgBytes = JsonRPCMarshaller.marshall(msg, _wiproVersion);
+ pm = new ProtocolMessage();
pm.setData(msgBytes);
pm.setSessionID(_rpcSessionID);
pm.setMessageType(MessageType.RPC);
pm.setSessionType(_session);
- pm.setFunctionID(FunctionID.getFunctionID(msg.getFunctionName()));
+ pm.setFunctionID(FunctionID.getFunctionId(msg.getFunctionName()));
- pm.setBulkData(buffer, length);
+ if (buffer.length != length)
+ pm.setBulkData(buffer, length);
+ else
+ pm.setBulkDataNoCopy(buffer);
+
pm.setCorrID(msg.getCorrelationID());
- _streamListener.sendStreamPacket(pm);
-
+ notification = new OnStreamRPC();
+ notification.setFileName(msg.getSdlFileName());
+ notification.setFileSize(iFileLength);
iOffsetCounter = iOffsetCounter + length;
+ notification.setBytesComplete(iOffsetCounter);
+ notificationList.put(msg.getCorrelationID(),notification);
+
msg.setOffset(iOffsetCounter);
iCorrID = msg.getCorrelationID() + 1;
msg.setCorrelationID(iCorrID);
+
+ _streamListener.sendStreamPacket(pm);
}
}
- } catch (IOException e) {
- e.printStackTrace();
+ } catch (Exception e) {
+ handleStreamException(null, e, "");
+ }
+ }
+
+ @Override
+ public void onPutFileResponse(PutFileResponse response)
+ {
+ OnStreamRPC streamNote = notificationList.get(response.getCorrelationID());
+ if (streamNote == null) return;
+
+ if (response.getSuccess())
+ {
+ if (_proxyListener != null)
+ _proxyListener.onOnStreamRPC(streamNote);
+ }
+ else
+ {
+ handleStreamException(response, null, "");
+ }
+
+ if (response.getSuccess() && streamNote.getBytesComplete().equals(streamNote.getFileSize()) )
+ {
+ handleStreamSuccess(response, streamNote.getBytesComplete());
}
}
+
+ @Override
+ public void onPutFileStreamError(Exception e, String info)
+ {
+ if (thread != null)
+ handleStreamException(null, e, info);
+ }
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/trace/Mime.java b/sdl_android_lib/src/com/smartdevicelink/trace/Mime.java
index 514cd4d36..026f31721 100644
--- a/sdl_android_lib/src/com/smartdevicelink/trace/Mime.java
+++ b/sdl_android_lib/src/com/smartdevicelink/trace/Mime.java
@@ -13,13 +13,13 @@ public class Mime {
b64String = base64Encode(strBytes);
} catch (Exception ex) {
// Don't care?
- } // end-catch
+ }
return b64String;
- } // end-method
+ }
public static String base64Encode(byte bytesToEncode[]) {
return base64Encode(bytesToEncode, 0, bytesToEncode.length);
- } // end-method
+ }
public static String base64Encode(byte bytesToEncode[], int offset, int length) {
StringBuilder sb = new StringBuilder();
@@ -42,9 +42,9 @@ public class Mime {
sb.append(m_base64Chars.charAt(b64idx));
b64idx = bytesToEncode[idxin] & 0x3f;
break;
- } // end-switch
+ }
sb.append(m_base64Chars.charAt(b64idx));
- } // end-for
+ }
switch ((idxin-offset) % 3) {
case 0:
@@ -59,128 +59,7 @@ public class Mime {
sb.append(m_base64Chars.charAt(b64idx));
sb.append('=');
break;
- } // end-switch
-
+ }
return sb.toString();
-
- } // end-method
-
- @SuppressWarnings("unused")
- private byte[] base64Decode(String base64String) {
- byte[] outBytes = null;
- byte[] base64ASCIIString = null;
- final String ASCII_Encoding = "US-ASCII";
-
- // Convert b64 string to raw bytes
- try {
- base64ASCIIString = base64String.getBytes(ASCII_Encoding);
- } catch (Exception ex) {
- return null;
- }
-
- if (!m_decodeInitComplete) {
- m_decodeInitComplete = true;
- initForDecode();
- } // end-if
-
- int numInChars = base64ASCIIString.length;
-
- if ((numInChars % 4) > 0) {
- return null;
- } // end-if
-
- int numOutBytes = base64ASCIIString.length / 4;
- numOutBytes *= 3;
- int eqpos = base64String.indexOf("=");
- if (eqpos >= 0) {
- numOutBytes--;
- if (base64String.substring(eqpos).indexOf("==") >= 0) {
- numOutBytes--;
- } // end-if
- } // end-if
- outBytes = new byte[numOutBytes];
-
- byte b64idxbits = 0x00;
- int iidx = 0, oidx = 0;
- byte writeByte = 0x00;
- byte b64ASCIIChar = 0x00;
- for (iidx=0, oidx=0;iidx < numInChars;iidx++) {
- b64ASCIIChar = base64ASCIIString[iidx];
- if (b64ASCIIChar == 0x3d /*'='*/) {
- return outBytes;
- } // end-if
-
- if (!isb64char(b64ASCIIChar)) {
- return null;
- } // end-if
-
- switch (iidx % 4) {
- case 0:
- break;
- case 1:
- b64idxbits = b64decode[base64ASCIIString[iidx-1]];
- writeByte = (byte)((b64idxbits << 2) | ((b64decode[b64ASCIIChar] >> 4) & 0x03));
- outBytes[oidx++] = writeByte;
- break;
- case 2:
- b64idxbits = b64decode[base64ASCIIString[iidx-1]];
- writeByte = (byte)(((b64idxbits << 4) & 0xf0) | ((b64decode[b64ASCIIChar] >> 2) & 0x0f));
- outBytes[oidx++] = writeByte;
- break;
- case 3:
- b64idxbits = b64decode[base64ASCIIString[iidx-1]];
- writeByte = (byte)(((b64idxbits << 6) & 0xc0) | ((b64decode[b64ASCIIChar]) & 0x3f));
- outBytes[oidx++] = writeByte;
- break;
- } // end-switch
- } // end-for
-
- return outBytes;
-
- } // end-method
-
-
- private static byte[] b64decode = new byte[256];
- // A-Z is 0x41-0x5a
- // a-z is 0x61-0x7a
- // 0-9 is 0x30-0x39
- // + is 0x2b
- // / is 0x2f
-
- private static boolean m_decodeInitComplete = false;
-
- private void initForDecode() {
- int aidx = 0;
- int lidx = 0;
- // Set A-Z
- for (aidx=0x41, lidx=0;aidx <= 0x5a;aidx++, lidx++) {
- b64decode[aidx] = (byte)lidx;
- } // end-for
- // Set a-z
- for (aidx=0x61;aidx <= 0x7a;aidx++, lidx++) {
- b64decode[aidx] = (byte)lidx;
- } // end-for
- // Set 0-9
- for (aidx=0x30;aidx <= 0x39;aidx++, lidx++) {
- b64decode[aidx] = (byte)lidx;
- } // end-for
- // Set '+'
- b64decode[0x2b] = (byte)lidx++;
- // Set '/'
- b64decode[0x2f] = (byte)lidx++;
- } // end-method
-
- private boolean isb64char(byte b) {
- // A-Z is 0x41-0x5a
- // a-z is 0x61-0x7a
- // 0-9 is 0x30-0x39
- // + is 0x2b
- // / is 0x2f
- return ( (b >= 0x41 && b <= 0x5a)
- || (b >= 0x61 && b <= 0x7a)
- || (b >= 0x30 && b <= 0x39)
- || (b == 0x2b)
- || (b == 0x2f)
- );
- } // end-method
-} // end-class \ No newline at end of file
+ }
+} \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/trace/SdlTrace.java b/sdl_android_lib/src/com/smartdevicelink/trace/SdlTrace.java
index e980ef372..51c3ab9bf 100644
--- a/sdl_android_lib/src/com/smartdevicelink/trace/SdlTrace.java
+++ b/sdl_android_lib/src/com/smartdevicelink/trace/SdlTrace.java
@@ -32,13 +32,10 @@ import com.smartdevicelink.util.NativeLogTool;
@SuppressLint("DefaultLocale")
public class SdlTrace {
private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
-
- static boolean canWriteLogs = false;
-
+
public static final String SYSTEM_LOG_TAG = "SdlTrace";
private static long baseTics = java.lang.System.currentTimeMillis();
- private final static String KeyStr = SDL_LIB_TRACE_KEY;
private static boolean acceptAPITraceAdjustments = true;
protected static ISTListener m_appTraceListener = null;
@@ -62,12 +59,6 @@ public class SdlTrace {
m_appTraceListener = listener;
} // end-method
- public static void setTracingEnable(Boolean enable) {
- if (enable != null) {
- canWriteLogs = enable;
- }
- } // end-method
-
public static void setAppTraceLevel(DetailLevel dt) {
if ( dt != null && acceptAPITraceAdjustments)
DiagLevel.setLevel(Mod.app, dt);
@@ -139,37 +130,37 @@ public class SdlTrace {
// Base64 only available in 2.2, when SmartDeviceLink base is 2.2 use: return Base64.encodeToString(data.getBytes(), Base64.DEFAULT);
} // end-method
- public static void logProxyEvent(String eventText, String token) {
- if (DiagLevel.getLevel(Mod.proxy) == DetailLevel.OFF || !token.equals(KeyStr)) {
- return;
- } // end-if
+ public static boolean logProxyEvent(String eventText, String token) {
+ if (DiagLevel.getLevel(Mod.proxy) == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
+ return false;
+ }
String msg = SdlTrace.B64EncodeForXML(eventText);
String xml = SdlTrace.encodeTraceMessage(SdlTrace.getBaseTicsDelta(), Mod.proxy, InterfaceActivityDirection.None, "<d>" + msg + "</d>");
- writeXmlTraceMessage(xml);
- } // end-method
+ return writeXmlTraceMessage(xml);
+ }
- public static void logAppEvent(String eventText) {
+ public static boolean logAppEvent(String eventText) {
if (DiagLevel.getLevel(Mod.app) == DetailLevel.OFF) {
- return;
- } // end-if
+ return false;
+ }
long timestamp = SdlTrace.getBaseTicsDelta();
String msg = SdlTrace.B64EncodeForXML(eventText);
String xml = SdlTrace.encodeTraceMessage(timestamp, Mod.app, InterfaceActivityDirection.None, "<d>" + msg + "</d>");
- writeXmlTraceMessage(xml);
- } // end-method
+ return writeXmlTraceMessage(xml);
+ }
- public static void logRPCEvent(InterfaceActivityDirection msgDirection, RPCMessage rpcMsg, String token) {
+ public static boolean logRPCEvent(InterfaceActivityDirection msgDirection, RPCMessage rpcMsg, String token) {
DetailLevel dl = DiagLevel.getLevel(Mod.rpc);
- if (dl == DetailLevel.OFF || !token.equals(KeyStr)) {
- return;
- } // end-if
+ if (dl == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
+ return false;
+ }
long timestamp = SdlTrace.getBaseTicsDelta();
String xml = SdlTrace.encodeTraceMessage(timestamp, Mod.rpc, msgDirection, rpc2Xml(dl, rpcMsg));
- writeXmlTraceMessage(xml);
- } // end-method
+ return writeXmlTraceMessage(xml);
+ }
private static String rpc2Xml(DetailLevel dl, RPCMessage rpcMsg) {
StringBuilder rpcAsXml = new StringBuilder();
@@ -206,11 +197,11 @@ public class SdlTrace {
return rpcAsXml.toString();
} // end-method
- public static void logMarshallingEvent(InterfaceActivityDirection msgDirection, byte[] marshalledMessage, String token) {
+ public static boolean logMarshallingEvent(InterfaceActivityDirection msgDirection, byte[] marshalledMessage, String token) {
DetailLevel dl = DiagLevel.getLevel(Mod.mar);
- if (dl == DetailLevel.OFF || !token.equals(KeyStr)) {
- return;
- } // end-fif
+ if (dl == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
+ return false;
+ }
long timestamp = SdlTrace.getBaseTicsDelta();
StringBuilder msg = new StringBuilder();
@@ -222,16 +213,16 @@ public class SdlTrace {
msg.append(Mime.base64Encode(marshalledMessage));
// Base64 only available in 2.2, when SmartDeviceLink base is 2.2 use: msg.append(Base64.encodeToString(marshalledMessage, Base64.DEFAULT));
msg.append("</d>");
- } // end-if
+ }
String xml = SdlTrace.encodeTraceMessage(timestamp, Mod.mar, msgDirection, msg.toString());
- writeXmlTraceMessage(xml);
- } // end-method
+ return writeXmlTraceMessage(xml);
+ }
- public static void logProtocolEvent(InterfaceActivityDirection frameDirection, ProtocolFrameHeader frameHeader, byte[] frameData, int frameDataOffset, int frameDataLength, String token) {
+ public static boolean logProtocolEvent(InterfaceActivityDirection frameDirection, ProtocolFrameHeader frameHeader, byte[] frameData, int frameDataOffset, int frameDataLength, String token) {
DetailLevel dl = DiagLevel.getLevel(Mod.proto);
- if (dl == DetailLevel.OFF || !token.equals(KeyStr)) {
- return;
- } // end-if
+ if (dl == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
+ return false;
+ }
StringBuffer protoMsg = new StringBuffer();
protoMsg.append("<frame>");
@@ -244,12 +235,12 @@ public class SdlTrace {
// 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>");
- } // end-if
- } // end-if
+ }
+ }
protoMsg.append("</frame>");
String xml = SdlTrace.encodeTraceMessage(SdlTrace.getBaseTicsDelta(), Mod.proto, frameDirection, protoMsg.toString());
- writeXmlTraceMessage(xml);
- } // end-method
+ return writeXmlTraceMessage(xml);
+ }
private static String getProtocolFrameType(FrameType f) {
if (f == FrameType.Control)
@@ -268,7 +259,7 @@ public class SdlTrace {
String s;
if (serviceType == SessionType.RPC )
s = "rpc";
- else if (serviceType == SessionType.Bulk_Data)
+ else if (serviceType == SessionType.BULK_DATA)
s = "bulk";
else
s = "Unknown";
@@ -337,9 +328,9 @@ public class SdlTrace {
return sb.toString();
} // end-method
- public static void logTransportEvent(String preamble, String transportSpecificInfoXml, InterfaceActivityDirection msgDirection, byte buf[], int byteLength, String token) {
- logTransportEvent(preamble, transportSpecificInfoXml, msgDirection, buf, 0, byteLength, token);
- } // end-method
+ public static boolean logTransportEvent(String preamble, String transportSpecificInfoXml, InterfaceActivityDirection msgDirection, byte buf[], int byteLength, String token) {
+ return logTransportEvent(preamble, transportSpecificInfoXml, msgDirection, buf, 0, byteLength, token);
+ }
private static void checkB64(String x, byte[] buf, int offset, int byteLength) {
if ((x.length() % 4) != 0) {
@@ -347,20 +338,20 @@ public class SdlTrace {
} // end-if
} // end-method
- public static void logTransportEvent(String preamble, String transportSpecificInfoXml, InterfaceActivityDirection msgDirection, byte buf[], int offset, int byteLength, String token) {
- if (DiagLevel.getLevel(Mod.tran) == DetailLevel.OFF || !token.equals(KeyStr)) {
- return;
- } // end-if
+ public static boolean logTransportEvent(String preamble, String transportSpecificInfoXml, InterfaceActivityDirection msgDirection, byte buf[], int offset, int byteLength, String token) {
+ if (DiagLevel.getLevel(Mod.tran) == DetailLevel.OFF || !token.equals(SDL_LIB_TRACE_KEY)) {
+ return false;
+ }
StringBuilder msg = new StringBuilder();
if (transportSpecificInfoXml != null && transportSpecificInfoXml.length() > 0) {
msg.append(transportSpecificInfoXml);
- } // end-if
+ }
if (preamble != null && preamble.length() > 0) {
msg.append("<desc>");
msg.append(preamble);
msg.append("</desc>");
- } // end-if
+ }
if (buf != null) {
msg.append("<sz>");
msg.append(byteLength);
@@ -373,12 +364,12 @@ public class SdlTrace {
checkB64(bytesInfo, buf, offset, byteLength);
msg.append(bytesInfo);
msg.append("</d>");
- } // end-if
- } // end-if
- } // end-if
+ }
+ }
+ }
String xml = SdlTrace.encodeTraceMessage(SdlTrace.getBaseTicsDelta(), Mod.tran, msgDirection, msg.toString());
- writeXmlTraceMessage(xml);
- } // end-method
+ return writeXmlTraceMessage(xml);
+ }
// Package-scoped
static long getBaseTicsDelta() {
@@ -394,27 +385,31 @@ public class SdlTrace {
return SiphonServer.sendFormattedTraceMessage(info);
}
- private static void writeXmlTraceMessage(String msg) {
+ private static boolean writeXmlTraceMessage(String msg) {
try {
// Attempt to write formatted message to the Siphon
- if (false == writeMessageToSiphonServer(msg)) {
+ if (false == writeMessageToSiphonServer(msg)) {
// If writing to the Siphon fails, write to the native log
NativeLogTool.logInfo(SdlTrace.SYSTEM_LOG_TAG, msg);
+ return false;
}
ISTListener localTraceListener = m_appTraceListener;
if (localTraceListener != null) {
try {
- localTraceListener.logXmlMsg(msg, KeyStr);
+ localTraceListener.logXmlMsg(msg, SDL_LIB_TRACE_KEY);
} catch (Exception ex) {
DebugTool.logError("Failure calling ISTListener: " + ex.toString(), ex);
- } // end-catch
- } // end-if
+ return false;
+ }
+ }
} catch (Exception ex) {
NativeLogTool.logError(SdlTrace.SYSTEM_LOG_TAG, "Failure writing XML trace message: " + ex.toString());
+ return false;
}
- } // end-method
+ return true;
+ }
// Package-scoped
@SuppressWarnings("deprecation")
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java
index 1046e20da..e45c2967b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/BTTransport.java
@@ -16,6 +16,7 @@ import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
import com.smartdevicelink.trace.SdlTrace;
import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
+import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.DebugTool;
/**
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/BTTransportConfig.java b/sdl_android_lib/src/com/smartdevicelink/transport/BTTransportConfig.java
index d4634192a..5de6022b2 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/BTTransportConfig.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/BTTransportConfig.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.transport;
+import com.smartdevicelink.transport.enums.TransportType;
+
/**
* Container of Bluetooth transport specific configuration.
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/BaseTransportConfig.java b/sdl_android_lib/src/com/smartdevicelink/transport/BaseTransportConfig.java
index c499ab91c..4b7fe79be 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/BaseTransportConfig.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/BaseTransportConfig.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.transport;
+import com.smartdevicelink.transport.enums.TransportType;
+
/**
* Defines base abstract class for transport configurations.
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/SdlTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/SdlTransport.java
index 76f5840d8..1f76b0af4 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/SdlTransport.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/SdlTransport.java
@@ -3,6 +3,7 @@ package com.smartdevicelink.transport;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.trace.SdlTrace;
import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
+import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.DebugTool;
public abstract class SdlTransport {
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransport.java
index ea1721b77..69500bf6b 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransport.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransport.java
@@ -4,6 +4,7 @@ import android.util.Log;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
+import com.smartdevicelink.transport.enums.TransportType;
import java.io.IOException;
import java.io.InputStream;
@@ -114,7 +115,6 @@ public class TCPTransport extends SdlTransport {
boolean bResult = false;
if(currentState == TCPTransportState.CONNECTED) {
- synchronized (this) {
if (mOutputStream != null) {
logInfo("TCPTransport: sendBytesOverTransport request accepted. Trying to send data");
try {
@@ -129,7 +129,7 @@ public class TCPTransport extends SdlTransport {
logError("TCPTransport: sendBytesOverTransport request accepted, but output stream is null");
}
}
- } else {
+ else {
logInfo("TCPTransport: sendBytesOverTransport request rejected. Transport is not connected");
bResult = false;
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransportConfig.java b/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransportConfig.java
index a8ab3f1a8..8ff3f2172 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransportConfig.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/TCPTransportConfig.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.transport;
+import com.smartdevicelink.transport.enums.TransportType;
+
/**
* Container of TCP transport specific configuration.
*/
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/USBTransport.java b/sdl_android_lib/src/com/smartdevicelink/transport/USBTransport.java
index 0acbfb6bd..eecd91cfc 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/USBTransport.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/USBTransport.java
@@ -16,7 +16,7 @@ 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.TransportType;
+import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.DebugTool;
import java.io.FileDescriptor;
@@ -63,12 +63,12 @@ public class USBTransport extends SdlTransport {
* Manufacturer name of the accessory we want to connect to. Must be the
* same as in accessory_filter.xml to work properly.
*/
- private final static String ACCESSORY_MANUFACTURER = "Ford";
+ private final static String ACCESSORY_MANUFACTURER = "SDL";
/**
* Model name of the accessory we want to connect to. Must be the same as
* in accessory_filter.xml to work properly.
*/
- private final static String ACCESSORY_MODEL = "HMI";
+ private final static String ACCESSORY_MODEL = "Core";
/**
* Version of the accessory we want to connect to. Must be the same as in
* accessory_filter.xml to work properly.
@@ -213,7 +213,6 @@ public class USBTransport extends SdlTransport {
final State state = getState();
switch (state) {
case CONNECTED:
- synchronized (this) {
if (mOutputStream != null) {
try {
mOutputStream.write(msgBytes, offset, length);
@@ -235,7 +234,6 @@ public class USBTransport extends SdlTransport {
logW(msg);
handleTransportError(msg, null);
}
- }
break;
default:
@@ -435,7 +433,7 @@ public class USBTransport extends SdlTransport {
* Returns the type of the transport.
*
* @return TransportType.USB
- * @see com.smartdevicelink.transport.TransportType
+ * @see com.smartdevicelink.transport.enums.TransportType
*/
@Override
public TransportType getTransportType() {
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/USBTransportConfig.java b/sdl_android_lib/src/com/smartdevicelink/transport/USBTransportConfig.java
index 9cc747407..0309753a9 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/USBTransportConfig.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/USBTransportConfig.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.transport;
+import com.smartdevicelink.transport.enums.TransportType;
+
import android.content.Context;
import android.hardware.usb.UsbAccessory;
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/TransportType.java b/sdl_android_lib/src/com/smartdevicelink/transport/enums/TransportType.java
index a1fd08d71..46e0c49ab 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/TransportType.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/enums/TransportType.java
@@ -1,4 +1,4 @@
-package com.smartdevicelink.transport;
+package com.smartdevicelink.transport.enums;
/**
* Defines available types of the transports.
diff --git a/sdl_android_lib/src/com/smartdevicelink/util/Base64.java b/sdl_android_lib/src/com/smartdevicelink/util/Base64.java
deleted file mode 100644
index 50b1fd4af..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/util/Base64.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package com.smartdevicelink.util;
-
-public class Base64 {
-
- private static final String defaultString = "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure";
-
- private static char[] map = new char[64];
- private static byte[] unmap = new byte['z' + 1];
- static {
- byte i = 0;
- for (char c = 'A'; c <= 'Z'; c++) {
- unmap[c] = i;
- map[i++] = c;
- }
- for (char c = 'a'; c <= 'z'; c++) {
- unmap[c] = i;
- map[i++] = c;
- }
- for (char c = '0'; c <= '9'; c++) {
- unmap[c] = i;
- map[i++] = c;
- }
- unmap['+'] = i;
- map[i++] = '+';
- unmap['/'] = i;
- map[i++] = '/';
-
- unmap['='] = 0;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
-
- String toEncode = defaultString;
- if (args.length > 0) {
- toEncode = args[0];
- }
- System.out.println(toEncode);
- String encoded = encode(toEncode.getBytes());
- System.out.println(encoded);
- String decoded = new String(decode(encoded));
- System.out.println(decoded);
- }
-
- public static String encode(byte[] toEncode) {
-
- int iSrc = 0;
- int iDest = 0;
- int srcLen = toEncode.length;
- int destLen = (srcLen * 4 + 2) / 3;
- int padLen = ((srcLen + 2) / 3) * 4;
- char[] dest = new char[padLen];
-
- while (iSrc < srcLen) {
- int src1 = toEncode[iSrc++];
- int src2 = (iSrc < srcLen) ? toEncode[iSrc++] : 0;
- int src3 = (iSrc < srcLen) ? toEncode[iSrc++] : 0;
- int dest1 = (src1 >>> 2);
- int dest2 = (src1 << 4) | (src2 >> 4);
- dest2 &= 0x3F;
- int dest3 = (src2 << 2) | (src3 >>> 6);
- dest3 &= 0x3F;
- int dest4 = src3 & 0x3F;
- dest[iDest++] = map[dest1];
- dest[iDest++] = map[dest2];
- dest[iDest] = iDest < destLen ? map[dest3] : '=';
- iDest++;
- dest[iDest] = iDest < destLen ? map[dest4] : '=';
- iDest++;
- }
-
- return new String(dest);
- }
-
- public static byte[] decode(String toDecode) {
- int iSrc = 0;
- int iDest = 0;
- char[] src = toDecode.toCharArray();
- int srcLen = src.length;
- int destLen = ((srcLen / 4) * 3);
- if (src[srcLen - 1] == '=') {
- destLen--;
- }
- if (src[srcLen - 2] == '=') {
- destLen--;
- }
- byte[] dest = new byte[destLen];
-
- while (iSrc < srcLen) {
- byte src1 = unmap[src[iSrc++]];
- byte src2 = unmap[src[iSrc++]];
- byte src3 = unmap[src[iSrc++]];
- byte src4 = unmap[src[iSrc++]];
- int dest1 = (src1 << 2) | (src2 >>> 4);
- int dest2 = (src2 << 4) | (src3 >>> 2);
- int dest3 = (src3 << 6) | src4;
- dest[iDest++] = (byte) dest1;
- if (iDest < destLen) {
- dest[iDest++] = (byte) dest2;
- }
- if (iDest < destLen) {
- dest[iDest++] = (byte) dest3;
- }
- }
-
- return dest;
- }
-
-}
diff --git a/sdl_android_lib/src/com/smartdevicelink/util/ByteEnumer.java b/sdl_android_lib/src/com/smartdevicelink/util/ByteEnumer.java
index ed9946c0f..0b67d9992 100644
--- a/sdl_android_lib/src/com/smartdevicelink/util/ByteEnumer.java
+++ b/sdl_android_lib/src/com/smartdevicelink/util/ByteEnumer.java
@@ -30,10 +30,14 @@ public abstract class ByteEnumer {
public static ByteEnumer get(Vector<?> theList, byte value) {
Enumeration<?> enumer = theList.elements();
- while (enumer.hasMoreElements()) {
- ByteEnumer current = (ByteEnumer)enumer.nextElement();
- if (current.getValue() == value) {
- return current;
+ while (enumer.hasMoreElements()) {
+ try {
+ ByteEnumer current = (ByteEnumer)enumer.nextElement();
+ if (current.getValue() == value) {
+ return current;
+ }
+ } catch (ClassCastException e) {
+ return null;
}
}
return null;
@@ -42,11 +46,15 @@ public abstract class ByteEnumer {
public static ByteEnumer get(Vector<?> theList, String name) {
Enumeration<?> enumer = theList.elements();
while (enumer.hasMoreElements()) {
+ try {
ByteEnumer current = (ByteEnumer)enumer.nextElement();
if (current.getName().equals(name)) {
return current;
}
+ } catch (ClassCastException e) {
+ return null;
+ }
}
return null;
}
-}
+} \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/util/HttpUtils.java b/sdl_android_lib/src/com/smartdevicelink/util/HttpUtils.java
new file mode 100644
index 000000000..d0752e008
--- /dev/null
+++ b/sdl_android_lib/src/com/smartdevicelink/util/HttpUtils.java
@@ -0,0 +1,22 @@
+package com.smartdevicelink.util;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+
+public class HttpUtils{
+
+ public static Bitmap downloadImage(String urlStr) throws IOException{
+ URL url = new URL(urlStr);
+ URLConnection connection = url.openConnection();
+ BufferedInputStream bis = new BufferedInputStream(connection.getInputStream());
+ Bitmap result = BitmapFactory.decodeStream(bis);
+ bis.close();
+ return result;
+ }
+
+}
diff --git a/sdl_android_lib/src/com/smartdevicelink/util/Mime.java b/sdl_android_lib/src/com/smartdevicelink/util/Mime.java
deleted file mode 100644
index 8180aa3dc..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/util/Mime.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package com.smartdevicelink.util;
-
-public class Mime {
-
- private static String m_base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
- public static Boolean isSafeASCII(String check) {
- if (check.contains("&") || check.contains("<") || check.contains("]]") || check.contains("}") )
- return false; // these things aren't reliably CDATA encodable
-
- return true;
- }
-
- public static String base64Encode(String toEncode) {
-
- byte[] bytesToEncode = new byte[toEncode.length()];
- for (int i=0; i< toEncode.length(); i++)
- bytesToEncode[i] = (byte)toEncode.charAt(i);
-
- StringBuilder sb = new StringBuilder();
-
- int idxin = 0;
- int b64idx = 0;
-
- for (idxin=0;idxin < bytesToEncode.length;idxin++) {
- switch (idxin % 3) {
- case 0:
- b64idx = (bytesToEncode[idxin] >> 2) & 0x3f;
- break;
- case 1:
- b64idx = (bytesToEncode[idxin] >> 4) & 0x0f;
- b64idx |= ((bytesToEncode[idxin-1] << 4)& 0x30);
- break;
- case 2:
- b64idx = (bytesToEncode[idxin] >> 6) & 0x03;
- b64idx |= ((bytesToEncode[idxin-1] << 2)& 0x3c);
- sb.append(m_base64Chars.charAt(b64idx));
- b64idx = bytesToEncode[idxin] & 0x3f;
- break;
- } // end-switch
- sb.append(m_base64Chars.charAt(b64idx));
- } // end-for
-
- switch (idxin % 3) {
- case 0:
- break;
- case 1:
- b64idx = (bytesToEncode[idxin-1] << 4) & 0x30;
- sb.append(m_base64Chars.charAt(b64idx));
- sb.append("==");
- break;
- case 2:
- b64idx = ((bytesToEncode[idxin-1] << 2)& 0x3c);
- sb.append(m_base64Chars.charAt(b64idx));
- sb.append('=');
- break;
- } // end-switch
-
- return sb.toString();
- } // end-method
-
-
- @SuppressWarnings("unused")
- private byte[] base64Decode(String base64String) {
- byte[] outBytes = null;
- byte[] base64ASCIIString = null;
- final String ASCII_Encoding = "US-ASCII";
-
- // Convert b64 string to raw bytes
- try {
- base64ASCIIString = base64String.getBytes(ASCII_Encoding);
- } catch (Exception ex){
- // TODO
- //publishStatus("Failure converting b64string to ASCII string: " + ex.toString());
- return null;
- }
-
- if (!m_decodeInitComplete) {
- m_decodeInitComplete = true;
- initForDecode();
- } // end-if
-
- int numInChars = base64ASCIIString.length;
-
- if ((numInChars % 4) > 0) {
- return null;
- } // end-if
-
- int numOutBytes = base64ASCIIString.length / 4;
- numOutBytes *= 3;
- int eqpos = base64String.indexOf("=");
- if (eqpos >= 0) {
- numOutBytes--;
- if (base64String.substring(eqpos).indexOf("==") >= 0) {
- numOutBytes--;
- } // end-if
- } // end-if
- outBytes = new byte[numOutBytes];
-
- byte b64idxbits = 0x00;
- int iidx = 0, oidx = 0;
- byte writeByte = 0x00;
- byte b64ASCIIChar = 0x00;
- for (iidx=0, oidx=0;iidx < numInChars;iidx++) {
- b64ASCIIChar = base64ASCIIString[iidx];
- if (b64ASCIIChar == 0x3d /*'='*/) {
- return outBytes;
- } // end-if
-
- if (!isb64char(b64ASCIIChar)) {
- return null;
- } // end-if
-
- switch (iidx % 4) {
- case 0:
- break;
- case 1:
- b64idxbits = b64decode[base64ASCIIString[iidx-1]];
- writeByte = (byte)((b64idxbits << 2) | ((b64decode[b64ASCIIChar] >> 4) & 0x03));
- outBytes[oidx++] = writeByte;
- break;
- case 2:
- b64idxbits = b64decode[base64ASCIIString[iidx-1]];
- writeByte = (byte)(((b64idxbits << 4) & 0xf0) | ((b64decode[b64ASCIIChar] >> 2) & 0x0f));
- outBytes[oidx++] = writeByte;
- break;
- case 3:
- b64idxbits = b64decode[base64ASCIIString[iidx-1]];
- writeByte = (byte)(((b64idxbits << 6) & 0xc0) | ((b64decode[b64ASCIIChar]) & 0x3f));
- outBytes[oidx++] = writeByte;
- break;
- } // end-switch
- } // end-for
-
- return outBytes;
-
- } // end-method
-
-
- private static byte[] b64decode = new byte[256];
- // A-Z is 0x41-0x5a
- // a-z is 0x61-0x7a
- // 0-9 is 0x30-0x39
- // + is 0x2b
- // / is 0x2f
-
- private static boolean m_decodeInitComplete = false;
-
- private void initForDecode() {
- int aidx = 0;
- int lidx = 0;
- // Set A-Z
- for (aidx=0x41, lidx=0;aidx <= 0x5a;aidx++, lidx++) {
- b64decode[aidx] = (byte)lidx;
- } // end-for
- // Set a-z
- for (aidx=0x61;aidx <= 0x7a;aidx++, lidx++) {
- b64decode[aidx] = (byte)lidx;
- } // end-for
- // Set 0-9
- for (aidx=0x30;aidx <= 0x39;aidx++, lidx++) {
- b64decode[aidx] = (byte)lidx;
- } // end-for
- // Set '+'
- b64decode[0x2b] = (byte)lidx++;
- // Set '/'
- b64decode[0x2f] = (byte)lidx++;
- } // end-method
-
- private boolean isb64char(byte b) {
- // A-Z is 0x41-0x5a
- // a-z is 0x61-0x7a
- // 0-9 is 0x30-0x39
- // + is 0x2b
- // / is 0x2f
- return ( (b >= 0x41 && b <= 0x5a)
- || (b >= 0x61 && b <= 0x7a)
- || (b >= 0x30 && b <= 0x39)
- || (b == 0x2b)
- || (b == 0x2f)
- );
- } // end-method
-}
diff --git a/sdl_android_lib/src/com/smartdevicelink/util/NativeLogTool.java b/sdl_android_lib/src/com/smartdevicelink/util/NativeLogTool.java
index 8c31bf742..b014009da 100644
--- a/sdl_android_lib/src/com/smartdevicelink/util/NativeLogTool.java
+++ b/sdl_android_lib/src/com/smartdevicelink/util/NativeLogTool.java
@@ -23,52 +23,56 @@ public class NativeLogTool {
return logToSystemEnabled;
} // end-method
- public static void logInfo(String message) {
- logInfo(SdlProxyBase.TAG, message);
+ public static boolean logInfo(String message) {
+ return logInfo(SdlProxyBase.TAG, message);
}
- public static void logInfo(String tag, String message) {
+ public static boolean logInfo(String tag, String message) {
if (logToSystemEnabled) {
- log(LogTarget.Info, tag, message);
+ return log(LogTarget.Info, tag, message);
}
+ return false;
}
- public static void logWarning(String message) {
- logWarning(SdlProxyBase.TAG, message);
+ public static boolean logWarning(String message) {
+ return logWarning(SdlProxyBase.TAG, message);
}
- public static void logWarning(String tag, String message) {
+ public static boolean logWarning(String tag, String message) {
if (logToSystemEnabled) {
- log(LogTarget.Warning, tag, message);
+ return log(LogTarget.Warning, tag, message);
}
+ return false;
}
- public static void logError(String message) {
- logError(SdlProxyBase.TAG, message);
+ public static boolean logError(String message) {
+ return logError(SdlProxyBase.TAG, message);
}
- public static void logError(String tag, String message) {
+ public static boolean logError(String tag, String message) {
if (logToSystemEnabled) {
- log(LogTarget.Error, tag, message);
+ return log(LogTarget.Error, tag, message);
}
+ return false;
}
- public static void logError(String message, Throwable t) {
- logError(SdlProxyBase.TAG, message, t);
+ public static boolean logError(String message, Throwable t) {
+ return logError(SdlProxyBase.TAG, message, t);
}
- public static void logError(String tag, String message, Throwable t) {
+ public static boolean logError(String tag, String message, Throwable t) {
// If the call to logError is passed a throwable, write directly to the system log
if (logToSystemEnabled) {
Log.e(tag, message, t);
}
+ return logToSystemEnabled;
}
- private static void log(LogTarget ltarg, String source, String logMsg) {
+ private static boolean log(LogTarget ltarg, String source, String logMsg) {
// Don't log empty messages
if (logMsg == null || logMsg.length() == 0) {
- return;
- } // end-if
+ return false;
+ }
int bytesWritten = 0;
int substrSize = 0;
@@ -88,13 +92,15 @@ public class NativeLogTool {
case Error:
bytesWritten = Log.e(tag, chunk);
break;
- } // end-switch
+ }
if (bytesWritten < chunk.length()) {
Log.e(SdlProxyBase.TAG, "Calling Log.e: msg length=" + chunk.length() + ", bytesWritten=" + bytesWritten);
- } // end-if
- } // end-while
+ }
+ }
} catch (Exception ex) {
Log.e(SdlProxyBase.TAG, "Failure writing " + ltarg.name() + " fragments to android log:" + ex.toString());
- } // end-catch
- } // end-method
-}
+ return false;
+ }
+ return true;
+ }
+} \ No newline at end of file
diff --git a/sdl_android_lib/src/com/smartdevicelink/util/SdlDataTypeConverter.java b/sdl_android_lib/src/com/smartdevicelink/util/SdlDataTypeConverter.java
index db0aa527b..fa958596e 100644
--- a/sdl_android_lib/src/com/smartdevicelink/util/SdlDataTypeConverter.java
+++ b/sdl_android_lib/src/com/smartdevicelink/util/SdlDataTypeConverter.java
@@ -1,21 +1,34 @@
package com.smartdevicelink.util;
+/**
+ * This is a utility class to aid in handling values stored in the RPC classes.
+ */
public class SdlDataTypeConverter {
- public static Double objectToDouble(Object obj) {
- if (obj == null) {
+ /**
+ * Converts values that are retrieved from an RPC parameters Hashtable as an
+ * Object into the standard number value of the mobile API, Double.
+ *
+ * @param originalValue The value retrieved from an RPC parameters Hashtable.
+ * @return The Double representation of an integer or double value stored in
+ * the Object, or null if the value could not be converted.
+ */
+ public static Double objectToDouble(Object originalValue) {
+
+ if (originalValue == null) {
return null;
}
- Double D = null;
- if (obj instanceof Integer) {
- int i = ((Integer) obj).intValue();
- double d = (double) i;
- D = Double.valueOf(d);
- } else if (obj instanceof Double){
- D = (Double) obj;
+
+ Double result = null;
+
+ // Uses reflection to determine if the object is a valid type.
+ if (originalValue instanceof Integer) {
+ result = ((Integer) originalValue).doubleValue();
+ } else if (originalValue instanceof Double){
+ result = (Double) originalValue;
}
- return D;
+ return result;
}
}
diff --git a/sdl_android_lib/src/com/smartdevicelink/util/StringEnumer.java b/sdl_android_lib/src/com/smartdevicelink/util/StringEnumer.java
deleted file mode 100644
index 34ab1a300..000000000
--- a/sdl_android_lib/src/com/smartdevicelink/util/StringEnumer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.smartdevicelink.util;
-
-import java.util.Vector;
-
-public abstract class StringEnumer {
-
- protected StringEnumer(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- private int value;
- private String name;
-
- public int getValue() { return value; }
- public String getName() { return name; }
-
- public boolean equals(StringEnumer other) {
- return name == other.getName();
- }
-
- public boolean eq(StringEnumer other) {
- return equals(other);
- }
-
- public String toString() {
- return name;
- }
-
- public static StringEnumer get(Vector<? extends StringEnumer> theList, int value) {
- for (StringEnumer current : theList) {
- if (current.getValue() == value) {
- return current;
- }
- }
- return null;
- }
-
- public static StringEnumer get(Vector<? extends StringEnumer> theList, String name) {
- for (StringEnumer current : theList) {
- if (current.getName().equalsIgnoreCase(name)) {
- return current;
- }
- }
- return null;
- }
-}