summaryrefslogtreecommitdiff
path: root/sdl_android
diff options
context:
space:
mode:
Diffstat (limited to 'sdl_android')
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java2
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java12
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java14
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java96
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HybridAppPreferenceTests.java75
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java7
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java4
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java46
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java46
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java42
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java42
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java2
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java2
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java2
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java5
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java7
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java12
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java9
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java2
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java7
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java10
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java3
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java2
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java223
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java6
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CloudAppProperties.java104
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppProperties.java35
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppPropertiesResponse.java28
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java27
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java26
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppProperties.java36
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppPropertiesResponse.java18
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java27
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java17
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/HybridAppPreference.java16
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RequestType.java4
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java5
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/util/HttpUtils.java23
42 files changed, 1031 insertions, 82 deletions
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
index 675ecb4f2..896c7af6d 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
@@ -83,6 +83,8 @@ public class SdlProtocolTests extends AndroidTestCase2 {
public void setAcceptedVideoParams(VideoStreamingParameters acceptedVideoParams) {}
@Override
public void stopStream(SessionType serviceType) {}
+ @Override
+ public void onAuthTokenReceived(String token){}
};
DidReceiveListener onProtocolMessageReceivedListener = new DidReceiveListener();
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
index 8fa09eb74..853dc02cc 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
@@ -12,6 +12,7 @@ import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
import com.smartdevicelink.proxy.rpc.Choice;
import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities;
import com.smartdevicelink.proxy.rpc.ClimateControlData;
+import com.smartdevicelink.proxy.rpc.CloudAppProperties;
import com.smartdevicelink.proxy.rpc.Coordinate;
import com.smartdevicelink.proxy.rpc.DIDResult;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
@@ -102,6 +103,7 @@ import com.smartdevicelink.proxy.rpc.enums.FuelType;
import com.smartdevicelink.proxy.rpc.enums.GlobalProperty;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.HybridAppPreference;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStableStatus;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
@@ -303,6 +305,8 @@ public class Test {
public static final String GENERAL_APP_ID = "123e4567e8";
public static final String GENERAL_FULL_APP_ID = "123e4567-e89b-12d3-a456-426655440000";
public static final Version GENERAL_VERSION = new Version("4.0.0");
+ public static final HybridAppPreference GENERAL_HYBRID_APP_PREFERENCE = HybridAppPreference.CLOUD;
+ public static final CloudAppProperties GENERAL_CLOUD_APP_PROPERTIES = new CloudAppProperties();
public static final ModuleType GENERAL_MODULETYPE = ModuleType.CLIMATE;
public static final Temperature GENERAL_TEMPERATURE = new Temperature();
@@ -845,6 +849,14 @@ public class Test {
GENERAL_LOCKSCREENCONFIG.setEnabled(true);
GENERAL_LOCKSCREENCONFIG.setCustomView(R.layout.activity_sdllock_screen);
+ GENERAL_CLOUD_APP_PROPERTIES.setAppName(GENERAL_STRING);
+ GENERAL_CLOUD_APP_PROPERTIES.setAppID(GENERAL_STRING);
+ GENERAL_CLOUD_APP_PROPERTIES.setEnabled(GENERAL_BOOLEAN);
+ GENERAL_CLOUD_APP_PROPERTIES.setAuthToken(GENERAL_STRING);
+ GENERAL_CLOUD_APP_PROPERTIES.setCloudTransportType(GENERAL_STRING);
+ GENERAL_CLOUD_APP_PROPERTIES.setHybridAppPreference(GENERAL_HYBRID_APP_PREFERENCE);
+ GENERAL_CLOUD_APP_PROPERTIES.setEndpoint(GENERAL_STRING);
+
try {
JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_ALLOWED, GENERAL_HMILEVEL_LIST);
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
index aecbb44f0..3797c648b 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
@@ -31,6 +31,7 @@ import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
+import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
@@ -65,6 +66,7 @@ import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
import com.smartdevicelink.proxy.rpc.SendLocationResponse;
import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
+import com.smartdevicelink.proxy.rpc.SetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
@@ -650,5 +652,15 @@ public class SdlProxyBaseTests extends AndroidTestCase2 {
@Override
public void onOnRCStatus(OnRCStatus notification) {
}
- }
+
+ @Override
+ public void onSetCloudAppProperties(SetCloudAppPropertiesResponse response) {
+
+ }
+
+ @Override
+ public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
+
+ }
+ }
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java
new file mode 100644
index 000000000..5340efdd2
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/CloudAppPropertiesTests.java
@@ -0,0 +1,96 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.smartdevicelink.proxy.rpc.CloudAppProperties;
+import com.smartdevicelink.proxy.rpc.enums.HybridAppPreference;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CloudAppProperties}
+ */
+public class CloudAppPropertiesTests extends TestCase{
+
+ private CloudAppProperties msg;
+
+ @Override
+ public void setUp(){
+ msg = new CloudAppProperties();
+
+ msg.setAppName(Test.GENERAL_STRING);
+ msg.setAppID(Test.GENERAL_STRING);
+ msg.setEnabled(Test.GENERAL_BOOLEAN);
+ msg.setAuthToken(Test.GENERAL_STRING);
+ msg.setCloudTransportType(Test.GENERAL_STRING);
+ msg.setHybridAppPreference(Test.GENERAL_HYBRID_APP_PREFERENCE);
+ msg.setEndpoint(Test.GENERAL_STRING);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String appName = msg.getAppName();
+ String appID = msg.getAppID();
+ boolean enabled = msg.isEnabled();
+ String authToken = msg.getAuthToken();
+ String cloudTransportType = msg.getCloudTransportType();
+ HybridAppPreference hybridAppPreference = msg.getHybridAppPreference();
+ String endpoint = msg.getEndpoint();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, appName);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, appID);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, enabled);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, authToken);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, cloudTransportType);
+ assertEquals(Test.MATCH, Test.GENERAL_HYBRID_APP_PREFERENCE, hybridAppPreference);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, endpoint);
+
+ // Invalid/Null Tests
+ CloudAppProperties msg = new CloudAppProperties();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getAppName());
+ assertNull(Test.NULL, msg.getAppID());
+ assertNull(Test.NULL, msg.isEnabled());
+ assertNull(Test.NULL, msg.getAuthToken());
+ assertNull(Test.NULL, msg.getCloudTransportType());
+ assertNull(Test.NULL, msg.getHybridAppPreference());
+ assertNull(Test.NULL, msg.getEndpoint());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(CloudAppProperties.KEY_APP_NAME, Test.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_APP_ID, Test.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_ENABLED, Test.GENERAL_BOOLEAN);
+ reference.put(CloudAppProperties.KEY_AUTH_TOKEN, Test.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_CLOUD_TRANSPORT_TYPE, Test.GENERAL_STRING);
+ reference.put(CloudAppProperties.KEY_HYBRID_APP_PREFERENCE, Test.GENERAL_HYBRID_APP_PREFERENCE);
+ reference.put(CloudAppProperties.KEY_ENDPOINT, Test.GENERAL_STRING);
+
+ JSONObject underTest = msg.serializeJSON();
+
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HybridAppPreferenceTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HybridAppPreferenceTests.java
new file mode 100644
index 000000000..89485a974
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/HybridAppPreferenceTests.java
@@ -0,0 +1,75 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import com.smartdevicelink.proxy.rpc.enums.HybridAppPreference;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.HybridAppPreference}
+ */
+public class HybridAppPreferenceTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "MOBILE";
+ HybridAppPreference enumMobile = HybridAppPreference.valueForString(example);
+ example = "CLOUD";
+ HybridAppPreference enumCloud = HybridAppPreference.valueForString(example);
+ example = "BOTH";
+ HybridAppPreference enumBoth = HybridAppPreference.valueForString(example);
+
+ assertNotNull("MOBILE returned null", enumMobile);
+ assertNotNull("CLOUD returned null", enumCloud);
+ assertNotNull("BOTH returned null", enumBoth);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "deFaUlt";
+ try {
+ HybridAppPreference temp = HybridAppPreference.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ HybridAppPreference temp = HybridAppPreference.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of HybridAppPreference.
+ */
+ public void testListEnum() {
+ List<HybridAppPreference> enumValueList = Arrays.asList(HybridAppPreference.values());
+
+ List<HybridAppPreference> enumTestList = new ArrayList<>();
+ enumTestList.add(HybridAppPreference.MOBILE);
+ enumTestList.add(HybridAppPreference.CLOUD);
+ enumTestList.add(HybridAppPreference.BOTH);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java
index 4ae23815f..d00cfe93f 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/RequestTypeTests.java
@@ -11,7 +11,7 @@ import com.smartdevicelink.test.Test;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.enums.RequestType}
+ * {@link com.smartdevicelink.proxy.rpc.enums.RequestType}
*/
public class RequestTypeTests extends TestCase {
@@ -60,6 +60,8 @@ public class RequestTypeTests extends TestCase {
RequestType enumMedia = RequestType.valueForString(example);
example = "FOTA";
RequestType enumFota = RequestType.valueForString(example);
+ example = "ICON_URL";
+ RequestType enumIconURL = RequestType.valueForString(example);
assertNotNull("HTTP returned null", enumHttp);
assertNotNull("FILE_RESUME returned null", enumFileResume);
@@ -67,6 +69,7 @@ public class RequestTypeTests extends TestCase {
assertNotNull("AUTH_CHALLENGE returned null", enumAuthChallenge);
assertNotNull("AUTH_ACK returned null", enumAuthAck);
assertNotNull("PROPRIETARY returned null", enumProprietary);
+ assertNotNull("ICON_URL returned null", enumIconURL);
assertNotNull(Test.NOT_NULL, enumQueryApps);
assertNotNull(Test.NOT_NULL, enumLaunchApp);
@@ -82,6 +85,7 @@ public class RequestTypeTests extends TestCase {
assertNotNull(Test.NOT_NULL, enumEmergency);
assertNotNull(Test.NOT_NULL, enumMedia);
assertNotNull(Test.NOT_NULL, enumFota);
+ assertNotNull(Test.NOT_NULL, enumIconURL);
}
/**
@@ -141,6 +145,7 @@ public class RequestTypeTests extends TestCase {
enumTestList.add(RequestType.MEDIA);
enumTestList.add(RequestType.FOTA);
enumTestList.add(RequestType.OEM_SPECIFIC);
+ enumTestList.add(RequestType.ICON_URL);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
index 9f9ff3449..56c418590 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
@@ -78,6 +78,8 @@ public class VehicleDataTypeTests extends TestCase {
VehicleDataType enumVehicleDataTurnSignal = VehicleDataType.valueForString(example);
example = "VEHICLEDATA_ELECTRONICPARKBRAKESTATUS";
VehicleDataType enumVehicleDataElectronicParkBrakeStatus = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_CLOUDAPPVEHICLEID";
+ VehicleDataType enumVehicleCloudAppVehicleId = VehicleDataType.valueForString(example);
assertNotNull("VEHICLEDATA_GPS returned null", enumVehicleDataGps);
assertNotNull("VEHICLEDATA_SPEED returned null", enumVehicleDataSpeed);
@@ -109,6 +111,7 @@ public class VehicleDataTypeTests extends TestCase {
assertNotNull("VEHICLEDATA_FUELRANGE returned null", enumVehicleDataFuelRange);
assertNotNull("VEHICLEDATA_TURNSIGNAL returned null", enumVehicleDataTurnSignal);
assertNotNull("VEHICLEDATA_ELECTRONICPARKBRAKESTATUS returned null", enumVehicleDataElectronicParkBrakeStatus);
+ assertNotNull("VEHICLEDATA_CLOUDAPPVEHICLEID returned null", enumVehicleCloudAppVehicleId);
}
/**
@@ -176,6 +179,7 @@ public class VehicleDataTypeTests extends TestCase {
enumTestList.add(VehicleDataType.VEHICLEDATA_FUELRANGE);
enumTestList.add(VehicleDataType.VEHICLEDATA_TURNSIGNAL);
enumTestList.add(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_CLOUDAPPVEHICLEID);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java
new file mode 100644
index 000000000..423e53add
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetCloudAppPropertiesTests.java
@@ -0,0 +1,46 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetCloudAppProperties;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class GetCloudAppPropertiesTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ GetCloudAppProperties msg = new GetCloudAppProperties();
+
+ msg.setAppId(Test.GENERAL_STRING);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_CLOUD_APP_PROPERTIES.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(GetCloudAppProperties.KEY_APP_ID, Test.GENERAL_STRING);
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java
new file mode 100644
index 000000000..ea817c85e
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetCloudAppPropertiesTests.java
@@ -0,0 +1,46 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.SetCloudAppProperties;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class SetCloudAppPropertiesTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ SetCloudAppProperties msg = new SetCloudAppProperties();
+
+ msg.setProperties(Test.GENERAL_CLOUD_APP_PROPERTIES);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.SET_CLOUD_APP_PROPERTIES.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(SetCloudAppProperties.KEY_PROPERTIES, Test.GENERAL_CLOUD_APP_PROPERTIES.serializeJSON());
+ }catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java
new file mode 100644
index 000000000..e082c82f9
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetCloudAppPropertiesResponseTests.java
@@ -0,0 +1,42 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+
+import org.json.JSONObject;
+
+public class GetCloudAppPropertiesResponseTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage(){
+ return new GetCloudAppPropertiesResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.GET_CLOUD_APP_PROPERTIES.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ GetCloudAppPropertiesResponse msg = new GetCloudAppPropertiesResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java
new file mode 100644
index 000000000..894c7ee78
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetCloudAppPropertiesResponseTests.java
@@ -0,0 +1,42 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.SetCloudAppPropertiesResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+
+import org.json.JSONObject;
+
+public class SetCloudAppPropertiesResponseTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage(){
+ return new SetCloudAppPropertiesResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.SET_CLOUD_APP_PROPERTIES.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ SetCloudAppPropertiesResponse msg = new SetCloudAppPropertiesResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
index e91903e21..82a042b81 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
@@ -114,6 +114,8 @@ public class SdlSecurityBaseTest extends AndroidTestCase2 {
byte sessionID) {
}
+ @Override
+ public void onAuthTokenReceived(String token, byte bytes){}
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
index 79fad2abb..f548560a9 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
@@ -68,4 +68,6 @@ public class MockInterfaceBroker implements ISdlConnectionListener {
byte sessionID) {
}
+ @Override
+ public void onAuthTokenReceived(String token, byte bytes){}
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
index 8c9032d7b..627c6eca9 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
@@ -35,4 +35,6 @@ public interface ISdlConnectionListener {
public void onHeartbeatTimedOut(byte sessionID);
public void onProtocolServiceDataACK(SessionType sessionType, int dataSize, byte sessionID);
+
+ void onAuthTokenReceived(String authToken, byte sessionID);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java
index 1d7055045..f67ac66af 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlConnection.java
@@ -37,7 +37,7 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
SdlTransport _transport = null;
AbstractProtocol _protocol = null;
ISdlConnectionListener _connectionListener = null;
-
+
// Thread safety locks
@@ -341,7 +341,13 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
}
}
return null;
- }
+ }
+
+ public void onAuthTokenReceived(String authToken, byte sessionID) {
+ if(this._connectionListener != null){
+ this._connectionListener.onAuthTokenReceived(authToken,sessionID);
+ }
+ }
private class InternalMsgDispatcher implements ISdlConnectionListener {
@@ -473,6 +479,14 @@ public class SdlConnection implements IProtocolListener, ITransportListener {
session.onProtocolServiceDataACK(serviceType, dataSize, sessionID);
}
}
+
+ @Override
+ public void onAuthTokenReceived(String authToken, byte sessionID) {
+ SdlSession session = findSessionById(sessionID);
+ if (session != null) {
+ session.onAuthTokenReceived(authToken,sessionID);
+ }
+ }
}
public int getRegisterCount() {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
index f509f412c..44df5f64c 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
@@ -658,6 +658,11 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
}
@Override
+ public void onAuthTokenReceived(String authToken, byte sessionId) {
+ this.sessionListener.onAuthTokenReceived(authToken, sessionId);
+ }
+
+ @Override
public void onSecurityInitialized() {
if (_sdlConnection != null && sdlSecurity != null)
diff --git a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
index 501fc31c8..913c8d5ee 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
@@ -233,6 +233,8 @@ public class SdlSession2 extends SdlSession implements ISdlProtocol{
public void onResetOutgoingHeartbeat(SessionType sessionType, byte sessionID) {/* Not supported */}
@Override
public void onResetIncomingHeartbeat(SessionType sessionType, byte sessionID) {/* Not supported */}
+ @Override
+ public void onAuthTokenReceived(String authToken, byte sessionID){/* Do nothing */ }
/* ***********************************************************************************************************************************************************************
* ***************************************************************** Security Listener *********************************************************************************
@@ -270,6 +272,11 @@ public class SdlSession2 extends SdlSession implements ISdlProtocol{
}
+ @Override
+ public void onAuthTokenReceived(String authToken) {
+ sessionListener.onAuthTokenReceived(authToken,sessionId);
+ }
+
/**
* Check to see if a transport is available to start/use the supplied service.
* @param sessionType the session that should be checked for transport availability
diff --git a/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java b/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
index b8d97f39c..29b7c1387 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
@@ -22,6 +22,7 @@ import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
+import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
@@ -58,6 +59,7 @@ import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
import com.smartdevicelink.proxy.rpc.SendLocationResponse;
import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
+import com.smartdevicelink.proxy.rpc.SetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
@@ -557,4 +559,14 @@ public class ProxyBridge implements IProxyListener{
public void onOnRCStatus(OnRCStatus notification) {
onRPCReceived(notification);
}
+
+ @Override
+ public void onSetCloudAppProperties(SetCloudAppPropertiesResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
+ onRPCReceived(response);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java b/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
index b1c281903..0a97c518b 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
@@ -391,6 +391,15 @@ public class SdlManager{
return null;
}
+ /**
+ * Retrieves the auth token, if any, that was attached to the StartServiceACK for the RPC
+ * service from the module. For example, this should be used to login to a user account.
+ * @return the string representation of the auth token
+ */
+ public String getAuthToken(){
+ return this.proxy.getAuthToken();
+ }
+
// PROTECTED GETTERS
protected String getAppName() { return appName; }
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java
index beb78a90a..32a21ec2a 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java
@@ -53,4 +53,6 @@ public interface ISdlProtocol extends IProtocolListener {
void setAcceptedVideoParams(VideoStreamingParameters acceptedVideoParams);
void stopStream(SessionType serviceType);
+
+ void onAuthTokenReceived(String authToken);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
index 7f223d1ce..955a72fc8 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
@@ -978,6 +978,13 @@ public class SdlProtocol {
Log.w(TAG, "Received a start service ack for RPC service while already active on a different transport.");
return;
}
+
+ if(protocolVersion.isNewerThan(new Version(5,2,0)) >= 0){
+ String authToken = (String)packet.getTag(ControlFrameTags.RPC.StartServiceACK.AUTH_TOKEN);
+ if(authToken != null){
+ iSdlProtocol.onAuthTokenReceived(authToken);
+ }
+ }
}else {
//Version is either not included or lower than 5.1.0
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
index 0d99d63a5..bc7c04b08 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/WiProProtocol.java
@@ -503,6 +503,16 @@ public class WiProProtocol extends AbstractProtocol {
}
}
handleProtocolSessionStarted(serviceType,(byte) packet.getSessionId(), getMajorVersionByte(), "", hashID, packet.isEncrypted());
+
+ if(serviceType.equals(SessionType.RPC)
+ && protocolVersion.isNewerThan(new Version(5,2,0)) >= 0){
+ // This has to be done after the session has been established because
+ // SdlConnection is just setup that way
+ String authToken = (String)packet.getTag(ControlFrameTags.RPC.StartServiceACK.AUTH_TOKEN);
+ if(authToken != null){
+ sdlconn.onAuthTokenReceived(authToken, (byte)packet.getSessionId());
+ }
+ }
} else if (frameInfo == FrameDataControlFrameType.StartSessionNACK.getValue()) {
List<String> rejectedParams = null;
if(packet.version >= 5){
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java
index bc926f714..0dd46ecfd 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/ControlFrameTags.java
@@ -35,6 +35,9 @@ public class ControlFrameTags {
/** HU allowed transports for audio and video services (1 == Primary, 2 == Secondary) */
public static final String AUDIO_SERVICE_TRANSPORTS = "audioServiceTransports";
public static final String VIDEO_SERVICE_TRANSPORTS = "videoServiceTransports";
+ /** Auth token to be used for log in into services **/
+ public static final String AUTH_TOKEN = "authToken";
+
}
public static class StartServiceNAK extends NAKBase{}
public static class EndService {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
index 4f1ad71b5..c5cacaed9 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -63,6 +63,8 @@ public enum FunctionID{
UNSUBSCRIBE_WAY_POINTS(47, "UnsubscribeWayPoints"),
GET_SYSTEM_CAPABILITY(48, "GetSystemCapability"),
SEND_HAPTIC_DATA(49, "SendHapticData"),
+ SET_CLOUD_APP_PROPERTIES(50, "SetCloudAppProperties"),
+ GET_CLOUD_APP_PROPERTIES(51, "GetCloudAppProperties"),
// NOTIFICATIONS
ON_HMI_STATUS(32768, "OnHMIStatus"),
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 485d6fec4..986310d5f 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -94,6 +94,7 @@ import com.smartdevicelink.transport.USBTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.CorrelationIdGenerator;
import com.smartdevicelink.util.DebugTool;
+import com.smartdevicelink.util.HttpUtils;
import com.smartdevicelink.util.Version;
import org.json.JSONArray;
@@ -256,6 +257,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
protected VideoStreamingManager manager; //Will move to SdlSession once the class becomes public
+ protected String authToken;
+
private Version minimumProtocolVersion;
private Version minimumRPCVersion;
@@ -679,6 +682,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
+
public void onProtocolServiceDataACK(SessionType sessionType, final int dataSize,
byte sessionID) {
if (_callbackToUIThread) {
@@ -693,6 +697,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onServiceDataACK(dataSize);
}
}
+
+ @Override
+ public void onAuthTokenReceived(String authToken, byte sessionID) {
+ SdlProxyBase.this.authToken = authToken;
+ }
}
/**
@@ -1177,51 +1186,54 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sendBroadcastIntent(sendIntent);
}
}
-
-
+
+
private void sendOnSystemRequestToUrl(OnSystemRequest msg)
- {
+ {
Intent sendIntent = createBroadcastIntent();
Intent sendIntent2 = createBroadcastIntent();
HttpURLConnection urlConnection = null;
boolean bLegacy = false;
-
+
String sURLString;
- if (!getPoliciesURL().equals(""))
+ if (!getPoliciesURL().equals("")) {
sURLString = sPoliciesURL;
- else
+ } else {
sURLString = msg.getUrl();
+ }
Integer iTimeout = msg.getTimeout();
if (iTimeout == null)
iTimeout = 2000;
-
- Headers myHeader = msg.getHeader();
-
+
+ Headers myHeader = msg.getHeader();
+
+ RequestType requestType = msg.getRequestType();
updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "sendOnSystemRequestToUrl");
- updateBroadcastIntent(sendIntent, "COMMENT5", "\r\nCloud URL: " + sURLString);
-
- try
+ updateBroadcastIntent(sendIntent, "COMMENT5", "\r\nCloud URL: " + sURLString);
+
+ try
{
- if (myHeader == null)
+ if (myHeader == null) {
updateBroadcastIntent(sendIntent, "COMMENT7", "\r\nHTTPRequest Header is null");
-
- String sBodyString = msg.getBody();
-
+ }
+
+ String sBodyString = msg.getBody();
+
JSONObject jsonObjectToSendToServer;
String valid_json = "";
int length;
if (sBodyString == null)
- {
- if(RequestType.HTTP.equals(msg.getRequestType())){
+ {
+ if(requestType == RequestType.HTTP ){
length = msg.getBulkData().length;
Intent sendIntent3 = createBroadcastIntent();
updateBroadcastIntent(sendIntent3, "FUNCTION_NAME", "replace");
- updateBroadcastIntent(sendIntent3, "COMMENT1", "Valid Json length before replace: " + length);
+ updateBroadcastIntent(sendIntent3, "COMMENT1", "Valid Json length before replace: " + length);
sendBroadcastIntent(sendIntent3);
-
+
}else{
List<String> legacyData = msg.getLegacyData();
JSONArray jsonArrayOfSdlPPackets = new JSONArray(legacyData);
@@ -1234,17 +1246,17 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
else
- {
+ {
Intent sendIntent3 = createBroadcastIntent();
updateBroadcastIntent(sendIntent3, "FUNCTION_NAME", "replace");
- updateBroadcastIntent(sendIntent3, "COMMENT1", "Valid Json length before replace: " + sBodyString.getBytes("UTF-8").length);
+ updateBroadcastIntent(sendIntent3, "COMMENT1", "Valid Json length before replace: " + sBodyString.getBytes("UTF-8").length);
sendBroadcastIntent(sendIntent3);
valid_json = sBodyString.replace("\\", "");
length = valid_json.getBytes("UTF-8").length;
}
-
+
urlConnection = getURLConnection(myHeader, sURLString, iTimeout, length);
-
+
if (urlConnection == null)
{
Log.i(TAG, "urlConnection is null, check RPC input parameters");
@@ -1253,44 +1265,44 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream());
- if(RequestType.HTTP.equals(msg.getRequestType())){
+ if(requestType == RequestType.HTTP){
wr.write(msg.getBulkData());
}else{
wr.writeBytes(valid_json);
}
-
+
wr.flush();
wr.close();
-
-
+
+
long BeforeTime = System.currentTimeMillis();
long AfterTime = System.currentTimeMillis();
final long roundtriptime = AfterTime - BeforeTime;
-
+
updateBroadcastIntent(sendIntent, "COMMENT4", " Round trip time: " + roundtriptime);
- updateBroadcastIntent(sendIntent, "COMMENT1", "Received response from cloud, response code=" + urlConnection.getResponseCode() + " ");
-
+ updateBroadcastIntent(sendIntent, "COMMENT1", "Received response from cloud, response code=" + urlConnection.getResponseCode() + " ");
+
int iResponseCode = urlConnection.getResponseCode();
-
+
if (iResponseCode != HttpURLConnection.HTTP_OK)
{
Log.i(TAG, "Response code not HTTP_OK, returning from sendOnSystemRequestToUrl.");
updateBroadcastIntent(sendIntent, "COMMENT2", "Response code not HTTP_OK, aborting request. ");
return;
}
-
+
InputStream is = urlConnection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
- StringBuilder response = new StringBuilder();
- while((line = rd.readLine()) != null)
+ StringBuilder response = new StringBuilder();
+ while((line = rd.readLine()) != null)
{
response.append(line);
response.append('\r');
}
rd.close();
//We've read the body
- if(RequestType.HTTP.equals(msg.getRequestType())){
+ if(requestType == RequestType.HTTP){
// Create the SystemRequest RPC to send to module.
PutFile putFile = new PutFile();
putFile.setFileType(FileType.JSON);
@@ -1299,39 +1311,39 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
putFile.setFileData(response.toString().getBytes("UTF-8"));
putFile.setCRC(response.toString().getBytes());
updateBroadcastIntent(sendIntent, "DATA", "Data from cloud response: " + response.toString());
-
+
sendRPCRequestPrivate(putFile);
Log.i("sendSystemRequestToUrl", "sent to sdl");
updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.PUT_FILE.toString());
updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
updateBroadcastIntent(sendIntent2, "CORRID", putFile.getCorrelationID());
-
+
}else{
- Vector<String> cloudDataReceived = new Vector<String>();
+ Vector<String> cloudDataReceived = new Vector<String>();
final String dataKey = "data";
// Convert the response to JSON
- JSONObject jsonResponse = new JSONObject(response.toString());
+ JSONObject jsonResponse = new JSONObject(response.toString());
if(jsonResponse.has(dataKey)){
- if (jsonResponse.get(dataKey) instanceof JSONArray)
+ if (jsonResponse.get(dataKey) instanceof JSONArray)
{
JSONArray jsonArray = jsonResponse.getJSONArray(dataKey);
- for (int i=0; i<jsonArray.length(); i++)
+ for (int i=0; i<jsonArray.length(); i++)
{
- if (jsonArray.get(i) instanceof String)
+ if (jsonArray.get(i) instanceof String)
{
cloudDataReceived.add(jsonArray.getString(i));
//Log.i("sendSystemRequestToUrl", "jsonArray.getString(i): " + jsonArray.getString(i));
}
}
- }
- else if (jsonResponse.get(dataKey) instanceof String)
+ }
+ else if (jsonResponse.get(dataKey) instanceof String)
{
cloudDataReceived.add(jsonResponse.getString(dataKey));
//Log.i("sendSystemRequestToUrl", "jsonResponse.getString(data): " + jsonResponse.getString("data"));
- }
+ }
}
- else
+ else
{
DebugTool.logError("sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
//Log.i("sendSystemRequestToUrl", "sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
@@ -1366,7 +1378,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
if (getIsConnected())
- {
+ {
sendRPCRequestPrivate(mySystemRequest);
Log.i("sendSystemRequestToUrl", "sent to sdl");
@@ -1376,43 +1388,43 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
}
- catch (SdlException e)
+ catch (SdlException e)
{
DebugTool.logError("sendSystemRequestToUrl: Could not get data from JSONObject received.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " SdlException encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: Could not get data from JSONObject received."+ e);
- }
- catch (JSONException e)
+ }
+ catch (JSONException e)
{
DebugTool.logError("sendSystemRequestToUrl: JSONException: ", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " JSONException encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: JSONException: "+ e);
- }
- catch (UnsupportedEncodingException e)
+ }
+ catch (UnsupportedEncodingException e)
{
DebugTool.logError("sendSystemRequestToUrl: Could not encode string.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " UnsupportedEncodingException encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: Could not encode string."+ e);
- }
- catch (ProtocolException e)
+ }
+ catch (ProtocolException e)
{
DebugTool.logError("sendSystemRequestToUrl: Could not set request method to post.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " ProtocolException encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: Could not set request method to post."+ e);
- }
- catch (MalformedURLException e)
+ }
+ catch (MalformedURLException e)
{
DebugTool.logError("sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server.", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " MalformedURLException encountered sendOnSystemRequestToUrl: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server."+ e);
- }
- catch (IOException e)
+ }
+ catch (IOException e)
{
DebugTool.logError("sendSystemRequestToUrl: IOException: ", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " IOException while sending to cloud: IOException: "+ e);
//Log.i("pt", "sendSystemRequestToUrl: IOException: "+ e);
- }
- catch (Exception e)
+ }
+ catch (Exception e)
{
DebugTool.logError("sendSystemRequestToUrl: Unexpected Exception: ", e);
updateBroadcastIntent(sendIntent, "COMMENT3", " Exception encountered sendOnSystemRequestToUrl: "+ e);
@@ -1428,9 +1440,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
else
iFileCount = 0;
- if(urlConnection != null)
+ if(urlConnection != null)
{
- urlConnection.disconnect();
+ urlConnection.disconnect();
}
}
}
@@ -3366,8 +3378,39 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onSendHapticDataResponse( msg);
onRPCResponseReceived(msg);
}
- }
- else {
+ } else if (functionName.equals(FunctionID.SET_CLOUD_APP_PROPERTIES.toString())) {
+ final SetCloudAppPropertiesResponse msg = new SetCloudAppPropertiesResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onSetCloudAppProperties(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onSetCloudAppProperties(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.GET_CLOUD_APP_PROPERTIES.toString())) {
+ final GetCloudAppPropertiesResponse msg = new GetCloudAppPropertiesResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onGetCloudAppProperties(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onGetCloudAppProperties(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else {
if (_sdlMsgVersion != null) {
DebugTool.logError("Unrecognized response Message: " + functionName +
" SDL Message Version = " + _sdlMsgVersion);
@@ -3637,9 +3680,10 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
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)))){
+ RequestType requestType = msg.getRequestType();
+ if(msg.getUrl() != null) {
+ if (((requestType == RequestType.PROPRIETARY) && (msg.getFileType() == FileType.JSON))
+ || ((requestType == RequestType.HTTP) && (msg.getFileType() == FileType.BINARY))) {
Thread handleOffboardTransmissionThread = new Thread() {
@Override
public void run() {
@@ -3648,15 +3692,34 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
};
handleOffboardTransmissionThread.start();
+ } else if (requestType == RequestType.LOCK_SCREEN_ICON_URL) {
+ //Cache this for when the lockscreen is displayed
+ lockScreenIconRequest = msg;
+ } else if (requestType == RequestType.ICON_URL) {
+ //Download the icon file and send SystemRequest RPC
+ Thread handleOffBoardTransmissionThread = new Thread() {
+ @Override
+ public void run() {
+ byte[] file = HttpUtils.downloadFile(msg.getUrl());
+ if (file != null) {
+ SystemRequest systemRequest = new SystemRequest();
+ systemRequest.setFileName(msg.getUrl());
+ systemRequest.setBulkData(file);
+ systemRequest.setRequestType(RequestType.ICON_URL);
+ try {
+ sendRPCRequestPrivate(systemRequest);
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ } else {
+ DebugTool.logError("File was null at: " + msg.getUrl());
+ }
+ }
+ };
+ handleOffBoardTransmissionThread.start();
}
-
-
- if(msg.getRequestType() == RequestType.LOCK_SCREEN_ICON_URL &&
- msg.getUrl() != null){
- lockScreenIconRequest = msg;
- }
-
- msg.format(rpcSpecVersion, true);
+ }
+
if (_callbackToUIThread) {
// Run in UI thread
_mainUIHandler.post(new Runnable() {
@@ -7448,6 +7511,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
return this.raiResponse;
}
+ /**
+ * Retrieves the auth token, if any, that was attached to the StartServiceACK for the RPC
+ * service from the module. For example, this should be used to login to a user account.
+ * @return the string representation of the auth token
+ */
+ public String getAuthToken(){
+ return this.authToken;
+ }
/**
* VideoStreamingManager houses all the elements needed to create a scoped, streaming manager for video projection. It is only a private, instance
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
index b7486785f..bc989352d 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
@@ -17,6 +17,7 @@ import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
import com.smartdevicelink.proxy.rpc.GenericResponse;
+import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
@@ -51,6 +52,7 @@ import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
import com.smartdevicelink.proxy.rpc.SendLocationResponse;
import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
+import com.smartdevicelink.proxy.rpc.SetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
@@ -356,4 +358,8 @@ public interface IProxyListenerBase {
public void onSendHapticDataResponse(SendHapticDataResponse response);
public void onOnRCStatus(OnRCStatus notification);
+
+ public void onSetCloudAppProperties(SetCloudAppPropertiesResponse response);
+
+ public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CloudAppProperties.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CloudAppProperties.java
new file mode 100644
index 000000000..6538496ee
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CloudAppProperties.java
@@ -0,0 +1,104 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.HybridAppPreference;
+
+import java.util.Hashtable;
+
+/**
+ * Properties that relate to a a cloud app entry.
+ */
+public class CloudAppProperties extends RPCStruct {
+ public static final String KEY_APP_NAME = "appName";
+ public static final String KEY_APP_ID = "appID";
+ public static final String KEY_ENABLED = "enabled";
+ public static final String KEY_AUTH_TOKEN = "authToken";
+ public static final String KEY_CLOUD_TRANSPORT_TYPE = "cloudTransportType";
+ public static final String KEY_HYBRID_APP_PREFERENCE = "hybridAppPreference";
+ public static final String KEY_ENDPOINT = "endpoint";
+
+
+ public CloudAppProperties(){}
+
+ public CloudAppProperties(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public CloudAppProperties(@NonNull String appName, @NonNull String appID){
+ this();
+ setValue(KEY_APP_NAME, appName);
+ setValue(KEY_APP_ID, appID);
+ }
+
+ public void setAppName(String appName){
+ setValue(KEY_APP_NAME, appName);
+ }
+
+ public String getAppName(){
+ return getString(KEY_APP_NAME);
+ }
+
+ public void setAppID(String appID){
+ setValue(KEY_APP_ID, appID);
+ }
+
+ public String getAppID(){
+ return getString(KEY_APP_ID);
+ }
+
+ /**
+ * If true, this cloud app entry will designate it should appear in the HMI
+ * @param enabled if the app should be
+ */
+ public void setEnabled(boolean enabled){
+ setValue(KEY_ENABLED, enabled);
+ }
+
+ /**
+ * @return if this cloud app entry will designate it should appear in the HMI
+ */
+ public Boolean isEnabled(){
+ return getBoolean(KEY_ENABLED);
+ }
+
+ public void setAuthToken(String token){
+ setValue(KEY_AUTH_TOKEN, token);
+ }
+
+ public String getAuthToken(){
+ return getString(KEY_AUTH_TOKEN);
+ }
+
+ public void setCloudTransportType(String transportType){
+ setValue(KEY_CLOUD_TRANSPORT_TYPE, transportType);
+ }
+
+ public String getCloudTransportType(){
+ return getString(KEY_CLOUD_TRANSPORT_TYPE);
+ }
+
+ public void setHybridAppPreference(HybridAppPreference hybridAppPreference){
+ setValue(KEY_HYBRID_APP_PREFERENCE, hybridAppPreference);
+ }
+
+ public HybridAppPreference getHybridAppPreference(){
+ return (HybridAppPreference)getObject(HybridAppPreference.class, KEY_HYBRID_APP_PREFERENCE);
+ }
+
+ /**
+ * @param token - max length ="65535"
+ */
+ public void setEndpoint(String token){
+ setValue(KEY_ENDPOINT, token);
+ }
+
+ /**
+ * @return token - max length ="65535"
+ */
+ public String getEndpoint(){
+ return getString(KEY_ENDPOINT);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppProperties.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppProperties.java
new file mode 100644
index 000000000..032ae7dad
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppProperties.java
@@ -0,0 +1,35 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+public class GetCloudAppProperties extends RPCRequest {
+
+ public static final String KEY_APP_ID = "appID";
+
+ public GetCloudAppProperties() {
+ super(FunctionID.GET_CLOUD_APP_PROPERTIES.toString());
+ }
+
+ public GetCloudAppProperties(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public GetCloudAppProperties(@NonNull String appID){
+ this();
+ setParameters(KEY_APP_ID, appID);
+ }
+
+ public void setAppId(String appId){
+ setParameters(KEY_APP_ID, appId);
+ }
+
+ public String getAppId(){
+ return getString((KEY_APP_ID));
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppPropertiesResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppPropertiesResponse.java
new file mode 100644
index 000000000..7577dd396
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetCloudAppPropertiesResponse.java
@@ -0,0 +1,28 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+
+import java.util.Hashtable;
+
+public class GetCloudAppPropertiesResponse extends RPCResponse {
+
+ public static final String KEY_PROPERTIES = "properties";
+
+ public GetCloudAppPropertiesResponse() {
+ super(FunctionID.GET_CLOUD_APP_PROPERTIES.toString());
+ }
+ public GetCloudAppPropertiesResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public void setCloudAppProperties(@NonNull CloudAppProperties cloudAppProperties){
+ setParameters(KEY_PROPERTIES, cloudAppProperties);
+ }
+
+ public CloudAppProperties getCloudAppProperties(){
+ return (CloudAppProperties) getObject(CloudAppProperties.class, KEY_PROPERTIES);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
index e751f4a3f..b847b37bc 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
@@ -194,7 +194,15 @@ import java.util.Hashtable;
* <td>Subscribable</td>
* <td>SmartDeviceLink 5.0</td>
* </tr>
- * </table>
+ * <tr>
+ * <td>cloudAppVehicleID</td>
+ * <td>Boolean</td>
+ * <td>ID for the vehicle when connecting to cloud applications</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
+ * <td>SmartDeviceLink 5.1 </td>
+ * </tr>
+ * </table>
*
*
* <p><b>Response</b></p>
@@ -247,6 +255,7 @@ public class GetVehicleData extends RPCRequest {
public static final String KEY_FUEL_RANGE = "fuelRange";
public static final String KEY_TURN_SIGNAL = "turnSignal";
public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
/**
* Constructs a new GetVehicleData object
@@ -484,4 +493,20 @@ public class GetVehicleData extends RPCRequest {
public Boolean getElectronicParkBrakeStatus(){
return getBoolean(KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
+
+ /**
+ * Sets a boolean value. If true, gets the cloudAppVehicleID data
+ * @param cloudAppVehicleID a boolean value
+ */
+ public void setCloudAppVehicleID(boolean cloudAppVehicleID){
+ setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
+ }
+
+ /**
+ * Gets a boolean value. If true, means the cloudAppVehicleDataID data has been set to retrieve.
+ * @return a Boolean value.
+ */
+ public Boolean getCloudAppVehicleID(){
+ return getBoolean(KEY_CLOUD_APP_VEHICLE_ID);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
index 91eefc13c..fc26a2c9a 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
@@ -52,6 +52,7 @@ public class GetVehicleDataResponse extends RPCResponse {
public static final String KEY_FUEL_RANGE = "fuelRange";
public static final String KEY_TURN_SIGNAL = "turnSignal";
public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
/**
* Constructs a new GetVehicleDataResponse object
@@ -313,4 +314,20 @@ public class GetVehicleDataResponse extends RPCResponse {
public ElectronicParkBrakeStatus getElectronicParkBrakeStatus(){
return (ElectronicParkBrakeStatus) getObject(ElectronicParkBrakeStatus.class, KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
+
+ /**
+ * Sets a string value for the cloud app vehicle ID
+ * @param cloudAppVehicleID a string value
+ */
+ public void setCloudAppVehicleID(String cloudAppVehicleID){
+ setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
+ }
+
+ /**
+ * Gets a String value of the returned cloud app vehicle ID
+ * @return a String value.
+ */
+ public String getCloudAppVehicleID(){
+ return getString(KEY_CLOUD_APP_VEHICLE_ID);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
index 526f8dbb7..7b97f9286 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
@@ -245,6 +245,14 @@ import java.util.List;
* <td> minvalue: -2000; maxvalue:2000</td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
+ * <tr>
+ * <td>cloudAppVehicleID</td>
+ * <td>String</td>
+ * <td>ID for the vehicle when connecting to cloud applications</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 5.1 </td>
+ * </tr>
* </table>
*
* @since SmartDeviceLink 1.0
@@ -284,6 +292,8 @@ public class OnVehicleData extends RPCNotification {
public static final String KEY_FUEL_RANGE = "fuelRange";
public static final String KEY_TURN_SIGNAL = "turnSignal";
public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
+
public OnVehicleData() {
super(FunctionID.ON_VEHICLE_DATA.toString());
@@ -525,4 +535,20 @@ public class OnVehicleData extends RPCNotification {
public ElectronicParkBrakeStatus getElectronicParkBrakeStatus(){
return (ElectronicParkBrakeStatus) getObject(ElectronicParkBrakeStatus.class, KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
+
+ /**
+ * Sets a string value for the cloud app vehicle ID
+ * @param cloudAppVehicleID a string value
+ */
+ public void setCloudAppVehicleID(String cloudAppVehicleID){
+ setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
+ }
+
+ /**
+ * Gets a String value of the returned cloud app vehicle ID
+ * @return a String value.
+ */
+ public String getCloudAppVehicleID(){
+ return getString(KEY_CLOUD_APP_VEHICLE_ID);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppProperties.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppProperties.java
new file mode 100644
index 000000000..5f6160361
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppProperties.java
@@ -0,0 +1,36 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+public class SetCloudAppProperties extends RPCRequest {
+
+ public static final String KEY_PROPERTIES = "properties";
+
+ public SetCloudAppProperties(){
+ super(FunctionID.SET_CLOUD_APP_PROPERTIES.toString());
+ }
+
+ public SetCloudAppProperties(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public SetCloudAppProperties(@NonNull CloudAppProperties cloudAppProperties){
+ this();
+ setParameters(KEY_PROPERTIES, cloudAppProperties);
+ }
+
+ public void setProperties(@NonNull CloudAppProperties cloudAppProperties){
+ setParameters(KEY_PROPERTIES, cloudAppProperties);
+ }
+
+ public CloudAppProperties getProperties(){
+ return (CloudAppProperties) getObject(CloudAppProperties.class, KEY_PROPERTIES);
+ }
+
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppPropertiesResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppPropertiesResponse.java
new file mode 100644
index 000000000..ea3e79d00
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetCloudAppPropertiesResponse.java
@@ -0,0 +1,18 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+
+import java.util.Hashtable;
+
+public class SetCloudAppPropertiesResponse extends RPCResponse {
+
+ public SetCloudAppPropertiesResponse(){
+ super(FunctionID.SET_CLOUD_APP_PROPERTIES.toString());
+ }
+ public SetCloudAppPropertiesResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
index 420d907b1..700f1dcb9 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
@@ -234,7 +234,15 @@ import java.util.Hashtable;
* <td>Subscribable</td>
* <td>SmartDeviceLink 5.0 </td>
* </tr>
- * </table>
+ * <tr>
+ * <td>cloudAppVehicleID</td>
+ * <td>Boolean</td>
+ * <td>ID for the vehicle when connecting to cloud applications</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
+ * <td>SmartDeviceLink 5.1 </td>
+ * </tr>
+ * </table>
*
* <p> <b>Response</b></p>
*<p><b>Non-default Result Codes:</b></p>
@@ -282,6 +290,7 @@ public class SubscribeVehicleData extends RPCRequest {
public static final String KEY_FUEL_RANGE = "fuelRange";
public static final String KEY_TURN_SIGNAL = "turnSignal";
public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
/**
* Constructs a new SubscribeVehicleData object
@@ -808,4 +817,20 @@ public class SubscribeVehicleData extends RPCRequest {
public Boolean getElectronicParkBrakeStatus(){
return getBoolean(KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
+
+ /**
+ * Sets a boolean value. If true, subscribes cloudAppVehicleID data
+ * @param cloudAppVehicleID a boolean value
+ */
+ public void setCloudAppVehicleID(boolean cloudAppVehicleID){
+ setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
+ }
+
+ /**
+ * Gets a boolean value. If true, means the cloudAppVehicleDataID data has been subscribed.
+ * @return a Boolean value.
+ */
+ public Boolean getCloudAppVehicleID(){
+ return getBoolean(KEY_CLOUD_APP_VEHICLE_ID);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
index 47d32936d..cc27233a8 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
@@ -42,6 +42,7 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public static final String KEY_FUEL_RANGE = "fuelRange";
public static final String KEY_TURN_SIGNAL = "turnSignal";
public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
/**
* Constructs a new SubscribeVehicleDataResponse object
@@ -466,4 +467,20 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getElectronicParkBrakeStatus(){
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
+
+ /**
+ * Sets cloudAppVehicleID
+ * @param cloudAppVehicleID a boolean value
+ */
+ public void setCloudAppVehicleID(VehicleDataResult cloudAppVehicleID){
+ setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
+ }
+
+ /**
+ * Gets a boolean value. If true, means the cloudAppVehicleDataID data has been subscribed.
+ * @return a Boolean value.
+ */
+ public VehicleDataResult getCloudAppVehicleID(){
+ return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_CLOUD_APP_VEHICLE_ID);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
index ca2439b9e..e682fa518 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
@@ -275,6 +275,7 @@ public class UnsubscribeVehicleData extends RPCRequest {
public static final String KEY_FUEL_RANGE = "fuelRange";
public static final String KEY_TURN_SIGNAL = "turnSignal";
public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
/**
* Constructs a new UnsubscribeVehicleData object
@@ -802,4 +803,20 @@ public class UnsubscribeVehicleData extends RPCRequest {
public Boolean getElectronicParkBrakeStatus() {
return getBoolean(KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
+
+ /**
+ * Sets cloudAppVehicleID
+ * @param cloudAppVehicleID a boolean value
+ */
+ public void setCloudAppVehicleID(VehicleDataResult cloudAppVehicleID){
+ setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
+ }
+
+ /**
+ * Gets a boolean value. If true, means the cloudAppVehicleDataID data should be unsubscribed.
+ * @return a Boolean value.
+ */
+ public VehicleDataResult getCloudAppVehicleID(){
+ return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_CLOUD_APP_VEHICLE_ID);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
index e3b8b44b0..c2ba69cfa 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
@@ -42,6 +42,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public static final String KEY_FUEL_RANGE = "fuelRange";
public static final String KEY_TURN_SIGNAL = "turnSignal";
public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
/**
* Constructs a new UnsubscribeVehicleDataResponse object
@@ -468,4 +469,20 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getElectronicParkBrakeStatus(){
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_ELECTRONIC_PARK_BRAKE_STATUS);
}
+
+ /**
+ * Sets cloudAppVehicleID
+ * @param cloudAppVehicleID a boolean value
+ */
+ public void setCloudAppVehicleID(VehicleDataResult cloudAppVehicleID){
+ setParameters(KEY_CLOUD_APP_VEHICLE_ID, cloudAppVehicleID);
+ }
+
+ /**
+ * Gets a boolean value. If true, means the cloudAppVehicleDataID data has been unsubscribed.
+ * @return a Boolean value.
+ */
+ public VehicleDataResult getCloudAppVehicleID(){
+ return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_CLOUD_APP_VEHICLE_ID);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/HybridAppPreference.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/HybridAppPreference.java
new file mode 100644
index 000000000..16732e9c3
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/HybridAppPreference.java
@@ -0,0 +1,16 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+public enum HybridAppPreference {
+
+ MOBILE,
+ CLOUD,
+ BOTH;
+
+ public static HybridAppPreference valueForString(String value){
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RequestType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RequestType.java
index 75707802e..e6fbab6df 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RequestType.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/RequestType.java
@@ -72,6 +72,10 @@ public enum RequestType {
* @since SmartDeviceLink 5.0
*/
OEM_SPECIFIC,
+ /**
+ * @since SmartDeviceLink 5.1
+ */
+ ICON_URL,
;
/**
* Convert String to RequestType
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
index 01525ef4a..8694d67c1 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
@@ -125,6 +125,11 @@ public enum VehicleDataType {
* Notifies ELECTRONICPARKBRAKESTATUSData may be subscribed
*/
VEHICLEDATA_ELECTRONICPARKBRAKESTATUS,
+
+ /**
+ * Notifies VEHICLEDATA_CLOUDAPPVEHICLEID may be subscribed
+ */
+ VEHICLEDATA_CLOUDAPPVEHICLEID,
;
/**
diff --git a/sdl_android/src/main/java/com/smartdevicelink/util/HttpUtils.java b/sdl_android/src/main/java/com/smartdevicelink/util/HttpUtils.java
index d0752e008..77b1a8004 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/util/HttpUtils.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/util/HttpUtils.java
@@ -1,12 +1,15 @@
package com.smartdevicelink.util;
import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.support.annotation.NonNull;
public class HttpUtils{
@@ -19,4 +22,24 @@ public class HttpUtils{
return result;
}
+ public static byte[] downloadFile(@NonNull String urlStr){
+ try {
+ URL url = new URL(urlStr);
+ URLConnection connection = url.openConnection();
+ InputStream inputStream = connection.getInputStream();
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+
+ int nRead;
+ byte[] data = new byte[4096];
+
+ while ((nRead = inputStream.read(data, 0, data.length)) != -1) {
+ buffer.write(data, 0, nRead);
+ }
+ return buffer.toByteArray();
+ }catch (Exception e){
+ DebugTool.logError("Unable to download file - " + urlStr, e);
+ return null;
+ }
+ }
+
}