summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett W <geekman3454@protonmail.com>2017-09-20 16:47:27 -0400
committerBrett W <geekman3454@protonmail.com>2017-09-20 16:47:27 -0400
commitf150c46dbb11e09201ac1f73348c04919f6a22c8 (patch)
treef8f1480df9965f97b689f3d1568d22103efaabbf
parent2a030b3b169e907934943da83161ac50f500ebc8 (diff)
parent9ac4f3d44de96a47aafcd2f563ae860834b2c05a (diff)
downloadsdl_android-f150c46dbb11e09201ac1f73348c04919f6a22c8.tar.gz
Merge branch 'develop' into feature/issue_566
# Conflicts: # sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
-rw-r--r--sdl_android/src/androidTest/assets/json/SendHapticData.json22
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java2
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java40
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java28
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java80
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java48
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java6
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java73
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java110
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java79
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java7
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java114
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java86
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java35
-rw-r--r--sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java2
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java1
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java5
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java5
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java4
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java21
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java3
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java82
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java116
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java109
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java86
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java54
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Show.java26
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java2
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java9
-rw-r--r--sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java96
30 files changed, 1289 insertions, 62 deletions
diff --git a/sdl_android/src/androidTest/assets/json/SendHapticData.json b/sdl_android/src/androidTest/assets/json/SendHapticData.json
new file mode 100644
index 000000000..42b863aae
--- /dev/null
+++ b/sdl_android/src/androidTest/assets/json/SendHapticData.json
@@ -0,0 +1,22 @@
+{
+ "request":{
+ "name":"SendHapticData",
+ "correlationID":1234,
+ "parameters":{
+ "hapticRectData":[
+ {"id":123,
+ "rect":{
+ "height":1,
+ "width":1,
+ "x":1,
+ "y":1
+ }
+ }
+ ]
+ }
+ },
+ "response":{
+ "name":"SendHapticData",
+ "correlationID":1234
+ }
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
index 9670492b0..c30f26a7f 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/BaseRpcTests.java
@@ -168,7 +168,7 @@ public abstract class BaseRpcTests extends AndroidTestCase {
Integer correlationId;
if (msg instanceof RPCRequest) {
correlationId = ((RPCRequest) msg).getCorrelationID();
- assertNull("Correlation ID of the RPC message was not null.", correlationId);
+ assertNotNull("Correlation ID of the RPC message was null.", correlationId);
//assertEquals("Correlation ID didn't match expected correlation ID.", CORR_ID, (int) correlationId);
}
else if (msg instanceof RPCResponse) {
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 f8af3ca9e..26169a136 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
@@ -12,16 +12,19 @@ import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
+import com.smartdevicelink.proxy.rpc.HapticRect;
import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.ImageField;
import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.LocationDetails;
import com.smartdevicelink.proxy.rpc.MenuParams;
+import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
+import com.smartdevicelink.proxy.rpc.Rectangle;
import com.smartdevicelink.proxy.rpc.ScreenParams;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SoftButton;
@@ -88,6 +91,7 @@ import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TBTState;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.TouchType;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
@@ -122,9 +126,10 @@ public class Test {
// RPC Request/Response/Notification/Datatype Test Values
public static final int GENERAL_INT = 100;
+ public static final Integer GENERAL_INTEGER = 100;
public static final Long GENERAL_LONG = 100L;
public static final Turn GENERAL_TURN = new Turn();
- public static final float GENERAL_FLOAT = 100f;
+ public static final Float GENERAL_FLOAT = 100f;
public static final Image GENERAL_IMAGE = new Image();
public static final Choice GENERAL_CHOICE = new Choice();
public static final String GENERAL_STRING = "test";
@@ -215,8 +220,14 @@ public class Test {
public static final VideoStreamingCodec GENERAL_VIDEOSTREAMINGCODEC = VideoStreamingCodec.H264;
public static final VideoStreamingCapability GENERAL_VIDEOSTREAMINGCAPABILITY = new VideoStreamingCapability();
public static final VideoStreamingFormat GENERAL_VIDEOSTREAMINGFORMAT = new VideoStreamingFormat();
+<<<<<<< HEAD
public static final HMICapabilities GENERAL_HMICAPABILITIES = new HMICapabilities();
+=======
+ public static final MetadataTags GENERAL_METADATASTRUCT = new MetadataTags();
+ public static final Rectangle GENERAL_RECTANGLE = new Rectangle();
+ public static final HapticRect GENERAL_HAPTIC_RECT = new HapticRect();
+>>>>>>> develop
public static final List<Long> GENERAL_LONG_LIST = Arrays.asList(new Long[]{ 1L, 2L });
public static final List<Turn> GENERAL_TURN_LIST = new ArrayList<Turn>();
public static final List<Choice> GENERAL_CHOICE_LIST = new ArrayList<Choice>();
@@ -261,6 +272,7 @@ public class Test {
public static final JSONArray JSON_BUTTONCAPABILITIES = new JSONArray();
public static final JSONArray JSON_SOFTBUTTONCAPABILITIES = new JSONArray();
public static final JSONArray JSON_AUDIOPASSTHRUCAPABILITIES = new JSONArray();
+ public static final JSONArray JSON_TEXTFIELDTYPES = new JSONArray();
public static final JSONObject JSON_TURN = new JSONObject();
public static final JSONObject JSON_IMAGE = new JSONObject();
@@ -485,11 +497,31 @@ public class Test {
GENERAL_VIDEOSTREAMINGCAPABILITY.setPreferredResolution(GENERAL_IMAGERESOLUTION);
GENERAL_VIDEOSTREAMINGCAPABILITY.setSupportedFormats(GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+<<<<<<< HEAD
GENERAL_HMICAPABILITIES.setNavigationAvilable(GENERAL_BOOLEAN);
GENERAL_HMICAPABILITIES.setVideoStreamingAvailable(GENERAL_BOOLEAN);
GENERAL_HMICAPABILITIES.setPhoneCallAvilable(GENERAL_BOOLEAN);
+=======
+ List<MetadataType> exampleList = new ArrayList<>();
+ exampleList.add(0, MetadataType.CURRENT_TEMPERATURE);
+ exampleList.add(1, MetadataType.MEDIA_ALBUM);
+ exampleList.add(2, MetadataType.MEDIA_ARTIST);
+
+ GENERAL_METADATASTRUCT.setMainField1(exampleList);
+ GENERAL_METADATASTRUCT.setMainField2(exampleList);
+ GENERAL_METADATASTRUCT.setMainField3(exampleList);
+ GENERAL_METADATASTRUCT.setMainField4(exampleList);
+
+ GENERAL_RECTANGLE.setX(GENERAL_FLOAT);
+ GENERAL_RECTANGLE.setY(GENERAL_FLOAT);
+ GENERAL_RECTANGLE.setWidth(GENERAL_FLOAT);
+ GENERAL_RECTANGLE.setHeight(GENERAL_FLOAT);
+
+ GENERAL_HAPTIC_RECT.setId(GENERAL_INTEGER);
+ GENERAL_HAPTIC_RECT.setRect(GENERAL_RECTANGLE);
+>>>>>>> develop
- try {
+ try {
JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_ALLOWED, GENERAL_HMILEVEL_LIST);
JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_USER_DISALLOWED, GENERAL_HMILEVEL_LIST);
@@ -640,6 +672,10 @@ public class Test {
JSON_TOUCHEVENT.put(TouchEvent.KEY_ID, GENERAL_INT);
JSON_TOUCHEVENT.put(TouchEvent.KEY_TS, JsonUtils.createJsonArray(GENERAL_LONG_LIST));
JSON_TOUCHEVENTS.put(JSON_TOUCHEVENT);
+
+ JSON_TEXTFIELDTYPES.put(MetadataType.CURRENT_TEMPERATURE);
+ JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ALBUM);
+ JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ARTIST);
} catch (JSONException e) {
Log.e("Test", "Static Json Construction Failed.", e);
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
index a817ec0a8..090dce405 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
@@ -36,6 +36,7 @@ import com.smartdevicelink.proxy.rpc.OasisAddress;
import com.smartdevicelink.proxy.rpc.ParameterPermissions;
import com.smartdevicelink.proxy.rpc.PermissionItem;
import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
+import com.smartdevicelink.proxy.rpc.Rectangle;
import com.smartdevicelink.proxy.rpc.ScreenParams;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
@@ -324,6 +325,33 @@ public class Validator{
return true;
}
+ public static boolean validateRectangle(Rectangle c1, Rectangle c2){
+ if(c1 == null){
+ return ( c2 == null );
+ }
+ if(c2 == null){
+ return ( c1 == null );
+ }
+
+ if(c1.getX() != c2.getX()){
+ return false;
+ }
+
+ if(c1.getY() != c2.getY()){
+ return false;
+ }
+
+ if(c1.getWidth() != c2.getWidth()){
+ return false;
+ }
+
+ if(c1.getHeight() != c2.getHeight()){
+ return false;
+ }
+
+ return true;
+ }
+
public static boolean validateOasisAddress(OasisAddress a1, OasisAddress a2){
if(a1 == null){
return ( a2 == null );
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
index b334058ea..e31aedbe7 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
@@ -80,7 +80,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testInt, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequest(testData, null);
- assertNull(Test.NULL, testBSR.getCorrelationID());
+ assertNotNull(Test.NULL, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequest(null, testInt);
assertNull(Test.NULL, testBSR);
@@ -95,7 +95,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testInt, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequestLegacy(testVData, null);
- assertNull(Test.NULL, testBSR.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBSR.getCorrelationID());
testBSR = RPCRequestFactory.buildSystemRequestLegacy(null, testInt);
assertNull(Test.NULL, testBSR);
@@ -145,7 +145,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testBAC.getMenuParams());
assertNull(Test.NULL, testBAC.getVrCommands());
assertNull(Test.NULL, testBAC.getCmdIcon());
- assertNull(Test.NULL, testBAC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, String menuText, Integer parentID, Integer position, Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
testIconValue = "icon";
@@ -167,7 +167,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testBAC.getMenuParams());
assertNull(Test.NULL, testBAC.getVrCommands());
assertNull(Test.NULL, testBAC.getCmdIcon());
- assertNull(Test.NULL, testBAC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, String menuText, Integer parentID, Integer position, Vector<String> vrCommands, Integer correlationID)
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testParentID, testPosition, testVrCommands, testCorrelationID);
@@ -182,7 +182,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testBAC.getCmdID());
assertNull(Test.NULL, testBAC.getMenuParams());
assertNull(Test.NULL, testBAC.getVrCommands());
- assertNull(Test.NULL, testBAC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, String menuText, Vector<String> vrCommands, Integer correlationID)
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testVrCommands, testCorrelationID);
@@ -195,7 +195,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testBAC.getCmdID());
assertNull(Test.NULL, testBAC.getMenuParams());
assertNull(Test.NULL, testBAC.getVrCommands());
- assertNull(Test.NULL, testBAC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
// Test -- buildAddCommand(Integer commandID, Vector<String> vrCommands, Integer correlationID)
testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testVrCommands, testCorrelationID);
@@ -206,7 +206,7 @@ public class RPCRequestFactoryTests extends TestCase {
testBAC = RPCRequestFactory.buildAddCommand(null, null, null);
assertNull(Test.NULL, testBAC.getCmdID());
assertNull(Test.NULL, testBAC.getVrCommands());
- assertNull(Test.NULL, testBAC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBAC.getCorrelationID());
}
public void testBuildAddSubMenu () {
@@ -232,7 +232,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testBASM.getMenuID());
assertNull(Test.NULL, testBASM.getMenuName());
assertNull(Test.NULL, testBASM.getPosition());
- assertNull(Test.NULL, testBASM.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBASM.getCorrelationID());
}
public void testBuildAlert () {
@@ -294,7 +294,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testAlert.getPlayTone());
assertNull(Test.NULL, testAlert.getDuration());
assertNull(Test.NULL, testAlert.getSoftButtons());
- assertNull(Test.NULL, testAlert.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testAlert.getCorrelationID());
// Test -- buildAlert(String ttsText, Boolean playTone, Integer correlationID)
// ^ Calls another build method.
@@ -323,7 +323,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testAlert.getAlertText2());
assertNull(Test.NULL, testAlert.getPlayTone());
assertNull(Test.NULL, testAlert.getDuration());
- assertNull(Test.NULL, testAlert.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testAlert.getCorrelationID());
}
public void testBuildCreateInteractionChoiceSet () {
@@ -346,7 +346,7 @@ public class RPCRequestFactoryTests extends TestCase {
testBCICS = RPCRequestFactory.buildCreateInteractionChoiceSet(null, null, null);
assertNull(Test.NULL, testBCICS.getChoiceSet());
assertNull(Test.NULL, testBCICS.getInteractionChoiceSetID());
- assertNull(Test.NULL, testBCICS.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testBCICS.getCorrelationID());
}
public void testBuildDeleteCommand () {
@@ -363,7 +363,7 @@ public class RPCRequestFactoryTests extends TestCase {
testDC = RPCRequestFactory.buildDeleteCommand(null, null);
assertNull(Test.NULL, testDC.getCmdID());
- assertNull(Test.NULL, testDC.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testDC.getCorrelationID());
}
@@ -381,7 +381,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testFileName, testDF.getSdlFileName());
testDF = RPCRequestFactory.buildDeleteFile(null, null);
- assertNull(Test.NULL, testDF.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testDF.getCorrelationID());
assertNull(Test.NULL, testDF.getSdlFileName());
}
@@ -400,7 +400,7 @@ public class RPCRequestFactoryTests extends TestCase {
testDICS = RPCRequestFactory.buildDeleteInteractionChoiceSet(null, null);
assertNull(Test.NULL, testDICS.getInteractionChoiceSetID());
- assertNull(Test.NULL, testDICS.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testDICS.getCorrelationID());
}
public void testBuildDeleteSubMenu () {
@@ -417,7 +417,7 @@ public class RPCRequestFactoryTests extends TestCase {
testDSM = RPCRequestFactory.buildDeleteSubMenu(null, null);
assertNull(Test.NULL, testDSM.getMenuID());
- assertNull(Test.NULL, testDSM.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testDSM.getCorrelationID());
}
public void testBuildListFiles () {
@@ -430,7 +430,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testLF.getCorrelationID());
testLF = RPCRequestFactory.buildListFiles(null);
- assertNull(Test.NULL, testLF.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testLF.getCorrelationID());
}
@SuppressWarnings("deprecation")
@@ -480,7 +480,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testPI.getInteractionMode());
assertNull(Test.NULL, testPI.getTimeout());
assertNull(Test.NULL, testPI.getVrHelp());
- assertNull(Test.NULL, testPI.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testPI.getCorrelationID());
// Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, String timeoutPrompt, InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp, Integer correlationID)
// ^ Calls another build method.
@@ -510,7 +510,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testPI.getTimeoutPrompt());
assertNull(Test.NULL, testPI.getInteractionMode());
assertNull(Test.NULL, testPI.getTimeout());
- assertNull(Test.NULL, testPI.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testPI.getCorrelationID());
// Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, String timeoutPrompt, InteractionMode interactionMode, Integer timeout, Integer correlationID)
// ^ Calls another build method.
@@ -538,7 +538,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testPI.getHelpPrompt());
assertNull(Test.NULL, testPI.getInteractionMode());
assertNull(Test.NULL, testPI.getTimeout());
- assertNull(Test.NULL, testPI.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testPI.getCorrelationID());
// Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, InteractionMode interactionMode, Integer timeout, Integer correlationID)
// ^ Calls another build method.
@@ -567,7 +567,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testPF.getFileType());
assertNull(Test.NULL, testPF.getPersistentFile());
assertNull(Test.NULL, testPF.getFileData());
- assertNull(Test.NULL, testPF.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testPF.getCorrelationID());
// Test -- buildPutFile(String sdlFileName, Integer iOffset, Integer iLength)
testPF = RPCRequestFactory.buildPutFile(testFileName, testOffset, testLength);
@@ -665,7 +665,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSAI = RPCRequestFactory.buildSetAppIcon(null, null);
assertNull(Test.NULL, testSAI.getSdlFileName());
- assertNull(Test.NULL, testSAI.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSAI.getCorrelationID());
}
@@ -698,7 +698,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSBP = RPCRequestFactory.buildSetGlobalProperties((Vector<TTSChunk>) null, null, null);
assertNull(Test.NULL, testSBP.getHelpPrompt());
assertNull(Test.NULL, testSBP.getTimeoutPrompt());
- assertNull(Test.NULL, testSBP.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSBP.getCorrelationID());
// Test -- buildSetGlobalProperties(String helpPrompt, String timeoutPrompt, String vrHelpTitle, Vector<VrHelpItem> vrHelp, Integer correlationID)
// ^ Calls another build method.
@@ -716,7 +716,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testSBP.getTimeoutPrompt());
assertNull(Test.NULL, testSBP.getVrHelpTitle());
assertNull(Test.NULL, testSBP.getVrHelp());
- assertNull(Test.NULL, testSBP.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSBP.getCorrelationID());
}
public void testBuildSetMediaClockTimer () {
@@ -736,7 +736,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSMCT = RPCRequestFactory.buildSetMediaClockTimer(null, null, null, null, null);
assertNull(Test.NULL, testSMCT.getStartTime());
assertNull(Test.NULL, testSMCT.getUpdateMode());
- assertNull(Test.NULL, testSMCT.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSMCT.getCorrelationID());
// Test -- buildSetMediaClockTimer(UpdateMode updateMode, Integer correlationID)
// ^ Calls another build method.
@@ -784,7 +784,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testShow.getSoftButtons());
assertNull(Test.NULL, testShow.getCustomPresets());
assertNull(Test.NULL, testShow.getAlignment());
- assertNull(Test.NULL, testShow.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testShow.getCorrelationID());
// Test -- buildShow(String mainText1, String mainText2, String mainText3, String mainText4, TextAlignment alignment, Integer correlationID)
// ^ Calls another build method.
@@ -805,7 +805,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testShow.getMediaClock());
assertNull(Test.NULL, testShow.getMediaTrack());
assertNull(Test.NULL, testShow.getAlignment());
- assertNull(Test.NULL, testShow.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testShow.getCorrelationID());
// Test -- buildShow(String mainText1, String mainText2, TextAlignment alignment, Integer correlationID)
// ^ Calls another build method.
@@ -825,7 +825,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSpeak = RPCRequestFactory.buildSpeak((String) null, null);
assertNull(Test.NULL, testSpeak.getTtsChunks());
- assertNull(Test.NULL, testSpeak.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSpeak.getCorrelationID());
// Test -- buildSpeak(Vector<TTSChunk> ttsChunks, Integer correlationID)
testSpeak = RPCRequestFactory.buildSpeak(testTTSChunks, testCorrelationID);
@@ -834,7 +834,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSpeak = RPCRequestFactory.buildSpeak((Vector<TTSChunk>) null, null);
assertNull(Test.NULL, testSpeak.getTtsChunks());
- assertNull(Test.NULL, testSpeak.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSpeak.getCorrelationID());
}
public void testBuildSubscribeButton () {
@@ -850,7 +850,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSB = RPCRequestFactory.buildSubscribeButton(null, null);
assertNull(Test.NULL, testSB.getButtonName());
- assertNull(Test.NULL, testSB.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSB.getCorrelationID());
}
@@ -864,7 +864,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testUAI.getCorrelationID());
testUAI = RPCRequestFactory.buildUnregisterAppInterface(null);
- assertNull(Test.NULL, testUAI.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testUAI.getCorrelationID());
}
public void testBuildUnsubscribeButton () {
@@ -880,7 +880,7 @@ public class RPCRequestFactoryTests extends TestCase {
testUB = RPCRequestFactory.buildUnsubscribeButton(null, null);
assertNull(Test.NULL, testUB.getButtonName());
- assertNull(Test.NULL, testUB.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testUB.getCorrelationID());
}
@@ -909,7 +909,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testSVD.getCorrelationID());
testSVD = RPCRequestFactory.BuildSubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNull(Test.NULL, testSVD.getCorrelationID());
+ assertNotNull(Test.NULL, testSVD.getCorrelationID());
}
public void testBuildUnsubscribeVehicleData () {
@@ -937,7 +937,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testUVD.getCorrelationID());
testUVD = RPCRequestFactory.BuildUnsubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNull(Test.NULL, testUVD.getCorrelationID());
+ assertNotNull(Test.NULL, testUVD.getCorrelationID());
}
public void testBuildGetVehicleData () {
@@ -966,7 +966,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testGVD.getCorrelationID());
testGVD = RPCRequestFactory.BuildGetVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testVIN, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNull(Test.NULL, testGVD.getCorrelationID());
+ assertNotNull(Test.NULL, testGVD.getCorrelationID());
}
public void testBuildScrollableMessage () {
@@ -988,7 +988,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testSM.getScrollableMessageBody());
assertNull(Test.NULL, testSM.getTimeout());
assertNull(Test.NULL, testSM.getSoftButtons());
- assertNull(Test.NULL, testSM.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSM.getCorrelationID());
}
public void testBuildSlider () {
@@ -1013,7 +1013,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testSlider.getSliderHeader());
assertNull(Test.NULL, testSlider.getSliderFooter());
assertNull(Test.NULL, testSlider.getTimeout());
- assertNull(Test.NULL, testSlider.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSlider.getCorrelationID());
}
public void testBuildChangeRegistration () {
@@ -1031,7 +1031,7 @@ public class RPCRequestFactoryTests extends TestCase {
testCR = RPCRequestFactory.BuildChangeRegistration(null, null, null);
assertNull(Test.NULL, testCR.getLanguage());
assertNull(Test.NULL, testCR.getHmiDisplayLanguage());
- assertNull(Test.NULL, testCR.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testCR.getCorrelationID());
}
public void testBuildSetDisplayLayout () {
@@ -1047,7 +1047,7 @@ public class RPCRequestFactoryTests extends TestCase {
testSDL = RPCRequestFactory.BuildSetDisplayLayout(null, null);
assertNull(Test.NULL, testSDL.getDisplayLayout());
- assertNull(Test.NULL, testSDL.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testSDL.getCorrelationID());
}
public void testBuildPerformAudioPassThru () {
@@ -1085,7 +1085,7 @@ public class RPCRequestFactoryTests extends TestCase {
assertNull(Test.NULL, testPAPT.getBitsPerSample());
assertNull(Test.NULL, testPAPT.getAudioType());
assertNull(Test.NULL, testPAPT.getMuteAudio());
- assertNull(Test.NULL, testPAPT.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testPAPT.getCorrelationID());
}
public void testBuildEndAudioPassThru () {
@@ -1098,6 +1098,6 @@ public class RPCRequestFactoryTests extends TestCase {
assertEquals(Test.MATCH, testCorrelationID, testEAPT.getCorrelationID());
testEAPT = RPCRequestFactory.BuildEndAudioPassThru(null);
- assertNull(Test.NULL, testEAPT.getCorrelationID());
+ assertNotNull(Test.NOT_NULL, testEAPT.getCorrelationID());
}
} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java
new file mode 100644
index 000000000..5c1b9436d
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestTest.java
@@ -0,0 +1,48 @@
+package com.smartdevicelink.test.proxy;
+
+import android.test.AndroidTestCase;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.GetSystemCapability;
+import com.smartdevicelink.test.Config;
+import com.smartdevicelink.test.JsonUtils;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+public class RPCRequestTest extends AndroidTestCase {
+
+ public static final int SDL_VERSION_UNDER_TEST = Config.SDL_VERSION_UNDER_TEST;
+
+ private static final int CORR_ID = 402;
+
+ protected RPCRequest msg;
+
+ @Override
+ public void setUp(){
+ this.msg = new GetSystemCapability();
+
+ }
+
+ public void testCreation(){
+ assertNotNull("Object creation failed.", msg);
+ }
+
+ public void testGetCorrelationId(){
+ assertNotNull(this.msg.getCorrelationID());
+ }
+ public void testSettingCorrelationId(){
+ assertNotNull(this.msg.getCorrelationID());
+ msg.setCorrelationID(CORR_ID);
+ assertEquals("Correlation ID doesn't match expected ID.", CORR_ID, (int)msg.getCorrelationID());
+
+ }
+
+
+} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
index b8b705cfe..ee8d7d0ee 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
@@ -55,6 +55,7 @@ import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
+import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
import com.smartdevicelink.proxy.rpc.SendLocationResponse;
import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
@@ -450,5 +451,10 @@ public class SdlProxyBaseTests extends AndroidTestCase{
public void onGenericResponse(GenericResponse response) {
Log.i(TAG, "Generic response from SDL: " + response.getResultCode().name() + " Info: " + response.getInfo());
}
+
+ @Override
+ public void onSendHapticDataResponse(SendHapticDataResponse response) {
+ Log.i(TAG, "SendHapticDataResponse response from SDL: " + response);
+ }
}
}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java
new file mode 100644
index 000000000..c72204640
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HapticRectTests.java
@@ -0,0 +1,73 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.HapticRect;
+import com.smartdevicelink.proxy.rpc.Rectangle;
+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;
+
+/**
+ * Created by brettywhite on 8/24/17.
+ */
+
+public class HapticRectTests extends TestCase {
+
+ private HapticRect msg;
+
+ @Override
+ public void setUp() {
+ msg = new HapticRect();
+
+ msg.setId(Test.GENERAL_INTEGER);
+ msg.setRect(Test.GENERAL_RECTANGLE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Integer id = msg.getId();
+ Rectangle rect = msg.getRect();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, id);
+ assertEquals(Test.MATCH, Test.GENERAL_RECTANGLE, rect);
+
+ // Invalid/Null Tests
+ HapticRect msg = new HapticRect();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getId());
+ assertNull(Test.NULL, msg.getRect());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(HapticRect.KEY_ID, Test.GENERAL_INTEGER);
+ reference.put(HapticRect.KEY_RECT, Test.GENERAL_RECTANGLE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(reference, HapticRect.KEY_ID),
+ JsonUtils.readIntegerFromJsonObject(underTest, HapticRect.KEY_ID));
+
+ assertTrue(Validator.validateRectangle(
+ (Rectangle) JsonUtils.readObjectFromJsonObject(reference, HapticRect.KEY_RECT),
+ new Rectangle(JsonRPCMarshaller.deserializeJSONObject( (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, HapticRect.KEY_RECT))))
+ );
+
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java
new file mode 100644
index 000000000..5f27cc132
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MetadataTagsTests.java
@@ -0,0 +1,110 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.MetadataTags;
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class:
+ * {@link MetadataTags}
+ */
+
+public class MetadataTagsTests extends TestCase {
+
+ private MetadataTags msg;
+ private MetadataTags msg2;
+ private List<MetadataType> exampleList;
+
+ @Override
+ public void setUp() {
+ // Create List for Testing
+ exampleList = new ArrayList<>();
+ exampleList.add(0, MetadataType.CURRENT_TEMPERATURE);
+ exampleList.add(1, MetadataType.MEDIA_ALBUM);
+ exampleList.add(2, MetadataType.MEDIA_ARTIST);
+
+ msg = new MetadataTags();
+ msg.setMainField1(exampleList);
+ msg.setMainField2(exampleList);
+ msg.setMainField3(exampleList);
+ msg.setMainField4(exampleList);
+
+ // Setup without a list
+ msg2 = new MetadataTags();
+ msg2.setMainField1(MetadataType.CURRENT_TEMPERATURE);
+ msg2.setMainField2(MetadataType.HUMIDITY);
+ msg2.setMainField3(MetadataType.MAXIMUM_TEMPERATURE);
+ msg2.setMainField4(MetadataType.MEDIA_ALBUM);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ List<MetadataType> mainField1Types = msg.getMainField1();
+ List<MetadataType> mainField2Types = msg.getMainField2();
+ List<MetadataType> mainField3Types = msg.getMainField3();
+ List<MetadataType> mainField4Types = msg.getMainField4();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, exampleList, mainField1Types);
+ assertEquals(Test.MATCH, exampleList, mainField2Types);
+ assertEquals(Test.MATCH, exampleList, mainField3Types);
+ assertEquals(Test.MATCH, exampleList, mainField4Types);
+
+ // Test metadata set without a list
+ mainField1Types = msg2.getMainField1();
+ mainField2Types = msg2.getMainField2();
+ mainField3Types = msg2.getMainField3();
+ mainField4Types = msg2.getMainField4();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, MetadataType.CURRENT_TEMPERATURE, mainField1Types.get(0));
+ assertEquals(Test.MATCH, MetadataType.HUMIDITY, mainField2Types.get(0));
+ assertEquals(Test.MATCH, MetadataType.MAXIMUM_TEMPERATURE, mainField3Types.get(0));
+ assertEquals(Test.MATCH, MetadataType.MEDIA_ALBUM, mainField4Types.get(0));
+
+ // Invalid/Null Tests
+ MetadataTags msg = new MetadataTags();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getMainField1());
+ assertNull(Test.NULL, msg.getMainField2());
+ assertNull(Test.NULL, msg.getMainField3());
+ assertNull(Test.NULL, msg.getMainField4());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(MetadataTags.KEY_MAIN_FIELD_1_TYPE, Test.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_2_TYPE, Test.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_3_TYPE, Test.JSON_TEXTFIELDTYPES);
+ reference.put(MetadataTags.KEY_MAIN_FIELD_4_TYPE, Test.JSON_TEXTFIELDTYPES);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java
new file mode 100644
index 000000000..569a4db83
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RectangleTests.java
@@ -0,0 +1,79 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.Rectangle;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link Rectangle}
+ */
+public class RectangleTests extends TestCase {
+
+ private Rectangle msg;
+
+ @Override
+ public void setUp() {
+ msg = new Rectangle();
+
+ msg.setX(Test.GENERAL_FLOAT);
+ msg.setY(Test.GENERAL_FLOAT);
+ msg.setWidth(Test.GENERAL_FLOAT);
+ msg.setHeight(Test.GENERAL_FLOAT);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Float x = msg.getX();
+ Float y = msg.getY();
+ Float width = msg.getWidth();
+ Float height = msg.getHeight();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_FLOAT, x);
+ assertEquals(Test.MATCH, Test.GENERAL_FLOAT, y);
+ assertEquals(Test.MATCH, Test.GENERAL_FLOAT, width);
+ assertEquals(Test.MATCH, Test.GENERAL_FLOAT, height);
+
+ // Invalid/Null Tests
+ Rectangle msg = new Rectangle();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getX());
+ assertNull(Test.NULL, msg.getY());
+ assertNull(Test.NULL, msg.getWidth());
+ assertNull(Test.NULL, msg.getHeight());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(Rectangle.KEY_X, (Test.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_Y, (Test.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_WIDTH, (Test.GENERAL_FLOAT));
+ reference.put(Rectangle.KEY_HEIGHT, (Test.GENERAL_FLOAT));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
index 8a417f1b1..54cfc1a22 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
@@ -29,6 +29,7 @@ public class VideoStreamingCapabilityTests extends TestCase {
msg.setSupportedFormats(Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
msg.setPreferredResolution(Test.GENERAL_IMAGERESOLUTION);
msg.setMaxBitrate(Test.GENERAL_INT);
+ msg.setIsHapticSpatialDataSupported(Test.GENERAL_BOOLEAN);
}
/**
@@ -39,11 +40,13 @@ public class VideoStreamingCapabilityTests extends TestCase {
List<VideoStreamingFormat> format = msg.getSupportedFormats();
ImageResolution res = msg.getPreferredResolution();
Integer maxBitrate = msg.getMaxBitrate();
+ Boolean isHapticSpatialDataSupported = msg.getIsHapticSpatialDataSupported();
// Valid Tests
assertEquals(Test.MATCH, (List<VideoStreamingFormat>) Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST, format);
assertEquals(Test.MATCH, (ImageResolution) Test.GENERAL_IMAGERESOLUTION, res);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, maxBitrate);
+ assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, isHapticSpatialDataSupported);
// Invalid/Null Tests
VideoStreamingCapability msg = new VideoStreamingCapability();
@@ -52,6 +55,7 @@ public class VideoStreamingCapabilityTests extends TestCase {
assertNull(Test.NULL, msg.getMaxBitrate());
assertNull(Test.NULL, msg.getPreferredResolution());
assertNull(Test.NULL, msg.getSupportedFormats());
+ assertNull(Test.NULL, msg.getIsHapticSpatialDataSupported());
}
public void testJson() {
@@ -61,6 +65,7 @@ public class VideoStreamingCapabilityTests extends TestCase {
reference.put(VideoStreamingCapability.KEY_MAX_BITRATE, Test.GENERAL_INT);
reference.put(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION, Test.GENERAL_IMAGERESOLUTION);
reference.put(VideoStreamingCapability.KEY_SUPPORTED_FORMATS, Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
+ reference.put(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -69,7 +74,7 @@ public class VideoStreamingCapabilityTests extends TestCase {
while (iterator.hasNext()) {
String key = (String) iterator.next();
- if (key.equals(VideoStreamingCapability.KEY_MAX_BITRATE)) {
+ if (key.equals(VideoStreamingCapability.KEY_MAX_BITRATE) || key.equals(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED)) {
assertTrue(Test.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
} else if (key.equals(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION)) {
ImageResolution irReference = (ImageResolution) JsonUtils.readObjectFromJsonObject(reference, key);
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java
new file mode 100644
index 000000000..c1aff1bdd
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MetadataTypeTests.java
@@ -0,0 +1,114 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.MetadataTags}
+ */
+
+public class MetadataTypeTests extends TestCase{
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "mediaTitle";
+ MetadataType enumMediaTitle = MetadataType.valueForString(example);
+ example = "mediaArtist";
+ MetadataType enumMediaArtist = MetadataType.valueForString(example);
+ example = "mediaAlbum";
+ MetadataType enumMediaAlbum = MetadataType.valueForString(example);
+ example = "mediaYear";
+ MetadataType enumMediaYear = MetadataType.valueForString(example);
+ example = "mediaGenre";
+ MetadataType enumMediaGenre = MetadataType.valueForString(example);
+ example = "mediaStation";
+ MetadataType enumMediaStation = MetadataType.valueForString(example);
+ example = "rating";
+ MetadataType enumRating = MetadataType.valueForString(example);
+ example = "currentTemperature";
+ MetadataType enumCurrentTemperature = MetadataType.valueForString(example);
+ example = "maximumTemperature";
+ MetadataType enumMaximumTemperature = MetadataType.valueForString(example);
+ example = "minimumTemperature";
+ MetadataType enumMinimumTemperature = MetadataType.valueForString(example);
+ example = "weatherTerm";
+ MetadataType enumWeatherTerm = MetadataType.valueForString(example);
+ example = "humidity";
+ MetadataType enumHumidity = MetadataType.valueForString(example);
+
+
+ assertNotNull("mediaTitle returned null", enumMediaTitle);
+ assertNotNull("mediaArtist returned null", enumMediaArtist);
+ assertNotNull("mediaAlbum returned null", enumMediaAlbum);
+ assertNotNull("mediaYear returned null", enumMediaYear);
+ assertNotNull("mediaGenre returned null", enumMediaGenre);
+ assertNotNull("mediaStation returned null", enumMediaStation);
+ assertNotNull("rating returned null", enumRating);
+ assertNotNull("currentTemperature returned null", enumCurrentTemperature);
+ assertNotNull("maximumTemperature returned null", enumMaximumTemperature);
+ assertNotNull("minimumTemperature returned null", enumMinimumTemperature);
+ assertNotNull("weatherTerm returned null", enumWeatherTerm);
+ assertNotNull("humidity returned null", enumHumidity);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "MEDIA_TITLEZ";
+ try {
+ MetadataType temp = MetadataType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ MetadataType temp = MetadataType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of MetadataType.
+ */
+ public void testListEnum() {
+ List<MetadataType> enumValueList = Arrays.asList(MetadataType.values());
+
+ List<MetadataType> enumTestList = new ArrayList<MetadataType>();
+ enumTestList.add(MetadataType.MEDIA_TITLE);
+ enumTestList.add(MetadataType.MEDIA_ARTIST);
+ enumTestList.add(MetadataType.MEDIA_ALBUM);
+ enumTestList.add(MetadataType.MEDIA_YEAR);
+ enumTestList.add(MetadataType.MEDIA_GENRE);
+ enumTestList.add(MetadataType.MEDIA_STATION);
+ enumTestList.add(MetadataType.RATING);
+ enumTestList.add(MetadataType.CURRENT_TEMPERATURE);
+ enumTestList.add(MetadataType.MAXIMUM_TEMPERATURE);
+ enumTestList.add(MetadataType.MINIMUM_TEMPERATURE);
+ enumTestList.add(MetadataType.WEATHER_TERM);
+ enumTestList.add(MetadataType.HUMIDITY);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java
new file mode 100644
index 000000000..7c3b0ed90
--- /dev/null
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SendHapticDataTests.java
@@ -0,0 +1,86 @@
+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.HapticRect;
+import com.smartdevicelink.proxy.rpc.SendHapticData;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.Test;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by brettywhite on 8/9/17.
+ */
+
+public class SendHapticDataTests extends BaseRpcTests {
+
+ private SendHapticData msg;
+
+ @Override
+ protected RPCMessage createMessage(){
+ msg = new SendHapticData();
+
+ List<HapticRect> list = new ArrayList<>();
+ list.add(Test.GENERAL_HAPTIC_RECT);
+
+ msg.setHapticRectData(list);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.SEND_HAPTIC_DATA.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ JSONObject result = new JSONObject();
+
+ JSONArray jsonArray = new JSONArray();
+ try {
+ jsonArray.put(JsonRPCMarshaller.serializeHashtable(Test.GENERAL_HAPTIC_RECT.getStore()));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ result.put(SendHapticData.KEY_HAPTIC_RECT_DATA, jsonArray);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ List<HapticRect> list = msg.getHapticRectData();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_HAPTIC_RECT, list.get(0));
+
+ // Invalid/Null Tests
+ SendHapticData msg = new SendHapticData();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getHapticRectData());
+ }
+
+}
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
index 5899d9015..9c7a681df 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
@@ -12,6 +12,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.Image;
+import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
@@ -23,12 +24,12 @@ import com.smartdevicelink.test.json.rpc.JsonFileReader;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.Show}
+ * {@link com.smartdevicelink.proxy.rpc.Show}
*/
public class ShowTests extends BaseRpcTests {
@Override
- protected RPCMessage createMessage() {
+ protected RPCMessage createMessage() {
Show msg = new Show();
msg.setMainField1(Test.GENERAL_STRING);
@@ -42,6 +43,7 @@ public class ShowTests extends BaseRpcTests {
msg.setSecondaryGraphic(Test.GENERAL_IMAGE);
msg.setCustomPresets(Test.GENERAL_STRING_LIST);
msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
+ msg.setMetadataTags(Test.GENERAL_METADATASTRUCT);
return msg;
}
@@ -66,12 +68,13 @@ public class ShowTests extends BaseRpcTests {
result.put(Show.KEY_MAIN_FIELD_3, Test.GENERAL_STRING);
result.put(Show.KEY_MAIN_FIELD_4, Test.GENERAL_STRING);
result.put(Show.KEY_STATUS_BAR, Test.GENERAL_STRING);
- result.put(Show.KEY_MEDIA_TRACK, Test.GENERAL_STRING);
+ result.put(Show.KEY_MEDIA_TRACK, Test.GENERAL_STRING);
result.put(Show.KEY_GRAPHIC, Test.JSON_IMAGE);
result.put(Show.KEY_SECONDARY_GRAPHIC, Test.JSON_IMAGE);
result.put(Show.KEY_ALIGNMENT, Test.GENERAL_TEXTALIGNMENT);
- result.put(Show.KEY_CUSTOM_PRESETS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ result.put(Show.KEY_CUSTOM_PRESETS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
result.put(Show.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(Show.KEY_METADATA_TAGS, Test.GENERAL_METADATASTRUCT.serializeJSON());
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -92,6 +95,7 @@ public class ShowTests extends BaseRpcTests {
TextAlignment testAlignment = ( (Show) msg ).getAlignment();
List<SoftButton> testSoftButtons = ( (Show) msg ).getSoftButtons();
List<String> testCustomPresets = ( (Show) msg ).getCustomPresets();
+ MetadataTags testMetadata = ( (Show) msg ).getMetadataTags();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, testTrack);
@@ -102,6 +106,7 @@ public class ShowTests extends BaseRpcTests {
assertEquals(Test.MATCH, Test.GENERAL_STRING, testText3);
assertEquals(Test.MATCH, Test.GENERAL_STRING, testText4);
assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), testCustomPresets.size());
+ assertEquals(Test.MATCH, Test.GENERAL_METADATASTRUCT, testMetadata);
assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testGraphic2));
assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testGraphic1));
@@ -121,7 +126,8 @@ public class ShowTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getSecondaryGraphic());
assertNull(Test.NULL, msg.getCustomPresets());
assertNull(Test.NULL, msg.getMediaTrack());
- assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(Test.NULL, msg.getMetadataTags());
}
/**
@@ -130,24 +136,24 @@ public class ShowTests extends BaseRpcTests {
public void testJsonConstructor () {
JSONObject commandJson = JsonFileReader.readId(this.mContext,getCommandType(), getMessageType());
assertNotNull(Test.NOT_NULL, commandJson);
-
+
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
Show cmd = new Show(hash);
-
+
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
assertNotNull(Test.NOT_NULL, body);
-
+
// Test everything in the json 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);
-
+
JSONObject graphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_GRAPHIC);
Image referenceGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(graphic));
assertTrue(Test.TRUE, Validator.validateImage(referenceGraphic, cmd.getGraphic()));
-
+
List<String> customPresetsList = JsonUtils.readStringListFromJsonObject(parameters, Show.KEY_CUSTOM_PRESETS);
List<String> testPresetsList = cmd.getCustomPresets();
assertEquals(Test.MATCH, customPresetsList.size(), testPresetsList.size());
@@ -160,11 +166,12 @@ public class ShowTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_STATUS_BAR), cmd.getStatusBar());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_ALIGNMENT), cmd.getAlignment().toString());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MEDIA_TRACK), cmd.getMediaTrack());
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_METADATA_TAGS), cmd.getMetadataTags());
JSONObject secondaryGraphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_SECONDARY_GRAPHIC);
Image referenceSecondaryGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(secondaryGraphic));
assertTrue(Test.TRUE, Validator.validateImage(referenceSecondaryGraphic, cmd.getSecondaryGraphic()));
-
+
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Show.KEY_SOFT_BUTTONS);
List<SoftButton> softButtonList = new ArrayList<SoftButton>();
for (int index = 0; index < softButtonArray.length(); index++) {
@@ -172,9 +179,9 @@ public class ShowTests extends BaseRpcTests {
softButtonList.add(chunk);
}
assertTrue(Test.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
-
+
} catch (JSONException e) {
fail(Test.JSON_FAIL);
- }
- }
+ }
+ }
} \ No newline at end of file
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
index b012d1944..301e330e7 100644
--- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
+++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowResponseTest.java
@@ -16,7 +16,7 @@ import com.smartdevicelink.test.json.rpc.JsonFileReader;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.ShowResponse}
+ * {@link com.smartdevicelink.proxy.rpc.ShowResponse}
*/
public class ShowResponseTest extends BaseRpcTests {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
index 9c34a4c67..06116c5b9 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -57,6 +57,7 @@ public enum FunctionID{
SUBSCRIBE_WAY_POINTS(46, "SubscribeWayPoints"),
UNSUBSCRIBE_WAY_POINTS(47, "UnsubscribeWayPoints"),
GET_SYSTEM_CAPABILITY(48, "GetSystemCapability"),
+ SEND_HAPTIC_DATA(49, "SendHapticData"),
// NOTIFICATIONS
ON_HMI_STATUS(32768, "OnHMIStatus"),
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
index ab4763103..e55292aad 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
@@ -104,6 +104,11 @@ public class RPCMessage extends RPCStruct {
}
@Override
+ public Float getFloat(String key) {
+ return (Float) parameters.get(key);
+ }
+
+ @Override
public Double getDouble(String key) {
return (Double) parameters.get(key);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
index 50493870d..370ffe1ec 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequest.java
@@ -6,6 +6,7 @@ package com.smartdevicelink.proxy;
import java.util.Hashtable;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.util.CorrelationIdGenerator;
public class RPCRequest extends RPCMessage {
@@ -21,6 +22,10 @@ public class RPCRequest extends RPCMessage {
}
public Integer getCorrelationID() {
+ //First we check to see if a correlation ID is set. If not, create one.
+ if(!function.containsKey(RPCMessage.KEY_CORRELATION_ID)){
+ setCorrelationID(CorrelationIdGenerator.generateId());
+ }
return (Integer)function.get(RPCMessage.KEY_CORRELATION_ID);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
index f1911b121..116c491df 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
@@ -231,6 +231,10 @@ public class RPCStruct {
return (Double) store.get(key);
}
+ public Float getFloat(String key) {
+ return (Float) store.get(key);
+ }
+
public Boolean getBoolean(String key) { return (Boolean) store.get(key); }
public Long getLong(String key){
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
index 226c8fd2c..17f00da06 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -2862,10 +2862,27 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onGetSystemCapabilityResponse(msg);
onRPCResponseReceived(msg);
}
- } else {
+ }
+ else if (functionName.equals(FunctionID.SEND_HAPTIC_DATA.toString())) {
+ final SendHapticDataResponse msg = new SendHapticDataResponse(hash);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onSendHapticDataResponse((SendHapticDataResponse) msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onSendHapticDataResponse((SendHapticDataResponse) msg);
+ onRPCResponseReceived(msg);
+ }
+ }
+ else {
if (_sdlMsgVersion != null) {
DebugTool.logError("Unrecognized response Message: " + functionName.toString() +
- "SDL Message Version = " + _sdlMsgVersion);
+ " SDL Message Version = " + _sdlMsgVersion);
} else {
DebugTool.logError("Unrecognized response Message: " + functionName.toString());
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
index 62ddbc1e0..80842cfc2 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
@@ -44,6 +44,7 @@ import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
+import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
import com.smartdevicelink.proxy.rpc.SendLocationResponse;
import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
@@ -338,4 +339,6 @@ public interface IProxyListenerBase {
public void onOnWayPointChange(OnWayPointChange notification);
public void onGetSystemCapabilityResponse(GetSystemCapabilityResponse response);
+
+ public void onSendHapticDataResponse(SendHapticDataResponse response);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java
new file mode 100644
index 000000000..64a9f8354
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HapticRect.java
@@ -0,0 +1,82 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/*
+ * Copyright (c) 2017 Livio, 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 Livio 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.
+ */
+
+/**
+ * Defines a haptic rectangle that contains a reference ID and the spatial data of a rectangle UI component.
+ * @since SmartDeviceLink 4.5.0
+ *
+ */
+
+public class HapticRect extends RPCStruct {
+ public static final String KEY_ID = "id";
+ public static final String KEY_RECT = "rect";
+
+ public HapticRect() {}
+
+ public HapticRect(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Set a user control spatial identifier that references the supplied spatial data
+ */
+ public void setId(Integer id) {
+ setValue(KEY_ID, id);
+ }
+
+ /**
+ * @return a user control spatial identifier that references the supplied spatial data
+ */
+ public Integer getId() {
+ return getInteger(KEY_ID);
+ }
+
+ /**
+ * Set the position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.
+ */
+ public void setRect(Rectangle rect) {
+ setValue(KEY_RECT, rect);
+ }
+
+ /**
+ * @return the position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.
+ */
+ public Rectangle getRect() {
+ return (Rectangle) getObject(Rectangle.class, KEY_RECT);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java
new file mode 100644
index 000000000..dc5a9b5aa
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/MetadataTags.java
@@ -0,0 +1,116 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.List;
+
+public class MetadataTags extends RPCStruct {
+
+ public static final String KEY_MAIN_FIELD_1_TYPE = "mainField1";
+ public static final String KEY_MAIN_FIELD_2_TYPE = "mainField2";
+ public static final String KEY_MAIN_FIELD_3_TYPE = "mainField3";
+ public static final String KEY_MAIN_FIELD_4_TYPE = "mainField4";
+
+ /**
+ * Constructs a newly allocated MetadataTags object
+ */
+ public MetadataTags(){}
+
+ /**
+ * Constructs a newly allocated MetadataTags object indicated by the Hashtable parameter
+ * @param hash The Hashtable to use
+ */
+ public MetadataTags(Hashtable<String, Object> hash){super(hash);}
+
+ /**
+ * Set the metadata types of data contained in the "mainField1" text field
+ */
+ public void setMainField1( List<MetadataType> metadataTypes ) {
+ setValue(KEY_MAIN_FIELD_1_TYPE, metadataTypes);
+ }
+
+ /**
+ * Set the metadata type of data contained in the "mainField1" text field
+ */
+ public void setMainField1(MetadataType metadataType) {
+ setValue(KEY_MAIN_FIELD_1_TYPE, Collections.singletonList(metadataType));
+ }
+
+ /**
+ * @return The type of data contained in the "mainField1" text field
+ */
+ @SuppressWarnings("unchecked")
+ public List<MetadataType> getMainField1() {
+ return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_1_TYPE);
+ }
+
+ /**
+ * Set the metadata types of data contained in the "mainField2" text field
+ */
+ public void setMainField2( List<MetadataType> metadataTypes ) {
+ setValue(KEY_MAIN_FIELD_2_TYPE, metadataTypes);
+ }
+
+ /**
+ * Set the metadata type of data contained in the "mainField2" text field
+ */
+ public void setMainField2(MetadataType metadataType) {
+ setValue(KEY_MAIN_FIELD_2_TYPE, Collections.singletonList(metadataType));
+ }
+
+ /**
+ * @return The type of data contained in the "mainField2" text field
+ */
+ @SuppressWarnings("unchecked")
+ public List<MetadataType> getMainField2() {
+ return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_2_TYPE);
+ }
+
+ /**
+ * Set the metadata types of data contained in the "mainField3" text field
+ */
+ public void setMainField3( List<MetadataType> metadataTypes ) {
+ setValue(KEY_MAIN_FIELD_3_TYPE, metadataTypes);
+ }
+
+ /**
+ * Set the metadata type of data contained in the "mainField3" text field
+ */
+ public void setMainField3(MetadataType metadataType) {
+ setValue(KEY_MAIN_FIELD_3_TYPE, Collections.singletonList(metadataType));
+ }
+
+ /**
+ * @return The type of data contained in the "mainField3" text field
+ */
+ @SuppressWarnings("unchecked")
+ public List<MetadataType> getMainField3() {
+ return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_3_TYPE);
+ }
+
+ /**
+ * Set the metadata types of data contained in the "mainField4" text field
+ */
+ public void setMainField4( List<MetadataType> metadataTypes ) {
+ setValue(KEY_MAIN_FIELD_4_TYPE, metadataTypes);
+ }
+
+ /**
+ * Set the metadata type of data contained in the "mainField4" text field
+ */
+ public void setMainField4(MetadataType metadataType) {
+ setValue(KEY_MAIN_FIELD_4_TYPE, Collections.singletonList(metadataType));
+ }
+
+ /**
+ * @return The type of data contained in the "mainField4" text field
+ */
+ @SuppressWarnings("unchecked")
+ public List<MetadataType> getMainField4() {
+ return (List<MetadataType>) getObject(MetadataType.class, KEY_MAIN_FIELD_4_TYPE);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java
new file mode 100644
index 000000000..e0d50e073
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Rectangle.java
@@ -0,0 +1,109 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+/*
+ * Copyright (c) 2017 Livio, 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 Livio 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.
+ */
+
+/**
+ * Defines Rectangle for each user control object for video streaming application
+ * @since SmartDeviceLink 4.5.0
+ */
+
+public class Rectangle extends RPCStruct {
+ public static final String KEY_X = "x";
+ public static final String KEY_Y = "y";
+ public static final String KEY_WIDTH = "width";
+ public static final String KEY_HEIGHT = "height";
+
+ public Rectangle() {}
+ public Rectangle(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Set the X-coordinate pixel in of the user control that starts in the upper left corner
+ */
+ public void setX(Float x) {
+ setValue(KEY_X, x);
+ }
+
+ /**
+ * @return the X-coordinate pixel of the user control that starts in the upper left corner
+ */
+ public Float getX() {
+ return getFloat(KEY_X);
+ }
+
+ /**
+ * Set the Y-coordinate pixel of the user control that starts in the upper left corner
+ */
+ public void setY(Float y) {
+ setValue(KEY_Y, y);
+ }
+
+ /**
+ * @return the Y-coordinate pixel of the user control that starts in the upper left corner
+ */
+ public Float getY() {
+ return getFloat(KEY_Y);
+ }
+
+ /**
+ * Set the width in pixels of the user control's bounding rectangle in pixels
+ */
+ public void setWidth(Float width) {
+ setValue(KEY_WIDTH, width);
+ }
+
+ /**
+ * @return the width in pixels of the user control's bounding rectangle in pixels
+ */
+ public Float getWidth() {
+ return getFloat(KEY_WIDTH);
+ }
+
+ /**
+ * The height in pixels of the user control's bounding rectangle
+ */
+ public void setHeight(Float height) {
+ setValue(KEY_HEIGHT, height);
+ }
+
+ /**
+ * @return the width in pixels of the user control's bounding rectangle in pixels
+ */
+ public Float getHeight() {
+ return getFloat(KEY_HEIGHT);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java
new file mode 100644
index 000000000..a93fd2b98
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticData.java
@@ -0,0 +1,86 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+import java.util.List;
+
+/*
+ * Copyright (c) 2017 Livio, 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 Livio 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.
+ */
+
+/**
+ * Request to describe UI elements boundaries to a connected modules.
+ * @since SmartDeviceLink 4.5.0
+ */
+public class SendHapticData extends RPCRequest {
+
+ public static final String KEY_HAPTIC_RECT_DATA = "hapticRectData";
+
+ /**
+ * Constructs a new SendHapticData object
+ */
+ public SendHapticData(){
+ super(FunctionID.SEND_HAPTIC_DATA.toString());
+ }
+
+ /**
+ * <p>
+ * Send the spatial data gathered from SDLCarWindow or VirtualDisplayEncoder to the HMI.
+ * This data will be utilized by the HMI to determine how and when haptic events should occur
+ * </p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public SendHapticData(Hashtable<String, Object> hash){
+ super(hash);
+ }
+
+ /**
+ * Array of spatial data structures that represent the locations of all user controls present on the app's layout.
+ * This data should be updated if/when the application presents a new screen.
+ * When a request is sent, if successful, it will replace all spatial data previously sent through RPC.
+ * If an empty array is sent, the existing spatial data will be cleared
+ */
+ public void setHapticRectData(List<HapticRect> hapticRectData) {
+ setParameters(KEY_HAPTIC_RECT_DATA, hapticRectData);
+ }
+
+ @SuppressWarnings("unchecked")
+ /**
+ * @return array of spatial data structures that represent the locations of all user controls present on the app's layout.
+ */
+ public List<HapticRect> getHapticRectData() {
+ return (List<HapticRect>) getObject(HapticRect.class, KEY_HAPTIC_RECT_DATA);
+ }
+
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java
new file mode 100644
index 000000000..e7c0c7d30
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SendHapticDataResponse.java
@@ -0,0 +1,54 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+
+import java.util.Hashtable;
+
+/*
+ * Copyright (c) 2017 Livio, 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 Livio 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.
+ */
+
+/**
+ * Response to request that described UI elements boundaries to a connected modules.
+ * @since SmartDeviceLink 4.5.0
+ */
+
+public class SendHapticDataResponse extends RPCResponse {
+
+ public SendHapticDataResponse(){
+ super(FunctionID.SEND_HAPTIC_DATA.toString());
+ }
+
+ public SendHapticDataResponse(Hashtable<String, Object> hash){
+ super(hash);
+ }
+}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Show.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
index 331ddebbe..6a42fe1a8 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
@@ -164,6 +164,7 @@ public class Show extends RPCRequest {
public static final String KEY_MEDIA_TRACK = "mediaTrack";
public static final String KEY_SECONDARY_GRAPHIC = "secondaryGraphic";
public static final String KEY_SOFT_BUTTONS = "softButtons";
+ public static final String KEY_METADATA_TAGS = "metadataTags";
/**
* Constructs a new Show object
*/
@@ -520,4 +521,29 @@ public class Show extends RPCRequest {
public void setCustomPresets(List<String> customPresets) {
setParameters(KEY_CUSTOM_PRESETS, customPresets);
}
+
+ /**
+ * Sets text field metadata defined by the App
+ *
+ * @param metadataTags
+ * A Struct containing metadata pertaining to the main text fields
+ * <p></p>
+ * <ul>
+ * @since SmartDeviceLink 4.5.0
+ */
+ public void setMetadataTags(MetadataTags metadataTags){
+ setParameters(KEY_METADATA_TAGS, metadataTags);
+ }
+
+ /**
+ * Gets text field metadata defined by the App
+ *
+ * @return metadataTags - App defined metadata information. See MetadataTags. Uses mainField1, mainField2, mainField3, mainField4.
+ * If omitted on supported displays, the currently set metadata tags will not change.
+ * If any text field contains no tags or the none tag, the metadata tag for that textfield should be removed.
+ * @since SmartDeviceLink 4.5.0
+ */
+ public MetadataTags getMetadataTags() {
+ return (MetadataTags) getObject(MetadataTags.class, KEY_METADATA_TAGS);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java
index 58433f26c..f99b0a8e2 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/TouchEvent.java
@@ -136,7 +136,7 @@ public class TouchEvent extends RPCStruct {
public List<TouchCoord> getC() {
return getTouchCoordinates();
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
public List<TouchCoord> getTouchCoordinates() {
return (List<TouchCoord>) getObject(TouchCoord.class, KEY_C);
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
index bc96056ac..6600cf38d 100644
--- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
@@ -13,6 +13,7 @@ public class VideoStreamingCapability extends RPCStruct {
public static final String KEY_PREFERRED_RESOLUTION = "preferredResolution";
public static final String KEY_MAX_BITRATE = "maxBitrate";
public static final String KEY_SUPPORTED_FORMATS = "supportedFormats";
+ public static final String KEY_HAPTIC_SPATIAL_DATA_SUPPORTED = "hapticSpatialDataSupported";
public VideoStreamingCapability(){}
public VideoStreamingCapability(Hashtable<String, Object> hash){super(hash);}
@@ -40,4 +41,12 @@ public class VideoStreamingCapability extends RPCStruct {
public List<VideoStreamingFormat> getSupportedFormats(){
return (List<VideoStreamingFormat>) getObject(VideoStreamingFormat.class, KEY_SUPPORTED_FORMATS);
}
+
+ public Boolean getIsHapticSpatialDataSupported() {
+ return getBoolean(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED);
+ }
+
+ public void setIsHapticSpatialDataSupported(Boolean hapticSpatialDataSupported) {
+ setValue(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, hapticSpatialDataSupported);
+ }
}
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java
new file mode 100644
index 000000000..9f51a6437
--- /dev/null
+++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java
@@ -0,0 +1,96 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+import java.util.EnumSet;
+
+/**
+ * Defines the metadata types that can be applied to text fields
+ *
+ */
+public enum MetadataType {
+
+ /**
+ * The data in this field contains the title of the currently playing audio track.
+ */
+ MEDIA_TITLE("mediaTitle"),
+
+ /**
+ * The data in this field contains the artist or creator of the currently playing audio track.
+ */
+ MEDIA_ARTIST("mediaArtist"),
+
+ /**
+ * The data in this field contains the album title of the currently playing audio track.
+ */
+ MEDIA_ALBUM("mediaAlbum"),
+
+ /**
+ * The data in this field contains the creation year of the currently playing audio track.
+ */
+ MEDIA_YEAR("mediaYear"),
+
+ /**
+ * The data in this field contains the genre of the currently playing audio track.
+ */
+ MEDIA_GENRE("mediaGenre"),
+
+ /**
+ * The data in this field contains the name of the current source for the media.
+ */
+ MEDIA_STATION("mediaStation"),
+
+ /**
+ * The data in this field is a rating.
+ */
+ RATING("rating"),
+
+ /**
+ * The data in this field is the current temperature.
+ */
+ CURRENT_TEMPERATURE("currentTemperature"),
+
+ /**
+ * The data in this field is the maximum temperature for the day.
+ */
+ MAXIMUM_TEMPERATURE("maximumTemperature"),
+
+ /**
+ * The data in this field is the minimum temperature for the day.
+ */
+ MINIMUM_TEMPERATURE("minimumTemperature"),
+
+ /**
+ * The data in this field describes the current weather (ex. cloudy, clear, etc.).
+ */
+ WEATHER_TERM("weatherTerm"),
+
+ /**
+ * The data in this field describes the current humidity value.
+ */
+ HUMIDITY("humidity"),
+
+
+ ;
+
+ private final String internalName;
+
+ private MetadataType(String internalName) {
+ this.internalName = internalName;
+ }
+
+ public String toString() {
+ return this.internalName;
+ }
+
+ public static MetadataType valueForString(String value) {
+ if(value == null){
+ return null;
+ }
+
+ for (MetadataType anEnum : EnumSet.allOf(MetadataType.class)) {
+ if (anEnum.toString().equals(value)) {
+ return anEnum;
+ }
+ }
+ return null;
+ }
+}