summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilal Alsharifi <bilal.alsharifi@gmail.com>2019-09-12 15:11:49 -0400
committerBilal Alsharifi <bilal.alsharifi@gmail.com>2019-09-12 15:11:49 -0400
commitb7fb2674c58902876f1693344800047ca24e6f1c (patch)
tree6fc1903d7db8a93bdfab5eec0a2df326422e4b36
parentae231318f1b6e9f862bce1561fce2eca53115cb3 (diff)
parent09b2577cc39ce8fddc7bd79c5f679baadae900ed (diff)
downloadsdl_android-b7fb2674c58902876f1693344800047ca24e6f1c.tar.gz
Merge branch 'develop' into bugfix/resume_secondary_transport
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Alert.json1
-rw-r--r--android/sdl_android/src/androidTest/assets/json/CancelInteraction.json14
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json23
-rw-r--r--android/sdl_android/src/androidTest/assets/json/PerformInteraction.json1
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json14
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json1
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Slider.json3
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java62
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java226
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java223
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java25
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java72
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java15
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java93
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java66
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java99
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java135
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java85
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java75
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java18
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java3
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java49
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java14
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java122
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java116
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java13
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java42
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java9
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java9
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java102
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java94
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java15
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java86
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java79
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java126
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java54
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java46
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java120
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java132
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java52
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java26
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java95
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java32
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java65
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java65
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java99
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java18
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java69
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java28
87 files changed, 3583 insertions, 377 deletions
diff --git a/android/sdl_android/src/androidTest/assets/json/Alert.json b/android/sdl_android/src/androidTest/assets/json/Alert.json
index 7e8397a62..75ff2ca50 100644
--- a/android/sdl_android/src/androidTest/assets/json/Alert.json
+++ b/android/sdl_android/src/androidTest/assets/json/Alert.json
@@ -9,6 +9,7 @@
"alertText2":"Line 2",
"alertText3":"Line 3",
"progressIndicator":true,
+ "cancelID":45,
"alertIcon":{
"value":"alertIconImage1.png",
"imageType":"DYNAMIC"
diff --git a/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json b/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json
new file mode 100644
index 000000000..dc420ad8f
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json
@@ -0,0 +1,14 @@
+{
+ "request":{
+ "name":"CancelInteraction",
+ "correlationID":554,
+ "parameters":{
+ "cancelID":6052,
+ "functionID":12
+ }
+ },
+ "response":{
+ "name":"CancelInteractionResponse",
+ "correlationID":554
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json
new file mode 100644
index 000000000..5ab1c6c41
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json
@@ -0,0 +1,23 @@
+{
+ "request":{
+ "name":"GetInteriorVehicleDataConsent",
+ "correlationID":168,
+ "parameters":{
+ "moduleType":"CLIMATE",
+ "moduleIds":[
+ "A0A",
+ "R0A"
+ ]
+ }
+ },
+ "response":{
+ "name":"GetInteriorVehicleDataConsent",
+ "correlationID":169,
+ "parameters":{
+ "allowed":[
+ true,
+ true
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json b/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
index b8965ee61..583a72b1c 100644
--- a/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
+++ b/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
@@ -43,6 +43,7 @@
}
],
"timeout":0,
+ "cancelID":45,
"vrHelp":[
{
"position":7,
diff --git a/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json b/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json
new file mode 100644
index 000000000..9f9f60096
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json
@@ -0,0 +1,14 @@
+{
+ "request":{
+ "name":"ReleaseInteriorVehicleDataModule",
+ "correlationID":172,
+ "parameters":{
+ "moduleType":"CLIMATE",
+ "moduleIds":"A0A"
+ }
+ },
+ "response":{
+ "name":"ReleaseInteriorVehicleDataModule",
+ "correlationID":173
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json b/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
index f86dc188c..3b14d1a43 100644
--- a/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
+++ b/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
@@ -5,6 +5,7 @@
"parameters":{
"scrollableMessageBody":"Sample body text",
"timeout":1000,
+ "cancelID":45,
"softButtons":[
{
"isHighlighted":true,
diff --git a/android/sdl_android/src/androidTest/assets/json/Slider.json b/android/sdl_android/src/androidTest/assets/json/Slider.json
index 38f033df4..5b69f4728 100644
--- a/android/sdl_android/src/androidTest/assets/json/Slider.json
+++ b/android/sdl_android/src/androidTest/assets/json/Slider.json
@@ -12,7 +12,8 @@
"Header Line 4"
],
"position":11,
- "timeout":30000
+ "timeout":30000,
+ "cancelID":45
}
},
"response":{
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
index e52f7b273..b8af1a68c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
@@ -52,8 +52,14 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.concurrent.LinkedBlockingQueue;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class ChoiceSetManagerTests extends AndroidTestCase2 {
@@ -98,7 +104,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertEquals(csm.nextChoiceId, 1);
assertTrue(csm.executor.isShutdown());
- assertTrue(csm.isVROptional);
+ assertFalse(csm.isVROptional);
assertEquals(csm.getState(), BaseSubManager.SHUTDOWN);
@@ -232,7 +238,61 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
for (ChoiceCell cell : returnedChoices){
assertEquals(cell.getText(), "test2");
}
+ }
+
+ public void testPresentingKeyboardShouldReturnCancelIDIfKeyboardCanBeSent() {
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+
+ ChoiceSetManager newCSM = new ChoiceSetManager(internalInterface, fileManager);
+ ChoiceSetManager partialMockCSM = spy(newCSM);
+ when(partialMockCSM.getState()).thenReturn(BaseSubManager.READY);
+ Integer cancelId = partialMockCSM.presentKeyboard("initial text", mock(KeyboardProperties.class), mock(KeyboardListener.class));
+ assertNotNull(cancelId);
}
+ public void testPresentingKeyboardShouldNotReturnCancelIDIfKeyboardCannotBeSent() {
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+
+ ChoiceSetManager newCSM = new ChoiceSetManager(internalInterface, fileManager);
+ ChoiceSetManager partialMockCSM = spy(newCSM);
+ when(partialMockCSM.getState()).thenReturn(BaseSubManager.ERROR);
+
+ Integer cancelId = partialMockCSM.presentKeyboard("initial text", mock(KeyboardProperties.class), mock(KeyboardListener.class));
+ assertNull(cancelId);
+ }
+
+ public void testDismissingExecutingKeyboard(){
+ Integer testCancelID = 42;
+ PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
+ doReturn(testCancelID).when(testKeyboardOp).getCancelID();
+ csm.currentlyPresentedKeyboardOperation = testKeyboardOp;
+ csm.dismissKeyboard(testCancelID);
+ verify(testKeyboardOp, times(1)).dismissKeyboard();
+ }
+
+ public void testDismissingQueuedKeyboard(){
+ Integer testCancelID = 42;
+
+ // Currently executing operation
+ PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
+ doReturn(true).when(testKeyboardOp).isExecuting();
+ doReturn(96).when(testKeyboardOp).getCancelID();
+ csm.currentlyPresentedKeyboardOperation = testKeyboardOp;
+
+ // Queued operations
+ PresentKeyboardOperation testKeyboardOp2 = mock(PresentKeyboardOperation.class);
+ doReturn(true).when(testKeyboardOp2).isExecuting();
+ doReturn(testCancelID).when(testKeyboardOp2).getCancelID();
+ LinkedBlockingQueue<Runnable> testOperationQueue = new LinkedBlockingQueue<>();
+ testOperationQueue.add(testKeyboardOp2);
+ csm.operationQueue = testOperationQueue;
+
+ // Queued operation should be canceled
+ csm.dismissKeyboard(testCancelID);
+ verify(testKeyboardOp, times(0)).dismissKeyboard();
+ verify(testKeyboardOp2, times(1)).dismissKeyboard();
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
index 3d7a30a79..900336594 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
@@ -46,6 +46,7 @@ public class ChoiceSetTests extends AndroidTestCase2 {
private ChoiceSetLayout layout;
private List<ChoiceCell> choices;
private Integer defaultTimeout;
+ private Boolean canceledHandlerCalled;
@Override
public void setUp() throws Exception{
@@ -55,6 +56,7 @@ public class ChoiceSetTests extends AndroidTestCase2 {
layout = ChoiceSetLayout.CHOICE_SET_LAYOUT_LIST;
defaultTimeout = 10;
choices = Arrays.asList(new ChoiceCell(Test.GENERAL_STRING), new ChoiceCell(Test.GENERAL_STRING));
+ canceledHandlerCalled = false;
}
@Override
@@ -98,4 +100,18 @@ public class ChoiceSetTests extends AndroidTestCase2 {
assertEquals(choiceSet2.getChoices(), choices);
assertEquals(choiceSet2.getChoiceSetSelectionListener(), listener);
}
+
+ public void testCancelingChoiceSet() {
+ ChoiceSet choiceSet = new ChoiceSet(Test.GENERAL_STRING, choices, listener);
+
+ choiceSet.canceledListener = new ChoiceSetCanceledListener() {
+ @Override
+ public void onChoiceSetCanceled() {
+ canceledHandlerCalled = true;
+ }
+ };
+
+ choiceSet.cancel();
+ assertTrue(canceledHandlerCalled);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
index ea5204eae..d8cf5be9d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
@@ -36,34 +36,60 @@
package com.smartdevicelink.managers.screen.choiceset;
import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
+import com.smartdevicelink.test.Test;
+
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
import java.util.Collections;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
private PresentChoiceSetOperation presentChoiceSetOperation;
+ private ChoiceSet choiceSet;
+ private ISdl internalInterface;
+ private KeyboardListener keyboardListener;
+ private ChoiceSetSelectionListener choiceSetSelectionListener;
+
+ private ExecutorService executor;
@Override
public void setUp() throws Exception{
super.setUp();
- ISdl internalInterface = mock(ISdl.class);
- KeyboardListener keyboardListener = mock(KeyboardListener.class);
- ChoiceSetSelectionListener choiceSetSelectionListener = mock(ChoiceSetSelectionListener.class);
+ internalInterface = mock(ISdl.class);
+
+ keyboardListener = mock(KeyboardListener.class);
+ choiceSetSelectionListener = mock(ChoiceSetSelectionListener.class);
+
ChoiceCell cell1 = new ChoiceCell("Cell1");
cell1.setChoiceId(0);
- ChoiceSet choiceSet = new ChoiceSet("Test", Collections.singletonList(cell1), choiceSetSelectionListener);
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener);
+ choiceSet = new ChoiceSet("Test", Collections.singletonList(cell1), choiceSetSelectionListener);
+
+ executor = Executors.newCachedThreadPool();
}
@Override
@@ -71,35 +97,209 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
super.tearDown();
}
- public void testGetLayoutMode(){
+ private KeyboardProperties getKeyBoardProperties(){
+ KeyboardProperties properties = new KeyboardProperties();
+ properties.setLanguage(Language.EN_US);
+ properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
+ properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
+ return properties;
+ }
+
+ public void testGetLayoutMode(){
// First we will check knowing our keyboard listener is NOT NULL
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
presentChoiceSetOperation.keyboardListener = null;
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_ONLY);
}
public void testGetPerformInteraction(){
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
PerformInteraction pi = presentChoiceSetOperation.getPerformInteraction();
assertEquals(pi.getInitialText(), "Test");
assertNull(pi.getHelpPrompt());
assertNull(pi.getTimeoutPrompt());
assertNull(pi.getVrHelp());
assertEquals(pi.getTimeout(), Integer.valueOf(10000));
+ assertEquals(pi.getCancelID(), Test.GENERAL_INTEGER);
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
}
public void testSetSelectedCellWithId(){
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
assertNull(presentChoiceSetOperation.selectedCellRow);
presentChoiceSetOperation.setSelectedCellWithId(0);
assertEquals(presentChoiceSetOperation.selectedCellRow, Integer.valueOf(0));
}
- private KeyboardProperties getKeyBoardProperties(){
- KeyboardProperties properties = new KeyboardProperties();
- properties.setLanguage(Language.EN_US);
- properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
- properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
- return properties;
+ public void testCancelingChoiceSetSuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ executor.execute(presentChoiceSetOperation);
+
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(true);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
}
-}
+ public void testCancelingChoiceSetUnsuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(false);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+ }
+
+ public void testCancelingChoiceSetIfThreadHasFinished(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ presentChoiceSetOperation.finishOperation();
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+ }
+
+ public void testCancelingChoiceSetIfThreadHasNotYetRun(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+
+ // Once the operation has started
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeatureButThreadIsNotRunning(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ // Once the operation has started
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
index ccf498293..486a1c361 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
@@ -36,27 +36,66 @@
package com.smartdevicelink.managers.screen.choiceset;
import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
+import com.smartdevicelink.test.Test;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class PresentKeyboardOperationTests extends AndroidTestCase2 {
private PresentKeyboardOperation presentKeyboardOperation;
+ private KeyboardListener keyboardListener;
+ private ISdl internalInterface;
+
+ private ExecutorService executor;
@Override
public void setUp() throws Exception{
super.setUp();
- ISdl internalInterface = mock(ISdl.class);
- KeyboardListener keyboardListener = mock(KeyboardListener.class);
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener);
+ internalInterface = mock(ISdl.class);
+ keyboardListener = mock(KeyboardListener.class);
+
+ Answer<Void> setGlobalPropertiesAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ SetGlobalProperties setGlobalProperties = (SetGlobalProperties) args[0];
+
+ RPCResponse response = new RPCResponse(FunctionID.SET_GLOBAL_PROPERTIES.toString());
+ response.setSuccess(true);
+ setGlobalProperties.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(setGlobalPropertiesAnswer).when(internalInterface).sendRPC(any(SetGlobalProperties.class));
+
+ executor = Executors.newCachedThreadPool();
}
@Override
@@ -64,20 +103,186 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
super.tearDown();
}
+ private KeyboardProperties getKeyBoardProperties(){
+ KeyboardProperties properties = new KeyboardProperties();
+ properties.setLanguage(Language.EN_US);
+ properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
+ properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
+ return properties;
+ }
+
public void testGetPerformInteraction(){
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener, Test.GENERAL_INTEGER);
+
PerformInteraction pi = presentKeyboardOperation.getPerformInteraction();
assertEquals(pi.getInitialText(), "Test");
assertNull(pi.getHelpPrompt());
assertNull(pi.getTimeoutPrompt());
assertNull(pi.getVrHelp());
assertEquals(pi.getInteractionLayout(), LayoutMode.KEYBOARD);
+ assertEquals(pi.getCancelID(), Test.GENERAL_INTEGER);
}
- private KeyboardProperties getKeyBoardProperties(){
- KeyboardProperties properties = new KeyboardProperties();
- properties.setLanguage(Language.EN_US);
- properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
- properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
- return properties;
+ public void testCancelingKeyboardSuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(true);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+ }
+
+ public void testCancelingKeyboardUnsuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ presentKeyboardOperation.dismissKeyboard();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(false);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+ }
+
+ public void testCancelingKeyboardIfThreadHasFinished(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ presentKeyboardOperation.finishOperation();
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+ }
+
+ public void testCancelingKeyboardIfThreadHasNotYetRun(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ // Once the operation has started
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeatureButThreadIsNotRunning(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ // Once the operation has started
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
index 375de9362..5cb0cf719 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
@@ -170,6 +170,24 @@ public final class JsonUtils {
return null;
}
+
+ public static List<Boolean> readBooleanListFromJsonObject(JSONObject json, String key){
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+
+ if(jsonArray != null){
+ int len = jsonArray.length();
+ List<Boolean> result = new ArrayList<>(len);
+ for(int i=0; i<len; i++){
+ try {
+ Boolean bool = jsonArray.getBoolean(i);
+ result.add(bool);
+ } catch (JSONException e) {}
+ }
+ return result;
+ }
+
+ return null;
+ }
public static List<Double> readDoubleListFromJsonObject(JSONObject json, String key){
JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
index b3d090842..793b2b035 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
@@ -36,6 +36,7 @@ import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.EqualizerSettings;
+import com.smartdevicelink.proxy.rpc.Grid;
import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities;
@@ -57,6 +58,7 @@ import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.proxy.rpc.NavigationInstruction;
import com.smartdevicelink.proxy.rpc.NavigationServiceData;
@@ -76,6 +78,7 @@ import com.smartdevicelink.proxy.rpc.ScreenParams;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SeatControlCapabilities;
import com.smartdevicelink.proxy.rpc.SeatControlData;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
import com.smartdevicelink.proxy.rpc.SeatMemoryAction;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
import com.smartdevicelink.proxy.rpc.SisData;
@@ -424,8 +427,10 @@ public class Test {
public static final HapticRect GENERAL_HAPTIC_RECT = new HapticRect();
public static final FuelType GENERAL_FUELTYPE = FuelType.GASOLINE;
public static final LockScreenConfig GENERAL_LOCKSCREENCONFIG = new LockScreenConfig();
+ public static final Grid GENERAL_GRID = new Grid();
+ public static final SeatLocation GENERAL_SEAT_LOCATION = new SeatLocation();
+ public static final ModuleInfo GENERAL_MODULE_INFO = new ModuleInfo();
public static final WindowType GENERAL_WINDOW_TYPE = WindowType.MAIN;
-
public static final List<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>();
@@ -473,6 +478,8 @@ public class Test {
public static final List<WeatherData> GENERAL_WEATHERDATA_LIST = Arrays.asList(GENERAL_WEATHERDATA);
public static final List<WeatherAlert> GENERAL_WEATHERALERT_LIST = Arrays.asList(GENERAL_WEATHERALERT);
public static final List<NavigationInstruction> GENERAL_NAVIGATION_INSTRUCTION_LIST = Arrays.asList(GENERAL_NAVIGATION_INSTRUCTION);
+ public static final List<SeatLocation> GENERAL_SEAT_LIST = new ArrayList<>(1);
+ public static final List<Boolean> GENERAL_BOOLEAN_LIST = Arrays.asList(new Boolean[]{Boolean.TRUE, Boolean.TRUE});
public static final List<Integer> GENERAL_AVAILABLE_HD_CHANNELS_LIST = Arrays.asList(new Integer[]{ 1, 2});
public static final List<ImageType> GENERAL_IMAGE_TYPE_LIST = Arrays.asList(new ImageType[]{ImageType.DYNAMIC, ImageType.STATIC});
public static final List<WindowTypeCapabilities> GENERAL_WINDOW_TYPE_CAPABILITIES_LIST = new ArrayList<WindowTypeCapabilities>(1);
@@ -515,6 +522,7 @@ public class Test {
public static final JSONArray JSON_RADIOCONTROLCAPABILITIES = new JSONArray();
public static final JSONArray JSON_CLIMATECONTROLCAPABILITIES = new JSONArray();
public static final JSONArray JSON_TEXTFIELDTYPES = new JSONArray();
+ public static final JSONArray JSON_SEAT_LOCATIONS = new JSONArray();
public static final JSONObject JSON_TURN = new JSONObject();
public static final JSONObject JSON_IMAGE = new JSONObject();
public static final JSONObject JSON_CHOICE = new JSONObject();
@@ -542,6 +550,8 @@ public class Test {
public static final JSONObject JSON_RGBCOLOR = new JSONObject();
public static final JSONObject JSON_DAYCOLORSCHEME = new JSONObject();
public static final JSONObject JSON_NIGHTCOLORSCHEME = new JSONObject();
+ public static final JSONObject JSON_GRID = new JSONObject();
+ public static final JSONObject JSON_MODULE_INFO = new JSONObject();
public static final JSONArray JSON_IMAGE_TYPE_SUPPORTED = new JSONArray();
public static final JSONObject JSON_WINDOW_TYPE_CAPABILITIES = new JSONObject();
public static final JSONArray JSON_WINDOW_TYPE_CAPABILITIES_LIST = new JSONArray();
@@ -550,7 +560,6 @@ public class Test {
public static final JSONArray JSON_IMAGE_TYPES = new JSONArray();
public static final JSONObject JSON_DISPLAYCAPABILITY = new JSONObject();
public static final JSONArray JSON_DISPLAYCAPABILITY_LIST = new JSONArray();
-
static {
GENERAL_TOUCHEVENTCAPABILITIES.setDoublePressAvailable(GENERAL_BOOLEAN);
GENERAL_TOUCHEVENTCAPABILITIES.setMultiTouchAvailable(GENERAL_BOOLEAN);
@@ -721,6 +730,7 @@ public class Test {
GENERAL_MEDIACLOCKFORMAT_LIST.add(MediaClockFormat.CLOCK1);
GENERAL_MEDIACLOCKFORMAT_LIST.add(MediaClockFormat.CLOCK2);
+ GENERAL_SEAT_LIST.add(GENERAL_SEAT_LOCATION);
GENERAL_IMAGE.setValue(GENERAL_STRING);
GENERAL_IMAGE.setImageType(GENERAL_IMAGETYPE);
@@ -1094,6 +1104,10 @@ public class Test {
GENERAL_NAVIGATION_INSTRUCTION.setDrivingSide(GENERAL_DIRECTION);
GENERAL_NAVIGATION_INSTRUCTION.setDetails(GENERAL_STRING);
GENERAL_NAVIGATION_INSTRUCTION.setImage(GENERAL_IMAGE);
+ GENERAL_MODULE_INFO.setModuleId(Test.GENERAL_STRING);
+ GENERAL_MODULE_INFO.setModuleLocation(Test.GENERAL_GRID);
+ GENERAL_MODULE_INFO.setModuleServiceArea(Test.GENERAL_GRID);
+ GENERAL_MODULE_INFO.setMultipleAccessAllowance(Test.GENERAL_BOOLEAN);
try {
@@ -1323,6 +1337,13 @@ public class Test {
JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ALBUM);
JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ARTIST);
+ JSON_SEAT_LOCATIONS.put(JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_ID, Test.GENERAL_STRING);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_LOCATION, Test.JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, Test.JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, Test.GENERAL_BOOLEAN);
+
+
} catch (JSONException e) {
Log.e("Test", "Static Json Construction Failed.", e);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
index a96dca9c6..965098c3f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
@@ -32,6 +32,7 @@ import com.smartdevicelink.proxy.rpc.EmergencyEvent;
import com.smartdevicelink.proxy.rpc.EqualizerSettings;
import com.smartdevicelink.proxy.rpc.FuelRange;
import com.smartdevicelink.proxy.rpc.GPSData;
+import com.smartdevicelink.proxy.rpc.Grid;
import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities;
@@ -53,6 +54,7 @@ import com.smartdevicelink.proxy.rpc.MediaServiceData;
import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.MyKey;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.proxy.rpc.NavigationInstruction;
@@ -73,6 +75,7 @@ import com.smartdevicelink.proxy.rpc.ScreenParams;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SeatControlCapabilities;
import com.smartdevicelink.proxy.rpc.SeatControlData;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
import com.smartdevicelink.proxy.rpc.SeatMemoryAction;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
import com.smartdevicelink.proxy.rpc.SisData;
@@ -3787,4 +3790,73 @@ public class Validator{
return true;
}
+
+ public static boolean validateGrid(Grid g1, Grid g2) {
+ String tag = "validateGrid";
+ if (g1 == null) {
+ return (g2 == null);
+ }
+ if (g2 == null) {
+ return (g1 == null);
+ }
+ if (g1.getColumn() != g2.getColumn()) {
+ log(tag, "Columns do not match");
+ return false;
+ }
+ if (g1.getRow() != g2.getRow()) {
+ log(tag, "Rows do not match");
+ return false;
+ }
+ if (g1.getLevel() != g2.getLevel()) {
+ log(tag, "Levels do not match");
+ return false;
+ }
+ if (g1.getColumnSpan() != g2.getColumnSpan()) {
+ log(tag, "Column spans do not match");
+ return false;
+ }
+ if (g1.getRowSpan() != g2.getRowSpan()) {
+ log(tag, "Row spans do not match");
+ return false;
+ }
+ if (g1.getLevelSpan() != g2.getLevelSpan()) {
+ log(tag, "Level spans do not match");
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateModuleInfo(ModuleInfo m1, ModuleInfo m2) {
+ if (m1 == null) {
+ return (m2 == null);
+ }
+ if (m2 == null) {
+ return (m1 == null);
+ }
+ if (!m1.getModuleId().equals(m2.getModuleId())) {
+ return false;
+ }
+ if (!m1.getMultipleAccessAllowance().equals(m2.getMultipleAccessAllowance())) {
+ return false;
+ }
+ if (!validateGrid(m1.getModuleLocation(), m2.getModuleLocation())) {
+ return false;
+ }
+ if (!validateGrid(m1.getModuleServiceArea(), m2.getModuleServiceArea())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateSeatLocation(SeatLocation cap1, SeatLocation cap2) {
+ if (cap1 == null) {
+ return (cap2 == null);
+ }
+ if (cap2 == null) {
+ return (cap1 == null);
+ }
+ return validateGrid(cap1.getGrid(), cap2.getGrid());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
index 524a6bde2..5351bf7a1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
@@ -1,14 +1,18 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.AudioControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -30,6 +34,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
msg.setEqualizerAvailable(Test.GENERAL_BOOLEAN);
msg.setVolumeAvailable(Test.GENERAL_BOOLEAN);
msg.setEqualizerMaxChannelId(Test.GENERAL_INT);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
/**
@@ -44,6 +49,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
Boolean volumeAvailable = msg.getVolumeAvailable();
Boolean equalizerAvailable = msg.getEqualizerAvailable();
int equalizerMaxChannelId = msg.getEqualizerMaxChannelId();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
@@ -52,6 +58,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) volumeAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) equalizerAvailable);
assertEquals(Test.MATCH, Test.GENERAL_INT, equalizerMaxChannelId);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
AudioControlCapabilities msg = new AudioControlCapabilities();
@@ -63,6 +70,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
assertNull(Test.NULL, msg.getVolumeAvailable());
assertNull(Test.NULL, msg.getEqualizerAvailable());
assertNull(Test.NULL, msg.getEqualizerMaxChannelId());
+ assertNull(Test.NULL, msg.getModuleInfo());
}
public void testJson() {
@@ -76,6 +84,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
reference.put(AudioControlCapabilities.KEY_VOLUME_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(AudioControlCapabilities.KEY_EQUALIZER_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(AudioControlCapabilities.KEY_EQUALIZER_MAX_CHANNEL_ID, Test.GENERAL_INT);
+ reference.put(AudioControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -83,9 +92,15 @@ public class AudioControlCapabilitiesTests extends TestCase {
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
-
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
-
+ if (key.equals(AudioControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch (JSONException e) {
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
index 4365ceafa..71f7d3ecf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
@@ -1,15 +1,19 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -28,6 +32,7 @@ public class ButtonCapabilitiesTests extends TestCase{
msg.setName(Test.GENERAL_BUTTONNAME);
msg.setShortPressAvailable(Test.GENERAL_BOOLEAN);
msg.setUpDownAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
@@ -40,12 +45,14 @@ public class ButtonCapabilitiesTests extends TestCase{
boolean longPress = msg.getLongPressAvailable();
boolean upDown = msg.getUpDownAvailable();
ButtonName buttonName = msg.getName();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, shortPress);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, longPress);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, upDown);
assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, buttonName);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
ButtonCapabilities msg = new ButtonCapabilities();
@@ -65,15 +72,24 @@ public class ButtonCapabilitiesTests extends TestCase{
reference.put(ButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ButtonCapabilities.KEY_UP_DOWN_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ButtonCapabilities.KEY_NAME, Test.GENERAL_BUTTONNAME);
+ reference.put(ButtonCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ if (key.equals(ButtonCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch(JSONException e){
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
index eb182f31c..a33f35b27 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
@@ -1,10 +1,13 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -13,6 +16,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -44,6 +48,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
msg.setHeatedWindshieldAvailable(Test.GENERAL_BOOLEAN);
msg.setHeatedRearWindowAvailable(Test.GENERAL_BOOLEAN);
msg.setHeatedMirrorsAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
msg.setClimateEnableAvailable(Test.GENERAL_BOOLEAN);
}
@@ -68,6 +73,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
boolean heatedWindshieldAvailable = msg.getHeatedWindshieldAvailable();
boolean heatedRearWindowAvailable = msg.getHeatedRearWindowAvailable();
boolean heatedMirrorsAvailable = msg.getHeatedMirrorsAvailable();
+ ModuleInfo info = msg.getModuleInfo();
boolean climateEnableAvailable = msg.getClimateEnableAvailable();
// Valid Tests
@@ -81,6 +87,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dualModeEnableAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, defrostZoneAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ventilationModeAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE_LIST.size(), defrostZone.size());
assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE_LIST.size(), ventilationMode.size());
@@ -117,6 +124,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertNull(Test.NULL, msg.getHeatedWindshieldAvailable());
assertNull(Test.NULL, msg.getHeatedRearWindowAvailable());
assertNull(Test.NULL, msg.getHeatedMirrorsAvailable());
+ assertNull(Test.NULL, msg.getModuleInfo());
assertNull(Test.NULL, msg.getClimateEnableAvailable());
}
@@ -140,6 +148,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
reference.put(ClimateControlCapabilities.KEY_HEATED_WIND_SHIELD_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ClimateControlCapabilities.KEY_HEATED_REAR_WINDOW_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ClimateControlCapabilities.KEY_HEATED_MIRRORS_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
reference.put(ClimateControlCapabilities.KEY_CLIMATE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
@@ -175,6 +184,12 @@ public class ClimateControlCapabilitiesTests extends TestCase{
ventilationModeListTest.add( (VentilationMode)ventilationModeArrayTest.get(index) );
}
assertTrue(Test.TRUE, ventilationModeListReference.containsAll(ventilationModeListTest) && ventilationModeListTest.containsAll(ventilationModeListReference));
+ } else if (key.equals(ClimateControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
} else{
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java
new file mode 100644
index 000000000..32e745d10
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java
@@ -0,0 +1,93 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+public class GridTests extends TestCase {
+
+ private Grid msg;
+
+ @Override
+ public void setUp() {
+ msg = new Grid();
+ msg.setColumn(Test.GENERAL_INT);
+ msg.setRow(Test.GENERAL_INT);
+ msg.setLevel(Test.GENERAL_INT);
+ msg.setColumnSpan(Test.GENERAL_INT);
+ msg.setRowSpan(Test.GENERAL_INT);
+ msg.setLevelSpan(Test.GENERAL_INT);
+ }
+
+ public void testRpcValues() {
+ int col = msg.getColumn();
+ int row = msg.getRow();
+ int level = msg.getLevel();
+ int colSpan = msg.getColumnSpan();
+ int rowSpan = msg.getRowSpan();
+ int levelSpan = msg.getLevelSpan();
+
+ //valid tests
+ assertEquals(Test.MATCH, col, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, row, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, level, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, colSpan, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, rowSpan, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, levelSpan, Test.GENERAL_INT);
+
+ //null tests
+ Grid msg = new Grid();
+ assertNull(Test.NULL, msg.getColumn());
+ assertNull(Test.NULL, msg.getRow());
+ assertNull(Test.NULL, msg.getLevel());
+ assertNull(Test.NULL, msg.getColumnSpan());
+ assertNull(Test.NULL, msg.getRowSpan());
+ assertNull(Test.NULL, msg.getLevelSpan());
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(Grid.KEY_COLUMN, Test.GENERAL_INT);
+ original.put(Grid.KEY_ROW, Test.GENERAL_INT);
+ original.put(Grid.KEY_LEVEL, Test.GENERAL_INT);
+ original.put(Grid.KEY_COL_SPAN, Test.GENERAL_INT);
+ original.put(Grid.KEY_ROW_SPAN, Test.GENERAL_INT);
+ original.put(Grid.KEY_LEVEL_SPAN, Test.GENERAL_INT);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(serialized.length(), original.length());
+
+ Iterator<String> iter = original.keys();
+ String key = "";
+ Grid grid1, grid2;
+ while (iter.hasNext()) {
+ key = iter.next();
+ grid1 = new Grid(JsonRPCMarshaller.deserializeJSONObject(original));
+ grid2 = new Grid(JsonRPCMarshaller.deserializeJSONObject(serialized));
+ if (key.equals(Grid.KEY_COLUMN)) {
+ assertEquals(Test.MATCH, grid1.getColumn(), grid2.getColumn());
+ } else if (key.equals(Grid.KEY_ROW)) {
+ assertEquals(Test.MATCH, grid1.getRow(), grid2.getRow());
+ } else if (key.equals(Grid.KEY_LEVEL)) {
+ assertEquals(Test.MATCH, grid1.getLevel(), grid2.getLevel());
+ } else if (key.equals(Grid.KEY_COL_SPAN)) {
+ assertEquals(Test.MATCH, grid1.getColumnSpan(), grid2.getColumnSpan());
+ } else if (key.equals(Grid.KEY_ROW_SPAN)) {
+ assertEquals(Test.MATCH, grid1.getRowSpan(), grid2.getRowSpan());
+ } else if (key.equals(Grid.KEY_LEVEL_SPAN)) {
+ assertEquals(Test.MATCH, grid1.getLevelSpan(), grid2.getLevelSpan());
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
index 620868b40..aa49bf0ac 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
@@ -1,14 +1,18 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -27,6 +31,7 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
msg.setDistanceUnitAvailable(Test.GENERAL_BOOLEAN);
msg.setTemperatureUnitAvailable(Test.GENERAL_BOOLEAN);
msg.setDisplayModeUnitAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
/**
@@ -38,12 +43,14 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
Boolean distanceUnitAvailable = msg.getDistanceUnitAvailable();
Boolean temperatureUnitAvailable = msg.getTemperatureUnitAvailable();
Boolean displayModeUnitAvailable = msg.getDisplayModeUnitAvailable();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) distanceUnitAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) temperatureUnitAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) displayModeUnitAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
HMISettingsControlCapabilities msg = new HMISettingsControlCapabilities();
@@ -53,6 +60,7 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
assertNull(Test.NULL, msg.getDistanceUnitAvailable());
assertNull(Test.NULL, msg.getTemperatureUnitAvailable());
assertNull(Test.NULL, msg.getDisplayModeUnitAvailable());
+ assertNull(Test.NULL, msg.getModuleInfo());
}
public void testJson() {
@@ -63,6 +71,7 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
reference.put(HMISettingsControlCapabilities.KEY_DISTANCE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(HMISettingsControlCapabilities.KEY_TEMPERATURE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(HMISettingsControlCapabilities.KEY_DISPLAY_MODE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(HMISettingsControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -70,8 +79,15 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
-
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ if (key.equals(HMISettingsControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch (JSONException e) {
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
index 4ebd7f467..ad6e5a4ac 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
@@ -3,6 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.LightCapabilities;
import com.smartdevicelink.proxy.rpc.LightControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
import com.smartdevicelink.test.Validator;
@@ -13,6 +14,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -30,6 +32,7 @@ public class LightControlCapabilitiesTests extends TestCase {
msg.setModuleName(Test.GENERAL_STRING);
msg.setSupportedLights(Test.GENERAL_LIGHTCAPABILITIES_LIST);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
/**
@@ -39,10 +42,12 @@ public class LightControlCapabilitiesTests extends TestCase {
// Test Values
String moduleName = msg.getModuleName();
List<LightCapabilities> supportedLights = msg.getSupportedLights();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
assertEquals(Test.MATCH, Test.GENERAL_LIGHTCAPABILITIES_LIST.size(), supportedLights.size());
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
assertTrue(Test.TRUE, Validator.validateLightCapabilitiesList(Test.GENERAL_LIGHTCAPABILITIES_LIST, supportedLights));
@@ -52,6 +57,7 @@ public class LightControlCapabilitiesTests extends TestCase {
assertNull(Test.NULL, msg.getModuleName());
assertNull(Test.NULL, msg.getSupportedLights());
+ assertNull(Test.NULL, msg.getModuleInfo());
}
public void testJson() {
@@ -60,6 +66,7 @@ public class LightControlCapabilitiesTests extends TestCase {
try {
reference.put(LightControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
reference.put(LightControlCapabilities.KEY_SUPPORTED_LIGHTS, Test.GENERAL_LIGHTCAPABILITIES_LIST);
+ reference.put(LightControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -75,7 +82,14 @@ public class LightControlCapabilitiesTests extends TestCase {
for (LightCapabilities lc : lcReference) {
assertTrue(Validator.validateLightCapabilities(lc, new LightCapabilities(JsonRPCMarshaller.deserializeJSONObject(lsArray.getJSONObject(i++)))));
}
- } else {
+ } else if(key.equals(LightControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ }
+ else {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
index b553587ad..7f4a78b27 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
@@ -39,6 +39,7 @@ public class ModuleDataTests extends TestCase {
msg.setAudioControlData(Test.GENERAL_AUDIOCONTROLDATA);
msg.setHmiSettingsControlData(Test.GENERAL_HMISETTINGSCONTROLDATA);
msg.setLightControlData(Test.GENERAL_LIGHTCONTROLDATA);
+ msg.setModuleId(Test.GENERAL_STRING);
}
/**
@@ -53,6 +54,7 @@ public class ModuleDataTests extends TestCase {
AudioControlData audioControlData = msg.getAudioControlData();
HMISettingsControlData hmiSettingsControlData = msg.getHmiSettingsControlData();
LightControlData lightControlData = msg.getLightControlData();
+ String moduleId = msg.getModuleId();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, moduleType);
@@ -62,6 +64,7 @@ public class ModuleDataTests extends TestCase {
assertTrue(Test.TRUE, Validator.validateAudioControlData(Test.GENERAL_AUDIOCONTROLDATA, audioControlData));
assertTrue(Test.TRUE, Validator.validateHMISettingsControlData(Test.GENERAL_HMISETTINGSCONTROLDATA, hmiSettingsControlData));
assertTrue(Test.TRUE, Validator.validateLightControlData(Test.GENERAL_LIGHTCONTROLDATA, lightControlData));
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleId);
// Invalid/Null Tests
ModuleData msg = new ModuleData();
@@ -74,6 +77,7 @@ public class ModuleDataTests extends TestCase {
assertNull(Test.NULL, msg.getAudioControlData());
assertNull(Test.NULL, msg.getHmiSettingsControlData());
assertNull(Test.NULL, msg.getLightControlData());
+ assertNull(Test.NULL, msg.getModuleId());
}
public void testJson() {
@@ -87,6 +91,7 @@ public class ModuleDataTests extends TestCase {
reference.put(ModuleData.KEY_AUDIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_AUDIOCONTROLDATA.getStore()));
reference.put(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_HMISETTINGSCONTROLDATA.getStore()));
reference.put(ModuleData.KEY_LIGHT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LIGHTCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_MODULE_ID, Test.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java
new file mode 100644
index 000000000..508c216f6
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java
@@ -0,0 +1,66 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ModuleInfoTests extends TestCase {
+ private ModuleInfo msg;
+
+ @Override
+ public void setUp() {
+ msg = new ModuleInfo();
+ msg.setModuleId(Test.GENERAL_STRING);
+ msg.setModuleLocation(Test.GENERAL_GRID);
+ msg.setModuleServiceArea(Test.GENERAL_GRID);
+ msg.setMultipleAccessAllowance(Test.GENERAL_BOOLEAN);
+ }
+
+ public void testRpcValues() {
+ String id = msg.getModuleId();
+ Grid loc = msg.getModuleLocation();
+ Grid area = msg.getModuleServiceArea();
+ boolean isAllowed = msg.getMultipleAccessAllowance();
+
+ //valid tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, id);
+ assertEquals(Test.MATCH, Test.GENERAL_GRID, loc);
+ assertEquals(Test.MATCH, Test.GENERAL_GRID, area);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, isAllowed);
+
+ //null test
+ ModuleInfo msg = new ModuleInfo();
+ assertNull(Test.NULL, msg.getModuleId());
+ assertNull(Test.NULL, msg.getModuleLocation());
+ assertNull(Test.NULL, msg.getModuleServiceArea());
+ assertNull(Test.NULL, msg.getMultipleAccessAllowance());
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(ModuleInfo.KEY_MODULE_ID, Test.GENERAL_STRING);
+ original.put(ModuleInfo.KEY_MODULE_LOCATION, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_GRID.getStore()));
+ original.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_GRID.getStore()));
+ original.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, Test.GENERAL_BOOLEAN);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(Test.MATCH, original.length(), serialized.length());
+
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(original);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(serialized);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
index a525bdb23..a65a7deef 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
@@ -1,14 +1,18 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.RadioControlCapabilities;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -36,6 +40,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
msg.setHdRadioEnableAvailable(Test.GENERAL_BOOLEAN);
msg.setSiriusXMRadioAvailable(Test.GENERAL_BOOLEAN);
msg.setSisDataAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
msg.setAvailableHdChannelsAvailable(Test.GENERAL_BOOLEAN);
}
@@ -57,6 +62,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
boolean hdRadioEnableAvailable = msg.getHdRadioEnableAvailable();
boolean siriusXMRadioAvailable = msg.getSiriusXMRadioAvailable();
boolean sisDataAvailable = msg.getSisDataAvailable();
+ ModuleInfo info = msg.getModuleInfo();
boolean availableHdChannelsAvailable = msg.getAvailableHdChannelsAvailable();
@@ -74,6 +80,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, hdRadioEnableAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, siriusXMRadioAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, sisDataAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, availableHdChannelsAvailable);
// Invalid/Null Tests
@@ -93,6 +100,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
assertNull(Test.NULL, msg.getHdRadioEnableAvailable());
assertNull(Test.NULL, msg.getSiriusXMRadioAvailable());
assertNull(Test.NULL, msg.getSisDataAvailable());
+ assertNull(Test.NULL, msg.getModuleInfo());
assertNull(Test.NULL, msg.getAvailableHdChannelsAvailable());
}
@@ -113,6 +121,7 @@ public class RadioControlCapabilitiesTests extends TestCase{
reference.put(RadioControlCapabilities.KEY_HD_RADIO_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(RadioControlCapabilities.KEY_SIRIUS_XM_RADIO_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(RadioControlCapabilities.KEY_SIS_DATA_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
reference.put(RadioControlCapabilities.KEY_AVAILABLE_HD_CHANNELS_AVAILABLE, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
@@ -121,8 +130,15 @@ public class RadioControlCapabilitiesTests extends TestCase{
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
-
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ if (key.equals(RadioControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch(JSONException e){
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java
new file mode 100644
index 000000000..847564adb
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java
@@ -0,0 +1,99 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
+import com.smartdevicelink.proxy.rpc.SeatLocationCapability;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+public class SeatLocationCapabilityTests extends TestCase {
+
+ private SeatLocationCapability msg;
+
+ @Override
+ public void setUp() {
+ msg = new SeatLocationCapability();
+ msg.setCols(Test.GENERAL_INT);
+ msg.setRows(Test.GENERAL_INT);
+ msg.setLevels(Test.GENERAL_INT);
+ msg.setSeats(Test.GENERAL_SEAT_LIST);
+ }
+
+ public void testRpcValues() {
+ int row = msg.getRows();
+ int col = msg.getCols();
+ int level = msg.getLevels();
+ List<SeatLocation> seats = msg.getSeatLocations();
+
+ //valid tests
+ assertEquals(Test.MATCH, row, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, col, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, level, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, seats.size(), Test.GENERAL_SEAT_LIST.size());
+ for (int i = 0; i < Test.GENERAL_SEAT_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateGrid(Test.GENERAL_SEAT_LIST.get(i).getGrid(), seats.get(i).getGrid()));
+ }
+
+ //null tests
+ SeatLocationCapability msg = new SeatLocationCapability();
+ assertNull(Test.NULL, msg.getCols());
+ assertNull(Test.NULL, msg.getRows());
+ assertNull(Test.NULL, msg.getLevels());
+ assertNull(Test.NULL, msg.getSeatLocations());
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(SeatLocationCapability.KEY_COLS, Test.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_ROWS, Test.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_LEVELS, Test.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_SEATS, Test.JSON_SEAT_LOCATIONS);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(serialized.length(), original.length());
+
+ Iterator<String> iter = original.keys();
+ String key = "";
+ while (iter.hasNext()) {
+ key = iter.next();
+ if (key.equals(SeatLocationCapability.KEY_COLS)) {
+ int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getCols();
+ int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getCols();
+ assertEquals(Test.MATCH, i1, i2);
+ } else if (key.equals(SeatLocationCapability.KEY_ROWS)) {
+ int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getRows();
+ int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getRows();
+ assertEquals(Test.MATCH, i1, i2);
+ } else if (key.equals(SeatLocationCapability.KEY_LEVELS)) {
+ int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getLevels();
+ int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getLevels();
+ assertEquals(Test.MATCH, i1, i2);
+ } else if (key.equals(SeatLocationCapability.KEY_SEATS)) {
+ JSONArray arr1 = JsonUtils.readJsonArrayFromJsonObject(original, key);
+ JSONArray arr2 = JsonUtils.readJsonArrayFromJsonObject(serialized, key);
+ assertEquals(Test.MATCH, arr1.length(), arr2.length());
+ for (int i = 0; i < Test.GENERAL_SEAT_LIST.size(); i++) {
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(arr1.getJSONObject(i));
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(arr2.getJSONObject(i));
+ assertTrue(Test.MATCH, Validator.validateSeatLocation(new SeatLocation(h1), new SeatLocation(h2)));
+ }
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java
new file mode 100644
index 000000000..6a102fc66
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java
@@ -0,0 +1,48 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class SeatLocationTests extends TestCase {
+
+ private SeatLocation msg;
+
+ @Override
+ public void setUp() {
+ msg = new SeatLocation();
+ msg.setGrid(Test.GENERAL_GRID);
+ }
+
+ public void testRpcValues() {
+ Grid grid = msg.getGrid();
+
+ //valid test
+ assertTrue(Validator.validateGrid(Test.GENERAL_GRID, grid));
+
+ //null test
+ SeatLocation msg = new SeatLocation();
+ assertNull(Test.NULL, msg.getGrid());
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(SeatLocation.KEY_GRID, Test.GENERAL_GRID);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(serialized.length(), original.length());
+ assertTrue(Test.TRUE, Validator.validateSeatLocation(new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(original)),
+ new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(serialized))));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java
index 422ab808c..38caad109 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java
@@ -32,6 +32,8 @@ public class GlobalPropertyTests extends TestCase {
GlobalProperty enumMenuIcon = GlobalProperty.valueForString(example);
example = "KEYBOARDPROPERTIES";
GlobalProperty enumKeyboardProperties = GlobalProperty.valueForString(example);
+ example = "USERLOCATION";
+ GlobalProperty enumUserLocation = GlobalProperty.valueForString(example);
assertNotNull("HELPPROMPT returned null", enumHelpPrompt);
assertNotNull("TIMEOUTPROMPT returned null", enumTimeoutPrompt);
@@ -40,6 +42,7 @@ public class GlobalPropertyTests extends TestCase {
assertNotNull("MENUNAME returned null", enumMenuName);
assertNotNull("MENUICON returned null", enumMenuIcon);
assertNotNull("KEYBOARDPROPERTIES returned null", enumKeyboardProperties);
+ assertNotNull("USERLOCATION returned null", enumUserLocation);
}
/**
@@ -84,6 +87,7 @@ public class GlobalPropertyTests extends TestCase {
enumTestList.add(GlobalProperty.MENUNAME);
enumTestList.add(GlobalProperty.MENUICON);
enumTestList.add(GlobalProperty.KEYBOARDPROPERTIES);
+ enumTestList.add(GlobalProperty.USERLOCATION);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
index bf3bed46b..f453cb985 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
@@ -48,6 +48,8 @@ public class SystemCapabilityTypeTests extends TestCase {
SystemCapabilityType enumPCM = SystemCapabilityType.valueForString(example);
example = "APP_SERVICES";
SystemCapabilityType enumAppServices = SystemCapabilityType.valueForString(example);
+ example = "SEAT_LOCATION";
+ SystemCapabilityType enumSeatLocation = SystemCapabilityType.valueForString(example);
example = "PRERECORDED_SPEECH";
SystemCapabilityType enumPrerecordedSpeech = SystemCapabilityType.valueForString(example);
example = "DISPLAYS";
@@ -68,6 +70,7 @@ public class SystemCapabilityTypeTests extends TestCase {
assertNotNull("VOICE_RECOGNITION returned null", enumVoiceRecognition);
assertNotNull("PCM_STREAMING", enumPCM);
assertNotNull("APP_SERVICES", enumAppServices);
+ assertNotNull("SEAT_LOCATION return null", enumSeatLocation);
assertNotNull("PRERECORDED_SPEECH", enumPrerecordedSpeech);
assertNotNull("DISPLAYS", enumDisplays);
}
@@ -122,6 +125,7 @@ public class SystemCapabilityTypeTests extends TestCase {
enumTestList.add(SystemCapabilityType.VOICE_RECOGNITION);
enumTestList.add(SystemCapabilityType.PCM_STREAMING);
enumTestList.add(SystemCapabilityType.APP_SERVICES);
+ enumTestList.add(SystemCapabilityType.SEAT_LOCATION);
enumTestList.add(SystemCapabilityType.PRERECORDED_SPEECH);
enumTestList.add(SystemCapabilityType.DISPLAYS);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
index d4a7bd473..8bd229d4d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
@@ -39,6 +39,7 @@ public class AlertTests extends BaseRpcTests{
msg.setProgressIndicator(Test.GENERAL_BOOLEAN);
msg.setTtsChunks(Test.GENERAL_TTSCHUNK_LIST);
msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
+ msg.setCancelID(Test.GENERAL_INTEGER);
msg.setAlertIcon(Test.GENERAL_IMAGE);
return msg;
@@ -67,6 +68,7 @@ public class AlertTests extends BaseRpcTests{
result.put(Alert.KEY_PROGRESS_INDICATOR, Test.GENERAL_BOOLEAN);
result.put(Alert.KEY_TTS_CHUNKS, Test.JSON_TTSCHUNKS);
result.put(Alert.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(Alert.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
result.put(Alert.KEY_ALERT_ICON, Test.JSON_IMAGE);
}catch(JSONException e){
fail(Test.JSON_FAIL);
@@ -88,6 +90,7 @@ public class AlertTests extends BaseRpcTests{
boolean testProgressIndicator = ( (Alert) msg ).getProgressIndicator();
List<TTSChunk> testTtsChunks = ( (Alert) msg ).getTtsChunks();
List<SoftButton> testSoftButtons = ( (Alert) msg ).getSoftButtons();
+ Integer testCancelID = ( (Alert) msg ).getCancelID();
Image alertIcon = ( (Alert) msg ).getAlertIcon();
// Valid Tests
@@ -99,6 +102,7 @@ public class AlertTests extends BaseRpcTests{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testProgressIndicator);
assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testTtsChunks));
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, alertIcon));
// Invalid/Null Tests
@@ -114,6 +118,7 @@ public class AlertTests extends BaseRpcTests{
assertNull(Test.NULL, msg.getProgressIndicator());
assertNull(Test.NULL, msg.getTtsChunks());
assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(Test.NULL, msg.getCancelID());
assertNull(Test.NULL, msg.getAlertIcon());
}
@@ -141,6 +146,7 @@ public class AlertTests extends BaseRpcTests{
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_2), cmd.getAlertText2());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_3), cmd.getAlertText3());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PROGRESS_INDICATOR), cmd.getProgressIndicator());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Alert.KEY_CANCEL_ID), cmd.getCancelID());
JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Alert.KEY_TTS_CHUNKS);
List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
index f16a3a87c..6f90585d4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
@@ -30,6 +30,7 @@ public class ButtonPressTests extends BaseRpcTests {
msg.setModuleType(Test.GENERAL_MODULETYPE);
msg.setButtonPressMode(Test.GENERAL_BUTTONPRESSMODE);
msg.setButtonName(Test.GENERAL_BUTTONNAME);
+ msg.setModuleId(Test.GENERAL_STRING);
return msg;
}
@@ -52,6 +53,7 @@ public class ButtonPressTests extends BaseRpcTests {
result.put(ButtonPress.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
result.put(ButtonPress.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME);
result.put(ButtonPress.KEY_BUTTON_PRESS_MODE, Test.GENERAL_BUTTONPRESSMODE);
+ result.put(ButtonPress.KEY_MODULE_ID, Test.GENERAL_STRING);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -67,11 +69,13 @@ public class ButtonPressTests extends BaseRpcTests {
ModuleType testModuleType = ( (ButtonPress) msg ).getModuleType();
ButtonName testButtonName = ( (ButtonPress) msg ).getButtonName();
ButtonPressMode testButtonPressMode = ( (ButtonPress) msg ).getButtonPressMode();
+ String testButtonId = ((ButtonPress) msg).getModuleId();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType);
assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, testButtonName);
assertEquals(Test.MATCH, Test.GENERAL_BUTTONPRESSMODE, testButtonPressMode);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testButtonId);
// Invalid/Null Tests
ButtonPress msg = new ButtonPress();
@@ -81,6 +85,7 @@ public class ButtonPressTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getModuleType());
assertNull(Test.NULL, msg.getButtonName());
assertNull(Test.NULL, msg.getButtonPressMode());
+ assertNull(Test.NULL, msg.getModuleId());
}
/**
@@ -106,6 +111,7 @@ public class ButtonPressTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_NAME).toString(), cmd.getButtonName().toString());
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_PRESS_MODE).toString(), cmd.getButtonPressMode().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_ID), cmd.getModuleId());
}catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java
new file mode 100644
index 000000000..8735bea9c
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ * Created by Nicole Yarroch on 7/17/19 10:06 AM
+ */
+
+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.CancelInteraction;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CancelInteraction}
+ */
+public class CancelInteractionTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ CancelInteraction msg = new CancelInteraction();
+ msg.setInteractionFunctionID(Test.GENERAL_INTEGER);
+ msg.setCancelID(Test.GENERAL_INTEGER);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.CANCEL_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(CancelInteraction.KEY_FUNCTION_ID, Test.GENERAL_INTEGER);
+ result.put(CancelInteraction.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Integer testFunctionID = ((CancelInteraction) msg).getInteractionFunctionID();
+ Integer testCancelID = ((CancelInteraction) msg).getCancelID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testFunctionID);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+
+ // Invalid/Null Tests
+ CancelInteraction msg = new CancelInteraction();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getInteractionFunctionID());
+ assertNull(Test.NULL, msg.getCancelID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CancelInteraction cmd = new CancelInteraction(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);
+
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_FUNCTION_ID), cmd.getInteractionFunctionID());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_CANCEL_ID), cmd.getCancelID());
+ }
+ catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java
new file mode 100644
index 000000000..0f21a2076
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java
@@ -0,0 +1,90 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsent;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsentTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
+ msg.setModuleType(Test.GENERAL_MODULETYPE);
+ msg.setModuleIds(Test.GENERAL_STRING_LIST);
+ return msg;
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+ try {
+ result.put(GetInteriorVehicleDataConsent.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
+ result.put(GetInteriorVehicleDataConsent.KEY_MODULE_ID, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ public void testRpcValues() {
+ ModuleType type = ((GetInteriorVehicleDataConsent) msg).getModuleType();
+ List<String> ids = ((GetInteriorVehicleDataConsent) msg).getModuleIds();
+
+ //valid tests
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, type);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, ids);
+
+ //null tests
+ GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
+ assertNull(Test.NULL, msg.getModuleType());
+ assertNull(Test.NULL, msg.getModuleIds());
+
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetInteriorVehicleDataConsent cmd = new GetInteriorVehicleDataConsent(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_ID), cmd.getModuleIds());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+
+
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
index 5a08d4266..dd175ae6f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
@@ -27,6 +27,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
msg.setModuleType(Test.GENERAL_MODULETYPE);
msg.setSubscribe(Test.GENERAL_BOOLEAN);
+ msg.setModuleId(Test.GENERAL_STRING);
return msg;
}
@@ -48,6 +49,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
try{
result.put(GetInteriorVehicleData.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
result.put(GetInteriorVehicleData.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
+ result.put(GetInteriorVehicleData.KEY_MODULE_ID, Test.GENERAL_STRING);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -62,10 +64,12 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
// Test Values
ModuleType testModuleType = ( (GetInteriorVehicleData) msg ).getModuleType();
boolean testSubscribed = ( (GetInteriorVehicleData) msg ).getSubscribe();
+ String testModuleId = ((GetInteriorVehicleData) msg).getModuleId();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testSubscribed);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testModuleId);
// Invalid/Null Tests
GetInteriorVehicleData msg = new GetInteriorVehicleData();
@@ -74,6 +78,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getModuleType());
assertNull(Test.NULL, msg.getSubscribe());
+ assertNull(Test.NULL, msg.getModuleId());
}
/**
@@ -98,6 +103,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_SUBSCRIBE), cmd.getSubscribe());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_ID), cmd.getModuleId());
}catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
index e415d8382..cd3ea00b4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
@@ -24,7 +24,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.PerformInteraction}
+ * {@link com.smartdevicelink.proxy.rpc.PerformInteraction}
*/
public class PerformInteractionTests extends BaseRpcTests {
@@ -41,6 +41,7 @@ public class PerformInteractionTests extends BaseRpcTests {
msg.setInitialText(Test.GENERAL_STRING);
msg.setInteractionMode(Test.GENERAL_INTERACTIONMODE);
msg.setTimeout(Test.GENERAL_INT);
+ msg.setCancelID(Test.GENERAL_INTEGER);
return msg;
}
@@ -68,7 +69,8 @@ public class PerformInteractionTests extends BaseRpcTests {
result.put(PerformInteraction.KEY_INTERACTION_LAYOUT, Test.GENERAL_LAYOUTMODE);
result.put(PerformInteraction.KEY_INITIAL_TEXT, Test.GENERAL_STRING);
result.put(PerformInteraction.KEY_INTERACTION_MODE, Test.GENERAL_INTERACTIONMODE);
- result.put(PerformInteraction.KEY_TIMEOUT, Test.GENERAL_INT);
+ result.put(PerformInteraction.KEY_TIMEOUT, Test.GENERAL_INT);
+ result.put(PerformInteraction.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -90,6 +92,7 @@ public class PerformInteractionTests extends BaseRpcTests {
String testInitialText = ( (PerformInteraction) msg).getInitialText();
InteractionMode testMode = ( (PerformInteraction) msg).getInteractionMode();
Integer testTimeout = ( (PerformInteraction) msg).getTimeout();
+ Integer testCancelID = ( (PerformInteraction) msg ).getCancelID();
// Valid Tests
assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testInitialPrompt));
@@ -101,6 +104,7 @@ public class PerformInteractionTests extends BaseRpcTests {
assertEquals(Test.MATCH, Test.GENERAL_STRING, testInitialText);
assertEquals(Test.MATCH, Test.GENERAL_INTERACTIONMODE, testMode);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testTimeout);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
// Invald/Null Tests
PerformInteraction msg = new PerformInteraction();
@@ -117,6 +121,7 @@ public class PerformInteractionTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getInitialText());
assertNull(Test.NULL, msg.getInteractionMode());
assertNull(Test.NULL, msg.getTimeout());
+ assertNull(Test.NULL, msg.getCancelID());
}
/**
@@ -140,6 +145,7 @@ public class PerformInteractionTests extends BaseRpcTests {
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INITIAL_TEXT), cmd.getInitialText());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_MODE), cmd.getInteractionMode().toString());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteraction.KEY_CANCEL_ID), cmd.getCancelID());
List<Integer> interactionIDList = JsonUtils.readIntegerListFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_CHOICE_SET_ID_LIST);
List<Integer> testIDList = cmd.getInteractionChoiceSetIDList();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java
new file mode 100644
index 000000000..711e4c977
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java
@@ -0,0 +1,85 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModule;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModuleTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
+ msg.setModuleType(Test.GENERAL_MODULETYPE);
+ msg.setModuleId(Test.GENERAL_STRING);
+ return msg;
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+ try {
+ result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
+ result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_ID, Test.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ public void testRpcValues() {
+ ModuleType type = ((ReleaseInteriorVehicleDataModule) msg).getModuleType();
+ String id = ((ReleaseInteriorVehicleDataModule) msg).getModuleId();
+
+ //valid tests
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, type);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, id);
+
+ //null tests
+ ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
+ assertNull(Test.NULL, msg.getModuleType());
+ assertNull(Test.NULL, msg.getModuleId());
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ReleaseInteriorVehicleDataModule cmd = new ReleaseInteriorVehicleDataModule(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_ID), cmd.getModuleId());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
index 2a4e14a6a..195cb7973 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
@@ -21,7 +21,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.ScrollableMessage}
+ * {@link com.smartdevicelink.proxy.rpc.ScrollableMessage}
*/
public class ScrollableMessageTests extends BaseRpcTests {
@@ -32,6 +32,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
msg.setTimeout(Test.GENERAL_INT);
msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
msg.setScrollableMessageBody(Test.GENERAL_STRING);
+ msg.setCancelID(Test.GENERAL_INTEGER);
return msg;
}
@@ -53,7 +54,8 @@ public class ScrollableMessageTests extends BaseRpcTests {
try {
result.put(ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY, Test.GENERAL_STRING);
result.put(ScrollableMessage.KEY_TIMEOUT, Test.GENERAL_INT);
- result.put(ScrollableMessage.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(ScrollableMessage.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(ScrollableMessage.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -69,6 +71,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
String testBody = ( (ScrollableMessage) msg ).getScrollableMessageBody();
Integer testTimeout = ( (ScrollableMessage) msg ).getTimeout();
List<SoftButton> testSoftButtons = ( (ScrollableMessage) msg ).getSoftButtons();
+ Integer testCancelID = ( (ScrollableMessage) msg ).getCancelID();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, testBody);
@@ -77,7 +80,8 @@ public class ScrollableMessageTests extends BaseRpcTests {
for (int i = 0; i < Test.GENERAL_SOFTBUTTON_LIST.size(); i++) {
assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTON_LIST.get(i), testSoftButtons.get(i));
}
-
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+
// Invalid/Null Tests
ScrollableMessage msg = new ScrollableMessage();
assertNotNull(Test.NOT_NULL, msg);
@@ -87,6 +91,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getScrollableMessageBody());
assertNull(Test.NULL, msg.getTimeout());
assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(Test.NULL, msg.getCancelID());
}
/**
@@ -110,6 +115,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY), cmd.getScrollableMessageBody());
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_TIMEOUT), cmd.getTimeout());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_CANCEL_ID), cmd.getCancelID());
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ScrollableMessage.KEY_SOFT_BUTTONS);
List<SoftButton> softButtonList = new ArrayList<SoftButton>();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
index 7f08fb332..f56cab807 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
@@ -19,7 +19,7 @@ import java.util.Hashtable;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.SetDisplayLayout}
+ * {@link com.smartdevicelink.proxy.rpc.SetDisplayLayout}
*/
public class SetDisplayLayoutTests extends BaseRpcTests {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
index 12119b847..cce913632 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
@@ -18,7 +18,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.Slider}
+ * {@link com.smartdevicelink.proxy.rpc.Slider}
*/
public class SliderTests extends BaseRpcTests {
@@ -31,6 +31,7 @@ public class SliderTests extends BaseRpcTests {
msg.setTimeout(Test.GENERAL_INT);
msg.setSliderHeader(Test.GENERAL_STRING);
msg.setSliderFooter(Test.GENERAL_STRING_LIST);
+ msg.setCancelID(Test.GENERAL_INTEGER);
return msg;
}
@@ -54,7 +55,8 @@ public class SliderTests extends BaseRpcTests {
result.put(Slider.KEY_SLIDER_FOOTER, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
result.put(Slider.KEY_POSITION, Test.GENERAL_INT);
result.put(Slider.KEY_TIMEOUT, Test.GENERAL_INT);
- result.put(Slider.KEY_NUM_TICKS, Test.GENERAL_INT);
+ result.put(Slider.KEY_NUM_TICKS, Test.GENERAL_INT);
+ result.put(Slider.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -72,13 +74,15 @@ public class SliderTests extends BaseRpcTests {
Integer testPosition = ( (Slider) msg ).getPosition();
String testSlider = ( (Slider) msg ).getSliderHeader();
List<String> testFooter = ( (Slider) msg ).getSliderFooter();
-
+ Integer testCancelID = ( (Slider) msg ).getCancelID();
+
// Valid Tests
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testNumTicks);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testTimeout);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testPosition);
assertEquals(Test.MATCH, Test.GENERAL_STRING, testSlider);
assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, testFooter));
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
// Invalid/Null Tests
Slider msg = new Slider();
@@ -90,6 +94,7 @@ public class SliderTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getPosition());
assertNull(Test.NULL, msg.getTimeout());
assertNull(Test.NULL, msg.getNumTicks());
+ assertNull(Test.NULL, msg.getCancelID());
}
/**
@@ -121,6 +126,7 @@ public class SliderTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_POSITION), cmd.getPosition());
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_TIMEOUT), cmd.getTimeout());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_CANCEL_ID), cmd.getCancelID());
}
catch (JSONException e) {
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java
new file mode 100644
index 000000000..e983327f2
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ * Created by Nicole Yarroch on 7/24/19 9:35 AM
+ */
+
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CancelInteractionResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CancelInteractionResponse}
+ */
+public class CancelInteractionResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new CancelInteractionResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.CANCEL_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ CancelInteractionResponse msg = new CancelInteractionResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CancelInteractionResponse cmd = new CancelInteractionResponse(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());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java
new file mode 100644
index 000000000..b77e056c9
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java
@@ -0,0 +1,75 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsentResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse();
+ msg.setAllowances(Test.GENERAL_BOOLEAN_LIST);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(GetInteriorVehicleDataConsentResponse.KEY_ALLOWED, JsonUtils.createJsonArray(Test.GENERAL_BOOLEAN_LIST));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ public void testRpcValues() {
+ List<Boolean> list = ((GetInteriorVehicleDataConsentResponse) msg).getAllowances();
+ assertEquals(Test.MATCH, list, Test.GENERAL_BOOLEAN_LIST);
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetInteriorVehicleDataConsentResponse cmd = new GetInteriorVehicleDataConsentResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readBooleanListFromJsonObject(parameters,
+ GetInteriorVehicleDataConsentResponse.KEY_ALLOWED), cmd.getAllowances());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java
new file mode 100644
index 000000000..f1d2b6e5a
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java
@@ -0,0 +1,56 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModuleResponseTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage() {
+ ReleaseInteriorVehicleDataModuleResponse msg = new ReleaseInteriorVehicleDataModuleResponse();
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ReleaseInteriorVehicleDataModuleResponse cmd = new ReleaseInteriorVehicleDataModuleResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
index ec0bef668..f6ea2e691 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
@@ -24,7 +24,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.SetDisplayLayoutResponse}
+ * {@link com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse}
*/
public class SetDisplayLayoutResponseTest extends BaseRpcTests {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
index f1042302c..23c37bea5 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
@@ -44,6 +44,7 @@ import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.proxy.rpc.AlertResponse;
import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
+import com.smartdevicelink.proxy.rpc.CancelInteractionResponse;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
import com.smartdevicelink.proxy.rpc.CloseApplicationResponse;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
@@ -61,6 +62,7 @@ import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
import com.smartdevicelink.proxy.rpc.GetFileResponse;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
@@ -95,6 +97,7 @@ import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
@@ -649,6 +652,16 @@ public class ProxyBridge implements IProxyListener{
}
@Override
+ public void onGetInteriorVehicleDataConsentResponse(GetInteriorVehicleDataConsentResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onReleaseInteriorVehicleDataModuleResponse(ReleaseInteriorVehicleDataModuleResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification){
onRPCReceived(notification);
}
@@ -659,6 +672,11 @@ public class ProxyBridge implements IProxyListener{
}
@Override
+ public void onCancelInteractionResponse(CancelInteractionResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
public void onShowAppMenuResponse(ShowAppMenuResponse response) {
onRPCReceived(response);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
index 4b43b01d1..13b41a806 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
@@ -199,6 +199,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
&& hmiLevel != null
&& hmiLevel.equals(HMILevel.HMI_FULL)
&& parameters != null){
+ stateMachine.transitionToState(StreamingStateMachine.READY);
transitionToState(READY);
}
}
@@ -686,4 +687,4 @@ public class VideoStreamManager extends BaseVideoStreamManager {
}
}
-} \ No newline at end of file
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
index 7a47251d9..ec6c751b8 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -3752,6 +3752,22 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onCloseApplicationResponse(msg);
onRPCResponseReceived(msg);
}
+ } else if (functionName.equals(FunctionID.CANCEL_INTERACTION.toString())) {
+ final CancelInteractionResponse msg = new CancelInteractionResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onCancelInteractionResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onCancelInteractionResponse(msg);
+ onRPCResponseReceived(msg);
+ }
} else if (functionName.equals(FunctionID.UNPUBLISH_APP_SERVICE.toString())) {
final UnpublishAppServiceResponse msg = new UnpublishAppServiceResponse(hash);
msg.format(rpcSpecVersion, true);
@@ -3781,7 +3797,37 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
});
} else {
- _proxyListener.onShowAppMenuResponse( msg);
+ _proxyListener.onShowAppMenuResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString())) {
+ final GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onGetInteriorVehicleDataConsentResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onGetInteriorVehicleDataConsentResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString())) {
+ final ReleaseInteriorVehicleDataModuleResponse msg = new ReleaseInteriorVehicleDataModuleResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onReleaseInteriorVehicleDataModuleResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onReleaseInteriorVehicleDataModuleResponse(msg);
onRPCResponseReceived(msg);
}
} else {
@@ -3793,6 +3839,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} // end-if
+
} else if (messageType.equals(RPCMessage.KEY_NOTIFICATION)) {
if (functionName.equals(FunctionID.ON_HMI_STATUS.toString())) {
// OnHMIStatus
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
index 8af6b1c59..a35b4790a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
@@ -173,7 +173,7 @@ public abstract class SdlRemoteDisplay extends Presentation {
public void run() {
// Want to create presentation on UI thread so it finds the right Looper
// when setting up the Dialog.
- if ((remoteDisplay == null) && (mDisplay != null))
+ if((mDisplay!=null) && (remoteDisplay == null || remoteDisplay.getDisplay() != mDisplay))
{
try {
Constructor constructor = remoteDisplayClass.getConstructor(Context.class, Display.class);
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
index 572182801..0a9404c4c 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
@@ -522,9 +522,10 @@ abstract class BaseScreenManager extends BaseSubManager {
* @param initialText - The initial text that is used as a placeholder text. It might not work on some head units.
* @param customKeyboardProperties - the custom keyboard configuration to be used when the keyboard is displayed
* @param keyboardListener - A keyboard listener to capture user input
+ * @return A unique cancelID that can be used to cancel this keyboard. If `null`, no keyboard was created.
*/
- public void presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardProperties, @NonNull KeyboardListener keyboardListener){
- this.choiceSetManager.presentKeyboard(initialText, customKeyboardProperties, keyboardListener);
+ public Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardProperties, @NonNull KeyboardListener keyboardListener){
+ return this.choiceSetManager.presentKeyboard(initialText, customKeyboardProperties, keyboardListener);
}
/**
@@ -542,6 +543,14 @@ abstract class BaseScreenManager extends BaseSubManager {
return this.choiceSetManager.getPreloadedChoices();
}
+ /**
+ * Dismisses a currently presented keyboard with the associated ID. Canceling a keyboard only works when connected to SDL Core v.6.0+. When connected to older versions of SDL Core the keyboard will not be dismissed.
+ * @param cancelID The unique ID assigned to the keyboard
+ */
+ public void dismissKeyboard(@NonNull Integer cancelID) {
+ this.choiceSetManager.dismissKeyboard(cancelID);
+ }
+
// END CHOICE SETS
/**
@@ -581,5 +590,4 @@ abstract class BaseScreenManager extends BaseSubManager {
}
});
}
-
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java
new file mode 100644
index 000000000..c0a1dbb25
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ * Created by Nicole Yarroch on 7/25/19 8:43 AM
+ */
+
+package com.smartdevicelink.managers.screen.choiceset;
+
+import com.smartdevicelink.util.DebugTool;
+
+class AsynchronousOperation implements Runnable {
+ private static final String TAG = "AsynchronousOperation - ";
+ private Thread thread;
+ private final Object lock;
+ private boolean blocked;
+ private boolean executing;
+ private boolean finished;
+ private boolean cancelled;
+
+ AsynchronousOperation() {
+ lock = new Object();
+ blocked = false;
+ executing = false;
+ finished = false;
+ cancelled = false;
+ }
+
+ @Override
+ public void run() {
+ thread = Thread.currentThread();
+ DebugTool.logInfo(TAG + "Starting: " + toString());
+ if (isCancelled()) {
+ finished = true;
+ DebugTool.logInfo(TAG + "Operation was cancelled: " + toString());
+ return;
+ }
+
+ executing = true;
+ }
+
+ void finishOperation() {
+ unblock();
+ executing = false;
+ finished = true;
+ cancelled = false;
+ DebugTool.logInfo(TAG + "Finishing: " + toString());
+ }
+
+ boolean isExecuting() {
+ return executing;
+ }
+
+ boolean isFinished() {
+ return finished;
+ }
+
+ void cancel(){
+ cancelled = true;
+ }
+
+ boolean isCancelled() {
+ return cancelled;
+ }
+
+ void block(){
+ if (!blocked && !finished) {
+ blocked = true;
+ DebugTool.logInfo(TAG + "Blocking: " + toString());
+ try {
+ synchronized (lock) {
+ lock.wait();
+ }
+ } catch (InterruptedException e) {
+ DebugTool.logWarning(TAG + "InterruptedException: " + toString());
+ finishOperation();
+ }
+ }
+ }
+
+ void unblock(){
+ if (blocked) {
+ blocked = false;
+ DebugTool.logInfo(TAG + "Unblocking: " + toString());
+ synchronized (lock) {
+ lock.notify();
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName() + " (OpId: " + System.identityHashCode(this) + ", OpThread:" + (thread != null ? thread.getName() : "no operating thread") + ", currentThread:" + Thread.currentThread().getName() + ", blocked:" + blocked + ", executing:" + executing + ", finished:" + finished + ", cancelled:" + cancelled + ")";
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
index 2636ada50..e343cd131 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
@@ -86,16 +86,18 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
SystemContext currentSystemContext;
HashSet<ChoiceCell> preloadedChoices, pendingPreloadChoices;
ChoiceSet pendingPresentationSet;
- private List<ChoiceCell> waitingChoices;
- private CompletionListener waitingListener;
// We will pass operations into this to be completed
PausableThreadPoolExecutor executor;
LinkedBlockingQueue<Runnable> operationQueue;
Future pendingPresentOperation;
+ PresentKeyboardOperation currentlyPresentedKeyboardOperation;
+
int nextChoiceId;
+ int nextCancelId;
final int choiceCellIdMin = 1;
+ final int choiceCellCancelIdMin = 1;
boolean isVROptional;
BaseChoiceSetManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
@@ -111,11 +113,14 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
preloadedChoices = new HashSet<>();
pendingPreloadChoices = new HashSet<>();
nextChoiceId = choiceCellIdMin;
+ nextCancelId = choiceCellCancelIdMin;
isVROptional = false;
keyboardConfiguration = defaultKeyboardConfiguration();
operationQueue = new LinkedBlockingQueue<>();
executor = new PausableThreadPoolExecutor(1, Runtime.getRuntime().availableProcessors(), 10, TimeUnit.SECONDS, operationQueue);
executor.pause(); // pause until HMI ready
+
+ currentlyPresentedKeyboardOperation = null;
}
@Override
@@ -138,10 +143,9 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
pendingPresentationSet = null;
pendingPresentOperation = null;
- waitingChoices = null;
- waitingListener = null;
- isVROptional = true;
+ isVROptional = false;
nextChoiceId = choiceCellIdMin;
+ nextCancelId = choiceCellCancelIdMin;
// remove listeners
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
@@ -162,7 +166,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
@Override
public void onError(String error) {
- // At this point, there were errors trying to send a test CICS
+ // At this point, there were errors trying to send a test PICS
// If we reach this state, we cannot use the manager
DebugTool.logError(error);
transitionToState(ERROR);
@@ -182,10 +186,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public void preloadChoices(@NonNull List<ChoiceCell> choices, @Nullable final CompletionListener listener){
- if (!isReady()){
- waitingChoices = new ArrayList<>(choices);
- waitingListener = listener;
- DebugTool.logInfo("Preload pending choice set manager being ready");
+ if (getState() == ERROR){
return;
}
@@ -215,15 +216,11 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (listener != null){
listener.onComplete(true);
}
- waitingChoices = null;
- waitingListener = null;
}else {
DebugTool.logError("There was an error pre loading choice cells");
- if (listener != null){
+ if (listener != null) {
listener.onComplete(false);
}
- waitingChoices = null;
- waitingListener = null;
}
}
});
@@ -240,7 +237,10 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public void deleteChoices(@NonNull List<ChoiceCell> choices){
- if (!isReady()){ return; }
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return;
+ }
// Find cells to be deleted that are already uploaded or are pending upload
final HashSet<ChoiceCell> cellsToBeDeleted = choicesToBeDeletedWithArray(choices);
@@ -252,7 +252,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
if (pendingPresentOperation != null && !pendingPresentOperation.isCancelled() && !pendingPresentOperation.isDone() && (cellsToBeDeleted.retainAll(pendingPresentationChoices) || cellsToBeRemovedFromPending.retainAll(pendingPresentationChoices))){
- pendingPresentOperation.cancel(true);
+ pendingPresentOperation.cancel(false);
DebugTool.logWarning("Attempting to delete choice cells while there is a pending presentation operation. Pending presentation cancelled.");
pendingPresentOperation = null;
}
@@ -292,13 +292,16 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public void presentChoiceSet(@NonNull final ChoiceSet choiceSet, @Nullable final InteractionMode mode, @Nullable final KeyboardListener keyboardListener){
- if (!isReady()){ return; }
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return;
+ }
// Perform additional checks against the ChoiceSet
if (!setUpChoiceSet(choiceSet)){ return; }
if (this.pendingPresentationSet != null && pendingPresentOperation != null){
- pendingPresentOperation.cancel(true);
+ pendingPresentOperation.cancel(false);
DebugTool.logWarning("Presenting a choice set while one is currently presented. Cancelling previous and continuing");
}
@@ -322,6 +325,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
findIdsOnChoiceSet(pendingPresentationSet);
+
// Pass back the information to the developer
ChoiceSetSelectionListener privateChoiceListener = new ChoiceSetSelectionListener() {
@Override
@@ -329,8 +333,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (pendingPresentationSet.getChoiceSetSelectionListener() != null){
pendingPresentationSet.getChoiceSetSelectionListener().onChoiceSelected(choiceCell, triggerSource,rowIndex);
}
- pendingPresentationSet = null;
- pendingPresentOperation = null;
}
@Override
@@ -338,8 +340,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (pendingPresentationSet.getChoiceSetSelectionListener() != null){
pendingPresentationSet.getChoiceSetSelectionListener().onError(error);
}
- pendingPresentationSet = null;
- pendingPresentOperation = null;
}
};
@@ -348,11 +348,11 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (keyboardListener == null){
// Non-searchable choice set
DebugTool.logInfo("Creating non-searchable choice set");
- presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, null, null, privateChoiceListener);
+ presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, null, null, privateChoiceListener, nextCancelId++);
} else {
// Searchable choice set
DebugTool.logInfo("Creating searchable choice set");
- presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, keyboardConfiguration, keyboardListener, privateChoiceListener);
+ presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, keyboardConfiguration, keyboardListener, privateChoiceListener, nextCancelId++);
}
pendingPresentOperation = executor.submit(presentOp);
@@ -363,18 +363,21 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
* @param initialText - The initial text that is used as a placeholder text. It might not work on some head units.
* @param customKeyboardConfig - the custom keyboard configuration to be used when the keyboard is displayed
* @param listener - A keyboard listener to capture user input
+ * @return - A unique id that can be used to cancel this keyboard. If `null`, no keyboard was created.
*/
- public void presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener){
-
+ public Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener){
if (initialText == null || initialText.length() == 0){
DebugTool.logError("initialText cannot be an empty string.");
- return;
+ return null;
}
- if (!isReady()){ return; }
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return null;
+ }
if (pendingPresentationSet != null && pendingPresentOperation != null){
- pendingPresentOperation.cancel(true);
+ pendingPresentOperation.cancel(false);
pendingPresentationSet = null;
DebugTool.logWarning("There is a current or pending choice set, cancelling and continuing.");
}
@@ -389,8 +392,42 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
// Present a keyboard with the choice set that we used to test VR's optional state
DebugTool.logInfo("Presenting Keyboard - Choice Set Manager");
- PresentKeyboardOperation keyboardOp = new PresentKeyboardOperation(internalInterface, keyboardConfiguration, initialText, customKeyboardConfig, listener);
+ Integer keyboardCancelID = nextCancelId++;
+ PresentKeyboardOperation keyboardOp = new PresentKeyboardOperation(internalInterface, keyboardConfiguration, initialText, customKeyboardConfig, listener, keyboardCancelID);
+ currentlyPresentedKeyboardOperation = keyboardOp;
pendingPresentOperation = executor.submit(keyboardOp);
+ return keyboardCancelID;
+ }
+
+ /**
+ * Cancels the keyboard-only interface if it is currently showing. If the keyboard has not yet been sent to Core, it will not be sent.
+ *
+ * This will only dismiss an already presented keyboard if connected to head units running SDL 6.0+.
+ *
+ * @param cancelID - The unique ID assigned to the keyboard, passed as the return value from `presentKeyboard`
+ */
+ public void dismissKeyboard(@NonNull Integer cancelID) {
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return;
+ }
+
+ // First, attempt to cancel the currently executing keyboard operation (Once an operation has started it is removed from the operationQueue)
+ if (currentlyPresentedKeyboardOperation != null && currentlyPresentedKeyboardOperation.getCancelID().equals(cancelID)) {
+ currentlyPresentedKeyboardOperation.dismissKeyboard();
+ return;
+ }
+
+ // Next, attempt to cancel keyboard operations that have not yet started
+ for (Runnable operation : operationQueue){
+ if (!(operation instanceof PresentKeyboardOperation)){ continue; }
+
+ PresentKeyboardOperation pendingOp = (PresentKeyboardOperation) operation;
+ if (!(pendingOp.getCancelID().equals(cancelID))) { continue; }
+
+ pendingOp.dismissKeyboard();
+ break;
+ }
}
/**
@@ -503,10 +540,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE){
executor.resume();
- if (waitingChoices != null && waitingChoices.size() > 0){
- DebugTool.logInfo("Pending Preload Choices now being sent");
- preloadChoices(waitingChoices, waitingListener);
- }
}
currentSystemContext = onHMIStatus.getSystemContext();
@@ -517,10 +550,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (currentSystemContext == SystemContext.SYSCTXT_MAIN && currentHMILevel != HMILevel.HMI_NONE){
executor.resume();
- if (waitingChoices != null && waitingChoices.size() > 0){
- DebugTool.logInfo("Pending Preload Choices now being sent");
- preloadChoices(waitingChoices, waitingListener);
- }
}
}
@@ -590,13 +619,4 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
defaultProperties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
return defaultProperties;
}
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- private boolean isReady(){
- if (getState() != READY){
- DebugTool.logWarning("Choice Manager In Not-Ready State");
- return false;
- }
- return true;
- }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
index 4ac5cb659..1c427c16b 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
@@ -47,21 +47,24 @@ import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.util.Collections;
-class CheckChoiceVROptionalOperation implements Runnable {
+class CheckChoiceVROptionalOperation extends AsynchronousOperation {
private CheckChoiceVROptionalInterface checkChoiceVROptionalInterface;
private WeakReference<ISdl> internalInterface;
private boolean isVROptional;
CheckChoiceVROptionalOperation(ISdl internalInterface, CheckChoiceVROptionalInterface checkChoiceVROptionalInterface){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.checkChoiceVROptionalInterface = checkChoiceVROptionalInterface;
}
@Override
public void run() {
+ CheckChoiceVROptionalOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing check vr optional operation");
sendTestChoiceNoVR();
+ block();
}
/**
@@ -117,6 +120,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(response.getInfo());
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
}
@@ -127,6 +132,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(info);
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
});
@@ -147,6 +154,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onCheckChoiceVROperationComplete(isVROptional);
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
@Override
@@ -155,6 +164,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(info);
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
});
if (internalInterface.get() != null){
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
index 7a1c0b138..b846760c7 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
@@ -53,6 +53,7 @@ public class ChoiceSet {
private List<VrHelpItem> vrHelpList;
private ChoiceSetSelectionListener choiceSetSelectionListener;
private KeyboardProperties customKeyboardConfiguration;
+ ChoiceSetCanceledListener canceledListener;
// defaults
private Integer defaultTimeout = 10;
@@ -153,6 +154,16 @@ public class ChoiceSet {
}
/**
+ * Cancels the choice set. If the choice set has not yet been sent to Core, it will not be sent. If the choice set is already presented on Core, the choice set will be immediately dismissed. Canceling an already presented choice set will only work if connected to Core versions 6.0+. On older versions of Core, the choice set will not be dismissed.
+ */
+ public void cancel() {
+ if (canceledListener == null) {
+ return;
+ }
+ canceledListener.onChoiceSetCanceled();
+ }
+
+ /**
* Maps to PerformInteraction.initialText. The title of the choice set, and/or the initial text on a keyboard prompt.
* @return the title
*/
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java
new file mode 100644
index 000000000..89e850b1e
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ * Created by Nicole Yarroch on 7/24/19 2:08 PM
+ */
+
+package com.smartdevicelink.managers.screen.choiceset;
+
+interface ChoiceSetCanceledListener {
+ /**
+ * Notifies the subscriber that the choice set should be cancelled.
+ */
+ void onChoiceSetCanceled();
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
index fdb01ae38..2fc6c314d 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
@@ -48,13 +48,14 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-class DeleteChoicesOperation implements Runnable {
+class DeleteChoicesOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private HashSet<ChoiceCell> cellsToDelete;
private CompletionListener completionListener;
DeleteChoicesOperation(ISdl internalInterface, HashSet<ChoiceCell> cellsToDelete, CompletionListener completionListener){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.cellsToDelete = cellsToDelete;
this.completionListener = completionListener;
@@ -62,8 +63,10 @@ class DeleteChoicesOperation implements Runnable {
@Override
public void run() {
+ DeleteChoicesOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing delete choices operation");
sendDeletions();
+ block();
}
private void sendDeletions(){
@@ -84,6 +87,8 @@ class DeleteChoicesOperation implements Runnable {
completionListener.onComplete(true);
}
DebugTool.logInfo("Successfully deleted choices");
+
+ DeleteChoicesOperation.super.finishOperation();
}
@Override
@@ -92,6 +97,8 @@ class DeleteChoicesOperation implements Runnable {
completionListener.onComplete(false);
}
DebugTool.logError("Failed to delete choice: " + info + " | Corr ID: " + correlationId);
+
+ DeleteChoicesOperation.super.finishOperation();
}
@Override
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
index f3d708998..99cd91a96 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
@@ -62,7 +62,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
-class PreloadChoicesOperation implements Runnable {
+class PreloadChoicesOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private WeakReference<FileManager> fileManager;
@@ -74,6 +74,7 @@ class PreloadChoicesOperation implements Runnable {
PreloadChoicesOperation(ISdl internalInterface, FileManager fileManager, DisplayCapabilities displayCapabilities,
Boolean isVROptional, HashSet<ChoiceCell> cellsToPreload, CompletionListener listener){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.fileManager = new WeakReference<>(fileManager);
this.displayCapabilities = displayCapabilities;
@@ -84,6 +85,7 @@ class PreloadChoicesOperation implements Runnable {
@Override
public void run() {
+ PreloadChoicesOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing preload choices operation");
preloadCellArtworks(new CompletionListener() {
@Override
@@ -91,6 +93,7 @@ class PreloadChoicesOperation implements Runnable {
preloadCells();
}
});
+ block();
}
void removeChoicesFromUpload(HashSet<ChoiceCell> choices){
@@ -161,11 +164,15 @@ class PreloadChoicesOperation implements Runnable {
isRunning = false;
DebugTool.logInfo("Finished pre loading choice cells");
completionListener.onComplete(true);
+
+ PreloadChoicesOperation.super.finishOperation();
}
@Override
public void onError(int correlationId, Result resultCode, String info) {
DebugTool.logError("There was an error uploading a choice cell: "+ info + " resultCode: " + resultCode);
+
+ PreloadChoicesOperation.super.finishOperation();
}
@Override
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
index e170dd89e..af69c0926 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
@@ -40,10 +40,12 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardEvent;
@@ -58,10 +60,11 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
-class PresentChoiceSetOperation implements Runnable {
+class PresentChoiceSetOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private ChoiceSet choiceSet;
+ private Integer cancelID;
private InteractionMode presentationMode;
private KeyboardProperties originalKeyboardProperties, keyboardProperties;
private ChoiceCell selectedCell;
@@ -71,27 +74,44 @@ class PresentChoiceSetOperation implements Runnable {
private ChoiceSetSelectionListener choiceSetSelectionListener;
Integer selectedCellRow;
KeyboardListener keyboardListener;
+ SdlMsgVersion sdlMsgVersion;
PresentChoiceSetOperation(ISdl internalInterface, ChoiceSet choiceSet, InteractionMode mode,
- KeyboardProperties originalKeyboardProperties, KeyboardListener keyboardListener, ChoiceSetSelectionListener choiceSetSelectionListener){
+ KeyboardProperties originalKeyboardProperties, KeyboardListener keyboardListener, ChoiceSetSelectionListener choiceSetSelectionListener, Integer cancelID){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.keyboardListener = keyboardListener;
this.choiceSet = choiceSet;
+ this.choiceSet.canceledListener = new ChoiceSetCanceledListener() {
+ @Override
+ public void onChoiceSetCanceled() {
+ cancelInteraction();
+ }
+ };
this.presentationMode = mode;
+ this.cancelID = cancelID;
this.originalKeyboardProperties = originalKeyboardProperties;
this.keyboardProperties = originalKeyboardProperties;
this.selectedCellRow = null;
this.choiceSetSelectionListener = choiceSetSelectionListener;
+ this.sdlMsgVersion = internalInterface.getSdlMsgVersion();
}
@Override
public void run() {
+ PresentChoiceSetOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing present choice set operation");
addListeners();
start();
+ block();
}
private void start(){
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
+
// Check if we're using a keyboard (searchable) choice set and setup keyboard properties if we need to
if (keyboardListener != null && choiceSet.getCustomKeyboardConfiguration() != null){
keyboardProperties = choiceSet.getCustomKeyboardConfiguration();
@@ -101,6 +121,10 @@ class PresentChoiceSetOperation implements Runnable {
updateKeyboardProperties(new CompletionListener() {
@Override
public void onComplete(boolean success) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
presentChoiceSet();
}
});
@@ -139,8 +163,10 @@ class PresentChoiceSetOperation implements Runnable {
@Override
public void onError(int correlationId, Result resultCode, String info) {
+ if (listener != null){
+ listener.onComplete(false);
+ }
DebugTool.logError("Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
- super.onError(correlationId, resultCode, info);
}
});
if (internalInterface.get() != null){
@@ -174,6 +200,16 @@ class PresentChoiceSetOperation implements Runnable {
finishOperation();
}
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Presenting Choice set failed: " + resultCode + ", " + info);
+
+ if (choiceSetSelectionListener != null){
+ choiceSetSelectionListener.onError(resultCode + ", " + info);
+ }
+ finishOperation();
+ }
});
if (internalInterface.get() != null){
internalInterface.get().sendRPC(pi);
@@ -182,8 +218,7 @@ class PresentChoiceSetOperation implements Runnable {
}
}
- private void finishOperation() {
-
+ void finishOperation() {
if (updatedKeyboardProperties) {
// We need to reset the keyboard properties
SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
@@ -193,6 +228,13 @@ class PresentChoiceSetOperation implements Runnable {
public void onResponse(int correlationId, RPCResponse response) {
updatedKeyboardProperties = false;
DebugTool.logInfo("Successfully reset choice keyboard properties to original config");
+ PresentChoiceSetOperation.super.finishOperation();
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
+ PresentChoiceSetOperation.super.finishOperation();
}
});
@@ -202,13 +244,56 @@ class PresentChoiceSetOperation implements Runnable {
} else {
DebugTool.logError("Internal Interface null when finishing choice keyboard reset");
}
+ } else {
+ PresentChoiceSetOperation.super.finishOperation();
+ }
+ }
+
+ /*
+ * Cancels the choice set. If the choice set has not yet been sent to Core, it will not be sent. If the choice set is already presented on Core, the choice set will be dismissed using the `CancelInteraction` RPC.
+ */
+ private void cancelInteraction() {
+ if (isFinished()) {
+ DebugTool.logInfo("This operation has already finished so it can not be canceled.");
+ return;
+ } else if (isCancelled()) {
+ DebugTool.logInfo("This operation has already been canceled. It will be finished at some point during the operation.");
+ return;
+ } else if (isExecuting()) {
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Canceling a presented choice set is not supported on this head unit");
+ return;
+ }
+
+ DebugTool.logInfo("Canceling the presented choice set interaction.");
+
+ CancelInteraction cancelInteraction = new CancelInteraction(FunctionID.PERFORM_INTERACTION.getId(), cancelID);
+ cancelInteraction.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ DebugTool.logInfo("Canceled the presented choice set " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Error canceling the presented choice set " + resultCode + " " + info);
+ };
+ });
+
+ if (internalInterface.get() != null){
+ internalInterface.get().sendRPC(cancelInteraction);
+ } else {
+ DebugTool.logError("Internal interface null - could not send cancel interaction for choice set");
+ }
+ } else {
+ DebugTool.logInfo("Canceling a choice set that has not yet been sent to Core");
+ this.cancel();
}
}
// GETTERS
PerformInteraction getPerformInteraction() {
-
PerformInteraction pi = new PerformInteraction(choiceSet.getTitle(), presentationMode, getChoiceIds());
pi.setInitialPrompt(choiceSet.getInitialPrompt());
pi.setHelpPrompt(choiceSet.getHelpPrompt());
@@ -216,6 +301,7 @@ class PresentChoiceSetOperation implements Runnable {
pi.setVrHelp(choiceSet.getVrHelpList());
pi.setTimeout(choiceSet.getTimeout() * 1000);
pi.setInteractionLayout(getLayoutMode());
+ pi.setCancelID(cancelID);
return pi;
}
@@ -260,6 +346,10 @@ class PresentChoiceSetOperation implements Runnable {
keyboardRPCListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
if (keyboardListener == null){
DebugTool.logError("Received Keyboard Input But Listener is null");
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
index 06d86edd5..5089d0c92 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
@@ -40,9 +40,11 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardEvent;
@@ -57,7 +59,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-class PresentKeyboardOperation implements Runnable {
+class PresentKeyboardOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private KeyboardListener keyboardListener;
@@ -65,24 +67,38 @@ class PresentKeyboardOperation implements Runnable {
private boolean updatedKeyboardProperties;
private String initialText;
private OnRPCNotificationListener keyboardRPCListener;
+ private Integer cancelID;
+ SdlMsgVersion sdlMsgVersion;
- PresentKeyboardOperation(ISdl internalInterface, KeyboardProperties originalKeyboardProperties, String initialText, KeyboardProperties customConfig, KeyboardListener keyboardListener){
+ PresentKeyboardOperation(ISdl internalInterface, KeyboardProperties originalKeyboardProperties, String initialText, KeyboardProperties customConfig, KeyboardListener keyboardListener, Integer cancelID){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.keyboardListener = keyboardListener;
this.originalKeyboardProperties = originalKeyboardProperties;
this.keyboardProperties = originalKeyboardProperties;
this.customConfig = customConfig;
this.initialText = initialText;
+ this.cancelID = cancelID;
+ this.sdlMsgVersion = internalInterface.getSdlMsgVersion();
}
@Override
public void run() {
+ PresentKeyboardOperation.super.run();
+ DebugTool.logInfo("Keyboard Operation: Executing present keyboard operation");
addListeners();
start();
+ block();
}
private void start(){
DebugTool.logInfo("Choice Operation: Executing present keyboard operation");
+
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
+
if (keyboardListener != null){
keyboardProperties = customConfig;
updatedKeyboardProperties = true;
@@ -91,6 +107,11 @@ class PresentKeyboardOperation implements Runnable {
updateKeyboardProperties(new CompletionListener() {
@Override
public void onComplete(boolean success) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
+
presentKeyboard();
}
});
@@ -99,9 +120,7 @@ class PresentKeyboardOperation implements Runnable {
// SENDING REQUESTS
private void presentKeyboard(){
-
if (internalInterface.get() != null){
-
PerformInteraction pi = getPerformInteraction();
pi.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
@@ -121,11 +140,52 @@ class PresentKeyboardOperation implements Runnable {
}else{
DebugTool.logError("Internal Interface null in present keyboard operation - choice");
}
+ }
+ /**
+ * Cancels the keyboard-only interface if it is currently showing. If the keyboard has not yet been sent to Core, it will not be sent.
+ *
+ * This will only dismiss an already presented keyboard if connected to head units running SDL 6.0+.
+ */
+ void dismissKeyboard() {
+ if (isFinished()) {
+ DebugTool.logInfo("This operation has already finished so it can not be canceled.");
+ return;
+ } else if (isCancelled()) {
+ DebugTool.logInfo("This operation has already been canceled. It will be finished at some point during the operation.");
+ return;
+ } else if (isExecuting()) {
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Canceling a keyboard is not supported on this head unit");
+ return;
+ }
+
+ DebugTool.logInfo("Canceling the presented keyboard.");
+
+ CancelInteraction cancelInteraction = new CancelInteraction(FunctionID.PERFORM_INTERACTION.getId(), cancelID);
+ cancelInteraction.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ DebugTool.logInfo("Canceled the presented keyboard " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Error canceling the presented keyboard " + resultCode + " " + info);
+ }
+ });
+ if (internalInterface.get() != null){
+ internalInterface.get().sendRPC(cancelInteraction);
+ } else {
+ DebugTool.logError("Internal interface null - could not send cancel interaction for keyboard.");
+ }
+ } else {
+ DebugTool.logInfo("Canceling a keyboard that has not yet been sent to Core.");
+ this.cancel();
+ }
}
private void updateKeyboardProperties(final CompletionListener listener){
-
if (keyboardProperties == null){
if (listener != null){
listener.onComplete(false);
@@ -157,6 +217,9 @@ class PresentKeyboardOperation implements Runnable {
@Override
public void onError(int correlationId, Result resultCode, String info) {
+ if (listener != null){
+ listener.onComplete(false);
+ }
DebugTool.logError("Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
super.onError(correlationId, resultCode, info);
}
@@ -169,8 +232,7 @@ class PresentKeyboardOperation implements Runnable {
}
}
- private void finishOperation() {
-
+ void finishOperation() {
if (updatedKeyboardProperties) {
// We need to reset the keyboard properties
SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
@@ -180,6 +242,13 @@ class PresentKeyboardOperation implements Runnable {
public void onResponse(int correlationId, RPCResponse response) {
updatedKeyboardProperties = false;
DebugTool.logInfo("Successfully reset choice keyboard properties to original config");
+ PresentKeyboardOperation.super.finishOperation();
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
+ PresentKeyboardOperation.super.finishOperation();
}
});
@@ -189,6 +258,8 @@ class PresentKeyboardOperation implements Runnable {
} else {
DebugTool.logError("Internal Interface null when finishing choice keyboard reset");
}
+ } else {
+ PresentKeyboardOperation.super.finishOperation();
}
}
@@ -200,9 +271,14 @@ class PresentKeyboardOperation implements Runnable {
pi.setInteractionMode(InteractionMode.MANUAL_ONLY);
pi.setInteractionChoiceSetIDList(Collections.<Integer>emptyList());
pi.setInteractionLayout(LayoutMode.KEYBOARD);
+ pi.setCancelID(cancelID);
return pi;
}
+ public Integer getCancelID() {
+ return cancelID;
+ }
+
// LISTENERS
private void addListeners(){
@@ -210,6 +286,10 @@ class PresentKeyboardOperation implements Runnable {
keyboardRPCListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
if (keyboardListener == null){
DebugTool.logError("Received Keyboard Input But Listener is null");
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
index 7bdcf43ae..964000dad 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -101,10 +101,13 @@ public enum FunctionID{
GET_FILE(54, "GetFile"),
PERFORM_APP_SERVICES_INTERACTION(55, "PerformAppServiceInteraction"),
UNPUBLISH_APP_SERVICE(56, "UnpublishAppService"),
+ CANCEL_INTERACTION(57, "CancelInteraction"),
CLOSE_APPLICATION(58, "CloseApplication"),
SHOW_APP_MENU(59, "ShowAppMenu"),
CREATE_WINDOW(60, "CreateWindow"),
DELETE_WINDOW(61, "DeleteWindow"),
+ GET_INTERIOR_VEHICLE_DATA_CONSENT(62, "GetInteriorVehicleDataConsent"),
+ RELEASE_INTERIOR_VEHICLE_MODULE(63, "ReleaseInteriorVehicleDataModule"),
// NOTIFICATIONS
ON_HMI_STATUS(32768, "OnHMIStatus"),
ON_APP_INTERFACE_UNREGISTERED(32769, "OnAppInterfaceUnregistered"),
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
index 4e97ebc01..988325bd9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
@@ -38,6 +38,7 @@ import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.proxy.rpc.AlertResponse;
import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
+import com.smartdevicelink.proxy.rpc.CancelInteractionResponse;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
import com.smartdevicelink.proxy.rpc.CloseApplicationResponse;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
@@ -55,6 +56,7 @@ import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
import com.smartdevicelink.proxy.rpc.GetFileResponse;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
@@ -87,6 +89,7 @@ import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
@@ -421,6 +424,10 @@ public interface IProxyListenerBase {
public void onOnAppServiceData(OnAppServiceData notification);
+ public void onGetInteriorVehicleDataConsentResponse(GetInteriorVehicleDataConsentResponse response);
+
+ public void onReleaseInteriorVehicleDataModuleResponse(ReleaseInteriorVehicleDataModuleResponse response);
+
public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification);
/**
@@ -431,6 +438,14 @@ public interface IProxyListenerBase {
*/
public void onCloseApplicationResponse(CloseApplicationResponse response);
+ /**
+ * onCancelInteractionResponse being called indicates that SDL has
+ * responded to a request to dismiss a modal view on the module.
+ *
+ * @param response - Contains information about the response sent from SDL.
+ */
+ public void onCancelInteractionResponse(CancelInteractionResponse response);
+
/**
* UnpublishAppServiceResponse being called indicates that SDL has
* responded to a request to close the application on the module.
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
index 8802e8d95..a67484131 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
@@ -39,7 +39,9 @@ import java.util.List;
/**
* Provides information to the user using either TTS, the Display or both and
- * can include a system-generated alert tone
+ * can include a system-generated alert tone.
+ *
+ * If connecting to SDL Core v.6.0+, the alert can be canceled programmatically using the `cancelID`. Canceling will not dismiss the alert's speech - only the modal view will be dismissed. On older versions of SDL Core, the alert will persist until the user has interacted with the alert or the specified timeout has elapsed.
*
* <ul>
* <li>The displayed portion of the Alert, if any, will persist until the
@@ -68,7 +70,7 @@ import java.util.List;
* <th>Name</th>
* <th>Type</th>
* <th>Description</th>
- * <th> Req.</th>
+ * <th>Req.</th>
* <th>Notes</th>
* <th>Version Available</th>
* </tr>
@@ -76,23 +78,23 @@ import java.util.List;
* <td>alertText1</td>
* <td>String</td>
* <td>Text to be displayed in the first field of the display during the Alert. </td>
- * <td>N</td>
- * <td> Length is limited to what is indicated in RegisterAppInterface response. If omitted, top display line will be cleared. Text is always centered</td>
+ * <td>N</td>
+ * <td>Length is limited to what is indicated in RegisterAppInterface response. If omitted, top display line will be cleared. Text is always centered</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>alertText2</td>
* <td>String</td>
* <td>Text to be displayed in the second field of the display during the Alert. </td>
- * <td>N</td>
- * <td> Only permitted if HMI supports a second display line. Length is limited to what is indicated in RegisterAppInterface response. If omitted, second display line will be cleared. </td>
+ * <td>N</td>
+ * <td>Only permitted if HMI supports a second display line. Length is limited to what is indicated in RegisterAppInterface response. If omitted, second display line will be cleared. </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>alertText3</td>
* <td>String</td>
* <td>Text to be displayed in the third field of the display during the Alert.</td>
- * <td>N</td>
+ * <td>N</td>
* <td>Array must have a least one element. </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -100,23 +102,23 @@ import java.util.List;
* <td>ttsChunks</td>
* <td>TTSChunk[]</td>
* <td>Array of type TTSChunk which, taken together, specify what is to be spoken to the user.</td>
- * <td>N</td>
+ * <td>N</td>
* <td>Array must have a least one element. </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>duration</td>
* <td>Integer</td>
- * <td><p>The duration of the displayed portion of the alert, in milliseconds.</p> After this amount of time has passed, the display fields alertText1 and alertText2 will revert to what was displayed in those fields before the alert began.</td>
- * <td>N</td>
- * <td>Min Value: 3000 Max Value: 10000 <p>If omitted, the default is 5000 milliseconds</p></td>
+ * <td>The duration of the displayed portion of the alert, in milliseconds. After this amount of time has passed, the display fields alertText1 and alertText2 will revert to what was displayed in those fields before the alert began.</td>
+ * <td>N</td>
+ * <td>Min Value: 3000 Max Value: 10000. If omitted, the default is 5000 milliseconds</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>playTone</td>
* <td>Boolean</td>
* <td>Specifies whether the alert tone should be played before the TTS (if any) is spoken.</td>
- * <td>N</td>
+ * <td>N</td>
* <td>If omitted, default is true.</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -124,7 +126,7 @@ import java.util.List;
* <td>softButtons</td>
* <td>SoftButton[]</td>
* <td>Specifies the softbuttons, the apps wants to use in this alert.</td>
- * <td></td>
+ * <td>N</td>
* <td>If omitted on supported displays, the alert will not have any SoftButton.ArrayMin: 0; ArrayMax: 4</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -132,15 +134,23 @@ import java.util.List;
* <td>progressIndicator</td>
* <td>Boolean</td>
* <td>If supported on the given platform, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.</td>
- * <td>N</td>
+ * <td>N</td>
* <td></td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
+ * <tr>
* <td>alertIcon</td>
* <td>Image</td>
* <td>Image struct determining whether the icon is static or dynamic. If omitted on supported displays, no (or the default if applicable) icon should be displayed.</td>
- * <td>N</td>
+ * <td>N</td>
* <td></td>
* <td>SmartDeviceLink 6.0.0</td>
* </tr>
@@ -162,6 +172,7 @@ public class Alert extends RPCRequest {
public static final String KEY_PROGRESS_INDICATOR = "progressIndicator";
public static final String KEY_TTS_CHUNKS = "ttsChunks";
public static final String KEY_SOFT_BUTTONS = "softButtons";
+ public static final String KEY_CANCEL_ID = "cancelID";
public static final String KEY_ALERT_ICON = "alertIcon";
/**
@@ -373,18 +384,55 @@ public class Alert extends RPCRequest {
* </ul>
* @since SmartDeviceLink 2.0
*/
-
public void setSoftButtons(List<SoftButton> softButtons) {
setParameters(KEY_SOFT_BUTTONS, softButtons);
}
- public Boolean getProgressIndicator() {
- return getBoolean(KEY_PROGRESS_INDICATOR);
+
+ /**
+ * Gets a Boolean value representing the progress indicator
+ *
+ * @return Boolean - If TRUE, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public Boolean getProgressIndicator() {
+ return getBoolean(KEY_PROGRESS_INDICATOR);
}
- public void setProgressIndicator(Boolean progressIndicator) {
+
+ /**
+ * Sets whether the progress indicator should be shown
+ *
+ * @param progressIndicator A Boolean value which specifies whether the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public void setProgressIndicator(Boolean progressIndicator) {
setParameters(KEY_PROGRESS_INDICATOR, progressIndicator);
}
/**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ };
+
+ /**
* <p>Sets the Image
* If provided, defines the image to be shown along with the alert</p>
* @param alertIcon
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
index c8e2d6d03..4210c9c2b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
@@ -44,6 +44,7 @@ public class AudioControlCapabilities extends RPCStruct {
public static final String KEY_VOLUME_AVAILABLE = "volumeAvailable";
public static final String KEY_EQUALIZER_AVAILABLE = "equalizerAvailable";
public static final String KEY_EQUALIZER_MAX_CHANNEL_ID = "equalizerMaxChannelId";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a newly allocated AudioControlCapabilities object
@@ -178,4 +179,19 @@ public class AudioControlCapabilities extends RPCStruct {
return getInteger(KEY_EQUALIZER_MAX_CHANNEL_ID);
}
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
index b92d3ef16..41dcb774d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -97,6 +97,7 @@ public class ButtonCapabilities extends RPCStruct {
public static final String KEY_SHORT_PRESS_AVAILABLE = "shortPressAvailable";
public static final String KEY_LONG_PRESS_AVAILABLE = "longPressAvailable";
public static final String KEY_UP_DOWN_AVAILABLE = "upDownAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a newly allocated ButtonCapabilities object
*/
@@ -178,4 +179,20 @@ public class ButtonCapabilities extends RPCStruct {
public void setUpDownAvailable( @NonNull Boolean upDownAvailable ) {
setValue(KEY_UP_DOWN_AVAILABLE, upDownAvailable);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
index 2272198be..1872138c5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
@@ -49,6 +49,7 @@ public class ButtonPress extends RPCRequest {
public static final String KEY_MODULE_TYPE = "moduleType";
public static final String KEY_BUTTON_NAME = "buttonName";
public static final String KEY_BUTTON_PRESS_MODE = "buttonPressMode";
+ public static final String KEY_MODULE_ID = "moduleId";
/**
* Constructs a new ButtonPress object
@@ -136,4 +137,20 @@ public class ButtonPress extends RPCRequest {
public void setButtonPressMode(@NonNull ButtonPressMode buttonPressMode) {
setParameters(KEY_BUTTON_PRESS_MODE, buttonPressMode);
}
+
+ /**
+ * Sets the module id for this object
+ * @param id the id to be set
+ */
+ public void setModuleId(String id) {
+ setParameters(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the module id of this object
+ * @return the module id of this object
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java
new file mode 100644
index 000000000..3fb02422c
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ * Created by Nicole Yarroch on 7/17/19 8:40 AM
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+/*
+ * Used to dismiss a modal view programmatically without needing to wait for the timeout to complete. Can be used to dismiss alerts, scrollable messages, sliders, and perform interactions (i.e. pop-up menus).
+ *
+ * @see Alert, ScrollableMessage, Slider, PerformInteraction
+ */
+public class CancelInteraction extends RPCRequest {
+ public static final String KEY_CANCEL_ID = "cancelID";
+ public static final String KEY_FUNCTION_ID = "functionID";
+
+ // Constructors
+
+ /**
+ * Constructs a new CancelInteraction object
+ */
+ public CancelInteraction() {
+ super(FunctionID.CANCEL_INTERACTION.toString());
+ }
+
+ /**
+ * Constructs a new CancelInteraction object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public CancelInteraction(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Convenience init for dismissing an interaction type.
+ * @param functionID - The ID of the type of interaction to dismiss
+ */
+ public CancelInteraction(@NonNull Integer functionID) {
+ this();
+ setInteractionFunctionID(functionID);
+ }
+
+ /**
+ * Convenience init for dismissing a specific interaction.
+ * @param functionID - The ID of the type of interaction to dismiss
+ * @param cancelID - The ID of the specific interaction to dismiss
+ */
+ public CancelInteraction(@NonNull Integer functionID, Integer cancelID) {
+ this();
+ setInteractionFunctionID(functionID);
+ setCancelID(cancelID);
+ }
+
+ // Custom Getters / Setters
+
+ /**
+ * The ID of the type of interaction to dismiss.
+ * Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), and 26 (SliderID) are permitted.
+ * @return - the functionID
+ */
+ public Integer getInteractionFunctionID() {
+ return getInteger(KEY_FUNCTION_ID);
+ }
+
+ /**
+ * The ID of the type of interaction to dismiss.
+ * Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), and 26 (SliderID) are permitted.
+ * @param functionID - the functionID
+ */
+ public void setInteractionFunctionID(@NonNull Integer functionID) {
+ setParameters(KEY_FUNCTION_ID, functionID);
+ }
+
+ /**
+ * The ID of the specific interaction to dismiss. If not set, the most recent of the RPC type set in functionID will be dismissed.
+ * @return - the cancelID
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * The ID of the specific interaction to dismiss. If not set, the most recent of the RPC type set in functionID will be dismissed.
+ * @param cancelID - the cancelID
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java
new file mode 100644
index 000000000..defab83c9
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ * Created by Nicole Yarroch on 7/24/19 9:29 AM
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+/**
+ * Response to the request to dismiss a modal view. If no applicable request can be dismissed, the `resultCode` will be `IGNORED`.
+ */
+public class CancelInteractionResponse extends RPCResponse {
+ /**
+ * Constructs a new CancelInteractionResponse object
+ */
+ public CancelInteractionResponse() { super(FunctionID.CANCEL_INTERACTION.toString()); }
+
+ /**
+ * Constructs a new CancelInteractionResponse object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public CancelInteractionResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new CancelInteractionResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public CancelInteractionResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
index 5a4a39c14..8d229c30a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
@@ -61,6 +61,7 @@ public class ClimateControlCapabilities extends RPCStruct{
public static final String KEY_HEATED_WIND_SHIELD_AVAILABLE = "heatedWindshieldAvailable";
public static final String KEY_HEATED_REAR_WINDOW_AVAILABLE = "heatedRearWindowAvailable";
public static final String KEY_HEATED_MIRRORS_AVAILABLE = "heatedMirrorsAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
public static final String KEY_CLIMATE_ENABLE_AVAILABLE = "climateEnableAvailable";
public ClimateControlCapabilities() {
@@ -406,6 +407,21 @@ public class ClimateControlCapabilities extends RPCStruct{
}
/**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
+ /**
* Sets the climateEnableAvailable portion of the ClimateControlCapabilities class
*
* @param climateEnableAvailable Availability of the control of enable/disable climate control.
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
index fecf4463f..a2999ae3b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
@@ -49,6 +49,7 @@ import java.util.Hashtable;
public class GetInteriorVehicleData extends RPCRequest {
public static final String KEY_MODULE_TYPE = "moduleType";
public static final String KEY_SUBSCRIBE = "subscribe";
+ public static final String KEY_MODULE_ID = "moduleId";
/**
* Constructs a new GetInteriorVehicleData object
@@ -118,4 +119,20 @@ public class GetInteriorVehicleData extends RPCRequest {
public Boolean getSubscribe() {
return getBoolean(KEY_SUBSCRIBE);
}
+
+ /**
+ * Sets the Module ID for this class
+ * @param id the id to be set
+ */
+ public void setModuleId(String id) {
+ setParameters(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module ID of this class
+ * @return the Module ID of this class
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java
new file mode 100644
index 000000000..459aeaf05
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java
@@ -0,0 +1,54 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsent extends RPCRequest {
+ public static final String KEY_MODULE_TYPE = "moduleType";
+ public static final String KEY_MODULE_ID = "moduleIds";
+
+ public GetInteriorVehicleDataConsent() {
+ super(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString());
+ }
+
+ public GetInteriorVehicleDataConsent(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the Module Type for this class
+ * @param type the Module Type to be set
+ */
+ public void setModuleType(ModuleType type) {
+ setParameters(KEY_MODULE_TYPE, type);
+ }
+
+ /**
+ * Gets the Module Type of this class
+ * @return the Module Type of this class
+ */
+ public ModuleType getModuleType() {
+ return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE);
+ }
+
+ /**
+ * Sets the Module Ids for this class
+ * @param ids the ids to be set
+ */
+ public void setModuleIds(List<String> ids) {
+ setParameters(KEY_MODULE_ID, ids);
+ }
+
+ /**
+ * Gets the Module Ids of this class
+ * @return the Module Ids
+ */
+ @SuppressWarnings("unchecked")
+ public List<String> getModuleIds() {
+ return (List<String>) getObject(String.class, KEY_MODULE_ID);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java
new file mode 100644
index 000000000..ee610aa1e
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java
@@ -0,0 +1,46 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsentResponse extends RPCResponse {
+
+ public static final String KEY_ALLOWED = "allowed";
+
+ public GetInteriorVehicleDataConsentResponse() {
+ super(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString());
+ }
+
+ public GetInteriorVehicleDataConsentResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public GetInteriorVehicleDataConsentResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
+ /**
+ * Sets the list of allowances for this class
+ * @param allowances the allowances to be set
+ */
+ public void setAllowances(List<Boolean> allowances) {
+ setParameters(KEY_ALLOWED, allowances);
+ }
+
+ /**
+ * Gets the list of allowances of this class
+ * @return the list of allowances of this class
+ */
+ @SuppressWarnings("unchecked")
+ public List<Boolean> getAllowances() {
+ return (List<Boolean>) getObject(Boolean.class, KEY_ALLOWED);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java
new file mode 100644
index 000000000..80e8fac2c
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java
@@ -0,0 +1,120 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/**
+ * Struct that describes a location (origin coordinates and span) of a vehicle component (Module)
+ */
+
+public class Grid extends RPCStruct {
+ public static final String KEY_COLUMN = "col";
+ public static final String KEY_ROW = "row";
+ public static final String KEY_LEVEL = "level";
+ public static final String KEY_COL_SPAN = "colspan";
+ public static final String KEY_ROW_SPAN = "rowspan";
+ public static final String KEY_LEVEL_SPAN = "levelspan";
+
+ public Grid() {}
+
+ public Grid(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the column of this Grid
+ * @param col the column to be set
+ */
+ public void setColumn(Integer col) {
+ setValue(KEY_COLUMN, col);
+ }
+
+ /**
+ * Get the column value of this Grid
+ * @return the column value
+ */
+ public Integer getColumn() {
+ return getInteger(KEY_COLUMN);
+ }
+
+ /**
+ * Sets the row's value of this Grid
+ * @param row the row to be set
+ */
+ public void setRow(Integer row) {
+ setValue(KEY_ROW, row);
+ }
+
+ /**
+ * Gets the row value of this Grid
+ * @return the row value
+ */
+ public Integer getRow() {
+ return getInteger(KEY_ROW);
+ }
+
+ /**
+ * Sets the level value of this Grid
+ * @param level the level to be set
+ */
+ public void setLevel(Integer level) {
+ setValue(KEY_LEVEL, level);
+ }
+
+ /**
+ * Gets the level value of this Grid
+ * @return the level
+ */
+ public Integer getLevel() {
+ return getInteger(KEY_LEVEL);
+ }
+
+ /**
+ * Sets the column span of this Grid
+ * @param span the span to be set
+ */
+ public void setColumnSpan(Integer span) {
+ setValue(KEY_COL_SPAN, span);
+ }
+
+ /**
+ * Gets the column span of this Grid
+ * @return the column span
+ */
+ public Integer getColumnSpan() {
+ return getInteger(KEY_COL_SPAN);
+ }
+
+ /**
+ * Sets the row span of this Grid
+ * @param span the span to be set
+ */
+ public void setRowSpan(Integer span) {
+ setValue(KEY_ROW_SPAN, span);
+ }
+
+ /**
+ * Gets the row span of this Grid
+ * @return the row span
+ */
+ public Integer getRowSpan() {
+ return getInteger(KEY_ROW_SPAN);
+ }
+
+ /**
+ * Sets the level span of this Grid
+ * @param span the span to be set
+ */
+ public void setLevelSpan(Integer span) {
+ setValue(KEY_LEVEL_SPAN, span);
+ }
+
+ /**
+ * Gets the level span of this Grid
+ * @return the level span
+ */
+ public Integer getLevelSpan() {
+ return getInteger(KEY_LEVEL_SPAN);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
index 80b030ad2..c9a7d690f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
@@ -42,6 +42,7 @@ public class HMISettingsControlCapabilities extends RPCStruct {
public static final String KEY_DISTANCE_UNIT_AVAILABLE = "distanceUnitAvailable";
public static final String KEY_TEMPERATURE_UNIT_AVAILABLE = "temperatureUnitAvailable";
public static final String KEY_DISPLAY_MODE_UNIT_AVAILABLE = "displayModeUnitAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a new HMISettingsControlCapabilities object
@@ -135,4 +136,20 @@ public class HMISettingsControlCapabilities extends RPCStruct {
public Boolean getDisplayModeUnitAvailable() {
return getBoolean(KEY_DISPLAY_MODE_UNIT_AVAILABLE);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
index 2c1e63455..a3b66467c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
@@ -41,6 +41,7 @@ import java.util.List;
public class LightControlCapabilities extends RPCStruct {
public static final String KEY_MODULE_NAME = "moduleName";
public static final String KEY_SUPPORTED_LIGHTS = "supportedLights";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a new LightControlCapabilities object
@@ -106,4 +107,20 @@ public class LightControlCapabilities extends RPCStruct {
public void setSupportedLights(@NonNull List<LightCapabilities> supportedLights) {
setValue(KEY_SUPPORTED_LIGHTS, supportedLights);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
index 8f11dc556..26cf08684 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
@@ -46,6 +46,7 @@ public class ModuleData extends RPCStruct {
public static final String KEY_AUDIO_CONTROL_DATA = "audioControlData";
public static final String KEY_LIGHT_CONTROL_DATA = "lightControlData";
public static final String KEY_HMI_SETTINGS_CONTROL_DATA = "hmiSettingsControlData";
+ public static final String KEY_MODULE_ID = "moduleId";
public ModuleData() {
}
@@ -186,4 +187,20 @@ public class ModuleData extends RPCStruct {
public HMISettingsControlData getHmiSettingsControlData() {
return (HMISettingsControlData) getObject(HMISettingsControlData.class, KEY_HMI_SETTINGS_CONTROL_DATA);
}
+
+ /**
+ * Sets the Module ID of the ModuleData class
+ * @param id the id to be set
+ */
+ public void setModuleId(String id) {
+ setValue(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module ID of the ModuleData class
+ * @return the Module ID
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java
new file mode 100644
index 000000000..eef2fb5f0
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java
@@ -0,0 +1,85 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/**
+ * Struct that describes a module within different SystemCapabilities
+ */
+public class ModuleInfo extends RPCStruct {
+ public static final String KEY_MODULE_ID = "moduleId";
+ public static final String KEY_MODULE_LOCATION = "location";
+ public static final String KEY_MODULE_SERVICE_AREA = "serviceArea";
+ public static final String KEY_MULTIPLE_ACCESS_ALLOWED = "allowMultipleAccess";
+
+ public ModuleInfo(){}
+
+ public ModuleInfo(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the Module ID for this Module
+ * @param id the id to be set
+ */
+ public void setModuleId(String id) {
+ setValue(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module ID for this module
+ * @return the Module ID as a String
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
+
+ /**
+ * Sets the location of this Module
+ * @param location the location to be set
+ */
+ public void setModuleLocation(Grid location) {
+ setValue(KEY_MODULE_LOCATION, location);
+ }
+
+ /**
+ * Gets the location of this Module
+ * @return the location of this Module
+ */
+ public Grid getModuleLocation() {
+ return (Grid) getObject(Grid.class, KEY_MODULE_LOCATION);
+ }
+
+ /**
+ * Sets the service area of this Module
+ * @param serviceArea the service area of this Module
+ */
+ public void setModuleServiceArea(Grid serviceArea) {
+ setValue(KEY_MODULE_SERVICE_AREA, serviceArea);
+ }
+
+ /**
+ * Gets the service area of this Module
+ * @return the service area of this Module
+ */
+ public Grid getModuleServiceArea() {
+ return (Grid) getObject(Grid.class, KEY_MODULE_SERVICE_AREA);
+ }
+
+ /**
+ * Sets the multiple access allowance for this Module
+ * @param isMultipleAccess the access to be set
+ */
+ public void setMultipleAccessAllowance(Boolean isMultipleAccess) {
+ setValue(KEY_MULTIPLE_ACCESS_ALLOWED, isMultipleAccess);
+ }
+
+ /**
+ * Gets the multiple allowance access of this Module
+ * @return the multiple access allowance of this Module
+ */
+ public Boolean getMultipleAccessAllowance() {
+ return getBoolean(KEY_MULTIPLE_ACCESS_ALLOWED);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
index 12be13e9f..5e253e540 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -47,7 +47,9 @@ import java.util.List;
* application may use a PerformInteraction to ask a user to say the name of a
* song to play. The user's response is only valid if it appears in the
* specified Choice Sets and is recognized by SDL
- * <p></p>
+ *
+ * If connecting to SDL Core v.6.0+, the perform interaction can be canceled programmatically using the `cancelID`. On older versions of SDL Core, the perform interaction will persist until the user has interacted with the perform interaction or the specified timeout has elapsed.
+ *
* <p>Function Group: Base</p>
*
* <p><b>HMILevel needs to be FULL</b></p>
@@ -134,6 +136,14 @@ import java.util.List;
* <td></td>
* <td>SmartDeviceLink 3.0</td>
* </tr>
+ * <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific perform interaction to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
* </table>
*
*
@@ -151,6 +161,8 @@ public class PerformInteraction extends RPCRequest {
public static final String KEY_TIMEOUT_PROMPT = "timeoutPrompt";
public static final String KEY_TIMEOUT = "timeout";
public static final String KEY_VR_HELP = "vrHelp";
+ public static final String KEY_CANCEL_ID = "cancelID";
+
/**
* Constructs a new PerformInteraction object
*/
@@ -168,10 +180,10 @@ public class PerformInteraction extends RPCRequest {
}
/**
* Constructs a new PerformInteraction object
- * @param initialText a String value that Displayed when the interaction begins
+ * @param initialText a String value that is displayed when the interaction begins
* @param interactionMode indicate how user selects interaction choice (VR_ONLY, MANUAL_ONLY or BOTH)
* @param interactionChoiceSetIDList a List<Integer> representing an Array of one or more Choice Set IDs. User can select any choice from any of the specified
- * Choice Sets <b>Notes: </b>Min Value: 0; Max Vlaue: 2000000000
+ * Choice Sets <b>Notes: </b>Min Value: 0; Max Value: 2000000000
*/
public PerformInteraction(@NonNull String initialText, @NonNull InteractionMode interactionMode, @NonNull List<Integer> interactionChoiceSetIDList) {
this();
@@ -361,8 +373,7 @@ public class PerformInteraction extends RPCRequest {
}
/**
- * Gets a Voice recognition Help, which is a suggested VR Help Items to
- * display on-screen during Perform Interaction
+ * Gets a Voice Recognition Help list, which is a list of suggested VR Help Items to display on-screen during a Perform Interaction
*
* @return List<VrHelpItem> -a List value representing a suggested VR
* Help Items to display on-screen during Perform Interaction
@@ -374,7 +385,8 @@ public class PerformInteraction extends RPCRequest {
}
/**
- *
+ * Sets a Voice Recognition Help list, which is a list of suggested VR Help Items to display on-screen during a Perform Interaction
+ *
* @param vrHelp
* a List representing a suggested VR Help Items to display
* on-screen during Perform Interaction
@@ -387,12 +399,48 @@ public class PerformInteraction extends RPCRequest {
public void setVrHelp(List<VrHelpItem> vrHelp) {
setParameters(KEY_VR_HELP, vrHelp);
}
-
- public LayoutMode getInteractionLayout() {
+
+ /**
+ * Gets the layout mode of how the choices are presented. For touchscreen interactions only.
+ *
+ * @return LayoutMode - The interaction layout mode
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public LayoutMode getInteractionLayout() {
return (LayoutMode) getObject(LayoutMode.class, KEY_INTERACTION_LAYOUT);
}
-
- public void setInteractionLayout( LayoutMode interactionLayout ) {
+
+ /**
+ * Sets the mode of how the choices are presented. For touchscreen interactions only.
+ *
+ * @param interactionLayout A LayoutMode representing the interaction layout mode
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public void setInteractionLayout(LayoutMode interactionLayout ) {
setParameters(KEY_INTERACTION_LAYOUT, interactionLayout);
- }
+ }
+
+ /**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific perform interaction to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific perform interaction to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
index e729c2934..22d1d892e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
@@ -54,6 +54,7 @@ public class RadioControlCapabilities extends RPCStruct{
public static final String KEY_HD_RADIO_ENABLE_AVAILABLE = "hdRadioEnableAvailable";
public static final String KEY_SIRIUS_XM_RADIO_AVAILABLE = "siriusxmRadioAvailable";
public static final String KEY_SIS_DATA_AVAILABLE = "sisDataAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
public static final String KEY_AVAILABLE_HD_CHANNELS_AVAILABLE = "availableHdChannelsAvailable";
public RadioControlCapabilities() {
@@ -364,4 +365,20 @@ public class RadioControlCapabilities extends RPCStruct{
public Boolean getSisDataAvailable() {
return getBoolean(KEY_SIS_DATA_AVAILABLE);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java
new file mode 100644
index 000000000..81bee2551
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java
@@ -0,0 +1,52 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModule extends RPCRequest {
+ public static final String KEY_MODULE_TYPE = "moduleType";
+ public static final String KEY_MODULE_ID = "moduleId";
+
+ public ReleaseInteriorVehicleDataModule() {
+ super(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString());
+ }
+
+ public ReleaseInteriorVehicleDataModule(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the Module Type for this class
+ * @param type the Module Type to be set
+ */
+ public void setModuleType(ModuleType type) {
+ setParameters(KEY_MODULE_TYPE, type);
+ }
+
+ /**
+ * Gets the Module Type of this class
+ * @return the Module Type of this class
+ */
+ public ModuleType getModuleType() {
+ return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE);
+ }
+
+ /**
+ * Sets the Module Ids for this class
+ * @param id the ids to be set
+ */
+ public void setModuleId(String id) {
+ setParameters(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module Id of this class
+ * @return the Module Ids
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java
new file mode 100644
index 000000000..61d8df98a
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java
@@ -0,0 +1,26 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModuleResponse extends RPCResponse {
+
+ public ReleaseInteriorVehicleDataModuleResponse() {
+ super(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString());
+ }
+
+ public ReleaseInteriorVehicleDataModuleResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public ReleaseInteriorVehicleDataModuleResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
index b4e212fcc..a3bb9a567 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -42,6 +42,8 @@ import java.util.List;
/**
* Creates a full screen overlay containing a large block of formatted text that
* can be scrolled with up to 8 SoftButtons defined
+ *
+ * If connecting to SDL Core v.6.0+, the scrollable message can be canceled programmatically using the `cancelID`. On older versions of SDL Core, the scrollable message will persist until the user has interacted with the scrollable message or the specified timeout has elapsed.
*
* <p>Function Group: ScrollableMessage</p>
*
@@ -81,6 +83,14 @@ import java.util.List;
* <td>minsize=0; maxsize=8</td>
* <td>SmartDevice Link 1.0 </td>
* </tr>
+ * <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific ScrollableMessage to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
* </table>
* <p> <b>Response</b></p>
*<b>Non-default Result Codes:</b>
@@ -102,6 +112,7 @@ public class ScrollableMessage extends RPCRequest {
public static final String KEY_SCROLLABLE_MESSAGE_BODY = "scrollableMessageBody";
public static final String KEY_TIMEOUT = "timeout";
public static final String KEY_SOFT_BUTTONS = "softButtons";
+ public static final String KEY_CANCEL_ID = "cancelID";
/**
* Constructs a new ScrollableMessage object
@@ -197,4 +208,26 @@ public class ScrollableMessage extends RPCRequest {
public List<SoftButton> getSoftButtons() {
return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
}
+
+ /**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific scrollable message to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific scrollable message to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
index 3c875d0d1..d56a321a2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
@@ -54,6 +54,7 @@ public class SeatControlCapabilities extends RPCStruct {
public static final String KEY_MASSAGE_MODE_AVAILABLE = "massageModeAvailable";
public static final String KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE = "massageCushionFirmnessAvailable";
public static final String KEY_MEMORY_AVAILABLE = "memoryAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a new SeatControlCapabilities object
@@ -367,4 +368,20 @@ public class SeatControlCapabilities extends RPCStruct {
public Boolean getMemoryAvailable() {
return getBoolean(KEY_MEMORY_AVAILABLE);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java
new file mode 100644
index 000000000..a4b33d1bd
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java
@@ -0,0 +1,32 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+public class SeatLocation extends RPCStruct {
+ public static final String KEY_GRID = "grid";
+
+ public SeatLocation(){}
+
+ public SeatLocation(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets grid data for this seat location
+ * @param grid the grid to be set
+ */
+ public void setGrid(Grid grid) {
+ setValue(KEY_GRID, grid);
+ }
+
+ /**
+ * Gets the Grid of this seat location
+ * @return the grid of this seat location
+ */
+ public Grid getGrid() {
+ return (Grid) getObject(Grid.class, KEY_GRID);
+ }
+
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java
new file mode 100644
index 000000000..3fc34bada
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java
@@ -0,0 +1,85 @@
+package com.smartdevicelink.proxy.rpc;
+
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class SeatLocationCapability extends RPCStruct {
+ public static final String KEY_ROWS = "rows";
+ public static final String KEY_COLS = "columns";
+ public static final String KEY_LEVELS = "levels";
+ public static final String KEY_SEATS = "seats";
+
+ public SeatLocationCapability(){}
+
+ public SeatLocationCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the seat rows for this capability
+ * @param rows rows to be set
+ */
+ public void setRows(Integer rows) {
+ setValue(KEY_ROWS, rows);
+ }
+
+ /**
+ * Gets the seat rows of this capability
+ * @return the seat rows
+ */
+ public Integer getRows() {
+ return getInteger(KEY_ROWS);
+ }
+
+ /**
+ * Sets the seat columns for this capability
+ * @param cols the seat columns to be set
+ */
+ public void setCols(Integer cols) {
+ setValue(KEY_COLS, cols);
+ }
+
+ /**
+ * Gets the seat columns of this capability
+ * @return the seat columns
+ */
+ public Integer getCols() {
+ return getInteger(KEY_COLS);
+ }
+
+ /**
+ * Sets the levels for this capability
+ * @param levels the levels to be set
+ */
+ public void setLevels(Integer levels) {
+ setValue(KEY_LEVELS, levels);
+ }
+
+ /**
+ * Gets the seat levels of this capability
+ * @return the seat levels
+ */
+ public Integer getLevels() {
+ return getInteger(KEY_LEVELS);
+ }
+
+ /**
+ * Sets the seat locations for this capability
+ * @param locations the locations to be set
+ */
+ public void setSeats(List<SeatLocation> locations) {
+ setValue(KEY_SEATS, locations);
+ }
+
+ /**
+ * Gets the seat locations of this capability
+ * @return the seat locations
+ */
+ @SuppressWarnings("unchecked")
+ public List<SeatLocation> getSeatLocations() {
+ return (List<SeatLocation>) getObject(SeatLocation.class, KEY_SEATS);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
index 92d15a749..562021544 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -39,7 +39,7 @@ import com.smartdevicelink.proxy.RPCRequest;
import java.util.Hashtable;
/**
- * @deprecated This RPC is deprecated. Use Show RPC to change layout.
+ * <Strong>If using Widgets with Core > 6.0, use {@link Show} to change widget layouts</Strong> <br>
* Used to set an alternate display layout. If not sent, default screen for
* given platform will be shown
*
@@ -93,7 +93,6 @@ import java.util.Hashtable;
* <p> REJECTED</p>
* @since SmartDeviceLink 2.0
*/
-@Deprecated
public class SetDisplayLayout extends RPCRequest {
public static final String KEY_DISPLAY_LAYOUT = "displayLayout";
public static final String KEY_DAY_COLOR_SCHEME = "dayColorScheme";
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
index bc7a44966..0d136daf6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -41,12 +41,11 @@ import java.util.Hashtable;
import java.util.List;
/**
- * @deprecated This RPC is deprecated. Use Show RPC to change layout.
+ * <Strong>If using Widgets with Core > 6.0, use {@link Show} to change widget layouts</Strong> <br>
* Set Display Layout Response is sent, when SetDisplayLayout has been called
*
* @since SmartDeviceLink 2.0
*/
-@Deprecated
public class SetDisplayLayoutResponse extends RPCResponse {
public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
index d3cf34310..82e7738ee 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
@@ -153,6 +153,7 @@ public class SetGlobalProperties extends RPCRequest {
public static final String KEY_HELP_PROMPT = "helpPrompt";
public static final String KEY_TIMEOUT_PROMPT = "timeoutPrompt";
public static final String KEY_VR_HELP = "vrHelp";
+ public static final String KEY_USER_LOCATION = "userLocation";
public static final String KEY_MENU_LAYOUT = "menuLayout";
/**
* Constructs a new SetGlobalProperties object
@@ -312,6 +313,22 @@ public class SetGlobalProperties extends RPCRequest {
setParameters(KEY_KEYBOARD_PROPERTIES, keyboardProperties);
}
+ /**
+ * Sets the user seat location
+ * @param location the location to be set
+ */
+ public void setUserLocation(SeatLocation location) {
+ setParameters(KEY_USER_LOCATION, location);
+ }
+
+ /**
+ * Gets the user seat location
+ * @return the user seat location
+ */
+ public SeatLocation getUserLocation() {
+ return (SeatLocation) getObject(SeatLocation.class, KEY_USER_LOCATION);
+ }
+
@SuppressWarnings("unchecked")
public KeyboardProperties getKeyboardProperties() {
return (KeyboardProperties) getObject(KeyboardProperties.class, KEY_KEYBOARD_PROPERTIES);
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
index 530352c6d..466879845 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -40,8 +40,9 @@ import java.util.Hashtable;
import java.util.List;
/**
- * <p>Creates a full screen or pop-up overlay (depending on platform) with a single
- * user controlled slider.</p>
+ * Creates a full screen or pop-up overlay (depending on platform) with a single user controlled slider.
+ *
+ * If connecting to SDL Core v.6.0+, the slider can be canceled programmatically using the `cancelID`. On older versions of SDL Core, the slider will persist until the user has interacted with the slider or the specified timeout has elapsed.
*
* <p>Function Group: Base</p>
*
@@ -99,6 +100,14 @@ import java.util.List;
* <td>Minvalue=0; Maxvalue=65535; Defvalue= 10000</td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
+ * <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific slider to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
* </table>
*<p><b>Response </b></p>
*
@@ -124,6 +133,8 @@ public class Slider extends RPCRequest {
public static final String KEY_SLIDER_FOOTER = "sliderFooter";
public static final String KEY_POSITION = "position";
public static final String KEY_TIMEOUT = "timeout";
+ public static final String KEY_CANCEL_ID = "cancelID";
+
/**
* Constructs a new Slider object
*/
@@ -263,4 +274,26 @@ public class Slider extends RPCRequest {
public Integer getTimeout() {
return getInteger(KEY_TIMEOUT);
}
+
+ /**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific slider to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific slider to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
index 76a2414b6..2ea186742 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
@@ -50,8 +50,8 @@ public class SystemCapability extends RPCStruct {
public static final String KEY_VIDEO_STREAMING_CAPABILITY = "videoStreamingCapability";
public static final String KEY_REMOTE_CONTROL_CAPABILITY = "remoteControlCapability";
public static final String KEY_APP_SERVICES_CAPABILITIES = "appServicesCapabilities";
+ public static final String KEY_SEAT_LOCATION_CAPABILITY = "seatLocationCapability";
public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
-
public SystemCapability(){}
public SystemCapability(Hashtable<String, Object> hash) {
@@ -94,8 +94,10 @@ public class SystemCapability extends RPCStruct {
}else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){
return getObject(RemoteControlCapabilities.class, KEY_REMOTE_CONTROL_CAPABILITY);
}else if(type.equals(SystemCapabilityType.APP_SERVICES)){
- return getObject(AppServicesCapabilities.class, KEY_APP_SERVICES_CAPABILITIES);
- }else if(type.equals(SystemCapabilityType.DISPLAYS)){
+ return (RPCStruct) getObject(AppServicesCapabilities.class, KEY_APP_SERVICES_CAPABILITIES);
+ }else if(type.equals(SystemCapabilityType.SEAT_LOCATION)){
+ return (RPCStruct) getObject(SeatLocationCapability.class, KEY_SEAT_LOCATION_CAPABILITY);
+ }else if(type.equals(SystemCapabilityType.DISPLAYS)){
return getObject(DisplayCapability.class, KEY_DISPLAY_CAPABILITIES);
}else{
return null;
@@ -113,12 +115,14 @@ public class SystemCapability extends RPCStruct {
setValue(KEY_VIDEO_STREAMING_CAPABILITY, capability);
}else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){
setValue(KEY_REMOTE_CONTROL_CAPABILITY, capability);
- }else if(type.equals(SystemCapabilityType.APP_SERVICES)) {
- setValue(KEY_APP_SERVICES_CAPABILITIES, capability);
- }else if(type.equals(SystemCapabilityType.DISPLAYS)){
+ }else if(type.equals(SystemCapabilityType.APP_SERVICES)){
+ setValue(KEY_APP_SERVICES_CAPABILITIES, capability);
+ }else if(type.equals(SystemCapabilityType.SEAT_LOCATION)){
+ setValue(KEY_SEAT_LOCATION_CAPABILITY, capability);
+ }else if(type.equals(SystemCapabilityType.DISPLAYS)) {
setValue(KEY_DISPLAY_CAPABILITIES, capability);
}else{
- return;
+ return;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
index d6a0a63aa..0990ef5ad 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
@@ -68,7 +68,12 @@ public enum GlobalProperty{
* The on-screen keyboard configuration of setGlobalProperties
*/
- KEYBOARDPROPERTIES;
+ KEYBOARDPROPERTIES,
+
+ /**
+ * The user seat location of setGlobalProperties
+ */
+ USERLOCATION;
/**
* Convert String to GlobalProperty
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
index 900578400..cdd8b01a5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
@@ -148,6 +148,13 @@ package com.smartdevicelink.proxy.rpc.enums;
* <td align=center>N</td>
* <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</td>
* </tr>
+ * <tr>
+ * <td>SEAT_LOCATION</td>
+ * <td>SeatLocationCapability</td>
+ * <td>Returns SEAT_LOCATION</td>
+ * <td align=center>N</td>
+ * <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</strong></td>
+ * </tr>
* </table>
*
*/
@@ -520,6 +527,27 @@ public enum SystemCapabilityType {
*/
APP_SERVICES (true),
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Enum Name</th>
+ * <th>Return Type</th>
+ * <th>Description</th>
+ * <th>Requires Async?</th>
+ * <th>Notes</th>
+ * </tr>
+ * <tr>
+ * <td>SEAT_LOCATION</td>
+ * <td>SeatLocationCapability</td>
+ * <td>Returns SEAT_LOCATION</td>
+ * <td align=center>N</td>
+ * <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</td>
+ * </tr>
+ * </table>
+ */
+ SEAT_LOCATION (true),
+
;
boolean IS_QUERYABLE;