summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2018-08-23 10:30:00 -0400
committerGitHub <noreply@github.com>2018-08-23 10:30:00 -0400
commitae07b1af97a57a5dc372503b49d9e44433fb1830 (patch)
treef586cec4c4d15c8961f316d179ff384ae647a4fe
parent44a72560d853f1281653dd145f363f267edc69d6 (diff)
parentf095e8d0f940ec78bfbf403dbb40b9436b4c18d4 (diff)
downloadsdl_android-ae07b1af97a57a5dc372503b49d9e44433fb1830.tar.gz
Merge pull request #839 from smartdevicelink/feature/rpc_versioning
Add ability for RPCs to be versioned/formatted
-rw-r--r--sdl_android/build.gradle2
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java4
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java6
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java9
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java81
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java97
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java11
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java10
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/streaming/AbstractPacketizer.java22
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java26
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java2
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/util/Version.java6
13 files changed, 265 insertions, 29 deletions
diff --git a/sdl_android/build.gradle b/sdl_android/build.gradle
index 5429f3eea..ec9ff5cbc 100644
--- a/sdl_android/build.gradle
+++ b/sdl_android/build.gradle
@@ -40,7 +40,7 @@ dependencies {
})
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.9.0'
- api 'com.android.support:support-annotations:27.1.1'
+ api 'com.android.support:support-annotations:27.+'
}
buildscript {
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
index e506268ea..6f38fdfa0 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
@@ -12,6 +12,7 @@ import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingState;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.util.Version;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -80,6 +81,9 @@ public class OnHMIStatusTests extends BaseRpcTests{
testNullBase(msg);
assertNull(Test.NULL, msg.getAudioStreamingState());
+
+ assertNull(Test.NULL, msg.getVideoStreamingState());
+ msg.format(new Version(4,5,0),true);
assertEquals(Test.MATCH, VideoStreamingState.STREAMABLE, msg.getVideoStreamingState());
assertNull(Test.NULL, msg.getHmiLevel());
assertNull(Test.NULL, msg.getSystemContext());
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java
index d32a204a6..2c6618f62 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockPacketizer.java
@@ -5,6 +5,7 @@ import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.streaming.AbstractPacketizer;
import com.smartdevicelink.streaming.IStreamListener;
+import com.smartdevicelink.util.Version;
import java.io.IOException;
import java.io.InputStream;
@@ -15,6 +16,7 @@ import java.io.InputStream;
*/
public class MockPacketizer extends AbstractPacketizer {
public MockPacketizer (IStreamListener l, InputStream i, SessionType s, byte sid, SdlSession sdlsession) throws IOException { super (l, i, s, sid, sdlsession); }
+ public MockPacketizer (IStreamListener l, InputStream i, RPCRequest r, SessionType s, byte sid, Version protocolVersion,SdlSession sdlsession) throws IOException { super (l, i, r, s, sid, protocolVersion, sdlsession); }
public MockPacketizer (IStreamListener l, InputStream i, RPCRequest r, SessionType s, byte sid, byte w, SdlSession sdlsession) throws IOException { super (l, i, r, s, sid, w, sdlsession); }
@Override public void start() throws IOException { }
@@ -26,7 +28,9 @@ public class MockPacketizer extends AbstractPacketizer {
public SdlSession getSdlSession () { return _session; }
public byte getSessionId () { return _rpcSessionID; }
public RPCRequest getRPCRequest () { return _request; }
- public byte getWiproVersion () { return _wiproVersion; }
+ @Deprecated
+ public byte getWiproVersion () { if(_wiproVersion != null){return (byte)_wiproVersion.getMajor(); }else{return 5;}}
+ public Version getProtocolVersion () { return _wiproVersion; }
@Override public void pause() { }
@Override public void resume() { }
diff --git a/sdl_android/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java b/sdl_android/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
index 414538a19..89f4d1ef7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
@@ -23,7 +23,12 @@ import com.smartdevicelink.util.DebugTool;
public class JsonRPCMarshaller {
private static final String SDL_LIB_PRIVATE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
-
+
+ /**
+ * @param msg RPC message to be marshaled
+ * @param version protocol version
+ * @return byte array of the marshalled message
+ */
public static byte[] marshall(RPCMessage msg, byte version) {
byte[] jsonBytes = null;
try {
@@ -81,7 +86,7 @@ public class JsonRPCMarshaller {
return ret;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked" )
private static JSONArray serializeList(List<?> list) throws JSONException{
JSONArray toPut = new JSONArray();
Iterator<Object> valueIterator = (Iterator<Object>) list.iterator();
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
index 116c491df..2d9ab77d7 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
@@ -1,6 +1,9 @@
package com.smartdevicelink.proxy;
+import android.util.Log;
+
import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.util.Version;
import org.json.JSONException;
import org.json.JSONObject;
@@ -20,6 +23,10 @@ public class RPCStruct {
private byte[] _bulkData = null;
private Boolean protectedPayload = false;
+ private boolean formatRequested = false;
+ private Version rpcSpecVersion = null;
+
+
protected Hashtable<String, Object> store = null;
public boolean getStoreValue(String key) { // for unit testing
@@ -45,6 +52,7 @@ public class RPCStruct {
public void deserializeJSON(JSONObject jsonObject) throws JSONException {
store = JsonRPCMarshaller.deserializeJSONObject(jsonObject);
+
}
// deserializeJSONObject method moved to JsonRPCMarshaller for consistency
@@ -54,14 +62,14 @@ public class RPCStruct {
throws JSONException {
return JsonRPCMarshaller.deserializeJSONObject(jsonObject);
}
-
+
public JSONObject serializeJSON() throws JSONException {
return JsonRPCMarshaller.serializeHashtable(store);
}
@SuppressWarnings("unchecked")
- public JSONObject serializeJSON(byte version) throws JSONException {
- if (version > 1) {
+ public JSONObject serializeJSON(byte protocolVersion) throws JSONException {
+ if (protocolVersion > 1) {
String messageType = getMessageTypeName(store.keySet());
Hashtable<String, Object> function = (Hashtable<String, Object>) store.get(messageType);
Hashtable<String, Object> parameters = (Hashtable<String, Object>) function.get(RPCMessage.KEY_PARAMETERS);
@@ -69,6 +77,57 @@ public class RPCStruct {
} else return JsonRPCMarshaller.serializeHashtable(store);
}
+ /**
+ * This method should clean the the RPC to make sure it is compliant with the spec.
+ * <br><br><b> NOTE:</b> Super needs to be called at the END of the method
+ *
+ * @param rpcVersion the rpc spec version that has been negotiated. If value is null the
+ * the max value of RPC spec version this library supports should be used.
+ * @param formatParams if true, the format method will be called on subsequent params
+ */
+ public void format(Version rpcVersion, boolean formatParams){
+ formatRequested = true;
+ rpcSpecVersion = rpcVersion;
+ //Should override this method when breaking changes are made to the RPC spec
+ if(formatParams && store != null){
+ Hashtable<String, Object> parameters;
+
+ if(this instanceof RPCMessage) {
+ //If this is a message (request, response, notification) the parameters have to be
+ //retrieved from the store object.
+ String messageType = getMessageTypeName(store.keySet());
+ Hashtable<String, Object> function = (Hashtable<String, Object>) store.get(messageType);
+ parameters = (Hashtable<String, Object>) function.get(RPCMessage.KEY_PARAMETERS);
+ } else {
+ //If this is just an RPC struct the store itself should be used
+ parameters = store;
+ }
+
+ for(Object value:parameters.values()){
+ internalFormat(rpcVersion, value);
+ }
+ }
+ }
+
+ /**
+ * Cycles through parameters in this RPC to ensure they all get formated
+ * @param rpcVersion version of the rpc spec that should be used to format this rpc
+ * @param value the object to investigate if it needs to be formated
+ */
+ private void internalFormat(Version rpcVersion, Object value) {
+ if(value instanceof RPCStruct) {
+ ((RPCStruct)value).format(rpcVersion,true);
+ } else if(value instanceof List<?>) {
+ List<?> list = (List<?>)value;
+ if(list != null && list.size() > 0) {
+ for(Object listItem: list){
+ internalFormat(rpcVersion, listItem);
+ }
+ }
+ }
+ }
+
+
public byte[] getBulkData() {
return this._bulkData;
}
@@ -156,7 +215,12 @@ public class RPCStruct {
} else if (obj instanceof Hashtable) {
try {
Constructor constructor = tClass.getConstructor(Hashtable.class);
- return constructor.newInstance((Hashtable<String, Object>) obj);
+ Object customObject = constructor.newInstance((Hashtable<String, Object>) obj);
+ if(formatRequested && customObject instanceof RPCStruct){
+ ((RPCStruct)customObject).format(rpcSpecVersion,true);
+ }
+
+ return customObject;
} catch (Exception e) {
e.printStackTrace();
}
@@ -168,10 +232,17 @@ public class RPCStruct {
return list;
} else if (item instanceof Hashtable) {
List<Object> newList = new ArrayList<Object>();
+ Object customObject;
for (Object hashObj : list) {
try {
Constructor constructor = tClass.getConstructor(Hashtable.class);
- newList.add(constructor.newInstance((Hashtable<String, Object>)hashObj));
+ customObject = constructor.newInstance((Hashtable<String, Object>) hashObj);
+ if(formatRequested
+ && customObject != null
+ && customObject instanceof RPCStruct){
+ ((RPCStruct)customObject).format(rpcSpecVersion,true);
+ }
+ newList.add(customObject);
} catch (Exception e) {
e.printStackTrace();
return null;
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
index 7d73d36d8..f8fb1f353 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -127,7 +127,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private static final int PROX_PROT_VER_ONE = 1;
private static final int RESPONSE_WAIT_TIME = 2000;
- private static final com.smartdevicelink.util.Version MAX_SUPPORTED_RPC_VERSION = new com.smartdevicelink.util.Version("4.5.0");
+ public static final com.smartdevicelink.util.Version MAX_SUPPORTED_RPC_VERSION = new com.smartdevicelink.util.Version("5.0.0");
private SdlSession sdlSession = null;
private proxyListenerType _proxyListener = null;
@@ -241,6 +241,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private final CopyOnWriteArrayList<IPutFileResponseListener> _putFileListenerList = new CopyOnWriteArrayList<IPutFileResponseListener>();
protected byte _wiproVersion = 1;
+ protected com.smartdevicelink.util.Version rpcSpecVersion;
protected SparseArray<OnRPCResponseListener> rpcResponseListeners = null;
protected SparseArray<CopyOnWriteArrayList<OnRPCNotificationListener>> rpcNotificationListeners = null;
@@ -1646,18 +1647,16 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public String serializeJSON(RPCMessage msg)
{
- String sReturn;
try
{
- sReturn = msg.serializeJSON(getWiProVersion()).toString(2);
- }
+ return msg.serializeJSON(getWiProVersion()).toString(2);
+ }
catch (final Exception e)
{
DebugTool.logError("Error handing proxy event.", e);
passErrorToProxyListener("Error serializing message.", e);
return null;
}
- return sReturn;
}
private void handleErrorsFromIncomingMessageDispatcher(String info, Exception e) {
@@ -1801,7 +1800,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private void sendRPCRequestPrivate(RPCRequest request) throws SdlException {
try {
SdlTrace.logRPCEvent(InterfaceActivityDirection.Transmit, request, SDL_LIB_TRACE_KEY);
-
+
+ request.format(rpcSpecVersion,true);
byte[] msgBytes = JsonRPCMarshaller.marshall(request, _wiproVersion);
ProtocolMessage pm = new ProtocolMessage();
@@ -2010,6 +2010,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private void handleRPCMessage(Hashtable<String, Object> hash) {
RPCMessage rpcMsg = new RPCMessage(hash);
+ //Call format to ensure the RPC is ready to be handled regardless of RPC spec version
+
String functionName = rpcMsg.getFunctionName();
String messageType = rpcMsg.getMessageType();
@@ -2024,6 +2026,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
&& _advancedLifecycleManagementEnabled
&& functionName.equals(FunctionID.REGISTER_APP_INTERFACE.toString())) {
final RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (msg.getSuccess()) {
_appInterfaceRegisterd = true;
}
@@ -2048,6 +2051,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_sdlLanguage = msg.getLanguage();
_hmiDisplayLanguage = msg.getHmiDisplayLanguage();
_sdlMsgVersion = msg.getSdlMsgVersion();
+ if(_sdlMsgVersion != null){
+ rpcSpecVersion = new com.smartdevicelink.util.Version(_sdlMsgVersion.getMajorVersion(),_sdlMsgVersion.getMinorVersion(), _sdlMsgVersion.getPatchVersion());
+ }else{
+ rpcSpecVersion = MAX_SUPPORTED_RPC_VERSION;
+ }
_vehicleType = msg.getVehicleType();
_systemSoftwareVersion = msg.getSystemSoftwareVersion();
_proxyVersionInfo = msg.getProxyVersionInfo();
@@ -2168,6 +2176,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
APP_INTERFACE_REGISTERED_LOCK.notify();
}
final UnregisterAppInterfaceResponse msg = new UnregisterAppInterfaceResponse(hash);
+ msg.format(rpcSpecVersion, true);
Intent sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
@@ -2183,6 +2192,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (functionName.equals(FunctionID.REGISTER_APP_INTERFACE.toString())) {
final RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (msg.getSuccess()) {
_appInterfaceRegisterd = true;
}
@@ -2196,6 +2206,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_sdlLanguage = msg.getLanguage();
_hmiDisplayLanguage = msg.getHmiDisplayLanguage();
_sdlMsgVersion = msg.getSdlMsgVersion();
+ rpcSpecVersion = new com.smartdevicelink.util.Version(_sdlMsgVersion.getMajorVersion(),_sdlMsgVersion.getMinorVersion(), _sdlMsgVersion.getPatchVersion());
_vehicleType = msg.getVehicleType();
_systemSoftwareVersion = msg.getSystemSoftwareVersion();
_proxyVersionInfo = msg.getProxyVersionInfo();
@@ -2256,6 +2267,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// SpeakResponse
final SpeakResponse msg = new SpeakResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2273,6 +2285,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// AlertResponse
final AlertResponse msg = new AlertResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2290,6 +2303,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// ShowResponse
final ShowResponse msg = new ShowResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2307,6 +2321,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// AddCommand
final AddCommandResponse msg = new AddCommandResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2324,6 +2339,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// DeleteCommandResponse
final DeleteCommandResponse msg = new DeleteCommandResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2341,6 +2357,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// AddSubMenu
final AddSubMenuResponse msg = new AddSubMenuResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2358,6 +2375,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// DeleteSubMenu
final DeleteSubMenuResponse msg = new DeleteSubMenuResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2375,6 +2393,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// SubscribeButton
final SubscribeButtonResponse msg = new SubscribeButtonResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2392,6 +2411,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// UnsubscribeButton
final UnsubscribeButtonResponse msg = new UnsubscribeButtonResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2409,6 +2429,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// SetMediaClockTimer
final SetMediaClockTimerResponse msg = new SetMediaClockTimerResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2425,7 +2446,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.ENCODED_SYNC_P_DATA.toString())) {
final SystemRequestResponse msg = new SystemRequestResponse(hash);
-
+ msg.format(rpcSpecVersion,true);
Intent sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
@@ -2452,6 +2473,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// CreateInteractionChoiceSet
final CreateInteractionChoiceSetResponse msg = new CreateInteractionChoiceSetResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2469,6 +2491,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// DeleteInteractionChoiceSet
final DeleteInteractionChoiceSetResponse msg = new DeleteInteractionChoiceSetResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2486,6 +2509,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// PerformInteraction
final PerformInteractionResponse msg = new PerformInteractionResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2503,6 +2527,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// SetGlobalPropertiesResponse
final SetGlobalPropertiesResponse msg = new SetGlobalPropertiesResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2520,6 +2545,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// ResetGlobalProperties
final ResetGlobalPropertiesResponse msg = new ResetGlobalPropertiesResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2542,7 +2568,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
final UnregisterAppInterfaceResponse msg = new UnregisterAppInterfaceResponse(hash);
-
+ msg.format(rpcSpecVersion,true);
Intent sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE.toString());
updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
@@ -2575,6 +2601,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.GENERIC_RESPONSE.toString())) {
// GenericResponse (Usually and error)
final GenericResponse msg = new GenericResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2591,6 +2618,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.SLIDER.toString())) {
// Slider
final SliderResponse msg = new SliderResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2607,6 +2635,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.PUT_FILE.toString())) {
// PutFile
final PutFileResponse msg = new PutFileResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2625,6 +2654,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.DELETE_FILE.toString())) {
// DeleteFile
final DeleteFileResponse msg = new DeleteFileResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2641,6 +2671,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.LIST_FILES.toString())) {
// ListFiles
final ListFilesResponse msg = new ListFilesResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2657,6 +2688,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.SET_APP_ICON.toString())) {
// SetAppIcon
final SetAppIconResponse msg = new SetAppIconResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2673,6 +2705,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.SCROLLABLE_MESSAGE.toString())) {
// ScrollableMessage
final ScrollableMessageResponse msg = new ScrollableMessageResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2689,6 +2722,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.CHANGE_REGISTRATION.toString())) {
// ChangeLanguageRegistration
final ChangeRegistrationResponse msg = new ChangeRegistrationResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2705,7 +2739,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.SET_DISPLAY_LAYOUT.toString())) {
// SetDisplayLayout
final SetDisplayLayoutResponse msg = new SetDisplayLayoutResponse(hash);
-
+ msg.format(rpcSpecVersion,true);
// successfully changed display layout - update layout capabilities
if(msg.getSuccess() && _systemCapabilityManager!=null){
_systemCapabilityManager.setCapability(SystemCapabilityType.DISPLAY, msg.getDisplayCapabilities());
@@ -2730,6 +2764,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.PERFORM_AUDIO_PASS_THRU.toString())) {
// PerformAudioPassThru
final PerformAudioPassThruResponse msg = new PerformAudioPassThruResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2746,6 +2781,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.END_AUDIO_PASS_THRU.toString())) {
// EndAudioPassThru
final EndAudioPassThruResponse msg = new EndAudioPassThruResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2762,6 +2798,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.SUBSCRIBE_VEHICLE_DATA.toString())) {
// SubscribeVehicleData
final SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2778,6 +2815,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString())) {
// UnsubscribeVehicleData
final UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2794,6 +2832,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.GET_VEHICLE_DATA.toString())) {
// GetVehicleData
final GetVehicleDataResponse msg = new GetVehicleDataResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2810,6 +2849,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.SUBSCRIBE_WAY_POINTS.toString())) {
// SubscribeWayPoints
final SubscribeWayPointsResponse msg = new SubscribeWayPointsResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2826,6 +2866,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.UNSUBSCRIBE_WAY_POINTS.toString())) {
// UnsubscribeWayPoints
final UnsubscribeWayPointsResponse msg = new UnsubscribeWayPointsResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2842,6 +2883,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.GET_WAY_POINTS.toString())) {
// GetWayPoints
final GetWayPointsResponse msg = new GetWayPointsResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2857,6 +2899,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} else if (functionName.equals(FunctionID.READ_DID.toString())) {
final ReadDIDResponse msg = new ReadDIDResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2872,6 +2915,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} else if (functionName.equals(FunctionID.GET_DTCS.toString())) {
final GetDTCsResponse msg = new GetDTCsResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2887,6 +2931,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} else if (functionName.equals(FunctionID.DIAGNOSTIC_MESSAGE.toString())) {
final DiagnosticMessageResponse msg = new DiagnosticMessageResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2904,6 +2949,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
else if (functionName.equals(FunctionID.SYSTEM_REQUEST.toString())) {
final SystemRequestResponse msg = new SystemRequestResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2921,6 +2967,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
else if (functionName.equals(FunctionID.SEND_LOCATION.toString())) {
final SendLocationResponse msg = new SendLocationResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2938,6 +2985,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
else if (functionName.equals(FunctionID.DIAL_NUMBER.toString())) {
final DialNumberResponse msg = new DialNumberResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -2954,6 +3002,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
else if (functionName.equals(FunctionID.SHOW_CONSTANT_TBT.toString())) {
final ShowConstantTbtResponse msg = new ShowConstantTbtResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
_mainUIHandler.post(new Runnable() {
@Override
@@ -2969,6 +3018,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
else if (functionName.equals(FunctionID.ALERT_MANEUVER.toString())) {
final AlertManeuverResponse msg = new AlertManeuverResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
_mainUIHandler.post(new Runnable() {
@Override
@@ -2983,6 +3033,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} else if (functionName.equals(FunctionID.UPDATE_TURN_LIST.toString())) {
final UpdateTurnListResponse msg = new UpdateTurnListResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
_mainUIHandler.post(new Runnable() {
@Override
@@ -2997,6 +3048,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} else if (functionName.equals(FunctionID.SET_INTERIOR_VEHICLE_DATA.toString())) {
final SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
_mainUIHandler.post(new Runnable() {
@Override
@@ -3011,6 +3063,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} else if (functionName.equals(FunctionID.GET_INTERIOR_VEHICLE_DATA.toString())) {
final GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
_mainUIHandler.post(new Runnable() {
@Override
@@ -3026,6 +3079,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.GET_SYSTEM_CAPABILITY.toString())) {
// GetSystemCapabilityResponse
final GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
_mainUIHandler.post(new Runnable() {
@Override
@@ -3040,6 +3094,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} else if (functionName.equals(FunctionID.BUTTON_PRESS.toString())) {
final ButtonPressResponse msg = new ButtonPressResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
_mainUIHandler.post(new Runnable() {
@Override
@@ -3054,6 +3109,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} else if (functionName.equals(FunctionID.SEND_HAPTIC_DATA.toString())) {
final SendHapticDataResponse msg = new SendHapticDataResponse(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3096,6 +3152,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_hmiLevel = msg.getHmiLevel();
_audioStreamingState = msg.getAudioStreamingState();
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3115,6 +3172,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// OnCommand
final OnCommand msg = new OnCommand(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3140,6 +3198,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sdlSession.getLockScreenMan().setDriverDistStatus(drDist == DriverDistractionState.DD_ON);
}
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3166,7 +3225,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// If url is null, then send notification to the app, otherwise, send to URL
if (msg.getUrl() == null) {
updateBroadcastIntent(sendIntent, "COMMENT1", "URL is a null value (received)");
- sendBroadcastIntent(sendIntent);
+ sendBroadcastIntent(sendIntent);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3202,6 +3262,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
//OnPermissionsChange
final OnPermissionsChange msg = new OnPermissionsChange(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3219,6 +3280,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// OnTBTClientState
final OnTBTClientState msg = new OnTBTClientState(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3236,6 +3298,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// OnButtonPress
final OnButtonPress msg = new OnButtonPress(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3253,6 +3316,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// OnButtonEvent
final OnButtonEvent msg = new OnButtonEvent(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3270,6 +3334,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// OnLanguageChange
final OnLanguageChange msg = new OnLanguageChange(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3287,6 +3352,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// OnLanguageChange
final OnHashChange msg = new OnHashChange(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3312,7 +3378,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
// OnSystemRequest
final OnSystemRequest msg = new OnSystemRequest(hash);
-
+ msg.format(rpcSpecVersion,true);
if ((msg.getUrl() != null) &&
(((msg.getRequestType() == RequestType.PROPRIETARY) && (msg.getFileType() == FileType.JSON))
|| ((msg.getRequestType() == RequestType.HTTP) && (msg.getFileType() == FileType.BINARY)))){
@@ -3332,6 +3398,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
lockScreenIconRequest = msg;
}
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3348,6 +3415,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.ON_AUDIO_PASS_THRU.toString())) {
// OnAudioPassThru
final OnAudioPassThru msg = new OnAudioPassThru(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3364,6 +3432,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} else if (functionName.equals(FunctionID.ON_VEHICLE_DATA.toString())) {
// OnVehicleData
final OnVehicleData msg = new OnVehicleData(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3387,6 +3456,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
final OnAppInterfaceUnregistered msg = new OnAppInterfaceUnregistered(hash);
+ msg.format(rpcSpecVersion,true);
Intent sendIntent = createBroadcastIntent();
updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.ON_APP_INTERFACE_UNREGISTERED.toString());
@@ -3416,6 +3486,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
else if (functionName.equals(FunctionID.ON_KEYBOARD_INPUT.toString())) {
final OnKeyboardInput msg = new OnKeyboardInput(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3432,6 +3503,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
else if (functionName.equals(FunctionID.ON_TOUCH_EVENT.toString())) {
final OnTouchEvent msg = new OnTouchEvent(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3448,6 +3520,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
else if (functionName.equals(FunctionID.ON_WAY_POINT_CHANGE.toString())) {
final OnWayPointChange msg = new OnWayPointChange(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3464,6 +3537,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
else if (functionName.equals(FunctionID.ON_INTERIOR_VEHICLE_DATA.toString())) {
final OnInteriorVehicleData msg = new OnInteriorVehicleData(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -3480,6 +3554,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
else if (functionName.equals(FunctionID.ON_RC_STATUS.toString())) {
final OnRCStatus msg = new OnRCStatus(hash);
+ msg.format(rpcSpecVersion, true);
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
index a7ebc26ae..bcb281986 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
@@ -104,6 +104,18 @@ public class OnHMIStatus extends RPCNotification {
setAudioStreamingState(audioStreamingState);
setSystemContext(systemContext);
}
+
+ @Override
+ public void format(com.smartdevicelink.util.Version rpcVersion, boolean formatParams){
+ if(rpcVersion.getMajor() < 5){
+ if(getVideoStreamingState() == null){
+ setVideoStreamingState(VideoStreamingState.STREAMABLE);
+ }
+ }
+
+ super.format(rpcVersion,formatParams);
+ }
+
/**
* <p>Get HMILevel in effect for the application</p>
* @return {@linkplain HMILevel} the current HMI Level in effect for the application
@@ -137,11 +149,7 @@ public class OnHMIStatus extends RPCNotification {
* @return {@linkplain VideoStreamingState} Returns current state of video streaming for the application
*/
public VideoStreamingState getVideoStreamingState() {
- VideoStreamingState videoStreamingState = (VideoStreamingState) getObject(VideoStreamingState.class, KEY_VIDEO_STREAMING_STATE);
- if (videoStreamingState == null){
- videoStreamingState = VideoStreamingState.STREAMABLE;
- }
- return videoStreamingState;
+ return (VideoStreamingState) getObject(VideoStreamingState.class, KEY_VIDEO_STREAMING_STATE);
}
/**
* <p>Set the video streaming state</p>
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
index 9527859da..13ecd9c75 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
@@ -77,6 +77,17 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
setSuccess(success);
setResultCode(resultCode);
}
+
+ @Override
+ public void format(com.smartdevicelink.util.Version rpcVersion, boolean formatParams){
+ //Add in 5.0.0 of the rpc spec
+ if(getIconResumed() == null){
+ setIconResumed(Boolean.FALSE);
+ }
+
+ super.format(rpcVersion,formatParams);
+ }
+
@SuppressWarnings("unchecked")
public SdlMsgVersion getSdlMsgVersion() {
return (SdlMsgVersion) getObject(SdlMsgVersion.class, KEY_SDL_MSG_VERSION);
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
index 128d2050f..3e1637e22 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SdlMsgVersion.java
@@ -74,7 +74,17 @@ public class SdlMsgVersion extends RPCStruct {
this();
setMajorVersion(majorVersion);
setMinorVersion(minorVersion);
+
+ }
+
+ @Override
+ public void format(com.smartdevicelink.util.Version rpcVersion, boolean formatParams) {
+ if(getPatchVersion() == null){
+ setPatchVersion(0);
+ }
+ super.format(rpcVersion,formatParams);
}
+
public Integer getMajorVersion() {
return getInteger( KEY_MAJOR_VERSION );
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/streaming/AbstractPacketizer.java b/sdl_android/src/main/java/com/smartdevicelink/streaming/AbstractPacketizer.java
index 722fa54f9..1a2c393cd 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/streaming/AbstractPacketizer.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/streaming/AbstractPacketizer.java
@@ -6,6 +6,7 @@ import java.io.InputStream;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.util.Version;
abstract public class AbstractPacketizer {
@@ -19,7 +20,7 @@ abstract public class AbstractPacketizer {
protected byte[] buffer;
protected boolean upts = false;
protected RPCRequest _request = null;
- protected byte _wiproVersion = 1;
+ protected Version _wiproVersion = new Version("1.0.0");
//protected long ts = 0, intervalBetweenReports = 5000, delta = 0;
protected long intervalBetweenReports = 5000, delta = 0;
@@ -38,13 +39,30 @@ abstract public class AbstractPacketizer {
}
}
+ @Deprecated
public AbstractPacketizer(IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion, SdlSession session) throws IOException, IllegalArgumentException {
this._streamListener = streamListener;
this.is = is;
_rpcSessionID = rpcSessionID;
_serviceType = sType;
_request = request;
- _wiproVersion = wiproVersion;
+ _wiproVersion = new Version(wiproVersion+".0.0");
+ this._session = session;
+ if (this._session != null) {
+ bufferSize = this._session.getMtu();
+ buffer = new byte[bufferSize];
+ }else{
+ throw new IllegalArgumentException("Session variable is null");
+ }
+ }
+
+ public AbstractPacketizer(IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, Version protocolVersion, SdlSession session) throws IOException, IllegalArgumentException {
+ this._streamListener = streamListener;
+ this.is = is;
+ _rpcSessionID = rpcSessionID;
+ _serviceType = sType;
+ _request = request;
+ _wiproVersion = protocolVersion;
this._session = session;
if (this._session != null) {
bufferSize = this._session.getMtu();
diff --git a/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java b/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
index 5652aafc3..8aab788c9 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
@@ -22,6 +22,7 @@ import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.StreamRPCResponse;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
+import com.smartdevicelink.util.Version;
public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileResponseListener, Runnable{
@@ -36,7 +37,9 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
private Object mPauseLock;
private boolean mPaused;
private boolean isRPCProtected = false;
- private OnPutFileUpdateListener callBack;
+ private OnPutFileUpdateListener callBack;
+
+ private Version rpcSpecVersion;
public StreamRPCPacketizer(SdlProxyBase<IProxyListenerBase> proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion, long lLength, SdlSession session) throws IOException {
super(streamListener, is, request, sType, rpcSessionID, wiproVersion, session);
@@ -56,6 +59,24 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
}
}
+ public StreamRPCPacketizer(SdlProxyBase<IProxyListenerBase> proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, Version wiproVersion, Version rpcSpecVersion, long lLength, SdlSession session) throws IOException {
+ super(streamListener, is, request, sType, rpcSessionID, wiproVersion, session);
+ this.rpcSpecVersion = rpcSpecVersion;
+ lFileSize = lLength;
+ iInitialCorrID = request.getCorrelationID();
+ mPauseLock = new Object();
+ mPaused = false;
+ isRPCProtected = request.isPayloadProtected();
+ if (proxy != null) {
+ _proxy = proxy;
+ _proxyListener = _proxy.getProxyListener();
+ _proxy.addPutFileResponseListener(this);
+ }
+ if(_request.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.toString())){
+ callBack = ((PutFile)_request).getOnPutFileUpdateListener();
+ }
+ }
+
@Override
public void start() throws IOException {
if (thread == null) {
@@ -201,7 +222,8 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
if (msg.getOffset() != 0)
msg.setLength((Long)null); //only need to send length when offset 0
- msgBytes = JsonRPCMarshaller.marshall(msg, _wiproVersion);
+ msg.format(rpcSpecVersion,true);
+ msgBytes = JsonRPCMarshaller.marshall(msg, (byte)_wiproVersion.getMajor());
pm = new ProtocolMessage();
pm.setData(msgBytes);
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
index 617fabcb2..03fc61ecc 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
@@ -78,6 +78,7 @@ import com.smartdevicelink.transport.utl.ByteArrayMessageSpliter;
import com.smartdevicelink.util.AndroidTools;
import com.smartdevicelink.util.BitConverter;
import com.smartdevicelink.util.SdlAppInfo;
+import com.smartdevicelink.util.Version;
import static com.smartdevicelink.transport.TransportConstants.FOREGROUND_EXTRA;
import static com.smartdevicelink.transport.TransportConstants.SDL_NOTIFICATION_CHANNEL_ID;
@@ -1977,6 +1978,7 @@ public class SdlRouterService extends Service{
private byte[] createForceUnregisterApp(byte sessionId,byte version){
UnregisterAppInterface request = new UnregisterAppInterface();
request.setCorrelationID(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
+ request.format(null,true);
byte[] msgBytes = JsonRPCMarshaller.marshall(request, version);
ProtocolMessage pm = new ProtocolMessage();
pm.setData(msgBytes);
diff --git a/sdl_android/src/main/java/com/smartdevicelink/util/Version.java b/sdl_android/src/main/java/com/smartdevicelink/util/Version.java
index 8621c8cfd..6861d1504 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/util/Version.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/util/Version.java
@@ -11,6 +11,12 @@ public class Version {
patch = 0;
}
+ public Version(int major, int minor, int patch){
+ this.major = major;
+ this.minor = minor;
+ this.patch = patch;
+ }
+
public Version(String versionString){
String[] versions = versionString.split("\\.");
if(versions.length!=3){