summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Kast <julian@livio.com>2021-01-26 13:09:57 -0500
committerJulian Kast <julian@livio.com>2021-01-26 13:09:57 -0500
commitc056a2d4dbafbb26e5678760d9a5be138a00e0af (patch)
treecd7db052d37d9189882c174930a7213473da9909
parent4e021aeaa810a8f6a8d51e6c4125d910a6ad81b8 (diff)
parent1bf85ae1fa07681215dc7a812d204a82ba863d24 (diff)
downloadsdl_android-bugfix/issue_1397.tar.gz
Merge branch 'develop' into bugfix/issue_1397bugfix/issue_1397
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java45
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java33
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java58
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DoorStatusTests.java65
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTests.java65
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RoofStatusTests.java75
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DoorStatusTypeTests.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java222
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DoorStatus.java142
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GateStatus.java142
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RoofStatus.java171
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DoorStatusType.java56
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java7
13 files changed, 1147 insertions, 7 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
index edf446b3c..1d58829ad 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
@@ -114,6 +114,9 @@ import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.WindowState;
import com.smartdevicelink.proxy.rpc.WindowStatus;
import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
+import com.smartdevicelink.proxy.rpc.DoorStatus;
+import com.smartdevicelink.proxy.rpc.GateStatus;
+import com.smartdevicelink.proxy.rpc.RoofStatus;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
@@ -137,6 +140,7 @@ import com.smartdevicelink.proxy.rpc.enums.Direction;
import com.smartdevicelink.proxy.rpc.enums.DisplayMode;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.DistanceUnit;
+import com.smartdevicelink.proxy.rpc.enums.DoorStatusType;
import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
import com.smartdevicelink.proxy.rpc.enums.ECallConfirmationStatus;
import com.smartdevicelink.proxy.rpc.enums.EmergencyEventType;
@@ -427,6 +431,15 @@ public class TestValues {
public static final DynamicUpdateCapabilities GENERAL_DYNAMICUPDATECAPABILITIES = new DynamicUpdateCapabilities();
public static final WindowState GENERAL_WINDOWSTATE = new WindowState();
+ public static final DoorStatusType GENERAL_DOOR_STATUS_TYPE = DoorStatusType.REMOVED;
+
+ public static final DoorStatus GENERAL_DOOR_STATUS = new DoorStatus();
+ public static final GateStatus GENERAL_GATE_STATUS = new GateStatus();
+ public static final RoofStatus GENERAL_ROOF_STATUS = new RoofStatus();
+
+ public static final ArrayList<DoorStatus> GENERAL_DOOR_STATUS_LIST = new ArrayList<>(1);
+ public static final ArrayList<GateStatus> GENERAL_GATE_STATUS_LIST = new ArrayList<>(1);
+ public static final ArrayList<RoofStatus> GENERAL_ROOF_STATUS_LIST = new ArrayList<>(1);
public static final VehicleDataResult GENERAL_OEM_CUSTOM_VEHICLE_DATA = new VehicleDataResult();
public static final TemplateConfiguration GENERAL_TEMPLATE_CONFIGURATION = new TemplateConfiguration();
@@ -591,6 +604,12 @@ public class TestValues {
public static final JSONObject JSON_DISPLAYCAPABILITY = new JSONObject();
public static final JSONArray JSON_DISPLAYCAPABILITY_LIST = new JSONArray();
public static final JSONObject JSON_DYNAMICUPDATECAPABILITIES = new JSONObject();
+ public static final JSONArray JSON_ROOF_STATUSES = new JSONArray();
+ public static final JSONArray JSON_DOOR_STATUSES = new JSONArray();
+ public static final JSONArray JSON_GATE_STATUSES = new JSONArray();
+ public static final JSONObject JSON_ROOF_STATUS = new JSONObject();
+ public static final JSONObject JSON_DOOR_STATUS = new JSONObject();
+ public static final JSONObject JSON_GATE_STATUS = new JSONObject();
static {
GENERAL_TOUCHEVENTCAPABILITIES.setDoublePressAvailable(GENERAL_BOOLEAN);
@@ -1154,6 +1173,19 @@ public class TestValues {
GENERAL_STABILITY_CONTROL_STATUS.setEscSystem(GENERAL_ESC_SYSTEM);
GENERAL_STABILITY_CONTROL_STATUS.setTrailerSwayControl(GENERAL_S_WAY_CONTROL);
+ GENERAL_ROOF_STATUS.setLocation(GENERAL_GRID);
+ GENERAL_ROOF_STATUS.setState(GENERAL_WINDOW_STATE);
+ GENERAL_ROOF_STATUS.setStatus(GENERAL_DOOR_STATUS_TYPE);
+ GENERAL_ROOF_STATUS_LIST.add(GENERAL_ROOF_STATUS);
+
+ GENERAL_GATE_STATUS.setLocation(GENERAL_GRID);
+ GENERAL_GATE_STATUS.setStatus(GENERAL_DOOR_STATUS_TYPE);
+ GENERAL_GATE_STATUS_LIST.add(GENERAL_GATE_STATUS);
+
+ GENERAL_DOOR_STATUS.setLocation(GENERAL_GRID);
+ GENERAL_DOOR_STATUS.setStatus(GENERAL_DOOR_STATUS_TYPE);
+ GENERAL_DOOR_STATUS_LIST.add(GENERAL_DOOR_STATUS);
+
try {
JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_ALLOWED, GENERAL_HMILEVEL_LIST);
JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_USER_DISALLOWED, GENERAL_HMILEVEL_LIST);
@@ -1391,6 +1423,19 @@ public class TestValues {
JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, TestValues.JSON_GRID);
JSON_MODULE_INFO.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, TestValues.GENERAL_BOOLEAN);
+ JSON_ROOF_STATUS.put(RoofStatus.KEY_STATUS, GENERAL_DOOR_STATUS_TYPE);
+ JSON_ROOF_STATUS.put(RoofStatus.KEY_LOCATION, JSON_GRID);
+ JSON_ROOF_STATUS.put(RoofStatus.KEY_STATE, GENERAL_WINDOW_STATE.serializeJSON());
+
+ JSON_DOOR_STATUS.put(DoorStatus.KEY_STATUS, GENERAL_DOOR_STATUS_TYPE);
+ JSON_DOOR_STATUS.put(DoorStatus.KEY_LOCATION, JSON_GRID);
+
+ JSON_GATE_STATUS.put(GateStatus.KEY_STATUS, GENERAL_DOOR_STATUS_TYPE);
+ JSON_GATE_STATUS.put(GateStatus.KEY_LOCATION, JSON_GRID);
+
+ JSON_ROOF_STATUSES.put(JSON_ROOF_STATUS);
+ JSON_DOOR_STATUSES.put(JSON_DOOR_STATUS);
+ JSON_GATE_STATUSES.put(JSON_GATE_STATUS);
} catch (JSONException e) {
Log.e("Test", "Static Json Construction Failed.", e);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
index 724be920b..3195691f7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
@@ -3929,4 +3929,37 @@ public class Validator {
}
return status1.getDataType().equals(status2.getDataType()) && status1.getResultCode().equals(status2.getResultCode());
}
+
+ public static boolean validateDoorStatus(DoorStatus status1, DoorStatus status2) {
+ if (status1 == null) {
+ return (status2 == null);
+ }
+ if (status2 == null) {
+ return (status2 == null);
+ }
+ boolean gridValidated = validateGrid(status1.getLocation(), status2.getLocation());
+ return gridValidated && status1.getStatus().equals(status2.getStatus());
+ }
+
+ public static boolean validateGateStatus(GateStatus status1, GateStatus status2) {
+ if (status1 == null) {
+ return (status2 == null);
+ }
+ if (status2 == null) {
+ return (status2 == null);
+ }
+ boolean gridValidated = validateGrid(status1.getLocation(), status2.getLocation());
+ return gridValidated && status1.getStatus().equals(status2.getStatus());
+ }
+
+ public static boolean validateRoofStatus(RoofStatus status1, RoofStatus status2) {
+ if (status1 == null) {
+ return (status2 == null);
+ }
+ if (status2 == null) {
+ return (status2 == null);
+ }
+ boolean gridValidated = validateGrid(status1.getLocation(), status2.getLocation());
+ return gridValidated && status1.getStatus().equals(status2.getStatus()) && validateWindowStates(status1.getState(), status2.getState());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java
index 1db5aa77a..f0a33599a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/BodyInformationTests.java
@@ -1,18 +1,29 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.BodyInformation;
+import com.smartdevicelink.proxy.rpc.DoorStatus;
+import com.smartdevicelink.proxy.rpc.GateStatus;
+import com.smartdevicelink.proxy.rpc.RoofStatus;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStableStatus;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.TestValues;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
+import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
+import static com.smartdevicelink.proxy.rpc.BodyInformation.KEY_DOOR_STATUSES;
+import static com.smartdevicelink.proxy.rpc.BodyInformation.KEY_GATE_STATUSES;
+import static com.smartdevicelink.proxy.rpc.BodyInformation.KEY_ROOF_STATUSES;
+
/**
* This is a unit test class for the SmartDeviceLink library project class :
* {@link com.smartdevicelink.proxy.rpc.BodyInformation}
@@ -32,6 +43,10 @@ public class BodyInformationTests extends TestCase {
msg.setPassengerDoorAjar(TestValues.GENERAL_BOOLEAN);
msg.setRearLeftDoorAjar(TestValues.GENERAL_BOOLEAN);
msg.setRearRightDoorAjar(TestValues.GENERAL_BOOLEAN);
+
+ msg.setDoorStatuses(TestValues.GENERAL_DOOR_STATUS_LIST);
+ msg.setGateStatuses(TestValues.GENERAL_GATE_STATUS_LIST);
+ msg.setRoofStatuses(TestValues.GENERAL_ROOF_STATUS_LIST);
}
/**
@@ -52,6 +67,9 @@ public class BodyInformationTests extends TestCase {
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getPassengerDoorAjar());
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getRearLeftDoorAjar());
assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, (boolean) msg.getRearRightDoorAjar());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_GATE_STATUS_LIST, msg.getGateStatuses());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_ROOF_STATUS_LIST, msg.getRoofStatuses());
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOOR_STATUS_LIST, msg.getDoorStatuses());
// Invalid/Null Tests
BodyInformation msg = new BodyInformation();
@@ -64,6 +82,9 @@ public class BodyInformationTests extends TestCase {
assertNull(TestValues.NULL, msg.getPassengerDoorAjar());
assertNull(TestValues.NULL, msg.getRearLeftDoorAjar());
assertNull(TestValues.NULL, msg.getRearRightDoorAjar());
+ assertNull(TestValues.NULL, msg.getGateStatuses());
+ assertNull(TestValues.NULL, msg.getRoofStatuses());
+ assertNull(TestValues.NULL, msg.getDoorStatuses());
}
public void testJson() {
@@ -77,6 +98,9 @@ public class BodyInformationTests extends TestCase {
reference.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, TestValues.GENERAL_BOOLEAN);
reference.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, TestValues.GENERAL_BOOLEAN);
reference.put(BodyInformation.KEY_REAR_RIGHT_DOOR_AJAR, TestValues.GENERAL_BOOLEAN);
+ reference.put(KEY_DOOR_STATUSES, TestValues.JSON_DOOR_STATUSES);
+ reference.put(KEY_GATE_STATUSES, TestValues.JSON_GATE_STATUSES);
+ reference.put(KEY_ROOF_STATUSES, TestValues.JSON_ROOF_STATUSES);
JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
@@ -84,7 +108,39 @@ public class BodyInformationTests extends TestCase {
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ if (key.equals(KEY_DOOR_STATUSES)) {
+
+ JSONArray array1 = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray array2 = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+
+ for (int i = 0; i < array1.length(); i++) {
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(array1.getJSONObject(i));
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(array2.getJSONObject(i));
+ assertTrue(Validator.validateDoorStatus(new DoorStatus(h1), new DoorStatus(h2)));
+
+ }
+ } else if (key.equals(KEY_GATE_STATUSES)) {
+
+ JSONArray array1 = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray array2 = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+
+ for (int i = 0; i < array1.length(); i++) {
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(array1.getJSONObject(i));
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(array2.getJSONObject(i));
+ assertTrue(Validator.validateGateStatus(new GateStatus(h1), new GateStatus(h2)));
+ }
+ } else if (key.equals(KEY_ROOF_STATUSES)) {
+ JSONArray array1 = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray array2 = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+
+ for (int i = 0; i < array1.length(); i++) {
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(array1.getJSONObject(i));
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(array2.getJSONObject(i));
+ assertTrue(Validator.validateRoofStatus(new RoofStatus(h1), new RoofStatus(h2)));
+ }
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch (JSONException e) {
fail(TestValues.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DoorStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DoorStatusTests.java
new file mode 100644
index 000000000..cae1001c3
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DoorStatusTests.java
@@ -0,0 +1,65 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.DoorStatus;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.proxy.rpc.RoofStatus;
+import com.smartdevicelink.proxy.rpc.enums.DoorStatusType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.TestValues;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+public class DoorStatusTests extends TestCase {
+ private DoorStatus msg;
+
+ @Override
+ public void setUp() {
+ msg = new DoorStatus(TestValues.GENERAL_GRID, TestValues.GENERAL_DOOR_STATUS_TYPE);
+ }
+
+ public void testRpcValues() {
+ // Test Values
+ Grid location = msg.getLocation();
+ DoorStatusType status = msg.getStatus();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, location);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOOR_STATUS_TYPE, status);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(RoofStatus.KEY_STATUS, TestValues.GENERAL_DOOR_STATUS_TYPE);
+ reference.put(RoofStatus.KEY_LOCATION, TestValues.JSON_GRID);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(RoofStatus.KEY_LOCATION)) {
+ Hashtable<String, Object> hs1 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(reference, key));
+ Hashtable<String, Object> hs2 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key));
+
+ assertTrue(Validator.validateGrid(new Grid(hs1), new Grid(hs2)));
+
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTests.java
new file mode 100644
index 000000000..7bb8da021
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTests.java
@@ -0,0 +1,65 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.GateStatus;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.proxy.rpc.RoofStatus;
+import com.smartdevicelink.proxy.rpc.enums.DoorStatusType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.TestValues;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+public class GateStatusTests extends TestCase {
+ private GateStatus msg;
+
+ @Override
+ public void setUp() {
+ msg = new GateStatus(TestValues.GENERAL_GRID, TestValues.GENERAL_DOOR_STATUS_TYPE);
+ }
+
+ public void testRpcValues() {
+ // Test Values
+ Grid location = msg.getLocation();
+ DoorStatusType status = msg.getStatus();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, location);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOOR_STATUS_TYPE, status);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(RoofStatus.KEY_STATUS, TestValues.GENERAL_DOOR_STATUS_TYPE);
+ reference.put(RoofStatus.KEY_LOCATION, TestValues.JSON_GRID);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(RoofStatus.KEY_LOCATION)) {
+ Hashtable<String, Object> hs1 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(reference, key));
+ Hashtable<String, Object> hs2 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key));
+
+ assertTrue(Validator.validateGrid(new Grid(hs1), new Grid(hs2)));
+
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RoofStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RoofStatusTests.java
new file mode 100644
index 000000000..5d30cdb15
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RoofStatusTests.java
@@ -0,0 +1,75 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.proxy.rpc.RoofStatus;
+import com.smartdevicelink.proxy.rpc.WindowState;
+import com.smartdevicelink.proxy.rpc.enums.DoorStatusType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.TestValues;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+public class RoofStatusTests extends TestCase {
+
+ private RoofStatus msg;
+
+ @Override
+ public void setUp() {
+ msg = new RoofStatus(TestValues.GENERAL_GRID, TestValues.GENERAL_DOOR_STATUS_TYPE);
+ msg.setState(TestValues.GENERAL_WINDOW_STATE);
+ }
+
+ public void testRpcValues() {
+ // Test Values
+ Grid location = msg.getLocation();
+ DoorStatusType status = msg.getStatus();
+ WindowState windowState = msg.getState();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, location);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_DOOR_STATUS_TYPE, status);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_WINDOW_STATE, windowState);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(RoofStatus.KEY_STATUS, TestValues.GENERAL_DOOR_STATUS_TYPE);
+ reference.put(RoofStatus.KEY_STATE, TestValues.GENERAL_WINDOW_STATE.serializeJSON());
+ reference.put(RoofStatus.KEY_LOCATION, TestValues.JSON_GRID);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(RoofStatus.KEY_STATE)) {
+ Hashtable<String, Object> hs1 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(reference, key));
+ Hashtable<String, Object> hs2 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key));
+
+ assertTrue(Validator.validateWindowStates(new WindowState(hs1), new WindowState(hs2)));
+ } else if (key.equals(RoofStatus.KEY_LOCATION)) {
+ Hashtable<String, Object> hs1 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(reference, key));
+ Hashtable<String, Object> hs2 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key));
+
+ assertTrue(Validator.validateGrid(new Grid(hs1), new Grid(hs2)));
+
+ } else {
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DoorStatusTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DoorStatusTypeTests.java
new file mode 100644
index 000000000..0a83f8e58
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DoorStatusTypeTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.DoorStatusType;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class DoorStatusTypeTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "CLOSED";
+ DoorStatusType closed = DoorStatusType.valueForString(example);
+ example = "LOCKED";
+ DoorStatusType locked = DoorStatusType.valueForString(example);
+ example = "AJAR";
+ DoorStatusType ajar = DoorStatusType.valueForString(example);
+ example = "REMOVED";
+ DoorStatusType removed = DoorStatusType.valueForString(example);
+
+ assertNotNull("CLOSED returned null", closed);
+ assertNotNull("LOCKED returned null", locked);
+ assertNotNull("AJAR returned null", ajar);
+ assertNotNull("REMOVED returned null", removed);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "cloS_ed";
+ try {
+ DoorStatusType temp = DoorStatusType.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 {
+ DoorStatusType temp = DoorStatusType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of DriverDistractionState.
+ */
+ public void testListEnum() {
+ List<DoorStatusType> enumValueList = Arrays.asList(DoorStatusType.values());
+
+ List<DoorStatusType> enumTestList = new ArrayList<DoorStatusType>();
+ enumTestList.add(DoorStatusType.CLOSED);
+ enumTestList.add(DoorStatusType.LOCKED);
+ enumTestList.add(DoorStatusType.AJAR);
+ enumTestList.add(DoorStatusType.REMOVED);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java
index fcb5c8d70..c040af0cd 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java
@@ -38,6 +38,7 @@ import com.smartdevicelink.proxy.rpc.enums.IgnitionStableStatus;
import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus;
import java.util.Hashtable;
+import java.util.List;
/**
* The body information including power modes.
@@ -86,30 +87,71 @@ import java.util.Hashtable;
* <td>Boolean</td>
* <td>true</td>
* <td>The information about the park brake: - true, if active - false if not.</td>
- * <td>SmartDeviceLink 2.0</td>
+ * <td>
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ * </td>
* </tr>
* <tr>
* <td>passengerDoorAjar</td>
* <td>Boolean</td>
* <td>true</td>
* <td>The information about the park brake: - true, if active - false if not.</td>
- * <td>SmartDeviceLink 2.0</td>
+ * <td>
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ * </td>
* </tr>
* <tr>
* <td>rearLeftDoorAjar</td>
* <td>Boolean</td>
* <td>true</td>
* <td>The information about the park brake: - true, if active - false if not.</td>
- * <td>SmartDeviceLink 2.0</td>
+ * <td>
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ * </td>
* </tr>
* <tr>
* <td>rearRightDoorAjar</td>
* <td>Boolean</td>
* <td>true</td>
* <td>References signal "DrStatRr_B_Actl".</td>
- * <td>SmartDeviceLink 2.0</td>
+ * <td>
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>doorStatuses</td>
+ * <td>List<DoorStatus></td>
+ * <td>Provides status for doors if Ajar/Closed/Locked</td>
+ * <td>N</td>
+ * <td>{"array_min_size": 0, "array_max_size": 100}</td>
+ * <td>
+ * @since SmartDeviceLink 7.1.0
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>gateStatuses</td>
+ * <td>List<GateStatus></td>
+ * <td>Provides status for trunk/hood/etc. if Ajar/Closed/Locked</td>
+ * <td>N</td>
+ * <td>{"array_min_size": 0, "array_max_size": 100}</td>
+ * <td>
+ * @since SmartDeviceLink 7.1.0
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>roofStatuses</td>
+ * <td>List<RoofStatus></td>
+ * <td>Provides status for roof/convertible roof/sunroof/moonroof etc., if Closed/Ajar/Removedetc.</td>
+ * <td>N</td>
+ * <td>{"array_min_size": 0, "array_max_size": 100}</td>
+ * <td>
+ * @since SmartDeviceLink 7.1.0
+ * </td>
* </tr>
- *
* </table>
*
* @see SubscribeVehicleData
@@ -122,10 +164,42 @@ public class BodyInformation extends RPCStruct {
public static final String KEY_PARK_BRAKE_ACTIVE = "parkBrakeActive";
public static final String KEY_IGNITION_STABLE_STATUS = "ignitionStableStatus";
public static final String KEY_IGNITION_STATUS = "ignitionStatus";
+ /**
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public static final String KEY_DRIVER_DOOR_AJAR = "driverDoorAjar";
+ /**
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public static final String KEY_PASSENGER_DOOR_AJAR = "passengerDoorAjar";
+ /**
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public static final String KEY_REAR_LEFT_DOOR_AJAR = "rearLeftDoorAjar";
+ /**
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public static final String KEY_REAR_RIGHT_DOOR_AJAR = "rearRightDoorAjar";
+ /**
+ * @since SmartDeviceLink 7.1.0
+ */
+ public static final String KEY_DOOR_STATUSES = "doorStatuses";
+ /**
+ * @since SmartDeviceLink 7.1.0
+ */
+ public static final String KEY_GATE_STATUSES = "gateStatuses";
+ /**
+ * @since SmartDeviceLink 7.1.0
+ */
+ public static final String KEY_ROOF_STATUSES = "roofStatuses";
public BodyInformation() {
}
@@ -175,41 +249,177 @@ public class BodyInformation extends RPCStruct {
return (IgnitionStatus) getObject(IgnitionStatus.class, KEY_IGNITION_STATUS);
}
+ /**
+ * Sets the driverDoorAjar.
+ *
+ * @param driverDoorAjar References signal "DrStatDrv_B_Actl". Deprecated starting with RPC Spec 7.1.0.
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public BodyInformation setDriverDoorAjar(Boolean driverDoorAjar) {
setValue(KEY_DRIVER_DOOR_AJAR, driverDoorAjar);
return this;
}
+ /**
+ * Gets the driverDoorAjar.
+ *
+ * @return Boolean References signal "DrStatDrv_B_Actl". Deprecated starting with RPC Spec 7.1.0.
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public Boolean getDriverDoorAjar() {
return getBoolean(KEY_DRIVER_DOOR_AJAR);
}
-
+ /**
+ * Sets the passengerDoorAjar.
+ *
+ * @param passengerDoorAjar References signal "DrStatPsngr_B_Actl". Deprecated starting with RPC Spec 7.1.0.
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public BodyInformation setPassengerDoorAjar(Boolean passengerDoorAjar) {
setValue(KEY_PASSENGER_DOOR_AJAR, passengerDoorAjar);
return this;
}
+ /**
+ * Gets the passengerDoorAjar.
+ *
+ * @return Boolean References signal "DrStatPsngr_B_Actl". Deprecated starting with RPC Spec 7.1.0.
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public Boolean getPassengerDoorAjar() {
return getBoolean(KEY_PASSENGER_DOOR_AJAR);
}
+ /**
+ * Sets the rearLeftDoorAjar.
+ *
+ * @param rearLeftDoorAjar References signal "DrStatRl_B_Actl". Deprecated starting with RPC Spec 7.1.0.
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public BodyInformation setRearLeftDoorAjar(Boolean rearLeftDoorAjar) {
setValue(KEY_REAR_LEFT_DOOR_AJAR, rearLeftDoorAjar);
return this;
}
+ /**
+ * Gets the rearLeftDoorAjar.
+ *
+ * @return Boolean References signal "DrStatRl_B_Actl". Deprecated starting with RPC Spec 7.1.0.
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public Boolean getRearLeftDoorAjar() {
return getBoolean(KEY_REAR_LEFT_DOOR_AJAR);
}
+ /**
+ * Sets the rearRightDoorAjar.
+ *
+ * @param rearRightDoorAjar References signal "DrStatRr_B_Actl". Deprecated starting with RPC Spec 7.1.0.
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public BodyInformation setRearRightDoorAjar(Boolean rearRightDoorAjar) {
setValue(KEY_REAR_RIGHT_DOOR_AJAR, rearRightDoorAjar);
return this;
}
+ /**
+ * Gets the rearRightDoorAjar.
+ *
+ * @return Boolean References signal "DrStatRr_B_Actl". Deprecated starting with RPC Spec 7.1.0.
+ * @since SmartDeviceLink 2.0.0
+ * @deprecated in SmartDeviceLink 7.1.0
+ */
+ @Deprecated
public Boolean getRearRightDoorAjar() {
return getBoolean(KEY_REAR_RIGHT_DOOR_AJAR);
}
+ /**
+ * Sets the doorStatuses.
+ *
+ * @param doorStatuses Provides status for doors if Ajar/Closed/Locked
+ * {"array_min_size": 0, "array_max_size": 100}
+ * @since SmartDeviceLink 7.1.0
+ */
+ public BodyInformation setDoorStatuses(List<DoorStatus> doorStatuses) {
+ setValue(KEY_DOOR_STATUSES, doorStatuses);
+ return this;
+ }
+
+ /**
+ * Gets the doorStatuses.
+ *
+ * @return List<DoorStatus> Provides status for doors if Ajar/Closed/Locked
+ * {"array_min_size": 0, "array_max_size": 100}
+ * @since SmartDeviceLink 7.1.0
+ */
+ @SuppressWarnings("unchecked")
+ public List<DoorStatus> getDoorStatuses() {
+ return (List<DoorStatus>) getObject(DoorStatus.class, KEY_DOOR_STATUSES);
+ }
+
+ /**
+ * Sets the gateStatuses.
+ *
+ * @param gateStatuses Provides status for trunk/hood/etc. if Ajar/Closed/Locked
+ * {"array_min_size": 0, "array_max_size": 100}
+ * @since SmartDeviceLink 7.1.0
+ */
+ public BodyInformation setGateStatuses(List<GateStatus> gateStatuses) {
+ setValue(KEY_GATE_STATUSES, gateStatuses);
+ return this;
+ }
+
+ /**
+ * Gets the gateStatuses.
+ *
+ * @return List<GateStatus> Provides status for trunk/hood/etc. if Ajar/Closed/Locked
+ * {"array_min_size": 0, "array_max_size": 100}
+ * @since SmartDeviceLink 7.1.0
+ */
+ @SuppressWarnings("unchecked")
+ public List<GateStatus> getGateStatuses() {
+ return (List<GateStatus>) getObject(GateStatus.class, KEY_GATE_STATUSES);
+ }
+
+ /**
+ * Sets the roofStatuses.
+ *
+ * @param roofStatuses Provides status for roof/convertible roof/sunroof/moonroof etc., if Closed/Ajar/Removed
+ * etc.
+ * {"array_min_size": 0, "array_max_size": 100}
+ * @since SmartDeviceLink 7.1.0
+ */
+ public BodyInformation setRoofStatuses(List<RoofStatus> roofStatuses) {
+ setValue(KEY_ROOF_STATUSES, roofStatuses);
+ return this;
+ }
+
+ /**
+ * Gets the roofStatuses.
+ *
+ * @return List<RoofStatus> Provides status for roof/convertible roof/sunroof/moonroof etc., if Closed/Ajar/Removed
+ * etc.
+ * {"array_min_size": 0, "array_max_size": 100}
+ * @since SmartDeviceLink 7.1.0
+ */
+ @SuppressWarnings("unchecked")
+ public List<RoofStatus> getRoofStatuses() {
+ return (List<RoofStatus>) getObject(RoofStatus.class, KEY_ROOF_STATUSES);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DoorStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DoorStatus.java
new file mode 100644
index 000000000..777542085
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DoorStatus.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2017 - 2020, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.smartdevicelink.proxy.rpc;
+
+import androidx.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.DoorStatusType;
+
+import java.util.Hashtable;
+
+/**
+ * Describes the status of a parameter of door.
+ *
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Required</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>location</td>
+ * <td>Grid</td>
+ * <td></td>
+ * <td>Y</td>
+ * <td></td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>status</td>
+ * <td>DoorStatusType</td>
+ * <td></td>
+ * <td>Y</td>
+ * <td></td>
+ * <td></td>
+ * </tr>
+ * </table>
+ *
+ * @since SmartDeviceLink 7.1.0
+ */
+public class DoorStatus extends RPCStruct {
+ public static final String KEY_LOCATION = "location";
+ public static final String KEY_STATUS = "status";
+
+ /**
+ * Constructs a new DoorStatus object
+ */
+ public DoorStatus() { }
+
+ /**
+ * Constructs a new DoorStatus object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public DoorStatus(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new DoorStatus object
+ *
+ * @param location
+ * @param status
+ */
+ public DoorStatus(@NonNull Grid location, @NonNull DoorStatusType status) {
+ this();
+ setLocation(location);
+ setStatus(status);
+ }
+
+ /**
+ * Sets the location.
+ *
+ * @param location
+ */
+ public DoorStatus setLocation(@NonNull Grid location) {
+ setValue(KEY_LOCATION, location);
+ return this;
+ }
+
+ /**
+ * Gets the location.
+ *
+ * @return Grid
+ */
+ public Grid getLocation() {
+ return (Grid) getObject(Grid.class, KEY_LOCATION);
+ }
+
+ /**
+ * Sets the status.
+ *
+ * @param status
+ */
+ public DoorStatus setStatus(@NonNull DoorStatusType status) {
+ setValue(KEY_STATUS, status);
+ return this;
+ }
+
+ /**
+ * Gets the status.
+ *
+ * @return DoorStatusType
+ */
+ public DoorStatusType getStatus() {
+ return (DoorStatusType) getObject(DoorStatusType.class, KEY_STATUS);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GateStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GateStatus.java
new file mode 100644
index 000000000..df000ecbc
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GateStatus.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2017 - 2020, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.smartdevicelink.proxy.rpc;
+
+import androidx.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.DoorStatusType;
+
+import java.util.Hashtable;
+
+/**
+ * Describes the status of a parameter of trunk/hood/etc.
+ *
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Required</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>location</td>
+ * <td>Grid</td>
+ * <td></td>
+ * <td>Y</td>
+ * <td></td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>status</td>
+ * <td>DoorStatusType</td>
+ * <td></td>
+ * <td>Y</td>
+ * <td></td>
+ * <td></td>
+ * </tr>
+ * </table>
+ *
+ * @since SmartDeviceLink 7.1.0
+ */
+public class GateStatus extends RPCStruct {
+ public static final String KEY_LOCATION = "location";
+ public static final String KEY_STATUS = "status";
+
+ /**
+ * Constructs a new GateStatus object
+ */
+ public GateStatus() { }
+
+ /**
+ * Constructs a new GateStatus object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public GateStatus(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new GateStatus object
+ *
+ * @param location
+ * @param status
+ */
+ public GateStatus(@NonNull Grid location, @NonNull DoorStatusType status) {
+ this();
+ setLocation(location);
+ setStatus(status);
+ }
+
+ /**
+ * Sets the location.
+ *
+ * @param location
+ */
+ public GateStatus setLocation(@NonNull Grid location) {
+ setValue(KEY_LOCATION, location);
+ return this;
+ }
+
+ /**
+ * Gets the location.
+ *
+ * @return Grid
+ */
+ public Grid getLocation() {
+ return (Grid) getObject(Grid.class, KEY_LOCATION);
+ }
+
+ /**
+ * Sets the status.
+ *
+ * @param status
+ */
+ public GateStatus setStatus(@NonNull DoorStatusType status) {
+ setValue(KEY_STATUS, status);
+ return this;
+ }
+
+ /**
+ * Gets the status.
+ *
+ * @return DoorStatusType
+ */
+ public DoorStatusType getStatus() {
+ return (DoorStatusType) getObject(DoorStatusType.class, KEY_STATUS);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RoofStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RoofStatus.java
new file mode 100644
index 000000000..1bc28d7cf
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RoofStatus.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2017 - 2020, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.smartdevicelink.proxy.rpc;
+
+import androidx.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.DoorStatusType;
+
+import java.util.Hashtable;
+
+/**
+ * Describes the status of a parameter of roof/convertible roof/sunroof/moonroof etc. If roof
+ * is open (AJAR), state will determine percentage of roof open.
+ *
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Required</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>location</td>
+ * <td>Grid</td>
+ * <td></td>
+ * <td>Y</td>
+ * <td></td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>status</td>
+ * <td>DoorStatusType</td>
+ * <td></td>
+ * <td>Y</td>
+ * <td></td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>state</td>
+ * <td>WindowState</td>
+ * <td></td>
+ * <td>N</td>
+ * <td></td>
+ * <td></td>
+ * </tr>
+ * </table>
+ *
+ * @since SmartDeviceLink 7.1.0
+ */
+public class RoofStatus extends RPCStruct {
+ public static final String KEY_LOCATION = "location";
+ public static final String KEY_STATUS = "status";
+ public static final String KEY_STATE = "state";
+
+ /**
+ * Constructs a new RoofStatus object
+ */
+ public RoofStatus() { }
+
+ /**
+ * Constructs a new RoofStatus object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public RoofStatus(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new RoofStatus object
+ *
+ * @param location
+ * @param status
+ */
+ public RoofStatus(@NonNull Grid location, @NonNull DoorStatusType status) {
+ this();
+ setLocation(location);
+ setStatus(status);
+ }
+
+ /**
+ * Sets the location.
+ *
+ * @param location
+ */
+ public RoofStatus setLocation(@NonNull Grid location) {
+ setValue(KEY_LOCATION, location);
+ return this;
+ }
+
+ /**
+ * Gets the location.
+ *
+ * @return Grid
+ */
+ public Grid getLocation() {
+ return (Grid) getObject(Grid.class, KEY_LOCATION);
+ }
+
+ /**
+ * Sets the status.
+ *
+ * @param status
+ */
+ public RoofStatus setStatus(@NonNull DoorStatusType status) {
+ setValue(KEY_STATUS, status);
+ return this;
+ }
+
+ /**
+ * Gets the status.
+ *
+ * @return DoorStatusType
+ */
+ public DoorStatusType getStatus() {
+ return (DoorStatusType) getObject(DoorStatusType.class, KEY_STATUS);
+ }
+
+ /**
+ * Sets the state.
+ *
+ * @param state
+ */
+ public RoofStatus setState(WindowState state) {
+ setValue(KEY_STATE, state);
+ return this;
+ }
+
+ /**
+ * Gets the state.
+ *
+ * @return WindowState
+ */
+ public WindowState getState() {
+ return (WindowState) getObject(WindowState.class, KEY_STATE);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DoorStatusType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DoorStatusType.java
new file mode 100644
index 000000000..f19c66699
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DoorStatusType.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017 - 2020, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * @since SmartDeviceLink 7.1.0
+ */
+public enum DoorStatusType {
+ CLOSED,
+ LOCKED,
+ AJAR,
+ REMOVED;
+
+ /**
+ * Convert String to DoorStatusType
+ *
+ * @param value String
+ * @return DoorStatusType
+ */
+ public static DoorStatusType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
index 51c635154..fa1f65489 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
@@ -119,6 +119,9 @@ public class VideoStreamingParameters {
this.interval = params.interval;
}
if (params.resolution != null) {
+ if (this.resolution == null) {
+ this.resolution = new ImageResolution(DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ }
if (params.resolution.getResolutionHeight() != null && params.resolution.getResolutionHeight() > 0) {
this.resolution.setResolutionHeight(params.resolution.getResolutionHeight());
}
@@ -152,6 +155,10 @@ public class VideoStreamingParameters {
ImageResolution resolution = capability.getPreferredResolution();
if (resolution != null) {
+ if (this.resolution == null) {
+ this.resolution = new ImageResolution(DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ }
+
if (vehicleMake != null) {
if ((vehicleMake.contains("Ford") || vehicleMake.contains("Lincoln")) && ((resolution.getResolutionHeight() != null && resolution.getResolutionHeight() > 800) || (resolution.getResolutionWidth() != null && resolution.getResolutionWidth() > 800))) {
scale = 1.0 / 0.75;