diff options
author | Austin Kirk <askirk@umich.edu> | 2017-06-19 11:10:19 -0400 |
---|---|---|
committer | Austin Kirk <askirk@umich.edu> | 2017-06-19 11:10:19 -0400 |
commit | 62ee24f3eb85f3fe73b9147bb71c47d77eca58cf (patch) | |
tree | 4a30d9d5c28f1a914eeea2a29e0fc0514d3f773b | |
parent | 97c3b2a804427196663452b1d140e7594f6fdb77 (diff) | |
download | sdl_android-62ee24f3eb85f3fe73b9147bb71c47d77eca58cf.tar.gz |
Deprecating use of DisplayType parameter in DisplayCapabilities
-Deprecating previous get/setDisplayType
-Adding new get/setDisplayName, returning/setting a String
-Testing for new methods
3 files changed, 34 insertions, 2 deletions
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java index 01cc2d6a6..fc802aee3 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java @@ -404,6 +404,7 @@ public class Test { GENERAL_DIDRESULT_LIST.add(GENERAL_DIDRESULT); GENERAL_DISPLAYCAPABILITIES.setDisplayType(GENERAL_DISPLAYTYPE); + GENERAL_DISPLAYCAPABILITIES.setDisplayName(GENERAL_STRING); GENERAL_DISPLAYCAPABILITIES.setGraphicSupported(GENERAL_BOOLEAN); GENERAL_DISPLAYCAPABILITIES.setImageFields(GENERAL_IMAGEFIELD_LIST); GENERAL_DISPLAYCAPABILITIES.setMediaClockFormats(GENERAL_MEDIACLOCKFORMAT_LIST); diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java index 689c3948f..82fe5bc59 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java @@ -36,6 +36,7 @@ public class DisplayCapabilitiesTests extends TestCase{ msg.setGraphicSupported(Test.GENERAL_BOOLEAN); msg.setNumCustomPresetsAvailable(Test.GENERAL_INT); msg.setDisplayType(Test.GENERAL_DISPLAYTYPE); + msg.setDisplayName(Test.GENERAL_STRING); msg.setImageFields(Test.GENERAL_IMAGEFIELD_LIST); msg.setTextFields(Test.GENERAL_TEXTFIELD_LIST); msg.setMediaClockFormats(Test.GENERAL_MEDIACLOCKFORMAT_LIST); @@ -51,6 +52,7 @@ public class DisplayCapabilitiesTests extends TestCase{ boolean graphicSupported = msg.getGraphicSupported(); int numPresets = msg.getNumCustomPresetsAvailable(); DisplayType displayType = msg.getDisplayType(); + String displayName = msg.getDisplayName(); ScreenParams screenParams = msg.getScreenParams(); List<String> templatesAvailable = msg.getTemplatesAvailable(); List<MediaClockFormat> mediaClock = msg.getMediaClockFormats(); @@ -61,6 +63,7 @@ public class DisplayCapabilitiesTests extends TestCase{ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, graphicSupported); assertEquals(Test.MATCH, Test.GENERAL_INT, numPresets); assertEquals(Test.MATCH, Test.GENERAL_DISPLAYTYPE, displayType); + assertEquals(Test.MATCH, Test.GENERAL_STRING, displayName); assertTrue(Test.TRUE, Validator.validateScreenParams(Test.GENERAL_SCREENPARAMS, screenParams)); assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), templatesAvailable.size()); assertEquals(Test.MATCH, Test.GENERAL_MEDIACLOCKFORMAT_LIST.size(), mediaClock.size()); @@ -88,6 +91,7 @@ public class DisplayCapabilitiesTests extends TestCase{ assertNotNull(Test.NOT_NULL, msg); assertNull(Test.NULL, msg.getDisplayType()); + assertNull(Test.NULL, msg.getDisplayName()); assertNull(Test.NULL, msg.getGraphicSupported()); assertNull(Test.NULL, msg.getImageFields()); assertNull(Test.NULL, msg.getMediaClockFormats()); diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java index 69928a128..a96b15cde 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java @@ -9,6 +9,9 @@ import com.smartdevicelink.util.DebugTool; import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+
+import static com.smartdevicelink.proxy.constants.Names.displayType;
+
/**
* Contains information about the display for the SDL system to which the application is currently connected.
* <p><b> Parameter List</b></p>
@@ -20,12 +23,20 @@ import java.util.List; * <th>SmartDeviceLink Ver. Available</th>
* </tr>
* <tr>
+ * @Deprecated
* <td>displayType</td>
* <td>DisplayType</td>
* <td>The type of display
* </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
+ * <tr>
+ * <td>displayName</td>
+ * <td>String</td>
+ * <td>The name of the display
+ * </td>
+ * <td>SmartDeviceLink 4.4</td>
+ * </tr>
* <tr>
* <td>textField</td>
* <td>TextField[]</td>
@@ -56,6 +67,7 @@ import java.util.List; */
public class DisplayCapabilities extends RPCStruct {
public static final String KEY_DISPLAY_TYPE = "displayType";
+ public static final String KEY_DISPLAY_NAME = "displayName";
public static final String KEY_MEDIA_CLOCK_FORMATS = "mediaClockFormats";
public static final String KEY_TEXT_FIELDS = "textFields";
public static final String KEY_IMAGE_FIELDS = "imageFields";
@@ -77,17 +89,32 @@ public class DisplayCapabilities extends RPCStruct { /**
* Get the type of display
* @return the type of display
- */
+ */
+ @Deprecated
public DisplayType getDisplayType() {
return (DisplayType) getObject(DisplayType.class, KEY_DISPLAY_TYPE);
}
/**
* Set the type of display
* @param displayType the display type
- */
+ */
+ @Deprecated
public void setDisplayType( DisplayType displayType ) {
setValue(KEY_DISPLAY_TYPE, displayType);
}
+ /** Get the name of the display
+ * @return the name of the display
+ */
+ public String getDisplayName() {
+ return getString(KEY_DISPLAY_NAME);
+ }
+ /**
+ * Set the name of the display
+ * @param displayName the name of the display
+ */
+ public void setDisplayName( String displayName ) {
+ setValue(KEY_DISPLAY_NAME, displayName);
+ }
/**
*Get an array of TextField structures, each of which describes a field in the HMI which the application can write to using operations such as <i>{@linkplain Show}</i>, <i>{@linkplain SetMediaClockTimer}</i>, etc.
* This array of TextField structures identify all the text fields to which the application can write on the current display (identified by DisplayType ).
|