diff --git a/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json new file mode 100644 index 0000000000..5ab1c6c41e --- /dev/null +++ b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json @@ -0,0 +1,23 @@ +{ + "request":{ + "name":"GetInteriorVehicleDataConsent", + "correlationID":168, + "parameters":{ + "moduleType":"CLIMATE", + "moduleIds":[ + "A0A", + "R0A" + ] + } + }, + "response":{ + "name":"GetInteriorVehicleDataConsent", + "correlationID":169, + "parameters":{ + "allowed":[ + true, + true + ] + } + } +} \ No newline at end of file diff --git a/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json b/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json new file mode 100644 index 0000000000..9f9f600961 --- /dev/null +++ b/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json @@ -0,0 +1,14 @@ +{ + "request":{ + "name":"ReleaseInteriorVehicleDataModule", + "correlationID":172, + "parameters":{ + "moduleType":"CLIMATE", + "moduleIds":"A0A" + } + }, + "response":{ + "name":"ReleaseInteriorVehicleDataModule", + "correlationID":173 + } +} \ No newline at end of file diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java index 375de93627..5cb0cf719b 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java @@ -170,6 +170,24 @@ public static List readIntegerListFromJsonObject(JSONObject json, Strin return null; } + + public static List readBooleanListFromJsonObject(JSONObject json, String key){ + JSONArray jsonArray = readJsonArrayFromJsonObject(json, key); + + if(jsonArray != null){ + int len = jsonArray.length(); + List result = new ArrayList<>(len); + for(int i=0; i readDoubleListFromJsonObject(JSONObject json, String key){ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key); diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java index b3d0908422..793b2b035b 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java @@ -36,6 +36,7 @@ import com.smartdevicelink.proxy.rpc.DisplayCapabilities; import com.smartdevicelink.proxy.rpc.DisplayCapability; import com.smartdevicelink.proxy.rpc.EqualizerSettings; +import com.smartdevicelink.proxy.rpc.Grid; import com.smartdevicelink.proxy.rpc.HMICapabilities; import com.smartdevicelink.proxy.rpc.HMIPermissions; import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities; @@ -57,6 +58,7 @@ 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; @@ -76,6 +78,7 @@ 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; @@ -424,8 +427,10 @@ public class Test { public static final HapticRect GENERAL_HAPTIC_RECT = new HapticRect(); public static final FuelType GENERAL_FUELTYPE = FuelType.GASOLINE; public static final LockScreenConfig GENERAL_LOCKSCREENCONFIG = new LockScreenConfig(); + public static final Grid GENERAL_GRID = new Grid(); + public static final SeatLocation GENERAL_SEAT_LOCATION = new SeatLocation(); + public static final ModuleInfo GENERAL_MODULE_INFO = new ModuleInfo(); public static final WindowType GENERAL_WINDOW_TYPE = WindowType.MAIN; - public static final List GENERAL_LONG_LIST = Arrays.asList(new Long[]{ 1L, 2L }); public static final List GENERAL_TURN_LIST = new ArrayList(); public static final List GENERAL_CHOICE_LIST = new ArrayList(); @@ -473,6 +478,8 @@ public class Test { public static final List GENERAL_WEATHERDATA_LIST = Arrays.asList(GENERAL_WEATHERDATA); public static final List GENERAL_WEATHERALERT_LIST = Arrays.asList(GENERAL_WEATHERALERT); public static final List GENERAL_NAVIGATION_INSTRUCTION_LIST = Arrays.asList(GENERAL_NAVIGATION_INSTRUCTION); + public static final List GENERAL_SEAT_LIST = new ArrayList<>(1); + public static final List GENERAL_BOOLEAN_LIST = Arrays.asList(new Boolean[]{Boolean.TRUE, Boolean.TRUE}); public static final List GENERAL_AVAILABLE_HD_CHANNELS_LIST = Arrays.asList(new Integer[]{ 1, 2}); public static final List GENERAL_IMAGE_TYPE_LIST = Arrays.asList(new ImageType[]{ImageType.DYNAMIC, ImageType.STATIC}); public static final List GENERAL_WINDOW_TYPE_CAPABILITIES_LIST = new ArrayList(1); @@ -515,6 +522,7 @@ public void onVoiceCommandSelected() { public static final JSONArray JSON_RADIOCONTROLCAPABILITIES = new JSONArray(); public static final JSONArray JSON_CLIMATECONTROLCAPABILITIES = new JSONArray(); public static final JSONArray JSON_TEXTFIELDTYPES = new JSONArray(); + public static final JSONArray JSON_SEAT_LOCATIONS = new JSONArray(); public static final JSONObject JSON_TURN = new JSONObject(); public static final JSONObject JSON_IMAGE = new JSONObject(); public static final JSONObject JSON_CHOICE = new JSONObject(); @@ -542,6 +550,8 @@ public void onVoiceCommandSelected() { public static final JSONObject JSON_RGBCOLOR = new JSONObject(); public static final JSONObject JSON_DAYCOLORSCHEME = new JSONObject(); public static final JSONObject JSON_NIGHTCOLORSCHEME = new JSONObject(); + public static final JSONObject JSON_GRID = new JSONObject(); + public static final JSONObject JSON_MODULE_INFO = new JSONObject(); public static final JSONArray JSON_IMAGE_TYPE_SUPPORTED = new JSONArray(); public static final JSONObject JSON_WINDOW_TYPE_CAPABILITIES = new JSONObject(); public static final JSONArray JSON_WINDOW_TYPE_CAPABILITIES_LIST = new JSONArray(); @@ -550,7 +560,6 @@ public void onVoiceCommandSelected() { public static final JSONArray JSON_IMAGE_TYPES = new JSONArray(); public static final JSONObject JSON_DISPLAYCAPABILITY = new JSONObject(); public static final JSONArray JSON_DISPLAYCAPABILITY_LIST = new JSONArray(); - static { GENERAL_TOUCHEVENTCAPABILITIES.setDoublePressAvailable(GENERAL_BOOLEAN); GENERAL_TOUCHEVENTCAPABILITIES.setMultiTouchAvailable(GENERAL_BOOLEAN); @@ -721,6 +730,7 @@ public void onVoiceCommandSelected() { GENERAL_MEDIACLOCKFORMAT_LIST.add(MediaClockFormat.CLOCK1); GENERAL_MEDIACLOCKFORMAT_LIST.add(MediaClockFormat.CLOCK2); + GENERAL_SEAT_LIST.add(GENERAL_SEAT_LOCATION); GENERAL_IMAGE.setValue(GENERAL_STRING); GENERAL_IMAGE.setImageType(GENERAL_IMAGETYPE); @@ -1094,6 +1104,10 @@ public void onVoiceCommandSelected() { GENERAL_NAVIGATION_INSTRUCTION.setDrivingSide(GENERAL_DIRECTION); GENERAL_NAVIGATION_INSTRUCTION.setDetails(GENERAL_STRING); GENERAL_NAVIGATION_INSTRUCTION.setImage(GENERAL_IMAGE); + GENERAL_MODULE_INFO.setModuleId(Test.GENERAL_STRING); + GENERAL_MODULE_INFO.setModuleLocation(Test.GENERAL_GRID); + GENERAL_MODULE_INFO.setModuleServiceArea(Test.GENERAL_GRID); + GENERAL_MODULE_INFO.setMultipleAccessAllowance(Test.GENERAL_BOOLEAN); try { @@ -1323,6 +1337,13 @@ public void onVoiceCommandSelected() { JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ALBUM); JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ARTIST); + JSON_SEAT_LOCATIONS.put(JSON_GRID); + JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_ID, Test.GENERAL_STRING); + JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_LOCATION, Test.JSON_GRID); + JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, Test.JSON_GRID); + JSON_MODULE_INFO.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, Test.GENERAL_BOOLEAN); + + } 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 a96dca9c6f..965098c3f5 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 @@ -32,6 +32,7 @@ import com.smartdevicelink.proxy.rpc.EqualizerSettings; import com.smartdevicelink.proxy.rpc.FuelRange; import com.smartdevicelink.proxy.rpc.GPSData; +import com.smartdevicelink.proxy.rpc.Grid; import com.smartdevicelink.proxy.rpc.HMICapabilities; import com.smartdevicelink.proxy.rpc.HMIPermissions; import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities; @@ -53,6 +54,7 @@ import com.smartdevicelink.proxy.rpc.MediaServiceManifest; import com.smartdevicelink.proxy.rpc.MenuParams; import com.smartdevicelink.proxy.rpc.ModuleData; +import com.smartdevicelink.proxy.rpc.ModuleInfo; import com.smartdevicelink.proxy.rpc.MyKey; import com.smartdevicelink.proxy.rpc.NavigationCapability; import com.smartdevicelink.proxy.rpc.NavigationInstruction; @@ -73,6 +75,7 @@ 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; @@ -3787,4 +3790,73 @@ public static boolean validateVideoStreamingCapability(VideoStreamingCapability return true; } + + public static boolean validateGrid(Grid g1, Grid g2) { + String tag = "validateGrid"; + if (g1 == null) { + return (g2 == null); + } + if (g2 == null) { + return (g1 == null); + } + if (g1.getColumn() != g2.getColumn()) { + log(tag, "Columns do not match"); + return false; + } + if (g1.getRow() != g2.getRow()) { + log(tag, "Rows do not match"); + return false; + } + if (g1.getLevel() != g2.getLevel()) { + log(tag, "Levels do not match"); + return false; + } + if (g1.getColumnSpan() != g2.getColumnSpan()) { + log(tag, "Column spans do not match"); + return false; + } + if (g1.getRowSpan() != g2.getRowSpan()) { + log(tag, "Row spans do not match"); + return false; + } + if (g1.getLevelSpan() != g2.getLevelSpan()) { + log(tag, "Level spans do not match"); + return false; + } + + return true; + } + + public static boolean validateModuleInfo(ModuleInfo m1, ModuleInfo m2) { + if (m1 == null) { + return (m2 == null); + } + if (m2 == null) { + return (m1 == null); + } + if (!m1.getModuleId().equals(m2.getModuleId())) { + return false; + } + if (!m1.getMultipleAccessAllowance().equals(m2.getMultipleAccessAllowance())) { + return false; + } + if (!validateGrid(m1.getModuleLocation(), m2.getModuleLocation())) { + return false; + } + if (!validateGrid(m1.getModuleServiceArea(), m2.getModuleServiceArea())) { + return false; + } + + return true; + } + + public static boolean validateSeatLocation(SeatLocation cap1, SeatLocation cap2) { + if (cap1 == null) { + return (cap2 == null); + } + if (cap2 == null) { + return (cap1 == null); + } + return validateGrid(cap1.getGrid(), cap2.getGrid()); + } } diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java index 524a6bde22..5351bf7a1b 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java @@ -1,14 +1,18 @@ package com.smartdevicelink.test.rpc.datatypes; +import com.smartdevicelink.marshal.JsonRPCMarshaller; import com.smartdevicelink.proxy.rpc.AudioControlCapabilities; +import com.smartdevicelink.proxy.rpc.ModuleInfo; import com.smartdevicelink.test.JsonUtils; import com.smartdevicelink.test.Test; +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; /** @@ -30,6 +34,7 @@ public void setUp() { msg.setEqualizerAvailable(Test.GENERAL_BOOLEAN); msg.setVolumeAvailable(Test.GENERAL_BOOLEAN); msg.setEqualizerMaxChannelId(Test.GENERAL_INT); + msg.setModuleInfo(Test.GENERAL_MODULE_INFO); } /** @@ -44,6 +49,7 @@ public void testRpcValues() { Boolean volumeAvailable = msg.getVolumeAvailable(); Boolean equalizerAvailable = msg.getEqualizerAvailable(); int equalizerMaxChannelId = msg.getEqualizerMaxChannelId(); + ModuleInfo info = msg.getModuleInfo(); // Valid Tests assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName); @@ -52,6 +58,7 @@ public void testRpcValues() { assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) volumeAvailable); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) equalizerAvailable); assertEquals(Test.MATCH, Test.GENERAL_INT, equalizerMaxChannelId); + assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info); // Invalid/Null Tests AudioControlCapabilities msg = new AudioControlCapabilities(); @@ -63,6 +70,7 @@ public void testRpcValues() { assertNull(Test.NULL, msg.getVolumeAvailable()); assertNull(Test.NULL, msg.getEqualizerAvailable()); assertNull(Test.NULL, msg.getEqualizerMaxChannelId()); + assertNull(Test.NULL, msg.getModuleInfo()); } public void testJson() { @@ -76,6 +84,7 @@ public void testJson() { reference.put(AudioControlCapabilities.KEY_VOLUME_AVAILABLE, Test.GENERAL_BOOLEAN); reference.put(AudioControlCapabilities.KEY_EQUALIZER_AVAILABLE, Test.GENERAL_BOOLEAN); reference.put(AudioControlCapabilities.KEY_EQUALIZER_MAX_CHANNEL_ID, Test.GENERAL_INT); + reference.put(AudioControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO); JSONObject underTest = msg.serializeJSON(); assertEquals(Test.MATCH, reference.length(), underTest.length()); @@ -83,9 +92,15 @@ public void testJson() { Iterator iterator = reference.keys(); while (iterator.hasNext()) { String key = (String) iterator.next(); - - assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); - + if (key.equals(AudioControlCapabilities.KEY_MODULE_INFO)) { + JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key); + JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key); + Hashtable h1 = JsonRPCMarshaller.deserializeJSONObject(o1); + Hashtable h2 = JsonRPCMarshaller.deserializeJSONObject(o2); + assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2))); + } else { + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); + } } } catch (JSONException e) { fail(Test.JSON_FAIL); diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java index 4365ceafa7..71f7d3ecf1 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java @@ -1,15 +1,19 @@ package com.smartdevicelink.test.rpc.datatypes; +import com.smartdevicelink.marshal.JsonRPCMarshaller; import com.smartdevicelink.proxy.rpc.ButtonCapabilities; +import com.smartdevicelink.proxy.rpc.ModuleInfo; import com.smartdevicelink.proxy.rpc.enums.ButtonName; import com.smartdevicelink.test.JsonUtils; import com.smartdevicelink.test.Test; +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; /** @@ -28,6 +32,7 @@ public void setUp(){ msg.setName(Test.GENERAL_BUTTONNAME); msg.setShortPressAvailable(Test.GENERAL_BOOLEAN); msg.setUpDownAvailable(Test.GENERAL_BOOLEAN); + msg.setModuleInfo(Test.GENERAL_MODULE_INFO); } @@ -40,12 +45,14 @@ public void testRpcValues () { boolean longPress = msg.getLongPressAvailable(); boolean upDown = msg.getUpDownAvailable(); ButtonName buttonName = msg.getName(); + ModuleInfo info = msg.getModuleInfo(); // Valid Tests assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, shortPress); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, longPress); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, upDown); assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, buttonName); + assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info); // Invalid/Null Tests ButtonCapabilities msg = new ButtonCapabilities(); @@ -65,15 +72,24 @@ public void testJson(){ reference.put(ButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN); reference.put(ButtonCapabilities.KEY_UP_DOWN_AVAILABLE, Test.GENERAL_BOOLEAN); reference.put(ButtonCapabilities.KEY_NAME, Test.GENERAL_BUTTONNAME); + reference.put(ButtonCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO); JSONObject underTest = msg.serializeJSON(); assertEquals(Test.MATCH, reference.length(), underTest.length()); Iterator iterator = reference.keys(); - while(iterator.hasNext()){ + while (iterator.hasNext()) { String key = (String) iterator.next(); - assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); + if (key.equals(ButtonCapabilities.KEY_MODULE_INFO)) { + JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key); + JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key); + Hashtable h1 = JsonRPCMarshaller.deserializeJSONObject(o1); + Hashtable h2 = JsonRPCMarshaller.deserializeJSONObject(o2); + assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2))); + } else { + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); + } } } catch(JSONException e){ fail(Test.JSON_FAIL); diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java index eb182f31c7..a33f35b272 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java @@ -1,10 +1,13 @@ package com.smartdevicelink.test.rpc.datatypes; +import com.smartdevicelink.marshal.JsonRPCMarshaller; import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities; +import com.smartdevicelink.proxy.rpc.ModuleInfo; import com.smartdevicelink.proxy.rpc.enums.DefrostZone; import com.smartdevicelink.proxy.rpc.enums.VentilationMode; import com.smartdevicelink.test.JsonUtils; import com.smartdevicelink.test.Test; +import com.smartdevicelink.test.Validator; import junit.framework.TestCase; @@ -13,6 +16,7 @@ import org.json.JSONObject; import java.util.ArrayList; +import java.util.Hashtable; import java.util.Iterator; import java.util.List; @@ -44,6 +48,7 @@ public void setUp(){ msg.setHeatedWindshieldAvailable(Test.GENERAL_BOOLEAN); msg.setHeatedRearWindowAvailable(Test.GENERAL_BOOLEAN); msg.setHeatedMirrorsAvailable(Test.GENERAL_BOOLEAN); + msg.setModuleInfo(Test.GENERAL_MODULE_INFO); msg.setClimateEnableAvailable(Test.GENERAL_BOOLEAN); } @@ -68,6 +73,7 @@ public void testRpcValues () { boolean heatedWindshieldAvailable = msg.getHeatedWindshieldAvailable(); boolean heatedRearWindowAvailable = msg.getHeatedRearWindowAvailable(); boolean heatedMirrorsAvailable = msg.getHeatedMirrorsAvailable(); + ModuleInfo info = msg.getModuleInfo(); boolean climateEnableAvailable = msg.getClimateEnableAvailable(); // Valid Tests @@ -81,6 +87,7 @@ public void testRpcValues () { assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dualModeEnableAvailable); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, defrostZoneAvailable); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ventilationModeAvailable); + assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info); assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE_LIST.size(), defrostZone.size()); assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE_LIST.size(), ventilationMode.size()); @@ -117,6 +124,7 @@ public void testRpcValues () { assertNull(Test.NULL, msg.getHeatedWindshieldAvailable()); assertNull(Test.NULL, msg.getHeatedRearWindowAvailable()); assertNull(Test.NULL, msg.getHeatedMirrorsAvailable()); + assertNull(Test.NULL, msg.getModuleInfo()); assertNull(Test.NULL, msg.getClimateEnableAvailable()); } @@ -140,6 +148,7 @@ public void testJson(){ reference.put(ClimateControlCapabilities.KEY_HEATED_WIND_SHIELD_AVAILABLE, Test.GENERAL_BOOLEAN); reference.put(ClimateControlCapabilities.KEY_HEATED_REAR_WINDOW_AVAILABLE, Test.GENERAL_BOOLEAN); reference.put(ClimateControlCapabilities.KEY_HEATED_MIRRORS_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(ClimateControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO); reference.put(ClimateControlCapabilities.KEY_CLIMATE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN); JSONObject underTest = msg.serializeJSON(); @@ -175,6 +184,12 @@ public void testJson(){ ventilationModeListTest.add( (VentilationMode)ventilationModeArrayTest.get(index) ); } assertTrue(Test.TRUE, ventilationModeListReference.containsAll(ventilationModeListTest) && ventilationModeListTest.containsAll(ventilationModeListReference)); + } else if (key.equals(ClimateControlCapabilities.KEY_MODULE_INFO)) { + JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key); + JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key); + Hashtable h1 = JsonRPCMarshaller.deserializeJSONObject(o1); + Hashtable h2 = JsonRPCMarshaller.deserializeJSONObject(o2); + assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2))); } else{ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); } diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java new file mode 100644 index 0000000000..32e745d109 --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java @@ -0,0 +1,93 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.Grid; +import com.smartdevicelink.test.Test; + +import junit.framework.TestCase; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.Iterator; + +public class GridTests extends TestCase { + + private Grid msg; + + @Override + public void setUp() { + msg = new Grid(); + msg.setColumn(Test.GENERAL_INT); + msg.setRow(Test.GENERAL_INT); + msg.setLevel(Test.GENERAL_INT); + msg.setColumnSpan(Test.GENERAL_INT); + msg.setRowSpan(Test.GENERAL_INT); + msg.setLevelSpan(Test.GENERAL_INT); + } + + public void testRpcValues() { + int col = msg.getColumn(); + int row = msg.getRow(); + int level = msg.getLevel(); + int colSpan = msg.getColumnSpan(); + int rowSpan = msg.getRowSpan(); + int levelSpan = msg.getLevelSpan(); + + //valid tests + assertEquals(Test.MATCH, col, Test.GENERAL_INT); + assertEquals(Test.MATCH, row, Test.GENERAL_INT); + assertEquals(Test.MATCH, level, Test.GENERAL_INT); + assertEquals(Test.MATCH, colSpan, Test.GENERAL_INT); + assertEquals(Test.MATCH, rowSpan, Test.GENERAL_INT); + assertEquals(Test.MATCH, levelSpan, Test.GENERAL_INT); + + //null tests + Grid msg = new Grid(); + assertNull(Test.NULL, msg.getColumn()); + assertNull(Test.NULL, msg.getRow()); + assertNull(Test.NULL, msg.getLevel()); + assertNull(Test.NULL, msg.getColumnSpan()); + assertNull(Test.NULL, msg.getRowSpan()); + assertNull(Test.NULL, msg.getLevelSpan()); + } + + public void testJson() { + JSONObject original = new JSONObject(); + try { + original.put(Grid.KEY_COLUMN, Test.GENERAL_INT); + original.put(Grid.KEY_ROW, Test.GENERAL_INT); + original.put(Grid.KEY_LEVEL, Test.GENERAL_INT); + original.put(Grid.KEY_COL_SPAN, Test.GENERAL_INT); + original.put(Grid.KEY_ROW_SPAN, Test.GENERAL_INT); + original.put(Grid.KEY_LEVEL_SPAN, Test.GENERAL_INT); + + JSONObject serialized = msg.serializeJSON(); + assertEquals(serialized.length(), original.length()); + + Iterator iter = original.keys(); + String key = ""; + Grid grid1, grid2; + while (iter.hasNext()) { + key = iter.next(); + grid1 = new Grid(JsonRPCMarshaller.deserializeJSONObject(original)); + grid2 = new Grid(JsonRPCMarshaller.deserializeJSONObject(serialized)); + if (key.equals(Grid.KEY_COLUMN)) { + assertEquals(Test.MATCH, grid1.getColumn(), grid2.getColumn()); + } else if (key.equals(Grid.KEY_ROW)) { + assertEquals(Test.MATCH, grid1.getRow(), grid2.getRow()); + } else if (key.equals(Grid.KEY_LEVEL)) { + assertEquals(Test.MATCH, grid1.getLevel(), grid2.getLevel()); + } else if (key.equals(Grid.KEY_COL_SPAN)) { + assertEquals(Test.MATCH, grid1.getColumnSpan(), grid2.getColumnSpan()); + } else if (key.equals(Grid.KEY_ROW_SPAN)) { + assertEquals(Test.MATCH, grid1.getRowSpan(), grid2.getRowSpan()); + } else if (key.equals(Grid.KEY_LEVEL_SPAN)) { + assertEquals(Test.MATCH, grid1.getLevelSpan(), grid2.getLevelSpan()); + } + } + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + } +} diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java index 620868b408..aa49bf0ac5 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java @@ -1,14 +1,18 @@ package com.smartdevicelink.test.rpc.datatypes; +import com.smartdevicelink.marshal.JsonRPCMarshaller; import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities; +import com.smartdevicelink.proxy.rpc.ModuleInfo; import com.smartdevicelink.test.JsonUtils; import com.smartdevicelink.test.Test; +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; /** @@ -27,6 +31,7 @@ public void setUp() { msg.setDistanceUnitAvailable(Test.GENERAL_BOOLEAN); msg.setTemperatureUnitAvailable(Test.GENERAL_BOOLEAN); msg.setDisplayModeUnitAvailable(Test.GENERAL_BOOLEAN); + msg.setModuleInfo(Test.GENERAL_MODULE_INFO); } /** @@ -38,12 +43,14 @@ public void testRpcValues() { Boolean distanceUnitAvailable = msg.getDistanceUnitAvailable(); Boolean temperatureUnitAvailable = msg.getTemperatureUnitAvailable(); Boolean displayModeUnitAvailable = msg.getDisplayModeUnitAvailable(); + ModuleInfo info = msg.getModuleInfo(); // Valid Tests assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) distanceUnitAvailable); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) temperatureUnitAvailable); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) displayModeUnitAvailable); + assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info); // Invalid/Null Tests HMISettingsControlCapabilities msg = new HMISettingsControlCapabilities(); @@ -53,6 +60,7 @@ public void testRpcValues() { assertNull(Test.NULL, msg.getDistanceUnitAvailable()); assertNull(Test.NULL, msg.getTemperatureUnitAvailable()); assertNull(Test.NULL, msg.getDisplayModeUnitAvailable()); + assertNull(Test.NULL, msg.getModuleInfo()); } public void testJson() { @@ -63,6 +71,7 @@ public void testJson() { reference.put(HMISettingsControlCapabilities.KEY_DISTANCE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN); reference.put(HMISettingsControlCapabilities.KEY_TEMPERATURE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN); reference.put(HMISettingsControlCapabilities.KEY_DISPLAY_MODE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(HMISettingsControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO); JSONObject underTest = msg.serializeJSON(); assertEquals(Test.MATCH, reference.length(), underTest.length()); @@ -70,8 +79,15 @@ public void testJson() { Iterator iterator = reference.keys(); while (iterator.hasNext()) { String key = (String) iterator.next(); - - assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); + if (key.equals(HMISettingsControlCapabilities.KEY_MODULE_INFO)) { + JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key); + JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key); + Hashtable h1 = JsonRPCMarshaller.deserializeJSONObject(o1); + Hashtable h2 = JsonRPCMarshaller.deserializeJSONObject(o2); + assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2))); + } else { + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); + } } } catch (JSONException e) { fail(Test.JSON_FAIL); diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java index 4ebd7f467a..ad6e5a4acf 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java @@ -3,6 +3,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller; import com.smartdevicelink.proxy.rpc.LightCapabilities; import com.smartdevicelink.proxy.rpc.LightControlCapabilities; +import com.smartdevicelink.proxy.rpc.ModuleInfo; import com.smartdevicelink.test.JsonUtils; import com.smartdevicelink.test.Test; import com.smartdevicelink.test.Validator; @@ -13,6 +14,7 @@ import org.json.JSONException; import org.json.JSONObject; +import java.util.Hashtable; import java.util.Iterator; import java.util.List; @@ -30,6 +32,7 @@ public void setUp() { msg.setModuleName(Test.GENERAL_STRING); msg.setSupportedLights(Test.GENERAL_LIGHTCAPABILITIES_LIST); + msg.setModuleInfo(Test.GENERAL_MODULE_INFO); } /** @@ -39,10 +42,12 @@ public void testRpcValues() { // Test Values String moduleName = msg.getModuleName(); List supportedLights = msg.getSupportedLights(); + ModuleInfo info = msg.getModuleInfo(); // Valid Tests assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName); assertEquals(Test.MATCH, Test.GENERAL_LIGHTCAPABILITIES_LIST.size(), supportedLights.size()); + assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info); assertTrue(Test.TRUE, Validator.validateLightCapabilitiesList(Test.GENERAL_LIGHTCAPABILITIES_LIST, supportedLights)); @@ -52,6 +57,7 @@ public void testRpcValues() { assertNull(Test.NULL, msg.getModuleName()); assertNull(Test.NULL, msg.getSupportedLights()); + assertNull(Test.NULL, msg.getModuleInfo()); } public void testJson() { @@ -60,6 +66,7 @@ public void testJson() { try { reference.put(LightControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING); reference.put(LightControlCapabilities.KEY_SUPPORTED_LIGHTS, Test.GENERAL_LIGHTCAPABILITIES_LIST); + reference.put(LightControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO); JSONObject underTest = msg.serializeJSON(); assertEquals(Test.MATCH, reference.length(), underTest.length()); @@ -75,7 +82,14 @@ public void testJson() { for (LightCapabilities lc : lcReference) { assertTrue(Validator.validateLightCapabilities(lc, new LightCapabilities(JsonRPCMarshaller.deserializeJSONObject(lsArray.getJSONObject(i++))))); } - } else { + } else if(key.equals(LightControlCapabilities.KEY_MODULE_INFO)) { + JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key); + JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key); + Hashtable h1 = JsonRPCMarshaller.deserializeJSONObject(o1); + Hashtable h2 = JsonRPCMarshaller.deserializeJSONObject(o2); + assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2))); + } + else { assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); } } diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java index b553587ade..7f4a78b274 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java @@ -39,6 +39,7 @@ public void setUp() { msg.setAudioControlData(Test.GENERAL_AUDIOCONTROLDATA); msg.setHmiSettingsControlData(Test.GENERAL_HMISETTINGSCONTROLDATA); msg.setLightControlData(Test.GENERAL_LIGHTCONTROLDATA); + msg.setModuleId(Test.GENERAL_STRING); } /** @@ -53,6 +54,7 @@ public void testRpcValues() { AudioControlData audioControlData = msg.getAudioControlData(); HMISettingsControlData hmiSettingsControlData = msg.getHmiSettingsControlData(); LightControlData lightControlData = msg.getLightControlData(); + String moduleId = msg.getModuleId(); // Valid Tests assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, moduleType); @@ -62,6 +64,7 @@ public void testRpcValues() { assertTrue(Test.TRUE, Validator.validateAudioControlData(Test.GENERAL_AUDIOCONTROLDATA, audioControlData)); assertTrue(Test.TRUE, Validator.validateHMISettingsControlData(Test.GENERAL_HMISETTINGSCONTROLDATA, hmiSettingsControlData)); assertTrue(Test.TRUE, Validator.validateLightControlData(Test.GENERAL_LIGHTCONTROLDATA, lightControlData)); + assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleId); // Invalid/Null Tests ModuleData msg = new ModuleData(); @@ -74,6 +77,7 @@ public void testRpcValues() { assertNull(Test.NULL, msg.getAudioControlData()); assertNull(Test.NULL, msg.getHmiSettingsControlData()); assertNull(Test.NULL, msg.getLightControlData()); + assertNull(Test.NULL, msg.getModuleId()); } public void testJson() { @@ -87,6 +91,7 @@ public void testJson() { reference.put(ModuleData.KEY_AUDIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_AUDIOCONTROLDATA.getStore())); reference.put(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_HMISETTINGSCONTROLDATA.getStore())); reference.put(ModuleData.KEY_LIGHT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LIGHTCONTROLDATA.getStore())); + reference.put(ModuleData.KEY_MODULE_ID, Test.GENERAL_STRING); JSONObject underTest = msg.serializeJSON(); assertEquals(Test.MATCH, reference.length(), underTest.length()); diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java new file mode 100644 index 0000000000..508c216f6a --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java @@ -0,0 +1,66 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.Grid; +import com.smartdevicelink.proxy.rpc.ModuleInfo; +import com.smartdevicelink.test.Test; +import com.smartdevicelink.test.Validator; + +import junit.framework.TestCase; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.Hashtable; + +public class ModuleInfoTests extends TestCase { + private ModuleInfo msg; + + @Override + public void setUp() { + msg = new ModuleInfo(); + msg.setModuleId(Test.GENERAL_STRING); + msg.setModuleLocation(Test.GENERAL_GRID); + msg.setModuleServiceArea(Test.GENERAL_GRID); + msg.setMultipleAccessAllowance(Test.GENERAL_BOOLEAN); + } + + public void testRpcValues() { + String id = msg.getModuleId(); + Grid loc = msg.getModuleLocation(); + Grid area = msg.getModuleServiceArea(); + boolean isAllowed = msg.getMultipleAccessAllowance(); + + //valid tests + assertEquals(Test.MATCH, Test.GENERAL_STRING, id); + assertEquals(Test.MATCH, Test.GENERAL_GRID, loc); + assertEquals(Test.MATCH, Test.GENERAL_GRID, area); + assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, isAllowed); + + //null test + ModuleInfo msg = new ModuleInfo(); + assertNull(Test.NULL, msg.getModuleId()); + assertNull(Test.NULL, msg.getModuleLocation()); + assertNull(Test.NULL, msg.getModuleServiceArea()); + assertNull(Test.NULL, msg.getMultipleAccessAllowance()); + } + + public void testJson() { + JSONObject original = new JSONObject(); + try { + original.put(ModuleInfo.KEY_MODULE_ID, Test.GENERAL_STRING); + original.put(ModuleInfo.KEY_MODULE_LOCATION, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_GRID.getStore())); + original.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_GRID.getStore())); + original.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, Test.GENERAL_BOOLEAN); + + JSONObject serialized = msg.serializeJSON(); + assertEquals(Test.MATCH, original.length(), serialized.length()); + + Hashtable h1 = JsonRPCMarshaller.deserializeJSONObject(original); + Hashtable h2 = JsonRPCMarshaller.deserializeJSONObject(serialized); + assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2))); + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + } +} diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java index a525bdb233..a65a7deef8 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java @@ -1,14 +1,18 @@ package com.smartdevicelink.test.rpc.datatypes; +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.ModuleInfo; import com.smartdevicelink.proxy.rpc.RadioControlCapabilities; import com.smartdevicelink.test.JsonUtils; import com.smartdevicelink.test.Test; +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; /** @@ -36,6 +40,7 @@ public void setUp(){ msg.setHdRadioEnableAvailable(Test.GENERAL_BOOLEAN); msg.setSiriusXMRadioAvailable(Test.GENERAL_BOOLEAN); msg.setSisDataAvailable(Test.GENERAL_BOOLEAN); + msg.setModuleInfo(Test.GENERAL_MODULE_INFO); msg.setAvailableHdChannelsAvailable(Test.GENERAL_BOOLEAN); } @@ -57,6 +62,7 @@ public void testRpcValues () { boolean hdRadioEnableAvailable = msg.getHdRadioEnableAvailable(); boolean siriusXMRadioAvailable = msg.getSiriusXMRadioAvailable(); boolean sisDataAvailable = msg.getSisDataAvailable(); + ModuleInfo info = msg.getModuleInfo(); boolean availableHdChannelsAvailable = msg.getAvailableHdChannelsAvailable(); @@ -74,6 +80,7 @@ public void testRpcValues () { assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, hdRadioEnableAvailable); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, siriusXMRadioAvailable); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, sisDataAvailable); + assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, availableHdChannelsAvailable); // Invalid/Null Tests @@ -93,6 +100,7 @@ public void testRpcValues () { assertNull(Test.NULL, msg.getHdRadioEnableAvailable()); assertNull(Test.NULL, msg.getSiriusXMRadioAvailable()); assertNull(Test.NULL, msg.getSisDataAvailable()); + assertNull(Test.NULL, msg.getModuleInfo()); assertNull(Test.NULL, msg.getAvailableHdChannelsAvailable()); } @@ -113,6 +121,7 @@ public void testJson(){ reference.put(RadioControlCapabilities.KEY_HD_RADIO_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN); reference.put(RadioControlCapabilities.KEY_SIRIUS_XM_RADIO_AVAILABLE, Test.GENERAL_BOOLEAN); reference.put(RadioControlCapabilities.KEY_SIS_DATA_AVAILABLE, Test.GENERAL_BOOLEAN); + reference.put(RadioControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO); reference.put(RadioControlCapabilities.KEY_AVAILABLE_HD_CHANNELS_AVAILABLE, Test.GENERAL_BOOLEAN); JSONObject underTest = msg.serializeJSON(); @@ -121,8 +130,15 @@ public void testJson(){ Iterator iterator = reference.keys(); while(iterator.hasNext()){ String key = (String) iterator.next(); - - assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); + if (key.equals(RadioControlCapabilities.KEY_MODULE_INFO)) { + JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key); + JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key); + Hashtable h1 = JsonRPCMarshaller.deserializeJSONObject(o1); + Hashtable h2 = JsonRPCMarshaller.deserializeJSONObject(o2); + assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2))); + } else { + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key)); + } } } catch(JSONException e){ diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java new file mode 100644 index 0000000000..847564adb4 --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java @@ -0,0 +1,99 @@ +package com.smartdevicelink.test.rpc.datatypes; + + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.SeatLocation; +import com.smartdevicelink.proxy.rpc.SeatLocationCapability; +import com.smartdevicelink.test.JsonUtils; +import com.smartdevicelink.test.Test; +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 java.util.List; + +public class SeatLocationCapabilityTests extends TestCase { + + private SeatLocationCapability msg; + + @Override + public void setUp() { + msg = new SeatLocationCapability(); + msg.setCols(Test.GENERAL_INT); + msg.setRows(Test.GENERAL_INT); + msg.setLevels(Test.GENERAL_INT); + msg.setSeats(Test.GENERAL_SEAT_LIST); + } + + public void testRpcValues() { + int row = msg.getRows(); + int col = msg.getCols(); + int level = msg.getLevels(); + List seats = msg.getSeatLocations(); + + //valid tests + assertEquals(Test.MATCH, row, Test.GENERAL_INT); + assertEquals(Test.MATCH, col, Test.GENERAL_INT); + assertEquals(Test.MATCH, level, Test.GENERAL_INT); + assertEquals(Test.MATCH, seats.size(), Test.GENERAL_SEAT_LIST.size()); + for (int i = 0; i < Test.GENERAL_SEAT_LIST.size(); i++) { + assertTrue(Test.TRUE, Validator.validateGrid(Test.GENERAL_SEAT_LIST.get(i).getGrid(), seats.get(i).getGrid())); + } + + //null tests + SeatLocationCapability msg = new SeatLocationCapability(); + assertNull(Test.NULL, msg.getCols()); + assertNull(Test.NULL, msg.getRows()); + assertNull(Test.NULL, msg.getLevels()); + assertNull(Test.NULL, msg.getSeatLocations()); + } + + public void testJson() { + JSONObject original = new JSONObject(); + try { + original.put(SeatLocationCapability.KEY_COLS, Test.GENERAL_INT); + original.put(SeatLocationCapability.KEY_ROWS, Test.GENERAL_INT); + original.put(SeatLocationCapability.KEY_LEVELS, Test.GENERAL_INT); + original.put(SeatLocationCapability.KEY_SEATS, Test.JSON_SEAT_LOCATIONS); + + JSONObject serialized = msg.serializeJSON(); + assertEquals(serialized.length(), original.length()); + + Iterator iter = original.keys(); + String key = ""; + while (iter.hasNext()) { + key = iter.next(); + if (key.equals(SeatLocationCapability.KEY_COLS)) { + int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getCols(); + int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getCols(); + assertEquals(Test.MATCH, i1, i2); + } else if (key.equals(SeatLocationCapability.KEY_ROWS)) { + int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getRows(); + int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getRows(); + assertEquals(Test.MATCH, i1, i2); + } else if (key.equals(SeatLocationCapability.KEY_LEVELS)) { + int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getLevels(); + int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getLevels(); + assertEquals(Test.MATCH, i1, i2); + } else if (key.equals(SeatLocationCapability.KEY_SEATS)) { + JSONArray arr1 = JsonUtils.readJsonArrayFromJsonObject(original, key); + JSONArray arr2 = JsonUtils.readJsonArrayFromJsonObject(serialized, key); + assertEquals(Test.MATCH, arr1.length(), arr2.length()); + for (int i = 0; i < Test.GENERAL_SEAT_LIST.size(); i++) { + Hashtable h1 = JsonRPCMarshaller.deserializeJSONObject(arr1.getJSONObject(i)); + Hashtable h2 = JsonRPCMarshaller.deserializeJSONObject(arr2.getJSONObject(i)); + assertTrue(Test.MATCH, Validator.validateSeatLocation(new SeatLocation(h1), new SeatLocation(h2))); + } + } + } + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + } +} diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java new file mode 100644 index 0000000000..6a102fc66a --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java @@ -0,0 +1,48 @@ +package com.smartdevicelink.test.rpc.datatypes; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.proxy.rpc.Grid; +import com.smartdevicelink.proxy.rpc.SeatLocation; +import com.smartdevicelink.test.Test; +import com.smartdevicelink.test.Validator; + +import junit.framework.TestCase; + +import org.json.JSONException; +import org.json.JSONObject; + +public class SeatLocationTests extends TestCase { + + private SeatLocation msg; + + @Override + public void setUp() { + msg = new SeatLocation(); + msg.setGrid(Test.GENERAL_GRID); + } + + public void testRpcValues() { + Grid grid = msg.getGrid(); + + //valid test + assertTrue(Validator.validateGrid(Test.GENERAL_GRID, grid)); + + //null test + SeatLocation msg = new SeatLocation(); + assertNull(Test.NULL, msg.getGrid()); + } + + public void testJson() { + JSONObject original = new JSONObject(); + try { + original.put(SeatLocation.KEY_GRID, Test.GENERAL_GRID); + + JSONObject serialized = msg.serializeJSON(); + assertEquals(serialized.length(), original.length()); + assertTrue(Test.TRUE, Validator.validateSeatLocation(new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(original)), + new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(serialized)))); + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + } +} diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java index 422ab808c8..38caad1097 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java @@ -32,6 +32,8 @@ public void testValidEnums () { GlobalProperty enumMenuIcon = GlobalProperty.valueForString(example); example = "KEYBOARDPROPERTIES"; GlobalProperty enumKeyboardProperties = GlobalProperty.valueForString(example); + example = "USERLOCATION"; + GlobalProperty enumUserLocation = GlobalProperty.valueForString(example); assertNotNull("HELPPROMPT returned null", enumHelpPrompt); assertNotNull("TIMEOUTPROMPT returned null", enumTimeoutPrompt); @@ -40,6 +42,7 @@ public void testValidEnums () { assertNotNull("MENUNAME returned null", enumMenuName); assertNotNull("MENUICON returned null", enumMenuIcon); assertNotNull("KEYBOARDPROPERTIES returned null", enumKeyboardProperties); + assertNotNull("USERLOCATION returned null", enumUserLocation); } /** @@ -84,6 +87,7 @@ public void testListEnum() { enumTestList.add(GlobalProperty.MENUNAME); enumTestList.add(GlobalProperty.MENUICON); enumTestList.add(GlobalProperty.KEYBOARDPROPERTIES); + enumTestList.add(GlobalProperty.USERLOCATION); 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/enums/SystemCapabilityTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java index bf3bed46bc..f453cb985b 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java @@ -48,6 +48,8 @@ public void testValidEnums () { SystemCapabilityType enumPCM = SystemCapabilityType.valueForString(example); example = "APP_SERVICES"; SystemCapabilityType enumAppServices = SystemCapabilityType.valueForString(example); + example = "SEAT_LOCATION"; + SystemCapabilityType enumSeatLocation = SystemCapabilityType.valueForString(example); example = "PRERECORDED_SPEECH"; SystemCapabilityType enumPrerecordedSpeech = SystemCapabilityType.valueForString(example); example = "DISPLAYS"; @@ -68,6 +70,7 @@ public void testValidEnums () { assertNotNull("VOICE_RECOGNITION returned null", enumVoiceRecognition); assertNotNull("PCM_STREAMING", enumPCM); assertNotNull("APP_SERVICES", enumAppServices); + assertNotNull("SEAT_LOCATION return null", enumSeatLocation); assertNotNull("PRERECORDED_SPEECH", enumPrerecordedSpeech); assertNotNull("DISPLAYS", enumDisplays); } @@ -122,6 +125,7 @@ public void testListEnum() { enumTestList.add(SystemCapabilityType.VOICE_RECOGNITION); enumTestList.add(SystemCapabilityType.PCM_STREAMING); enumTestList.add(SystemCapabilityType.APP_SERVICES); + enumTestList.add(SystemCapabilityType.SEAT_LOCATION); enumTestList.add(SystemCapabilityType.PRERECORDED_SPEECH); enumTestList.add(SystemCapabilityType.DISPLAYS); diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java index f16a3a87c5..6f90585d45 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java @@ -30,6 +30,7 @@ protected RPCMessage createMessage(){ msg.setModuleType(Test.GENERAL_MODULETYPE); msg.setButtonPressMode(Test.GENERAL_BUTTONPRESSMODE); msg.setButtonName(Test.GENERAL_BUTTONNAME); + msg.setModuleId(Test.GENERAL_STRING); return msg; } @@ -52,6 +53,7 @@ protected JSONObject getExpectedParameters(int sdlVersion){ result.put(ButtonPress.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE); result.put(ButtonPress.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME); result.put(ButtonPress.KEY_BUTTON_PRESS_MODE, Test.GENERAL_BUTTONPRESSMODE); + result.put(ButtonPress.KEY_MODULE_ID, Test.GENERAL_STRING); }catch(JSONException e){ fail(Test.JSON_FAIL); } @@ -67,11 +69,13 @@ public void testRpcValues () { ModuleType testModuleType = ( (ButtonPress) msg ).getModuleType(); ButtonName testButtonName = ( (ButtonPress) msg ).getButtonName(); ButtonPressMode testButtonPressMode = ( (ButtonPress) msg ).getButtonPressMode(); + String testButtonId = ((ButtonPress) msg).getModuleId(); // Valid Tests assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType); assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, testButtonName); assertEquals(Test.MATCH, Test.GENERAL_BUTTONPRESSMODE, testButtonPressMode); + assertEquals(Test.MATCH, Test.GENERAL_STRING, testButtonId); // Invalid/Null Tests ButtonPress msg = new ButtonPress(); @@ -81,6 +85,7 @@ public void testRpcValues () { assertNull(Test.NULL, msg.getModuleType()); assertNull(Test.NULL, msg.getButtonName()); assertNull(Test.NULL, msg.getButtonPressMode()); + assertNull(Test.NULL, msg.getModuleId()); } /** @@ -106,6 +111,7 @@ public void testJsonConstructor () { assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString()); assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_NAME).toString(), cmd.getButtonName().toString()); assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_PRESS_MODE).toString(), cmd.getButtonPressMode().toString()); + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_ID), cmd.getModuleId()); }catch (JSONException e) { fail(Test.JSON_FAIL); } diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java new file mode 100644 index 0000000000..0f21a2076f --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java @@ -0,0 +1,90 @@ +package com.smartdevicelink.test.rpc.requests; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCMessage; +import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsent; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; +import com.smartdevicelink.test.BaseRpcTests; +import com.smartdevicelink.test.JsonUtils; +import com.smartdevicelink.test.Test; +import com.smartdevicelink.test.json.rpc.JsonFileReader; + + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.Hashtable; +import java.util.List; + +public class GetInteriorVehicleDataConsentTests extends BaseRpcTests { + + @Override + protected RPCMessage createMessage() { + GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent(); + msg.setModuleType(Test.GENERAL_MODULETYPE); + msg.setModuleIds(Test.GENERAL_STRING_LIST); + return msg; + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion) { + JSONObject result = new JSONObject(); + try { + result.put(GetInteriorVehicleDataConsent.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE); + result.put(GetInteriorVehicleDataConsent.KEY_MODULE_ID, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST)); + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + return result; + } + + @Override + protected String getCommandType() { + return FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString(); + } + + @Override + protected String getMessageType(){ + return RPCMessage.KEY_REQUEST; + } + + public void testRpcValues() { + ModuleType type = ((GetInteriorVehicleDataConsent) msg).getModuleType(); + List ids = ((GetInteriorVehicleDataConsent) msg).getModuleIds(); + + //valid tests + assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, type); + assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, ids); + + //null tests + GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent(); + assertNull(Test.NULL, msg.getModuleType()); + assertNull(Test.NULL, msg.getModuleIds()); + + } + + public void testJsonConstructor() { + JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType()); + assertNotNull(Test.NOT_NULL, commandJson); + + try { + Hashtable hash = JsonRPCMarshaller.deserializeJSONObject(commandJson); + GetInteriorVehicleDataConsent cmd = new GetInteriorVehicleDataConsent(hash); + + JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType()); + assertNotNull(Test.NOT_NULL, body); + + assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName()); + assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID()); + + JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS); + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString()); + assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_ID), cmd.getModuleIds()); + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + } + + +} diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java index 5a08d42663..dd175ae6f6 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java @@ -27,6 +27,7 @@ protected RPCMessage createMessage(){ msg.setModuleType(Test.GENERAL_MODULETYPE); msg.setSubscribe(Test.GENERAL_BOOLEAN); + msg.setModuleId(Test.GENERAL_STRING); return msg; } @@ -48,6 +49,7 @@ protected JSONObject getExpectedParameters(int sdlVersion){ try{ result.put(GetInteriorVehicleData.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE); result.put(GetInteriorVehicleData.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN); + result.put(GetInteriorVehicleData.KEY_MODULE_ID, Test.GENERAL_STRING); }catch(JSONException e){ fail(Test.JSON_FAIL); } @@ -62,10 +64,12 @@ public void testRpcValues () { // Test Values ModuleType testModuleType = ( (GetInteriorVehicleData) msg ).getModuleType(); boolean testSubscribed = ( (GetInteriorVehicleData) msg ).getSubscribe(); + String testModuleId = ((GetInteriorVehicleData) msg).getModuleId(); // Valid Tests assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType); assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testSubscribed); + assertEquals(Test.MATCH, Test.GENERAL_STRING, testModuleId); // Invalid/Null Tests GetInteriorVehicleData msg = new GetInteriorVehicleData(); @@ -74,6 +78,7 @@ public void testRpcValues () { assertNull(Test.NULL, msg.getModuleType()); assertNull(Test.NULL, msg.getSubscribe()); + assertNull(Test.NULL, msg.getModuleId()); } /** @@ -98,6 +103,7 @@ public void testJsonConstructor () { assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString()); assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_SUBSCRIBE), cmd.getSubscribe()); + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_ID), cmd.getModuleId()); }catch (JSONException e) { fail(Test.JSON_FAIL); } diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java new file mode 100644 index 0000000000..711e4c9770 --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java @@ -0,0 +1,85 @@ +package com.smartdevicelink.test.rpc.requests; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCMessage; +import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModule; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; +import com.smartdevicelink.test.BaseRpcTests; +import com.smartdevicelink.test.JsonUtils; +import com.smartdevicelink.test.Test; +import com.smartdevicelink.test.json.rpc.JsonFileReader; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.Hashtable; + +public class ReleaseInteriorVehicleDataModuleTests extends BaseRpcTests { + + @Override + protected RPCMessage createMessage() { + ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule(); + msg.setModuleType(Test.GENERAL_MODULETYPE); + msg.setModuleId(Test.GENERAL_STRING); + return msg; + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion) { + JSONObject result = new JSONObject(); + try { + result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE); + result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_ID, Test.GENERAL_STRING); + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + return result; + } + + @Override + protected String getCommandType() { + return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString(); + } + + @Override + protected String getMessageType() { + return RPCMessage.KEY_REQUEST; + } + + public void testRpcValues() { + ModuleType type = ((ReleaseInteriorVehicleDataModule) msg).getModuleType(); + String id = ((ReleaseInteriorVehicleDataModule) msg).getModuleId(); + + //valid tests + assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, type); + assertEquals(Test.MATCH, Test.GENERAL_STRING, id); + + //null tests + ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule(); + assertNull(Test.NULL, msg.getModuleType()); + assertNull(Test.NULL, msg.getModuleId()); + } + + public void testJsonConstructor() { + JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType()); + assertNotNull(Test.NOT_NULL, commandJson); + + try { + Hashtable hash = JsonRPCMarshaller.deserializeJSONObject(commandJson); + ReleaseInteriorVehicleDataModule cmd = new ReleaseInteriorVehicleDataModule(hash); + + JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType()); + assertNotNull(Test.NOT_NULL, body); + + assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName()); + assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID()); + + JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS); + assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString()); + assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_ID), cmd.getModuleId()); + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + } +} diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java new file mode 100644 index 0000000000..b77e056c95 --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java @@ -0,0 +1,75 @@ +package com.smartdevicelink.test.rpc.responses; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCMessage; +import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse; +import com.smartdevicelink.test.BaseRpcTests; +import com.smartdevicelink.test.JsonUtils; +import com.smartdevicelink.test.Test; +import com.smartdevicelink.test.json.rpc.JsonFileReader; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.Hashtable; +import java.util.List; + +public class GetInteriorVehicleDataConsentResponseTests extends BaseRpcTests { + + @Override + protected RPCMessage createMessage() { + GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(); + msg.setAllowances(Test.GENERAL_BOOLEAN_LIST); + return msg; + } + + @Override + protected String getMessageType() { + return RPCMessage.KEY_RESPONSE; + } + + @Override + protected String getCommandType() { + return FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString(); + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion) { + JSONObject result = new JSONObject(); + + try{ + result.put(GetInteriorVehicleDataConsentResponse.KEY_ALLOWED, JsonUtils.createJsonArray(Test.GENERAL_BOOLEAN_LIST)); + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + return result; + } + + public void testRpcValues() { + List list = ((GetInteriorVehicleDataConsentResponse) msg).getAllowances(); + assertEquals(Test.MATCH, list, Test.GENERAL_BOOLEAN_LIST); + } + + public void testJsonConstructor() { + JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType()); + assertNotNull(Test.NOT_NULL, commandJson); + + try { + Hashtable hash = JsonRPCMarshaller.deserializeJSONObject(commandJson); + GetInteriorVehicleDataConsentResponse cmd = new GetInteriorVehicleDataConsentResponse(hash); + + JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType()); + assertNotNull(Test.NOT_NULL, body); + + assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName()); + assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID()); + + JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS); + assertEquals(Test.MATCH, JsonUtils.readBooleanListFromJsonObject(parameters, + GetInteriorVehicleDataConsentResponse.KEY_ALLOWED), cmd.getAllowances()); + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + } +} diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java new file mode 100644 index 0000000000..f1d2b6e5a3 --- /dev/null +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java @@ -0,0 +1,56 @@ +package com.smartdevicelink.test.rpc.responses; + +import com.smartdevicelink.marshal.JsonRPCMarshaller; +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCMessage; +import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse; +import com.smartdevicelink.test.BaseRpcTests; +import com.smartdevicelink.test.JsonUtils; +import com.smartdevicelink.test.Test; +import com.smartdevicelink.test.json.rpc.JsonFileReader; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.Hashtable; + +public class ReleaseInteriorVehicleDataModuleResponseTests extends BaseRpcTests { + @Override + protected RPCMessage createMessage() { + ReleaseInteriorVehicleDataModuleResponse msg = new ReleaseInteriorVehicleDataModuleResponse(); + return msg; + } + + @Override + protected String getMessageType() { + return RPCMessage.KEY_RESPONSE; + } + + @Override + protected String getCommandType() { + return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString(); + } + + @Override + protected JSONObject getExpectedParameters(int sdlVersion) { + return new JSONObject(); + } + + public void testJsonConstructor() { + JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType()); + assertNotNull(Test.NOT_NULL, commandJson); + + try { + Hashtable hash = JsonRPCMarshaller.deserializeJSONObject(commandJson); + ReleaseInteriorVehicleDataModuleResponse cmd = new ReleaseInteriorVehicleDataModuleResponse(hash); + + JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType()); + assertNotNull(Test.NOT_NULL, body); + + assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName()); + assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID()); + } catch (JSONException e) { + fail(Test.JSON_FAIL); + } + } +} diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java index f1042302c0..50200b247d 100644 --- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java +++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java @@ -61,6 +61,7 @@ import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse; import com.smartdevicelink.proxy.rpc.GetDTCsResponse; import com.smartdevicelink.proxy.rpc.GetFileResponse; +import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse; import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse; import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse; import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse; @@ -95,6 +96,7 @@ import com.smartdevicelink.proxy.rpc.PutFileResponse; import com.smartdevicelink.proxy.rpc.ReadDIDResponse; import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse; +import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse; import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse; import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse; import com.smartdevicelink.proxy.rpc.SendHapticDataResponse; @@ -648,6 +650,16 @@ public void onOnAppServiceData(OnAppServiceData notification){ onRPCReceived(notification); } + @Override + public void onGetInteriorVehicleDataConsentResponse(GetInteriorVehicleDataConsentResponse response) { + onRPCReceived(response); + } + + @Override + public void onReleaseInteriorVehicleDataModuleResponse(ReleaseInteriorVehicleDataModuleResponse response) { + onRPCReceived(response); + } + @Override public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification){ onRPCReceived(notification); diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java index 3e3b471cd1..a3e798adea 100644 --- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java +++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java @@ -3779,7 +3779,37 @@ public void run() { } }); } else { - _proxyListener.onShowAppMenuResponse( msg); + _proxyListener.onShowAppMenuResponse(msg); + onRPCResponseReceived(msg); + } + } else if (functionName.equals(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString())) { + final GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(hash); + msg.format(rpcSpecVersion, true); + if (_callbackToUIThread) { + _mainUIHandler.post(new Runnable() { + @Override + public void run() { + _proxyListener.onGetInteriorVehicleDataConsentResponse(msg); + onRPCResponseReceived(msg); + } + }); + } else { + _proxyListener.onGetInteriorVehicleDataConsentResponse(msg); + onRPCResponseReceived(msg); + } + } else if (functionName.equals(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString())) { + final ReleaseInteriorVehicleDataModuleResponse msg = new ReleaseInteriorVehicleDataModuleResponse(hash); + msg.format(rpcSpecVersion, true); + if (_callbackToUIThread) { + _mainUIHandler.post(new Runnable() { + @Override + public void run() { + _proxyListener.onReleaseInteriorVehicleDataModuleResponse(msg); + onRPCResponseReceived(msg); + } + }); + } else { + _proxyListener.onReleaseInteriorVehicleDataModuleResponse(msg); onRPCResponseReceived(msg); } } else { @@ -3791,6 +3821,7 @@ public void run() { } } // end-if + } else if (messageType.equals(RPCMessage.KEY_NOTIFICATION)) { if (functionName.equals(FunctionID.ON_HMI_STATUS.toString())) { // OnHMIStatus diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java index 7bdcf43aee..a7c722ee28 100644 --- a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java +++ b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java @@ -105,6 +105,8 @@ public enum FunctionID{ SHOW_APP_MENU(59, "ShowAppMenu"), CREATE_WINDOW(60, "CreateWindow"), DELETE_WINDOW(61, "DeleteWindow"), + GET_INTERIOR_VEHICLE_DATA_CONSENT(62, "GetInteriorVehicleDataConsent"), + RELEASE_INTERIOR_VEHICLE_MODULE(63, "ReleaseInteriorVehicleDataModule"), // NOTIFICATIONS ON_HMI_STATUS(32768, "OnHMIStatus"), ON_APP_INTERFACE_UNREGISTERED(32769, "OnAppInterfaceUnregistered"), diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java index 4e97ebc014..dfa18ff521 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java +++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java @@ -55,6 +55,7 @@ import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse; import com.smartdevicelink.proxy.rpc.GetDTCsResponse; import com.smartdevicelink.proxy.rpc.GetFileResponse; +import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse; import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse; import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse; import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse; @@ -87,6 +88,7 @@ import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse; import com.smartdevicelink.proxy.rpc.PutFileResponse; import com.smartdevicelink.proxy.rpc.ReadDIDResponse; +import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse; import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse; import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse; import com.smartdevicelink.proxy.rpc.SendHapticDataResponse; @@ -421,6 +423,10 @@ public interface IProxyListenerBase { public void onOnAppServiceData(OnAppServiceData notification); + public void onGetInteriorVehicleDataConsentResponse(GetInteriorVehicleDataConsentResponse response); + + public void onReleaseInteriorVehicleDataModuleResponse(ReleaseInteriorVehicleDataModuleResponse response); + public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification); /** diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java index c8e2d6d033..4210c9c2b2 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java @@ -44,6 +44,7 @@ public class AudioControlCapabilities extends RPCStruct { public static final String KEY_VOLUME_AVAILABLE = "volumeAvailable"; public static final String KEY_EQUALIZER_AVAILABLE = "equalizerAvailable"; public static final String KEY_EQUALIZER_MAX_CHANNEL_ID = "equalizerMaxChannelId"; + public static final String KEY_MODULE_INFO = "moduleInfo"; /** * Constructs a newly allocated AudioControlCapabilities object @@ -178,4 +179,19 @@ public Integer getEqualizerMaxChannelId() { return getInteger(KEY_EQUALIZER_MAX_CHANNEL_ID); } + /** + * Sets ModuleInfo for this capability + * @param info the ModuleInfo to be set + */ + public void setModuleInfo(ModuleInfo info) { + setValue(KEY_MODULE_INFO, info); + } + + /** + * Gets a ModuleInfo of this capability + * @return module info of this capability + */ + public ModuleInfo getModuleInfo() { + return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO); + } } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java index b92d3ef16b..41dcb774d1 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java @@ -1,34 +1,34 @@ -/* - * 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. - */ +/* + * 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 android.support.annotation.NonNull; @@ -97,6 +97,7 @@ public class ButtonCapabilities extends RPCStruct { public static final String KEY_SHORT_PRESS_AVAILABLE = "shortPressAvailable"; public static final String KEY_LONG_PRESS_AVAILABLE = "longPressAvailable"; public static final String KEY_UP_DOWN_AVAILABLE = "upDownAvailable"; + public static final String KEY_MODULE_INFO = "moduleInfo"; /** * Constructs a newly allocated ButtonCapabilities object */ @@ -178,4 +179,20 @@ public Boolean getUpDownAvailable() { public void setUpDownAvailable( @NonNull Boolean upDownAvailable ) { setValue(KEY_UP_DOWN_AVAILABLE, upDownAvailable); } + + /** + * Sets ModuleInfo for this capability + * @param info the ModuleInfo to be set + */ + public void setModuleInfo(ModuleInfo info) { + setValue(KEY_MODULE_INFO, info); + } + + /** + * Gets a ModuleInfo of this capability + * @return module info of this capability + */ + public ModuleInfo getModuleInfo() { + return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO); + } } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java index 2272198be8..1872138c52 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java @@ -49,6 +49,7 @@ public class ButtonPress extends RPCRequest { public static final String KEY_MODULE_TYPE = "moduleType"; public static final String KEY_BUTTON_NAME = "buttonName"; public static final String KEY_BUTTON_PRESS_MODE = "buttonPressMode"; + public static final String KEY_MODULE_ID = "moduleId"; /** * Constructs a new ButtonPress object @@ -136,4 +137,20 @@ public ButtonPressMode getButtonPressMode() { public void setButtonPressMode(@NonNull ButtonPressMode buttonPressMode) { setParameters(KEY_BUTTON_PRESS_MODE, buttonPressMode); } + + /** + * Sets the module id for this object + * @param id the id to be set + */ + public void setModuleId(String id) { + setParameters(KEY_MODULE_ID, id); + } + + /** + * Gets the module id of this object + * @return the module id of this object + */ + public String getModuleId() { + return getString(KEY_MODULE_ID); + } } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java index 5a4a39c14f..8d229c30a7 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java @@ -61,6 +61,7 @@ public class ClimateControlCapabilities extends RPCStruct{ public static final String KEY_HEATED_WIND_SHIELD_AVAILABLE = "heatedWindshieldAvailable"; public static final String KEY_HEATED_REAR_WINDOW_AVAILABLE = "heatedRearWindowAvailable"; public static final String KEY_HEATED_MIRRORS_AVAILABLE = "heatedMirrorsAvailable"; + public static final String KEY_MODULE_INFO = "moduleInfo"; public static final String KEY_CLIMATE_ENABLE_AVAILABLE = "climateEnableAvailable"; public ClimateControlCapabilities() { @@ -405,6 +406,21 @@ public Boolean getHeatedMirrorsAvailable() { return getBoolean(KEY_HEATED_MIRRORS_AVAILABLE); } + /** + * Sets ModuleInfo for this capability + * @param info the ModuleInfo to be set + */ + public void setModuleInfo(ModuleInfo info) { + setValue(KEY_MODULE_INFO, info); + } + + /** + * Gets a ModuleInfo of this capability + * @return module info of this capability + */ + public ModuleInfo getModuleInfo() { + return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO); + } /** * Sets the climateEnableAvailable portion of the ClimateControlCapabilities class * diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java index fecf4463f7..a2999ae3bc 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java @@ -49,6 +49,7 @@ public class GetInteriorVehicleData extends RPCRequest { public static final String KEY_MODULE_TYPE = "moduleType"; public static final String KEY_SUBSCRIBE = "subscribe"; + public static final String KEY_MODULE_ID = "moduleId"; /** * Constructs a new GetInteriorVehicleData object @@ -118,4 +119,20 @@ public void setSubscribe(Boolean subscribe) { public Boolean getSubscribe() { return getBoolean(KEY_SUBSCRIBE); } + + /** + * Sets the Module ID for this class + * @param id the id to be set + */ + public void setModuleId(String id) { + setParameters(KEY_MODULE_ID, id); + } + + /** + * Gets the Module ID of this class + * @return the Module ID of this class + */ + public String getModuleId() { + return getString(KEY_MODULE_ID); + } } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java new file mode 100644 index 0000000000..459aeaf053 --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java @@ -0,0 +1,54 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCRequest; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; + +import java.util.Hashtable; +import java.util.List; + +public class GetInteriorVehicleDataConsent extends RPCRequest { + public static final String KEY_MODULE_TYPE = "moduleType"; + public static final String KEY_MODULE_ID = "moduleIds"; + + public GetInteriorVehicleDataConsent() { + super(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString()); + } + + public GetInteriorVehicleDataConsent(Hashtable hash) { + super(hash); + } + + /** + * Sets the Module Type for this class + * @param type the Module Type to be set + */ + public void setModuleType(ModuleType type) { + setParameters(KEY_MODULE_TYPE, type); + } + + /** + * Gets the Module Type of this class + * @return the Module Type of this class + */ + public ModuleType getModuleType() { + return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE); + } + + /** + * Sets the Module Ids for this class + * @param ids the ids to be set + */ + public void setModuleIds(List ids) { + setParameters(KEY_MODULE_ID, ids); + } + + /** + * Gets the Module Ids of this class + * @return the Module Ids + */ + @SuppressWarnings("unchecked") + public List getModuleIds() { + return (List) getObject(String.class, KEY_MODULE_ID); + } +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java new file mode 100644 index 0000000000..ee610aa1e0 --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java @@ -0,0 +1,46 @@ +package com.smartdevicelink.proxy.rpc; + +import android.support.annotation.NonNull; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCResponse; +import com.smartdevicelink.proxy.rpc.enums.Result; + +import java.util.Hashtable; +import java.util.List; + +public class GetInteriorVehicleDataConsentResponse extends RPCResponse { + + public static final String KEY_ALLOWED = "allowed"; + + public GetInteriorVehicleDataConsentResponse() { + super(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString()); + } + + public GetInteriorVehicleDataConsentResponse(Hashtable hash) { + super(hash); + } + + public GetInteriorVehicleDataConsentResponse(@NonNull Boolean success, @NonNull Result resultCode) { + this(); + setSuccess(success); + setResultCode(resultCode); + } + + /** + * Sets the list of allowances for this class + * @param allowances the allowances to be set + */ + public void setAllowances(List allowances) { + setParameters(KEY_ALLOWED, allowances); + } + + /** + * Gets the list of allowances of this class + * @return the list of allowances of this class + */ + @SuppressWarnings("unchecked") + public List getAllowances() { + return (List) getObject(Boolean.class, KEY_ALLOWED); + } +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java new file mode 100644 index 0000000000..80e8fac2c2 --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java @@ -0,0 +1,120 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; + +import java.util.Hashtable; + +/** + * Struct that describes a location (origin coordinates and span) of a vehicle component (Module) + */ + +public class Grid extends RPCStruct { + public static final String KEY_COLUMN = "col"; + public static final String KEY_ROW = "row"; + public static final String KEY_LEVEL = "level"; + public static final String KEY_COL_SPAN = "colspan"; + public static final String KEY_ROW_SPAN = "rowspan"; + public static final String KEY_LEVEL_SPAN = "levelspan"; + + public Grid() {} + + public Grid(Hashtable hash) { + super(hash); + } + + /** + * Sets the column of this Grid + * @param col the column to be set + */ + public void setColumn(Integer col) { + setValue(KEY_COLUMN, col); + } + + /** + * Get the column value of this Grid + * @return the column value + */ + public Integer getColumn() { + return getInteger(KEY_COLUMN); + } + + /** + * Sets the row's value of this Grid + * @param row the row to be set + */ + public void setRow(Integer row) { + setValue(KEY_ROW, row); + } + + /** + * Gets the row value of this Grid + * @return the row value + */ + public Integer getRow() { + return getInteger(KEY_ROW); + } + + /** + * Sets the level value of this Grid + * @param level the level to be set + */ + public void setLevel(Integer level) { + setValue(KEY_LEVEL, level); + } + + /** + * Gets the level value of this Grid + * @return the level + */ + public Integer getLevel() { + return getInteger(KEY_LEVEL); + } + + /** + * Sets the column span of this Grid + * @param span the span to be set + */ + public void setColumnSpan(Integer span) { + setValue(KEY_COL_SPAN, span); + } + + /** + * Gets the column span of this Grid + * @return the column span + */ + public Integer getColumnSpan() { + return getInteger(KEY_COL_SPAN); + } + + /** + * Sets the row span of this Grid + * @param span the span to be set + */ + public void setRowSpan(Integer span) { + setValue(KEY_ROW_SPAN, span); + } + + /** + * Gets the row span of this Grid + * @return the row span + */ + public Integer getRowSpan() { + return getInteger(KEY_ROW_SPAN); + } + + /** + * Sets the level span of this Grid + * @param span the span to be set + */ + public void setLevelSpan(Integer span) { + setValue(KEY_LEVEL_SPAN, span); + } + + /** + * Gets the level span of this Grid + * @return the level span + */ + public Integer getLevelSpan() { + return getInteger(KEY_LEVEL_SPAN); + } +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java index 80b030ad23..c9a7d690f9 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java @@ -42,6 +42,7 @@ public class HMISettingsControlCapabilities extends RPCStruct { public static final String KEY_DISTANCE_UNIT_AVAILABLE = "distanceUnitAvailable"; public static final String KEY_TEMPERATURE_UNIT_AVAILABLE = "temperatureUnitAvailable"; public static final String KEY_DISPLAY_MODE_UNIT_AVAILABLE = "displayModeUnitAvailable"; + public static final String KEY_MODULE_INFO = "moduleInfo"; /** * Constructs a new HMISettingsControlCapabilities object @@ -135,4 +136,20 @@ public void setDisplayModeUnitAvailable(Boolean displayModeUnitAvailable) { public Boolean getDisplayModeUnitAvailable() { return getBoolean(KEY_DISPLAY_MODE_UNIT_AVAILABLE); } + + /** + * Sets ModuleInfo for this capability + * @param info the ModuleInfo to be set + */ + public void setModuleInfo(ModuleInfo info) { + setValue(KEY_MODULE_INFO, info); + } + + /** + * Gets a ModuleInfo of this capability + * @return module info of this capability + */ + public ModuleInfo getModuleInfo() { + return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO); + } } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java index 2c1e634553..a3b66467cf 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java @@ -41,6 +41,7 @@ public class LightControlCapabilities extends RPCStruct { public static final String KEY_MODULE_NAME = "moduleName"; public static final String KEY_SUPPORTED_LIGHTS = "supportedLights"; + public static final String KEY_MODULE_INFO = "moduleInfo"; /** * Constructs a new LightControlCapabilities object @@ -106,4 +107,20 @@ public List getSupportedLights() { public void setSupportedLights(@NonNull List supportedLights) { setValue(KEY_SUPPORTED_LIGHTS, supportedLights); } + + /** + * Sets ModuleInfo for this capability + * @param info the ModuleInfo to be set + */ + public void setModuleInfo(ModuleInfo info) { + setValue(KEY_MODULE_INFO, info); + } + + /** + * Gets a ModuleInfo of this capability + * @return module info of this capability + */ + public ModuleInfo getModuleInfo() { + return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO); + } } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java index 8f11dc5560..26cf08684b 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java @@ -46,6 +46,7 @@ public class ModuleData extends RPCStruct { public static final String KEY_AUDIO_CONTROL_DATA = "audioControlData"; public static final String KEY_LIGHT_CONTROL_DATA = "lightControlData"; public static final String KEY_HMI_SETTINGS_CONTROL_DATA = "hmiSettingsControlData"; + public static final String KEY_MODULE_ID = "moduleId"; public ModuleData() { } @@ -186,4 +187,20 @@ public void setHmiSettingsControlData(HMISettingsControlData hmiSettingsControlD public HMISettingsControlData getHmiSettingsControlData() { return (HMISettingsControlData) getObject(HMISettingsControlData.class, KEY_HMI_SETTINGS_CONTROL_DATA); } + + /** + * Sets the Module ID of the ModuleData class + * @param id the id to be set + */ + public void setModuleId(String id) { + setValue(KEY_MODULE_ID, id); + } + + /** + * Gets the Module ID of the ModuleData class + * @return the Module ID + */ + public String getModuleId() { + return getString(KEY_MODULE_ID); + } } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java new file mode 100644 index 0000000000..eef2fb5f0f --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java @@ -0,0 +1,85 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; + +import java.util.Hashtable; + +/** + * Struct that describes a module within different SystemCapabilities + */ +public class ModuleInfo extends RPCStruct { + public static final String KEY_MODULE_ID = "moduleId"; + public static final String KEY_MODULE_LOCATION = "location"; + public static final String KEY_MODULE_SERVICE_AREA = "serviceArea"; + public static final String KEY_MULTIPLE_ACCESS_ALLOWED = "allowMultipleAccess"; + + public ModuleInfo(){} + + public ModuleInfo(Hashtable hash) { + super(hash); + } + + /** + * Sets the Module ID for this Module + * @param id the id to be set + */ + public void setModuleId(String id) { + setValue(KEY_MODULE_ID, id); + } + + /** + * Gets the Module ID for this module + * @return the Module ID as a String + */ + public String getModuleId() { + return getString(KEY_MODULE_ID); + } + + /** + * Sets the location of this Module + * @param location the location to be set + */ + public void setModuleLocation(Grid location) { + setValue(KEY_MODULE_LOCATION, location); + } + + /** + * Gets the location of this Module + * @return the location of this Module + */ + public Grid getModuleLocation() { + return (Grid) getObject(Grid.class, KEY_MODULE_LOCATION); + } + + /** + * Sets the service area of this Module + * @param serviceArea the service area of this Module + */ + public void setModuleServiceArea(Grid serviceArea) { + setValue(KEY_MODULE_SERVICE_AREA, serviceArea); + } + + /** + * Gets the service area of this Module + * @return the service area of this Module + */ + public Grid getModuleServiceArea() { + return (Grid) getObject(Grid.class, KEY_MODULE_SERVICE_AREA); + } + + /** + * Sets the multiple access allowance for this Module + * @param isMultipleAccess the access to be set + */ + public void setMultipleAccessAllowance(Boolean isMultipleAccess) { + setValue(KEY_MULTIPLE_ACCESS_ALLOWED, isMultipleAccess); + } + + /** + * Gets the multiple allowance access of this Module + * @return the multiple access allowance of this Module + */ + public Boolean getMultipleAccessAllowance() { + return getBoolean(KEY_MULTIPLE_ACCESS_ALLOWED); + } +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java index e729c2934e..22d1d892e5 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java @@ -54,6 +54,7 @@ public class RadioControlCapabilities extends RPCStruct{ public static final String KEY_HD_RADIO_ENABLE_AVAILABLE = "hdRadioEnableAvailable"; public static final String KEY_SIRIUS_XM_RADIO_AVAILABLE = "siriusxmRadioAvailable"; public static final String KEY_SIS_DATA_AVAILABLE = "sisDataAvailable"; + public static final String KEY_MODULE_INFO = "moduleInfo"; public static final String KEY_AVAILABLE_HD_CHANNELS_AVAILABLE = "availableHdChannelsAvailable"; public RadioControlCapabilities() { @@ -364,4 +365,20 @@ public void setSisDataAvailable(Boolean sisDataAvailable) { public Boolean getSisDataAvailable() { return getBoolean(KEY_SIS_DATA_AVAILABLE); } + + /** + * Sets ModuleInfo for this capability + * @param info the ModuleInfo to be set + */ + public void setModuleInfo(ModuleInfo info) { + setValue(KEY_MODULE_INFO, info); + } + + /** + * Gets a ModuleInfo of this capability + * @return module info of this capability + */ + public ModuleInfo getModuleInfo() { + return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO); + } } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java new file mode 100644 index 0000000000..81bee25512 --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java @@ -0,0 +1,52 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCRequest; +import com.smartdevicelink.proxy.rpc.enums.ModuleType; + +import java.util.Hashtable; + +public class ReleaseInteriorVehicleDataModule extends RPCRequest { + public static final String KEY_MODULE_TYPE = "moduleType"; + public static final String KEY_MODULE_ID = "moduleId"; + + public ReleaseInteriorVehicleDataModule() { + super(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString()); + } + + public ReleaseInteriorVehicleDataModule(Hashtable hash) { + super(hash); + } + + /** + * Sets the Module Type for this class + * @param type the Module Type to be set + */ + public void setModuleType(ModuleType type) { + setParameters(KEY_MODULE_TYPE, type); + } + + /** + * Gets the Module Type of this class + * @return the Module Type of this class + */ + public ModuleType getModuleType() { + return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE); + } + + /** + * Sets the Module Ids for this class + * @param id the ids to be set + */ + public void setModuleId(String id) { + setParameters(KEY_MODULE_ID, id); + } + + /** + * Gets the Module Id of this class + * @return the Module Ids + */ + public String getModuleId() { + return getString(KEY_MODULE_ID); + } +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java new file mode 100644 index 0000000000..61d8df98a2 --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java @@ -0,0 +1,26 @@ +package com.smartdevicelink.proxy.rpc; + +import android.support.annotation.NonNull; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCResponse; +import com.smartdevicelink.proxy.rpc.enums.Result; + +import java.util.Hashtable; + +public class ReleaseInteriorVehicleDataModuleResponse extends RPCResponse { + + public ReleaseInteriorVehicleDataModuleResponse() { + super(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString()); + } + + public ReleaseInteriorVehicleDataModuleResponse(Hashtable hash) { + super(hash); + } + + public ReleaseInteriorVehicleDataModuleResponse(@NonNull Boolean success, @NonNull Result resultCode) { + this(); + setSuccess(success); + setResultCode(resultCode); + } +} \ No newline at end of file diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java index 3c875d0d1c..d56a321a2b 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java @@ -54,6 +54,7 @@ public class SeatControlCapabilities extends RPCStruct { public static final String KEY_MASSAGE_MODE_AVAILABLE = "massageModeAvailable"; public static final String KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE = "massageCushionFirmnessAvailable"; public static final String KEY_MEMORY_AVAILABLE = "memoryAvailable"; + public static final String KEY_MODULE_INFO = "moduleInfo"; /** * Constructs a new SeatControlCapabilities object @@ -367,4 +368,20 @@ public void setMemoryAvailable(Boolean memoryAvailable) { public Boolean getMemoryAvailable() { return getBoolean(KEY_MEMORY_AVAILABLE); } + + /** + * Sets ModuleInfo for this capability + * @param info the ModuleInfo to be set + */ + public void setModuleInfo(ModuleInfo info) { + setValue(KEY_MODULE_INFO, info); + } + + /** + * Gets a ModuleInfo of this capability + * @return module info of this capability + */ + public ModuleInfo getModuleInfo() { + return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO); + } } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java new file mode 100644 index 0000000000..a4b33d1bd0 --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java @@ -0,0 +1,32 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; + +import java.util.Hashtable; + +public class SeatLocation extends RPCStruct { + public static final String KEY_GRID = "grid"; + + public SeatLocation(){} + + public SeatLocation(Hashtable hash) { + super(hash); + } + + /** + * Sets grid data for this seat location + * @param grid the grid to be set + */ + public void setGrid(Grid grid) { + setValue(KEY_GRID, grid); + } + + /** + * Gets the Grid of this seat location + * @return the grid of this seat location + */ + public Grid getGrid() { + return (Grid) getObject(Grid.class, KEY_GRID); + } + +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java new file mode 100644 index 0000000000..3fc34bada4 --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java @@ -0,0 +1,85 @@ +package com.smartdevicelink.proxy.rpc; + + +import com.smartdevicelink.proxy.RPCStruct; + +import java.util.Hashtable; +import java.util.List; + +public class SeatLocationCapability extends RPCStruct { + public static final String KEY_ROWS = "rows"; + public static final String KEY_COLS = "columns"; + public static final String KEY_LEVELS = "levels"; + public static final String KEY_SEATS = "seats"; + + public SeatLocationCapability(){} + + public SeatLocationCapability(Hashtable hash) { + super(hash); + } + + /** + * Sets the seat rows for this capability + * @param rows rows to be set + */ + public void setRows(Integer rows) { + setValue(KEY_ROWS, rows); + } + + /** + * Gets the seat rows of this capability + * @return the seat rows + */ + public Integer getRows() { + return getInteger(KEY_ROWS); + } + + /** + * Sets the seat columns for this capability + * @param cols the seat columns to be set + */ + public void setCols(Integer cols) { + setValue(KEY_COLS, cols); + } + + /** + * Gets the seat columns of this capability + * @return the seat columns + */ + public Integer getCols() { + return getInteger(KEY_COLS); + } + + /** + * Sets the levels for this capability + * @param levels the levels to be set + */ + public void setLevels(Integer levels) { + setValue(KEY_LEVELS, levels); + } + + /** + * Gets the seat levels of this capability + * @return the seat levels + */ + public Integer getLevels() { + return getInteger(KEY_LEVELS); + } + + /** + * Sets the seat locations for this capability + * @param locations the locations to be set + */ + public void setSeats(List locations) { + setValue(KEY_SEATS, locations); + } + + /** + * Gets the seat locations of this capability + * @return the seat locations + */ + @SuppressWarnings("unchecked") + public List getSeatLocations() { + return (List) getObject(SeatLocation.class, KEY_SEATS); + } +} diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java index d3cf343105..82e7738ee5 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java @@ -153,6 +153,7 @@ public class SetGlobalProperties extends RPCRequest { public static final String KEY_HELP_PROMPT = "helpPrompt"; public static final String KEY_TIMEOUT_PROMPT = "timeoutPrompt"; public static final String KEY_VR_HELP = "vrHelp"; + public static final String KEY_USER_LOCATION = "userLocation"; public static final String KEY_MENU_LAYOUT = "menuLayout"; /** * Constructs a new SetGlobalProperties object @@ -312,6 +313,22 @@ public void setKeyboardProperties(KeyboardProperties keyboardProperties) { setParameters(KEY_KEYBOARD_PROPERTIES, keyboardProperties); } + /** + * Sets the user seat location + * @param location the location to be set + */ + public void setUserLocation(SeatLocation location) { + setParameters(KEY_USER_LOCATION, location); + } + + /** + * Gets the user seat location + * @return the user seat location + */ + public SeatLocation getUserLocation() { + return (SeatLocation) getObject(SeatLocation.class, KEY_USER_LOCATION); + } + @SuppressWarnings("unchecked") public KeyboardProperties getKeyboardProperties() { return (KeyboardProperties) getObject(KeyboardProperties.class, KEY_KEYBOARD_PROPERTIES); diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java index 76a2414b66..2ea1867422 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java @@ -50,8 +50,8 @@ public class SystemCapability extends RPCStruct { public static final String KEY_VIDEO_STREAMING_CAPABILITY = "videoStreamingCapability"; public static final String KEY_REMOTE_CONTROL_CAPABILITY = "remoteControlCapability"; public static final String KEY_APP_SERVICES_CAPABILITIES = "appServicesCapabilities"; + public static final String KEY_SEAT_LOCATION_CAPABILITY = "seatLocationCapability"; public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities"; - public SystemCapability(){} public SystemCapability(Hashtable hash) { @@ -94,8 +94,10 @@ public Object getCapabilityForType(SystemCapabilityType type) { }else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){ return getObject(RemoteControlCapabilities.class, KEY_REMOTE_CONTROL_CAPABILITY); }else if(type.equals(SystemCapabilityType.APP_SERVICES)){ - return getObject(AppServicesCapabilities.class, KEY_APP_SERVICES_CAPABILITIES); - }else if(type.equals(SystemCapabilityType.DISPLAYS)){ + return (RPCStruct) getObject(AppServicesCapabilities.class, KEY_APP_SERVICES_CAPABILITIES); + }else if(type.equals(SystemCapabilityType.SEAT_LOCATION)){ + return (RPCStruct) getObject(SeatLocationCapability.class, KEY_SEAT_LOCATION_CAPABILITY); + }else if(type.equals(SystemCapabilityType.DISPLAYS)){ return getObject(DisplayCapability.class, KEY_DISPLAY_CAPABILITIES); }else{ return null; @@ -113,12 +115,14 @@ public void setCapabilityForType(SystemCapabilityType type, Object capability){ setValue(KEY_VIDEO_STREAMING_CAPABILITY, capability); }else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){ setValue(KEY_REMOTE_CONTROL_CAPABILITY, capability); - }else if(type.equals(SystemCapabilityType.APP_SERVICES)) { - setValue(KEY_APP_SERVICES_CAPABILITIES, capability); - }else if(type.equals(SystemCapabilityType.DISPLAYS)){ + }else if(type.equals(SystemCapabilityType.APP_SERVICES)){ + setValue(KEY_APP_SERVICES_CAPABILITIES, capability); + }else if(type.equals(SystemCapabilityType.SEAT_LOCATION)){ + setValue(KEY_SEAT_LOCATION_CAPABILITY, capability); + }else if(type.equals(SystemCapabilityType.DISPLAYS)) { setValue(KEY_DISPLAY_CAPABILITIES, capability); }else{ - return; + return; } } diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java index d6a0a63aa0..0990ef5ad7 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java @@ -1,34 +1,34 @@ -/* - * 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. - */ +/* + * 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.enums; /** @@ -68,7 +68,12 @@ public enum GlobalProperty{ * The on-screen keyboard configuration of setGlobalProperties */ - KEYBOARDPROPERTIES; + KEYBOARDPROPERTIES, + + /** + * The user seat location of setGlobalProperties + */ + USERLOCATION; /** * Convert String to GlobalProperty diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java index 900578400e..cdd8b01a54 100644 --- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java +++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java @@ -148,6 +148,13 @@ * N * Available Asynchronously, Call is synchronous after initial call * + * + * SEAT_LOCATION + * SeatLocationCapability + * Returns SEAT_LOCATION + * N + * Available Asynchronously, Call is synchronous after initial call + * * * */ @@ -520,6 +527,27 @@ public enum SystemCapabilityType { */ APP_SERVICES (true), + /** + * Available Synchronously after Register App Interface response
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Enum NameReturn TypeDescriptionRequires Async?Notes
SEAT_LOCATIONSeatLocationCapabilityReturns SEAT_LOCATIONNAvailable Asynchronously, Call is synchronous after initial call
+ */ + SEAT_LOCATION (true), + ; boolean IS_QUERYABLE;