summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2018-08-22 11:35:17 -0400
committerJoey Grover <joeygrover@gmail.com>2018-08-22 11:35:17 -0400
commit8cd48bd4144631635219a86be60b639a97a04fb6 (patch)
treeee158679ba40ed9c16d9eca98f08f0411b540d5e
parente1afe0b26744510b5fe32415e64a32ad4d717f95 (diff)
downloadsdl_android-8cd48bd4144631635219a86be60b639a97a04fb6.tar.gz
RPCs will now be formatted through SdlProxyBase
This happens on marshalling and when the proxy base handles incomming messages. Subparams will be formated on retrieval when RPCs are retrieved due to them being stored as hashmaps instead of their actual RPC structs.
-rw-r--r--sdl_android/build.gradle2
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java34
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java85
-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/StreamRPCPacketizer.java3
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java3
9 files changed, 199 insertions, 64 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/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java b/sdl_android/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
index eb1519c17..aaeb01805 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/marshal/JsonRPCMarshaller.java
@@ -25,15 +25,15 @@ public class JsonRPCMarshaller {
private static final String SDL_LIB_PRIVATE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
- @Deprecated
+ /**
+ * @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) {
- return marshall(msg,new Version(version,0,0),null);
- }
-
- public static byte[] marshall(RPCMessage msg, Version protocolVersion, Version rpcMsgVersion) {
byte[] jsonBytes = null;
try {
- JSONObject jsonObject = msg.serializeJSON(protocolVersion, rpcMsgVersion);
+ JSONObject jsonObject = msg.serializeJSON(version);
jsonBytes = jsonObject.toString().getBytes();
SdlTrace.logMarshallingEvent(InterfaceActivityDirection.Transmit, jsonBytes, SDL_LIB_PRIVATE_KEY);
@@ -87,24 +87,17 @@ public class JsonRPCMarshaller {
return ret;
}
- @SuppressWarnings("unchecked")
- @Deprecated
private static JSONArray serializeList(List<?> list) throws JSONException{
- return serializeList(list,null);
-
- }
-
- private static JSONArray serializeList(List<?> list, Version rpcVersion) throws JSONException{
JSONArray toPut = new JSONArray();
Iterator<Object> valueIterator = (Iterator<Object>) list.iterator();
while(valueIterator.hasNext()){
Object anObject = valueIterator.next();
if (anObject instanceof RPCStruct) {
RPCStruct toSerialize = (RPCStruct) anObject;
- toPut.put(toSerialize.serializeStoreJSON(rpcVersion));
+ toPut.put(toSerialize.serializeJSON());
} else if(anObject instanceof Hashtable){
Hashtable<String, Object> toSerialize = (Hashtable<String, Object>)anObject;
- toPut.put(serializeHashtable(toSerialize,rpcVersion));
+ toPut.put(serializeHashtable(toSerialize));
} else {
toPut.put(anObject);
}
@@ -113,23 +106,18 @@ public class JsonRPCMarshaller {
}
@SuppressWarnings({"unchecked" })
- @Deprecated
public static JSONObject serializeHashtable(Hashtable<String, Object> hash) throws JSONException{
- return serializeHashtable(hash,null);
- }
-
- public static JSONObject serializeHashtable(Hashtable<String, Object> hash, Version rpcVersion) throws JSONException{
JSONObject obj = new JSONObject();
Iterator<String> hashKeyIterator = hash.keySet().iterator();
while (hashKeyIterator.hasNext()){
String key = (String) hashKeyIterator.next();
Object value = hash.get(key);
if (value instanceof RPCStruct) {
- obj.put(key, ((RPCStruct) value).serializeStoreJSON(rpcVersion));
+ obj.put(key, ((RPCStruct) value).serializeJSON());
} else if (value instanceof List<?>) {
- obj.put(key, serializeList((List<?>) value,rpcVersion));
+ obj.put(key, serializeList((List<?>) value));
} else if (value instanceof Hashtable) {
- obj.put(key, serializeHashtable((Hashtable<String, Object>)value, rpcVersion));
+ obj.put(key, serializeHashtable((Hashtable<String, Object>)value));
} else {
obj.put(key, value);
}
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 0963944d4..99960449b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
@@ -1,5 +1,7 @@
package com.smartdevicelink.proxy;
+import android.util.Log;
+
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.util.Version;
@@ -21,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
@@ -57,37 +63,68 @@ public class RPCStruct {
return JsonRPCMarshaller.deserializeJSONObject(jsonObject);
}
- @Deprecated
public JSONObject serializeJSON() throws JSONException {
- return serializeStoreJSON(null);
- }
-
- public JSONObject serializeStoreJSON(Version rpcMsgVersion) throws JSONException {
- format(rpcMsgVersion);
- return JsonRPCMarshaller.serializeHashtable(store, rpcMsgVersion);
+ return JsonRPCMarshaller.serializeHashtable(store);
}
@SuppressWarnings("unchecked")
public JSONObject serializeJSON(byte protocolVersion) throws JSONException {
- return serializeJSON(new Version(protocolVersion,0,0), null);
- }
-
- public JSONObject serializeJSON(Version version, Version rpcMsgVersion) throws JSONException {
- if (version.getMajor() > 1) {
+ 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);
- return JsonRPCMarshaller.serializeHashtable(parameters,rpcMsgVersion);
- } else return JsonRPCMarshaller.serializeHashtable(store, rpcMsgVersion);
+ return JsonRPCMarshaller.serializeHashtable(parameters);
+ } else return JsonRPCMarshaller.serializeHashtable(store);
}
/**
- * This method should clean the the RPC to make sure it is compliant with the spec
+ * 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
*/
- protected void format(Version rpcVersion){
+ 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 == true && 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);
+ }
+ }
+ }
}
@@ -178,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();
}
@@ -190,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 53ff92e59..f8fb1f353 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -1647,20 +1647,16 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public String serializeJSON(RPCMessage msg)
{
- String sReturn;
try
{
- //sReturn = msg.serializeJSON(getWiProVersion()).toString(2);
- sReturn = msg.serializeJSON(new com.smartdevicelink.util.Version(getWiProVersion(),0,0),
- rpcSpecVersion ).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) {
@@ -1804,8 +1800,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private void sendRPCRequestPrivate(RPCRequest request) throws SdlException {
try {
SdlTrace.logRPCEvent(InterfaceActivityDirection.Transmit, request, SDL_LIB_TRACE_KEY);
-
- byte[] msgBytes = JsonRPCMarshaller.marshall(request, new com.smartdevicelink.util.Version(_wiproVersion,0,0), rpcSpecVersion);
+
+ request.format(rpcSpecVersion,true);
+ byte[] msgBytes = JsonRPCMarshaller.marshall(request, _wiproVersion);
ProtocolMessage pm = new ProtocolMessage();
pm.setData(msgBytes);
@@ -2014,7 +2011,6 @@ 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
- rpcMsg.format(rpcSpecVersion);
String functionName = rpcMsg.getFunctionName();
String messageType = rpcMsg.getMessageType();
@@ -2030,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;
}
@@ -2054,7 +2051,11 @@ 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());
+ 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();
@@ -2175,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);
@@ -2190,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;
}
@@ -2264,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() {
@@ -2281,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() {
@@ -2298,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() {
@@ -2315,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() {
@@ -2332,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() {
@@ -2349,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() {
@@ -2366,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() {
@@ -2383,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() {
@@ -2400,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() {
@@ -2417,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() {
@@ -2433,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);
@@ -2460,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() {
@@ -2477,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() {
@@ -2494,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() {
@@ -2511,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() {
@@ -2528,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() {
@@ -2550,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);
@@ -2583,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() {
@@ -2599,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() {
@@ -2615,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() {
@@ -2633,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() {
@@ -2649,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() {
@@ -2665,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() {
@@ -2681,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() {
@@ -2697,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() {
@@ -2713,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());
@@ -2738,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() {
@@ -2754,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() {
@@ -2770,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() {
@@ -2786,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() {
@@ -2802,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() {
@@ -2818,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() {
@@ -2834,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() {
@@ -2850,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() {
@@ -2865,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() {
@@ -2880,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() {
@@ -2895,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() {
@@ -2912,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() {
@@ -2929,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() {
@@ -2946,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() {
@@ -2962,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
@@ -2977,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
@@ -2991,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
@@ -3005,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
@@ -3019,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
@@ -3034,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
@@ -3048,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
@@ -3062,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() {
@@ -3104,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() {
@@ -3123,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() {
@@ -3148,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() {
@@ -3174,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() {
@@ -3210,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() {
@@ -3227,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() {
@@ -3244,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() {
@@ -3261,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() {
@@ -3278,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() {
@@ -3295,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() {
@@ -3320,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)))){
@@ -3340,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() {
@@ -3356,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() {
@@ -3372,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() {
@@ -3395,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());
@@ -3424,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() {
@@ -3440,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() {
@@ -3456,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() {
@@ -3472,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() {
@@ -3488,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/StreamRPCPacketizer.java b/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
index 167dbd074..ae1fb50db 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
@@ -223,7 +223,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,rpcSpecVersion);
+ 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 cbcf528e1..03fc61ecc 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
@@ -1978,7 +1978,8 @@ public class SdlRouterService extends Service{
private byte[] createForceUnregisterApp(byte sessionId,byte version){
UnregisterAppInterface request = new UnregisterAppInterface();
request.setCorrelationID(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
- byte[] msgBytes = JsonRPCMarshaller.marshall(request, new Version(version,0,0), null);
+ request.format(null,true);
+ byte[] msgBytes = JsonRPCMarshaller.marshall(request, version);
ProtocolMessage pm = new ProtocolMessage();
pm.setData(msgBytes);
pm.setSessionID(sessionId);