From 9ab30be2275d899b43854c114fad867a68896e63 Mon Sep 17 00:00:00 2001 From: kboskin Date: Wed, 9 Dec 2020 18:20:39 +0200 Subject: [0255] - Implement changes according to the latest specification --- .../java/com/sdl/hellosdlandroid/MainActivity.java | 2 +- .../java/com/smartdevicelink/test/TestValues.java | 141 ++--- .../java/com/smartdevicelink/test/Validator.java | 33 ++ .../smartdevicelink/test/VehicleDataHelper.java | 8 + .../test/rpc/datatypes/BodyInformationTests.java | 58 +- .../test/rpc/datatypes/DoorStatusTests.java | 67 +++ .../test/rpc/datatypes/GateStatusTest.java | 66 +++ .../test/rpc/datatypes/RoofStatusTests.java | 73 +++ .../test/rpc/enums/DoorStatusTypeTests.java | 73 +++ .../test/rpc/notifications/OnVehicleDataTests.java | 3 + .../rpc/responses/GetVehicleDataResponseTests.java | 3 + .../smartdevicelink/proxy/rpc/BodyInformation.java | 638 ++++++++++++++------- .../com/smartdevicelink/proxy/rpc/DoorStatus.java | 142 +++++ .../com/smartdevicelink/proxy/rpc/GateStatus.java | 142 +++++ .../com/smartdevicelink/proxy/rpc/RoofStatus.java | 171 ++++++ .../proxy/rpc/enums/DoorStatusType.java | 56 ++ 16 files changed, 1361 insertions(+), 315 deletions(-) create mode 100644 android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DoorStatusTests.java create mode 100644 android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTest.java create mode 100644 android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RoofStatusTests.java create mode 100644 android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/DoorStatusTypeTests.java create mode 100644 base/src/main/java/com/smartdevicelink/proxy/rpc/DoorStatus.java create mode 100644 base/src/main/java/com/smartdevicelink/proxy/rpc/GateStatus.java create mode 100644 base/src/main/java/com/smartdevicelink/proxy/rpc/RoofStatus.java create mode 100644 base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DoorStatusType.java diff --git a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java index 43ad79ac7..c6ed33123 100755 --- a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java +++ b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java @@ -31,7 +31,7 @@ public class MainActivity extends AppCompatActivity { @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will + // Handle action bar item clicksere. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); 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..9df127d51 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 @@ -16,104 +16,7 @@ import com.smartdevicelink.managers.screen.menu.VoiceCommand; import com.smartdevicelink.managers.screen.menu.VoiceCommandSelectionListener; import com.smartdevicelink.protocol.SdlProtocol; import com.smartdevicelink.protocol.enums.FunctionID; -import com.smartdevicelink.proxy.rpc.AppInfo; -import com.smartdevicelink.proxy.rpc.AppServiceCapability; -import com.smartdevicelink.proxy.rpc.AppServiceData; -import com.smartdevicelink.proxy.rpc.AppServiceManifest; -import com.smartdevicelink.proxy.rpc.AppServiceRecord; -import com.smartdevicelink.proxy.rpc.AppServicesCapabilities; -import com.smartdevicelink.proxy.rpc.AudioControlCapabilities; -import com.smartdevicelink.proxy.rpc.AudioControlData; -import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities; -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.DateTime; -import com.smartdevicelink.proxy.rpc.DeviceInfo; -import com.smartdevicelink.proxy.rpc.DisplayCapabilities; -import com.smartdevicelink.proxy.rpc.DisplayCapability; -import com.smartdevicelink.proxy.rpc.DriverDistractionCapability; -import com.smartdevicelink.proxy.rpc.DynamicUpdateCapabilities; -import com.smartdevicelink.proxy.rpc.EqualizerSettings; -import com.smartdevicelink.proxy.rpc.GearStatus; -import com.smartdevicelink.proxy.rpc.Grid; -import com.smartdevicelink.proxy.rpc.HMICapabilities; -import com.smartdevicelink.proxy.rpc.HMIPermissions; -import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities; -import com.smartdevicelink.proxy.rpc.HMISettingsControlData; -import com.smartdevicelink.proxy.rpc.HapticRect; -import com.smartdevicelink.proxy.rpc.Image; -import com.smartdevicelink.proxy.rpc.ImageField; -import com.smartdevicelink.proxy.rpc.ImageResolution; -import com.smartdevicelink.proxy.rpc.KeyboardProperties; -import com.smartdevicelink.proxy.rpc.LightCapabilities; -import com.smartdevicelink.proxy.rpc.LightControlCapabilities; -import com.smartdevicelink.proxy.rpc.LightControlData; -import com.smartdevicelink.proxy.rpc.LightState; -import com.smartdevicelink.proxy.rpc.LocationDetails; -import com.smartdevicelink.proxy.rpc.MassageCushionFirmness; -import com.smartdevicelink.proxy.rpc.MassageModeData; -import com.smartdevicelink.proxy.rpc.MediaServiceData; -import com.smartdevicelink.proxy.rpc.MediaServiceManifest; -import com.smartdevicelink.proxy.rpc.MenuParams; -import com.smartdevicelink.proxy.rpc.MetadataTags; -import com.smartdevicelink.proxy.rpc.ModuleData; -import com.smartdevicelink.proxy.rpc.ModuleInfo; -import com.smartdevicelink.proxy.rpc.NavigationCapability; -import com.smartdevicelink.proxy.rpc.NavigationInstruction; -import com.smartdevicelink.proxy.rpc.NavigationServiceData; -import com.smartdevicelink.proxy.rpc.NavigationServiceManifest; -import com.smartdevicelink.proxy.rpc.OasisAddress; -import com.smartdevicelink.proxy.rpc.ParameterPermissions; -import com.smartdevicelink.proxy.rpc.PermissionItem; -import com.smartdevicelink.proxy.rpc.PhoneCapability; -import com.smartdevicelink.proxy.rpc.PresetBankCapabilities; -import com.smartdevicelink.proxy.rpc.RGBColor; -import com.smartdevicelink.proxy.rpc.RadioControlCapabilities; -import com.smartdevicelink.proxy.rpc.RadioControlData; -import com.smartdevicelink.proxy.rpc.RdsData; -import com.smartdevicelink.proxy.rpc.Rectangle; -import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities; -import com.smartdevicelink.proxy.rpc.ScreenParams; -import com.smartdevicelink.proxy.rpc.SdlMsgVersion; -import com.smartdevicelink.proxy.rpc.SeatControlCapabilities; -import com.smartdevicelink.proxy.rpc.SeatControlData; -import com.smartdevicelink.proxy.rpc.SeatLocation; -import com.smartdevicelink.proxy.rpc.SeatMemoryAction; -import com.smartdevicelink.proxy.rpc.SingleTireStatus; -import com.smartdevicelink.proxy.rpc.SisData; -import com.smartdevicelink.proxy.rpc.SoftButton; -import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities; -import com.smartdevicelink.proxy.rpc.StabilityControlsStatus; -import com.smartdevicelink.proxy.rpc.StartTime; -import com.smartdevicelink.proxy.rpc.StationIDNumber; -import com.smartdevicelink.proxy.rpc.SystemCapability; -import com.smartdevicelink.proxy.rpc.TTSChunk; -import com.smartdevicelink.proxy.rpc.Temperature; -import com.smartdevicelink.proxy.rpc.TemplateColorScheme; -import com.smartdevicelink.proxy.rpc.TemplateConfiguration; -import com.smartdevicelink.proxy.rpc.TextField; -import com.smartdevicelink.proxy.rpc.TouchCoord; -import com.smartdevicelink.proxy.rpc.TouchEvent; -import com.smartdevicelink.proxy.rpc.TouchEventCapabilities; -import com.smartdevicelink.proxy.rpc.Turn; -import com.smartdevicelink.proxy.rpc.VehicleDataResult; -import com.smartdevicelink.proxy.rpc.VehicleType; -import com.smartdevicelink.proxy.rpc.VideoStreamingCapability; -import com.smartdevicelink.proxy.rpc.VideoStreamingFormat; -import com.smartdevicelink.proxy.rpc.VrHelpItem; -import com.smartdevicelink.proxy.rpc.WeatherAlert; -import com.smartdevicelink.proxy.rpc.WeatherData; -import com.smartdevicelink.proxy.rpc.WeatherServiceData; -import com.smartdevicelink.proxy.rpc.WeatherServiceManifest; -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.*; import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus; import com.smartdevicelink.proxy.rpc.enums.AppHMIType; import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason; @@ -137,6 +40,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 +331,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 GENERAL_DOOR_STATUS_LIST = new ArrayList<>(1); + public static final ArrayList GENERAL_GATE_STATUS_LIST = new ArrayList<>(1); + public static final ArrayList 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 +504,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 +1073,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 +1323,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/VehicleDataHelper.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java index a13486983..dc58a8bd4 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java @@ -5,16 +5,19 @@ import com.smartdevicelink.proxy.rpc.BeltStatus; import com.smartdevicelink.proxy.rpc.BodyInformation; import com.smartdevicelink.proxy.rpc.ClusterModeStatus; import com.smartdevicelink.proxy.rpc.DeviceStatus; +import com.smartdevicelink.proxy.rpc.DoorStatus; import com.smartdevicelink.proxy.rpc.ECallInfo; import com.smartdevicelink.proxy.rpc.EmergencyEvent; import com.smartdevicelink.proxy.rpc.FuelRange; import com.smartdevicelink.proxy.rpc.GPSData; +import com.smartdevicelink.proxy.rpc.GateStatus; import com.smartdevicelink.proxy.rpc.GearStatus; import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse; import com.smartdevicelink.proxy.rpc.Grid; import com.smartdevicelink.proxy.rpc.HeadLampStatus; import com.smartdevicelink.proxy.rpc.MyKey; import com.smartdevicelink.proxy.rpc.OnVehicleData; +import com.smartdevicelink.proxy.rpc.RoofStatus; import com.smartdevicelink.proxy.rpc.SingleTireStatus; import com.smartdevicelink.proxy.rpc.StabilityControlsStatus; import com.smartdevicelink.proxy.rpc.TireStatus; @@ -48,6 +51,7 @@ import com.smartdevicelink.proxy.rpc.enums.WiperStatus; import org.json.JSONArray; import org.json.JSONException; +import org.junit.Test; import java.util.ArrayList; import java.util.List; @@ -147,6 +151,10 @@ public class VehicleDataHelper { public static final Boolean BODY_INFORMATION_REAR_LEFT_AJAR = false; public static final Boolean BODY_INFORMATION_REAR_RIGHT_AJAR = true; + public static final JSONArray ROOF_STATUES = TestValues.JSON_ROOF_STATUSES; + public static final JSONArray GATE_STATUES = TestValues.JSON_GATE_STATUSES; + public static final JSONArray DOOR_STATUES = TestValues.JSON_DOOR_STATUSES; + // device status public static final Boolean DEVICE_STATUS_VOICE_REC = true; public static final Boolean DEVICE_STATUS_BT_ICON = true; 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 h1 = JsonRPCMarshaller.deserializeJSONObject(array1.getJSONObject(i)); + Hashtable 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 h1 = JsonRPCMarshaller.deserializeJSONObject(array1.getJSONObject(i)); + Hashtable 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 h1 = JsonRPCMarshaller.deserializeJSONObject(array1.getJSONObject(i)); + Hashtable 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..80bc41c62 --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DoorStatusTests.java @@ -0,0 +1,67 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.DoorStatus; +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 DoorStatusTests extends TestCase { + private DoorStatus msg; + + @Override + public void setUp() { + msg = new DoorStatus(TestValues.GENERAL_GRID, TestValues.GENERAL_DOOR_STATUS_TYPE); + msg.setStatus(TestValues.GENERAL_DOOR_STATUS_TYPE); + } + + public void testRpcValues() { + // Test Values + Grid location = msg.getLocation(); + DoorStatusType status = msg.getStatus(); + + // Valid Tests + assertTrue(Validator.validateGrid(msg.getLocation(), 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 hs1 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(reference, key)); + Hashtable 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/GateStatusTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTest.java new file mode 100644 index 000000000..22f984bb3 --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTest.java @@ -0,0 +1,66 @@ +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 GateStatusTest extends TestCase { + private GateStatus msg; + + @Override + public void setUp() { + msg = new GateStatus(TestValues.GENERAL_GRID, TestValues.GENERAL_DOOR_STATUS_TYPE); + msg.setStatus(TestValues.GENERAL_DOOR_STATUS_TYPE); + } + + public void testRpcValues() { + // Test Values + Grid location = msg.getLocation(); + DoorStatusType status = msg.getStatus(); + + // Valid Tests + assertTrue(Validator.validateGrid(msg.getLocation(), 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 hs1 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(reference, key)); + Hashtable 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..7b93a9b2f --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RoofStatusTests.java @@ -0,0 +1,73 @@ +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(); + + // Valid Tests + assertTrue(Validator.validateGrid(msg.getLocation(), 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_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 hs1 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(reference, key)); + Hashtable 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 hs1 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(reference, key)); + Hashtable 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 enumValueList = Arrays.asList(DoorStatusType.values()); + + List enumTestList = new ArrayList(); + 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/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java index cb60f7572..7cfa73e3c 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java @@ -320,6 +320,9 @@ public class OnVehicleDataTests extends BaseRpcTests { bodyInformationObj.put(BodyInformation.KEY_PARK_BRAKE_ACTIVE, VehicleDataHelper.BODY_INFORMATION_PARK_BRAKE); bodyInformationObj.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STATUS); bodyInformationObj.put(BodyInformation.KEY_IGNITION_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STABLE_STATUS); + bodyInformationObj.put(BodyInformation.KEY_ROOF_STATUSES, VehicleDataHelper.ROOF_STATUES); + bodyInformationObj.put(BodyInformation.KEY_GATE_STATUSES, VehicleDataHelper.GATE_STATUES); + bodyInformationObj.put(BodyInformation.KEY_DOOR_STATUSES, VehicleDataHelper.DOOR_STATUES); bodyInformationObj.put(BodyInformation.KEY_DRIVER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_DRIVER_AJAR); bodyInformationObj.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_PASSENGER_AJAR); bodyInformationObj.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_LEFT_AJAR); diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java index 606283cc7..5a679af4a 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java @@ -202,6 +202,9 @@ public class GetVehicleDataResponseTests extends BaseRpcTests { bodyInformationObj.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STATUS); bodyInformationObj.put(BodyInformation.KEY_IGNITION_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STABLE_STATUS); bodyInformationObj.put(BodyInformation.KEY_DRIVER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_DRIVER_AJAR); + bodyInformationObj.put(BodyInformation.KEY_ROOF_STATUSES, VehicleDataHelper.ROOF_STATUES); + bodyInformationObj.put(BodyInformation.KEY_GATE_STATUSES, VehicleDataHelper.GATE_STATUES); + bodyInformationObj.put(BodyInformation.KEY_DOOR_STATUSES, VehicleDataHelper.DOOR_STATUES); bodyInformationObj.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_PASSENGER_AJAR); bodyInformationObj.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_LEFT_AJAR); bodyInformationObj.put(BodyInformation.KEY_REAR_RIGHT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_RIGHT_AJAR); 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..c6ab55e4b 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java @@ -1,215 +1,423 @@ -/* - * Copyright (c) 2017 - 2019, 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.IgnitionStableStatus; -import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus; - -import java.util.Hashtable; - -/** - * The body information including power modes. - * - *

Note: The structure defines the information about the park brake and ignition.

- * - *

Parameter List

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Param NameTypeMandatoryDescriptionVersion
parkBrakeActiveBooleantrueDescribes, if the park break is active. The information about the park brake: - true, if active - false if not.SmartDeviceLink 2.0
ignitionStableStatusIgnitionStableStatustrueDescribes, if the ignition situation is considered stableThe information about stability of the ignition switch. See {@linkplain IgnitionStableStatus}SmartDeviceLink 2.0
ignitionStatusIgnitionStatustrueThe information about ignition status. See {@linkplain IgnitionStatus}SmartDeviceLink 2.0
parkBrakeActiveBooleantrueThe information about the park brake: - true, if active - false if not.SmartDeviceLink 2.0
driverDoorAjarBooleantrueThe information about the park brake: - true, if active - false if not.SmartDeviceLink 2.0
passengerDoorAjarBooleantrueThe information about the park brake: - true, if active - false if not.SmartDeviceLink 2.0
rearLeftDoorAjarBooleantrueThe information about the park brake: - true, if active - false if not.SmartDeviceLink 2.0
rearRightDoorAjarBooleantrueReferences signal "DrStatRr_B_Actl".SmartDeviceLink 2.0
- * - * @see SubscribeVehicleData - * @see GetVehicleData - * @see OnVehicleData - * @since SmartDeviceLink 2.0 - */ - -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"; - public static final String KEY_DRIVER_DOOR_AJAR = "driverDoorAjar"; - public static final String KEY_PASSENGER_DOOR_AJAR = "passengerDoorAjar"; - public static final String KEY_REAR_LEFT_DOOR_AJAR = "rearLeftDoorAjar"; - public static final String KEY_REAR_RIGHT_DOOR_AJAR = "rearRightDoorAjar"; - - public BodyInformation() { - } - - /** - * Constructs a new BodyInformation object indicated by the Hashtable - * parameter - * - * @param hash hashtable filled with params to create an instance of this RPC - * The hash table to use - */ - public BodyInformation(Hashtable hash) { - super(hash); - } - - public BodyInformation(@NonNull Boolean parkBrakeActive, @NonNull IgnitionStableStatus ignitionStableStatus, @NonNull IgnitionStatus ignitionStatus) { - this(); - setParkBrakeActive(parkBrakeActive); - setIgnitionStableStatus(ignitionStableStatus); - setIgnitionStatus(ignitionStatus); - } - - public BodyInformation setParkBrakeActive(@NonNull Boolean parkBrakeActive) { - setValue(KEY_PARK_BRAKE_ACTIVE, parkBrakeActive); - return this; - } - - public Boolean getParkBrakeActive() { - return getBoolean(KEY_PARK_BRAKE_ACTIVE); - } - - public BodyInformation setIgnitionStableStatus(@NonNull IgnitionStableStatus ignitionStableStatus) { - setValue(KEY_IGNITION_STABLE_STATUS, ignitionStableStatus); - return this; - } - - public IgnitionStableStatus getIgnitionStableStatus() { - return (IgnitionStableStatus) getObject(IgnitionStableStatus.class, KEY_IGNITION_STABLE_STATUS); - } - - public BodyInformation setIgnitionStatus(@NonNull IgnitionStatus ignitionStatus) { - setValue(KEY_IGNITION_STATUS, ignitionStatus); - return this; - } - - public IgnitionStatus getIgnitionStatus() { - return (IgnitionStatus) getObject(IgnitionStatus.class, KEY_IGNITION_STATUS); - } - - public BodyInformation setDriverDoorAjar(Boolean driverDoorAjar) { - setValue(KEY_DRIVER_DOOR_AJAR, driverDoorAjar); - return this; - } - - public Boolean getDriverDoorAjar() { - return getBoolean(KEY_DRIVER_DOOR_AJAR); - } - - - public BodyInformation setPassengerDoorAjar(Boolean passengerDoorAjar) { - setValue(KEY_PASSENGER_DOOR_AJAR, passengerDoorAjar); - return this; - } - - public Boolean getPassengerDoorAjar() { - return getBoolean(KEY_PASSENGER_DOOR_AJAR); - } - - public BodyInformation setRearLeftDoorAjar(Boolean rearLeftDoorAjar) { - setValue(KEY_REAR_LEFT_DOOR_AJAR, rearLeftDoorAjar); - return this; - } - - public Boolean getRearLeftDoorAjar() { - return getBoolean(KEY_REAR_LEFT_DOOR_AJAR); - } - - public BodyInformation setRearRightDoorAjar(Boolean rearRightDoorAjar) { - setValue(KEY_REAR_RIGHT_DOOR_AJAR, rearRightDoorAjar); - return this; - } - - public Boolean getRearRightDoorAjar() { - return getBoolean(KEY_REAR_RIGHT_DOOR_AJAR); - } - -} +/* + * Copyright (c) 2017 - 2019, 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.IgnitionStableStatus; +import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus; + +import java.util.Hashtable; +import java.util.List; + +/** + * + *

Parameter List

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Param NameTypeDescriptionRequiredNotesVersion Available
parkBrakeActiveBooleanReferences signal "PrkBrkActv_B_Actl".Y
ignitionStableStatusIgnitionStableStatusReferences signal "Ignition_Switch_Stable". See IgnitionStableStatus.Y
ignitionStatusIgnitionStatusReferences signal "Ignition_status". See IgnitionStatus.Y
driverDoorAjarBooleanReferences signal "DrStatDrv_B_Actl". Deprecated starting with RPC Spec 7.1.0.N + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + *
passengerDoorAjarBooleanReferences signal "DrStatPsngr_B_Actl". Deprecated starting with RPC Spec 7.1.0.N + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + *
rearLeftDoorAjarBooleanReferences signal "DrStatRl_B_Actl". Deprecated starting with RPC Spec 7.1.0.N + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + *
rearRightDoorAjarBooleanReferences signal "DrStatRr_B_Actl". Deprecated starting with RPC Spec 7.1.0.N + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + *
doorStatusesListProvides status for doors if Ajar/Closed/LockedN{"array_min_size": 0, "array_max_size": 100} + * @since SmartDeviceLink 7.1.0 + *
gateStatusesListProvides status for trunk/hood/etc. if Ajar/Closed/LockedN{"array_min_size": 0, "array_max_size": 100} + * @since SmartDeviceLink 7.1.0 + *
roofStatusesListProvides status for roof/convertible roof/sunroof/moonroof etc., if Closed/Ajar/Removedetc.N{"array_min_size": 0, "array_max_size": 100} + * @since SmartDeviceLink 7.1.0 + *
+ * + * @see SubscribeVehicleData + * @see GetVehicleData + * @see OnVehicleData + * @since SmartDeviceLink 2.0 + */ + +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() { + } + + /** + * Constructs a new BodyInformation object indicated by the Hashtable + * parameter + * + * @param hash hashtable filled with params to create an instance of this RPC + * The hash table to use + */ + public BodyInformation(Hashtable hash) { + super(hash); + } + + public BodyInformation(@NonNull Boolean parkBrakeActive, @NonNull IgnitionStableStatus ignitionStableStatus, @NonNull IgnitionStatus ignitionStatus) { + this(); + setParkBrakeActive(parkBrakeActive); + setIgnitionStableStatus(ignitionStableStatus); + setIgnitionStatus(ignitionStatus); + } + + public BodyInformation setParkBrakeActive(@NonNull Boolean parkBrakeActive) { + setValue(KEY_PARK_BRAKE_ACTIVE, parkBrakeActive); + return this; + } + + public Boolean getParkBrakeActive() { + return getBoolean(KEY_PARK_BRAKE_ACTIVE); + } + + public BodyInformation setIgnitionStableStatus(@NonNull IgnitionStableStatus ignitionStableStatus) { + setValue(KEY_IGNITION_STABLE_STATUS, ignitionStableStatus); + return this; + } + + public IgnitionStableStatus getIgnitionStableStatus() { + return (IgnitionStableStatus) getObject(IgnitionStableStatus.class, KEY_IGNITION_STABLE_STATUS); + } + + public BodyInformation setIgnitionStatus(@NonNull IgnitionStatus ignitionStatus) { + setValue(KEY_IGNITION_STATUS, ignitionStatus); + return this; + } + + public IgnitionStatus getIgnitionStatus() { + 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 doorStatuses) { + setValue(KEY_DOOR_STATUSES, doorStatuses); + return this; + } + + /** + * Gets the doorStatuses. + * + * @return List 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 getDoorStatuses() { + return (List) 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 gateStatuses) { + setValue(KEY_GATE_STATUSES, gateStatuses); + return this; + } + + /** + * Gets the gateStatuses. + * + * @return List 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 getGateStatuses() { + return (List) 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 roofStatuses) { + setValue(KEY_ROOF_STATUSES, roofStatuses); + return this; + } + + /** + * Gets the roofStatuses. + * + * @return List 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 getRoofStatuses() { + return (List) 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. + * + *

Parameter List

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Param NameTypeDescriptionRequiredNotesVersion Available
locationGridY
statusDoorStatusTypeY
+ * + * @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 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. + * + *

Parameter List

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Param NameTypeDescriptionRequiredNotesVersion Available
locationGridY
statusDoorStatusTypeY
+ * + * @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 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. + * + *

Parameter List

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Param NameTypeDescriptionRequiredNotesVersion Available
locationGridY
statusDoorStatusTypeY
stateWindowStateN
+ * + * @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 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; + } + } +} -- cgit v1.2.1 From 2bb43495859bace60abdfcb071f70854224af556 Mon Sep 17 00:00:00 2001 From: kboskin Date: Sat, 12 Dec 2020 15:35:02 +0200 Subject: [0255] - Rollback of the imports --- .../java/com/smartdevicelink/test/TestValues.java | 102 ++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) 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 9df127d51..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 @@ -16,7 +16,107 @@ import com.smartdevicelink.managers.screen.menu.VoiceCommand; import com.smartdevicelink.managers.screen.menu.VoiceCommandSelectionListener; import com.smartdevicelink.protocol.SdlProtocol; import com.smartdevicelink.protocol.enums.FunctionID; -import com.smartdevicelink.proxy.rpc.*; +import com.smartdevicelink.proxy.rpc.AppInfo; +import com.smartdevicelink.proxy.rpc.AppServiceCapability; +import com.smartdevicelink.proxy.rpc.AppServiceData; +import com.smartdevicelink.proxy.rpc.AppServiceManifest; +import com.smartdevicelink.proxy.rpc.AppServiceRecord; +import com.smartdevicelink.proxy.rpc.AppServicesCapabilities; +import com.smartdevicelink.proxy.rpc.AudioControlCapabilities; +import com.smartdevicelink.proxy.rpc.AudioControlData; +import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities; +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.DateTime; +import com.smartdevicelink.proxy.rpc.DeviceInfo; +import com.smartdevicelink.proxy.rpc.DisplayCapabilities; +import com.smartdevicelink.proxy.rpc.DisplayCapability; +import com.smartdevicelink.proxy.rpc.DriverDistractionCapability; +import com.smartdevicelink.proxy.rpc.DynamicUpdateCapabilities; +import com.smartdevicelink.proxy.rpc.EqualizerSettings; +import com.smartdevicelink.proxy.rpc.GearStatus; +import com.smartdevicelink.proxy.rpc.Grid; +import com.smartdevicelink.proxy.rpc.HMICapabilities; +import com.smartdevicelink.proxy.rpc.HMIPermissions; +import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities; +import com.smartdevicelink.proxy.rpc.HMISettingsControlData; +import com.smartdevicelink.proxy.rpc.HapticRect; +import com.smartdevicelink.proxy.rpc.Image; +import com.smartdevicelink.proxy.rpc.ImageField; +import com.smartdevicelink.proxy.rpc.ImageResolution; +import com.smartdevicelink.proxy.rpc.KeyboardProperties; +import com.smartdevicelink.proxy.rpc.LightCapabilities; +import com.smartdevicelink.proxy.rpc.LightControlCapabilities; +import com.smartdevicelink.proxy.rpc.LightControlData; +import com.smartdevicelink.proxy.rpc.LightState; +import com.smartdevicelink.proxy.rpc.LocationDetails; +import com.smartdevicelink.proxy.rpc.MassageCushionFirmness; +import com.smartdevicelink.proxy.rpc.MassageModeData; +import com.smartdevicelink.proxy.rpc.MediaServiceData; +import com.smartdevicelink.proxy.rpc.MediaServiceManifest; +import com.smartdevicelink.proxy.rpc.MenuParams; +import com.smartdevicelink.proxy.rpc.MetadataTags; +import com.smartdevicelink.proxy.rpc.ModuleData; +import com.smartdevicelink.proxy.rpc.ModuleInfo; +import com.smartdevicelink.proxy.rpc.NavigationCapability; +import com.smartdevicelink.proxy.rpc.NavigationInstruction; +import com.smartdevicelink.proxy.rpc.NavigationServiceData; +import com.smartdevicelink.proxy.rpc.NavigationServiceManifest; +import com.smartdevicelink.proxy.rpc.OasisAddress; +import com.smartdevicelink.proxy.rpc.ParameterPermissions; +import com.smartdevicelink.proxy.rpc.PermissionItem; +import com.smartdevicelink.proxy.rpc.PhoneCapability; +import com.smartdevicelink.proxy.rpc.PresetBankCapabilities; +import com.smartdevicelink.proxy.rpc.RGBColor; +import com.smartdevicelink.proxy.rpc.RadioControlCapabilities; +import com.smartdevicelink.proxy.rpc.RadioControlData; +import com.smartdevicelink.proxy.rpc.RdsData; +import com.smartdevicelink.proxy.rpc.Rectangle; +import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities; +import com.smartdevicelink.proxy.rpc.ScreenParams; +import com.smartdevicelink.proxy.rpc.SdlMsgVersion; +import com.smartdevicelink.proxy.rpc.SeatControlCapabilities; +import com.smartdevicelink.proxy.rpc.SeatControlData; +import com.smartdevicelink.proxy.rpc.SeatLocation; +import com.smartdevicelink.proxy.rpc.SeatMemoryAction; +import com.smartdevicelink.proxy.rpc.SingleTireStatus; +import com.smartdevicelink.proxy.rpc.SisData; +import com.smartdevicelink.proxy.rpc.SoftButton; +import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities; +import com.smartdevicelink.proxy.rpc.StabilityControlsStatus; +import com.smartdevicelink.proxy.rpc.StartTime; +import com.smartdevicelink.proxy.rpc.StationIDNumber; +import com.smartdevicelink.proxy.rpc.SystemCapability; +import com.smartdevicelink.proxy.rpc.TTSChunk; +import com.smartdevicelink.proxy.rpc.Temperature; +import com.smartdevicelink.proxy.rpc.TemplateColorScheme; +import com.smartdevicelink.proxy.rpc.TemplateConfiguration; +import com.smartdevicelink.proxy.rpc.TextField; +import com.smartdevicelink.proxy.rpc.TouchCoord; +import com.smartdevicelink.proxy.rpc.TouchEvent; +import com.smartdevicelink.proxy.rpc.TouchEventCapabilities; +import com.smartdevicelink.proxy.rpc.Turn; +import com.smartdevicelink.proxy.rpc.VehicleDataResult; +import com.smartdevicelink.proxy.rpc.VehicleType; +import com.smartdevicelink.proxy.rpc.VideoStreamingCapability; +import com.smartdevicelink.proxy.rpc.VideoStreamingFormat; +import com.smartdevicelink.proxy.rpc.VrHelpItem; +import com.smartdevicelink.proxy.rpc.WeatherAlert; +import com.smartdevicelink.proxy.rpc.WeatherData; +import com.smartdevicelink.proxy.rpc.WeatherServiceData; +import com.smartdevicelink.proxy.rpc.WeatherServiceManifest; +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; -- cgit v1.2.1 From f75c83dd14d7de4788af636b54817a57aa21a495 Mon Sep 17 00:00:00 2001 From: kboskin Date: Sun, 20 Dec 2020 10:51:25 +0200 Subject: [0255] - Fix tests --- .../java/com/sdl/hellosdlandroid/MainActivity.java | 2 +- .../test/rpc/datatypes/DoorStatusTests.java | 4 +- .../test/rpc/datatypes/GateStatusTest.java | 66 -- .../test/rpc/datatypes/GateStatusTests.java | 65 ++ .../test/rpc/datatypes/RoofStatusTests.java | 4 +- .../test/rpc/notifications/OnVehicleDataTests.java | 3 - .../rpc/responses/GetVehicleDataResponseTests.java | 3 - .../smartdevicelink/proxy/rpc/BodyInformation.java | 846 ++++++++++----------- 8 files changed, 493 insertions(+), 500 deletions(-) delete mode 100644 android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTest.java create mode 100644 android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTests.java diff --git a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java index c6ed33123..43ad79ac7 100755 --- a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java +++ b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java @@ -31,7 +31,7 @@ public class MainActivity extends AppCompatActivity { @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicksere. The action bar will + // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); 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 index 80bc41c62..a657529d5 100644 --- 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 @@ -2,7 +2,6 @@ package com.smartdevicelink.test.rpc.datatypes; import com.smartdevicelink.marshal.JsonRPCMarshaller; import com.smartdevicelink.proxy.rpc.DoorStatus; -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; @@ -24,7 +23,6 @@ public class DoorStatusTests extends TestCase { @Override public void setUp() { msg = new DoorStatus(TestValues.GENERAL_GRID, TestValues.GENERAL_DOOR_STATUS_TYPE); - msg.setStatus(TestValues.GENERAL_DOOR_STATUS_TYPE); } public void testRpcValues() { @@ -34,7 +32,7 @@ public class DoorStatusTests extends TestCase { // Valid Tests assertTrue(Validator.validateGrid(msg.getLocation(), location)); - assertEquals(TestValues.MATCH, TestValues.GENERAL_DOOR_STATUS_TYPE, status); + assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, location); } public void testJson() { diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTest.java deleted file mode 100644 index 22f984bb3..000000000 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GateStatusTest.java +++ /dev/null @@ -1,66 +0,0 @@ -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 GateStatusTest extends TestCase { - private GateStatus msg; - - @Override - public void setUp() { - msg = new GateStatus(TestValues.GENERAL_GRID, TestValues.GENERAL_DOOR_STATUS_TYPE); - msg.setStatus(TestValues.GENERAL_DOOR_STATUS_TYPE); - } - - public void testRpcValues() { - // Test Values - Grid location = msg.getLocation(); - DoorStatusType status = msg.getStatus(); - - // Valid Tests - assertTrue(Validator.validateGrid(msg.getLocation(), 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 hs1 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(reference, key)); - Hashtable 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 hs1 = JsonRPCMarshaller.deserializeJSONObject((JSONObject) JsonUtils.readObjectFromJsonObject(reference, key)); + Hashtable 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 index 7b93a9b2f..5d30cdb15 100644 --- 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 @@ -31,10 +31,12 @@ public class RoofStatusTests extends TestCase { // Test Values Grid location = msg.getLocation(); DoorStatusType status = msg.getStatus(); + WindowState windowState = msg.getState(); // Valid Tests - assertTrue(Validator.validateGrid(msg.getLocation(), location)); + 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() { diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java index 7cfa73e3c..cb60f7572 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java @@ -320,9 +320,6 @@ public class OnVehicleDataTests extends BaseRpcTests { bodyInformationObj.put(BodyInformation.KEY_PARK_BRAKE_ACTIVE, VehicleDataHelper.BODY_INFORMATION_PARK_BRAKE); bodyInformationObj.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STATUS); bodyInformationObj.put(BodyInformation.KEY_IGNITION_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STABLE_STATUS); - bodyInformationObj.put(BodyInformation.KEY_ROOF_STATUSES, VehicleDataHelper.ROOF_STATUES); - bodyInformationObj.put(BodyInformation.KEY_GATE_STATUSES, VehicleDataHelper.GATE_STATUES); - bodyInformationObj.put(BodyInformation.KEY_DOOR_STATUSES, VehicleDataHelper.DOOR_STATUES); bodyInformationObj.put(BodyInformation.KEY_DRIVER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_DRIVER_AJAR); bodyInformationObj.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_PASSENGER_AJAR); bodyInformationObj.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_LEFT_AJAR); diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java index 5a679af4a..606283cc7 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java @@ -202,9 +202,6 @@ public class GetVehicleDataResponseTests extends BaseRpcTests { bodyInformationObj.put(BodyInformation.KEY_IGNITION_STABLE_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STATUS); bodyInformationObj.put(BodyInformation.KEY_IGNITION_STATUS, VehicleDataHelper.BODY_INFORMATION_IGNITION_STABLE_STATUS); bodyInformationObj.put(BodyInformation.KEY_DRIVER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_DRIVER_AJAR); - bodyInformationObj.put(BodyInformation.KEY_ROOF_STATUSES, VehicleDataHelper.ROOF_STATUES); - bodyInformationObj.put(BodyInformation.KEY_GATE_STATUSES, VehicleDataHelper.GATE_STATUES); - bodyInformationObj.put(BodyInformation.KEY_DOOR_STATUSES, VehicleDataHelper.DOOR_STATUES); bodyInformationObj.put(BodyInformation.KEY_PASSENGER_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_PASSENGER_AJAR); bodyInformationObj.put(BodyInformation.KEY_REAR_LEFT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_LEFT_AJAR); bodyInformationObj.put(BodyInformation.KEY_REAR_RIGHT_DOOR_AJAR, VehicleDataHelper.BODY_INFORMATION_REAR_RIGHT_AJAR); 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 c6ab55e4b..a88dbcf79 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java @@ -1,423 +1,423 @@ -/* - * Copyright (c) 2017 - 2019, 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.IgnitionStableStatus; -import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus; - -import java.util.Hashtable; -import java.util.List; - -/** - * - *

Parameter List

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Param NameTypeDescriptionRequiredNotesVersion Available
parkBrakeActiveBooleanReferences signal "PrkBrkActv_B_Actl".Y
ignitionStableStatusIgnitionStableStatusReferences signal "Ignition_Switch_Stable". See IgnitionStableStatus.Y
ignitionStatusIgnitionStatusReferences signal "Ignition_status". See IgnitionStatus.Y
driverDoorAjarBooleanReferences signal "DrStatDrv_B_Actl". Deprecated starting with RPC Spec 7.1.0.N - * @since SmartDeviceLink 2.0.0 - * @deprecated in SmartDeviceLink 7.1.0 - *
passengerDoorAjarBooleanReferences signal "DrStatPsngr_B_Actl". Deprecated starting with RPC Spec 7.1.0.N - * @since SmartDeviceLink 2.0.0 - * @deprecated in SmartDeviceLink 7.1.0 - *
rearLeftDoorAjarBooleanReferences signal "DrStatRl_B_Actl". Deprecated starting with RPC Spec 7.1.0.N - * @since SmartDeviceLink 2.0.0 - * @deprecated in SmartDeviceLink 7.1.0 - *
rearRightDoorAjarBooleanReferences signal "DrStatRr_B_Actl". Deprecated starting with RPC Spec 7.1.0.N - * @since SmartDeviceLink 2.0.0 - * @deprecated in SmartDeviceLink 7.1.0 - *
doorStatusesListProvides status for doors if Ajar/Closed/LockedN{"array_min_size": 0, "array_max_size": 100} - * @since SmartDeviceLink 7.1.0 - *
gateStatusesListProvides status for trunk/hood/etc. if Ajar/Closed/LockedN{"array_min_size": 0, "array_max_size": 100} - * @since SmartDeviceLink 7.1.0 - *
roofStatusesListProvides status for roof/convertible roof/sunroof/moonroof etc., if Closed/Ajar/Removedetc.N{"array_min_size": 0, "array_max_size": 100} - * @since SmartDeviceLink 7.1.0 - *
- * - * @see SubscribeVehicleData - * @see GetVehicleData - * @see OnVehicleData - * @since SmartDeviceLink 2.0 - */ - -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() { - } - - /** - * Constructs a new BodyInformation object indicated by the Hashtable - * parameter - * - * @param hash hashtable filled with params to create an instance of this RPC - * The hash table to use - */ - public BodyInformation(Hashtable hash) { - super(hash); - } - - public BodyInformation(@NonNull Boolean parkBrakeActive, @NonNull IgnitionStableStatus ignitionStableStatus, @NonNull IgnitionStatus ignitionStatus) { - this(); - setParkBrakeActive(parkBrakeActive); - setIgnitionStableStatus(ignitionStableStatus); - setIgnitionStatus(ignitionStatus); - } - - public BodyInformation setParkBrakeActive(@NonNull Boolean parkBrakeActive) { - setValue(KEY_PARK_BRAKE_ACTIVE, parkBrakeActive); - return this; - } - - public Boolean getParkBrakeActive() { - return getBoolean(KEY_PARK_BRAKE_ACTIVE); - } - - public BodyInformation setIgnitionStableStatus(@NonNull IgnitionStableStatus ignitionStableStatus) { - setValue(KEY_IGNITION_STABLE_STATUS, ignitionStableStatus); - return this; - } - - public IgnitionStableStatus getIgnitionStableStatus() { - return (IgnitionStableStatus) getObject(IgnitionStableStatus.class, KEY_IGNITION_STABLE_STATUS); - } - - public BodyInformation setIgnitionStatus(@NonNull IgnitionStatus ignitionStatus) { - setValue(KEY_IGNITION_STATUS, ignitionStatus); - return this; - } - - public IgnitionStatus getIgnitionStatus() { - 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 doorStatuses) { - setValue(KEY_DOOR_STATUSES, doorStatuses); - return this; - } - - /** - * Gets the doorStatuses. - * - * @return List 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 getDoorStatuses() { - return (List) 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 gateStatuses) { - setValue(KEY_GATE_STATUSES, gateStatuses); - return this; - } - - /** - * Gets the gateStatuses. - * - * @return List 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 getGateStatuses() { - return (List) 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 roofStatuses) { - setValue(KEY_ROOF_STATUSES, roofStatuses); - return this; - } - - /** - * Gets the roofStatuses. - * - * @return List 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 getRoofStatuses() { - return (List) getObject(RoofStatus.class, KEY_ROOF_STATUSES); - } -} +/* + * Copyright (c) 2017 - 2019, 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.IgnitionStableStatus; +import com.smartdevicelink.proxy.rpc.enums.IgnitionStatus; + +import java.util.Hashtable; +import java.util.List; + +/** + * + *

Parameter List

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Param NameTypeDescriptionRequiredNotesVersion Available
parkBrakeActiveBooleanReferences signal "PrkBrkActv_B_Actl".Y
ignitionStableStatusIgnitionStableStatusReferences signal "Ignition_Switch_Stable". See IgnitionStableStatus.Y
ignitionStatusIgnitionStatusReferences signal "Ignition_status". See IgnitionStatus.Y
driverDoorAjarBooleanReferences signal "DrStatDrv_B_Actl". Deprecated starting with RPC Spec 7.1.0.N + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + *
passengerDoorAjarBooleanReferences signal "DrStatPsngr_B_Actl". Deprecated starting with RPC Spec 7.1.0.N + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + *
rearLeftDoorAjarBooleanReferences signal "DrStatRl_B_Actl". Deprecated starting with RPC Spec 7.1.0.N + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + *
rearRightDoorAjarBooleanReferences signal "DrStatRr_B_Actl". Deprecated starting with RPC Spec 7.1.0.N + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + *
doorStatusesListProvides status for doors if Ajar/Closed/LockedN{"array_min_size": 0, "array_max_size": 100} + * @since SmartDeviceLink 7.1.0 + *
gateStatusesListProvides status for trunk/hood/etc. if Ajar/Closed/LockedN{"array_min_size": 0, "array_max_size": 100} + * @since SmartDeviceLink 7.1.0 + *
roofStatusesListProvides status for roof/convertible roof/sunroof/moonroof etc., if Closed/Ajar/Removedetc.N{"array_min_size": 0, "array_max_size": 100} + * @since SmartDeviceLink 7.1.0 + *
+ * + * @see SubscribeVehicleData + * @see GetVehicleData + * @see OnVehicleData + * @since SmartDeviceLink 2.0 + */ + +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() { + } + + /** + * Constructs a new BodyInformation object indicated by the Hashtable + * parameter + * + * @param hash hashtable filled with params to create an instance of this RPC + * The hash table to use + */ + public BodyInformation(Hashtable hash) { + super(hash); + } + + public BodyInformation(@NonNull Boolean parkBrakeActive, @NonNull IgnitionStableStatus ignitionStableStatus, @NonNull IgnitionStatus ignitionStatus) { + this(); + setParkBrakeActive(parkBrakeActive); + setIgnitionStableStatus(ignitionStableStatus); + setIgnitionStatus(ignitionStatus); + } + + public BodyInformation setParkBrakeActive(@NonNull Boolean parkBrakeActive) { + setValue(KEY_PARK_BRAKE_ACTIVE, parkBrakeActive); + return this; + } + + public Boolean getParkBrakeActive() { + return getBoolean(KEY_PARK_BRAKE_ACTIVE); + } + + public BodyInformation setIgnitionStableStatus(@NonNull IgnitionStableStatus ignitionStableStatus) { + setValue(KEY_IGNITION_STABLE_STATUS, ignitionStableStatus); + return this; + } + + public IgnitionStableStatus getIgnitionStableStatus() { + return (IgnitionStableStatus) getObject(IgnitionStableStatus.class, KEY_IGNITION_STABLE_STATUS); + } + + public BodyInformation setIgnitionStatus(@NonNull IgnitionStatus ignitionStatus) { + setValue(KEY_IGNITION_STATUS, ignitionStatus); + return this; + } + + public IgnitionStatus getIgnitionStatus() { + 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 doorStatuses) { + setValue(KEY_DOOR_STATUSES, doorStatuses); + return this; + } + + /** + * Gets the doorStatuses. + * + * @return List 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 getDoorStatuses() { + return (List) 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 gateStatuses) { + setValue(KEY_GATE_STATUSES, gateStatuses); + return this; + } + + /** + * Gets the gateStatuses. + * + * @return List 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 getGateStatuses() { + return (List) 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 roofStatuses) { + setValue(KEY_ROOF_STATUSES, roofStatuses); + return this; + } + + /** + * Gets the roofStatuses. + * + * @return List 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 getRoofStatuses() { + return (List) getObject(RoofStatus.class, KEY_ROOF_STATUSES); + } +} -- cgit v1.2.1 From 6bd783c69192397a91f509a0bd6da49909d01784 Mon Sep 17 00:00:00 2001 From: kboskin Date: Tue, 29 Dec 2020 16:02:11 +0200 Subject: [0255] - Fix pr comments --- .../java/com/smartdevicelink/test/VehicleDataHelper.java | 8 -------- .../com/smartdevicelink/test/rpc/datatypes/DoorStatusTests.java | 1 - 2 files changed, 9 deletions(-) diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java index dc58a8bd4..a13486983 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java @@ -5,19 +5,16 @@ import com.smartdevicelink.proxy.rpc.BeltStatus; import com.smartdevicelink.proxy.rpc.BodyInformation; import com.smartdevicelink.proxy.rpc.ClusterModeStatus; import com.smartdevicelink.proxy.rpc.DeviceStatus; -import com.smartdevicelink.proxy.rpc.DoorStatus; import com.smartdevicelink.proxy.rpc.ECallInfo; import com.smartdevicelink.proxy.rpc.EmergencyEvent; import com.smartdevicelink.proxy.rpc.FuelRange; import com.smartdevicelink.proxy.rpc.GPSData; -import com.smartdevicelink.proxy.rpc.GateStatus; import com.smartdevicelink.proxy.rpc.GearStatus; import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse; import com.smartdevicelink.proxy.rpc.Grid; import com.smartdevicelink.proxy.rpc.HeadLampStatus; import com.smartdevicelink.proxy.rpc.MyKey; import com.smartdevicelink.proxy.rpc.OnVehicleData; -import com.smartdevicelink.proxy.rpc.RoofStatus; import com.smartdevicelink.proxy.rpc.SingleTireStatus; import com.smartdevicelink.proxy.rpc.StabilityControlsStatus; import com.smartdevicelink.proxy.rpc.TireStatus; @@ -51,7 +48,6 @@ import com.smartdevicelink.proxy.rpc.enums.WiperStatus; import org.json.JSONArray; import org.json.JSONException; -import org.junit.Test; import java.util.ArrayList; import java.util.List; @@ -151,10 +147,6 @@ public class VehicleDataHelper { public static final Boolean BODY_INFORMATION_REAR_LEFT_AJAR = false; public static final Boolean BODY_INFORMATION_REAR_RIGHT_AJAR = true; - public static final JSONArray ROOF_STATUES = TestValues.JSON_ROOF_STATUSES; - public static final JSONArray GATE_STATUES = TestValues.JSON_GATE_STATUSES; - public static final JSONArray DOOR_STATUES = TestValues.JSON_DOOR_STATUSES; - // device status public static final Boolean DEVICE_STATUS_VOICE_REC = true; public static final Boolean DEVICE_STATUS_BT_ICON = true; 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 index a657529d5..564cdabc2 100644 --- 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 @@ -31,7 +31,6 @@ public class DoorStatusTests extends TestCase { DoorStatusType status = msg.getStatus(); // Valid Tests - assertTrue(Validator.validateGrid(msg.getLocation(), location)); assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, location); } -- cgit v1.2.1 From 5f8a2e769e8cfcd6af86be644977f2eea7ea65ce Mon Sep 17 00:00:00 2001 From: kboskin Date: Wed, 6 Jan 2021 12:35:00 +0200 Subject: [0255] - Fix Pr comments --- .../java/com/smartdevicelink/test/rpc/datatypes/DoorStatusTests.java | 1 + 1 file changed, 1 insertion(+) 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 index 564cdabc2..cae1001c3 100644 --- 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 @@ -32,6 +32,7 @@ public class DoorStatusTests extends TestCase { // Valid Tests assertEquals(TestValues.MATCH, TestValues.GENERAL_GRID, location); + assertEquals(TestValues.MATCH, TestValues.GENERAL_DOOR_STATUS_TYPE, status); } public void testJson() { -- cgit v1.2.1 From 57730e53ae180458f71672e35469ee46bca790b7 Mon Sep 17 00:00:00 2001 From: kboskin Date: Fri, 15 Jan 2021 11:38:33 +0200 Subject: [0255] - Rollback of the JavaDoc --- .../smartdevicelink/proxy/rpc/BodyInformation.java | 80 ++++++++++------------ 1 file changed, 35 insertions(+), 45 deletions(-) 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 a88dbcf79..58b102654 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java @@ -41,84 +41,74 @@ import java.util.Hashtable; import java.util.List; /** + * The body information including power modes. + * + *

Note: The structure defines the information about the park brake and ignition.

* *

Parameter List

* * * * + * * - * - * - * + * * * * * - * - * - * - * + * + * + * * * * * - * - * - * - * + * + * + * * * * * - * - * - * - * + * + * + * + * + * + * + * + * + * + * * * * * - * - * - * - * + * + * + * * * * * - * - * - * - * + * + * + * * * * * - * - * - * - * + * + * + * * * * * - * - * - * - * + * + * + * * * * @@ -137,7 +127,7 @@ import java.util.List; * * * * * @@ -149,7 +139,7 @@ import java.util.List; * - * + * *
Param NameTypeMandatoryDescriptionRequiredNotesVersion AvailableVersion
parkBrakeActiveBooleanReferences signal "PrkBrkActv_B_Actl".YtrueDescribes, if the park break is active. The information about the park brake: - true, if active - false if not.SmartDeviceLink 2.0
ignitionStableStatusIgnitionStableStatusReferences signal "Ignition_Switch_Stable". See IgnitionStableStatus.YtrueDescribes, if the ignition situation is considered stableThe information about stability of the ignition switch. See {@linkplain IgnitionStableStatus}SmartDeviceLink 2.0
ignitionStatusIgnitionStatusReferences signal "Ignition_status". See IgnitionStatus.YtrueThe information about ignition status. See {@linkplain IgnitionStatus}SmartDeviceLink 2.0
parkBrakeActiveBooleantrueThe information about the park brake: - true, if active - false if not.SmartDeviceLink 2.0
driverDoorAjarBooleanReferences signal "DrStatDrv_B_Actl". Deprecated starting with RPC Spec 7.1.0.N - * @since SmartDeviceLink 2.0.0 - * @deprecated in SmartDeviceLink 7.1.0 - * trueThe information about the park brake: - true, if active - false if not.SmartDeviceLink 2.0
passengerDoorAjarBooleanReferences signal "DrStatPsngr_B_Actl". Deprecated starting with RPC Spec 7.1.0.N - * @since SmartDeviceLink 2.0.0 - * @deprecated in SmartDeviceLink 7.1.0 - * trueThe information about the park brake: - true, if active - false if not.SmartDeviceLink 2.0
rearLeftDoorAjarBooleanReferences signal "DrStatRl_B_Actl". Deprecated starting with RPC Spec 7.1.0.N - * @since SmartDeviceLink 2.0.0 - * @deprecated in SmartDeviceLink 7.1.0 - * trueThe information about the park brake: - true, if active - false if not.SmartDeviceLink 2.0
rearRightDoorAjarBooleanReferences signal "DrStatRr_B_Actl". Deprecated starting with RPC Spec 7.1.0.N - * @since SmartDeviceLink 2.0.0 - * @deprecated in SmartDeviceLink 7.1.0 - * trueReferences signal "DrStatRr_B_Actl".SmartDeviceLink 2.0
doorStatusesN{"array_min_size": 0, "array_max_size": 100} - * @since SmartDeviceLink 7.1.0 + * @since SmartDeviceLink 7.1.0 *
* @since SmartDeviceLink 7.1.0 *
* * @see SubscribeVehicleData -- cgit v1.2.1 From 3ea6c35f92cf76d69b0f2c892b8123518a34ff40 Mon Sep 17 00:00:00 2001 From: kboskin Date: Mon, 25 Jan 2021 14:59:28 +0200 Subject: [0255] - Fix javadoc --- .../smartdevicelink/proxy/rpc/BodyInformation.java | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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 58b102654..c040af0cd 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/BodyInformation.java @@ -87,28 +87,40 @@ import java.util.List; * Boolean * true * The information about the park brake: - true, if active - false if not. - * SmartDeviceLink 2.0 + * + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + * * * * passengerDoorAjar * Boolean * true * The information about the park brake: - true, if active - false if not. - * SmartDeviceLink 2.0 + * + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + * * * * rearLeftDoorAjar * Boolean * true * The information about the park brake: - true, if active - false if not. - * SmartDeviceLink 2.0 + * + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + * * * * rearRightDoorAjar * Boolean * true * References signal "DrStatRr_B_Actl". - * SmartDeviceLink 2.0 + * + * @since SmartDeviceLink 2.0.0 + * @deprecated in SmartDeviceLink 7.1.0 + * * * * doorStatuses -- cgit v1.2.1 From b3599a54ede42ea25f0e08b30aaac56a520ac8b9 Mon Sep 17 00:00:00 2001 From: Henigan Date: Tue, 26 Jan 2021 09:07:41 -0500 Subject: Prevent potential npe on resolution --- .../streaming/video/VideoStreamingParameters.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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..8f52cf3de 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,11 @@ public class VideoStreamingParameters { this.interval = params.interval; } if (params.resolution != null) { + if (this.resolution == null) { + this.resolution = new ImageResolution(); + resolution.setResolutionWidth(DEFAULT_WIDTH); + resolution.setResolutionHeight(DEFAULT_HEIGHT); + } if (params.resolution.getResolutionHeight() != null && params.resolution.getResolutionHeight() > 0) { this.resolution.setResolutionHeight(params.resolution.getResolutionHeight()); } @@ -152,6 +157,12 @@ public class VideoStreamingParameters { ImageResolution resolution = capability.getPreferredResolution(); if (resolution != null) { + if (this.resolution == null) { + this.resolution = new ImageResolution(); + resolution.setResolutionWidth(DEFAULT_WIDTH); + resolution.setResolutionHeight(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; -- cgit v1.2.1 From 7a30eff365eccb0e67edbd59d4e43b726667a4dc Mon Sep 17 00:00:00 2001 From: Robert Henigan Date: Tue, 26 Jan 2021 11:04:12 -0500 Subject: Apply suggestions from code review Co-authored-by: Bilal Alsharifi <599206+bilal-alsharifi@users.noreply.github.com> --- .../smartdevicelink/streaming/video/VideoStreamingParameters.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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 8f52cf3de..fa1f65489 100644 --- a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java +++ b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java @@ -120,9 +120,7 @@ public class VideoStreamingParameters { } if (params.resolution != null) { if (this.resolution == null) { - this.resolution = new ImageResolution(); - resolution.setResolutionWidth(DEFAULT_WIDTH); - resolution.setResolutionHeight(DEFAULT_HEIGHT); + this.resolution = new ImageResolution(DEFAULT_WIDTH, DEFAULT_HEIGHT); } if (params.resolution.getResolutionHeight() != null && params.resolution.getResolutionHeight() > 0) { this.resolution.setResolutionHeight(params.resolution.getResolutionHeight()); @@ -158,9 +156,7 @@ public class VideoStreamingParameters { if (resolution != null) { if (this.resolution == null) { - this.resolution = new ImageResolution(); - resolution.setResolutionWidth(DEFAULT_WIDTH); - resolution.setResolutionHeight(DEFAULT_HEIGHT); + this.resolution = new ImageResolution(DEFAULT_WIDTH, DEFAULT_HEIGHT); } if (vehicleMake != null) { -- cgit v1.2.1