summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRHenigan <heniganr1@gmail.com>2020-09-01 15:56:13 -0400
committerRHenigan <heniganr1@gmail.com>2020-09-01 15:56:13 -0400
commitc7e761f173d173aa1def1090265941670b955406 (patch)
treefe850bc1f6b8ec91b9b3af9c46146569e4377feb
parentab2977d82e4b071ef63d25cbcf67a007c9accdef (diff)
parent30e11caebce4986594f3267984e2d6d8ead09bce (diff)
downloadsdl_android-refactor/streamingCalls.tar.gz
Merge branch 'develop' into refactor/streamingCallsrefactor/streamingCalls
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetVehicleData.json7
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json5
-rw-r--r--android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java9
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java601
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java902
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java62
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameDataTests.java116
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java1102
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java298
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java58
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CapacityUnitTests.java71
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java32
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java38
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java9
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java11
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BTTransportConfigTests.java43
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java22
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java686
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java17
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java161
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java1030
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStreamController.java64
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java2074
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java8494
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java224
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java66
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java18
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransportConfig.java71
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlTransport.java154
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java557
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java915
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransportConfig.java135
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java847
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java638
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/TextsAndGraphicsState.java122
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/FrameData.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/IProxyListener.java51
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java37
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java461
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/FuelRange.java160
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java105
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java93
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java96
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/StabilityControlsStatus.java125
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java91
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java63
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java102
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java64
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CapacityUnit.java (renamed from android/sdl_android/src/main/java/com/smartdevicelink/proxy/Version.java)42
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/ITransportListener.java48
-rw-r--r--base/src/main/java/com/smartdevicelink/transport/TransportConstants.java10
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/file/FileManager.java37
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java13
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java57
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java4
71 files changed, 3225 insertions, 18280 deletions
diff --git a/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json b/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
index e75de1d3b..085cfedce 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
@@ -34,7 +34,8 @@
"electronicParkBrakeStatus":true,
"gearStatus": true,
"oemCustomVehicleDataName":true,
- "windowStatus": true
+ "windowStatus": true,
+ "stabilityControlsStatus": true
}
},
"response":{
@@ -172,6 +173,10 @@
"range":10.0
}
],
+ "stabilityControlsStatus": {
+ "escSystem": "ON",
+ "trailerSwayControl": "OFF"
+ },
"oemCustomVehicleDataName":"oemCustomVehicleDataState",
"gearStatus": {
"userSelectedGear": "PARK",
diff --git a/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json b/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
index c61da0661..a876a8a10 100644
--- a/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
@@ -31,6 +31,7 @@
"fuelRange":true,
"turnSignal":true,
"electronicParkBrakeStatus":true,
+ "stabilityControlsStatus": true,
"gearStatus": true,
"oemCustomVehicleDataName":true,
"windowStatus": true,
@@ -157,6 +158,10 @@
"dataType":"VEHICLEDATA_HANDSOFFSTEERING",
"resultCode":"SUCCESS"
},
+ "stabilityControlsStatus":{
+ "dataType":"VEHICLEDATA_STABILITYCONTROLSSTATUS",
+ "resultCode":"SUCCESS"
+ },
"gearStatus":{
"dataType":"VEHICLEDATA_GEARSTATUS",
"resultCode":"SUCCESS"
diff --git a/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json b/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
index dd00502e5..e57dea0c8 100644
--- a/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
@@ -31,6 +31,7 @@
"fuelRange":true,
"turnSignal":true,
"electronicParkBrakeStatus":true,
+ "stabilityControlsStatus": true,
"handsOffSteering": true,
"gearStatus": true,
"oemCustomVehicleDataName":true,
@@ -161,6 +162,10 @@
"dataType":"VEHICLEDATA_GEARSTATUS",
"resultCode":"SUCCESS"
},
+ "stabilityControlsStatus":{
+ "dataType":"VEHICLEDATA_STABILITYCONTROLSSTATUS",
+ "resultCode":"SUCCESS"
+ },
"oemCustomVehicleDataName":{
"oemCustomDataType":"oemCustomVehicleDataName",
"resultCode":"SUCCESS"
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
index f1e68e9b3..11d8472c2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
@@ -21,7 +21,6 @@ import java.util.Arrays;
import java.util.List;
import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.assertTrue;
import static org.mockito.Mockito.mock;
@@ -99,14 +98,11 @@ public class ScreenManagerTests {
screenManager.setPrimaryGraphic(testArtwork);
assertEquals(screenManager.getPrimaryGraphic(), testArtwork);
}
-
@Test
public void testSetPrimaryGraphicWithBlankImage() {
screenManager.setPrimaryGraphic(null);
- assertNotNull(screenManager.getPrimaryGraphic());
- assertEquals(screenManager.getPrimaryGraphic().getName(), "blankArtwork");
+ assertNull(screenManager.getPrimaryGraphic());
}
-
@Test
public void testSetSecondaryGraphic() {
screenManager.setSecondaryGraphic(testArtwork);
@@ -116,8 +112,7 @@ public class ScreenManagerTests {
@Test
public void testSetSecondaryGraphicWithBlankImage() {
screenManager.setSecondaryGraphic(null);
- assertNotNull(screenManager.getSecondaryGraphic());
- assertEquals(screenManager.getSecondaryGraphic().getName(), "blankArtwork");
+ assertNull(screenManager.getSecondaryGraphic());
}
@Test
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
index 439b7ebe9..2bb0164fb 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
@@ -4,28 +4,34 @@ import android.content.Context;
import android.net.Uri;
import androidx.test.ext.junit.runners.AndroidJUnit4;
+import com.livio.taskmaster.Task;
+import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.ManagerUtility;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
+import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.interfaces.ISdl;
-import com.smartdevicelink.proxy.rpc.MetadataTags;
-import com.smartdevicelink.proxy.rpc.Show;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
+import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.TextField;
import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
-import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
-import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
@@ -33,7 +39,12 @@ import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertNull;
+import static junit.framework.TestCase.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
/**
* This is a unit test class for the SmartDeviceLink library manager class :
@@ -49,6 +60,7 @@ public class TextAndGraphicManagerTests {
@Before
public void setUp() throws Exception{
Context mTestContext = getInstrumentation().getContext();
+
// mock things
ISdl internalInterface = mock(ISdl.class);
FileManager fileManager = mock(FileManager.class);
@@ -60,6 +72,38 @@ public class TextAndGraphicManagerTests {
testArtwork.setUri(uri);
testArtwork.setType(FileType.GRAPHIC_PNG);
+ Taskmaster taskmaster = new Taskmaster.Builder().build();
+ taskmaster.start();
+ when(internalInterface.getTaskmaster()).thenReturn(taskmaster);
+
+ Answer<Void> onHMIStatusAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ OnRPCNotificationListener onHMIStatusListener = (OnRPCNotificationListener) args[1];
+ OnHMIStatus onHMIStatusFakeNotification = new OnHMIStatus();
+ onHMIStatusFakeNotification.setHmiLevel(HMILevel.HMI_FULL);
+ onHMIStatusListener.onNotified(onHMIStatusFakeNotification);
+ return null;
+ }
+ };
+ doAnswer(onHMIStatusAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_HMI_STATUS), any(OnRPCNotificationListener.class));
+
+ Answer<Void> onSystemCapabilityAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ OnSystemCapabilityListener onSystemCapabilityListener = (OnSystemCapabilityListener) args[1];
+ WindowCapability windowCapability = getWindowCapability(4);
+ DisplayCapability displayCapability = new DisplayCapability();
+ displayCapability.setWindowCapabilities(Collections.singletonList(windowCapability));
+ List<DisplayCapability> capabilities = Collections.singletonList(displayCapability);
+ onSystemCapabilityListener.onCapabilityRetrieved(capabilities);
+ return null;
+ }
+ };
+ doAnswer(onSystemCapabilityAnswer).when(internalInterface).addOnSystemCapabilityListener(eq(SystemCapabilityType.DISPLAYS), any(OnSystemCapabilityListener.class));
+
textAndGraphicManager = new TextAndGraphicManager(internalInterface, fileManager, softButtonManager);
}
@@ -122,13 +166,9 @@ public class TextAndGraphicManagerTests {
assertNull(textAndGraphicManager.getTextField2Type());
assertNull(textAndGraphicManager.getTextField3Type());
assertNull(textAndGraphicManager.getTextField4Type());
-
assertNotNull(textAndGraphicManager.currentScreenData);
- assertNull(textAndGraphicManager.inProgressUpdate);
- assertNull(textAndGraphicManager.queuedImageUpdate);
- assertFalse(textAndGraphicManager.hasQueuedUpdate);
- assertNull(textAndGraphicManager.defaultMainWindowCapability);
- assertEquals(textAndGraphicManager.currentHMILevel, HMILevel.HMI_NONE);
+ assertNotNull(textAndGraphicManager.defaultMainWindowCapability);
+ assertEquals(textAndGraphicManager.currentHMILevel, HMILevel.HMI_FULL);
assertFalse(textAndGraphicManager.isDirty);
assertEquals(textAndGraphicManager.getState(), BaseSubManager.SETTING_UP);
assertNotNull(textAndGraphicManager.getBlankArtwork());
@@ -153,494 +193,6 @@ public class TextAndGraphicManagerTests {
}
@Test
- public void testAssemble1Line(){
-
- Show inputShow = new Show();
-
- // Force it to return display with support for only 1 line of text
- textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(1);
-
- textAndGraphicManager.setTextField1("It is");
- textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
-
- Show assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
-
- // test tags (just 1)
- MetadataTags tags = assembledShow.getMetadataTags();
- List<MetadataType> tagsList = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- assertEquals(tags.getMainField1(), tagsList);
-
- textAndGraphicManager.setTextField2("Wednesday");
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is - Wednesday");
-
- textAndGraphicManager.setTextField3("My");
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is - Wednesday - My");
-
- textAndGraphicManager.setTextField4("Dudes");
- textAndGraphicManager.setTextField4Type(MetadataType.CURRENT_TEMPERATURE);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is - Wednesday - My - Dudes");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList.add(MetadataType.CURRENT_TEMPERATURE);
- assertEquals(tags.getMainField1(), tagsList);
-
- // For some obscurity, lets try setting just fields 2 and 4 for a 1 line display
- textAndGraphicManager.setTextField1(null);
- textAndGraphicManager.setTextField3(null);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "Wednesday - Dudes");
- }
-
- @Test
- public void testAssemble2Lines() {
-
- Show inputShow = new Show();
-
- // Force it to return display with support for only 2 lines of text
- textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(2);
-
- textAndGraphicManager.setTextField1("It is");
- textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
-
- Show assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
-
- // test tags
- MetadataTags tags = assembledShow.getMetadataTags();
- List<MetadataType> tagsList = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- assertEquals(tags.getMainField1(), tagsList);
-
- textAndGraphicManager.setTextField2("Wednesday");
- textAndGraphicManager.setTextField2Type(MetadataType.CURRENT_TEMPERATURE);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "Wednesday");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- List<MetadataType> tagsList2 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
-
- textAndGraphicManager.setTextField3("My");
- textAndGraphicManager.setTextField3Type(MetadataType.MEDIA_ALBUM);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is - Wednesday");
- assertEquals(assembledShow.getMainField2(), "My");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList2 = new ArrayList<>();
- tagsList.add(MetadataType.CURRENT_TEMPERATURE);
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.MEDIA_ALBUM);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
-
- textAndGraphicManager.setTextField4("Dudes");
- textAndGraphicManager.setTextField4Type(MetadataType.MEDIA_STATION);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is - Wednesday");
- assertEquals(assembledShow.getMainField2(), "My - Dudes");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList2 = new ArrayList<>();
- tagsList.add(MetadataType.CURRENT_TEMPERATURE);
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.MEDIA_STATION);
- tagsList2.add(MetadataType.MEDIA_ALBUM);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
-
- // For some obscurity, lets try setting just fields 2 and 4 for a 2 line display
- textAndGraphicManager.setTextField1(null);
- textAndGraphicManager.setTextField3(null);
- textAndGraphicManager.setTextField1Type(null);
- textAndGraphicManager.setTextField3Type(null);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "Wednesday");
- assertEquals(assembledShow.getMainField2(), "Dudes");
-
- // And 3 fields without setting 1
- textAndGraphicManager.setTextField3("My");
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "Wednesday");
- assertEquals(assembledShow.getMainField2(), "My - Dudes");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList2 = new ArrayList<>();
- tagsList.add(MetadataType.CURRENT_TEMPERATURE);
- tagsList2.add(MetadataType.MEDIA_STATION);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
- }
-
- @Test
- public void testAssemble3Lines() {
-
- Show inputShow = new Show();
-
- // Force it to return display with support for only 3 lines of text
- textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(3);
-
- textAndGraphicManager.setTextField1("It is");
- textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
-
- Show assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "");
- assertEquals(assembledShow.getMainField3(), "");
-
- // test tags
- MetadataTags tags = assembledShow.getMetadataTags();
- List<MetadataType> tagsList = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- assertEquals(tags.getMainField1(), tagsList);
-
- textAndGraphicManager.setTextField2("Wednesday");
- textAndGraphicManager.setTextField2Type(MetadataType.CURRENT_TEMPERATURE);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "Wednesday");
- assertEquals(assembledShow.getMainField3(), "");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- List<MetadataType> tagsList2 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
-
- textAndGraphicManager.setTextField3("My");
- textAndGraphicManager.setTextField3Type(MetadataType.MEDIA_ALBUM);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "Wednesday");
- assertEquals(assembledShow.getMainField3(), "My");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList2 = new ArrayList<>();
- List<MetadataType> tagsList3 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
- tagsList3.add(MetadataType.MEDIA_ALBUM);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
- assertEquals(tags.getMainField3(), tagsList3);
-
- textAndGraphicManager.setTextField4("Dudes");
- textAndGraphicManager.setTextField4Type(MetadataType.MEDIA_STATION);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "Wednesday");
- assertEquals(assembledShow.getMainField3(), "My - Dudes");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList2 = new ArrayList<>();
- tagsList3 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
- tagsList3.add(MetadataType.MEDIA_ALBUM);
- tagsList3.add(MetadataType.MEDIA_STATION);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
- assertEquals(tags.getMainField3(), tagsList3);
-
- // Someone might not want to set the fields in order? We should handle that
- textAndGraphicManager.setTextField1(null);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- try {
- System.out.println(assembledShow.serializeJSON().toString());
- } catch (JSONException e) {
- e.printStackTrace();
- }
-
- assertEquals(assembledShow.getMainField2(), "Wednesday");
- assertEquals(assembledShow.getMainField3(), "My - Dudes");
- }
-
- @Test
- public void testAssemble4Lines() {
-
- Show inputShow = new Show();
-
- textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(4);
- TextField tx1 = new TextField();
- TextField tx2 = new TextField();
- TextField tx3 = new TextField();
- TextField tx4 = new TextField();
- TextField tx5 = new TextField();
- TextField tx6 = new TextField();
-
- tx1.setName(TextFieldName.mainField1);
- tx2.setName(TextFieldName.mainField2);
- tx3.setName(TextFieldName.mainField3);
- tx4.setName(TextFieldName.mainField4);
- tx5.setName(TextFieldName.mediaTrack);
- tx6.setName(TextFieldName.templateTitle);
-
- List<TextField> textFieldNames = Arrays.asList(tx1,tx2,tx3,tx4,tx5,tx6);
- textAndGraphicManager.defaultMainWindowCapability.setTextFields(textFieldNames);
-
- textAndGraphicManager.setMediaTrackTextField("HI");
- textAndGraphicManager.setTitle("bye");
-
- // Force it to return display with support for only 4 lines of text
-
- textAndGraphicManager.setTextField1("It is");
- textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
-
- Show assembledShow = textAndGraphicManager.assembleShowText(inputShow);
-
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "");
- assertEquals(assembledShow.getMainField3(), "");
- assertEquals(assembledShow.getMainField4(), "");
- assertEquals(assembledShow.getMediaTrack(), "HI");
- assertEquals(assembledShow.getTemplateTitle(), "bye");
-
- // test tags
- MetadataTags tags = assembledShow.getMetadataTags();
- List<MetadataType> tagsList = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- assertEquals(tags.getMainField1(), tagsList);
-
- textAndGraphicManager.setTextField2("Wednesday");
- textAndGraphicManager.setTextField2Type(MetadataType.CURRENT_TEMPERATURE);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "Wednesday");
- assertEquals(assembledShow.getMainField3(), "");
- assertEquals(assembledShow.getMainField4(), "");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- List<MetadataType> tagsList2 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
-
- textAndGraphicManager.setTextField3("My");
- textAndGraphicManager.setTextField3Type(MetadataType.MEDIA_ALBUM);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "Wednesday");
- assertEquals(assembledShow.getMainField3(), "My");
- assertEquals(assembledShow.getMainField4(), "");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList2 = new ArrayList<>();
- List<MetadataType> tagsList3 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
- tagsList3.add(MetadataType.MEDIA_ALBUM);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
- assertEquals(tags.getMainField3(), tagsList3);
-
- textAndGraphicManager.setTextField4("Dudes");
- textAndGraphicManager.setTextField4Type(MetadataType.MEDIA_STATION);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "Wednesday");
- assertEquals(assembledShow.getMainField3(), "My");
- assertEquals(assembledShow.getMainField4(), "Dudes");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList2 = new ArrayList<>();
- tagsList3 = new ArrayList<>();
- List<MetadataType> tagsList4 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
- tagsList3.add(MetadataType.MEDIA_ALBUM);
- tagsList4.add(MetadataType.MEDIA_STATION);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
- assertEquals(tags.getMainField3(), tagsList3);
- assertEquals(tags.getMainField4(), tagsList4);
-
- // try just setting line 1 and 4
- textAndGraphicManager.setTextField2(null);
- textAndGraphicManager.setTextField3(null);
- textAndGraphicManager.setTextField2Type(null);
- textAndGraphicManager.setTextField3Type(null);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "");
- assertEquals(assembledShow.getMainField3(), "");
- assertEquals(assembledShow.getMainField4(), "Dudes");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList4 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList4.add(MetadataType.MEDIA_STATION);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField4(), tagsList4);
- }
-
- /**
- * Testing if WindowCapability is null, TextFields should still update.
- */
- @Test
- public void testAssemble4LinesNullWindowCapability() {
-
- Show inputShow = new Show();
-
- textAndGraphicManager.setMediaTrackTextField("HI");
- textAndGraphicManager.setTitle("bye");
-
- textAndGraphicManager.setTextField1("It is");
- textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
-
- Show assembledShow = textAndGraphicManager.assembleShowText(inputShow);
-
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "");
- assertEquals(assembledShow.getMainField3(), "");
- assertEquals(assembledShow.getMainField4(), "");
- assertEquals(assembledShow.getMediaTrack(), "HI");
- assertEquals(assembledShow.getTemplateTitle(), "bye");
-
- // test tags
- MetadataTags tags = assembledShow.getMetadataTags();
- List<MetadataType> tagsList = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- assertEquals(tags.getMainField1(), tagsList);
-
- textAndGraphicManager.setTextField2("Wednesday");
- textAndGraphicManager.setTextField2Type(MetadataType.CURRENT_TEMPERATURE);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "Wednesday");
- assertEquals(assembledShow.getMainField3(), "");
- assertEquals(assembledShow.getMainField4(), "");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- List<MetadataType> tagsList2 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
-
- textAndGraphicManager.setTextField3("My");
- textAndGraphicManager.setTextField3Type(MetadataType.MEDIA_ALBUM);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "Wednesday");
- assertEquals(assembledShow.getMainField3(), "My");
- assertEquals(assembledShow.getMainField4(), "");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList2 = new ArrayList<>();
- List<MetadataType> tagsList3 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
- tagsList3.add(MetadataType.MEDIA_ALBUM);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
- assertEquals(tags.getMainField3(), tagsList3);
-
- textAndGraphicManager.setTextField4("Dudes");
- textAndGraphicManager.setTextField4Type(MetadataType.MEDIA_STATION);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "Wednesday");
- assertEquals(assembledShow.getMainField3(), "My");
- assertEquals(assembledShow.getMainField4(), "Dudes");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList2 = new ArrayList<>();
- tagsList3 = new ArrayList<>();
- List<MetadataType> tagsList4 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
- tagsList3.add(MetadataType.MEDIA_ALBUM);
- tagsList4.add(MetadataType.MEDIA_STATION);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField2(), tagsList2);
- assertEquals(tags.getMainField3(), tagsList3);
- assertEquals(tags.getMainField4(), tagsList4);
-
- // try just setting line 1 and 4
- textAndGraphicManager.setTextField2(null);
- textAndGraphicManager.setTextField3(null);
- textAndGraphicManager.setTextField2Type(null);
- textAndGraphicManager.setTextField3Type(null);
-
- assembledShow = textAndGraphicManager.assembleShowText(inputShow);
- assertEquals(assembledShow.getMainField1(), "It is");
- assertEquals(assembledShow.getMainField2(), "");
- assertEquals(assembledShow.getMainField3(), "");
- assertEquals(assembledShow.getMainField4(), "Dudes");
-
- // test tags
- tags = assembledShow.getMetadataTags();
- tagsList = new ArrayList<>();
- tagsList4 = new ArrayList<>();
- tagsList.add(MetadataType.HUMIDITY);
- tagsList4.add(MetadataType.MEDIA_STATION);
- assertEquals(tags.getMainField1(), tagsList);
- assertEquals(tags.getMainField4(), tagsList4);
- }
-
- @Test
public void testMediaTrackTextField() {
String songTitle = "Wild For The Night";
@@ -663,22 +215,6 @@ public class TextAndGraphicManagerTests {
assertEquals(textAndGraphicManager.getTextAlignment(), TextAlignment.LEFT_ALIGNED);
}
- @Test
- public void testExtractTextFromShow(){
-
- Show mainShow = new Show();
- mainShow.setMainField1("test");
- mainShow.setMainField3("Sauce");
- mainShow.setMainField4("");
-
- Show newShow = textAndGraphicManager.extractTextFromShow(mainShow);
-
- assertEquals(newShow.getMainField1(), "test");
- assertEquals(newShow.getMainField3(), "Sauce");
- assertEquals(newShow.getMainField4(), "");
- assertNull(newShow.getMainField2());
- }
-
// TEST IMAGES
@Test
@@ -714,11 +250,40 @@ public class TextAndGraphicManagerTests {
assertNull(textAndGraphicManager.getTitle());
assertNotNull(textAndGraphicManager.getBlankArtwork());
assertNull(textAndGraphicManager.currentScreenData);
- assertNull(textAndGraphicManager.inProgressUpdate);
- assertNull(textAndGraphicManager.queuedImageUpdate);
- assertFalse(textAndGraphicManager.hasQueuedUpdate);
assertNull(textAndGraphicManager.defaultMainWindowCapability);
assertFalse(textAndGraphicManager.isDirty);
assertEquals(textAndGraphicManager.getState(), BaseSubManager.SHUTDOWN);
}
+
+ @Test
+ public void testOperationManagement() {
+ textAndGraphicManager.isDirty = true;
+ textAndGraphicManager.updateOperation = null;
+ textAndGraphicManager.update(null);
+ assertEquals(textAndGraphicManager.transactionQueue.getTasksAsList().size(), 1);
+
+ textAndGraphicManager.transactionQueue.clear();
+ textAndGraphicManager.updateOperation = null;
+
+ assertEquals(textAndGraphicManager.transactionQueue.getTasksAsList().size(), 0);
+
+ textAndGraphicManager.isDirty = true;
+ textAndGraphicManager.update(null);
+
+ assertEquals(textAndGraphicManager.transactionQueue.getTasksAsList().size(), 1);
+
+ assertTrue(textAndGraphicManager.transactionQueue.getTasksAsList().get(0).getState() == Task.READY);
+ }
+
+ @Test
+ public void testHasData() {
+ assertFalse(textAndGraphicManager.hasData());
+
+ textAndGraphicManager.setTextField1("HI");
+ assertTrue(textAndGraphicManager.hasData());
+
+ textAndGraphicManager.setTextField1(null);
+ textAndGraphicManager.setPrimaryGraphic(testArtwork);
+ assertTrue(textAndGraphicManager.hasData());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java
new file mode 100644
index 000000000..cdfab186c
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java
@@ -0,0 +1,902 @@
+package com.smartdevicelink.managers.screen;
+
+import android.content.Context;
+import android.net.Uri;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import com.smartdevicelink.R;
+import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.ManagerUtility;
+import com.smartdevicelink.managers.file.FileManager;
+import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
+import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.file.filetypes.SdlFile;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.ImageField;
+import com.smartdevicelink.proxy.rpc.MetadataTags;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.Show;
+import com.smartdevicelink.proxy.rpc.ShowResponse;
+import com.smartdevicelink.proxy.rpc.TextField;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.enums.FileType;
+import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
+import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
+
+import org.json.JSONException;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+import static junit.framework.TestCase.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@RunWith(AndroidJUnit4.class)
+public class TextAndGraphicUpdateOperationTest {
+
+ private TextAndGraphicUpdateOperation textAndGraphicUpdateOperation;
+ private String textField1, textField2, textField3, textField4, mediaTrackField, title;
+ private MetadataType textField1Type, textField2Type, textField3Type, textField4Type;
+ private SdlArtwork testArtwork1, testArtwork2, testArtwork3, testArtwork4;
+ private TextAlignment textAlignment;
+ private WindowCapability defaultMainWindowCapability;
+ private Show currentScreenData;
+ private CompletionListener listener;
+ private TextAndGraphicManager.CurrentScreenDataUpdatedListener currentScreenDataUpdatedListener;
+ private SdlArtwork blankArtwork;
+ ISdl internalInterface;
+ FileManager fileManager;
+
+ private Answer<Void> onShowSuccess = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ RPCRequest message = (RPCRequest) args[0];
+ if (message instanceof Show) {
+ int correlationId = message.getCorrelationID();
+ ShowResponse showResponse = new ShowResponse();
+ showResponse.setSuccess(true);
+ message.getOnRPCResponseListener().onResponse(correlationId, showResponse);
+ }
+ return null;
+ }
+ };
+
+ private Answer<Void> onShowSuccessCanceled = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ RPCRequest message = (RPCRequest) args[0];
+ if (message instanceof Show) {
+ int correlationId = message.getCorrelationID();
+ textAndGraphicUpdateOperation.cancelTask();
+ ShowResponse showResponse = new ShowResponse();
+ showResponse.setSuccess(true);
+ message.getOnRPCResponseListener().onResponse(correlationId, showResponse);
+ }
+ return null;
+ }
+ };
+
+
+ private Answer<Void> onImageUploadSuccessTaskCanceled = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) throws Throwable {
+ Object[] args = invocation.getArguments();
+ MultipleFileCompletionListener listener = (MultipleFileCompletionListener) args[1];
+ textAndGraphicUpdateOperation.cancelTask();
+ listener.onComplete(null);
+ return null;
+ }
+ };
+
+ private Answer<Void> onArtworkUploadSuccess = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ MultipleFileCompletionListener listener = (MultipleFileCompletionListener) args[1];
+ when(fileManager.hasUploadedFile(any(SdlFile.class))).thenReturn(true);
+ listener.onComplete(null);
+ return null;
+ }
+ };
+
+
+ @Before
+ public void setUp() throws Exception {
+ Context mTestContext = getInstrumentation().getContext();
+ // mock things
+ internalInterface = mock(ISdl.class);
+ fileManager = mock(FileManager.class);
+ setUpCompletionListener();
+ textField1 = "It is";
+ textField2 = "Wednesday";
+ textField3 = "My";
+ textField4 = "Dudes";
+ mediaTrackField = "dudes";
+ title = "dudes";
+
+ blankArtwork = new SdlArtwork();
+ blankArtwork.setType(FileType.GRAPHIC_PNG);
+ blankArtwork.setName("blankArtwork");
+ blankArtwork.setResourceId(R.drawable.transparent);
+
+ textField1Type = MetadataType.MEDIA_TITLE;
+ textField2Type = MetadataType.MEDIA_TITLE;
+ textField3Type = MetadataType.MEDIA_TITLE;
+ textField4Type = MetadataType.MEDIA_TITLE;
+
+
+ textAlignment = TextAlignment.CENTERED;
+
+ testArtwork1 = new SdlArtwork();
+ testArtwork1.setName("testFile1");
+ Uri uri1 = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
+ testArtwork1.setUri(uri1);
+ testArtwork1.setType(FileType.GRAPHIC_PNG);
+
+ testArtwork2 = new SdlArtwork();
+ testArtwork2.setName("testFile2");
+ Uri uri2 = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
+ testArtwork2.setUri(uri2);
+ testArtwork2.setType(FileType.GRAPHIC_PNG);
+
+ testArtwork3 = new SdlArtwork();
+ testArtwork3.setName("testFile3");
+ Uri uri3 = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
+ testArtwork3.setUri(uri3);
+ testArtwork3.setType(FileType.GRAPHIC_PNG);
+
+ testArtwork4 = new SdlArtwork();
+ testArtwork4.setName("testFile4");
+ Uri uri4 = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
+ testArtwork4.setUri(uri4);
+ testArtwork4.setType(FileType.GRAPHIC_PNG);
+
+ currentScreenData = new Show();
+ currentScreenData.setMainField1("Old");
+ currentScreenData.setMainField2("Text");
+ currentScreenData.setMainField3("Not");
+ currentScreenData.setMainField4("Important");
+
+ currentScreenData.setGraphic(testArtwork1.getImageRPC());
+ currentScreenData.setSecondaryGraphic(testArtwork2.getImageRPC());
+
+ currentScreenDataUpdatedListener = new TextAndGraphicManager.CurrentScreenDataUpdatedListener() {
+ @Override
+ public void onUpdate(Show show) {
+
+ }
+ };
+
+ defaultMainWindowCapability = getWindowCapability(4);
+
+ TextsAndGraphicsState textsAndGraphicsState = new TextsAndGraphicsState(textField1, textField2, textField3, textField4,
+ mediaTrackField, title, testArtwork3, testArtwork4, textAlignment, textField1Type, textField2Type, textField3Type, textField4Type);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+ }
+
+
+ private void setUpCompletionListener() {
+ listener = new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+
+ }
+ };
+
+ }
+
+ private WindowCapability getWindowCapability(int numberOfMainFields) {
+
+ TextField mainField1 = new TextField();
+ mainField1.setName(TextFieldName.mainField1);
+ TextField mainField2 = new TextField();
+ mainField2.setName(TextFieldName.mainField2);
+ TextField mainField3 = new TextField();
+ mainField3.setName(TextFieldName.mainField3);
+ TextField mainField4 = new TextField();
+ mainField4.setName(TextFieldName.mainField4);
+
+ List<TextField> textFieldList = new ArrayList<>();
+
+ textFieldList.add(mainField1);
+ textFieldList.add(mainField2);
+ textFieldList.add(mainField3);
+ textFieldList.add(mainField4);
+
+ List<TextField> returnList = new ArrayList<>();
+
+ if (numberOfMainFields > 0) {
+ for (int i = 0; i < numberOfMainFields; i++) {
+ returnList.add(textFieldList.get(i));
+ }
+ }
+
+ WindowCapability windowCapability = new WindowCapability();
+ windowCapability.setTextFields(returnList);
+
+ ImageField imageField = new ImageField();
+ imageField.setName(ImageFieldName.graphic);
+ ImageField imageField2 = new ImageField();
+ imageField2.setName(ImageFieldName.secondaryGraphic);
+ List<ImageField> imageFieldList = new ArrayList<>();
+ imageFieldList.add(imageField);
+ imageFieldList.add(imageField2);
+ windowCapability.setImageFields(imageFieldList);
+
+ windowCapability.setImageFields(imageFieldList);
+
+ return windowCapability;
+ }
+
+ /**
+ * Used to simulate WindowCapability having no capabilities set
+ *
+ * @return windowCapability that has no capabilities set
+ */
+ private WindowCapability getNullVarWindowCapability() {
+
+ WindowCapability windowCapability = new WindowCapability();
+ return windowCapability;
+ }
+
+ @Test
+ public void testUploads() {
+ doAnswer(onShowSuccess).when(internalInterface).sendRPC(any(Show.class));
+ doAnswer(onArtworkUploadSuccess).when(fileManager).uploadArtworks(any(List.class), any(MultipleFileCompletionListener.class));
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(4, 0));
+
+ // Test Images need to be uploaded, sending text and uploading images
+ textAndGraphicUpdateOperation.onExecute();
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getMainField1(), textField1);
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getMainField2(), textField2);
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getMainField3(), textField3);
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getMainField4(), textField4);
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getAlignment(), textAlignment);
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getGraphic(), testArtwork3.getImageRPC());
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getSecondaryGraphic(), testArtwork4.getImageRPC());
+
+
+ // Test The files to be updated are already uploaded, send the full show immediately
+ String textField11 = "It's not";
+ TextsAndGraphicsState textsAndGraphicsState = new TextsAndGraphicsState(textField11, textField2, textField3, textField4,
+ mediaTrackField, title, testArtwork1, testArtwork2, textAlignment, textField1Type, textField2Type, textField3Type, textField4Type);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+ textAndGraphicUpdateOperation.onExecute();
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getMainField1(), textField11);
+
+ //Test: If there are no images to update, just send the text
+ TextsAndGraphicsState textsAndGraphicsStateNullImages = new TextsAndGraphicsState(textField1, textField2, textField3, textField4,
+ mediaTrackField, title, blankArtwork, blankArtwork, textAlignment, textField1Type, textField2Type, textField3Type, textField4Type);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsStateNullImages, listener, currentScreenDataUpdatedListener);
+ textAndGraphicUpdateOperation.onExecute();
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getMainField1(), textField1);
+
+ // Verifies that uploadArtworks gets called only with the fist textAndGraphicsUpdateOperation.onExecute call
+ verify(fileManager, times(1)).uploadArtworks(any(List.class), any(MultipleFileCompletionListener.class));
+ }
+
+ @Test
+ public void testCanceledRightAway() {
+ textAndGraphicUpdateOperation.cancelTask();
+ textAndGraphicUpdateOperation.onExecute();
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getMainField1(), "Old");
+ }
+
+ @Test
+ public void testTaskCanceledAfterImageUpload() {
+ doAnswer(onShowSuccess).when(internalInterface).sendRPC(any(Show.class));
+ doAnswer(onImageUploadSuccessTaskCanceled).when(fileManager).uploadArtworks(any(List.class), any(MultipleFileCompletionListener.class));
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 0));
+
+ // Test Canceled after Image upload
+ textAndGraphicUpdateOperation.onExecute();
+ verify(internalInterface, times(1)).sendRPC(any(Show.class));
+ assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getMainField1(), textField1);
+
+ }
+
+ @Test
+ public void testTaskCanceledAfterTextSent() {
+ doAnswer(onShowSuccessCanceled).when(internalInterface).sendRPC(any(Show.class));
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 0));
+
+ textAndGraphicUpdateOperation.onExecute();
+ verify(fileManager, times(0)).uploadArtworks(any(List.class), any(MultipleFileCompletionListener.class));
+
+ }
+
+ /**
+ * Test getting number of lines available to be set based off of windowCapability
+ */
+ @Test
+ public void testGetMainLines() {
+
+ // We want to test that the looping works. By default, it will return 4 if display cap is null
+ textAndGraphicUpdateOperation.defaultMainWindowCapability = getNullVarWindowCapability();
+
+ // Null test
+ assertEquals(0, ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(textAndGraphicUpdateOperation.defaultMainWindowCapability));
+
+ // The tests.java class has an example of this, but we must build it to do what
+ // we need it to do. Build display cap w/ 3 main fields and test that it returns 3
+ textAndGraphicUpdateOperation.defaultMainWindowCapability = getWindowCapability(3);
+ assertEquals(ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(textAndGraphicUpdateOperation.defaultMainWindowCapability), 3);
+ }
+
+
+ @Test
+ public void testAssemble1Line() {
+
+ Show inputShow = new Show();
+
+ TextsAndGraphicsState textsAndGraphicsState = new TextsAndGraphicsState(textField1, null, null, null,
+ mediaTrackField, title, testArtwork3, testArtwork4, textAlignment, MetadataType.HUMIDITY, null, null, null);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, getWindowCapability(1), currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ Show assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+
+ // test tags (just 1)
+ MetadataTags tags = assembledShow.getMetadataTags();
+ List<MetadataType> tagsList = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ assertEquals(tags.getMainField1(), tagsList);
+
+ textsAndGraphicsState.setTextField2(textField2);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, getWindowCapability(1), currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is - Wednesday");
+
+ textsAndGraphicsState.setTextField3(textField3);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, getWindowCapability(1), currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is - Wednesday - My");
+
+ textsAndGraphicsState.setTextField4(textField4);
+ textsAndGraphicsState.setTextField4Type(MetadataType.CURRENT_TEMPERATURE);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, getWindowCapability(1), currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is - Wednesday - My - Dudes");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList.add(MetadataType.CURRENT_TEMPERATURE);
+ assertEquals(tags.getMainField1(), tagsList);
+
+ // For some obscurity, lets try setting just fields 2 and 4 for a 1 line display
+ textsAndGraphicsState.setTextField1(null);
+ textsAndGraphicsState.setTextField3(null);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, getWindowCapability(1), currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "Wednesday - Dudes");
+ }
+
+ @Test
+ public void testAssemble2Lines() {
+
+ Show inputShow = new Show();
+ defaultMainWindowCapability = getWindowCapability(2);
+
+ // Force it to return display with support for only 2 lines of text
+ TextsAndGraphicsState textsAndGraphicsState = new TextsAndGraphicsState(textField1, null, null, null,
+ mediaTrackField, title, testArtwork3, testArtwork4, textAlignment, MetadataType.HUMIDITY, null, null, null);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ Show assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+
+ // test tags
+ MetadataTags tags = assembledShow.getMetadataTags();
+ List<MetadataType> tagsList = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ assertEquals(tags.getMainField1(), tagsList);
+
+ textsAndGraphicsState.setTextField2(textField2);
+ textsAndGraphicsState.setTextField2Type(MetadataType.CURRENT_TEMPERATURE);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ List<MetadataType> tagsList2 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+
+ textsAndGraphicsState.setTextField3(textField3);
+ textsAndGraphicsState.setTextField3Type(MetadataType.MEDIA_ALBUM);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, getWindowCapability(2), currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is - Wednesday");
+ assertEquals(assembledShow.getMainField2(), "My");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList2 = new ArrayList<>();
+ tagsList.add(MetadataType.CURRENT_TEMPERATURE);
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.MEDIA_ALBUM);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+
+ textsAndGraphicsState.setTextField4(textField4);
+ textsAndGraphicsState.setTextField4Type(MetadataType.MEDIA_STATION);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, getWindowCapability(2), currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is - Wednesday");
+ assertEquals(assembledShow.getMainField2(), "My - Dudes");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList2 = new ArrayList<>();
+ tagsList.add(MetadataType.CURRENT_TEMPERATURE);
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.MEDIA_STATION);
+ tagsList2.add(MetadataType.MEDIA_ALBUM);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+
+ // For some obscurity, lets try setting just fields 2 and 4 for a 2 line display
+ textsAndGraphicsState.setTextField1(null);
+ textsAndGraphicsState.setTextField3(null);
+ textsAndGraphicsState.setTextField1Type(null);
+ textsAndGraphicsState.setTextField3Type(null);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, getWindowCapability(2), currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "Wednesday");
+ assertEquals(assembledShow.getMainField2(), "Dudes");
+
+ // And 3 fields without setting 1
+ textsAndGraphicsState.setTextField3(textField3);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, getWindowCapability(2), currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "Wednesday");
+ assertEquals(assembledShow.getMainField2(), "My - Dudes");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList2 = new ArrayList<>();
+ tagsList.add(MetadataType.CURRENT_TEMPERATURE);
+ tagsList2.add(MetadataType.MEDIA_STATION);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+ }
+
+ @Test
+ public void testAssemble3Lines() {
+
+ Show inputShow = new Show();
+
+ // Force it to return display with support for only 3 lines of text
+ defaultMainWindowCapability = getWindowCapability(3);
+ TextsAndGraphicsState textsAndGraphicsState = new TextsAndGraphicsState(textField1, null, null, null,
+ mediaTrackField, title, testArtwork3, testArtwork4, textAlignment, MetadataType.HUMIDITY, null, null, null);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ Show assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "");
+ assertEquals(assembledShow.getMainField3(), "");
+
+ // test tags
+ MetadataTags tags = assembledShow.getMetadataTags();
+ List<MetadataType> tagsList = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ assertEquals(tags.getMainField1(), tagsList);
+
+ textsAndGraphicsState.setTextField2(textField2);
+ textsAndGraphicsState.setTextField2Type(MetadataType.CURRENT_TEMPERATURE);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+ assertEquals(assembledShow.getMainField3(), "");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ List<MetadataType> tagsList2 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+
+ textsAndGraphicsState.setTextField3(textField3);
+ textsAndGraphicsState.setTextField3Type(MetadataType.MEDIA_ALBUM);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+ assertEquals(assembledShow.getMainField3(), "My");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList2 = new ArrayList<>();
+ List<MetadataType> tagsList3 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
+ tagsList3.add(MetadataType.MEDIA_ALBUM);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+ assertEquals(tags.getMainField3(), tagsList3);
+
+ textsAndGraphicsState.setTextField4(textField4);
+ textsAndGraphicsState.setTextField4Type(MetadataType.MEDIA_STATION);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+ assertEquals(assembledShow.getMainField3(), "My - Dudes");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList2 = new ArrayList<>();
+ tagsList3 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
+ tagsList3.add(MetadataType.MEDIA_ALBUM);
+ tagsList3.add(MetadataType.MEDIA_STATION);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+ assertEquals(tags.getMainField3(), tagsList3);
+
+ // Someone might not want to set the fields in order? We should handle that
+ textsAndGraphicsState.setTextField1(null);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ try {
+ System.out.println(assembledShow.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+ assertEquals(assembledShow.getMainField3(), "My - Dudes");
+ }
+
+ @Test
+ public void testAssemble4Lines() {
+
+ Show inputShow = new Show();
+
+ defaultMainWindowCapability = getWindowCapability(4);
+ TextField tx1 = new TextField();
+ TextField tx2 = new TextField();
+ TextField tx3 = new TextField();
+ TextField tx4 = new TextField();
+ TextField tx5 = new TextField();
+ TextField tx6 = new TextField();
+
+ tx1.setName(TextFieldName.mainField1);
+ tx2.setName(TextFieldName.mainField2);
+ tx3.setName(TextFieldName.mainField3);
+ tx4.setName(TextFieldName.mainField4);
+ tx5.setName(TextFieldName.mediaTrack);
+ tx6.setName(TextFieldName.templateTitle);
+
+ List<TextField> textFieldNames = Arrays.asList(tx1, tx2, tx3, tx4, tx5, tx6);
+ defaultMainWindowCapability.setTextFields(textFieldNames);
+
+ TextsAndGraphicsState textsAndGraphicsState = new TextsAndGraphicsState(textField1, null, null, null,
+ mediaTrackField, title, testArtwork3, testArtwork4, textAlignment, MetadataType.HUMIDITY, null, null, null);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+ textsAndGraphicsState.setMediaTrackTextField("HI");
+ textsAndGraphicsState.setTitle("bye");
+
+ // Force it to return display with support for only 4 lines of text
+ Show assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "");
+ assertEquals(assembledShow.getMainField3(), "");
+ assertEquals(assembledShow.getMainField4(), "");
+ assertEquals(assembledShow.getMediaTrack(), "HI");
+ assertEquals(assembledShow.getTemplateTitle(), "bye");
+
+ // test tags
+ MetadataTags tags = assembledShow.getMetadataTags();
+ List<MetadataType> tagsList = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ assertEquals(tags.getMainField1(), tagsList);
+
+ textsAndGraphicsState.setTextField2("Wednesday");
+ textsAndGraphicsState.setTextField2Type(MetadataType.CURRENT_TEMPERATURE);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+ assertEquals(assembledShow.getMainField3(), "");
+ assertEquals(assembledShow.getMainField4(), "");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ List<MetadataType> tagsList2 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+
+ textsAndGraphicsState.setTextField3("My");
+ textsAndGraphicsState.setTextField3Type(MetadataType.MEDIA_ALBUM);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+ assertEquals(assembledShow.getMainField3(), "My");
+ assertEquals(assembledShow.getMainField4(), "");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList2 = new ArrayList<>();
+ List<MetadataType> tagsList3 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
+ tagsList3.add(MetadataType.MEDIA_ALBUM);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+ assertEquals(tags.getMainField3(), tagsList3);
+
+ textsAndGraphicsState.setTextField4("Dudes");
+ textsAndGraphicsState.setTextField4Type(MetadataType.MEDIA_STATION);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+ assertEquals(assembledShow.getMainField3(), "My");
+ assertEquals(assembledShow.getMainField4(), "Dudes");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList2 = new ArrayList<>();
+ tagsList3 = new ArrayList<>();
+ List<MetadataType> tagsList4 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
+ tagsList3.add(MetadataType.MEDIA_ALBUM);
+ tagsList4.add(MetadataType.MEDIA_STATION);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+ assertEquals(tags.getMainField3(), tagsList3);
+ assertEquals(tags.getMainField4(), tagsList4);
+
+ // try just setting line 1 and 4
+ textsAndGraphicsState.setTextField2(null);
+ textsAndGraphicsState.setTextField3(null);
+ textsAndGraphicsState.setTextField2Type(null);
+ textsAndGraphicsState.setTextField3Type(null);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "");
+ assertEquals(assembledShow.getMainField3(), "");
+ assertEquals(assembledShow.getMainField4(), "Dudes");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList4 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList4.add(MetadataType.MEDIA_STATION);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField4(), tagsList4);
+ }
+
+ /**
+ * Testing if WindowCapability is null, TextFields should still update.
+ */
+ @Test
+ public void testAssemble4LinesNullWindowCapability() {
+
+ Show inputShow = new Show();
+
+ TextsAndGraphicsState textsAndGraphicsState = new TextsAndGraphicsState(textField1, null, null, null,
+ mediaTrackField, title, testArtwork3, testArtwork4, textAlignment, MetadataType.HUMIDITY, null, null, null);
+
+ textsAndGraphicsState.setMediaTrackTextField("HI");
+ textsAndGraphicsState.setTitle("bye");
+
+ textsAndGraphicsState.setTextField1("It is");
+ textsAndGraphicsState.setTextField1Type(MetadataType.HUMIDITY);
+
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, null, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ Show assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "");
+ assertEquals(assembledShow.getMainField3(), "");
+ assertEquals(assembledShow.getMainField4(), "");
+ assertEquals(assembledShow.getMediaTrack(), "HI");
+ assertEquals(assembledShow.getTemplateTitle(), "bye");
+
+ // test tags
+ MetadataTags tags = assembledShow.getMetadataTags();
+ List<MetadataType> tagsList = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ assertEquals(tags.getMainField1(), tagsList);
+
+ textsAndGraphicsState.setTextField2("Wednesday");
+ textsAndGraphicsState.setTextField2Type(MetadataType.CURRENT_TEMPERATURE);
+
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, null, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+ assertEquals(assembledShow.getMainField3(), "");
+ assertEquals(assembledShow.getMainField4(), "");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ List<MetadataType> tagsList2 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+
+ textsAndGraphicsState.setTextField3("My");
+ textsAndGraphicsState.setTextField3Type(MetadataType.MEDIA_ALBUM);
+
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, null, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+ assertEquals(assembledShow.getMainField3(), "My");
+ assertEquals(assembledShow.getMainField4(), "");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList2 = new ArrayList<>();
+ List<MetadataType> tagsList3 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
+ tagsList3.add(MetadataType.MEDIA_ALBUM);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+ assertEquals(tags.getMainField3(), tagsList3);
+
+ textsAndGraphicsState.setTextField4("Dudes");
+ textsAndGraphicsState.setTextField4Type(MetadataType.MEDIA_STATION);
+
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, null, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "Wednesday");
+ assertEquals(assembledShow.getMainField3(), "My");
+ assertEquals(assembledShow.getMainField4(), "Dudes");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList2 = new ArrayList<>();
+ tagsList3 = new ArrayList<>();
+ List<MetadataType> tagsList4 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList2.add(MetadataType.CURRENT_TEMPERATURE);
+ tagsList3.add(MetadataType.MEDIA_ALBUM);
+ tagsList4.add(MetadataType.MEDIA_STATION);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField2(), tagsList2);
+ assertEquals(tags.getMainField3(), tagsList3);
+ assertEquals(tags.getMainField4(), tagsList4);
+
+ // try just setting line 1 and 4
+ textsAndGraphicsState.setTextField2(null);
+ textsAndGraphicsState.setTextField3(null);
+ textsAndGraphicsState.setTextField2Type(null);
+ textsAndGraphicsState.setTextField3Type(null);
+
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, null, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+
+ assembledShow = textAndGraphicUpdateOperation.assembleShowText(inputShow);
+ assertEquals(assembledShow.getMainField1(), "It is");
+ assertEquals(assembledShow.getMainField2(), "");
+ assertEquals(assembledShow.getMainField3(), "");
+ assertEquals(assembledShow.getMainField4(), "Dudes");
+
+ // test tags
+ tags = assembledShow.getMetadataTags();
+ tagsList = new ArrayList<>();
+ tagsList4 = new ArrayList<>();
+ tagsList.add(MetadataType.HUMIDITY);
+ tagsList4.add(MetadataType.MEDIA_STATION);
+ assertEquals(tags.getMainField1(), tagsList);
+ assertEquals(tags.getMainField4(), tagsList4);
+ }
+
+ @Test
+ public void testExtractTextFromShow() {
+ Show mainShow = new Show();
+ mainShow.setMainField1("test");
+ mainShow.setMainField3("Sauce");
+ mainShow.setMainField4("");
+
+ Show newShow = textAndGraphicUpdateOperation.extractTextFromShow(mainShow);
+
+ assertEquals(newShow.getMainField1(), "test");
+ assertEquals(newShow.getMainField3(), "Sauce");
+ assertEquals(newShow.getMainField4(), "");
+ assertNull(newShow.getMainField2());
+ }
+
+ @Test
+ public void testCreateImageOnlyShowWithPrimaryArtwork() {
+ // Test null
+ Show testShow = textAndGraphicUpdateOperation.createImageOnlyShowWithPrimaryArtwork(null, null);
+ assertNull(testShow);
+
+ // Test when artwork hasn't been uploaded
+ when(fileManager.hasUploadedFile(any(SdlFile.class))).thenReturn(false);
+ TextsAndGraphicsState textsAndGraphicsState = new TextsAndGraphicsState(textField1, textField2, textField3, textField4,
+ mediaTrackField, title, testArtwork3, testArtwork4, textAlignment, textField1Type, textField2Type, textField3Type, textField4Type);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+ testShow = textAndGraphicUpdateOperation.createImageOnlyShowWithPrimaryArtwork(testArtwork1, testArtwork2);
+ assertNull(testShow);
+
+ // Test when artwork has been uploaded
+ when(fileManager.hasUploadedFile(any(SdlFile.class))).thenReturn(true);
+ textsAndGraphicsState = new TextsAndGraphicsState(textField1, textField2, textField3, textField4,
+ mediaTrackField, title, testArtwork3, testArtwork4, textAlignment, textField1Type, textField2Type, textField3Type, textField4Type);
+ textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
+ testShow = textAndGraphicUpdateOperation.createImageOnlyShowWithPrimaryArtwork(testArtwork1, testArtwork2);
+ assertEquals(testShow.getGraphic(), testArtwork1.getImageRPC());
+ assertEquals(testShow.getSecondaryGraphic(), testArtwork2.getImageRPC());
+ }
+
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
index 05d0327a7..bd82d2d5d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java
@@ -6,6 +6,7 @@ import android.util.Log;
import com.smartdevicelink.R;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleManager;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
import com.smartdevicelink.managers.screen.choiceset.ChoiceCell;
import com.smartdevicelink.managers.screen.menu.MenuCell;
@@ -15,7 +16,6 @@ import com.smartdevicelink.managers.screen.menu.VoiceCommand;
import com.smartdevicelink.managers.screen.menu.VoiceCommandSelectionListener;
import com.smartdevicelink.protocol.SdlProtocol;
import com.smartdevicelink.protocol.enums.FunctionID;
-import com.smartdevicelink.proxy.SdlProxyBase;
import com.smartdevicelink.proxy.TTSChunkFactory;
import com.smartdevicelink.proxy.rpc.AppInfo;
import com.smartdevicelink.proxy.rpc.AppServiceCapability;
@@ -89,6 +89,7 @@ import com.smartdevicelink.proxy.rpc.SingleTireStatus;
import com.smartdevicelink.proxy.rpc.SisData;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.StabilityControlsStatus;
import com.smartdevicelink.proxy.rpc.StartTime;
import com.smartdevicelink.proxy.rpc.StationIDNumber;
import com.smartdevicelink.proxy.rpc.SystemCapability;
@@ -125,6 +126,7 @@ import com.smartdevicelink.proxy.rpc.enums.BitsPerSample;
import com.smartdevicelink.proxy.rpc.enums.ButtonEventMode;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.proxy.rpc.enums.ButtonPressMode;
+import com.smartdevicelink.proxy.rpc.enums.CapacityUnit;
import com.smartdevicelink.proxy.rpc.enums.CarModeStatus;
import com.smartdevicelink.proxy.rpc.enums.CharacterSet;
import com.smartdevicelink.proxy.rpc.enums.CompassDirection;
@@ -224,7 +226,7 @@ import java.util.Vector;
public class TestValues {
//Versions
- public static final Version MAX_RPC_VERSION_SUPPORTED = SdlProxyBase.MAX_SUPPORTED_RPC_VERSION;
+ public static final Version MAX_RPC_VERSION_SUPPORTED = LifecycleManager.MAX_SUPPORTED_RPC_VERSION;
/**
* @see SdlProtocol
*/
@@ -335,6 +337,7 @@ public class TestValues {
public static final VehicleDataResultCode GENERAL_VEHICLEDATARESULTCODE = VehicleDataResultCode.IGNORED;
public static final ComponentVolumeStatus GENERAL_COMPONENTVOLUMESTATUS = ComponentVolumeStatus.LOW;
public static final PresetBankCapabilities GENERAL_PRESETBANKCAPABILITIES = new PresetBankCapabilities();
+ public static final CapacityUnit GENERAL_CAPACITYUNIT = CapacityUnit.KILOGRAMS;
public static final VehicleDataEventStatus GENERAL_VEHCILEDATAEVENTSTATUS = VehicleDataEventStatus.YES;
public static final VehicleDataEventStatus GENERAL_VEHICLEDATAEVENTSTATUS = VehicleDataEventStatus.YES;
public static final TouchEventCapabilities GENERAL_TOUCHEVENTCAPABILITIES = new TouchEventCapabilities();
@@ -444,6 +447,9 @@ public class TestValues {
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 StabilityControlsStatus GENERAL_STABILITY_CONTROL_STATUS = new StabilityControlsStatus();
+ public static final VehicleDataStatus GENERAL_ESC_SYSTEM = VehicleDataStatus.ON;
+ public static final VehicleDataStatus GENERAL_S_WAY_CONTROL = VehicleDataStatus.OFF;
public static final WindowType GENERAL_WINDOWTYPE = WindowType.MAIN;
public static final GearStatus GENERAL_GEAR_STATUS = new GearStatus();
public static final PRNDL GENERAL_USER_SELECTED_GEAR = PRNDL.NEUTRAL;
@@ -1143,6 +1149,8 @@ public class TestValues {
GENERAL_WINDOW_STATUS.setLocation(TestValues.GENERAL_GRID);
GENERAL_WINDOW_STATUS.setState(TestValues.GENERAL_WINDOW_STATE);
+ GENERAL_STABILITY_CONTROL_STATUS.setEscSystem(GENERAL_ESC_SYSTEM);
+ GENERAL_STABILITY_CONTROL_STATUS.setTrailerSwayControl(GENERAL_S_WAY_CONTROL);
try {
JSON_HMIPERMISSIONS.put(HMIPermissions.KEY_ALLOWED, GENERAL_HMILEVEL_LIST);
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 d34bfea07..da99ac3fd 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
@@ -1,7 +1,6 @@
package com.smartdevicelink.test;
import com.smartdevicelink.managers.file.filetypes.SdlFile;
-import com.smartdevicelink.protocol.enums.FrameData;
import com.smartdevicelink.protocol.enums.FrameDataControlFrameType;
import com.smartdevicelink.protocol.enums.FrameType;
import com.smartdevicelink.protocol.enums.SessionType;
@@ -146,28 +145,7 @@ public class Validator{
return true;
}
-
- public static boolean validateFrameDataArray (FrameData[] array1, FrameData[] array2) {
- if (array1 == null) {
- return (array2 == null);
- }
-
- if (array2 == null) {
- return (array1 == null);
- }
-
- if (array1.length != array2.length) {
- return false;
- }
-
- for (int i = 0; i < array1.length; i++) {
- if (array1[i] != array2[i]) {
- return false;
- }
- }
-
- return true;
- }
+
public static boolean validateImage(Image image1, Image image2){
if(image1 == null){
@@ -2343,7 +2321,23 @@ public class Validator{
if (item1.get(i).getType() != item2.get(i).getType()) {
return false;
}
- if (item1.get(i).getRange() != item2.get(i).getRange()) {
+ if (!item1.get(i).getRange().equals(item2.get(i).getRange())) {
+ return false;
+ }
+
+ if (!item1.get(i).getCapacity().equals(item2.get(i).getCapacity())) {
+ return false;
+ }
+
+ if (!item1.get(i).getCapacityUnit().equals(item2.get(i).getCapacityUnit())) {
+ return false;
+ }
+
+ if (!item1.get(i).getLevel().equals(item2.get(i).getLevel())) {
+ return false;
+ }
+
+ if (!item1.get(i).getLevelState().equals(item2.get(i).getLevelState())) {
return false;
}
}
@@ -3913,4 +3907,24 @@ public class Validator{
return approxPosition1.equals(approxPosition2) && deviation1.equals(deviation2);
}
+
+ public static boolean validateStabilityControlStatus(StabilityControlsStatus status1, StabilityControlsStatus status2) {
+ if (status1 == null) {
+ return (status2 == null);
+ }
+ if (status2 == null) {
+ return (status2 == null);
+ }
+ return status1.getEscSystem().equals(status2.getEscSystem()) && status1.getTrailerSwayControl().equals(status2.getTrailerSwayControl());
+ }
+
+ public static boolean validateStabilityControlStatus(VehicleDataResult status1, VehicleDataResult status2) {
+ if (status1 == null) {
+ return (status2 == null);
+ }
+ if (status2 == null) {
+ return (status2 == null);
+ }
+ return status1.getDataType().equals(status2.getDataType()) && status1.getResultCode().equals(status2.getResultCode());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
index 542cf28c3..569b13b13 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
@@ -16,10 +16,12 @@ import com.smartdevicelink.proxy.rpc.HeadLampStatus;
import com.smartdevicelink.proxy.rpc.MyKey;
import com.smartdevicelink.proxy.rpc.OnVehicleData;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
+import com.smartdevicelink.proxy.rpc.StabilityControlsStatus;
import com.smartdevicelink.proxy.rpc.TireStatus;
import com.smartdevicelink.proxy.rpc.WindowState;
import com.smartdevicelink.proxy.rpc.WindowStatus;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
+import com.smartdevicelink.proxy.rpc.enums.CapacityUnit;
import com.smartdevicelink.proxy.rpc.enums.CarModeStatus;
import com.smartdevicelink.proxy.rpc.enums.CompassDirection;
import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
@@ -84,6 +86,7 @@ public class VehicleDataHelper{
public static final List<FuelRange> FUEL_RANGE_LIST = new ArrayList<FuelRange>(1);
public static final TurnSignal TURN_SIGNAL = TurnSignal.OFF;
public static final ElectronicParkBrakeStatus ELECTRONIC_PARK_BRAKE_STATUS = ElectronicParkBrakeStatus.CLOSED;
+ public static final StabilityControlsStatus STABILITY_CONTROLS_STATUS = new StabilityControlsStatus();
public static final String OEM_CUSTOM_VEHICLE_DATA_STATE = "oemCustomVehicleDataState";
public static final Boolean HANDS_OFF_STEERING = Boolean.TRUE;
@@ -197,6 +200,10 @@ public class VehicleDataHelper{
// fuel range
public static final FuelType FUEL_RANGE_TYPE = FuelType.GASOLINE;
public static final Float FUEL_RANGE_RANGE = TestValues.GENERAL_FLOAT;
+ public static final Float FUEL_RANGE_CAPACITY = TestValues.GENERAL_FLOAT;
+ public static final CapacityUnit FUEL_RANGE_CAPACITY_UNIT = TestValues.GENERAL_CAPACITYUNIT;
+ public static final Float FUEL_RANGE_LEVEL = TestValues.GENERAL_FLOAT;
+ public static final ComponentVolumeStatus FUEL_RANGE_LEVEL_STATE = TestValues.GENERAL_COMPONENTVOLUMESTATUS;
// Gear status
public static final GearStatus GEAR_STATUS = new GearStatus();
@@ -208,6 +215,10 @@ public class VehicleDataHelper{
public static final Grid LOCATION_GRID = TestValues.GENERAL_LOCATION_GRID;
public static final WindowState WINDOW_STATE = TestValues.GENERAL_WINDOW_STATE;
+ // stability control status
+ public static final VehicleDataStatus ESC_SYSTEM = VehicleDataStatus.ON;
+ public static final VehicleDataStatus S_WAY_TRAILER = VehicleDataStatus.OFF;
+
public static final JSONArray JSON_FUEL_RANGE = new JSONArray();
//the OnVehicleData which stores all the information above
@@ -336,6 +347,10 @@ public class VehicleDataHelper{
// FUEL_RANGE and FUEL_RANGE_LIST set up
FUEL_RANGE.setType(FUEL_RANGE_TYPE);
FUEL_RANGE.setRange(FUEL_RANGE_RANGE);
+ FUEL_RANGE.setCapacity(FUEL_RANGE_CAPACITY);
+ FUEL_RANGE.setCapacityUnit(FUEL_RANGE_CAPACITY_UNIT);
+ FUEL_RANGE.setLevel(FUEL_RANGE_LEVEL);
+ FUEL_RANGE.setLevelState(FUEL_RANGE_LEVEL_STATE);
FUEL_RANGE_LIST.add(FUEL_RANGE);
//WINDOW_STATUS and WINDOW_STATUS_LIST set up
@@ -349,6 +364,10 @@ public class VehicleDataHelper{
e.printStackTrace();
}
+ // STABILITY_CONTROLS_STATUS
+ STABILITY_CONTROLS_STATUS.setEscSystem(VehicleDataStatus.ON);
+ STABILITY_CONTROLS_STATUS.setTrailerSwayControl(VehicleDataStatus.OFF);
+
// GEAR_STATUS
GEAR_STATUS.setTransmissionType(TRANSMISSION_TYPE);
GEAR_STATUS.setUserSelectedGear(USER_SELECTED_GEAR);
@@ -386,6 +405,7 @@ public class VehicleDataHelper{
VEHICLE_DATA.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
VEHICLE_DATA.setGearStatus(GEAR_STATUS);
VEHICLE_DATA.setWindowStatus(WINDOW_STATUS_LIST);
+ VEHICLE_DATA.setStabilityControlsStatus(STABILITY_CONTROLS_STATUS);
VEHICLE_DATA.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
VEHICLE_DATA.setHandsOffSteering(HANDS_OFF_STEERING);
//set up the GetVehicleDataResponse object
@@ -420,6 +440,7 @@ public class VehicleDataHelper{
VEHICLE_DATA_RESPONSE.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
VEHICLE_DATA_RESPONSE.setGearStatus(GEAR_STATUS);
VEHICLE_DATA_RESPONSE.setWindowStatus(WINDOW_STATUS_LIST);
+ VEHICLE_DATA_RESPONSE.setStabilityControlsStatus(STABILITY_CONTROLS_STATUS);
VEHICLE_DATA_RESPONSE.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
VEHICLE_DATA_RESPONSE.setHandsOffSteering(HANDS_OFF_STEERING);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameDataTests.java
deleted file mode 100644
index e2ad1ea3a..000000000
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/protocol/enums/FrameDataTests.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.smartdevicelink.test.protocol.enums;
-
-import com.smartdevicelink.protocol.enums.FrameData;
-import com.smartdevicelink.test.Validator;
-
-import junit.framework.TestCase;
-
-import java.util.Vector;
-
-public class FrameDataTests extends TestCase {
-
- private Vector<FrameData> list = FrameData.getList();
-
- // Verifies the values are not null upon valid assignment.
- // These are not actual enums for packeting reasons so testing is different.
- public void testValidEnums () {
-
- final byte START_SESSION_BYTE = (byte) 0x01;
- final String START_SESSION_STRING = "StartSession";
-
- final byte START_SESSION_ACK_BYTE = (byte) 0x02;
- final String START_SESSION_ACK_STRING = "StartSessionACK";
-
- final byte START_SESSION_NACK_BYTE = (byte) 0x03;
- final String START_SESSION_NACK_STRING = "StartSessionNACK";
-
- final byte END_SESSION_BYTE = (byte) 0x04;
- final String END_SESSION_STRING = "EndSession";
-
- try {
-
- assertNotNull("FrameData list returned null", list);
-
- // Check the byte values
- FrameData enumSS = (FrameData) FrameData.get(list, START_SESSION_BYTE);
- FrameData enumSSACK = (FrameData) FrameData.get(list, START_SESSION_ACK_BYTE);
- FrameData enumSSNACK = (FrameData) FrameData.get(list, START_SESSION_NACK_BYTE);
- FrameData enumES = (FrameData) FrameData.get(list, END_SESSION_BYTE);
-
- assertNotNull("Start session byte match returned null", enumSS);
- assertNotNull("Single byte match returned null", enumSSACK);
- assertNotNull("First byte match returned null", enumSSNACK);
- assertNotNull("Consecutive byte match returned null", enumES);
-
- // Check the string values
- enumSS = (FrameData) FrameData.get(list, START_SESSION_STRING);
- enumSSACK = (FrameData) FrameData.get(list, START_SESSION_ACK_STRING);
- enumSSNACK = (FrameData) FrameData.get(list, START_SESSION_NACK_STRING);
- enumES = (FrameData) FrameData.get(list, END_SESSION_STRING);
-
- assertNotNull("Start session string match returned null", enumSS);
- assertNotNull("Single string match returned null", enumSSACK);
- assertNotNull("First string match returned null", enumSSNACK);
- assertNotNull("Consecutive string match returned null", enumES);
-
- } catch (NullPointerException exception) {
- fail("Null enum list throws NullPointerException.");
- }
- }
-
- // Verifies that an invalid assignment is null.
- public void testInvalidEnum () {
-
- final byte INVALID_BYTE = (byte) 0xAB;
- final String INVALID_STRING = "Invalid";
-
- try {
-
- // Check the byte value
- FrameData enumInvalid = (FrameData) FrameData.get(list, INVALID_BYTE);
- assertNull("Invalid byte match didn't return null", enumInvalid);
-
- // Check the string value
- enumInvalid = (FrameData) FrameData.get(list, INVALID_STRING);
- assertNull("Invalid string match didn't return null", enumInvalid);
-
- } catch (IllegalArgumentException exception) {
- fail("Invalid enum throws IllegalArgumentException.");
- }
- }
-
- // Verifies that a null assignment is invalid.
- public void testNullEnum () {
- try {
-
- // Check null string lookup
- FrameData enumNull = (FrameData) FrameData.get(list, null);
- assertNull("Null lookup returns a value", enumNull);
-
- } catch (NullPointerException exception) {
- fail("Null string throws NullPointerException.");
- }
- }
-
- // Verifies the possible enum values of FrameType.
- public void testListEnum () {
- // Test Vector
- Vector<FrameData> enumTestList = new Vector<FrameData>();
- enumTestList.add(FrameData.StartSession);
- enumTestList.add(FrameData.StartSessionACK);
- enumTestList.add(FrameData.StartSessionNACK);
- enumTestList.add(FrameData.EndSession);
-
- assertTrue("List does not match enum test list.",
- list.containsAll(enumTestList) &&
- enumTestList.containsAll(list));
-
- // Test Array
- FrameData[] enumValueArray = FrameData.values();
- FrameData[] enumTestArray = { FrameData.StartSession, FrameData.StartSessionACK,
- FrameData.StartSessionNACK, FrameData.EndSession };
-
- assertTrue("Array does not match enum values array.",
- Validator.validateFrameDataArray(enumValueArray, enumTestArray));
- }
-} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
deleted file mode 100644
index 8c66446af..000000000
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/RPCRequestFactoryTests.java
+++ /dev/null
@@ -1,1102 +0,0 @@
-package com.smartdevicelink.test.proxy;
-
-import com.smartdevicelink.proxy.RPCRequestFactory;
-import com.smartdevicelink.proxy.TTSChunkFactory;
-import com.smartdevicelink.proxy.rpc.AddCommand;
-import com.smartdevicelink.proxy.rpc.AddSubMenu;
-import com.smartdevicelink.proxy.rpc.Alert;
-import com.smartdevicelink.proxy.rpc.ChangeRegistration;
-import com.smartdevicelink.proxy.rpc.Choice;
-import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSet;
-import com.smartdevicelink.proxy.rpc.DeleteCommand;
-import com.smartdevicelink.proxy.rpc.DeleteFile;
-import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
-import com.smartdevicelink.proxy.rpc.DeleteSubMenu;
-import com.smartdevicelink.proxy.rpc.DeviceInfo;
-import com.smartdevicelink.proxy.rpc.EndAudioPassThru;
-import com.smartdevicelink.proxy.rpc.GetVehicleData;
-import com.smartdevicelink.proxy.rpc.Image;
-import com.smartdevicelink.proxy.rpc.ListFiles;
-import com.smartdevicelink.proxy.rpc.PerformAudioPassThru;
-import com.smartdevicelink.proxy.rpc.PerformInteraction;
-import com.smartdevicelink.proxy.rpc.PutFile;
-import com.smartdevicelink.proxy.rpc.RegisterAppInterface;
-import com.smartdevicelink.proxy.rpc.ScrollableMessage;
-import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
-import com.smartdevicelink.proxy.rpc.SetAppIcon;
-import com.smartdevicelink.proxy.rpc.SetDisplayLayout;
-import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
-import com.smartdevicelink.proxy.rpc.SetMediaClockTimer;
-import com.smartdevicelink.proxy.rpc.Show;
-import com.smartdevicelink.proxy.rpc.Slider;
-import com.smartdevicelink.proxy.rpc.SoftButton;
-import com.smartdevicelink.proxy.rpc.Speak;
-import com.smartdevicelink.proxy.rpc.SubscribeButton;
-import com.smartdevicelink.proxy.rpc.SubscribeVehicleData;
-import com.smartdevicelink.proxy.rpc.SystemRequest;
-import com.smartdevicelink.proxy.rpc.TTSChunk;
-import com.smartdevicelink.proxy.rpc.UnregisterAppInterface;
-import com.smartdevicelink.proxy.rpc.UnsubscribeButton;
-import com.smartdevicelink.proxy.rpc.UnsubscribeVehicleData;
-import com.smartdevicelink.proxy.rpc.VrHelpItem;
-import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
-import com.smartdevicelink.proxy.rpc.enums.AudioType;
-import com.smartdevicelink.proxy.rpc.enums.BitsPerSample;
-import com.smartdevicelink.proxy.rpc.enums.ButtonName;
-import com.smartdevicelink.proxy.rpc.enums.FileType;
-import com.smartdevicelink.proxy.rpc.enums.ImageType;
-import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
-import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
-import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
-import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
-import com.smartdevicelink.test.NullValues;
-import com.smartdevicelink.test.TestValues;
-import com.smartdevicelink.test.Validator;
-
-import junit.framework.TestCase;
-
-import java.util.Vector;
-
-/**
- * This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.proxy.RPCRequestFactory}
- */
-public class RPCRequestFactoryTests extends TestCase {
-
- public void testBuildSystemRequest () {
-
- String testData;
- Integer testInt;
- SystemRequest testBSR;
- Vector<String> testVData;
-
- // Test -- buildSystemRequest(String data, Integer correlationID)
- testData = "test";
- testInt = 0;
- testBSR = RPCRequestFactory.buildSystemRequest(testData, testInt);
- assertNotNull(TestValues.NOT_NULL, testBSR.getBulkData());
- assertEquals(TestValues.MATCH, testInt, testBSR.getCorrelationID());
-
- testBSR = RPCRequestFactory.buildSystemRequest(testData, null);
- assertNotNull(TestValues.NULL, testBSR.getCorrelationID());
-
- testBSR = RPCRequestFactory.buildSystemRequest(null, testInt);
- assertNull(TestValues.NULL, testBSR);
-
- // Test -- buildSystemRequestLegacy(Vector<String> data, Integer correlationID)
- testVData = new Vector<String>();
- testVData.add("Test A");
- testVData.add("Test B");
- testVData.add("Test C");
- testBSR = RPCRequestFactory.buildSystemRequestLegacy(testVData, testInt);
- assertEquals(TestValues.MATCH, testVData, new Vector<String>(testBSR.getLegacyData()));
- assertEquals(TestValues.MATCH, testInt, testBSR.getCorrelationID());
-
- testBSR = RPCRequestFactory.buildSystemRequestLegacy(testVData, null);
- assertNotNull(TestValues.NOT_NULL, testBSR.getCorrelationID());
-
- testBSR = RPCRequestFactory.buildSystemRequestLegacy(null, testInt);
- assertNull(TestValues.NULL, testBSR);
-
- // Issue #166 -- Null values within the Vector<String> parameter.
- // TODO: Once resolved, add the following test.
- //testVData = new Vector<String>();
- //testVData.add("Test A");
- //testVData.add("Test B");
- //testVData.add(null);
- //testBSR = RPCRequestFactory.buildSystemRequestLegacy(testVData, testInt);
- //assertNull(Test.NULL, testBSR);
- }
-
- public void testBuildAddCommand () {
-
- Image testImage;
- String testMenuText, testIconValue;
- Integer testCommandID, testParentID, testPosition, testCorrelationID;
- ImageType testIconType;
- AddCommand testBAC;
- Vector<String> testVrCommands;
-
- // Test -- buildAddCommand(Integer commandID, String menuText, Integer parentID, Integer position,Vector<String> vrCommands, Image cmdIcon, Integer correlationID)
- testImage = new Image();
- testMenuText = "menu";
- testPosition = 1;
- testParentID = 2;
- testCommandID = 3;
- testCorrelationID = 4;
- testVrCommands = new Vector<String>();
- testImage.setImageType(ImageType.STATIC);
- testImage.setValue("image");
- testVrCommands.add("Test A");
- testVrCommands.add("Test B");
- testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testParentID, testPosition, testVrCommands, testImage, testCorrelationID);
- assertEquals(TestValues.MATCH, testCommandID, testBAC.getCmdID());
- assertEquals(TestValues.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
- assertEquals(TestValues.MATCH, testParentID, testBAC.getMenuParams().getParentID());
- assertEquals(TestValues.MATCH, testPosition, testBAC.getMenuParams().getPosition());
- assertEquals(TestValues.MATCH, testVrCommands, testBAC.getVrCommands());
- assertTrue(TestValues.TRUE, Validator.validateImage(testImage, testBAC.getCmdIcon()));
- assertEquals(TestValues.MATCH, testCorrelationID, testBAC.getCorrelationID());
-
- testBAC = RPCRequestFactory.buildAddCommand(null, null, null, null, null, null, null);
- assertNull(TestValues.NULL, testBAC.getCmdID());
- assertNull(TestValues.NULL, testBAC.getMenuParams());
- assertNull(TestValues.NULL, testBAC.getVrCommands());
- assertNull(TestValues.NULL, testBAC.getCmdIcon());
- assertNotNull(TestValues.NOT_NULL, testBAC.getCorrelationID());
-
- // Test -- buildAddCommand(Integer commandID, String menuText, Integer parentID, Integer position, Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
- testIconValue = "icon";
- testIconType = ImageType.STATIC;
- testImage = new Image();
- testImage.setValue(testIconValue);
- testImage.setImageType(testIconType);
- testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testParentID, testPosition, testVrCommands, testIconValue, testIconType, testCorrelationID);
- assertEquals(TestValues.MATCH, testCommandID, testBAC.getCmdID());
- assertEquals(TestValues.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
- assertEquals(TestValues.MATCH, testParentID, testBAC.getMenuParams().getParentID());
- assertEquals(TestValues.MATCH, testPosition, testBAC.getMenuParams().getPosition());
- assertEquals(TestValues.MATCH, testVrCommands, testBAC.getVrCommands());
- assertEquals(TestValues.MATCH, testCorrelationID, testBAC.getCorrelationID());
- assertTrue(TestValues.TRUE, Validator.validateImage(testImage, testBAC.getCmdIcon()));
-
- testBAC = RPCRequestFactory.buildAddCommand(null, null, null, null, null, null, null, null);
- assertNull(TestValues.NULL, testBAC.getCmdID());
- assertNull(TestValues.NULL, testBAC.getMenuParams());
- assertNull(TestValues.NULL, testBAC.getVrCommands());
- assertNull(TestValues.NULL, testBAC.getCmdIcon());
- assertNotNull(TestValues.NOT_NULL, testBAC.getCorrelationID());
-
- // Test -- buildAddCommand(Integer commandID, String menuText, Integer parentID, Integer position, Vector<String> vrCommands, Integer correlationID)
- testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testParentID, testPosition, testVrCommands, testCorrelationID);
- assertEquals(TestValues.MATCH, testCommandID, testBAC.getCmdID());
- assertEquals(TestValues.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
- assertEquals(TestValues.MATCH, testParentID, testBAC.getMenuParams().getParentID());
- assertEquals(TestValues.MATCH, testPosition, testBAC.getMenuParams().getPosition());
- assertEquals(TestValues.MATCH, testVrCommands, testBAC.getVrCommands());
- assertEquals(TestValues.MATCH, testCorrelationID, testBAC.getCorrelationID());
-
- testBAC = RPCRequestFactory.buildAddCommand(null, null, null, null, null, null);
- assertNull(TestValues.NULL, testBAC.getCmdID());
- assertNull(TestValues.NULL, testBAC.getMenuParams());
- assertNull(TestValues.NULL, testBAC.getVrCommands());
- assertNotNull(TestValues.NOT_NULL, testBAC.getCorrelationID());
-
- // Test -- buildAddCommand(Integer commandID, String menuText, Vector<String> vrCommands, Integer correlationID)
- testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testMenuText, testVrCommands, testCorrelationID);
- assertEquals(TestValues.MATCH, testCommandID, testBAC.getCmdID());
- assertEquals(TestValues.MATCH, testMenuText, testBAC.getMenuParams().getMenuName());
- assertEquals(TestValues.MATCH, testVrCommands, testBAC.getVrCommands());
- assertEquals(TestValues.MATCH, testCorrelationID, testBAC.getCorrelationID());
-
- testBAC = RPCRequestFactory.buildAddCommand(null, null, null, null);
- assertNull(TestValues.NULL, testBAC.getCmdID());
- assertNull(TestValues.NULL, testBAC.getMenuParams());
- assertNull(TestValues.NULL, testBAC.getVrCommands());
- assertNotNull(TestValues.NOT_NULL, testBAC.getCorrelationID());
-
- // Test -- buildAddCommand(Integer commandID, Vector<String> vrCommands, Integer correlationID)
- testBAC = RPCRequestFactory.buildAddCommand(testCommandID, testVrCommands, testCorrelationID);
- assertEquals(TestValues.MATCH, testCommandID, testBAC.getCmdID());
- assertEquals(TestValues.MATCH, testVrCommands, testBAC.getVrCommands());
- assertEquals(TestValues.MATCH, testCorrelationID, testBAC.getCorrelationID());
-
- testBAC = RPCRequestFactory.buildAddCommand(null, null, null);
- assertNull(TestValues.NULL, testBAC.getCmdID());
- assertNull(TestValues.NULL, testBAC.getVrCommands());
- assertNotNull(TestValues.NOT_NULL, testBAC.getCorrelationID());
- }
-
- public void testBuildAddSubMenu () {
-
- Integer testMenuID, testCorrelationID, testPosition;
- String testMenuName;
- AddSubMenu testBASM;
-
- // Test -- buildAddSubMenu(Integer menuID, String menuName, Integer correlationID)
- // ^ Calls another build method.
- // Test -- buildAddSubMenu(Integer menuID, String menuName, Integer position, Integer correlationID)
- testMenuID = 0;
- testMenuName = "name";
- testPosition = 1;
- testCorrelationID = 2;
- testBASM = RPCRequestFactory.buildAddSubMenu(testMenuID, testMenuName, testPosition, testCorrelationID);
- assertEquals(TestValues.MATCH, testMenuID, testBASM.getMenuID());
- assertEquals(TestValues.MATCH, testMenuName, testBASM.getMenuName());
- assertEquals(TestValues.MATCH, testPosition, testBASM.getPosition());
- assertEquals(TestValues.MATCH, testCorrelationID, testBASM.getCorrelationID());
-
- testBASM = RPCRequestFactory.buildAddSubMenu(null, null, null, null);
- assertNull(TestValues.NULL, testBASM.getMenuID());
- assertNull(TestValues.NULL, testBASM.getMenuName());
- assertNull(TestValues.NULL, testBASM.getPosition());
- assertNotNull(TestValues.NOT_NULL, testBASM.getCorrelationID());
- }
-
- public void testBuildAlert () {
-
- Alert testAlert;
- String testTTSText, testAlertText1, testAlertText2, testAlertText3;
- Integer testCorrelationID, testDuration;
- Boolean testPlayTone;
- Vector<SoftButton> testSoftButtons;
- Vector<TTSChunk> testTtsChunks;
-
- // Test -- buildAlert(String ttsText, Boolean playTone, Vector<SoftButton> softButtons, Integer correlationID)
- testTTSText = "simple test";
- testCorrelationID = 0;
- testPlayTone = true;
- testSoftButtons = new Vector<SoftButton>();
- SoftButton test1 = new SoftButton();
- test1.setText("test 1");
- SoftButton test2 = new SoftButton();
- test2.setText("test 2");
- testSoftButtons.add(test1);
- testSoftButtons.add(test2);
- testAlert = RPCRequestFactory.buildAlert(testTTSText, testPlayTone, testSoftButtons, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TTSChunkFactory.createSimpleTTSChunks(testTTSText), testAlert.getTtsChunks()));
- // ^ Calls another build method.
-
- // Test -- buildAlert(String alertText1, String alertText2, String alertText3, Integer duration, Vector<SoftButton> softButtons, Integer correlationID)
- testAlertText1 = "test 1";
- testAlertText2 = "test 2";
- testAlertText3 = "test 3";
- testDuration = 1;
- // ^ Calls another build method.
-
- // Test -- buildAlert(String ttsText, String alertText1, String alertText2, String alertText3, Boolean playTone, Integer duration, Vector<SoftButton> softButtons, Integer correlationID)
- testAlert = RPCRequestFactory.buildAlert(testTTSText, testAlertText1, testAlertText2, testAlertText3, testPlayTone, testDuration, testSoftButtons, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(TTSChunkFactory.createSimpleTTSChunks(testTTSText), testAlert.getTtsChunks()));
- // ^ Calls another build method.
-
- // Test -- buildAlert(Vector<TTSChunk> chunks, Boolean playTone, Vector<SoftButton> softButtons, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildAlert(Vector<TTSChunk> ttsChunks, String alertText1, String alertText2, String alertText3, Boolean playTone, Integer duration, Vector<SoftButton> softButtons, Integer correlationID)
- testTtsChunks = TTSChunkFactory.createSimpleTTSChunks(testTTSText);
- testAlert = RPCRequestFactory.buildAlert(testTtsChunks, testAlertText1, testAlertText2, testAlertText3, testPlayTone, testDuration, testSoftButtons, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTtsChunks, testAlert.getTtsChunks()));
- assertEquals(TestValues.MATCH, testAlertText1, testAlert.getAlertText1());
- assertEquals(TestValues.MATCH, testAlertText2, testAlert.getAlertText2());
- assertEquals(TestValues.MATCH, testAlertText3, testAlert.getAlertText3());
- assertEquals(TestValues.MATCH, testPlayTone, testAlert.getPlayTone());
- assertEquals(TestValues.MATCH, testDuration, testAlert.getDuration());
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(testSoftButtons, testAlert.getSoftButtons()));
- assertEquals(TestValues.MATCH, testCorrelationID, testAlert.getCorrelationID());
-
- testAlert = RPCRequestFactory.buildAlert((Vector<TTSChunk>) null, null, null, null, null, null, null, null);
- assertNull(TestValues.NULL, testAlert.getTtsChunks());
- assertNull(TestValues.NULL, testAlert.getAlertText1());
- assertNull(TestValues.NULL, testAlert.getAlertText2());
- assertNull(TestValues.NULL, testAlert.getAlertText3());
- assertNull(TestValues.NULL, testAlert.getPlayTone());
- assertNull(TestValues.NULL, testAlert.getDuration());
- assertNull(TestValues.NULL, testAlert.getSoftButtons());
- assertNotNull(TestValues.NOT_NULL, testAlert.getCorrelationID());
-
- // Test -- buildAlert(String ttsText, Boolean playTone, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildAlert(String alertText1, String alertText2, Integer duration, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildAlert(String ttsText, String alertText1, String alertText2, Boolean playTone, Integer duration, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildAlert(Vector<TTSChunk> chunks, Boolean playTone, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildAlert(Vector<TTSChunk> ttsChunks, String alertText1, String alertText2, Boolean playTone, Integer duration, Integer correlationID)
- testAlert = RPCRequestFactory.buildAlert(testTtsChunks, testAlertText1, testAlertText2, testPlayTone, testDuration, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTtsChunks, testAlert.getTtsChunks()));
- assertEquals(TestValues.MATCH, testAlertText1, testAlert.getAlertText1());
- assertEquals(TestValues.MATCH, testAlertText2, testAlert.getAlertText2());
- assertEquals(TestValues.MATCH, testPlayTone, testAlert.getPlayTone());
- assertEquals(TestValues.MATCH, testDuration, testAlert.getDuration());
- assertEquals(TestValues.MATCH, testCorrelationID, testAlert.getCorrelationID());
-
- testAlert = RPCRequestFactory.buildAlert((Vector<TTSChunk>) null, null, null, null, null, null);
- assertNull(TestValues.NULL, testAlert.getTtsChunks());
- assertNull(TestValues.NULL, testAlert.getAlertText1());
- assertNull(TestValues.NULL, testAlert.getAlertText2());
- assertNull(TestValues.NULL, testAlert.getPlayTone());
- assertNull(TestValues.NULL, testAlert.getDuration());
- assertNotNull(TestValues.NOT_NULL, testAlert.getCorrelationID());
- }
-
- public void testBuildCreateInteractionChoiceSet () {
-
- Integer testICSID, testCorrelationID;
- Vector<Choice> testChoiceSet;
- CreateInteractionChoiceSet testBCICS;
-
- // Test --buildCreateInteractionChoiceSet(Vector<Choice> choiceSet, Integer interactionChoiceSetID, Integer correlationID)
- testICSID = 0;
- testCorrelationID = 1;
- testChoiceSet = new Vector<Choice>();
- Choice testChoice = new Choice();
- testChoiceSet.add(testChoice);
- testBCICS = RPCRequestFactory.buildCreateInteractionChoiceSet(testChoiceSet, testICSID, testCorrelationID);
- assertEquals(TestValues.MATCH, testChoiceSet, testBCICS.getChoiceSet());
- assertEquals(TestValues.MATCH, testICSID, testBCICS.getInteractionChoiceSetID());
- assertEquals(TestValues.MATCH, testCorrelationID, testBCICS.getCorrelationID());
-
- testBCICS = RPCRequestFactory.buildCreateInteractionChoiceSet(null, null, null);
- assertNull(TestValues.NULL, testBCICS.getChoiceSet());
- assertNull(TestValues.NULL, testBCICS.getInteractionChoiceSetID());
- assertNotNull(TestValues.NOT_NULL, testBCICS.getCorrelationID());
- }
-
- public void testBuildDeleteCommand () {
-
- Integer testCID, testCorrelationID;
- DeleteCommand testDC;
-
- // Test -- buildDeleteCommand(Integer commandID, Integer correlationID)
- testCID = 0;
- testCorrelationID = 1;
- testDC = RPCRequestFactory.buildDeleteCommand(testCID, testCorrelationID);
- assertEquals(TestValues.MATCH, testCID, testDC.getCmdID());
- assertEquals(TestValues.MATCH, testCorrelationID, testDC.getCorrelationID());
-
- testDC = RPCRequestFactory.buildDeleteCommand(null, null);
- assertNull(TestValues.NULL, testDC.getCmdID());
- assertNotNull(TestValues.NOT_NULL, testDC.getCorrelationID());
-
- }
-
- public void testBuildDeleteFile () {
-
- Integer testCorrelationID;
- String testFileName;
- DeleteFile testDF;
-
- // Test --buildDeleteFile(String sdlFileName, Integer correlationID)
- testCorrelationID = 0;
- testFileName = "test";
- testDF = RPCRequestFactory.buildDeleteFile(testFileName, testCorrelationID);
- assertEquals(TestValues.MATCH, testCorrelationID, testDF.getCorrelationID());
- assertEquals(TestValues.MATCH, testFileName, testDF.getSdlFileName());
-
- testDF = RPCRequestFactory.buildDeleteFile(null, null);
- assertNotNull(TestValues.NOT_NULL, testDF.getCorrelationID());
- assertNull(TestValues.NULL, testDF.getSdlFileName());
-
- }
-
- public void testBuildDeleteInteractionChoiceSet () {
-
- Integer testICSID, testCorrelationID;
- DeleteInteractionChoiceSet testDICS;
-
- // Test -- buildDeleteInteractionChoiceSet(Integer interactionChoiceSetID, Integer correlationID)
- testICSID = 0;
- testCorrelationID = 1;
- testDICS = RPCRequestFactory.buildDeleteInteractionChoiceSet(testICSID, testCorrelationID);
- assertEquals(TestValues.MATCH, testICSID, testDICS.getInteractionChoiceSetID());
- assertEquals(TestValues.MATCH, testCorrelationID, testDICS.getCorrelationID());
-
- testDICS = RPCRequestFactory.buildDeleteInteractionChoiceSet(null, null);
- assertNull(TestValues.NULL, testDICS.getInteractionChoiceSetID());
- assertNotNull(TestValues.NOT_NULL, testDICS.getCorrelationID());
- }
-
- public void testBuildDeleteSubMenu () {
-
- Integer testMenuID, testCorrelationID;
- DeleteSubMenu testDSM;
-
- // Test -- buildDeleteSubMenu(Integer menuID, Integer correlationID)
- testMenuID = 0;
- testCorrelationID = 1;
- testDSM = RPCRequestFactory.buildDeleteSubMenu(testMenuID, testCorrelationID);
- assertEquals(TestValues.MATCH, testMenuID, testDSM.getMenuID());
- assertEquals(TestValues.MATCH, testCorrelationID, testDSM.getCorrelationID());
-
- testDSM = RPCRequestFactory.buildDeleteSubMenu(null, null);
- assertNull(TestValues.NULL, testDSM.getMenuID());
- assertNotNull(TestValues.NOT_NULL, testDSM.getCorrelationID());
- }
-
- public void testBuildListFiles () {
-
- Integer testCorrelationID = 0;
- ListFiles testLF;
-
- // Test -- buildListFiles(Integer correlationID)
- testLF = RPCRequestFactory.buildListFiles(testCorrelationID);
- assertEquals(TestValues.MATCH, testCorrelationID, testLF.getCorrelationID());
-
- testLF = RPCRequestFactory.buildListFiles(null);
- assertNotNull(TestValues.NOT_NULL, testLF.getCorrelationID());
- }
-
- @SuppressWarnings("deprecation")
- public void testBuildPerformInteraction () {
-
- String testDisplayText = "test";
- Integer testTimeout = 1, testCorrelationID = 0;
- InteractionMode testIM = InteractionMode.BOTH;
- Vector<TTSChunk> testInitChunks, testHelpChunks, testTimeoutChunks;
- Vector<Integer> testCSIDs;
- Vector<VrHelpItem> testVrHelpItems;
- PerformInteraction testPI;
-
- // Test -- buildPerformInteraction(Vector<TTSChunk> initChunks, String displayText, Vector<Integer> interactionChoiceSetIDList, Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp, Integer correlationID)
- testInitChunks = TTSChunkFactory.createSimpleTTSChunks("init chunks");
- testHelpChunks = TTSChunkFactory.createSimpleTTSChunks("help items");
- testTimeoutChunks = TTSChunkFactory.createSimpleTTSChunks("timeout");
- testVrHelpItems = new Vector<VrHelpItem>();
- VrHelpItem testItem = new VrHelpItem();
- testItem.setPosition(0);
- testItem.setText("text");
- Image image = new Image();
- image.setValue("value");
- image.setImageType(ImageType.DYNAMIC);
- testItem.setImage(image);
- testVrHelpItems.add(testItem);
- testCSIDs = new Vector<Integer>();
- testCSIDs.add(0);
- testCSIDs.add(1);
- testPI = RPCRequestFactory.buildPerformInteraction(testInitChunks, testDisplayText, testCSIDs, testHelpChunks, testTimeoutChunks, testIM, testTimeout, testVrHelpItems, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testInitChunks, testPI.getInitialPrompt()));
- assertEquals(TestValues.MATCH, testDisplayText, testPI.getInitialText());
- assertTrue(TestValues.TRUE, Validator.validateIntegerList(testCSIDs, testPI.getInteractionChoiceSetIDList()));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testHelpChunks, testPI.getHelpPrompt()));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testPI.getTimeoutPrompt()));
- assertEquals(TestValues.MATCH, testIM, testPI.getInteractionMode());
- assertEquals(TestValues.MATCH, testTimeout, testPI.getTimeout());
- assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(testVrHelpItems, testPI.getVrHelp()));
- assertEquals(TestValues.MATCH, testCorrelationID, testPI.getCorrelationID());
-
- testPI = RPCRequestFactory.buildPerformInteraction((Vector<TTSChunk>) null, null, null, null, null, null, null, null, null);
- assertNull(TestValues.NULL, testPI.getInitialPrompt());
- assertNull(TestValues.NULL, testPI.getInitialText());
- assertNull(TestValues.NULL, testPI.getInteractionChoiceSetIDList());
- assertNull(TestValues.NULL, testPI.getHelpPrompt());
- assertNull(TestValues.NULL, testPI.getTimeoutPrompt());
- assertNull(TestValues.NULL, testPI.getInteractionMode());
- assertNull(TestValues.NULL, testPI.getTimeout());
- assertNull(TestValues.NULL, testPI.getVrHelp());
- assertNotNull(TestValues.NOT_NULL, testPI.getCorrelationID());
-
- // Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, String timeoutPrompt, InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildPerformInteraction(String initPrompt, String displayText, Integer interactionChoiceSetID, String helpPrompt, String timeoutPrompt, InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildPerformInteraction(String initPrompt, String displayText, Integer interactionChoiceSetID, Vector<VrHelpItem> vrHelp, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildPerformInteraction(Vector<TTSChunk> initChunks, String displayText, Vector<Integer> interactionChoiceSetIDList, Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, InteractionMode interactionMode, Integer timeout, Integer correlationID)
- testPI = RPCRequestFactory.buildPerformInteraction(testInitChunks, testDisplayText, testCSIDs, testHelpChunks, testTimeoutChunks, testIM, testTimeout, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testInitChunks, testPI.getInitialPrompt()));
- assertEquals(TestValues.MATCH, testDisplayText, testPI.getInitialText());
- assertTrue(TestValues.TRUE, Validator.validateIntegerList(testCSIDs, testPI.getInteractionChoiceSetIDList()));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testHelpChunks, testPI.getHelpPrompt()));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testPI.getTimeoutPrompt()));
- assertEquals(TestValues.MATCH, testIM, testPI.getInteractionMode());
- assertEquals(TestValues.MATCH, testTimeout, testPI.getTimeout());
- assertEquals(TestValues.MATCH, testCorrelationID, testPI.getCorrelationID());
-
- testPI = RPCRequestFactory.buildPerformInteraction((Vector<TTSChunk>) null, null, null, null, null, null, null, null);
- assertNull(TestValues.NULL, testPI.getInitialPrompt());
- assertNull(TestValues.NULL, testPI.getInitialText());
- assertNull(TestValues.NULL, testPI.getInteractionChoiceSetIDList());
- assertNull(TestValues.NULL, testPI.getHelpPrompt());
- assertNull(TestValues.NULL, testPI.getTimeoutPrompt());
- assertNull(TestValues.NULL, testPI.getInteractionMode());
- assertNull(TestValues.NULL, testPI.getTimeout());
- assertNotNull(TestValues.NOT_NULL, testPI.getCorrelationID());
-
- // Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, String timeoutPrompt, InteractionMode interactionMode, Integer timeout, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildPerformInteraction(String initPrompt, String displayText, Integer interactionChoiceSetID, String helpPrompt, String timeoutPrompt, InteractionMode interactionMode, Integer timeout, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildPerformInteraction(String initPrompt, String displayText, Integer interactionChoiceSetID, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildPerformInteraction(Vector<TTSChunk> initChunks, String displayText, Vector<Integer> interactionChoiceSetIDList, Vector<TTSChunk> helpChunks, InteractionMode interactionMode, Integer timeout, Integer correlationID)
- testPI = RPCRequestFactory.buildPerformInteraction(testInitChunks, testDisplayText, testCSIDs, testHelpChunks, testIM, testTimeout, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testInitChunks, testPI.getInitialPrompt()));
- assertEquals(TestValues.MATCH, testDisplayText, testPI.getInitialText());
- assertTrue(TestValues.TRUE, Validator.validateIntegerList(testCSIDs, testPI.getInteractionChoiceSetIDList()));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testHelpChunks, testPI.getHelpPrompt()));
- assertEquals(TestValues.MATCH, testIM, testPI.getInteractionMode());
- assertEquals(TestValues.MATCH, testTimeout, testPI.getTimeout());
- assertEquals(TestValues.MATCH, testCorrelationID, testPI.getCorrelationID());
-
- testPI = RPCRequestFactory.buildPerformInteraction((Vector<TTSChunk>) null, null, null, null, null, null, null);
- assertNull(TestValues.NULL, testPI.getInitialPrompt());
- assertNull(TestValues.NULL, testPI.getInitialText());
- assertNull(TestValues.NULL, testPI.getInteractionChoiceSetIDList());
- assertNull(TestValues.NULL, testPI.getHelpPrompt());
- assertNull(TestValues.NULL, testPI.getInteractionMode());
- assertNull(TestValues.NULL, testPI.getTimeout());
- assertNotNull(TestValues.NOT_NULL, testPI.getCorrelationID());
-
- // Test -- buildPerformInteraction(String initPrompt, String displayText, Vector<Integer> interactionChoiceSetIDList, String helpPrompt, InteractionMode interactionMode, Integer timeout, Integer correlationID)
- // ^ Calls another build method.
- }
-
- public void testBuildPutFiles () {
-
- String testFileName = "test";
- Boolean testPFile = true, testSystemFile = true;
- Integer testCorrelationID = 0;
- Long testOffset = 1L, testLength = 2L;
- FileType testFileType = FileType.BINARY;
- byte[] testFileData = {(byte) 0x00, (byte) 0x01, (byte) 0x02 };
- PutFile testPF;
-
- // Test -- buildPutFile(String sdlFileName, FileType fileType, Boolean persistentFile, byte[] fileData, Integer correlationID)
- testPF = RPCRequestFactory.buildPutFile(testFileName, testFileType, testPFile, testFileData, testCorrelationID);
- assertEquals(TestValues.MATCH, testFileName, testPF.getSdlFileName());
- assertEquals(TestValues.MATCH, testFileType, testPF.getFileType());
- assertEquals(TestValues.MATCH, testPFile, testPF.getPersistentFile());
- assertTrue(TestValues.TRUE, Validator.validateBulkData(testFileData, testPF.getFileData()));
- assertEquals(TestValues.MATCH, testCorrelationID, testPF.getCorrelationID());
-
- testPF = RPCRequestFactory.buildPutFile(null, null, null, null, null);
- assertNull(TestValues.NULL, testPF.getSdlFileName());
- assertNull(TestValues.NULL, testPF.getFileType());
- assertNull(TestValues.NULL, testPF.getPersistentFile());
- assertNull(TestValues.NULL, testPF.getFileData());
- assertNotNull(TestValues.NOT_NULL, testPF.getCorrelationID());
-
- // Test -- buildPutFile(String sdlFileName, Integer iOffset, Integer iLength)
- testPF = RPCRequestFactory.buildPutFile(testFileName, testOffset, testLength);
- assertEquals(TestValues.MATCH, testFileName, testPF.getSdlFileName());
- assertEquals(TestValues.MATCH, testOffset, testPF.getOffset());
- assertEquals(TestValues.MATCH, testLength, testPF.getLength());
-
- testPF = RPCRequestFactory.buildPutFile(NullValues.STRING, NullValues.INTEGER, NullValues.INTEGER);
- assertNull(TestValues.NULL, testPF.getSdlFileName());
- assertNull(TestValues.NULL, testPF.getOffset());
- assertNull(TestValues.NULL, testPF.getLength());
-
- // Test -- buildPutFile(String syncFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile)
- testPF = RPCRequestFactory.buildPutFile(testFileName, testOffset, testLength, testFileType, testPFile, testSystemFile);
- assertEquals(TestValues.MATCH, testFileName, testPF.getSdlFileName());
- assertEquals(TestValues.MATCH, testOffset, testPF.getOffset());
- assertEquals(TestValues.MATCH, testLength, testPF.getLength());
- assertTrue(TestValues.TRUE, testPF.getPersistentFile());
- assertEquals(TestValues.MATCH, testSystemFile, testPF.getSystemFile());
-
- testPF = RPCRequestFactory.buildPutFile(NullValues.STRING, NullValues.INTEGER, NullValues.INTEGER, null, NullValues.BOOLEAN, NullValues.BOOLEAN);
- assertNull(TestValues.NULL, testPF.getSdlFileName());
- assertNull(TestValues.NULL, testPF.getOffset());
- assertNull(TestValues.NULL, testPF.getLength());
- assertNull(TestValues.NULL, testPF.getFileType());
- assertNull(TestValues.NULL, testPF.getPersistentFile());
- assertNull(TestValues.NULL, testPF.getSystemFile());
- }
-
- public void testBuildRegisterAppInterface () {
-
- SdlMsgVersion testSMV = new SdlMsgVersion();
- testSMV.setMajorVersion(1);
- testSMV.setMinorVersion(0);
- String testAppName = "test", testNGN = "ngn", testAppID = "id";
- Vector<TTSChunk> testTTSName = TTSChunkFactory.createSimpleTTSChunks("name");
- Vector<String> testSynonyms = new Vector<String>();
- testSynonyms.add("examine");
- Boolean testIMA = false;
- Integer testCorrelationID = 0;
- Language testLang = Language.EN_US, testHMILang = Language.EN_GB;
- Vector<AppHMIType> testHMIType = new Vector<AppHMIType>();
- testHMIType.add(AppHMIType.DEFAULT);
- DeviceInfo testDI = RPCRequestFactory.BuildDeviceInfo(null);
- RegisterAppInterface testRAI;
-
- // Test -- buildRegisterAppInterface(String appName, String appID)
- // ^ Calls another build method.
-
- // Test -- buildRegisterAppInterface(String appName, Boolean isMediaApp, String appID)
- // ^ Calls another build method.
-
- // Test -- buildRegisterAppInterface(SdlMsgVersion sdlMsgVersion, String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID, Integer correlationID)
- testRAI = RPCRequestFactory.buildRegisterAppInterface(testSMV, testAppName, testTTSName, testNGN, testSynonyms, testIMA, testLang, testHMILang, testHMIType, testAppID, testCorrelationID,testDI);
- assertTrue(TestValues.TRUE, Validator.validateSdlMsgVersion(testSMV, testRAI.getSdlMsgVersion()));
- assertEquals(TestValues.MATCH, testAppName, testRAI.getAppName());
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTTSName, testRAI.getTtsName()));
- assertEquals(TestValues.MATCH, testNGN, testRAI.getNgnMediaScreenAppName());
- assertTrue(TestValues.TRUE, Validator.validateStringList(testSynonyms, testRAI.getVrSynonyms()));
- assertEquals(TestValues.MATCH, testIMA, testRAI.getIsMediaApplication());
- assertEquals(TestValues.MATCH, testLang, testRAI.getLanguageDesired());
- assertEquals(TestValues.MATCH, testHMILang, testRAI.getHmiDisplayLanguageDesired());
- assertEquals(TestValues.MATCH, AppHMIType.DEFAULT, testRAI.getAppHMIType().get(0));
- assertEquals(TestValues.MATCH, testAppID, testRAI.getAppID());
- assertEquals(TestValues.MATCH, testCorrelationID, testRAI.getCorrelationID());
- assertEquals(TestValues.MATCH, testDI, testRAI.getDeviceInfo());
-
-
- testRAI = RPCRequestFactory.buildRegisterAppInterface(null, null, null, null, null, null, null, null, null, null, null,null);
- assertEquals(TestValues.MATCH, (Integer) 1, testRAI.getCorrelationID());
- assertEquals(TestValues.MATCH, testSMV.getMajorVersion(), testRAI.getSdlMsgVersion().getMajorVersion());
- assertEquals(TestValues.MATCH, testSMV.getMinorVersion(), testRAI.getSdlMsgVersion().getMinorVersion());
- assertNull(TestValues.NULL, testRAI.getAppName());
- assertNull(TestValues.NULL, testRAI.getTtsName());
- assertNull(TestValues.NULL, testRAI.getNgnMediaScreenAppName());
- assertNull(TestValues.NULL, testRAI.getVrSynonyms());
- assertNull(TestValues.NULL, testRAI.getIsMediaApplication());
- assertNotNull(TestValues.NOT_NULL, testRAI.getLanguageDesired());
- assertNotNull(TestValues.NOT_NULL, testRAI.getHmiDisplayLanguageDesired());
- assertNull(TestValues.NULL, testRAI.getAppHMIType());
- assertNull(TestValues.NULL, testRAI.getAppID());
- assertNull(TestValues.NULL, testRAI.getDeviceInfo());
- }
-
- public void testBuildSetAppIcon () {
-
- String testFileName = "test";
- Integer testCorrelationID = 0;
- SetAppIcon testSAI;
-
- // Test -- buildSetAppIcon(String sdlFileName, Integer correlationID)
- testSAI = RPCRequestFactory.buildSetAppIcon(testFileName, testCorrelationID);
- assertEquals(TestValues.MATCH, testFileName, testSAI.getSdlFileName());
- assertEquals(TestValues.MATCH, testCorrelationID, testSAI.getCorrelationID());
-
- testSAI = RPCRequestFactory.buildSetAppIcon(null, null);
- assertNull(TestValues.NULL, testSAI.getSdlFileName());
- assertNotNull(TestValues.NOT_NULL, testSAI.getCorrelationID());
-
- }
-
- public void testBuildSetGlobalProperties () {
-
- Vector<TTSChunk> testHelpChunks = TTSChunkFactory.createSimpleTTSChunks("test"),
- testTimeoutChunks = TTSChunkFactory.createSimpleTTSChunks("timeout");
- Vector<VrHelpItem> testVrHelp = new Vector<VrHelpItem>();
- VrHelpItem testItem = new VrHelpItem();
- testItem.setPosition(0);
- testItem.setText("text");
- Image image = new Image();
- image.setValue("value");
- image.setImageType(ImageType.DYNAMIC);
- testItem.setImage(image);
- testVrHelp.add(testItem);
- Integer testCorrelationID = 0;
- String testHelpTitle = "help";
- SetGlobalProperties testSBP;
-
- // Test -- buildSetGlobalProperties(String helpPrompt, String timeoutPrompt, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildSetGlobalProperties(Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, Integer correlationID)
- testSBP = RPCRequestFactory.buildSetGlobalProperties(testHelpChunks, testTimeoutChunks, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testHelpChunks, testSBP.getHelpPrompt()));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testSBP.getTimeoutPrompt()));
- assertEquals(TestValues.MATCH, testCorrelationID, testSBP.getCorrelationID());
-
- testSBP = RPCRequestFactory.buildSetGlobalProperties((Vector<TTSChunk>) null, null, null);
- assertNull(TestValues.NULL, testSBP.getHelpPrompt());
- assertNull(TestValues.NULL, testSBP.getTimeoutPrompt());
- assertNotNull(TestValues.NOT_NULL, testSBP.getCorrelationID());
-
- // Test -- buildSetGlobalProperties(String helpPrompt, String timeoutPrompt, String vrHelpTitle, Vector<VrHelpItem> vrHelp, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildSetGlobalProperties(Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, String vrHelpTitle, Vector<VrHelpItem> vrHelp, Integer correlationID)
- testSBP = RPCRequestFactory.buildSetGlobalProperties(testHelpChunks, testTimeoutChunks, testHelpTitle, testVrHelp, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testHelpChunks, testSBP.getHelpPrompt()));
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testSBP.getTimeoutPrompt()));
- assertEquals(TestValues.MATCH, testHelpTitle, testSBP.getVrHelpTitle());
- assertTrue(TestValues.TRUE, Validator.validateVrHelpItems(testVrHelp, testSBP.getVrHelp()));
- assertEquals(TestValues.MATCH, testCorrelationID, testSBP.getCorrelationID());
-
- testSBP = RPCRequestFactory.buildSetGlobalProperties((Vector<TTSChunk>) null, null, null, null, null);
- assertNull(TestValues.NULL, testSBP.getHelpPrompt());
- assertNull(TestValues.NULL, testSBP.getTimeoutPrompt());
- assertNull(TestValues.NULL, testSBP.getVrHelpTitle());
- assertNull(TestValues.NULL, testSBP.getVrHelp());
- assertNotNull(TestValues.NOT_NULL, testSBP.getCorrelationID());
- }
-
- public void testBuildSetMediaClockTimer () {
-
- Integer hours = 0, minutes = 0, seconds = 0, testCorrelationID = 0;
- UpdateMode testMode = UpdateMode.COUNTUP;
- SetMediaClockTimer testSMCT;
-
- // Test -- buildSetMediaClockTimer(Integer hours, Integer minutes, Integer seconds, UpdateMode updateMode, Integer correlationID)
- testSMCT = RPCRequestFactory.buildSetMediaClockTimer(hours, minutes, seconds, testMode, testCorrelationID);
- assertEquals(TestValues.MATCH, hours, testSMCT.getStartTime().getHours());
- assertEquals(TestValues.MATCH, minutes, testSMCT.getStartTime().getMinutes());
- assertEquals(TestValues.MATCH, seconds, testSMCT.getStartTime().getSeconds());
- assertEquals(TestValues.MATCH, testMode, testSMCT.getUpdateMode());
- assertEquals(TestValues.MATCH, testCorrelationID, testSMCT.getCorrelationID());
-
- testSMCT = RPCRequestFactory.buildSetMediaClockTimer(null, null, null, null, null);
- assertNull(TestValues.NULL, testSMCT.getStartTime());
- assertNull(TestValues.NULL, testSMCT.getUpdateMode());
- assertNotNull(TestValues.NOT_NULL, testSMCT.getCorrelationID());
-
- // Test -- buildSetMediaClockTimer(UpdateMode updateMode, Integer correlationID)
- // ^ Calls another build method.
- }
-
- @SuppressWarnings("deprecation")
- public void testBuildShow () {
-
- Image testGraphic = new Image();
- testGraphic.setImageType(ImageType.STATIC);
- testGraphic.setValue("test");
- String testText1 = "test1", testText2 = "test2", testText3 = "test3", testText4 = "test4", testStatusBar = "status", testMediaClock = "media", testMediaTrack = "track";
- Vector<SoftButton> testSoftButtons = new Vector<SoftButton>();
- testSoftButtons.add(new SoftButton());
- Vector<String> testCustomPresets = new Vector<String>();
- testCustomPresets.add("Test");
- TextAlignment testAlignment = TextAlignment.CENTERED;
- Integer testCorrelationID = 0;
- Show testShow;
-
- // Test -- buildShow(String mainText1, String mainText2, String mainText3, String mainText4, String statusBar, String mediaClock, String mediaTrack, Image graphic, Vector<SoftButton> softButtons, Vector <String> customPresets, TextAlignment alignment, Integer correlationID)
- testShow = RPCRequestFactory.buildShow(testText1, testText2, testText3, testText4, testStatusBar, testMediaClock, testMediaTrack, testGraphic, testSoftButtons, testCustomPresets, testAlignment, testCorrelationID);
- assertEquals(TestValues.MATCH, testText1, testShow.getMainField1());
- assertEquals(TestValues.MATCH, testText2, testShow.getMainField2());
- assertEquals(TestValues.MATCH, testText3, testShow.getMainField3());
- assertEquals(TestValues.MATCH, testText4, testShow.getMainField4());
- assertEquals(TestValues.MATCH, testStatusBar, testShow.getStatusBar());
- assertEquals(TestValues.MATCH, testMediaClock, testShow.getMediaClock());
- assertEquals(TestValues.MATCH, testMediaTrack, testShow.getMediaTrack());
- assertTrue(TestValues.TRUE, Validator.validateImage(testGraphic, testShow.getGraphic()));
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(testSoftButtons, testShow.getSoftButtons()));
- assertTrue(TestValues.TRUE, Validator.validateStringList(testCustomPresets, testShow.getCustomPresets()));
- assertEquals(TestValues.MATCH, testAlignment, testShow.getAlignment());
- assertEquals(TestValues.MATCH, testCorrelationID, testShow.getCorrelationID());
-
- testShow = RPCRequestFactory.buildShow(null, null, null, null, null, null, null, null, null, null, null, null);
- assertNull(TestValues.NULL, testShow.getMainField1());
- assertNull(TestValues.NULL, testShow.getMainField2());
- assertNull(TestValues.NULL, testShow.getMainField3());
- assertNull(TestValues.NULL, testShow.getMainField4());
- assertNull(TestValues.NULL, testShow.getStatusBar());
- assertNull(TestValues.NULL, testShow.getMediaClock());
- assertNull(TestValues.NULL, testShow.getMediaTrack());
- assertNull(TestValues.NULL, testShow.getGraphic());
- assertNull(TestValues.NULL, testShow.getSoftButtons());
- assertNull(TestValues.NULL, testShow.getCustomPresets());
- assertNull(TestValues.NULL, testShow.getAlignment());
- assertNotNull(TestValues.NOT_NULL, testShow.getCorrelationID());
- // Test -- buildShow(String mainText1, String mainText2, String mainText3, String mainText4, TextAlignment alignment, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- buildShow(String mainText1, String mainText2, String statusBar, String mediaClock, String mediaTrack, TextAlignment alignment, Integer correlationID)
- testShow = RPCRequestFactory.buildShow(testText1, testText2, testStatusBar, testMediaClock, testMediaTrack, testAlignment, testCorrelationID);
- assertEquals(TestValues.MATCH, testText1, testShow.getMainField1());
- assertEquals(TestValues.MATCH, testText2, testShow.getMainField2());
- assertEquals(TestValues.MATCH, testStatusBar, testShow.getStatusBar());
- assertEquals(TestValues.MATCH, testMediaClock, testShow.getMediaClock());
- assertEquals(TestValues.MATCH, testMediaTrack, testShow.getMediaTrack());
- assertEquals(TestValues.MATCH, testAlignment, testShow.getAlignment());
- assertEquals(TestValues.MATCH, testCorrelationID, testShow.getCorrelationID());
-
- testShow = RPCRequestFactory.buildShow(null, null, null, null, null, null, null);
- assertNull(TestValues.NULL, testShow.getMainField1());
- assertNull(TestValues.NULL, testShow.getMainField2());
- assertNull(TestValues.NULL, testShow.getStatusBar());
- assertNull(TestValues.NULL, testShow.getMediaClock());
- assertNull(TestValues.NULL, testShow.getMediaTrack());
- assertNull(TestValues.NULL, testShow.getAlignment());
- assertNotNull(TestValues.NOT_NULL, testShow.getCorrelationID());
-
- // Test -- buildShow(String mainText1, String mainText2, TextAlignment alignment, Integer correlationID)
- // ^ Calls another build method.
- }
-
- public void testBuildSpeak () {
-
- String testTTSText = "test";
- Integer testCorrelationID = 0;
- Vector<TTSChunk> testTTSChunks = TTSChunkFactory.createSimpleTTSChunks(testTTSText);
- Speak testSpeak;
-
- // Test -- buildSpeak(String ttsText, Integer correlationID)
- testSpeak = RPCRequestFactory.buildSpeak(testTTSText, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTTSChunks, testSpeak.getTtsChunks()));
- assertEquals(TestValues.MATCH, testCorrelationID, testSpeak.getCorrelationID());
-
- testSpeak = RPCRequestFactory.buildSpeak((String) null, null);
- assertNull(TestValues.NULL, testSpeak.getTtsChunks());
- assertNotNull(TestValues.NOT_NULL, testSpeak.getCorrelationID());
-
- // Test -- buildSpeak(Vector<TTSChunk> ttsChunks, Integer correlationID)
- testSpeak = RPCRequestFactory.buildSpeak(testTTSChunks, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testTTSChunks, testSpeak.getTtsChunks()));
- assertEquals(TestValues.MATCH, testCorrelationID, testSpeak.getCorrelationID());
-
- testSpeak = RPCRequestFactory.buildSpeak((Vector<TTSChunk>) null, null);
- assertNull(TestValues.NULL, testSpeak.getTtsChunks());
- assertNotNull(TestValues.NOT_NULL, testSpeak.getCorrelationID());
- }
-
- public void testBuildSubscribeButton () {
-
- ButtonName testButtonName = ButtonName.CUSTOM_BUTTON;
- Integer testCorrelationID = 0;
- SubscribeButton testSB;
-
- // Test -- buildSubscribeButton(ButtonName buttonName, Integer correlationID)
- testSB = RPCRequestFactory.buildSubscribeButton(testButtonName, testCorrelationID);
- assertEquals(TestValues.MATCH, testButtonName, testSB.getButtonName());
- assertEquals(TestValues.MATCH, testCorrelationID, testSB.getCorrelationID());
-
- testSB = RPCRequestFactory.buildSubscribeButton(null, null);
- assertNull(TestValues.NULL, testSB.getButtonName());
- assertNotNull(TestValues.NOT_NULL, testSB.getCorrelationID());
-
- }
-
- public void testBuildUnregisterAppInterface () {
-
- Integer testCorrelationID = 0;
- UnregisterAppInterface testUAI;
-
- // Test -- buildUnregisterAppInterface(Integer correlationID)
- testUAI = RPCRequestFactory.buildUnregisterAppInterface(testCorrelationID);
- assertEquals(TestValues.MATCH, testCorrelationID, testUAI.getCorrelationID());
-
- testUAI = RPCRequestFactory.buildUnregisterAppInterface(null);
- assertNotNull(TestValues.NOT_NULL, testUAI.getCorrelationID());
- }
-
- public void testBuildUnsubscribeButton () {
-
- ButtonName testButtonName = ButtonName.CUSTOM_BUTTON;
- Integer testCorrelationID = 0;
- UnsubscribeButton testUB;
-
- // Test -- buildUnsubscribeButton(ButtonName buttonName, Integer correlationID)
- testUB = RPCRequestFactory.buildUnsubscribeButton(testButtonName, testCorrelationID);
- assertEquals(TestValues.MATCH, testButtonName, testUB.getButtonName());
- assertEquals(TestValues.MATCH, testCorrelationID, testUB.getCorrelationID());
-
- testUB = RPCRequestFactory.buildUnsubscribeButton(null, null);
- assertNull(TestValues.NULL, testUB.getButtonName());
- assertNotNull(TestValues.NOT_NULL, testUB.getCorrelationID());
-
- }
-
- public void testBuildSubscribeVehicleData () {
-
- boolean testGPS = true, testSpeed = true, testRPM = true, testFuelLevel = true, testFuelLevelState = true, testInstantFuelConsumption = true, testExternalTemperature = true, testPRNDL = true, testTirePressure = true, testOdometer = true, testBeltStatus = true, testBodyInformation = true, testDeviceStatus = true, testDriverBraking = true;
- Integer testCorrelationID = 0;
- SubscribeVehicleData testSVD;
-
- // Test -- BuildSubscribeVehicleData(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State, boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure, boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus, boolean driverBraking, Integer correlationID)
- testSVD = RPCRequestFactory.BuildSubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, testCorrelationID);
- assertTrue(TestValues.TRUE, testSVD.getGps());
- assertTrue(TestValues.TRUE, testSVD.getSpeed());
- assertTrue(TestValues.TRUE, testSVD.getRpm());
- assertTrue(TestValues.TRUE, testSVD.getFuelLevel());
- assertTrue(TestValues.TRUE, testSVD.getFuelLevelState());
- assertTrue(TestValues.TRUE, testSVD.getInstantFuelConsumption());
- assertTrue(TestValues.TRUE, testSVD.getExternalTemperature());
- assertTrue(TestValues.TRUE, testSVD.getPrndl());
- assertTrue(TestValues.TRUE, testSVD.getTirePressure());
- assertTrue(TestValues.TRUE, testSVD.getOdometer());
- assertTrue(TestValues.TRUE, testSVD.getBeltStatus());
- assertTrue(TestValues.TRUE, testSVD.getBodyInformation());
- assertTrue(TestValues.TRUE, testSVD.getDeviceStatus());
- assertTrue(TestValues.TRUE, testSVD.getDriverBraking());
- assertEquals(TestValues.MATCH, testCorrelationID, testSVD.getCorrelationID());
-
- testSVD = RPCRequestFactory.BuildSubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNotNull(TestValues.NULL, testSVD.getCorrelationID());
- }
-
- public void testBuildUnsubscribeVehicleData () {
-
- boolean testGPS = true, testSpeed = true, testRPM = true, testFuelLevel = true, testFuelLevelState = true, testInstantFuelConsumption = true, testExternalTemperature = true, testPRNDL = true, testTirePressure = true, testOdometer = true, testBeltStatus = true, testBodyInformation = true, testDeviceStatus = true, testDriverBraking = true;
- Integer testCorrelationID = 0;
- UnsubscribeVehicleData testUVD;
-
- // Test -- BuildUnsubscribeVehicleData(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State, boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure, boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus, boolean driverBraking, Integer correlationID)
- testUVD = RPCRequestFactory.BuildUnsubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, testCorrelationID);
- assertTrue(TestValues.TRUE, testUVD.getGps());
- assertTrue(TestValues.TRUE, testUVD.getSpeed());
- assertTrue(TestValues.TRUE, testUVD.getRpm());
- assertTrue(TestValues.TRUE, testUVD.getFuelLevel());
- assertTrue(TestValues.TRUE, testUVD.getFuelLevelState());
- assertTrue(TestValues.TRUE, testUVD.getInstantFuelConsumption());
- assertTrue(TestValues.TRUE, testUVD.getExternalTemperature());
- assertTrue(TestValues.TRUE, testUVD.getPrndl());
- assertTrue(TestValues.TRUE, testUVD.getTirePressure());
- assertTrue(TestValues.TRUE, testUVD.getOdometer());
- assertTrue(TestValues.TRUE, testUVD.getBeltStatus());
- assertTrue(TestValues.TRUE, testUVD.getBodyInformation());
- assertTrue(TestValues.TRUE, testUVD.getDeviceStatus());
- assertTrue(TestValues.TRUE, testUVD.getDriverBraking());
- assertEquals(TestValues.MATCH, testCorrelationID, testUVD.getCorrelationID());
-
- testUVD = RPCRequestFactory.BuildUnsubscribeVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNotNull(TestValues.NULL, testUVD.getCorrelationID());
- }
-
- public void testBuildGetVehicleData () {
-
- boolean testGPS = true, testSpeed = true, testRPM = true, testFuelLevel = true, testFuelLevelState = true, testInstantFuelConsumption = true, testExternalTemperature = true, testVIN = true, testPRNDL = true, testTirePressure = true, testOdometer = true, testBeltStatus = true, testBodyInformation = true, testDeviceStatus = true, testDriverBraking = true;
- Integer testCorrelationID = 0;
- GetVehicleData testGVD;
-
- // Test -- BuildGetVehicleData(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State, boolean instantFuelConsumption, boolean externalTemperature, boolean vin, boolean prndl, boolean tirePressure, boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus, boolean driverBraking, Integer correlationID)
- testGVD = RPCRequestFactory.BuildGetVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testVIN, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, testCorrelationID);
- assertTrue(TestValues.TRUE, testGVD.getGps());
- assertTrue(TestValues.TRUE, testGVD.getSpeed());
- assertTrue(TestValues.TRUE, testGVD.getRpm());
- assertTrue(TestValues.TRUE, testGVD.getFuelLevel());
- assertTrue(TestValues.TRUE, testGVD.getFuelLevelState());
- assertTrue(TestValues.TRUE, testGVD.getInstantFuelConsumption());
- assertTrue(TestValues.TRUE, testGVD.getExternalTemperature());
- assertTrue(TestValues.TRUE, testGVD.getPrndl());
- assertTrue(TestValues.TRUE, testGVD.getTirePressure());
- assertTrue(TestValues.TRUE, testGVD.getOdometer());
- assertTrue(TestValues.TRUE, testGVD.getBeltStatus());
- assertTrue(TestValues.TRUE, testGVD.getBodyInformation());
- assertTrue(TestValues.TRUE, testGVD.getDeviceStatus());
- assertTrue(TestValues.TRUE, testGVD.getDriverBraking());
- assertTrue(TestValues.TRUE, testGVD.getVin());
- assertEquals(TestValues.MATCH, testCorrelationID, testGVD.getCorrelationID());
-
- testGVD = RPCRequestFactory.BuildGetVehicleData(testGPS, testSpeed, testRPM, testFuelLevel, testFuelLevelState, testInstantFuelConsumption, testExternalTemperature, testVIN, testPRNDL, testTirePressure, testOdometer, testBeltStatus, testBodyInformation, testDeviceStatus, testDriverBraking, null);
- assertNotNull(TestValues.NULL, testGVD.getCorrelationID());
- }
-
- public void testBuildScrollableMessage () {
-
- String testSMB = "test";
- Integer testTimeout = 1, testCorrelationID = 0;
- Vector<SoftButton> testSoftButtons = new Vector<SoftButton>();
- testSoftButtons.add(new SoftButton());
- ScrollableMessage testSM;
-
- // Test -- BuildScrollableMessage(String scrollableMessageBody, Integer timeout, Vector<SoftButton> softButtons, Integer correlationID)
- testSM = RPCRequestFactory.BuildScrollableMessage(testSMB, testTimeout, testSoftButtons, testCorrelationID);
- assertEquals(TestValues.MATCH, testSMB, testSM.getScrollableMessageBody());
- assertEquals(TestValues.MATCH, testTimeout, testSM.getTimeout());
- assertTrue(TestValues.TRUE, Validator.validateSoftButtons(testSoftButtons, testSM.getSoftButtons()));
- assertEquals(TestValues.MATCH, testCorrelationID, testSM.getCorrelationID());
-
- testSM = RPCRequestFactory.BuildScrollableMessage(null, null, null, null);
- assertNull(TestValues.NULL, testSM.getScrollableMessageBody());
- assertNull(TestValues.NULL, testSM.getTimeout());
- assertNull(TestValues.NULL, testSM.getSoftButtons());
- assertNotNull(TestValues.NOT_NULL, testSM.getCorrelationID());
- }
-
- public void testBuildSlider () {
-
- Integer testTicks = 1, testPosition = 2, testTimeout = 3, testCorrelationID = 0;
- String testHeader = "header";
- Vector<String> testFooter = new Vector<String>();
- testFooter.add("footer");
- Slider testSlider;
-
- // Test -- BuildSlider(Integer numTicks, Integer position, String sliderHeader, Vector<String> sliderFooter, Integer timeout, Integer correlationID)
- testSlider = RPCRequestFactory.BuildSlider(testTicks, testPosition, testHeader, testFooter, testTimeout, testCorrelationID);
- assertEquals(TestValues.MATCH, testTicks, testSlider.getNumTicks());
- assertEquals(TestValues.MATCH, testPosition, testSlider.getPosition());
- assertEquals(TestValues.MATCH, testHeader, testSlider.getSliderHeader());
- assertTrue(TestValues.TRUE, Validator.validateStringList(testFooter, testSlider.getSliderFooter()));
- assertEquals(TestValues.MATCH, testCorrelationID, testSlider.getCorrelationID());
-
- testSlider = RPCRequestFactory.BuildSlider(null, null, null, null, null, null);
- assertNull(TestValues.NULL, testSlider.getNumTicks());
- assertNull(TestValues.NULL, testSlider.getPosition());
- assertNull(TestValues.NULL, testSlider.getSliderHeader());
- assertNull(TestValues.NULL, testSlider.getSliderFooter());
- assertNull(TestValues.NULL, testSlider.getTimeout());
- assertNotNull(TestValues.NOT_NULL, testSlider.getCorrelationID());
- }
-
- public void testBuildChangeRegistration () {
-
- Language testLang = Language.EN_US, testHMILang = Language.EN_AU;
- Integer testCorrelationID = 0;
- ChangeRegistration testCR;
-
- // Test -- BuildChangeRegistration(Language language, Language hmiDisplayLanguage, Integer correlationID)
- testCR = RPCRequestFactory.BuildChangeRegistration(testLang, testHMILang, testCorrelationID);
- assertEquals(TestValues.MATCH, testLang, testCR.getLanguage());
- assertEquals(TestValues.MATCH, testHMILang, testCR.getHmiDisplayLanguage());
- assertEquals(TestValues.MATCH, testCorrelationID, testCR.getCorrelationID());
-
- testCR = RPCRequestFactory.BuildChangeRegistration(null, null, null);
- assertNull(TestValues.NULL, testCR.getLanguage());
- assertNull(TestValues.NULL, testCR.getHmiDisplayLanguage());
- assertNotNull(TestValues.NOT_NULL, testCR.getCorrelationID());
- }
-
- public void testBuildSetDisplayLayout () {
-
- String testDL = "layout";
- Integer testCorrelationID = 0;
- SetDisplayLayout testSDL;
-
- // Test -- BuildSetDisplayLayout(String displayLayout, Integer correlationID)
- testSDL = RPCRequestFactory.BuildSetDisplayLayout(testDL, testCorrelationID);
- assertEquals(TestValues.MATCH, testDL, testSDL.getDisplayLayout());
- assertEquals(TestValues.MATCH, testCorrelationID, testSDL.getCorrelationID());
-
- testSDL = RPCRequestFactory.BuildSetDisplayLayout(null, null);
- assertNull(TestValues.NULL, testSDL.getDisplayLayout());
- assertNotNull(TestValues.NOT_NULL, testSDL.getCorrelationID());
- }
-
- public void testBuildPerformAudioPassThru () {
-
- Vector<TTSChunk> testInitialPrompt = TTSChunkFactory.createSimpleTTSChunks("test");
- String testAPTDT1 = "audio", testAPTDT2 = "pass";
- SamplingRate testSR = SamplingRate._16KHZ;
- Integer testMaxDuration = 1, testCorrelationID = 0;
- BitsPerSample testBits = BitsPerSample._16_BIT;
- AudioType testAT = AudioType.PCM;
- Boolean testMute = false;
- PerformAudioPassThru testPAPT;
-
- // Test -- BuildPerformAudioPassThru(String ttsText, String audioPassThruDisplayText1, String audioPassThruDisplayText2, SamplingRate samplingRate, Integer maxDuration, BitsPerSample bitsPerSample, AudioType audioType, Boolean muteAudio, Integer correlationID)
- // ^ Calls another build method.
-
- // Test -- BuildPerformAudioPassThru(Vector<TTSChunk> initialPrompt, String audioPassThruDisplayText1, String audioPassThruDisplayText2, SamplingRate samplingRate, Integer maxDuration, BitsPerSample bitsPerSample, AudioType audioType, Boolean muteAudio, Integer correlationID)
- testPAPT = RPCRequestFactory.BuildPerformAudioPassThru(testInitialPrompt, testAPTDT1, testAPTDT2, testSR, testMaxDuration, testBits, testAT, testMute, testCorrelationID);
- assertTrue(TestValues.TRUE, Validator.validateTtsChunks(testInitialPrompt, testPAPT.getInitialPrompt()));
- assertEquals(TestValues.MATCH, testAPTDT1, testPAPT.getAudioPassThruDisplayText1());
- assertEquals(TestValues.MATCH, testAPTDT2, testPAPT.getAudioPassThruDisplayText2());
- assertEquals(TestValues.MATCH, testSR, testPAPT.getSamplingRate());
- assertEquals(TestValues.MATCH, testMaxDuration, testPAPT.getMaxDuration());
- assertEquals(TestValues.MATCH, testBits, testPAPT.getBitsPerSample());
- assertEquals(TestValues.MATCH, testAT, testPAPT.getAudioType());
- assertEquals(TestValues.MATCH, testMute, testPAPT.getMuteAudio());
- assertEquals(TestValues.MATCH, testCorrelationID, testPAPT.getCorrelationID());
-
- testPAPT = RPCRequestFactory.BuildPerformAudioPassThru((Vector<TTSChunk>) null, null, null, null, null, null, null, null, null);
- assertNull(TestValues.NULL, testPAPT.getInitialPrompt());
- assertNull(TestValues.NULL, testPAPT.getAudioPassThruDisplayText1());
- assertNull(TestValues.NULL, testPAPT.getAudioPassThruDisplayText2());
- assertNull(TestValues.NULL, testPAPT.getSamplingRate());
- assertNull(TestValues.NULL, testPAPT.getMaxDuration());
- assertNull(TestValues.NULL, testPAPT.getBitsPerSample());
- assertNull(TestValues.NULL, testPAPT.getAudioType());
- assertNull(TestValues.NULL, testPAPT.getMuteAudio());
- assertNotNull(TestValues.NOT_NULL, testPAPT.getCorrelationID());
- }
-
- public void testBuildEndAudioPassThru () {
-
- Integer testCorrelationID = 0;
- EndAudioPassThru testEAPT;
-
- // Test -- BuildEndAudioPassThru(Integer correlationID)
- testEAPT = RPCRequestFactory.BuildEndAudioPassThru(testCorrelationID);
- assertEquals(TestValues.MATCH, testCorrelationID, testEAPT.getCorrelationID());
-
- testEAPT = RPCRequestFactory.BuildEndAudioPassThru(null);
- assertNotNull(TestValues.NOT_NULL, testEAPT.getCorrelationID());
- }
-} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
deleted file mode 100644
index 92670c7d4..000000000
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
+++ /dev/null
@@ -1,298 +0,0 @@
-package com.smartdevicelink.test.proxy;
-
-import android.content.Context;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import android.telephony.TelephonyManager;
-import android.util.Log;
-
-import com.smartdevicelink.exception.SdlException;
-import com.smartdevicelink.exception.SdlExceptionCause;
-import com.smartdevicelink.proxy.RPCMessage;
-import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.proxy.SdlProxyALM;
-import com.smartdevicelink.proxy.SdlProxyBase;
-import com.smartdevicelink.proxy.SdlProxyBuilder;
-import com.smartdevicelink.proxy.SdlProxyConfigurationResources;
-import com.smartdevicelink.proxy.interfaces.IProxyListenerALM;
-import com.smartdevicelink.proxy.rpc.GenericResponse;
-import com.smartdevicelink.proxy.rpc.Show;
-import com.smartdevicelink.proxy.rpc.ShowResponse;
-import com.smartdevicelink.proxy.rpc.Speak;
-import com.smartdevicelink.proxy.rpc.SpeakResponse;
-import com.smartdevicelink.proxy.rpc.enums.Result;
-import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
-import com.smartdevicelink.streaming.video.SdlRemoteDisplay;
-import com.smartdevicelink.streaming.video.VideoStreamingParameters;
-import com.smartdevicelink.test.streaming.video.SdlRemoteDisplayTest;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertNotNull;
-import static junit.framework.TestCase.assertTrue;
-import static junit.framework.TestCase.fail;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
-
-@RunWith(AndroidJUnit4.class)
-public class SdlProxyBaseTests {
- public static final String TAG = "SdlProxyBaseTests";
-
- int onUpdateListenerCounter, onFinishedListenerCounter, onResponseListenerCounter, onErrorListenerCounter, remainingRequestsExpected;
-
- /**
- * Test SdlProxyBase for handling null SdlProxyConfigurationResources
- */
- @Test
- public void testNullSdlProxyConfigurationResources() {
- SdlProxyALM proxy = null;
- SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(mock(IProxyListenerALM.class), "appId", "appName", true, getInstrumentation().getTargetContext());
- SdlProxyConfigurationResources config = new SdlProxyConfigurationResources("path", (TelephonyManager) getInstrumentation().getTargetContext().getSystemService(Context.TELEPHONY_SERVICE));
- //Construct with a non-null SdlProxyConfigurationResources
- builder.setSdlProxyConfigurationResources(config);
- try {
- proxy = builder.build();
- } catch (Exception e) {
- Log.v(TAG, "Exception in testNullSdlProxyConfigurationResources, testing non null SdlProxyConfigurationResources");
- if (!(e instanceof SdlException) || !((SdlException) e).getSdlExceptionCause().equals(SdlExceptionCause.BLUETOOTH_ADAPTER_NULL)) {
- e.printStackTrace();
- Assert.fail("Exception in testNullSdlProxyConfigurationResources - \n" + e.toString());
- }
- }
-
- if (proxy != null) {
- try {
- proxy.dispose();
- proxy = null;
- }catch(SdlException e){
- e.printStackTrace();
- }
- }
-
- //Construct with a null SdlProxyConfigurationResources
- builder.setSdlProxyConfigurationResources(null);
- try {
- proxy = builder.build();
- } catch (Exception e) {
- Log.v(TAG, "Exception in testNullSdlProxyConfigurationResources, testing null SdlProxyConfigurationResources");
- if (!(e instanceof SdlException) || !((SdlException) e).getSdlExceptionCause().equals(SdlExceptionCause.BLUETOOTH_ADAPTER_NULL)) {
- e.printStackTrace();
- Assert.fail("Exception in testNullSdlProxyConfigurationResources, testing null SdlProxyConfigurationResources");
- }
- }
- if (proxy != null) {
- try {
- proxy.dispose();
- proxy = null;
- }catch(SdlException e){
- e.printStackTrace();
- }
- }
-
- //Construct with a non-null SdlProxyConfigurationResources and a null TelephonyManager
- config.setTelephonyManager(null);
- builder.setSdlProxyConfigurationResources(config);
- try {
- proxy = builder.build();
- } catch (Exception e) {
- Log.v(TAG, "Exception in testNullSdlProxyConfigurationResources, testing null TelephonyManager");
- if (!(e instanceof SdlException) || !((SdlException) e).getSdlExceptionCause().equals(SdlExceptionCause.BLUETOOTH_ADAPTER_NULL)) {
- Assert.fail("Exception in testNullSdlProxyConfigurationResources, testing null TelephonyManager");
- }
- }
- if (proxy != null) {
- try {
- proxy.dispose();
- proxy = null;
- }catch(SdlException e){
- e.printStackTrace();
- }
- }
- }
-
- @Test
- public void testRemoteDisplayStreaming(){
- SdlProxyALM proxy = null;
- SdlProxyBuilder.Builder builder = new SdlProxyBuilder.Builder(mock(IProxyListenerALM.class), "appId", "appName", true, getInstrumentation().getTargetContext());
- try{
- proxy = builder.build();
- // public void startRemoteDisplayStream(Context context, final Class<? extends SdlRemoteDisplay> remoteDisplay, final VideoStreamingParameters parameters, final boolean encrypted){
- Method m = SdlProxyALM.class.getDeclaredMethod("startRemoteDisplayStream", Context.class, SdlRemoteDisplay.class, VideoStreamingParameters.class, boolean.class);
- assertNotNull(m);
- m.setAccessible(true);
- m.invoke(proxy,getInstrumentation().getTargetContext(), SdlRemoteDisplayTest.MockRemoteDisplay.class, (VideoStreamingParameters)null, false);
- assert true;
-
- }catch (Exception e){
- assert false;
- }
- }
-
- @Test
- public void testSendRPCsAllSucceed(){
- testSendMultipleRPCs(false, 1);
- }
-
- @Test
- public void testSendRPCsSomeFail(){
- testSendMultipleRPCs(false, 2);
- }
-
- @Test
- public void testSendSequentialRPCsAllSucceed(){
- testSendMultipleRPCs(true, 1);
- }
-
- @Test
- public void testSendSequentialRPCsSomeFail(){
- testSendMultipleRPCs(true, 2);
- }
-
- private void testSendMultipleRPCs(boolean sequentialSend, int caseNumber){
- final List<RPCRequest> rpcsList = new ArrayList<>();
- final List<RPCRequest> rpcsTempList = new ArrayList<>();
- final HashMap<RPCRequest, OnRPCResponseListener> requestsMap = new HashMap<>();
- onUpdateListenerCounter = 0;
- onFinishedListenerCounter = 0;
- onResponseListenerCounter = 0;
- onErrorListenerCounter = 0;
-
-
- // We extend the SdlProxyBase to be able to override getIsConnected() & sendRPCMessagePrivate() methods so they don't cause issues when trying to send RPCs
- // Because otherwise, they will throw exception cause there not actual connection to head unit
- SdlProxyBase proxy = new SdlProxyBase() {
-
- @Override
- public Boolean getIsConnected() {
- return true;
- }
-
- @Override
- protected void sendRPCMessagePrivate(RPCMessage message) {
- // Do nothing
- }
- };
-
-
- // We need to get list of all OnRPCResponseListeners so we can trigger onResponse/onError for each RPC to fake a response from Core
- final Answer<Void> answer = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- RPCRequest request = (RPCRequest) invocation.getMock();
- OnRPCResponseListener listener = (OnRPCResponseListener) args[0];
- requestsMap.put(request, listener);
- rpcsTempList.add(request);
- return null;
- }
- };
-
-
- // Prepare RPCs to send
- Speak speak = mock(Speak.class);
- doReturn(RPCMessage.KEY_REQUEST).when(speak).getMessageType();
- doAnswer(answer).when(speak).setOnRPCResponseListener(any(OnRPCResponseListener.class));
- rpcsList.add(speak);
-
- Show show = mock(Show.class);
- doReturn(RPCMessage.KEY_REQUEST).when(show).getMessageType();
- doAnswer(answer).when(show).setOnRPCResponseListener(any(OnRPCResponseListener.class));
- rpcsList.add(show);
-
-
- // Send RPCs
- remainingRequestsExpected = rpcsList.size();
- OnMultipleRequestListener onMultipleRequestListener = new OnMultipleRequestListener() {
- @Override
- public void onUpdate(int remainingRequests) {
- onUpdateListenerCounter++;
- assertEquals(remainingRequestsExpected, remainingRequests);
- }
-
- @Override
- public void onFinished() {
- onFinishedListenerCounter++;
- }
-
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess()) {
- onResponseListenerCounter++;
- remainingRequestsExpected--;
- } else {
- onErrorListenerCounter++;
- remainingRequestsExpected--;
- }
- }
- };
- try {
- if (sequentialSend) {
- proxy.sendSequentialRequests(rpcsList, onMultipleRequestListener);
- } else {
- proxy.sendRequests(rpcsList, onMultipleRequestListener);
- }
- assertTrue(true);
- } catch (SdlException e) {
- e.printStackTrace();
- fail();
- }
-
-
- // Trigger fake RPC responses
- int onUpdateListenerCounterExpected = 0, onFinishedListenerCounterExpected = 0, onResponseListenerCounterExpected = 0, onErrorListenerCounterExpected = 0;
- switch (caseNumber){
- case 1: // All RPCs succeed
- onUpdateListenerCounterExpected = 2;
- onFinishedListenerCounterExpected = 1;
- onResponseListenerCounterExpected = 2;
- onErrorListenerCounterExpected = 0;
-
- while (rpcsTempList.size() != 0){
- RPCRequest request = rpcsTempList.remove(0);
- if (request instanceof Speak) {
- requestsMap.get(request).onResponse(request.getCorrelationID(), new SpeakResponse(true, Result.SUCCESS));
- } else if (request instanceof Show) {
- requestsMap.get(request).onResponse(request.getCorrelationID(), new ShowResponse(true, Result.SUCCESS));
- }
- }
- break;
- case 2: // Some RPCs fail
- onUpdateListenerCounterExpected = 2;
- onFinishedListenerCounterExpected = 1;
- onResponseListenerCounterExpected = 1;
- onErrorListenerCounterExpected = 1;
-
- while (rpcsTempList.size() != 0){
- RPCRequest request = rpcsTempList.remove(0);
- if (request instanceof Speak) {
- requestsMap.get(request).onResponse(request.getCorrelationID(), new GenericResponse(false, Result.DISALLOWED));
- } else if (request instanceof Show) {
- requestsMap.get(request).onResponse(request.getCorrelationID(), new ShowResponse(true, Result.SUCCESS));
- }
- }
- break;
- }
-
-
- // Make sure the listener is called correctly
- assertEquals("onUpdate Listener was not called or called more/less frequently than expected", onUpdateListenerCounterExpected, onUpdateListenerCounter);
- assertEquals("onFinished Listener was not called or called more/less frequently than expected", onFinishedListenerCounterExpected, onFinishedListenerCounter);
- assertEquals("onResponse Listener was not called or called more/less frequently than expected", onResponseListenerCounterExpected, onResponseListenerCounter);
- assertEquals("onError Listener was not called or called more/less frequently than expected", onErrorListenerCounterExpected, onErrorListenerCounter);
- }
-}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
index f8bb07caf..6e23edc7a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/FuelRangeTests.java
@@ -1,6 +1,8 @@
package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.proxy.rpc.FuelRange;
+import com.smartdevicelink.proxy.rpc.enums.CapacityUnit;
+import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
import com.smartdevicelink.proxy.rpc.enums.FuelType;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.TestValues;
@@ -26,6 +28,10 @@ public class FuelRangeTests extends TestCase{
msg.setType(TestValues.GENERAL_FUELTYPE);
msg.setRange(TestValues.GENERAL_FLOAT);
+ msg.setLevel(TestValues.GENERAL_FLOAT);
+ msg.setLevelState(TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ msg.setCapacity(TestValues.GENERAL_FLOAT);
+ msg.setCapacityUnit(TestValues.GENERAL_CAPACITYUNIT);
}
/**
@@ -35,10 +41,18 @@ public class FuelRangeTests extends TestCase{
// Test Values
FuelType fuelType = msg.getType();
float range = msg.getRange();
-
+ float level = msg.getLevel();
+ ComponentVolumeStatus levelState = msg.getLevelState();
+ CapacityUnit capacityUnit = msg.getCapacityUnit();
+ float capacity = msg.getCapacity();
+
// Valid Tests
assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, range);
assertEquals(TestValues.MATCH, TestValues.GENERAL_FUELTYPE, fuelType);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, level);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_COMPONENTVOLUMESTATUS, levelState);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_CAPACITYUNIT, capacityUnit);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_FLOAT, capacity);
// Invalid/Null Tests
FuelRange msg = new FuelRange();
@@ -46,6 +60,10 @@ public class FuelRangeTests extends TestCase{
assertNull(TestValues.NULL, msg.getType());
assertNull(TestValues.NULL, msg.getRange());
+ assertNull(TestValues.NULL, msg.getLevel());
+ assertNull(TestValues.NULL, msg.getLevelState());
+ assertNull(TestValues.NULL, msg.getCapacityUnit());
+ assertNull(TestValues.NULL, msg.getCapacity());
}
public void testJson(){
@@ -54,6 +72,10 @@ public class FuelRangeTests extends TestCase{
try{
reference.put(FuelRange.KEY_TYPE, TestValues.GENERAL_FUELTYPE);
reference.put(FuelRange.KEY_RANGE, (Float) TestValues.GENERAL_FLOAT);
+ reference.put(FuelRange.KEY_LEVEL, TestValues.GENERAL_FLOAT);
+ reference.put(FuelRange.KEY_LEVEL_STATE, TestValues.GENERAL_COMPONENTVOLUMESTATUS);
+ reference.put(FuelRange.KEY_CAPACITY, TestValues.GENERAL_FLOAT);
+ reference.put(FuelRange.KEY_CAPACITY_UNIT, TestValues.GENERAL_CAPACITYUNIT);
JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java
new file mode 100644
index 000000000..1de8abfdf
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/StabilityControlsStatusTests.java
@@ -0,0 +1,58 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.StabilityControlsStatus;
+import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.TestValues;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+public class StabilityControlsStatusTests extends TestCase {
+ private StabilityControlsStatus msg;
+
+ @Override
+ public void setUp() {
+ msg = new StabilityControlsStatus();
+
+ msg.setEscSystem(TestValues.GENERAL_ESC_SYSTEM);
+ msg.setTrailerSwayControl(TestValues.GENERAL_S_WAY_CONTROL);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ VehicleDataStatus esc = msg.getEscSystem();
+ VehicleDataStatus sTrailer = msg.getTrailerSwayControl();
+
+ // Valid Tests
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_ESC_SYSTEM, esc);
+ assertEquals(TestValues.MATCH, TestValues.GENERAL_S_WAY_CONTROL, sTrailer);
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(StabilityControlsStatus.KEY_TRAILER_SWAY_CONTROL, TestValues.GENERAL_S_WAY_CONTROL);
+ reference.put(StabilityControlsStatus.KEY_ESC_SYSTEM, TestValues.GENERAL_ESC_SYSTEM);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CapacityUnitTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CapacityUnitTests.java
new file mode 100644
index 000000000..4da32bebf
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/CapacityUnitTests.java
@@ -0,0 +1,71 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.CapacityUnit;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class CapacityUnitTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "LITERS";
+ CapacityUnit enumLiters = CapacityUnit.valueForString(example);
+ example = "KILOWATTHOURS";
+ CapacityUnit enumKWH = CapacityUnit.valueForString(example);
+ example = "KILOGRAMS";
+ CapacityUnit enumKilograms = CapacityUnit.valueForString(example);
+
+ assertNotNull("LITERS returned null", enumLiters);
+ assertNotNull("KILOWATTHOURS returned null", enumKWH);
+ assertNotNull("KILOGRAMS returned null", enumKilograms);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "lONg";
+ try {
+ CapacityUnit temp = CapacityUnit.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum () {
+ String example = null;
+ try {
+ CapacityUnit temp = CapacityUnit.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of ButtonPressMode.
+ */
+ public void testListEnum() {
+ List<CapacityUnit> enumValueList = Arrays.asList(CapacityUnit.values());
+
+ List<CapacityUnit> enumTestList = new ArrayList<CapacityUnit>();
+ enumTestList.add(CapacityUnit.KILOGRAMS);
+ enumTestList.add(CapacityUnit.KILOWATTHOURS);
+ enumTestList.add(CapacityUnit.LITERS);
+
+ 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/VehicleDataTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
index 37793b489..a337058f9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
@@ -88,6 +88,8 @@ public class VehicleDataTypeTests extends TestCase {
VehicleDataType enumVehicleDataGearStatus= VehicleDataType.valueForString(example);
example = "VEHICLEDATA_WINDOWSTATUS";
VehicleDataType enumVehicleDataTypeWindowStatus= VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_STABILITYCONTROLSSTATUS";
+ VehicleDataType enumVehicleDataStabilityControlsStatus = VehicleDataType.valueForString(example);
assertNotNull("VEHICLEDATA_GPS returned null", enumVehicleDataGps);
assertNotNull("VEHICLEDATA_SPEED returned null", enumVehicleDataSpeed);
@@ -124,6 +126,7 @@ public class VehicleDataTypeTests extends TestCase {
assertNotNull("VEHICLEDATA_HANDSOFFSTEERING returned null", enumVehicleDataHandsOffSteeringType);
assertNotNull("VEHICLEDATA_WINDOWSTATUS returned null", enumVehicleDataTypeWindowStatus);
assertNotNull("VEHICLEDATA_GEARSTATUS returned null", enumVehicleDataGearStatus);
+ assertNotNull("VEHICLEDATA_STABILITYCONTROLSSTATUS returned null", enumVehicleDataStabilityControlsStatus);
}
/**
@@ -196,6 +199,7 @@ public class VehicleDataTypeTests extends TestCase {
enumTestList.add(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING);
enumTestList.add(VehicleDataType.VEHICLEDATA_WINDOWSTATUS);
enumTestList.add(VehicleDataType.VEHICLEDATA_GEARSTATUS);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
index d333d3b5a..409ad1dd1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
@@ -13,10 +13,12 @@ import com.smartdevicelink.proxy.rpc.EmergencyEvent;
import com.smartdevicelink.proxy.rpc.FuelRange;
import com.smartdevicelink.proxy.rpc.GPSData;
import com.smartdevicelink.proxy.rpc.GearStatus;
+import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.HeadLampStatus;
import com.smartdevicelink.proxy.rpc.MyKey;
import com.smartdevicelink.proxy.rpc.OnVehicleData;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
+import com.smartdevicelink.proxy.rpc.StabilityControlsStatus;
import com.smartdevicelink.proxy.rpc.TireStatus;
import com.smartdevicelink.proxy.rpc.WindowStatus;
import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
@@ -104,6 +106,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
result.put(OnVehicleData.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
result.put(OnVehicleData.KEY_GEAR_STATUS, VehicleDataHelper.GEAR_STATUS);
result.put(OnVehicleData.KEY_WINDOW_STATUS, VehicleDataHelper.WINDOW_STATUS_LIST);
+ result.put(OnVehicleData.KEY_STABILITY_CONTROLS_STATUS, VehicleDataHelper.STABILITY_CONTROLS_STATUS);
result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
} catch(JSONException e) {
fail(TestValues.JSON_FAIL);
@@ -149,6 +152,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
TurnSignal turnSignal = ( (OnVehicleData) msg).getTurnSignal();
ElectronicParkBrakeStatus electronicParkBrakeStatus = ( (OnVehicleData) msg).getElectronicParkBrakeStatus();
GearStatus gearStatus = ( (OnVehicleData) msg).getGearStatus();
+ StabilityControlsStatus stabilityControlsStatus = ( (OnVehicleData) msg).getStabilityControlsStatus();
Object oemCustomVehicleData = ( (OnVehicleData) msg).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
Boolean handsOffSteering = ( (OnVehicleData) msg).getHandsOffSteering();
// Valid Tests
@@ -183,6 +187,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
assertEquals(TestValues.MATCH, VehicleDataHelper.TURN_SIGNAL, turnSignal);
assertEquals(TestValues.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
assertEquals(TestValues.MATCH, VehicleDataHelper.GEAR_STATUS, gearStatus);
+ assertEquals(TestValues.MATCH, VehicleDataHelper.STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
assertEquals(TestValues.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, oemCustomVehicleData);
assertEquals(TestValues.MATCH, VehicleDataHelper.HANDS_OFF_STEERING, handsOffSteering);
// Invalid/Null Tests
@@ -222,6 +227,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
assertNull(TestValues.NULL, msg.getHandsOffSteering());
assertNull(TestValues.NULL, msg.getWindowStatus());
assertNull(TestValues.NULL, msg.getGearStatus());
+ assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
@@ -244,8 +250,9 @@ public class OnVehicleDataTests extends BaseRpcTests{
JSONObject fuelRangeObj = new JSONObject();
JSONObject windowStatusObj = new JSONObject();
JSONObject gearStatusObj = new JSONObject();
+ JSONObject stabilityControlStatusObj = new JSONObject();
JSONArray fuelRangeArrayObj = new JSONArray();
- JSONArray windowStatusArrayObj = new JSONArray();
+ JSONArray windowStatusArrayObj = new JSONArray();
try {
//Set up the JSONObject to represent OnVehicleData:
@@ -370,8 +377,16 @@ public class OnVehicleDataTests extends BaseRpcTests{
// FUEL_RANGE
fuelRangeObj.put(FuelRange.KEY_TYPE, VehicleDataHelper.FUEL_RANGE_TYPE);
fuelRangeObj.put(FuelRange.KEY_RANGE, VehicleDataHelper.FUEL_RANGE_RANGE);
+ fuelRangeObj.put(FuelRange.KEY_CAPACITY, VehicleDataHelper.FUEL_RANGE_CAPACITY);
+ fuelRangeObj.put(FuelRange.KEY_CAPACITY_UNIT, VehicleDataHelper.FUEL_RANGE_CAPACITY_UNIT);
+ fuelRangeObj.put(FuelRange.KEY_LEVEL, VehicleDataHelper.FUEL_RANGE_LEVEL);
+ fuelRangeObj.put(FuelRange.KEY_LEVEL_STATE, VehicleDataHelper.FUEL_RANGE_LEVEL_STATE);
fuelRangeArrayObj.put(fuelRangeObj);
+ // STABILITY_CONTROLS_STATU
+ stabilityControlStatusObj.put(StabilityControlsStatus.KEY_ESC_SYSTEM, VehicleDataHelper.ESC_SYSTEM);
+ stabilityControlStatusObj.put(StabilityControlsStatus.KEY_TRAILER_SWAY_CONTROL, VehicleDataHelper.S_WAY_TRAILER);
+
// WINDOW_STATUS
windowStatusObj.put(WindowStatus.KEY_LOCATION, VehicleDataHelper.LOCATION_GRID);
windowStatusObj.put(WindowStatus.KEY_STATE, VehicleDataHelper.WINDOW_STATE);
@@ -414,6 +429,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
reference.put(OnVehicleData.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
reference.put(OnVehicleData.KEY_WINDOW_STATUS, windowStatusArrayObj);
reference.put(OnVehicleData.KEY_GEAR_STATUS, gearStatusObj);
+ reference.put(OnVehicleData.KEY_STABILITY_CONTROLS_STATUS, stabilityControlStatusObj);
reference.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
JSONObject underTest = msg.serializeJSON();
@@ -561,6 +577,20 @@ public class OnVehicleDataTests extends BaseRpcTests{
windowStatusReferenceList,
windowStatusUnderTestList));
}
+ else if (key.equals(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS)) {
+ JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ StabilityControlsStatus status1 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference));
+ StabilityControlsStatus status2 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest));
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateStabilityControlStatus(
+ status1,
+ status2
+ )
+ );
+ }
else {
assertEquals(TestValues.TRUE, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
index f3b4b564e..467c37b2e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
@@ -64,6 +64,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
msg.setHandsOffSteering(TestValues.GENERAL_BOOLEAN);
msg.setWindowStatus(TestValues.GENERAL_BOOLEAN);
msg.setGearStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setStabilityControlsStatus(TestValues.GENERAL_BOOLEAN);
msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
return msg;
@@ -116,6 +117,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
result.put(GetVehicleData.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_BOOLEAN);
result.put(GetVehicleData.KEY_GEAR_STATUS, TestValues.GENERAL_BOOLEAN);
result.put(GetVehicleData.KEY_WINDOW_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(GetVehicleData.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_BOOLEAN);
result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
}catch(JSONException e){
fail(TestValues.JSON_FAIL);
@@ -163,6 +165,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getHandsOffSteering());
assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getWindowStatus());
assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getGearStatus());
+ assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getStabilityControlsStatus());
assertTrue(TestValues.TRUE, ( (GetVehicleData) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
@@ -202,6 +205,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getHandsOffSteering());
assertNull(TestValues.NULL, msg.getWindowStatus());
assertNull(TestValues.NULL, msg.getGearStatus());
+ assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
@@ -257,6 +261,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_WINDOW_STATUS), cmd.getWindowStatus());
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_GEAR_STATUS), cmd.getGearStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_STABILITY_CONTROLS_STATUS), cmd.getStabilityControlsStatus());
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
fail(TestValues.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
index fee5ddd25..7f5113fc7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
@@ -63,6 +63,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
msg.setHandsOffSteering(TestValues.GENERAL_BOOLEAN);
msg.setWindowStatus(TestValues.GENERAL_BOOLEAN);
msg.setGearStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setStabilityControlsStatus(TestValues.GENERAL_BOOLEAN);
msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
return msg;
@@ -114,6 +115,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
result.put(SubscribeVehicleData.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_BOOLEAN);
result.put(SubscribeVehicleData.KEY_WINDOW_STATUS, TestValues.GENERAL_BOOLEAN);
result.put(SubscribeVehicleData.KEY_GEAR_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(SubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_BOOLEAN);
result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
} catch (JSONException e) {
fail(TestValues.JSON_FAIL);
@@ -160,6 +162,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getHandsOffSteering());
assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getWindowStatus());
assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getGearStatus());
+ assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getStabilityControlsStatus());
assertTrue(TestValues.MATCH,( (SubscribeVehicleData) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
@@ -198,6 +201,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getHandsOffSteering());
assertNull(TestValues.NULL, msg.getWindowStatus());
assertNull(TestValues.NULL, msg.getGearStatus());
+ assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
@@ -251,6 +255,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_WINDOW_STATUS), cmd.getWindowStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS), cmd.getStabilityControlsStatus());
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
fail(TestValues.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
index 747b61563..9ca309030 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
@@ -66,6 +66,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
msg.setGearStatus(TestValues.GENERAL_BOOLEAN);
msg.setHandsOffSteering(TestValues.GENERAL_BOOLEAN);
msg.setWindowStatus(TestValues.GENERAL_BOOLEAN);
+ msg.setStabilityControlsStatus(TestValues.GENERAL_BOOLEAN);
msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
return msg;
@@ -118,6 +119,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
result.put(UnsubscribeVehicleData.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_BOOLEAN);
result.put(UnsubscribeVehicleData.KEY_WINDOW_STATUS, TestValues.GENERAL_BOOLEAN);
result.put(UnsubscribeVehicleData.KEY_GEAR_STATUS, TestValues.GENERAL_BOOLEAN);
+ result.put(UnsubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_BOOLEAN);
result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_BOOLEAN);
} catch (JSONException e) {
fail(TestValues.JSON_FAIL);
@@ -164,6 +166,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getHandsOffSteering());
assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getWindowStatus());
assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getGearStatus());
+ assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getStabilityControlsStatus());
assertTrue(TestValues.TRUE,( (UnsubscribeVehicleData) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
@@ -202,6 +205,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getHandsOffSteering());
assertNull(TestValues.NULL, msg.getWindowStatus());
assertNull(TestValues.NULL, msg.getGearStatus());
+ assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
@@ -257,6 +261,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_HANDS_OFF_STEERING), cmd.getHandsOffSteering());
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_WINDOW_STATUS), cmd.getWindowStatus());
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_GEAR_STATUS), cmd.getGearStatus());
+ assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_STABILITY_CONTROLS_STATUS), cmd.getStabilityControlsStatus());
assertEquals(TestValues.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
index 6ebc03f80..818c9b4ce 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
@@ -17,6 +17,7 @@ import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.HeadLampStatus;
import com.smartdevicelink.proxy.rpc.MyKey;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
+import com.smartdevicelink.proxy.rpc.StabilityControlsStatus;
import com.smartdevicelink.proxy.rpc.TireStatus;
import com.smartdevicelink.proxy.rpc.WindowStatus;
import com.smartdevicelink.proxy.rpc.enums.TurnSignal;
@@ -100,10 +101,11 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
result.put(GetVehicleDataResponse.KEY_FUEL_RANGE, VehicleDataHelper.JSON_FUEL_RANGE);
result.put(GetVehicleDataResponse.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
result.put(GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
- result.put(GetVehicleDataResponse.KEY_WINDOW_STATUS, VehicleDataHelper.WINDOW_STATUS_LIST);
+ result.put(GetVehicleDataResponse.KEY_WINDOW_STATUS, VehicleDataHelper.WINDOW_STATUS_LIST);
result.put(GetVehicleDataResponse.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
result.put(GetVehicleDataResponse.KEY_GEAR_STATUS, VehicleDataHelper.GEAR_STATUS);
- result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
+ result.put(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, VehicleDataHelper.STABILITY_CONTROLS_STATUS);
+ result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
} catch(JSONException e){
fail(TestValues.JSON_FAIL);
}
@@ -127,6 +129,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
JSONObject emergencyEventObj = new JSONObject();
JSONObject clusterModeStatusObj = new JSONObject();
JSONObject myKeyObj = new JSONObject();
+ JSONObject stabilityControlsStatusObj = new JSONObject();
JSONObject fuelRangeObj = new JSONObject();
JSONObject windowStatusObj = new JSONObject();
JSONObject gearStatusObj = new JSONObject();
@@ -248,13 +251,21 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_QUALIFICATION_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_QUALIFICATION_STATUS);
clusterModeStatusObj.put(ClusterModeStatus.KEY_CAR_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_CAR_MODE_STATUS);
clusterModeStatusObj.put(ClusterModeStatus.KEY_POWER_MODE_STATUS, VehicleDataHelper.CLUSTER_MODE_STATUS_POWER_MODE_STATUS);
-
+
+ // STABILITY_CONTROL_STATUS
+ stabilityControlsStatusObj.put(StabilityControlsStatus.KEY_ESC_SYSTEM, VehicleDataHelper.ESC_SYSTEM);
+ stabilityControlsStatusObj.put(StabilityControlsStatus.KEY_TRAILER_SWAY_CONTROL, VehicleDataHelper.S_WAY_TRAILER);
+
//MY_KEY
myKeyObj.put(MyKey.KEY_E_911_OVERRIDE, VehicleDataHelper.MY_KEY_E_911_OVERRIDE);
// FUEL_RANGE
fuelRangeObj.put(FuelRange.KEY_TYPE, VehicleDataHelper.FUEL_RANGE_TYPE);
fuelRangeObj.put(FuelRange.KEY_RANGE, VehicleDataHelper.FUEL_RANGE_RANGE);
+ fuelRangeObj.put(FuelRange.KEY_CAPACITY, VehicleDataHelper.FUEL_RANGE_CAPACITY);
+ fuelRangeObj.put(FuelRange.KEY_CAPACITY_UNIT, VehicleDataHelper.FUEL_RANGE_CAPACITY_UNIT);
+ fuelRangeObj.put(FuelRange.KEY_LEVEL, VehicleDataHelper.FUEL_RANGE_LEVEL);
+ fuelRangeObj.put(FuelRange.KEY_LEVEL_STATE, VehicleDataHelper.FUEL_RANGE_LEVEL_STATE);
fuelRangeArrayObj.put(fuelRangeObj);
//GEAR_STATUS
@@ -299,6 +310,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
reference.put(GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
reference.put(GetVehicleDataResponse.KEY_WINDOW_STATUS, windowStatusArrayObj);
reference.put(GetVehicleDataResponse.KEY_HANDS_OFF_STEERING, VehicleDataHelper.HANDS_OFF_STEERING);
+ reference.put(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatusObj);
reference.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
JSONObject underTest = msg.serializeJSON();
@@ -425,6 +437,20 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
new GearStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference)),
new GearStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest))));
}
+ else if (key.equals(GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS)) {
+ JSONObject myKeyObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
+ JSONObject myKeyObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
+
+ StabilityControlsStatus status1 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjReference));
+ StabilityControlsStatus status2 = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(myKeyObjTest));
+
+ assertTrue("JSON value didn't match expected value for key \"" + key + "\".",
+ Validator.validateStabilityControlStatus(
+ status1,
+ status2
+ )
+ );
+ }
else if (key.equals(GetVehicleDataResponse.KEY_FUEL_RANGE)) {
JSONArray fuelRangeArrayObjReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
List<FuelRange> fuelRangeRefereceList = new ArrayList<FuelRange>();
@@ -514,6 +540,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
assertEquals(TestValues.MATCH, VehicleDataHelper.WINDOW_STATUS_LIST, ( (GetVehicleDataResponse) msg ).getWindowStatus());
assertEquals(TestValues.MATCH, VehicleDataHelper.GEAR_STATUS, ( (GetVehicleDataResponse) msg ).getGearStatus());
assertEquals(TestValues.MATCH, VehicleDataHelper.HANDS_OFF_STEERING, ( (GetVehicleDataResponse) msg ).getHandsOffSteering());
+ assertEquals(TestValues.MATCH, VehicleDataHelper.STABILITY_CONTROLS_STATUS, ( (GetVehicleDataResponse) msg ).getStabilityControlsStatus());
assertEquals(TestValues.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, ( (GetVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
@@ -550,6 +577,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
assertNull(TestValues.NULL, msg.getElectronicParkBrakeStatus());
assertNull(TestValues.NULL, msg.getGearStatus());
assertNull(TestValues.NULL, msg.getHandsOffSteering());
+ assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getWindowStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
@@ -656,6 +684,10 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_TURN_SIGNAL), cmd.getTurnSignal().toString());
assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus().toString());
assertEquals(TestValues.MATCH, JsonUtils.readStringFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
+
+ JSONObject stabilityControlStatusObj = JsonUtils.readJsonObjectFromJsonObject(parameters, GetVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS);
+ StabilityControlsStatus stabilityControlsStatus = new StabilityControlsStatus(JsonRPCMarshaller.deserializeJSONObject(stabilityControlStatusObj));
+ assertTrue(TestValues.TRUE, Validator.validateStabilityControlStatus(stabilityControlsStatus, cmd.getStabilityControlsStatus()));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
index 643935a02..79af1baa8 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
@@ -68,6 +68,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
msg.setGearStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()));
msg.setHandsOffSteering(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()));
msg.setWindowStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()));
+ msg.setStabilityControlsStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()));
msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
return msg;
@@ -122,6 +123,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_WINDOW_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_GEAR_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()).serializeJSON());
result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
@@ -169,6 +171,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult testHOffSteering = ( (SubscribeVehicleDataResponse) msg ).getHandsOffSteering();
VehicleDataResult testWindowStatus = ( (SubscribeVehicleDataResponse) msg ).getWindowStatus();
VehicleDataResult testGearStatus = ( (SubscribeVehicleDataResponse) msg ).getGearStatus();
+ VehicleDataResult testStabilityControlStatus = ( (SubscribeVehicleDataResponse) msg ).getStabilityControlsStatus();
VehicleDataResult testOEMCustomVehicleData = ( (SubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
@@ -203,6 +206,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
assertTrue(TestValues.TRUE, testHOffSteering.getDataType().equals(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING));
assertTrue(TestValues.TRUE, testGearStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_GEARSTATUS));
assertTrue(TestValues.TRUE, testWindowStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WINDOWSTATUS));
+ assertTrue(TestValues.TRUE, testStabilityControlStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS));
assertTrue(TestValues.TRUE, testOEMCustomVehicleData.getOEMCustomVehicleDataType().equals(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
@@ -241,6 +245,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getHandsOffSteering());
assertNull(TestValues.NULL, msg.getWindowStatus());
assertNull(TestValues.NULL, msg.getGearStatus());
+ assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
@@ -389,6 +394,10 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult referenceGearStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(gearStatus));
assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceGearStatus, cmd.getGearStatus()));
+ JSONObject stabilityControlStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS);
+ VehicleDataResult referenceStabilityControlStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(stabilityControlStatus));
+ assertTrue(TestValues.TRUE, Validator.validateStabilityControlStatus(referenceStabilityControlStatus, cmd.getStabilityControlsStatus()));
+
JSONObject oemCustomVehicleDataName = JsonUtils.readJsonObjectFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomVehicleDataName));
assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
index dc69b66ae..284090cd5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
@@ -70,6 +70,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
msg.setWindowStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()));
msg.setHandsOffSteering(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()));
msg.setGearStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()));
+ msg.setStabilityControlsStatus(TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()));
msg.setOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
return msg;
@@ -124,6 +125,8 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_GEAR_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_GEARSTATUS.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS.ordinal()).serializeJSON());
+ result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_HANDS_OFF_STEERING, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_WINDOW_STATUS, TestValues.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_WINDOWSTATUS.ordinal()).serializeJSON());
result.put(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
@@ -171,6 +174,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult testHOffSteering = ( (UnsubscribeVehicleDataResponse) msg ).getHandsOffSteering();
VehicleDataResult testGearStatus = ( (UnsubscribeVehicleDataResponse) msg ).getGearStatus();
VehicleDataResult testWindowStatus = ( (UnsubscribeVehicleDataResponse) msg ).getWindowStatus();
+ VehicleDataResult testStabilityControlStatus = ( (UnsubscribeVehicleDataResponse) msg ).getStabilityControlsStatus();
VehicleDataResult testOemCustomData = ( (UnsubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
@@ -204,6 +208,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
assertTrue(TestValues.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
assertTrue(TestValues.TRUE, testHOffSteering.getDataType().equals(VehicleDataType.VEHICLEDATA_HANDSOFFSTEERING));
assertTrue(TestValues.TRUE, testWindowStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_WINDOWSTATUS));
+ assertTrue(TestValues.TRUE, testStabilityControlStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_STABILITYCONTROLSSTATUS));
assertTrue(TestValues.TRUE, testOemCustomData.getOEMCustomVehicleDataType().equals(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
assertTrue(TestValues.TRUE, testGearStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_GEARSTATUS));
@@ -243,6 +248,8 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
assertNull(TestValues.NULL, msg.getGearStatus());
assertNull(TestValues.NULL, msg.getHandsOffSteering());
assertNull(TestValues.NULL, msg.getWindowStatus());
+ assertNull(TestValues.NULL, msg.getHandsOffSteering());
+ assertNull(TestValues.NULL, msg.getStabilityControlsStatus());
assertNull(TestValues.NULL, msg.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
@@ -394,6 +401,10 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
JSONObject oemCustomData = JsonUtils.readJsonObjectFromJsonObject(parameters, TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomData));
assertTrue(TestValues.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(TestValues.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
+
+ JSONObject stabilityControlsStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_STABILITY_CONTROLS_STATUS);
+ VehicleDataResult referenceStabilityControlStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(stabilityControlsStatus));
+ assertTrue(TestValues.TRUE, Validator.validateStabilityControlStatus(referenceStabilityControlStatus, cmd.getStabilityControlsStatus()));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
index e5e47f3a5..28b1520d2 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/AbstractPacketizerTests.java
@@ -5,8 +5,6 @@ import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.test.TestValues;
-import com.smartdevicelink.transport.BTTransportConfig;
-import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
import com.smartdevicelink.util.Version;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
index 736798d67..bf6f6a850 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamPacketizerTests.java
@@ -7,8 +7,6 @@ import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamPacketizer;
import com.smartdevicelink.test.TestValues;
-import com.smartdevicelink.transport.BTTransportConfig;
-import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
import junit.framework.TestCase;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java
index 561cc1ef7..05a579b72 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/StreamRPCPacketizerTests.java
@@ -3,12 +3,9 @@ package com.smartdevicelink.test.streaming;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.proxy.SdlProxyBase;
import com.smartdevicelink.streaming.IStreamListener;
import com.smartdevicelink.streaming.StreamRPCPacketizer;
import com.smartdevicelink.test.TestValues;
-import com.smartdevicelink.transport.BTTransportConfig;
-import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
import junit.framework.TestCase;
@@ -28,7 +25,7 @@ public class StreamRPCPacketizerTests extends TestCase {
/**
* This is a unit test for the following methods :
- * {@link com.smartdevicelink.streaming.StreamRPCPacketizer#StreamRPCPacketizer(SdlProxyBase, IStreamListener, InputStream, RPCRequest, SessionType, byte, byte, long, SdlSession)}
+ * {@link com.smartdevicelink.streaming.StreamRPCPacketizer#StreamRPCPacketizer(Object, IStreamListener, InputStream, RPCRequest, SessionType, byte, byte, long, SdlSession)}
*/
public void testConstructor () {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BTTransportConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BTTransportConfigTests.java
deleted file mode 100644
index edb932f62..000000000
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/transport/BTTransportConfigTests.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.smartdevicelink.test.transport;
-
-import com.smartdevicelink.test.TestValues;
-import com.smartdevicelink.transport.BTTransportConfig;
-import com.smartdevicelink.transport.enums.TransportType;
-
-import junit.framework.TestCase;
-
-/**
- * This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.transport.BtTransportConfig}
- */
-public class BTTransportConfigTests extends TestCase {
-
- /**
- * This is a unit test for the following methods :
- * {@link com.smartdevicelink.transport.BtTransportConfig#getTransportType()}
- * {@link com.smartdevicelink.transport.BtTransportConfig#setKeepSocketActive(boolean)}
- * {@link com.smartdevicelink.transport.BtTransportConfig#getKeepSocketActive}
- */
- public void testConfigs () {
-
- // Test Values
- boolean testBoolean = true;
- BTTransportConfig testConfig1 = new BTTransportConfig();
- BTTransportConfig testConfig2 = new BTTransportConfig(testBoolean);
-
- // Comparison Values
- TransportType expectedTransportType = TransportType.BLUETOOTH;
- boolean actualShareConnection = testConfig2.shareConnection();
- TransportType actualTransportType = testConfig1.getTransportType();
-
- // Valid Tests
- assertEquals(TestValues.MATCH, expectedTransportType, actualTransportType);
- assertTrue(TestValues.TRUE, actualShareConnection);
-
-
- testConfig1.setKeepSocketActive(true);
- assertTrue(TestValues.TRUE, testConfig1.getKeepSocketActive());
- testConfig1.setKeepSocketActive(false);
- assertFalse(TestValues.FALSE, testConfig1.getKeepSocketActive());
- }
-} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java
index 6f4f0231b..075f89a81 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/transport/MultiplexTransportTest.java
@@ -6,7 +6,6 @@ import android.os.Looper;
import android.os.Message;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import com.smartdevicelink.protocol.SdlPacket;
import org.junit.Before;
import org.junit.Test;
@@ -15,13 +14,11 @@ import org.junit.runner.RunWith;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
-import static junit.framework.TestCase.assertTrue;
@RunWith(AndroidJUnit4.class)
public class MultiplexTransportTest {
RouterServiceValidator rsvp;
- ITransportListener transportListener;
@Before
@@ -29,26 +26,7 @@ public class MultiplexTransportTest {
rsvp = new RouterServiceValidator(getInstrumentation().getTargetContext());
rsvp.setFlags(RouterServiceValidator.FLAG_DEBUG_NONE);
rsvp.validate();
-
- transportListener = new ITransportListener(){
-
- @Override
- public void onTransportPacketReceived(SdlPacket packet) {
- }
-
- @Override
- public void onTransportConnected() {
- }
-
- @Override
- public void onTransportDisconnected(String info) {
- }
- @Override
- public void onTransportError(String info, Exception e) {
- }
-
- };
}
// test for setting error state.
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
deleted file mode 100644
index 69180d255..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
- * 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.
- */
-
-package com.smartdevicelink.managers;
-
-import android.util.SparseArray;
-
-import com.smartdevicelink.protocol.enums.FunctionID;
-import com.smartdevicelink.proxy.IProxyListener;
-import com.smartdevicelink.proxy.RPCMessage;
-import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
-import com.smartdevicelink.proxy.callbacks.OnServiceNACKed;
-import com.smartdevicelink.proxy.rpc.AddCommandResponse;
-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;
-import com.smartdevicelink.proxy.rpc.CreateWindowResponse;
-import com.smartdevicelink.proxy.rpc.DeleteCommandResponse;
-import com.smartdevicelink.proxy.rpc.DeleteFileResponse;
-import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSetResponse;
-import com.smartdevicelink.proxy.rpc.DeleteSubMenuResponse;
-import com.smartdevicelink.proxy.rpc.DeleteWindowResponse;
-import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
-import com.smartdevicelink.proxy.rpc.DialNumberResponse;
-import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
-import com.smartdevicelink.proxy.rpc.GenericResponse;
-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;
-import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
-import com.smartdevicelink.proxy.rpc.ListFilesResponse;
-import com.smartdevicelink.proxy.rpc.OnAppInterfaceUnregistered;
-import com.smartdevicelink.proxy.rpc.OnAppServiceData;
-import com.smartdevicelink.proxy.rpc.OnAudioPassThru;
-import com.smartdevicelink.proxy.rpc.OnButtonEvent;
-import com.smartdevicelink.proxy.rpc.OnButtonPress;
-import com.smartdevicelink.proxy.rpc.OnCommand;
-import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
-import com.smartdevicelink.proxy.rpc.OnHMIStatus;
-import com.smartdevicelink.proxy.rpc.OnHashChange;
-import com.smartdevicelink.proxy.rpc.OnInteriorVehicleData;
-import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
-import com.smartdevicelink.proxy.rpc.OnLanguageChange;
-import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
-import com.smartdevicelink.proxy.rpc.OnRCStatus;
-import com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated;
-import com.smartdevicelink.proxy.rpc.OnSystemRequest;
-import com.smartdevicelink.proxy.rpc.OnTBTClientState;
-import com.smartdevicelink.proxy.rpc.OnTouchEvent;
-import com.smartdevicelink.proxy.rpc.OnVehicleData;
-import com.smartdevicelink.proxy.rpc.OnWayPointChange;
-import com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse;
-import com.smartdevicelink.proxy.rpc.PerformAudioPassThruResponse;
-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.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;
-import com.smartdevicelink.proxy.rpc.SendLocationResponse;
-import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
-import com.smartdevicelink.proxy.rpc.SetCloudAppPropertiesResponse;
-import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
-import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
-import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
-import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
-import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
-import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
-import com.smartdevicelink.proxy.rpc.ShowResponse;
-import com.smartdevicelink.proxy.rpc.SliderResponse;
-import com.smartdevicelink.proxy.rpc.SpeakResponse;
-import com.smartdevicelink.proxy.rpc.SubscribeButtonResponse;
-import com.smartdevicelink.proxy.rpc.SubscribeVehicleDataResponse;
-import com.smartdevicelink.proxy.rpc.SubscribeWayPointsResponse;
-import com.smartdevicelink.proxy.rpc.SystemRequestResponse;
-import com.smartdevicelink.proxy.rpc.UnpublishAppServiceResponse;
-import com.smartdevicelink.proxy.rpc.UnregisterAppInterfaceResponse;
-import com.smartdevicelink.proxy.rpc.UnsubscribeButtonResponse;
-import com.smartdevicelink.proxy.rpc.UnsubscribeVehicleDataResponse;
-import com.smartdevicelink.proxy.rpc.UnsubscribeWayPointsResponse;
-import com.smartdevicelink.proxy.rpc.UpdateTurnListResponse;
-import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
-
-import java.util.concurrent.CopyOnWriteArrayList;
-
-@Deprecated
-public class ProxyBridge implements IProxyListener{
- private final Object RPC_LISTENER_LOCK = new Object();
- private SparseArray<CopyOnWriteArrayList<OnRPCListener>> rpcListeners = null;
- private final LifecycleListener lifecycleListener;
-
- @Override
- public void onProxyOpened() {}
-
- @Override
- public void onRegisterAppInterfaceResponse(RegisterAppInterfaceResponse response) {
- onRPCReceived(response);
- if(response.getSuccess()){
- lifecycleListener.onProxyConnected();
- }
- }
-
- @Override
- public void onOnAppInterfaceUnregistered(OnAppInterfaceUnregistered notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onUnregisterAppInterfaceResponse(UnregisterAppInterfaceResponse response) {
- onRPCReceived(response);
- }
-
- protected interface LifecycleListener{
- void onProxyConnected();
- void onProxyClosed(String info, Exception e, SdlDisconnectedReason reason);
- void onServiceEnded(OnServiceEnded serviceEnded);
- void onServiceNACKed(OnServiceNACKed serviceNACKed);
- void onError(String info, Exception e);
- }
-
- public ProxyBridge( LifecycleListener lifecycleListener){
- this.lifecycleListener = lifecycleListener;
- rpcListeners = new SparseArray<>();
- }
-
- public boolean onRPCReceived(final RPCMessage message){
- synchronized(RPC_LISTENER_LOCK){
- final int id = FunctionID.getFunctionId(message.getFunctionName());
- CopyOnWriteArrayList<OnRPCListener> listeners = rpcListeners.get(id);
- if(listeners!=null && listeners.size()>0) {
- for (OnRPCListener listener : listeners) {
- listener.onReceived(message);
- }
- return true;
- }
- return false;
- }
- }
-
- protected void addRpcListener(FunctionID id, OnRPCListener listener){
- synchronized(RPC_LISTENER_LOCK){
- if (id != null && listener != null) {
- if (rpcListeners.indexOfKey(id.getId()) < 0) {
- rpcListeners.put(id.getId(), new CopyOnWriteArrayList<OnRPCListener>());
- }
- rpcListeners.get(id.getId()).add(listener);
- }
- }
- }
-
- public boolean removeOnRPCListener(FunctionID id, OnRPCListener listener){
- synchronized(RPC_LISTENER_LOCK){
- if(rpcListeners!= null
- && id != null
- && listener != null
- && rpcListeners.indexOfKey(id.getId()) >= 0){
- return rpcListeners.get(id.getId()).remove(listener);
- }
- }
- return false;
- }
-
- @Override
- public void onProxyClosed(String info, Exception e, SdlDisconnectedReason reason) {
- lifecycleListener.onProxyClosed(info,e,reason);
- }
-
- @Override
- public void onServiceEnded(OnServiceEnded serviceEnded) {
- lifecycleListener.onServiceEnded(serviceEnded);
-
- }
-
- @Override
- public void onServiceNACKed(OnServiceNACKed serviceNACKed) {
- lifecycleListener.onServiceNACKed(serviceNACKed);
-
- }
- @Override
- public void onError(String info, Exception e) {
- lifecycleListener.onError(info, e);
- }
-
-// @Override
-// public void onOnStreamRPC(OnStreamRPC notification) {
-// onRPCReceived(notification);
-//
-// }
-//
-// @Override
-// public void onStreamRPCResponse(StreamRPCResponse response) {
-// onRPCReceived(response);
-// }
-
- @Override
- public void onOnHMIStatus(OnHMIStatus notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onGenericResponse(GenericResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onOnCommand(OnCommand notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onAddCommandResponse(AddCommandResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onAddSubMenuResponse(AddSubMenuResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onCreateInteractionChoiceSetResponse(CreateInteractionChoiceSetResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onAlertResponse(AlertResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onDeleteCommandResponse(DeleteCommandResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onDeleteInteractionChoiceSetResponse(DeleteInteractionChoiceSetResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onDeleteSubMenuResponse(DeleteSubMenuResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onPerformInteractionResponse(PerformInteractionResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onResetGlobalPropertiesResponse(ResetGlobalPropertiesResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onSetGlobalPropertiesResponse(SetGlobalPropertiesResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onSetMediaClockTimerResponse(SetMediaClockTimerResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onShowResponse(ShowResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onSpeakResponse(SpeakResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onOnButtonEvent(OnButtonEvent notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onOnButtonPress(OnButtonPress notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onSubscribeButtonResponse(SubscribeButtonResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onUnsubscribeButtonResponse(UnsubscribeButtonResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onOnPermissionsChange(OnPermissionsChange notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onSubscribeVehicleDataResponse(SubscribeVehicleDataResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onUnsubscribeVehicleDataResponse(UnsubscribeVehicleDataResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onGetVehicleDataResponse(GetVehicleDataResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onOnVehicleData(OnVehicleData notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onPerformAudioPassThruResponse(PerformAudioPassThruResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onEndAudioPassThruResponse(EndAudioPassThruResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onOnAudioPassThru(OnAudioPassThru notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onPutFileResponse(PutFileResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onDeleteFileResponse(DeleteFileResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onListFilesResponse(ListFilesResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onSetAppIconResponse(SetAppIconResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onScrollableMessageResponse(ScrollableMessageResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onChangeRegistrationResponse(ChangeRegistrationResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onSetDisplayLayoutResponse(SetDisplayLayoutResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onOnLanguageChange(OnLanguageChange notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onOnHashChange(OnHashChange notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onSliderResponse(SliderResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onOnDriverDistraction(OnDriverDistraction notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onOnTBTClientState(OnTBTClientState notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onOnSystemRequest(OnSystemRequest notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onSystemRequestResponse(SystemRequestResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onOnKeyboardInput(OnKeyboardInput notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onOnTouchEvent(OnTouchEvent notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onDiagnosticMessageResponse(DiagnosticMessageResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onReadDIDResponse(ReadDIDResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onGetDTCsResponse(GetDTCsResponse response) {
- onRPCReceived(response);
-
- }
-
-// @Override
-// public void onOnLockScreenNotification(OnLockScreenStatus notification) {
-// onRPCReceived(notification);
-// }
-
- @Override
- public void onDialNumberResponse(DialNumberResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onSendLocationResponse(SendLocationResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onShowConstantTbtResponse(ShowConstantTbtResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onAlertManeuverResponse(AlertManeuverResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onUpdateTurnListResponse(UpdateTurnListResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onServiceDataACK(int dataSize) {
-
- }
-
- @Override
- public void onGetWayPointsResponse(GetWayPointsResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onSubscribeWayPointsResponse(SubscribeWayPointsResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onUnsubscribeWayPointsResponse(UnsubscribeWayPointsResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onOnWayPointChange(OnWayPointChange notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onGetSystemCapabilityResponse(GetSystemCapabilityResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onGetInteriorVehicleDataResponse(GetInteriorVehicleDataResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onCreateWindowResponse(CreateWindowResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onDeleteWindowResponse(DeleteWindowResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onButtonPressResponse(ButtonPressResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onSetInteriorVehicleDataResponse(SetInteriorVehicleDataResponse response) {
- onRPCReceived(response);
-
- }
-
- @Override
- public void onOnInteriorVehicleData(OnInteriorVehicleData notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onSendHapticDataResponse(SendHapticDataResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onOnRCStatus(OnRCStatus notification) {
- onRPCReceived(notification);
- }
-
- @Override
- public void onSetCloudAppProperties(SetCloudAppPropertiesResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onPublishAppServiceResponse(PublishAppServiceResponse response){
- onRPCReceived(response);
- }
-
- @Override
- public void onGetAppServiceDataResponse(GetAppServiceDataResponse response){
- onRPCReceived(response);
- }
-
- @Override
- public void onGetFileResponse(GetFileResponse response){
- onRPCReceived(response);
- }
-
- @Override
- public void onPerformAppServiceInteractionResponse(PerformAppServiceInteractionResponse response){
- onRPCReceived(response);
- }
-
- @Override
- public void onOnAppServiceData(OnAppServiceData notification){
- onRPCReceived(notification);
- }
-
- @Override
- public void onGetInteriorVehicleDataConsentResponse(GetInteriorVehicleDataConsentResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onReleaseInteriorVehicleDataModuleResponse(ReleaseInteriorVehicleDataModuleResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification){
- onRPCReceived(notification);
- }
-
- @Override
- public void onCloseApplicationResponse(CloseApplicationResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onCancelInteractionResponse(CancelInteractionResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onShowAppMenuResponse(ShowAppMenuResponse response) {
- onRPCReceived(response);
- }
-
- @Override
- public void onUnpublishAppServiceResponse(UnpublishAppServiceResponse response) {
- onRPCReceived(response);
- }
-}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
index b5a450c68..ed3f5f219 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
@@ -48,7 +48,6 @@ import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
import com.smartdevicelink.transport.TCPTransportConfig;
-import com.smartdevicelink.transport.USBTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.DebugTool;
@@ -76,22 +75,6 @@ public class LifecycleManager extends BaseLifecycleManager {
void initialize() {
super.initialize();
- //Handle legacy USB connections
- if (_transportConfig != null && TransportType.USB.equals(_transportConfig.getTransportType())) {
- //A USB transport config was provided
- USBTransportConfig usbTransportConfig = (USBTransportConfig) _transportConfig;
- if (usbTransportConfig.getUsbAccessory() == null) {
- DebugTool.logInfo(TAG,"Legacy USB transport config was used, but received null for accessory. Attempting to connect with router service");
- //The accessory was null which means it came from a router service
- MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(usbTransportConfig.getUSBContext(), appConfig.getAppID());
- multiplexTransportConfig.setRequiresHighBandwidth(true);
- multiplexTransportConfig.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
- multiplexTransportConfig.setPrimaryTransports(Collections.singletonList(TransportType.USB));
- multiplexTransportConfig.setSecondaryTransports(new ArrayList<TransportType>());
- _transportConfig = multiplexTransportConfig;
- }
- }
-
if (_transportConfig != null && _transportConfig.getTransportType().equals(TransportType.MULTIPLEX)) {
this.session = new SdlSession(sdlSessionListener, (MultiplexTransportConfig) _transportConfig);
} else if (_transportConfig != null && _transportConfig.getTransportType().equals(TransportType.TCP)) {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
index 82e9a5e01..3d05bc7cd 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
@@ -53,8 +53,8 @@ class TextAndGraphicManager extends BaseTextAndGraphicManager {
}
@Override
- SdlArtwork getBlankArtwork(){
- if (blankArtwork == null){
+ SdlArtwork getBlankArtwork() {
+ if (blankArtwork == null) {
blankArtwork = new SdlArtwork();
blankArtwork.setType(FileType.GRAPHIC_PNG);
blankArtwork.setName("blankArtwork");
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java
deleted file mode 100644
index 6cb19000e..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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;
-
-import android.graphics.Bitmap;
-
-import com.smartdevicelink.proxy.rpc.enums.HMILevel;
-import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus;
-import com.smartdevicelink.util.AndroidTools;
-
-import java.io.IOException;
-
-@Deprecated
-public class LockScreenManager {
-
- public interface OnLockScreenIconDownloadedListener{
- public void onLockScreenIconDownloaded(Bitmap icon);
- public void onLockScreenIconDownloadError(Exception e);
- }
-
- private Bitmap lockScreenIcon;
- private Boolean bUserSelected = false;
- private Boolean bDriverDistStatus = null;
- private HMILevel hmiLevel = null;
- @SuppressWarnings("unused")
- private int iSessionID;
-
- public synchronized void setSessionID(int iVal)
- {
- iSessionID = iVal;
- }
-
- private synchronized void setUserSelectedStatus(boolean bVal)
- {
- bUserSelected = bVal;
- }
-
- public synchronized void setDriverDistStatus(boolean bVal)
- {
- bDriverDistStatus = bVal;
- }
-
- public synchronized void setHMILevel(HMILevel hmiVal)
- {
- hmiLevel = hmiVal;
-
- if (hmiVal != null) {
- if ((hmiVal.equals(HMILevel.HMI_FULL)) || (hmiVal.equals(HMILevel.HMI_LIMITED)))
- setUserSelectedStatus(true);
- else if (hmiVal.equals(HMILevel.HMI_NONE))
- setUserSelectedStatus(false);
- }else{
- setUserSelectedStatus(false);
- }
- }
-
-// public synchronized OnLockScreenStatus getLockObj(/*int SessionID*/)
-// {
-// //int iSessionID = SessionID;
-// OnLockScreenStatus myLock = new OnLockScreenStatus();
-// myLock.setDriverDistractionStatus(bDriverDistStatus);
-// myLock.setHMILevel(hmiLevel);
-// myLock.setUserSelected(bUserSelected);
-// myLock.setShowLockScreen(getLockScreenStatus());
-//
-// return myLock;
-// }
-
- private synchronized LockScreenStatus getLockScreenStatus()
- {
-
- if ( (hmiLevel == null) || (hmiLevel.equals(HMILevel.HMI_NONE)) )
- {
- return LockScreenStatus.OFF;
- }
- else if ( hmiLevel.equals(HMILevel.HMI_BACKGROUND) )
- {
- if (bDriverDistStatus == null)
- {
- //we don't have driver distraction, lockscreen is entirely based on userselection
- if (bUserSelected)
- return LockScreenStatus.REQUIRED;
- else
- return LockScreenStatus.OFF;
- }
- else if (bDriverDistStatus && bUserSelected)
- {
- return LockScreenStatus.REQUIRED;
- }
- else if (!bDriverDistStatus && bUserSelected)
- {
- return LockScreenStatus.OPTIONAL;
- }
- else
- {
- return LockScreenStatus.OFF;
- }
- }
- else if ( (hmiLevel.equals(HMILevel.HMI_FULL)) || (hmiLevel.equals(HMILevel.HMI_LIMITED)) )
- {
- if ( (bDriverDistStatus != null) && (!bDriverDistStatus) )
- {
- return LockScreenStatus.OPTIONAL;
- }
- else
- return LockScreenStatus.REQUIRED;
- }
- return LockScreenStatus.OFF;
- }
-
- public void downloadLockScreenIcon(final String url, final OnLockScreenIconDownloadedListener l){
- new Thread(new Runnable(){
- @Override
- public void run(){
- try{
- lockScreenIcon = AndroidTools.downloadImage(url);
- if(l != null){
- l.onLockScreenIconDownloaded(lockScreenIcon);
- }
- }catch(IOException e){
- if(l != null){
- l.onLockScreenIconDownloadError(e);
- }
- }
- }
- }).start();
- }
-
- public Bitmap getLockScreenIcon(){
- return this.lockScreenIcon;
- }
-}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java
deleted file mode 100644
index 1d1216b40..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java
+++ /dev/null
@@ -1,1030 +0,0 @@
-/*
- * 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;
-
-import android.os.Build;
-
-import com.smartdevicelink.proxy.rpc.AddCommand;
-import com.smartdevicelink.proxy.rpc.AddSubMenu;
-import com.smartdevicelink.proxy.rpc.Alert;
-import com.smartdevicelink.proxy.rpc.ChangeRegistration;
-import com.smartdevicelink.proxy.rpc.Choice;
-import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSet;
-import com.smartdevicelink.proxy.rpc.DeleteCommand;
-import com.smartdevicelink.proxy.rpc.DeleteFile;
-import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
-import com.smartdevicelink.proxy.rpc.DeleteSubMenu;
-import com.smartdevicelink.proxy.rpc.DeviceInfo;
-import com.smartdevicelink.proxy.rpc.EndAudioPassThru;
-import com.smartdevicelink.proxy.rpc.GetVehicleData;
-import com.smartdevicelink.proxy.rpc.Image;
-import com.smartdevicelink.proxy.rpc.ListFiles;
-import com.smartdevicelink.proxy.rpc.MenuParams;
-import com.smartdevicelink.proxy.rpc.PerformAudioPassThru;
-import com.smartdevicelink.proxy.rpc.PerformInteraction;
-import com.smartdevicelink.proxy.rpc.PutFile;
-import com.smartdevicelink.proxy.rpc.RegisterAppInterface;
-import com.smartdevicelink.proxy.rpc.ScrollableMessage;
-import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
-import com.smartdevicelink.proxy.rpc.SetAppIcon;
-import com.smartdevicelink.proxy.rpc.SetDisplayLayout;
-import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
-import com.smartdevicelink.proxy.rpc.SetMediaClockTimer;
-import com.smartdevicelink.proxy.rpc.Show;
-import com.smartdevicelink.proxy.rpc.Slider;
-import com.smartdevicelink.proxy.rpc.SoftButton;
-import com.smartdevicelink.proxy.rpc.Speak;
-import com.smartdevicelink.proxy.rpc.StartTime;
-import com.smartdevicelink.proxy.rpc.SubscribeButton;
-import com.smartdevicelink.proxy.rpc.SubscribeVehicleData;
-import com.smartdevicelink.proxy.rpc.SystemRequest;
-import com.smartdevicelink.proxy.rpc.TTSChunk;
-import com.smartdevicelink.proxy.rpc.UnregisterAppInterface;
-import com.smartdevicelink.proxy.rpc.UnsubscribeButton;
-import com.smartdevicelink.proxy.rpc.UnsubscribeVehicleData;
-import com.smartdevicelink.proxy.rpc.VrHelpItem;
-import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
-import com.smartdevicelink.proxy.rpc.enums.AudioType;
-import com.smartdevicelink.proxy.rpc.enums.BitsPerSample;
-import com.smartdevicelink.proxy.rpc.enums.ButtonName;
-import com.smartdevicelink.proxy.rpc.enums.FileType;
-import com.smartdevicelink.proxy.rpc.enums.ImageType;
-import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
-import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.proxy.rpc.enums.RequestType;
-import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
-import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
-import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
-
-import java.util.Vector;
-
-/**
- * @deprecated Use RPC constructors directly instead
- */
-@Deprecated
-public class RPCRequestFactory {
-
- public static final int SDL_MSG_MAJOR_VERSION = 1;
- public static final int SDL_MSG_MINOR_VERSION = 0;
-
- public static SystemRequest buildSystemRequest(
- String data, Integer correlationID) {
-
- if(data == null) return null;
-
- SystemRequest msg = new SystemRequest();
- msg.setRequestType(RequestType.PROPRIETARY);
- msg.setCorrelationID(correlationID);
- msg.setBulkData(data.getBytes());
- return msg;
- }
-
- public static SystemRequest buildSystemRequestLegacy(
- Vector<String> data, Integer correlationID) {
-
- if(data == null) return null;
-
- SystemRequest msg = new SystemRequest(true);
- msg.setCorrelationID(correlationID);
- msg.setLegacyData(data);
- return msg;
- }
-
- public static AddCommand buildAddCommand(Integer commandID,
- String menuText, Integer parentID, Integer position,
- Vector<String> vrCommands, Image cmdIcon, Integer correlationID) {
- AddCommand msg = new AddCommand();
- msg.setCorrelationID(correlationID);
- msg.setCmdID(commandID);
- msg.setVrCommands(vrCommands);
-
- if (cmdIcon != null) msg.setCmdIcon(cmdIcon);
-
- if(menuText != null || parentID != null || position != null) {
- MenuParams menuParams = new MenuParams();
- menuParams.setMenuName(menuText);
- menuParams.setPosition(position);
- menuParams.setParentID(parentID);
- msg.setMenuParams(menuParams);
- }
-
- return msg;
- }
-
- public static AddCommand buildAddCommand(Integer commandID,
- String menuText, Integer parentID, Integer position,
- Vector<String> vrCommands, String IconValue, ImageType IconType,
- Integer correlationID) {
- AddCommand msg = new AddCommand();
- msg.setCorrelationID(correlationID);
- msg.setCmdID(commandID);
-
- if (vrCommands != null) msg.setVrCommands(vrCommands);
-
- Image cmdIcon = null;
-
- if (IconValue != null && IconType != null)
- {
- cmdIcon = new Image();
- cmdIcon.setValue(IconValue);
- cmdIcon.setImageType(IconType);
- }
-
- if (cmdIcon != null) msg.setCmdIcon(cmdIcon);
-
- if(menuText != null || parentID != null || position != null) {
- MenuParams menuParams = new MenuParams();
- menuParams.setMenuName(menuText);
- menuParams.setPosition(position);
- menuParams.setParentID(parentID);
- msg.setMenuParams(menuParams);
- }
-
- return msg;
- }
-
- public static AddCommand buildAddCommand(Integer commandID,
- String menuText, Integer parentID, Integer position,
- Vector<String> vrCommands, Integer correlationID) {
- AddCommand msg = new AddCommand();
- msg.setCorrelationID(correlationID);
- msg.setCmdID(commandID);
- msg.setVrCommands(vrCommands);
-
- if(menuText != null || parentID != null || position != null) {
- MenuParams menuParams = new MenuParams();
- menuParams.setMenuName(menuText);
- menuParams.setPosition(position);
- menuParams.setParentID(parentID);
- msg.setMenuParams(menuParams);
- }
-
- return msg;
- }
-
- public static AddCommand buildAddCommand(Integer commandID,
- String menuText, Vector<String> vrCommands, Integer correlationID) {
- AddCommand msg = buildAddCommand(commandID, menuText, null, null,
- vrCommands, correlationID);
- return msg;
- }
-
- public static AddCommand buildAddCommand(Integer commandID,
- Vector<String> vrCommands, Integer correlationID) {
- AddCommand msg = new AddCommand();
- msg.setCorrelationID(correlationID);
- msg.setCmdID(commandID);
- msg.setVrCommands(vrCommands);
-
- return msg;
- }
-
- public static AddSubMenu buildAddSubMenu(Integer menuID, String menuName,
- Integer correlationID) {
- AddSubMenu msg = buildAddSubMenu(menuID, menuName, null, correlationID);
- return msg;
- }
-
- public static AddSubMenu buildAddSubMenu(Integer menuID, String menuName,
- Integer position, Integer correlationID) {
- AddSubMenu msg = new AddSubMenu();
- msg.setCorrelationID(correlationID);
- msg.setMenuName(menuName);
- msg.setMenuID(menuID);
- msg.setPosition(position);
-
- return msg;
- }
-
- public static Alert buildAlert(String ttsText, Boolean playTone,
- Vector<SoftButton> softButtons, Integer correlationID) {
- Vector<TTSChunk> chunks = TTSChunkFactory
- .createSimpleTTSChunks(ttsText);
- Alert msg = buildAlert(chunks, null, null, null, playTone, null, softButtons,
- correlationID);
- return msg;
- }
-
- public static Alert buildAlert(String alertText1, String alertText2,
- String alertText3, Integer duration, Vector<SoftButton> softButtons,
- Integer correlationID) {
- Alert msg = buildAlert((Vector<TTSChunk>) null, alertText1, alertText2,
- alertText3, null, duration, softButtons, correlationID);
- return msg;
- }
-
- public static Alert buildAlert(String ttsText, String alertText1,
- String alertText2, String alertText3, Boolean playTone,
- Integer duration, Vector<SoftButton> softButtons, Integer correlationID) {
- Vector<TTSChunk> chunks = TTSChunkFactory
- .createSimpleTTSChunks(ttsText);
- Alert msg = buildAlert(chunks, alertText1, alertText2, alertText3,
- playTone, duration, softButtons, correlationID);
- return msg;
- }
-
- public static Alert buildAlert(Vector<TTSChunk> chunks, Boolean playTone,
- Vector<SoftButton> softButtons, Integer correlationID) {
- Alert msg = buildAlert(chunks, null, null, null, playTone, null, softButtons, correlationID);
- return msg;
- }
-
- public static Alert buildAlert(Vector<TTSChunk> ttsChunks,
- String alertText1, String alertText2, String alertText3,
- Boolean playTone, Integer duration, Vector<SoftButton> softButtons,
- Integer correlationID) {
- Alert msg = new Alert();
- msg.setCorrelationID(correlationID);
- msg.setAlertText1(alertText1);
- msg.setAlertText2(alertText2);
- msg.setAlertText3(alertText3);
- msg.setDuration(duration);
- msg.setPlayTone(playTone);
- msg.setTtsChunks(ttsChunks);
- msg.setSoftButtons(softButtons);
-
- return msg;
- }
-
- public static Alert buildAlert(String ttsText, Boolean playTone,
- Integer correlationID) {
- Vector<TTSChunk> chunks = TTSChunkFactory
- .createSimpleTTSChunks(ttsText);
- Alert msg = buildAlert(chunks, null, null, playTone, null,
- correlationID);
- return msg;
- }
-
- public static Alert buildAlert(String alertText1, String alertText2,
- Integer duration, Integer correlationID) {
- Alert msg = buildAlert((Vector<TTSChunk>) null, alertText1, alertText2,
- null, duration, correlationID);
- return msg;
- }
-
- public static Alert buildAlert(String ttsText, String alertText1,
- String alertText2, Boolean playTone, Integer duration,
- Integer correlationID) {
- Vector<TTSChunk> chunks = TTSChunkFactory
- .createSimpleTTSChunks(ttsText);
- Alert msg = buildAlert(chunks, alertText1, alertText2, playTone,
- duration, correlationID);
- return msg;
- }
-
- public static Alert buildAlert(Vector<TTSChunk> chunks, Boolean playTone,
- Integer correlationID) {
- Alert msg = buildAlert(chunks, null, null, playTone, null,
- correlationID);
- return msg;
- }
-
- public static Alert buildAlert(Vector<TTSChunk> ttsChunks,
- String alertText1, String alertText2, Boolean playTone,
- Integer duration, Integer correlationID) {
- Alert msg = new Alert();
- msg.setCorrelationID(correlationID);
- msg.setAlertText1(alertText1);
- msg.setAlertText2(alertText2);
- msg.setDuration(duration);
- msg.setPlayTone(playTone);
- msg.setTtsChunks(ttsChunks);
-
- return msg;
- }
-
- public static CreateInteractionChoiceSet buildCreateInteractionChoiceSet(
- Vector<Choice> choiceSet, Integer interactionChoiceSetID,
- Integer correlationID) {
- CreateInteractionChoiceSet msg = new CreateInteractionChoiceSet();
- msg.setChoiceSet(choiceSet);
- msg.setInteractionChoiceSetID(interactionChoiceSetID);
- msg.setCorrelationID(correlationID);
- return msg;
- }
-
- public static DeleteCommand buildDeleteCommand(Integer commandID,
- Integer correlationID) {
- DeleteCommand msg = new DeleteCommand();
- msg.setCmdID(commandID);
- msg.setCorrelationID(correlationID);
- return msg;
- }
-
- public static DeleteFile buildDeleteFile(String sdlFileName,
- Integer correlationID) {
- DeleteFile deleteFile = new DeleteFile();
- deleteFile.setCorrelationID(correlationID);
- deleteFile.setSdlFileName(sdlFileName);
- return deleteFile;
- }
-
- public static DeleteInteractionChoiceSet buildDeleteInteractionChoiceSet(
- Integer interactionChoiceSetID, Integer correlationID) {
- DeleteInteractionChoiceSet msg = new DeleteInteractionChoiceSet();
- msg.setInteractionChoiceSetID(interactionChoiceSetID);
- msg.setCorrelationID(correlationID);
-
- return msg;
- }
-
- public static DeleteSubMenu buildDeleteSubMenu(Integer menuID,
- Integer correlationID) {
- DeleteSubMenu msg = new DeleteSubMenu();
- msg.setCorrelationID(correlationID);
- msg.setMenuID(menuID);
-
- return msg;
- }
-
- public static ListFiles buildListFiles(Integer correlationID) {
- ListFiles listFiles = new ListFiles();
- listFiles.setCorrelationID(correlationID);
- return listFiles;
- }
-
- public static PerformInteraction buildPerformInteraction(
- Vector<TTSChunk> initChunks, String displayText,
- Vector<Integer> interactionChoiceSetIDList,
- Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks,
- InteractionMode interactionMode, Integer timeout,
- Vector<VrHelpItem> vrHelp, Integer correlationID) {
- PerformInteraction msg = new PerformInteraction();
- msg.setInitialPrompt(initChunks);
- msg.setInitialText(displayText);
- msg.setInteractionChoiceSetIDList(interactionChoiceSetIDList);
- msg.setInteractionMode(interactionMode);
- msg.setTimeout(timeout);
- msg.setHelpPrompt(helpChunks);
- msg.setTimeoutPrompt(timeoutChunks);
- msg.setVrHelp(vrHelp);
- msg.setCorrelationID(correlationID);
-
- return msg;
- }
-
- public static PerformInteraction buildPerformInteraction(
- String initPrompt, String displayText,
- Vector<Integer> interactionChoiceSetIDList,
- String helpPrompt, String timeoutPrompt,
- InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
- Integer correlationID) {
- Vector<TTSChunk> initChunks = TTSChunkFactory
- .createSimpleTTSChunks(initPrompt);
- Vector<TTSChunk> helpChunks = TTSChunkFactory
- .createSimpleTTSChunks(helpPrompt);
- Vector<TTSChunk> timeoutChunks = TTSChunkFactory
- .createSimpleTTSChunks(timeoutPrompt);
- return buildPerformInteraction(initChunks,
- displayText, interactionChoiceSetIDList, helpChunks,
- timeoutChunks, interactionMode, timeout, vrHelp, correlationID);
- }
-
- public static PerformInteraction buildPerformInteraction(
- String initPrompt, String displayText,
- Integer interactionChoiceSetID,
- String helpPrompt, String timeoutPrompt,
- InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
- Integer correlationID) {
- Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
- interactionChoiceSetIDs.add(interactionChoiceSetID);
-
- return buildPerformInteraction(
- initPrompt, displayText, interactionChoiceSetIDs,
- helpPrompt, timeoutPrompt, interactionMode,
- timeout, vrHelp, correlationID);
- }
-
- public static PerformInteraction buildPerformInteraction(String initPrompt,
- String displayText, Integer interactionChoiceSetID, Vector<VrHelpItem> vrHelp,
- Integer correlationID) {
-
- return buildPerformInteraction(initPrompt, displayText,
- interactionChoiceSetID, null, null,
- InteractionMode.BOTH, null, vrHelp, correlationID);
- }
-
- public static PerformInteraction buildPerformInteraction(
- Vector<TTSChunk> initChunks, String displayText,
- Vector<Integer> interactionChoiceSetIDList,
- Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks,
- InteractionMode interactionMode, Integer timeout,
- Integer correlationID) {
- PerformInteraction msg = new PerformInteraction();
- msg.setInitialPrompt(initChunks);
- msg.setInitialText(displayText);
- msg.setInteractionChoiceSetIDList(interactionChoiceSetIDList);
- msg.setInteractionMode(interactionMode);
- msg.setTimeout(timeout);
- msg.setHelpPrompt(helpChunks);
- msg.setTimeoutPrompt(timeoutChunks);
- msg.setCorrelationID(correlationID);
-
- return msg;
- }
-
- public static PerformInteraction buildPerformInteraction(
- String initPrompt, String displayText,
- Vector<Integer> interactionChoiceSetIDList,
- String helpPrompt, String timeoutPrompt,
- InteractionMode interactionMode, Integer timeout,
- Integer correlationID) {
- Vector<TTSChunk> initChunks = TTSChunkFactory
- .createSimpleTTSChunks(initPrompt);
- Vector<TTSChunk> helpChunks = TTSChunkFactory
- .createSimpleTTSChunks(helpPrompt);
- Vector<TTSChunk> timeoutChunks = TTSChunkFactory
- .createSimpleTTSChunks(timeoutPrompt);
- return buildPerformInteraction(initChunks,
- displayText, interactionChoiceSetIDList, helpChunks,
- timeoutChunks, interactionMode, timeout, correlationID);
- }
-
- public static PerformInteraction buildPerformInteraction(
- String initPrompt, String displayText,
- Integer interactionChoiceSetID,
- String helpPrompt, String timeoutPrompt,
- InteractionMode interactionMode, Integer timeout,
- Integer correlationID) {
- Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
- interactionChoiceSetIDs.add(interactionChoiceSetID);
-
- return buildPerformInteraction(
- initPrompt, displayText, interactionChoiceSetIDs,
- helpPrompt, timeoutPrompt, interactionMode,
- timeout, correlationID);
- }
-
- public static PerformInteraction buildPerformInteraction(String initPrompt,
- String displayText, Integer interactionChoiceSetID,
- Integer correlationID) {
-
- return buildPerformInteraction(initPrompt, displayText,
- interactionChoiceSetID, null, null,
- InteractionMode.BOTH, null, correlationID);
- }
-
- @Deprecated
- public static PerformInteraction buildPerformInteraction(
- Vector<TTSChunk> initChunks, String displayText,
- Vector<Integer> interactionChoiceSetIDList,
- Vector<TTSChunk> helpChunks, InteractionMode interactionMode,
- Integer timeout, Integer correlationID) {
- PerformInteraction msg = new PerformInteraction();
- msg.setInitialPrompt(initChunks);
- msg.setInitialText(displayText);
- msg.setInteractionChoiceSetIDList(interactionChoiceSetIDList);
- msg.setInteractionMode(interactionMode);
- msg.setTimeout(timeout);
- msg.setHelpPrompt(helpChunks);
- msg.setCorrelationID(correlationID);
- return msg;
- }
-
- @Deprecated
- public static PerformInteraction buildPerformInteraction(String initPrompt,
- String displayText, Vector<Integer> interactionChoiceSetIDList,
- String helpPrompt, InteractionMode interactionMode,
- Integer timeout, Integer correlationID) {
- Vector<TTSChunk> initChunks = TTSChunkFactory
- .createSimpleTTSChunks(initPrompt);
- Vector<TTSChunk> helpChunks = TTSChunkFactory
- .createSimpleTTSChunks(helpPrompt);
- PerformInteraction msg = buildPerformInteraction(initChunks,
- displayText, interactionChoiceSetIDList, helpChunks,
- interactionMode, timeout, correlationID);
- return msg;
- }
-
- public static PutFile buildPutFile(String sdlFileName, FileType fileType,
- Boolean persistentFile, byte[] fileData, Integer correlationID) {
- PutFile putFile = new PutFile();
- putFile.setCorrelationID(correlationID);
- putFile.setSdlFileName(sdlFileName);
- putFile.setFileType(fileType);
- putFile.setPersistentFile(persistentFile);
- putFile.setBulkData(fileData);
- putFile.setCRC(fileData);
- return putFile;
- }
-
- @Deprecated
- public static PutFile buildPutFile(String sdlFileName, Integer iOffset, Integer iLength) {
- PutFile putFile = new PutFile();
- putFile.setCorrelationID(10000);
- putFile.setSdlFileName(sdlFileName);
- putFile.setFileType(FileType.BINARY);
- putFile.setSystemFile(true);
- putFile.setOffset(iOffset);
- putFile.setLength(iLength);
- return putFile;
- }
-
- public static PutFile buildPutFile(String sdlFileName, Long iOffset, Long iLength) {
- PutFile putFile = new PutFile();
- putFile.setCorrelationID(10000);
- putFile.setSdlFileName(sdlFileName);
- putFile.setFileType(FileType.BINARY);
- putFile.setSystemFile(true);
- putFile.setOffset(iOffset);
- putFile.setLength(iLength);
- return putFile;
- }
-
- @Deprecated
- public static PutFile buildPutFile(String syncFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) {
- PutFile putFile = new PutFile();
- putFile.setCorrelationID(10000);
- putFile.setSdlFileName(syncFileName);
- putFile.setFileType(fileType);
- putFile.setPersistentFile(bPersistentFile);
- putFile.setSystemFile(bSystemFile);
- putFile.setOffset(iOffset);
- putFile.setLength(iLength);
- return putFile;
- }
-
- public static PutFile buildPutFile(String syncFileName, Long iOffset, Long iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) {
- PutFile putFile = new PutFile();
- putFile.setCorrelationID(10000);
- putFile.setSdlFileName(syncFileName);
- putFile.setFileType(fileType);
- putFile.setPersistentFile(bPersistentFile);
- putFile.setSystemFile(bSystemFile);
- putFile.setOffset(iOffset);
- putFile.setLength(iLength);
- return putFile;
- }
-
- @Deprecated
- public static PutFile buildPutFile(String sdlFileName, Integer iOffset, Integer iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) {
- PutFile putFile = new PutFile();
- putFile.setCorrelationID(iCorrelationID);
- putFile.setSdlFileName(sdlFileName);
- putFile.setFileType(fileType);
- putFile.setPersistentFile(bPersistentFile);
- putFile.setSystemFile(bSystemFile);
- putFile.setOffset(iOffset);
- putFile.setLength(iLength);
- return putFile;
- }
-
- public static PutFile buildPutFile(String sdlFileName, Long iOffset, Long iLength, FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Boolean isPayloadProtected, Integer iCorrelationID) {
- PutFile putFile = new PutFile();
- putFile.setCorrelationID(iCorrelationID);
- putFile.setSdlFileName(sdlFileName);
- putFile.setFileType(fileType);
- putFile.setPersistentFile(bPersistentFile);
- putFile.setSystemFile(bSystemFile);
- putFile.setOffset(iOffset);
- putFile.setLength(iLength);
- putFile.setPayloadProtected(isPayloadProtected);
- return putFile;
- }
-
- public static RegisterAppInterface buildRegisterAppInterface(String appName, String appID) {
- return buildRegisterAppInterface(appName, false, appID);
- }
-
- public static RegisterAppInterface buildRegisterAppInterface(
- String appName, Boolean isMediaApp, String appID) {
-
- return buildRegisterAppInterface(null, appName, null, null, null, isMediaApp,
- null, null, null, appID, null, null);
- }
-
- public static RegisterAppInterface buildRegisterAppInterface(
- SdlMsgVersion sdlMsgVersion, String appName, Vector<TTSChunk> ttsName,
- String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, Integer correlationID, DeviceInfo deviceInfo) {
- RegisterAppInterface msg = new RegisterAppInterface();
-
- if (correlationID == null) {
- correlationID = 1;
- }
- msg.setCorrelationID(correlationID);
-
- if (sdlMsgVersion == null) {
- sdlMsgVersion = new SdlMsgVersion();
- sdlMsgVersion.setMajorVersion(Integer.valueOf(SDL_MSG_MAJOR_VERSION));
- sdlMsgVersion.setMinorVersion(Integer.valueOf(SDL_MSG_MINOR_VERSION));
- }
- msg.setSdlMsgVersion(sdlMsgVersion);
- msg.setDeviceInfo(deviceInfo);
- msg.setAppName(appName);
-
- msg.setTtsName(ttsName);
-
- if (ngnMediaScreenAppName == null) {
- ngnMediaScreenAppName = appName;
- }
-
- msg.setNgnMediaScreenAppName(ngnMediaScreenAppName);
-
- if (vrSynonyms == null) {
- vrSynonyms = new Vector<String>();
- vrSynonyms.add(appName);
- }
- msg.setVrSynonyms(vrSynonyms);
-
- msg.setIsMediaApplication(isMediaApp);
-
- if (languageDesired == null) {
- languageDesired = Language.EN_US;
- }
- msg.setLanguageDesired(languageDesired);
-
- if (hmiDisplayLanguageDesired == null) {
- hmiDisplayLanguageDesired = Language.EN_US;
- }
-
- msg.setHmiDisplayLanguageDesired(hmiDisplayLanguageDesired);
-
- msg.setAppHMIType(appType);
-
- msg.setAppID(appID);
-
- return msg;
- }
-
- public static SetAppIcon buildSetAppIcon(String sdlFileName,
- Integer correlationID) {
- SetAppIcon setAppIcon = new SetAppIcon();
- setAppIcon.setCorrelationID(correlationID);
- setAppIcon.setSdlFileName(sdlFileName);
- return setAppIcon;
- }
-
- public static SetGlobalProperties buildSetGlobalProperties(
- String helpPrompt, String timeoutPrompt, Integer correlationID) {
- return buildSetGlobalProperties(TTSChunkFactory
- .createSimpleTTSChunks(helpPrompt), TTSChunkFactory
- .createSimpleTTSChunks(timeoutPrompt), correlationID);
- }
-
- public static SetGlobalProperties buildSetGlobalProperties(
- Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks,
- Integer correlationID) {
- SetGlobalProperties req = new SetGlobalProperties();
- req.setCorrelationID(correlationID);
-
- req.setHelpPrompt(helpChunks);
- req.setTimeoutPrompt(timeoutChunks);
-
- return req;
- }
-
- public static SetGlobalProperties buildSetGlobalProperties(
- String helpPrompt, String timeoutPrompt, String vrHelpTitle,
- Vector<VrHelpItem> vrHelp, Integer correlationID) {
- return buildSetGlobalProperties(TTSChunkFactory
- .createSimpleTTSChunks(helpPrompt), TTSChunkFactory
- .createSimpleTTSChunks(timeoutPrompt), vrHelpTitle, vrHelp, correlationID);
- }
-
- public static SetGlobalProperties buildSetGlobalProperties(
- Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks,
- String vrHelpTitle, Vector<VrHelpItem> vrHelp,
- Integer correlationID) {
- SetGlobalProperties req = new SetGlobalProperties();
- req.setCorrelationID(correlationID);
-
- req.setHelpPrompt(helpChunks);
- req.setTimeoutPrompt(timeoutChunks);
-
- req.setVrHelpTitle(vrHelpTitle);
- req.setVrHelp(vrHelp);
-
- return req;
- }
-
- public static SetMediaClockTimer buildSetMediaClockTimer(Integer hours,
- Integer minutes, Integer seconds, UpdateMode updateMode,
- Integer correlationID) {
-
- SetMediaClockTimer msg = new SetMediaClockTimer();
- if (hours != null || minutes != null || seconds != null) {
- StartTime startTime = new StartTime();
- msg.setStartTime(startTime);
- startTime.setHours(hours);
- startTime.setMinutes(minutes);
- startTime.setSeconds(seconds);
- }
-
- msg.setUpdateMode(updateMode);
- msg.setCorrelationID(correlationID);
-
- return msg;
- }
-
- @Deprecated
- public static SetMediaClockTimer buildSetMediaClockTimer(
- UpdateMode updateMode, Integer correlationID) {
- Integer hours = null;
- Integer minutes = null;
- Integer seconds = null;
-
- SetMediaClockTimer msg = buildSetMediaClockTimer(hours, minutes,
- seconds, updateMode, correlationID);
- return msg;
- }
-
- @SuppressWarnings("deprecation")
- public static Show buildShow(String mainText1, String mainText2,
- String mainText3, String mainText4,
- String statusBar, String mediaClock, String mediaTrack,
- Image graphic, Vector<SoftButton> softButtons, Vector <String> customPresets,
- TextAlignment alignment, Integer correlationID) {
- Show msg = new Show();
- msg.setCorrelationID(correlationID);
- msg.setMainField1(mainText1);
- msg.setMainField2(mainText2);
- msg.setStatusBar(statusBar);
- msg.setMediaClock(mediaClock);
- msg.setMediaTrack(mediaTrack);
- msg.setAlignment(alignment);
- msg.setMainField3(mainText3);
- msg.setMainField4(mainText4);
- msg.setGraphic(graphic);
- msg.setSoftButtons(softButtons);
- msg.setCustomPresets(customPresets);
-
- return msg;
- }
-
- public static Show buildShow(String mainText1, String mainText2, String mainText3, String mainText4,
- TextAlignment alignment, Integer correlationID) {
- Show msg = buildShow(mainText1, mainText2, mainText3, mainText4, null, null, null, null, null, null, alignment,
- correlationID);
- return msg;
- }
-
- @SuppressWarnings("deprecation")
- public static Show buildShow(String mainText1, String mainText2,
- String statusBar, String mediaClock, String mediaTrack,
- TextAlignment alignment, Integer correlationID) {
- Show msg = new Show();
- msg.setCorrelationID(correlationID);
- msg.setMainField1(mainText1);
- msg.setMainField2(mainText2);
- msg.setStatusBar(statusBar);
- msg.setMediaClock(mediaClock);
- msg.setMediaTrack(mediaTrack);
- msg.setAlignment(alignment);
-
- return msg;
- }
-
- public static Show buildShow(String mainText1, String mainText2,
- TextAlignment alignment, Integer correlationID) {
- Show msg = buildShow(mainText1, mainText2, null, null, null, alignment,
- correlationID);
- return msg;
- }
-
- public static Speak buildSpeak(String ttsText, Integer correlationID) {
- Speak msg = buildSpeak(TTSChunkFactory.createSimpleTTSChunks(ttsText),
- correlationID);
- return msg;
- }
-
- public static Speak buildSpeak(Vector<TTSChunk> ttsChunks,
- Integer correlationID) {
-
- Speak msg = new Speak();
- msg.setCorrelationID(correlationID);
-
- msg.setTtsChunks(ttsChunks);
-
- return msg;
- }
-
- public static SubscribeButton buildSubscribeButton(ButtonName buttonName,
- Integer correlationID) {
-
- SubscribeButton msg = new SubscribeButton();
- msg.setCorrelationID(correlationID);
- msg.setButtonName(buttonName);
-
- return msg;
- }
-
- public static UnregisterAppInterface buildUnregisterAppInterface(
- Integer correlationID) {
- UnregisterAppInterface msg = new UnregisterAppInterface();
- msg.setCorrelationID(correlationID);
-
- return msg;
- }
-
- public static UnsubscribeButton buildUnsubscribeButton(
- ButtonName buttonName, Integer correlationID) {
-
- UnsubscribeButton msg = new UnsubscribeButton();
- msg.setCorrelationID(correlationID);
- msg.setButtonName(buttonName);
-
- return msg;
- }
-
- @SuppressWarnings("deprecation")
- public static SubscribeVehicleData BuildSubscribeVehicleData(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure,
- boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID)
- {
- SubscribeVehicleData msg = new SubscribeVehicleData();
- msg.setGps(gps);
- msg.setSpeed(speed);
- msg.setRpm(rpm);
- msg.setFuelLevel(fuelLevel);
- msg.setFuelLevelState(fuelLevel_State);
- msg.setInstantFuelConsumption(instantFuelConsumption);
- msg.setExternalTemperature(externalTemperature);
- msg.setPrndl(prndl);
- msg.setTirePressure(tirePressure);
- msg.setOdometer(odometer);
- msg.setBeltStatus(beltStatus);
- msg.setBodyInformation(bodyInformation);
- msg.setDeviceStatus(deviceStatus);
- msg.setDriverBraking(driverBraking);
- msg.setCorrelationID(correlationID);
-
- return msg;
- }
-
- @SuppressWarnings("deprecation")
- public static UnsubscribeVehicleData BuildUnsubscribeVehicleData(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure,
- boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID)
- {
- UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
- msg.setGps(gps);
- msg.setSpeed(speed);
- msg.setRpm(rpm);
- msg.setFuelLevel(fuelLevel);
- msg.setFuelLevelState(fuelLevel_State);
- msg.setInstantFuelConsumption(instantFuelConsumption);
- msg.setExternalTemperature(externalTemperature);
- msg.setPrndl(prndl);
- msg.setTirePressure(tirePressure);
- msg.setOdometer(odometer);
- msg.setBeltStatus(beltStatus);
- msg.setBodyInformation(bodyInformation);
- msg.setDeviceStatus(deviceStatus);
- msg.setDriverBraking(driverBraking);
- msg.setCorrelationID(correlationID);
-
- return msg;
- }
-
- @SuppressWarnings("deprecation")
- public static GetVehicleData BuildGetVehicleData(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean vin, boolean prndl, boolean tirePressure,
- boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID)
- {
- GetVehicleData msg = new GetVehicleData();
- msg.setGps(gps);
- msg.setSpeed(speed);
- msg.setRpm(rpm);
- msg.setFuelLevel(fuelLevel);
- msg.setFuelLevelState(fuelLevel_State);
- msg.setInstantFuelConsumption(instantFuelConsumption);
- msg.setExternalTemperature(externalTemperature);
- msg.setVin(vin);
- msg.setPrndl(prndl);
- msg.setTirePressure(tirePressure);
- msg.setOdometer(odometer);
- msg.setBeltStatus(beltStatus);
- msg.setBodyInformation(bodyInformation);
- msg.setDeviceStatus(deviceStatus);
- msg.setDriverBraking(driverBraking);
- msg.setCorrelationID(correlationID);
-
- return msg;
- }
-
- public static ScrollableMessage BuildScrollableMessage(String scrollableMessageBody, Integer timeout, Vector<SoftButton> softButtons, Integer correlationID)
- {
- ScrollableMessage msg = new ScrollableMessage();
- msg.setCorrelationID(correlationID);
- msg.setScrollableMessageBody(scrollableMessageBody);
- msg.setTimeout(timeout);
- msg.setSoftButtons(softButtons);
-
- return msg;
- }
-
- public static Slider BuildSlider(Integer numTicks, Integer position, String sliderHeader, Vector<String> sliderFooter, Integer timeout, Integer correlationID)
- {
- Slider msg = new Slider();
- msg.setCorrelationID(correlationID);
- msg.setNumTicks(numTicks);
- msg.setPosition(position);
- msg.setSliderHeader(sliderHeader);
- msg.setSliderFooter(sliderFooter);
- msg.setTimeout(timeout);
-
- return msg;
- }
-
- public static ChangeRegistration BuildChangeRegistration(Language language, Language hmiDisplayLanguage, Integer correlationID)
- {
- ChangeRegistration msg = new ChangeRegistration();
- msg.setCorrelationID(correlationID);
- msg.setLanguage(language);
- msg.setHmiDisplayLanguage(hmiDisplayLanguage);
-
- return msg;
- }
-
- public static SetDisplayLayout BuildSetDisplayLayout(String displayLayout, Integer correlationID)
- {
- SetDisplayLayout msg = new SetDisplayLayout();
- msg.setCorrelationID(correlationID);
- msg.setDisplayLayout(displayLayout);
-
- return msg;
- }
-
- public static PerformAudioPassThru BuildPerformAudioPassThru(String ttsText, String audioPassThruDisplayText1, String audioPassThruDisplayText2,
- SamplingRate samplingRate, Integer maxDuration, BitsPerSample bitsPerSample,
- AudioType audioType, Boolean muteAudio, Integer correlationID)
- {
- Vector<TTSChunk> chunks = TTSChunkFactory
- .createSimpleTTSChunks(ttsText);
-
- PerformAudioPassThru msg = BuildPerformAudioPassThru(chunks, audioPassThruDisplayText1, audioPassThruDisplayText2,
- samplingRate, maxDuration, bitsPerSample,audioType, muteAudio, correlationID);
-
- return msg;
- }
-
- public static PerformAudioPassThru BuildPerformAudioPassThru(Vector<TTSChunk> initialPrompt, String audioPassThruDisplayText1, String audioPassThruDisplayText2,
- SamplingRate samplingRate, Integer maxDuration, BitsPerSample bitsPerSample,
- AudioType audioType, Boolean muteAudio, Integer correlationID)
- {
- PerformAudioPassThru msg = new PerformAudioPassThru();
- msg.setCorrelationID(correlationID);
- msg.setInitialPrompt(initialPrompt);
- msg.setAudioPassThruDisplayText1(audioPassThruDisplayText1);
- msg.setAudioPassThruDisplayText2(audioPassThruDisplayText2);
- msg.setSamplingRate(samplingRate);
- msg.setMaxDuration(maxDuration);
- msg.setBitsPerSample(bitsPerSample);
- msg.setAudioType(audioType);
- msg.setMuteAudio(muteAudio);
-
- return msg;
- }
-
- public static EndAudioPassThru BuildEndAudioPassThru(Integer correlationID)
- {
- EndAudioPassThru msg = new EndAudioPassThru();
- msg.setCorrelationID(correlationID);
-
- return msg;
- }
-
- public static DeviceInfo BuildDeviceInfo(String carrierName)
- {
- DeviceInfo msg = new DeviceInfo();
- msg.setHardware(android.os.Build.MODEL);
- msg.setOs("Android");
- msg.setOsVersion(Build.VERSION.RELEASE);
- msg.setCarrier(carrierName);
- return msg;
- }
-}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStreamController.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStreamController.java
deleted file mode 100644
index 28f1989e1..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStreamController.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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;
-
-import com.smartdevicelink.streaming.StreamRPCPacketizer;
-
-@Deprecated
-public class RPCStreamController {
- private StreamRPCPacketizer rpcPacketizer;
- private Integer iCorrelationID;
-
- public RPCStreamController(StreamRPCPacketizer rpcPacketizer, Integer iCorrelationID)
- {
- this.rpcPacketizer = rpcPacketizer;
- this.iCorrelationID = iCorrelationID;
- }
-
- public Integer getCorrelationID()
- {
- return iCorrelationID;
- }
-
- public void pause()
- {
- rpcPacketizer.pause();
- }
- public void resume()
- {
- rpcPacketizer.resume();
- }
- public void stop()
- {
- rpcPacketizer.onPutFileStreamError(null, "Stop Putfile Stream Requested");
- }
-}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
deleted file mode 100644
index 066c78b37..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
+++ /dev/null
@@ -1,2074 +0,0 @@
-/*
- * 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;
-
-import android.app.Service;
-import android.content.Context;
-
-import com.smartdevicelink.BuildConfig;
-import com.smartdevicelink.exception.SdlException;
-import com.smartdevicelink.exception.SdlExceptionCause;
-import com.smartdevicelink.proxy.interfaces.IProxyListenerALM;
-import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
-import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
-import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
-import com.smartdevicelink.proxy.rpc.HMICapabilities;
-import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
-import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
-import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
-import com.smartdevicelink.proxy.rpc.TTSChunk;
-import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
-import com.smartdevicelink.proxy.rpc.VehicleType;
-import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
-import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
-import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech;
-import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
-import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
-import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
-import com.smartdevicelink.trace.SdlTrace;
-import com.smartdevicelink.transport.BTTransportConfig;
-import com.smartdevicelink.transport.BaseTransportConfig;
-import com.smartdevicelink.transport.MultiplexTransportConfig;
-import com.smartdevicelink.transport.enums.TransportType;
-
-import java.util.List;
-import java.util.Vector;
-
-import static com.smartdevicelink.managers.lifecycle.SystemCapabilityManager.convertToList;
-
-/**
- * @deprecated use {@link com.smartdevicelink.managers.SdlManager} instead.
- *
- * The guide created for the initial transition of SdlProxyBase/ALM to SdlManager can be found at
- * <a href="https://smartdevicelink.com/en/guides/android/migrating-to-newer-sdl-versions/updating-to-v47/">Migrating to SDL Manager</a>
- */
-@Deprecated
-public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
-
- private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
- @SuppressWarnings("unused")
- private static final String SDL_LIB_PRIVATE_TOKEN = "{DAE1A88C-6C16-4768-ACA5-6F1247EA01C2}";
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL
- *
- * Takes advantage of the advanced lifecycle management.
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param isMediaApp - Indicates if the app is a media application.
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- /*ngn media app*/null,
- /*vr synonyms*/null,
- /*is media app*/isMediaApp,
- /*sdlMsgVersion*/null,
- /*language desired*/languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ false,
- new BTTransportConfig());
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL
- *
- * Takes advantage of the advanced lifecycle management.
- * @param context - Used to create a multiplexing transport config
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param isMediaApp - Indicates if the app is a media application.
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, Boolean isMediaApp,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- /*ngn media app*/null,
- /*vr synonyms*/null,
- /*is media app*/isMediaApp,
- /*sdlMsgVersion*/null,
- /*language desired*/languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ false,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, appName, and isMediaApp.", SDL_LIB_TRACE_KEY);
- }
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp - Indicates if the app is a media application.
- * @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired - Indicates the language desired for the SDL interface.
- * @param autoActivateID - ID used to re-register previously registered application.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- /*callbackToUIThread*/ false,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, appName, ngnMediaScreenAppName, " +
- "vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
- }
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param context - Used to create a multiplexing transport config
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp - Indicates if the app is a media application.
- * @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired - Indicates the language desired for the SDL interface.
- * @param autoActivateID - ID used to re-register previously registered application.
- * @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- /*callbackToUIThread*/ false,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, appName, ngnMediaScreenAppName, " +
- "vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
- }
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp - Indicates if the app is a media application.
- * @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired - Indicates the language desired for the SDL interface.
- * @param autoActivateID - ID used to re-register previously registered application.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms,
- Boolean isMediaApp, SdlMsgVersion sdlMsgVersion, Language languageDesired,
- Language hmiDisplayLanguageDesired, String appID, String autoActivateID) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- /*callbackToUIThread*/ false,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
- }
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param context - Used to create a multiplexing transport config
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp - Indicates if the app is a media application.
- * @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired - Indicates the language desired for the SDL interface.
- * @param autoActivateID - ID used to re-register previously registered application.
- * @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms,
- Boolean isMediaApp, SdlMsgVersion sdlMsgVersion, Language languageDesired,
- Language hmiDisplayLanguageDesired, String appID, String autoActivateID) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- /*callbackToUIThread*/ false,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
- }
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp - Indicates if the app is a media application.
- * @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired - Indicates the language desired for the SDL interface.
- * @param autoActivateID - ID used to re-register previously registered application.
- * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID, boolean callbackToUIThread) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "and callbackToUIThread", SDL_LIB_TRACE_KEY);
- }
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param context - Used to create a multiplexing transport config
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp - Indicates if the app is a media application.
- * @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired - Indicates the language desired for the SDL interface.
- * @param autoActivateID - ID used to re-register previously registered application.
- * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
- * @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID, boolean callbackToUIThread) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "and callbackToUIThread", SDL_LIB_TRACE_KEY);
- }
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp - Indicates if the app is a media application.
- * @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired - Indicates the language desired for the SDL interface.
- * @param autoActivateID - ID used to re-register previously registered application.
- * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID,
- boolean callbackToUIThread) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "and callbackToUIThread", SDL_LIB_TRACE_KEY);
- }
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param context - Used to create a multiplexing transport config
- * @param listener - Reference to the object in the App listening to callbacks from SDL.
- * @param appName - Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName - Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms - A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp - Indicates if the app is a media application.
- * @param sdlMsgVersion - Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired - Indicates the language desired for the SDL interface.
- * @param autoActivateID - ID used to re-register previously registered application.
- * @param callbackToUIThread - If true, all callbacks will occur on the UI thread.
- * @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID,
- boolean callbackToUIThread) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "and callbackToUIThread", SDL_LIB_TRACE_KEY);
- }
-
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
-
- public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
-
- /********************************************** TRANSPORT SWITCHING SUPPORT *****************************************/
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param isMediaApp Indicates if the app is a media application.
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- /*ngn media app*/null,
- /*vr synonyms*/null,
- /*is media app*/isMediaApp,
- /*sdlMsgVersion*/null,
- /*language desired*/languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- /*callbackToUIThread*/ false,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, appName, and isMediaApp.", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID, TransportType transportType, BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- /*callbackToUIThread*/ false,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, appName, ngnMediaScreenAppName, " +
- "vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms,
- Boolean isMediaApp, SdlMsgVersion sdlMsgVersion, Language languageDesired,
- Language hmiDisplayLanguageDesired, String appID, String autoActivateID,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- /*callbackToUIThread*/ false,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, and autoActivateID.", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands to
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- public SdlProxyALM(IProxyListenerALM listener, String appName, String ngnMediaScreenAppName,
- Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, String appID,
- String autoActivateID, boolean callbackToUIThread,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*sdl proxy configuration resources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "and callbackToUIThread", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands too
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID,
- boolean callbackToUIThread, BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "and callbackToUIThread", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands too
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appID Identifier of the client application.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*TTS Name*/null,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param isMediaApp Indicates if the app is a media application.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appID Identifier of the client application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @throws SdlException
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, boolean callbackToUIThread, boolean preRegister) throws SdlException
- {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- languageDesired,
- hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- callbackToUIThread,
- preRegister,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, isMediaApp, languageDesired, hmiDisplayLanguageDesired" + "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param context - Used to create a multiplexing transport config
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param isMediaApp Indicates if the app is a media application.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appID Identifier of the client application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, Boolean isMediaApp,Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, boolean callbackToUIThread, boolean preRegister) throws SdlException
- {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- languageDesired,
- hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- callbackToUIThread,
- preRegister,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, isMediaApp, languageDesired, hmiDisplayLanguageDesired" + "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param isMediaApp Indicates if the app is a media application.
- * @param appID Identifier of the client application.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- false,
- false,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param context - Used to create a multiplexing transport config
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param isMediaApp Indicates if the app is a media application.
- * @param appID Identifier of the client application.
- * @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- false,
- false,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param isMediaApp Indicates if the app is a media application.
- * @param appID Identifier of the client application.
- * @throws SdlException
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources, String appName, Boolean isMediaApp,String appID) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- false,
- false,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "sdlProxyConfigurationResources, appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param context - Used to create a multiplexing transport config
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param isMediaApp Indicates if the app is a media application.
- * @param appID Identifier of the client application.
- * @throws SdlException
- */
- public SdlProxyALM(Context context, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources, String appName, Boolean isMediaApp,String appID) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- false,
- false,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "sdlProxyConfigurationResources, appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
- }
-
- public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID,BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- false,
- false,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, isMediaApp, appID", SDL_LIB_TRACE_KEY);
- }
-
- public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp, String appID,
- TemplateColorScheme dayColorScheme, TemplateColorScheme nightColorScheme, BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- dayColorScheme,
- nightColorScheme,
- false,
- false,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, isMediaApp, appID, dayColorScheme, nightColorScheme", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param isMediaApp Indicates if the app is a media application.
- * @param appID Identifier of the client application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @throws SdlException
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID,
- boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- callbackToUIThread,
- preRegister,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, isMediaApp, " + "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param context - Used to create a multiplexing transport config
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param appName Name of the application displayed on SDL.
- * @param isMediaApp Indicates if the app is a media application.
- * @param appID Identifier of the client application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, String appName, Boolean isMediaApp,String appID,
- boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- /*sdlProxyConfigurationResources*/null,
- /*enable advanced lifecycle management*/true,
- appName,
- /*ttsName*/null,
- /*ngnMediaScreenAppName*/null,
- /*vrSynonyms*/null,
- isMediaApp,
- /*sdlMsgVersion*/null,
- /*languageDesired*/null,
- /*hmiDisplayLanguageDesired*/null,
- /*App Type*/null,
- /*App ID*/appID,
- /*autoActivateID*/null,
- callbackToUIThread,
- preRegister,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, " +
- "appName, isMediaApp, " + "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- * @param appService Reference to the apps service object.
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands too
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appID Identifier of the client application.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @throws SdlException
- */
- public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- new MultiplexTransportConfig(appService.getBaseContext(),appID));
-
- this.setAppService(appService);
- this.sendTransportBroadcast();
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
-
-
- public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister, BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- transportConfig);
-
- this.setAppService(appService);
- this.sendTransportBroadcast();
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
-
-
-
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands too
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appID Identifier of the client application.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @throws SdlException
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param context - Used to create a multiplexing transport config
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands too
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appID Identifier of the client application.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
-
-
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands too
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appID Identifier of the client application.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/null,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- /**
- * @deprecated
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands too
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appType Type of application.
- * @param appID Identifier of the client application.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @throws SdlException
- */
- @Deprecated
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- Vector<AppHMIType> appType, String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- new BTTransportConfig());
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param context - Used to create a multiplexing transport config
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands too
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appType Type of application.
- * @param appID Identifier of the client application.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @throws SdlException
- */
- public SdlProxyALM(Context context,IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired,
- Vector<AppHMIType> appType, String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- new MultiplexTransportConfig(context,appID));
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using legacy constructor for BT transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands too
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appType Type of application.
- * @param appID Identifier of the client application.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
- autoActivateID,
- callbackToUIThread,
- preRegister,
- transportConfig);
-
- this.setAppService(appService);
- this.sendTransportBroadcast();
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- /**
- * Constructor for the SdlProxy object, the proxy for communicating between the App and SDL via specified transport.
- *
- * Takes advantage of the advanced lifecycle management.
- *
- * @param listener Reference to the object in the App listening to callbacks from SDL.
- * @param sdlProxyConfigurationResources Proxy configuration resources.
- * @param appName Name of the application displayed on SDL.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Name of the application displayed on SDL for Navigation equipped
- * vehicles. Limited to five characters.
- * @param vrSynonyms A vector of strings, all of which can be used as voice commands too
- * @param isMediaApp Indicates if the app is a media application.
- * @param sdlMsgVersion Indicates the version of SDL SmartDeviceLink Messages desired. Must be less than
- * or equal to the version of SDL SmartDeviceLink running on the vehicle.
- * @param languageDesired Indicates the language desired for the SDL interface.
- * @param hmiDisplayLanguageDesired Desired language in HMI.
- * @param appType Type of application.
- * @param appID Identifier of the client application.
- * @param autoActivateID ID used to re-register previously registered application.
- * @param callbackToUIThread If true, all callbacks will occur on the UI thread.
- * @param preRegister Flag that indicates that client should be pre-registred or not
- * @param sHashID HashID used for app resumption
- * @param transportConfig Initial configuration for transport.
- * @throws SdlException
- */
- public SdlProxyALM(IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister, String sHashID,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
- autoActivateID,
- null,
- null,
- callbackToUIThread,
- preRegister,
- /*sHashID*/sHashID,
- true,
- transportConfig);
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, String autoActivateID, boolean callbackToUIThread, boolean preRegister, String sHashID,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
- autoActivateID,
- null,
- null,
- callbackToUIThread,
- preRegister,
- /*sHashID*/sHashID,
- /*bEnableResume*/true,
- transportConfig);
-
- this.setAppService(appService);
- this.sendTransportBroadcast();
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, " +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,
- SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- String appID, String autoActivateID, TemplateColorScheme dayColorScheme, TemplateColorScheme nightColorScheme, boolean callbackToUIThread, boolean preRegister, String sHashID,
- BaseTransportConfig transportConfig) throws SdlException {
- super( listener,
- sdlProxyConfigurationResources,
- /*enable advanced lifecycle management*/true,
- appName,
- ttsName,
- ngnMediaScreenAppName,
- vrSynonyms,
- isMediaApp,
- sdlMsgVersion,
- languageDesired,
- /*HMI Display Language Desired*/hmiDisplayLanguageDesired,
- /*App Type*/appType,
- /*App ID*/appID,
- autoActivateID,
- dayColorScheme,
- nightColorScheme,
- callbackToUIThread,
- preRegister,
- /*sHashID*/sHashID,
- /*bEnableResume*/true,
- transportConfig);
-
- this.setAppService(appService);
- this.sendTransportBroadcast();
-
- SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " +
- "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, dayColorScheme, nightColorScheme" +
- "callbackToUIThread and version", SDL_LIB_TRACE_KEY);
- }
- /***************************************** END OF TRANSPORT SWITCHING SUPPORT ***************************************/
-
- // Allow applications using ALM to reset the proxy (dispose and reinstantiate)
- /**
- * Disconnects the application from SDL, then recreates the transport such that
- * the next time a SDL unit discovers applications, this application will be
- * available.
- */
- public void resetProxy() throws SdlException {
- super.cycleProxy(SdlDisconnectedReason.APPLICATION_REQUESTED_DISCONNECT);
- }
-
- /********* Getters for values returned by RegisterAppInterfaceResponse **********/
-
- /**
- * Gets buttonCapabilities set when application interface is registered.
- *
- * @return buttonCapabilities
- * @throws SdlException
- * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
- */
- @Deprecated
- public List<ButtonCapabilities> getButtonCapabilities() throws SdlException{
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
- throw new SdlException("SDL is unavailable. Unable to get the buttonCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
-
- return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.BUTTON), ButtonCapabilities.class);
- }
-
- /**
- * Gets getSoftButtonCapabilities set when application interface is registered.
- *
- * @return softButtonCapabilities
- * @throws SdlException
- * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
- */
- @Deprecated
- public List<SoftButtonCapabilities> getSoftButtonCapabilities() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
- throw new SdlException("SDL is not connected. Unable to get the softButtonCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON),SoftButtonCapabilities.class);
- }
-
- /**
- * Gets getPresetBankCapabilities set when application interface is registered.
- *
- * @return presetBankCapabilities
- * @throws SdlException
- * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
- */
- @Deprecated
- public PresetBankCapabilities getPresetBankCapabilities() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
- throw new SdlException("SDL is not connected. Unable to get the presetBankCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return ( PresetBankCapabilities ) _systemCapabilityManager.getCapability(SystemCapabilityType.PRESET_BANK);
- }
-
- /**
- * Gets the current version information of the proxy.
- *
- * @return String
- * @throws SdlException
- */
- public String getProxyVersionInfo() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- if (BuildConfig.VERSION_NAME != null)
- return BuildConfig.VERSION_NAME;
-
- return null;
- }
-
-
-
- /**
- * Gets displayCapabilities set when application interface is registered.
- *
- * @return displayCapabilities
- * @throws SdlException
- * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
- */
- @Deprecated
- public DisplayCapabilities getDisplayCapabilities() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
- throw new SdlException("SDL is unavailable. Unable to get the displayCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return ( DisplayCapabilities ) _systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY);
- }
-
- /**
- * Gets hmiZoneCapabilities set when application interface is registered.
- *
- * @return hmiZoneCapabilities
- * @throws SdlException
- * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
- */
- @Deprecated
- public List<HmiZoneCapabilities> getHmiZoneCapabilities() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
- throw new SdlException("SDL is unavailable. Unable to get the hmiZoneCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.HMI_ZONE), HmiZoneCapabilities.class);
- }
-
- /**
- * Gets speechCapabilities set when application interface is registered.
- *
- * @return speechCapabilities
- * @throws SdlException
- * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
- */
- @Deprecated
- public List<SpeechCapabilities> getSpeechCapabilities() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
- throw new SdlException("SDL is unavailable. Unable to get the speechCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
-
- return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.SPEECH), SpeechCapabilities.class);
- }
- /**
- * Gets PrerecordedSpeech set when application interface is registered.
- *
- * @return PrerecordedSpeech
- * @throws SdlException
- */
- public List<PrerecordedSpeech> getPrerecordedSpeech() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
- throw new SdlException("SDL is unavailable. Unable to get the PrerecordedSpeech.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
-
- return _prerecordedSpeech;
- }
- /**
- * Gets sdlLanguage set when application interface is registered.
- *
- * @return sdlLanguage
- * @throws SdlException
- */
- public Language getSdlLanguage() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
- throw new SdlException("SDL is unavailable. Unable to get the sdlLanguage.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return _sdlLanguage;
- }
-
- /**
- * Gets getHmiDisplayLanguage set when application interface is registered.
- *
- * @return hmiDisplayLanguage
- * @throws SdlException
- */
- public Language getHmiDisplayLanguage() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
- throw new SdlException("SDL is not connected. Unable to get the hmiDisplayLanguage.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return _hmiDisplayLanguage;
- }
-
- /**
- * Gets sdlMsgVersion set when application interface is registered.
- *
- * @return sdlMsgVersion
- * @throws SdlException
- */
- public SdlMsgVersion getSdlMsgVersion() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
- throw new SdlException("SDL is unavailable. Unable to get the sdlMsgVersion.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return _sdlMsgVersion;
- }
-
- /**
- * Gets vrCapabilities set when application interface is registered.
- *
- * @return vrCapabilities
- * @throws SdlException
- * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
- */
- @Deprecated
- public List<VrCapabilities> getVrCapabilities() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
- throw new SdlException("SDL is unavailable. Unable to get the vrCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.VOICE_RECOGNITION), VrCapabilities.class);
- }
-
- /**
- * Gets getVehicleType set when application interface is registered.
- *
- * @return vehicleType
- * @throws SdlException
- */
- public VehicleType getVehicleType() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
- throw new SdlException("SDL is not connected. Unable to get the vehicleType.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return _vehicleType;
- }
-
- /**
- * Gets AudioPassThruCapabilities set when application interface is registered.
- *
- * @return AudioPassThruCapabilities
- * @throws SdlException
- * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
- */
- @Deprecated
- public List<AudioPassThruCapabilities> getAudioPassThruCapabilities() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
- throw new SdlException("SDL is not connected. Unable to get the vehicleType.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.AUDIO_PASSTHROUGH), AudioPassThruCapabilities.class);
- }
-
- public List<Integer> getSupportedDiagModes() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
- throw new SdlException("SDL is not connected. Unable to get SupportedDiagModes.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return _diagModes;
- }
-
- /**
- * Gets HMICapabilities when application interface is registered.
- *
- * @return HMICapabilities
- * @throws SdlException
- * @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
- */
- @Deprecated
- public HMICapabilities getHmiCapabilities() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
- throw new SdlException("SDL is not connected. Unable to get the HMICapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return ( HMICapabilities ) _systemCapabilityManager.getCapability(SystemCapabilityType.HMI);
- }
-
-
- public String getSystemSoftwareVersion() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
- throw new SdlException("SDL is not connected. Unable to get the SystemSoftwareVersion.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return _systemSoftwareVersion;
- }
-
- public boolean isAppResumeSuccess() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
- throw new SdlException("SDL is not connected. Unable to get isResumeSuccess.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return _bResumeSuccess;
- }
-
-}
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 9103e313c..e69de29bb 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
@@ -1,8494 +0,0 @@
-/*
- * 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;
-
-import android.annotation.TargetApi;
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.os.Build;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.SystemClock;
-import android.telephony.TelephonyManager;
-import android.util.DisplayMetrics;
-import android.util.SparseArray;
-import android.view.Display;
-import android.view.InputDevice;
-import android.view.MotionEvent;
-import android.view.Surface;
-
-import androidx.annotation.NonNull;
-
-import com.livio.taskmaster.Taskmaster;
-import com.smartdevicelink.BuildConfig;
-import com.smartdevicelink.Dispatcher.IDispatchingStrategy;
-import com.smartdevicelink.Dispatcher.ProxyMessageDispatcher;
-import com.smartdevicelink.SdlConnection.ISdlSessionListener;
-import com.smartdevicelink.SdlConnection.SdlSession;
-import com.smartdevicelink.encoder.VirtualDisplayEncoder;
-import com.smartdevicelink.exception.SdlException;
-import com.smartdevicelink.exception.SdlExceptionCause;
-import com.smartdevicelink.managers.ServiceEncryptionListener;
-import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
-import com.smartdevicelink.managers.lifecycle.RpcConverter;
-import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
-import com.smartdevicelink.marshal.JsonRPCMarshaller;
-import com.smartdevicelink.protocol.ProtocolMessage;
-import com.smartdevicelink.protocol.enums.FunctionID;
-import com.smartdevicelink.protocol.enums.MessageType;
-import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.proxy.LockScreenManager.OnLockScreenIconDownloadedListener;
-import com.smartdevicelink.proxy.callbacks.InternalProxyMessage;
-import com.smartdevicelink.proxy.callbacks.OnError;
-import com.smartdevicelink.proxy.callbacks.OnProxyClosed;
-import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
-import com.smartdevicelink.proxy.callbacks.OnServiceNACKed;
-import com.smartdevicelink.proxy.interfaces.IAudioStreamListener;
-import com.smartdevicelink.proxy.interfaces.IProxyListenerBase;
-import com.smartdevicelink.proxy.interfaces.IPutFileResponseListener;
-import com.smartdevicelink.proxy.interfaces.ISdl;
-import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
-import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
-//import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
-import com.smartdevicelink.proxy.rpc.*;
-import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
-import com.smartdevicelink.proxy.rpc.enums.AudioStreamingState;
-import com.smartdevicelink.proxy.rpc.enums.AudioType;
-import com.smartdevicelink.proxy.rpc.enums.BitsPerSample;
-import com.smartdevicelink.proxy.rpc.enums.ButtonName;
-import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
-import com.smartdevicelink.proxy.rpc.enums.FileType;
-import com.smartdevicelink.proxy.rpc.enums.GlobalProperty;
-import com.smartdevicelink.proxy.rpc.enums.HMILevel;
-import com.smartdevicelink.proxy.rpc.enums.ImageType;
-import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
-import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech;
-import com.smartdevicelink.proxy.rpc.enums.RequestType;
-import com.smartdevicelink.proxy.rpc.enums.Result;
-import com.smartdevicelink.proxy.rpc.enums.SamplingRate;
-import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-import com.smartdevicelink.proxy.rpc.enums.SdlInterfaceAvailability;
-import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
-import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
-import com.smartdevicelink.proxy.rpc.enums.TouchType;
-import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
-import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
-import com.smartdevicelink.security.SdlSecurityBase;
-import com.smartdevicelink.streaming.StreamRPCPacketizer;
-import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
-import com.smartdevicelink.streaming.audio.AudioStreamingParams;
-import com.smartdevicelink.streaming.video.SdlRemoteDisplay;
-import com.smartdevicelink.streaming.video.VideoStreamingParameters;
-import com.smartdevicelink.trace.SdlTrace;
-import com.smartdevicelink.trace.TraceDeviceInfo;
-import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
-import com.smartdevicelink.transport.BaseTransportConfig;
-import com.smartdevicelink.transport.MultiplexTransportConfig;
-import com.smartdevicelink.transport.SiphonServer;
-import com.smartdevicelink.transport.TCPTransportConfig;
-import com.smartdevicelink.transport.USBTransportConfig;
-import com.smartdevicelink.transport.enums.TransportType;
-import com.smartdevicelink.util.CorrelationIdGenerator;
-import com.smartdevicelink.util.DebugTool;
-import com.smartdevicelink.util.FileUtls;
-import com.smartdevicelink.util.Version;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.BufferedReader;
-import java.io.DataOutputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.ProtocolException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.Executors;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.ScheduledExecutorService;
-
-//import com.smartdevicelink.managers.video.HapticInterfaceManager;
-
-
-/**
- * @deprecated use {@link com.smartdevicelink.managers.SdlManager} instead.
- *
- * The guide created for the initial transition of SdlProxyBase to SdlManager can be found at
- * <a href="https://smartdevicelink.com/en/guides/android/migrating-to-newer-sdl-versions/updating-to-v47/">Migrating to SDL Manager</a>
- */
-@SuppressWarnings({"WeakerAccess", "Convert2Diamond"})
-@Deprecated
-public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> {
- // Used for calls to Android Log class.
- public static final String TAG = "SdlProxy";
- private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
- private static final int PROX_PROT_VER_ONE = 1;
- private static final int RESPONSE_WAIT_TIME = 2000;
-
- public static final com.smartdevicelink.util.Version MAX_SUPPORTED_RPC_VERSION = new com.smartdevicelink.util.Version("6.0.0");
-
- private SdlSession sdlSession = null;
- private proxyListenerType _proxyListener = null;
-
- protected Service _appService = null;
- private Context _appContext;
- private String sPoliciesURL = ""; //for testing only
-
- // Protected Correlation IDs
- private final int REGISTER_APP_INTERFACE_CORRELATION_ID = 65529,
- UNREGISTER_APP_INTERFACE_CORRELATION_ID = 65530,
- POLICIES_CORRELATION_ID = 65535;
-
- // Sdl Synchronization Objects
- private static final Object CONNECTION_REFERENCE_LOCK = new Object(),
- INCOMING_MESSAGE_QUEUE_THREAD_LOCK = new Object(),
- OUTGOING_MESSAGE_QUEUE_THREAD_LOCK = new Object(),
- INTERNAL_MESSAGE_QUEUE_THREAD_LOCK = new Object(),
- ON_UPDATE_LISTENER_LOCK = new Object(),
- RPC_LISTENER_LOCK = new Object(),
- ON_NOTIFICATION_LISTENER_LOCK = new Object();
-
- private final Object APP_INTERFACE_REGISTERED_LOCK = new Object();
-
- private int iFileCount = 0;
-
- private boolean navServiceStartResponseReceived = false;
- private boolean navServiceStartResponse = false;
- private List<String> navServiceStartRejectedParams = null;
- private boolean pcmServiceStartResponseReceived = false;
- private boolean pcmServiceStartResponse = false;
- @SuppressWarnings("FieldCanBeLocal")
- private List<String> pcmServiceStartRejectedParams = null;
- private boolean navServiceEndResponseReceived = false;
- private boolean navServiceEndResponse = false;
- private boolean pcmServiceEndResponseReceived = false;
- private boolean pcmServiceEndResponse = false;
- private boolean rpcProtectedResponseReceived = false;
- private boolean rpcProtectedStartResponse = false;
-
- // Device Info for logging
- private TraceDeviceInfo _traceDeviceInterrogator = null;
-
- // Declare Queuing Threads
- private ProxyMessageDispatcher<ProtocolMessage> _incomingProxyMessageDispatcher;
- private ProxyMessageDispatcher<ProtocolMessage> _outgoingProxyMessageDispatcher;
- private ProxyMessageDispatcher<InternalProxyMessage> _internalProxyMessageDispatcher;
-
- // Flag indicating if callbacks should be called from UIThread
- private Boolean _callbackToUIThread = false;
- // UI Handler
- private Handler _mainUIHandler = null;
- final int HEARTBEAT_CORRELATION_ID = 65531;
-
- // SdlProxy Advanced Lifecycle Management
- protected Boolean _advancedLifecycleManagementEnabled = false;
- // Parameters passed to the constructor from the app to register an app interface
- private String _applicationName = null;
- private final long instanceDateTime = System.currentTimeMillis();
- private String sConnectionDetails = "N/A";
- private Vector<TTSChunk> _ttsName = null;
- private String _ngnMediaScreenAppName = null;
- private Boolean _isMediaApp = null;
- private Language _sdlLanguageDesired = null;
- private Language _hmiDisplayLanguageDesired = null;
- private Vector<AppHMIType> _appType = null;
- private String _appID = null;
- private TemplateColorScheme _dayColorScheme = null;
- private TemplateColorScheme _nightColorScheme = null;
- @SuppressWarnings({"FieldCanBeLocal", "unused"}) //Need to understand what this is used for
- private String _autoActivateIdDesired = null;
- private String _lastHashID = null;
- private SdlMsgVersion _sdlMsgVersionRequest = null;
- private Vector<String> _vrSynonyms = null;
- private boolean _bAppResumeEnabled = false;
- private OnSystemRequest lockScreenIconRequest = null;
- private TelephonyManager telephonyManager = null;
- private DeviceInfo deviceInfo = null;
- private ISdlServiceListener navServiceListener;
-
- /**
- * Contains current configuration for the transport that was selected during
- * construction of this object
- */
- private BaseTransportConfig _transportConfig = null;
- // Proxy State Variables
- protected Boolean _appInterfaceRegisterd = false;
- protected Boolean _preRegisterd = false;
- @SuppressWarnings({"unused", "FieldCanBeLocal"})
- private Boolean _haveReceivedFirstNonNoneHMILevel = false;
- protected Boolean _haveReceivedFirstFocusLevel = false;
- protected Boolean _haveReceivedFirstFocusLevelFull = false;
- protected Boolean _proxyDisposed = false;
- //protected SdlConnectionState _sdlConnectionState = null;
- protected SdlInterfaceAvailability _sdlIntefaceAvailablity = null;
- protected HMILevel _hmiLevel = null;
- protected OnHMIStatus lastHmiStatus;
- protected AudioStreamingState _audioStreamingState = null;
- // Variables set by RegisterAppInterfaceResponse
- protected SdlMsgVersion _sdlMsgVersion = null;
- protected String _autoActivateIdReturned = null;
- protected Language _sdlLanguage = null;
- protected Language _hmiDisplayLanguage = null;
- protected List<PrerecordedSpeech> _prerecordedSpeech = null;
- protected VehicleType _vehicleType = null;
- protected String _systemSoftwareVersion = null;
- protected List<Integer> _diagModes = null;
- protected Boolean firstTimeFull = true;
- protected String _proxyVersionInfo = null;
- protected Boolean _bResumeSuccess = false;
- protected List<Class<? extends SdlSecurityBase>> _secList = null;
- protected SystemCapabilityManager _systemCapabilityManager;
- protected Boolean _iconResumed = false;
- protected RegisterAppInterfaceResponse raiResponse = null;
-
- private final CopyOnWriteArrayList<IPutFileResponseListener> _putFileListenerList = new CopyOnWriteArrayList<IPutFileResponseListener>();
-
- protected com.smartdevicelink.util.Version protocolVersion = new com.smartdevicelink.util.Version(1,0,0);
- protected com.smartdevicelink.util.Version rpcSpecVersion;
-
- protected SparseArray<OnRPCResponseListener> rpcResponseListeners = null;
- protected SparseArray<CopyOnWriteArrayList<OnRPCNotificationListener>> rpcNotificationListeners = null;
- protected SparseArray<CopyOnWriteArrayList<OnRPCRequestListener>> rpcRequestListeners = null;
- protected SparseArray<CopyOnWriteArrayList<OnRPCListener>> rpcListeners = null;
-
- protected VideoStreamingManager manager; //Will move to SdlSession once the class becomes public
-
- protected String authToken;
-
- private Version minimumProtocolVersion;
- private Version minimumRPCVersion;
-
- private Set<String> encryptionRequiredRPCs = new HashSet<>();
- private boolean rpcSecuredServiceStarted;
- private ServiceEncryptionListener serviceEncryptionListener;
- private Taskmaster taskmaster;
-
- // Interface broker
- private SdlInterfaceBroker _interfaceBroker = null;
- //We create an easily passable anonymous class of the interface so that we don't expose the internal interface to developers
- private ISdl _internalInterface = new ISdl() {
- @Override
- public void start() {
- try{
- initializeProxy();
- }catch (SdlException e){
- e.printStackTrace();
- }
- }
-
- @Override
- public void stop() {
- try{
- dispose();
- }catch (SdlException e){
- e.printStackTrace();
- }
- }
-
- @Override
- public boolean isConnected() {
- return getIsConnected();
- }
-
- @Override
- public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
- SdlProxyBase.this.addServiceListener(serviceType,sdlServiceListener);
- }
-
- @Override
- public void removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener) {
- SdlProxyBase.this.removeServiceListener(serviceType,sdlServiceListener);
- }
-
- @Override
- public void startVideoService(VideoStreamingParameters parameters, boolean encrypted) {
- if(isConnected()){
- sdlSession.setDesiredVideoParams(parameters);
- sdlSession.startService(SessionType.NAV,encrypted);
- addNavListener();
- }
- }
-
-// @Override
-// public void stopVideoService() {
-// if(isConnected()){
-// sdlSession.endService(SessionType.NAV);
-// }
-// }
-//
-// @Override public void stopAudioService() {
-// if(isConnected()){
-// sdlSession.endService(SessionType.PCM);
-// }
-// }
-
- @Override
- public void sendRPCRequest(RPCRequest message){
- try {
- SdlProxyBase.this.sendRPCRequest(message);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void sendRPC(RPCMessage message) {
- try {
- SdlProxyBase.this.sendRPC(message);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void sendRequests(List<? extends RPCRequest> rpcs, OnMultipleRequestListener listener) {
- try {
- SdlProxyBase.this.sendRequests(rpcs, listener);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void sendRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
- try {
- SdlProxyBase.this.sendRequests(rpcs, listener);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void sendSequentialRPCs(List<? extends RPCMessage> rpcs, OnMultipleRequestListener listener) {
- try{
- SdlProxyBase.this.sendSequentialRequests(rpcs,listener);
- }catch (SdlException e ){
- DebugTool.logError(TAG, "Issue sending sequential RPCs ", e);
- }
- }
-
- @Override
- public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
- SdlProxyBase.this.addOnRPCNotificationListener(notificationId,listener);
- }
-
- @Override
- public boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener) {
- return SdlProxyBase.this.removeOnRPCNotificationListener(notificationId,listener);
- }
-
- @Override
- public void addOnRPCRequestListener(FunctionID functionID, OnRPCRequestListener listener) {
- SdlProxyBase.this.addOnRPCRequestListener(functionID,listener);
- }
-
- @Override
- public boolean removeOnRPCRequestListener(FunctionID functionID, OnRPCRequestListener listener) {
- return SdlProxyBase.this.removeOnRPCRequestListener(functionID,listener);
- }
-
- @Override
- public void addOnRPCListener(FunctionID responseId, OnRPCListener listener) {
- SdlProxyBase.this.addOnRPCListener(responseId, listener);
- }
-
- @Override
- public boolean removeOnRPCListener(FunctionID responseId, OnRPCListener listener) {
- return SdlProxyBase.this.removeOnRPCListener(responseId, listener);
- }
-
- @Override
- public Object getCapability(SystemCapabilityType systemCapabilityType){
- return SdlProxyBase.this.getCapability(systemCapabilityType);
- }
-
- @Override
- public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse() {
- return SdlProxyBase.this.getRegisterAppInterfaceResponse();
- }
-
- @Override
- public void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener) {
- SdlProxyBase.this.getCapability(systemCapabilityType, scListener);
- }
-
- @Override
- public Object getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener, boolean forceUpdate) {
- if (_systemCapabilityManager != null) {
- return _systemCapabilityManager.getCapability(systemCapabilityType, scListener, forceUpdate);
- }
- return null;
- }
-
- @Override
- public SdlMsgVersion getSdlMsgVersion(){
- try {
- return SdlProxyBase.this.getSdlMsgVersion();
- } catch (SdlException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- @Override
- public com.smartdevicelink.util.Version getProtocolVersion() {
- return SdlProxyBase.this.protocolVersion;
- }
-
- @Override
- public boolean isCapabilitySupported(SystemCapabilityType systemCapabilityType){
- return SdlProxyBase.this.isCapabilitySupported(systemCapabilityType);
- }
-
- @Override
- public void addOnSystemCapabilityListener(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener listener) {
- SdlProxyBase.this.removeOnSystemCapabilityListener(systemCapabilityType, listener);
- }
-
- @Override
- public boolean removeOnSystemCapabilityListener(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener listener) {
- return SdlProxyBase.this.removeOnSystemCapabilityListener(systemCapabilityType, listener);
- }
-
- @Override
- public boolean isTransportForServiceAvailable(SessionType serviceType) {
- return SdlProxyBase.this.sdlSession != null
- && SdlProxyBase.this.sdlSession.isTransportForServiceAvailable(serviceType);
- }
-
- @Override
- public void startAudioService(boolean isEncrypted, AudioStreamingCodec codec,
- AudioStreamingParams params) {
- if(getIsConnected()){
- SdlProxyBase.this.startAudioStream(isEncrypted, codec, params);
- }
- }
-
- @Override
- public void startAudioService(boolean encrypted) {
- if(isConnected()){
- sdlSession.startService(SessionType.PCM,encrypted);
- }
- }
-
- @Override
- public IVideoStreamListener startVideoStream(boolean isEncrypted, VideoStreamingParameters parameters){
- return SdlProxyBase.this.startVideoStream(isEncrypted, parameters);
- }
-
- @Override
- public IAudioStreamListener startAudioStream(boolean isEncrypted, AudioStreamingCodec codec,
- AudioStreamingParams params) {
- return SdlProxyBase.this.startAudioStream(isEncrypted, codec, params);
- }
-
- @Override
- public void startRPCEncryption() {
- SdlProxyBase.this.startProtectedRPCService();
- }
-
- @Override
- public Taskmaster getTaskmaster() {
- return SdlProxyBase.this.getTaskmaster();
- }
- };
-
- Taskmaster getTaskmaster() {
- if (taskmaster == null) {
- Taskmaster.Builder builder = new Taskmaster.Builder();
- builder.setThreadCount(2);
- builder.shouldBeDaemon(false);
- taskmaster = builder.build();
- taskmaster.start();
- }
- return taskmaster;
- }
-
- private void notifyPutFileStreamError(Exception e, String info)
- {
- for (IPutFileResponseListener _putFileListener : _putFileListenerList) {
- _putFileListener.onPutFileStreamError(e, info);
- }
- }
-
- private void notifyPutFileStreamResponse(PutFileResponse msg)
- {
- for (IPutFileResponseListener _putFileListener : _putFileListenerList) {
- _putFileListener.onPutFileResponse(msg);
- }
- }
-
- public void addPutFileResponseListener(IPutFileResponseListener _putFileListener)
- {
- _putFileListenerList.addIfAbsent(_putFileListener);
- }
-
- public void remPutFileResponseListener(IPutFileResponseListener _putFileListener)
- {
- _putFileListenerList.remove(_putFileListener);
- }
-
- // Private Class to Interface with SdlConnection
- private class SdlInterfaceBroker implements ISdlSessionListener {
-
- @Override
- public void onTransportDisconnected(String info, boolean altTransportAvailable, BaseTransportConfig transportConfig) {
-
- notifyPutFileStreamError(null, info);
-
- if (altTransportAvailable){
- SdlProxyBase.this._transportConfig = transportConfig;
- DebugTool.logInfo(TAG, "notifying RPC session ended, but potential primary transport available");
- cycleProxy(SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST);
- }else{
- notifyProxyClosed(info, new SdlException("Transport disconnected.", SdlExceptionCause.SDL_UNAVAILABLE), SdlDisconnectedReason.TRANSPORT_DISCONNECT);
- }
- }
-
-
- @Override
- public void onRPCMessageReceived(RPCMessage rpcMessage) {
-
- }
-
- @Override
- public void onSessionStarted(int sessionID, Version version) {
-
- }
-
- @Override
- public void onSessionEnded(int sessionID) {
-
- }
-
- @Override
- public void onAuthTokenReceived(String authToken, int sessionID) {
-
- }
-
-
- public void onProtocolServiceDataACK(SessionType sessionType, final int dataSize,
- byte sessionID) {
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onServiceDataACK(dataSize);
- }
- });
- } else {
- _proxyListener.onServiceDataACK(dataSize);
- }
- }
-
- }
-
- protected SdlProxyBase(){}
-
- /**
- * Used by the SdlManager
- *
- * @param listener Type of listener for this proxy base.
- * @param context Application context.
- * @param appName Client application name.
- * @param shortAppName Client short application name.
- * @param isMediaApp Flag that indicates that client application if media application or not.
- * @param languageDesired Desired language.
- * @param hmiDisplayLanguageDesired Desired language for HMI.
- * @param appType Type of application.
- * @param appID Application identifier.
- * @param dayColorScheme TemplateColorScheme for the day
- * @param nightColorScheme TemplateColorScheme for the night
- * @param transportConfig Configuration of transport to be used by underlying connection.
- * @param vrSynonyms List of synonyms.
- * @param ttsName TTS name.
- * @throws SdlException
- */
- public SdlProxyBase(proxyListenerType listener, Context context, String appName,String shortAppName, Boolean isMediaApp, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID,
- BaseTransportConfig transportConfig, Vector<String> vrSynonyms, Vector<TTSChunk> ttsName, TemplateColorScheme dayColorScheme, TemplateColorScheme nightColorScheme) throws SdlException {
- performBaseCommon(listener, null, true, appName, ttsName, shortAppName, vrSynonyms, isMediaApp,
- null, languageDesired, hmiDisplayLanguageDesired, appType, appID, null, dayColorScheme,nightColorScheme, false, false, null, null, transportConfig);
- _appContext = context;
- }
-
- /**
- * Constructor.
- *
- * @param listener Type of listener for this proxy base.
- * @param sdlProxyConfigurationResources Configuration resources for this proxy.
- * @param enableAdvancedLifecycleManagement Flag that ALM should be enabled or not.
- * @param appName Client application name.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Media Screen Application name.
- * @param vrSynonyms List of synonyms.
- * @param isMediaApp Flag that indicates that client application if media application or not.
- * @param sdlMsgVersion Version of Sdl Message.
- * @param languageDesired Desired language.
- * @param hmiDisplayLanguageDesired Desired language for HMI.
- * @param appType Type of application.
- * @param appID Application identifier.
- * @param autoActivateID Auto activation identifier.
- * @param callbackToUIThread Flag that indicates that this proxy should send callback to UI thread or not.
- * @param transportConfig Configuration of transport to be used by underlying connection.
- * @throws SdlException if there is an unrecoverable error class might throw an exception.
- */
- protected SdlProxyBase(proxyListenerType listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- boolean enableAdvancedLifecycleManagement, String appName, Vector<TTSChunk> ttsName,
- String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID,
- String autoActivateID, boolean callbackToUIThread, BaseTransportConfig transportConfig)
- throws SdlException {
-
- performBaseCommon(listener, sdlProxyConfigurationResources, enableAdvancedLifecycleManagement, appName, ttsName, ngnMediaScreenAppName, vrSynonyms, isMediaApp,
- sdlMsgVersion, languageDesired, hmiDisplayLanguageDesired, appType, appID, autoActivateID, null, null, callbackToUIThread, null, null, null, transportConfig);
- }
-
- @SuppressWarnings("ConstantConditions")
- private void performBaseCommon(proxyListenerType listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- boolean enableAdvancedLifecycleManagement, String appName, Vector<TTSChunk> ttsName,
- String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID,
- String autoActivateID, TemplateColorScheme dayColorScheme, TemplateColorScheme nightColorScheme,
- boolean callbackToUIThread, Boolean preRegister, String sHashID, Boolean bAppResumeEnab,
- BaseTransportConfig transportConfig) throws SdlException
- {
- DebugTool.logInfo(TAG, "SDL_LIB_VERSION: " + BuildConfig.VERSION_NAME);
- setProtocolVersion(new Version(PROX_PROT_VER_ONE,0,0));
-
- if (preRegister != null && preRegister)
- {
- _appInterfaceRegisterd = preRegister;
- _preRegisterd = preRegister;
- }
-
- if (bAppResumeEnab != null && bAppResumeEnab)
- {
- _bAppResumeEnabled = true;
- _lastHashID = sHashID;
- }
- _interfaceBroker = new SdlInterfaceBroker();
-
- _callbackToUIThread = callbackToUIThread;
-
- if (_callbackToUIThread) {
- _mainUIHandler = new Handler(Looper.getMainLooper());
- }
-
- // Set variables for Advanced Lifecycle Management
- _advancedLifecycleManagementEnabled = enableAdvancedLifecycleManagement;
- _applicationName = appName;
- _ttsName = ttsName;
- _ngnMediaScreenAppName = ngnMediaScreenAppName;
- _isMediaApp = isMediaApp;
- _sdlMsgVersionRequest = sdlMsgVersion;
- _vrSynonyms = vrSynonyms;
- _sdlLanguageDesired = languageDesired;
- _hmiDisplayLanguageDesired = hmiDisplayLanguageDesired;
- _appType = appType;
- _appID = appID;
- _autoActivateIdDesired = autoActivateID;
- _dayColorScheme = dayColorScheme;
- _nightColorScheme = nightColorScheme;
- _transportConfig = transportConfig;
-
- // Test conditions to invalidate the proxy
- if (listener == null) {
- throw new IllegalArgumentException("IProxyListener listener must be provided to instantiate SdlProxy object.");
- }
- if (_advancedLifecycleManagementEnabled) {
- /* if (_applicationName == null ) {
- throw new IllegalArgumentException("To use SdlProxyALM, an application name, appName, must be provided");
- }
- if (_applicationName.length() < 1 || _applicationName.length() > 100) {
- throw new IllegalArgumentException("A provided application name, appName, must be between 1 and 100 characters in length.");
- }*/
- if (_isMediaApp == null) {
- throw new IllegalArgumentException("isMediaApp must not be null when using SdlProxyALM.");
- }
- }
-
- _proxyListener = listener;
-
- // Get information from sdlProxyConfigurationResources
- if (sdlProxyConfigurationResources != null) {
- telephonyManager = sdlProxyConfigurationResources.getTelephonyManager();
- }
-
- // Use the telephonyManager to get and log phone info
- if (telephonyManager != null) {
- // Following is not quite thread-safe (because m_traceLogger could test null twice),
- // so we need to fix this, but vulnerability (i.e. two instances of listener) is
- // likely harmless.
- if (_traceDeviceInterrogator == null) {
- _traceDeviceInterrogator = new TraceDeviceInfo(telephonyManager);
- } // end-if
-
- } // end-if
-
- // Setup Internal ProxyMessage Dispatcher
- synchronized(INTERNAL_MESSAGE_QUEUE_THREAD_LOCK) {
- // Ensure internalProxyMessageDispatcher is null
- if (_internalProxyMessageDispatcher != null) {
- _internalProxyMessageDispatcher.dispose();
- _internalProxyMessageDispatcher = null;
- }
-
- _internalProxyMessageDispatcher = new ProxyMessageDispatcher<InternalProxyMessage>("INTERNAL_MESSAGE_DISPATCHER", new IDispatchingStrategy<InternalProxyMessage>() {
-
- @Override
- public void dispatch(InternalProxyMessage message) {
- dispatchInternalMessage(message);
- }
-
- @Override
- public void handleDispatchingError(String info, Exception ex) {
- handleErrorsFromInternalMessageDispatcher(info, ex);
- }
-
- @Override
- public void handleQueueingError(String info, Exception ex) {
- handleErrorsFromInternalMessageDispatcher(info, ex);
- }
- });
- }
-
- // Setup Incoming ProxyMessage Dispatcher
- synchronized(INCOMING_MESSAGE_QUEUE_THREAD_LOCK) {
- // Ensure incomingProxyMessageDispatcher is null
- if (_incomingProxyMessageDispatcher != null) {
- _incomingProxyMessageDispatcher.dispose();
- _incomingProxyMessageDispatcher = null;
- }
-
- _incomingProxyMessageDispatcher = new ProxyMessageDispatcher<ProtocolMessage>("INCOMING_MESSAGE_DISPATCHER",new IDispatchingStrategy<ProtocolMessage>() {
- @Override
- public void dispatch(ProtocolMessage message) {
- dispatchIncomingMessage(message);
- }
-
- @Override
- public void handleDispatchingError(String info, Exception ex) {
- handleErrorsFromIncomingMessageDispatcher(info, ex);
- }
-
- @Override
- public void handleQueueingError(String info, Exception ex) {
- handleErrorsFromIncomingMessageDispatcher(info, ex);
- }
- });
- }
-
- // Setup Outgoing ProxyMessage Dispatcher
- synchronized(OUTGOING_MESSAGE_QUEUE_THREAD_LOCK) {
- // Ensure outgoingProxyMessageDispatcher is null
- if (_outgoingProxyMessageDispatcher != null) {
- _outgoingProxyMessageDispatcher.dispose();
- _outgoingProxyMessageDispatcher = null;
- }
-
- _outgoingProxyMessageDispatcher = new ProxyMessageDispatcher<ProtocolMessage>("OUTGOING_MESSAGE_DISPATCHER",new IDispatchingStrategy<ProtocolMessage>() {
- @Override
- public void dispatch(ProtocolMessage message) {
- dispatchOutgoingMessage(message);
- }
-
- @Override
- public void handleDispatchingError(String info, Exception ex) {
- handleErrorsFromOutgoingMessageDispatcher(info, ex);
- }
-
- @Override
- public void handleQueueingError(String info, Exception ex) {
- handleErrorsFromOutgoingMessageDispatcher(info, ex);
- }
- });
- }
-
- rpcResponseListeners = new SparseArray<OnRPCResponseListener>();
- rpcNotificationListeners = new SparseArray<CopyOnWriteArrayList<OnRPCNotificationListener>>();
- rpcRequestListeners = new SparseArray<CopyOnWriteArrayList<OnRPCRequestListener>>();
- rpcListeners = new SparseArray<CopyOnWriteArrayList<OnRPCListener>>();
-
- // Initialize the proxy
- try {
- initializeProxy();
- } catch (SdlException e) {
- // Couldn't initialize the proxy
- // Dispose threads and then rethrow exception
-
- if (_internalProxyMessageDispatcher != null) {
- _internalProxyMessageDispatcher.dispose();
- _internalProxyMessageDispatcher = null;
- }
- if (_incomingProxyMessageDispatcher != null) {
- _incomingProxyMessageDispatcher.dispose();
- _incomingProxyMessageDispatcher = null;
- }
- if (_outgoingProxyMessageDispatcher != null) {
- _outgoingProxyMessageDispatcher.dispose();
- _outgoingProxyMessageDispatcher = null;
- }
- throw e;
- }
-
- addOnRPCNotificationListener(FunctionID.ON_PERMISSIONS_CHANGE, onPermissionsChangeListener);
- this._internalInterface.addServiceListener(SessionType.RPC, securedServiceListener);
- this._internalInterface.addServiceListener(SessionType.NAV, securedServiceListener);
- this._internalInterface.addServiceListener(SessionType.PCM, securedServiceListener);
-
-
- // Trace that ctor has fired
- SdlTrace.logProxyEvent("SdlProxy Created, instanceID=" + this.toString(), SDL_LIB_TRACE_KEY);
- }
-
- protected SdlProxyBase(proxyListenerType listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- boolean enableAdvancedLifecycleManagement, String appName, Vector<TTSChunk> ttsName,
- String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID,
- String autoActivateID, TemplateColorScheme dayColorScheme, TemplateColorScheme nightColorScheme,
- boolean callbackToUIThread, boolean preRegister, String sHashID, Boolean bEnableResume, BaseTransportConfig transportConfig)
- throws SdlException
- {
- performBaseCommon(listener, sdlProxyConfigurationResources, enableAdvancedLifecycleManagement, appName, ttsName, ngnMediaScreenAppName, vrSynonyms, isMediaApp,
- sdlMsgVersion, languageDesired, hmiDisplayLanguageDesired, appType, appID, autoActivateID, dayColorScheme, nightColorScheme, callbackToUIThread, preRegister, sHashID, bEnableResume, transportConfig);
- }
-
- /**
- * Constructor.
- *
- * @param listener Type of listener for this proxy base.
- * @param sdlProxyConfigurationResources Configuration resources for this proxy.
- * @param enableAdvancedLifecycleManagement Flag that ALM should be enabled or not.
- * @param appName Client application name.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Media Screen Application name.
- * @param vrSynonyms List of synonyms.
- * @param isMediaApp Flag that indicates that client application if media application or not.
- * @param sdlMsgVersion Version of Sdl Message.
- * @param languageDesired Desired language.
- * @param hmiDisplayLanguageDesired Desired language for HMI.
- * @param appType Type of application.
- * @param appID Application identifier.
- * @param autoActivateID Auto activation identifier.
- * @param callbackToUIThread Flag that indicates that this proxy should send callback to UI thread or not.
- * @param preRegister Flag that indicates that this proxy should be pre-registerd or not.
- * @param transportConfig Configuration of transport to be used by underlying connection.
- * @throws SdlException if there is an unrecoverable error class might throw an exception.
- */
- protected SdlProxyBase(proxyListenerType listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- boolean enableAdvancedLifecycleManagement, String appName, Vector<TTSChunk> ttsName,
- String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID,
- String autoActivateID, boolean callbackToUIThread, boolean preRegister, BaseTransportConfig transportConfig)
- throws SdlException
- {
- performBaseCommon(listener, sdlProxyConfigurationResources, enableAdvancedLifecycleManagement, appName, ttsName, ngnMediaScreenAppName, vrSynonyms, isMediaApp,
- sdlMsgVersion, languageDesired, hmiDisplayLanguageDesired, appType, appID, autoActivateID, null, null, callbackToUIThread, preRegister, null, null, transportConfig);
- }
-
- /**
- * Constructor.
- *
- * @param listener Type of listener for this proxy base.
- * @param sdlProxyConfigurationResources Configuration resources for this proxy.
- * @param enableAdvancedLifecycleManagement Flag that ALM should be enabled or not.
- * @param appName Client application name.
- * @param ttsName TTS name.
- * @param ngnMediaScreenAppName Media Screen Application name.
- * @param vrSynonyms List of synonyms.
- * @param isMediaApp Flag that indicates that client application if media application or not.
- * @param sdlMsgVersion Version of Sdl Message.
- * @param languageDesired Desired language.
- * @param hmiDisplayLanguageDesired Desired language for HMI.
- * @param appType Type of application.
- * @param appID Application identifier.
- * @param autoActivateID Auto activation identifier.
- * @param dayColorScheme Day color scheme.
- * @param dayColorScheme Night color scheme.
- * @param callbackToUIThread Flag that indicates that this proxy should send callback to UI thread or not.
- * @param preRegister Flag that indicates that this proxy should be pre-registerd or not.
- * @param transportConfig Configuration of transport to be used by underlying connection.
- * @throws SdlException if there is an unrecoverable error class might throw an exception.
- */
- protected SdlProxyBase(proxyListenerType listener, SdlProxyConfigurationResources sdlProxyConfigurationResources,
- boolean enableAdvancedLifecycleManagement, String appName, Vector<TTSChunk> ttsName,
- String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion,
- Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID,
- String autoActivateID, TemplateColorScheme dayColorScheme, TemplateColorScheme nightColorScheme,
- boolean callbackToUIThread, boolean preRegister, BaseTransportConfig transportConfig)
- throws SdlException
- {
- performBaseCommon(listener, sdlProxyConfigurationResources, enableAdvancedLifecycleManagement, appName, ttsName, ngnMediaScreenAppName, vrSynonyms, isMediaApp,
- sdlMsgVersion, languageDesired, hmiDisplayLanguageDesired, appType, appID, autoActivateID, dayColorScheme, nightColorScheme, callbackToUIThread, preRegister, null, null, transportConfig);
- }
-
- private Intent createBroadcastIntent()
- {
- Intent sendIntent = new Intent();
- sendIntent.setAction("com.smartdevicelink.broadcast");
- sendIntent.putExtra("APP_NAME", this._applicationName);
- sendIntent.putExtra("APP_ID", this._appID);
- sendIntent.putExtra("RPC_NAME", "");
- sendIntent.putExtra("TYPE", "");
- sendIntent.putExtra("SUCCESS", true);
- sendIntent.putExtra("CORRID", 0);
- sendIntent.putExtra("FUNCTION_NAME", "");
- sendIntent.putExtra("COMMENT1", "");
- sendIntent.putExtra("COMMENT2", "");
- sendIntent.putExtra("COMMENT3", "");
- sendIntent.putExtra("COMMENT4", "");
- sendIntent.putExtra("COMMENT5", "");
- sendIntent.putExtra("COMMENT6", "");
- sendIntent.putExtra("COMMENT7", "");
- sendIntent.putExtra("COMMENT8", "");
- sendIntent.putExtra("COMMENT9", "");
- sendIntent.putExtra("COMMENT10", "");
- sendIntent.putExtra("DATA", "");
- sendIntent.putExtra("SHOW_ON_UI", true);
- return sendIntent;
- }
- private void updateBroadcastIntent(Intent sendIntent, String sKey, String sValue)
- {
- if (sValue == null) sValue = "";
- sendIntent.putExtra(sKey, sValue);
- }
- private void updateBroadcastIntent(Intent sendIntent, String sKey, boolean bValue)
- {
- sendIntent.putExtra(sKey, bValue);
- }
- private void updateBroadcastIntent(Intent sendIntent, String sKey, int iValue)
- {
- sendIntent.putExtra(sKey, iValue);
- }
-
- private Service getService()
- {
- try {
- Service myService = null;
- if (_proxyListener != null && _proxyListener instanceof Service) {
- myService = (Service) _proxyListener;
- } else if (_appService != null) {
- myService = _appService;
- } else if (_appContext != null && _appContext instanceof Service) {
- myService = (Service) _appContext;
- }
- return myService;
- } catch (Exception ex){
- return null;
- }
- }
-
- private void sendBroadcastIntent(Intent sendIntent)
- {
- Service myService = null;
- if (_proxyListener != null && _proxyListener instanceof Service)
- {
- myService = (Service) _proxyListener;
- }
- else if (_appService != null)
- {
- myService = _appService;
- }
- Context myContext;
- if (myService != null){
- myContext = myService.getApplicationContext();
- } else if (_appContext != null){
- myContext = _appContext;
- }
- else
- {
- return;
- }
- try
- {
- if (myContext != null) myContext.sendBroadcast(sendIntent);
- }
- catch(Exception ex)
- {
- //If the service or context has become unavailable unexpectedly, catch the exception and move on -- no broadcast log will occur.
- }
- }
-
- private HttpURLConnection getURLConnection(Headers myHeader, String sURLString, int Timeout, int iContentLen)
- {
- String sContentType = "application/json";
- int CONNECTION_TIMEOUT = Timeout * 1000;
- int READ_TIMEOUT = Timeout * 1000;
- boolean bDoOutput = true;
- boolean bDoInput = true;
- boolean bUsesCaches = false;
- String sRequestMeth = "POST";
-
- boolean bInstFolRed = false;
- String sCharSet = "utf-8";
- int iContentLength = iContentLen;
-
- URL url;
- HttpURLConnection urlConnection;
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "getURLConnection");
- updateBroadcastIntent(sendIntent, "COMMENT1", "Actual Content Length: " + iContentLen);
-
- if (myHeader != null)
- {
- //if the header isn't null, use it and replace the hardcoded params
- int iTimeout;
- int iReadTimeout;
- sContentType = myHeader.getContentType();
- iTimeout = myHeader.getConnectTimeout();
- bDoOutput = myHeader.getDoOutput();
- bDoInput = myHeader.getDoInput();
- bUsesCaches = myHeader.getUseCaches();
- sRequestMeth = myHeader.getRequestMethod();
- iReadTimeout = myHeader.getReadTimeout();
- bInstFolRed = myHeader.getInstanceFollowRedirects();
- sCharSet = myHeader.getCharset();
- iContentLength = myHeader.getContentLength();
- CONNECTION_TIMEOUT = iTimeout*1000;
- READ_TIMEOUT = iReadTimeout*1000;
- updateBroadcastIntent(sendIntent, "COMMENT2", "\nHeader Defined Content Length: " + iContentLength);
- }
-
- try
- {
- url = new URL(sURLString);
- urlConnection = (HttpURLConnection) url.openConnection();
- urlConnection.setConnectTimeout(CONNECTION_TIMEOUT);
- urlConnection.setDoOutput(bDoOutput);
- urlConnection.setDoInput(bDoInput);
- urlConnection.setRequestMethod(sRequestMeth);
- urlConnection.setReadTimeout(READ_TIMEOUT);
- urlConnection.setInstanceFollowRedirects(bInstFolRed);
- urlConnection.setRequestProperty("Content-Type", sContentType);
- urlConnection.setRequestProperty("charset", sCharSet);
- urlConnection.setRequestProperty("Content-Length", "" + Integer.toString(iContentLength));
- urlConnection.setUseCaches(bUsesCaches);
- return urlConnection;
- }
- catch (Exception e)
- {
- return null;
- }
- finally
- {
- sendBroadcastIntent(sendIntent);
- }
- }
-
-
- private void sendOnSystemRequestToUrl(OnSystemRequest msg)
- {
- Intent sendIntent = createBroadcastIntent();
- Intent sendIntent2 = createBroadcastIntent();
-
- HttpURLConnection urlConnection = null;
- boolean bLegacy = false;
-
- String sURLString;
- if (!getPoliciesURL().equals("")) {
- sURLString = sPoliciesURL;
- } else {
- sURLString = msg.getUrl();
- }
- sURLString = sURLString.replaceFirst("http://", "https://");
-
- Integer iTimeout = msg.getTimeout();
-
- if (iTimeout == null)
- iTimeout = 2000;
-
- Headers myHeader = msg.getHeader();
-
- RequestType requestType = msg.getRequestType();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "sendOnSystemRequestToUrl");
- updateBroadcastIntent(sendIntent, "COMMENT5", "\r\nCloud URL: " + sURLString);
-
- try
- {
- if (myHeader == null) {
- updateBroadcastIntent(sendIntent, "COMMENT7", "\r\nHTTPRequest Header is null");
- }
-
- String sBodyString = msg.getBody();
-
- JSONObject jsonObjectToSendToServer;
- String valid_json = "";
- int length;
- if (sBodyString == null)
- {
- if(requestType == RequestType.HTTP ){
- length = msg.getBulkData().length;
- Intent sendIntent3 = createBroadcastIntent();
- updateBroadcastIntent(sendIntent3, "FUNCTION_NAME", "replace");
- updateBroadcastIntent(sendIntent3, "COMMENT1", "Valid Json length before replace: " + length);
- sendBroadcastIntent(sendIntent3);
-
- }else{
- List<String> legacyData = msg.getLegacyData();
- JSONArray jsonArrayOfSdlPPackets = new JSONArray(legacyData);
- jsonObjectToSendToServer = new JSONObject();
- jsonObjectToSendToServer.put("data", jsonArrayOfSdlPPackets);
- bLegacy = true;
- updateBroadcastIntent(sendIntent, "COMMENT6", "\r\nLegacy SystemRequest: true");
- valid_json = jsonObjectToSendToServer.toString().replace("\\", "");
- length = valid_json.getBytes("UTF-8").length;
- }
- }
- else
- {
- Intent sendIntent3 = createBroadcastIntent();
- updateBroadcastIntent(sendIntent3, "FUNCTION_NAME", "replace");
- updateBroadcastIntent(sendIntent3, "COMMENT1", "Valid Json length before replace: " + sBodyString.getBytes("UTF-8").length);
- sendBroadcastIntent(sendIntent3);
- valid_json = sBodyString.replace("\\", "");
- length = valid_json.getBytes("UTF-8").length;
- }
-
- urlConnection = getURLConnection(myHeader, sURLString, iTimeout, length);
-
- if (urlConnection == null)
- {
- DebugTool.logInfo(TAG, "urlConnection is null, check RPC input parameters");
- updateBroadcastIntent(sendIntent, "COMMENT2", "urlConnection is null, check RPC input parameters");
- return;
- }
-
- DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream());
- if(requestType == RequestType.HTTP){
- wr.write(msg.getBulkData());
- }else{
- wr.writeBytes(valid_json);
- }
-
- wr.flush();
- wr.close();
-
-
- long BeforeTime = System.currentTimeMillis();
- long AfterTime = System.currentTimeMillis();
- final long roundtriptime = AfterTime - BeforeTime;
-
- updateBroadcastIntent(sendIntent, "COMMENT4", " Round trip time: " + roundtriptime);
- updateBroadcastIntent(sendIntent, "COMMENT1", "Received response from cloud, response code=" + urlConnection.getResponseCode() + " ");
-
- int iResponseCode = urlConnection.getResponseCode();
-
- if (iResponseCode != HttpURLConnection.HTTP_OK)
- {
- DebugTool.logInfo(TAG, "Response code not HTTP_OK, returning from sendOnSystemRequestToUrl.");
- updateBroadcastIntent(sendIntent, "COMMENT2", "Response code not HTTP_OK, aborting request. ");
- return;
- }
-
- InputStream is = urlConnection.getInputStream();
- BufferedReader rd = new BufferedReader(new InputStreamReader(is));
- String line;
- StringBuilder response = new StringBuilder();
- while((line = rd.readLine()) != null)
- {
- response.append(line);
- response.append('\r');
- }
- rd.close();
- //We've read the body
- if(requestType == RequestType.HTTP){
- // Create the SystemRequest RPC to send to module.
- PutFile putFile = new PutFile();
- putFile.setFileType(FileType.JSON);
- putFile.setCorrelationID(POLICIES_CORRELATION_ID);
- putFile.setSdlFileName("response_data");
- putFile.setFileData(response.toString().getBytes("UTF-8"));
- putFile.setCRC(response.toString().getBytes());
- updateBroadcastIntent(sendIntent, "DATA", "Data from cloud response: " + response.toString());
-
- sendRPCMessagePrivate(putFile);
- DebugTool.logInfo(TAG, "sendSystemRequestToUrl sent to sdl");
-
- updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.PUT_FILE.toString());
- updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
- updateBroadcastIntent(sendIntent2, "CORRID", putFile.getCorrelationID());
-
- }else{
- Vector<String> cloudDataReceived = new Vector<String>();
- final String dataKey = "data";
- // Convert the response to JSON
- JSONObject jsonResponse = new JSONObject(response.toString());
- if(jsonResponse.has(dataKey)){
- if (jsonResponse.get(dataKey) instanceof JSONArray)
- {
- JSONArray jsonArray = jsonResponse.getJSONArray(dataKey);
- for (int i=0; i<jsonArray.length(); i++)
- {
- if (jsonArray.get(i) instanceof String)
- {
- cloudDataReceived.add(jsonArray.getString(i));
- //Log.i("sendSystemRequestToUrl", "jsonArray.getString(i): " + jsonArray.getString(i));
- }
- }
- }
- else if (jsonResponse.get(dataKey) instanceof String)
- {
- cloudDataReceived.add(jsonResponse.getString(dataKey));
- //Log.i("sendSystemRequestToUrl", "jsonResponse.getString(data): " + jsonResponse.getString("data"));
- }
- }
- else
- {
- DebugTool.logError(TAG, "sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
- //Log.i("sendSystemRequestToUrl", "sendSystemRequestToUrl: Data in JSON Object neither an array nor a string.");
- return;
- }
-
- String sResponse = cloudDataReceived.toString();
-
- if (sResponse.length() > 512)
- {
- sResponse = sResponse.substring(0, 511);
- }
-
- updateBroadcastIntent(sendIntent, "DATA", "Data from cloud response: " + sResponse);
-
- // Send new SystemRequest to SDL
- SystemRequest mySystemRequest = null;
-
- if (bLegacy){
- if(cloudDataReceived != null) {
- mySystemRequest = new SystemRequest(true);
- mySystemRequest.setCorrelationID(getPoliciesReservedCorrelationID());
- mySystemRequest.setLegacyData(cloudDataReceived);
- }
- }else{
- if (response != null) {
- mySystemRequest = new SystemRequest();
- mySystemRequest.setRequestType(RequestType.PROPRIETARY);
- mySystemRequest.setCorrelationID(getPoliciesReservedCorrelationID());
- mySystemRequest.setBulkData(response.toString().getBytes());
- }
- }
-
- if (getIsConnected())
- {
- sendRPCMessagePrivate(mySystemRequest);
- DebugTool.logInfo(TAG, "sendSystemRequestToUrl sent to sdl");
-
- updateBroadcastIntent(sendIntent2, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
- updateBroadcastIntent(sendIntent2, "TYPE", RPCMessage.KEY_REQUEST);
- updateBroadcastIntent(sendIntent2, "CORRID", mySystemRequest.getCorrelationID());
- }
- }
- }
- catch (SdlException e)
- {
- DebugTool.logError(TAG, "sendSystemRequestToUrl: Could not get data from JSONObject received.", e);
- updateBroadcastIntent(sendIntent, "COMMENT3", " SdlException encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendSystemRequestToUrl: Could not get data from JSONObject received."+ e);
- }
- catch (JSONException e)
- {
- DebugTool.logError(TAG, "sendSystemRequestToUrl: JSONException: ", e);
- updateBroadcastIntent(sendIntent, "COMMENT3", " JSONException encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendSystemRequestToUrl: JSONException: "+ e);
- }
- catch (UnsupportedEncodingException e)
- {
- DebugTool.logError(TAG, "sendSystemRequestToUrl: Could not encode string.", e);
- updateBroadcastIntent(sendIntent, "COMMENT3", " UnsupportedEncodingException encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendSystemRequestToUrl: Could not encode string."+ e);
- }
- catch (ProtocolException e)
- {
- DebugTool.logError(TAG, "sendSystemRequestToUrl: Could not set request method to post.", e);
- updateBroadcastIntent(sendIntent, "COMMENT3", " ProtocolException encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendSystemRequestToUrl: Could not set request method to post."+ e);
- }
- catch (MalformedURLException e)
- {
- DebugTool.logError(TAG, "sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server.", e);
- updateBroadcastIntent(sendIntent, "COMMENT3", " MalformedURLException encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendSystemRequestToUrl: URL Exception when sending SystemRequest to an external server."+ e);
- }
- catch (IOException e)
- {
- DebugTool.logError(TAG, "sendSystemRequestToUrl: IOException: ", e);
- updateBroadcastIntent(sendIntent, "COMMENT3", " IOException while sending to cloud: IOException: "+ e);
- //Log.i("pt", "sendSystemRequestToUrl: IOException: "+ e);
- }
- catch (Exception e)
- {
- DebugTool.logError(TAG, "sendSystemRequestToUrl: Unexpected Exception: ", e);
- updateBroadcastIntent(sendIntent, "COMMENT3", " Exception encountered sendOnSystemRequestToUrl: "+ e);
- //Log.i("pt", "sendSystemRequestToUrl: Unexpected Exception: " + e);
- }
- finally
- {
- sendBroadcastIntent(sendIntent);
- sendBroadcastIntent(sendIntent2);
-
- if (iFileCount < 10)
- iFileCount++;
- else
- iFileCount = 0;
-
- if(urlConnection != null)
- {
- urlConnection.disconnect();
- }
- }
- }
-
- private int getPoliciesReservedCorrelationID() {
- return POLICIES_CORRELATION_ID;
- }
-
- // Test correlationID
- private boolean isCorrelationIDProtected(Integer correlationID) {
- return correlationID != null &&
- (HEARTBEAT_CORRELATION_ID == correlationID
- || REGISTER_APP_INTERFACE_CORRELATION_ID == correlationID
- || UNREGISTER_APP_INTERFACE_CORRELATION_ID == correlationID
- || POLICIES_CORRELATION_ID == correlationID);
-
- }
-
- // Protected isConnected method to allow legacy proxy to poll isConnected state
- public Boolean getIsConnected() {
- return sdlSession != null && sdlSession.getIsConnected();
- }
-
-
- /**
- * Returns whether the application is registered in SDL. Note: for testing
- * purposes, it's possible that the connection is established, but the
- * application is not registered.
- *
- * @return true if the application is registered in SDL
- */
- public Boolean getAppInterfaceRegistered() {
- return _appInterfaceRegisterd;
- }
-
- // Function to initialize new proxy connection
- public void initializeProxy() throws SdlException {
- // Reset all of the flags and state variables
- _haveReceivedFirstNonNoneHMILevel = false;
- _haveReceivedFirstFocusLevel = false;
- _haveReceivedFirstFocusLevelFull = false;
- _appInterfaceRegisterd = _preRegisterd;
-
- _putFileListenerList.clear();
-
- _sdlIntefaceAvailablity = SdlInterfaceAvailability.SDL_INTERFACE_UNAVAILABLE;
-
- //Initialize _systemCapabilityManager here.
- //_systemCapabilityManager = new SystemCapabilityManager(_internalInterface);
- // Setup SdlConnection
- synchronized(CONNECTION_REFERENCE_LOCK) {
-
- //Handle legacy USB connections
- if (_transportConfig != null
- && TransportType.USB.equals(_transportConfig.getTransportType())) {
- //A USB transport config was provided
- USBTransportConfig usbTransportConfig = (USBTransportConfig) _transportConfig;
- if (usbTransportConfig.getUsbAccessory() == null) {
- DebugTool.logInfo(TAG, "Legacy USB transport config was used, but received null for accessory. Attempting to connect with router service");
- //The accessory was null which means it came from a router service
- MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(usbTransportConfig.getUSBContext(), _appID);
- multiplexTransportConfig.setRequiresHighBandwidth(true);
- multiplexTransportConfig.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
- multiplexTransportConfig.setPrimaryTransports(Collections.singletonList(TransportType.USB));
- multiplexTransportConfig.setSecondaryTransports(new ArrayList<TransportType>());
- _transportConfig = multiplexTransportConfig;
- }
- }
-
- if (_transportConfig != null && _transportConfig.getTransportType().equals(TransportType.MULTIPLEX)) {
- this.sdlSession = new SdlSession(_interfaceBroker, (MultiplexTransportConfig) _transportConfig);
- }else if(_transportConfig != null &&_transportConfig.getTransportType().equals(TransportType.TCP)){
- this.sdlSession = new SdlSession(_interfaceBroker, (TCPTransportConfig) _transportConfig);
- }else {
- throw new SdlException(new UnsupportedOperationException("Unable to create session with supplied transport config"));
- }
- }
-
- synchronized(CONNECTION_REFERENCE_LOCK) {
- this.sdlSession.startSession();
- sendTransportBroadcast();
- }
- }
- /**
- * This method will fake the multiplex connection event
- */
- @SuppressWarnings("unused")
- public void forceOnConnected(){
- synchronized(CONNECTION_REFERENCE_LOCK) {
- if (sdlSession != null) {
- DebugTool.logInfo(TAG, "Forcing on connected.... might actually need this"); //FIXME
- /*if(sdlSession.getSdlConnection()==null){ //There is an issue when switching from v1 to v2+ where the connection is closed. So we restart the session during this call.
- try {
- sdlSession.startSession();
- } catch (SdlException e) {
- e.printStackTrace();
- }
- }
- sdlSession.getSdlConnection().forceHardwareConnectEvent(TransportType.BLUETOOTH);
- */
- }
- }
- }
-
- public void sendTransportBroadcast()
- {
- if (sdlSession == null || _transportConfig == null) return;
-
- String sTransComment = "no";//sdlSession.getBroadcastComment(_transportConfig);
-
- if (sTransComment == null || sTransComment.equals("")) return;
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "initializeProxy");
- updateBroadcastIntent(sendIntent, "COMMENT1", sTransComment);
- sendBroadcastIntent(sendIntent);
- }
-
-
- /**
- * Public method to enable the siphon transport
- */
- @SuppressWarnings("unused")
- public void enableSiphonDebug() {
-
- short enabledPortNumber = SiphonServer.enableSiphonServer();
- String sSiphonPortNumber = "Enabled Siphon Port Number: " + enabledPortNumber;
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "enableSiphonDebug");
- updateBroadcastIntent(sendIntent, "COMMENT1", sSiphonPortNumber);
- sendBroadcastIntent(sendIntent);
- }
-
-
-
- /**
- * Public method to disable the Siphon Trace Server
- */
- @SuppressWarnings("unused")
- public void disableSiphonDebug() {
-
- short disabledPortNumber = SiphonServer.disableSiphonServer();
- if (disabledPortNumber != -1) {
- String sSiphonPortNumber = "Disabled Siphon Port Number: " + disabledPortNumber;
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "disableSiphonDebug");
- updateBroadcastIntent(sendIntent, "COMMENT1", sSiphonPortNumber);
- sendBroadcastIntent(sendIntent);
- }
- }
-
-
-
- /**
- * Public method to enable the Debug Tool
- */
- public static void enableDebugTool() {
- DebugTool.enableDebugTool();
- }
-
- /**
- * Public method to disable the Debug Tool
- */
- public static void disableDebugTool() {
- DebugTool.disableDebugTool();
- }
-
- /**
- * Public method to determine Debug Tool enabled
- */
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public static boolean isDebugEnabled() {
- return DebugTool.isDebugEnabled();
- }
-
-
- /**
- * Check to see if it a transport is available to perform audio streaming.
- * <br><strong>NOTE:</strong> This is only for the audio streaming service, not regular
- * streaming of media playback.
- * @return true if there is either an audio streaming supported
- * transport currently connected or a transport is
- * available to connect with. false if there is no
- * transport connected to support audio streaming and
- * no possibility in the foreseeable future.
- */
- public boolean isAudioStreamTransportAvailable(){
- return sdlSession!= null && sdlSession.isTransportForServiceAvailable(SessionType.PCM);
- }
-
- /**
- * Check to see if it a transport is available to perform video streaming.
-
- * @return true if there is either an video streaming supported
- * transport currently connected or a transport is
- * available to connect with. false if there is no
- * transport connected to support video streaming and
- * no possibility in the foreseeable future.
- */
- public boolean isVideoStreamTransportAvailable(){
- return sdlSession!= null && sdlSession.isTransportForServiceAvailable(SessionType.NAV);
- }
-
-
- @SuppressWarnings("unused")
- @Deprecated
- public void close() throws SdlException {
- dispose();
- }
-
- @SuppressWarnings("UnusedParameters")
- private void cleanProxy(SdlDisconnectedReason disconnectedReason) throws SdlException {
- try {
-
- // ALM Specific Cleanup
- if (_advancedLifecycleManagementEnabled) {
- //_sdlConnectionState = SdlConnectionState.SDL_DISCONNECTED;
-
- firstTimeFull = true;
-
- // Should we wait for the interface to be unregistered?
- Boolean waitForInterfaceUnregistered = false;
- // Unregister app interface
- synchronized(CONNECTION_REFERENCE_LOCK) {
- if (getIsConnected() && getAppInterfaceRegistered()) {
- waitForInterfaceUnregistered = true;
- unregisterAppInterfacePrivate(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
- }
- }
-
- // Wait for the app interface to be unregistered
- if (waitForInterfaceUnregistered) {
- synchronized(APP_INTERFACE_REGISTERED_LOCK) {
- try {
- APP_INTERFACE_REGISTERED_LOCK.wait(3000);
- } catch (InterruptedException e) {
- // Do nothing
- }
- }
- }
- }
-
- if(rpcResponseListeners != null){
- rpcResponseListeners.clear();
- }
- if(rpcNotificationListeners != null){
- rpcNotificationListeners.clear();
- }
-
- // Clean up SDL Connection
- synchronized(CONNECTION_REFERENCE_LOCK) {
- if (sdlSession != null) {
- sdlSession.close();
- }
- }
- } finally {
- SdlTrace.logProxyEvent("SdlProxy cleaned.", SDL_LIB_TRACE_KEY);
- }
- }
-
- /**
- * Check to see if the proxy has already been disposed
- * @return if the proxy has been disposed
- */
- public synchronized boolean isDisposed(){
- return _proxyDisposed;
- }
-
- /**
- * Terminates the App's Interface Registration, closes the transport connection, ends the protocol session, and frees any resources used by the proxy.
- */
- public void dispose() throws SdlException {
- SdlTrace.logProxyEvent("Application called dispose() method.", SDL_LIB_TRACE_KEY);
- disposeInternal(SdlDisconnectedReason.APPLICATION_REQUESTED_DISCONNECT);
- if (taskmaster != null) {
- taskmaster.shutdown();
- }
- }
- /**
- * Terminates the App's Interface Registration, closes the transport connection, ends the protocol session, and frees any resources used by the proxy.
- * @param sdlDisconnectedReason the reason the proxy should be disposed.
- */
- private synchronized void disposeInternal(SdlDisconnectedReason sdlDisconnectedReason) throws SdlException
- {
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- _proxyDisposed = true;
- rpcSecuredServiceStarted = false;
- encryptionRequiredRPCs.clear();
- serviceEncryptionListener = null;
-
- try{
- // Clean the proxy
- cleanProxy(sdlDisconnectedReason);
-
- if (sdlDisconnectedReason == SdlDisconnectedReason.MINIMUM_PROTOCOL_VERSION_HIGHER_THAN_SUPPORTED
- || sdlDisconnectedReason == SdlDisconnectedReason.MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED){
- //We want to notify listeners for this case before disposing the dispatchers
- notifyProxyClosed(sdlDisconnectedReason.toString(), null, sdlDisconnectedReason);
- }
-
- // Close IncomingProxyMessageDispatcher thread
- synchronized(INCOMING_MESSAGE_QUEUE_THREAD_LOCK) {
- if (_incomingProxyMessageDispatcher != null) {
- _incomingProxyMessageDispatcher.dispose();
- _incomingProxyMessageDispatcher = null;
- }
- }
-
- // Close OutgoingProxyMessageDispatcher thread
- synchronized(OUTGOING_MESSAGE_QUEUE_THREAD_LOCK) {
- if (_outgoingProxyMessageDispatcher != null) {
- _outgoingProxyMessageDispatcher.dispose();
- _outgoingProxyMessageDispatcher = null;
- }
- }
-
- // Close InternalProxyMessageDispatcher thread
- synchronized(INTERNAL_MESSAGE_QUEUE_THREAD_LOCK) {
- if (_internalProxyMessageDispatcher != null) {
- _internalProxyMessageDispatcher.dispose();
- _internalProxyMessageDispatcher = null;
- }
- }
-
- _traceDeviceInterrogator = null;
-
- rpcResponseListeners = null;
-
- } finally {
- SdlTrace.logProxyEvent("SdlProxy disposed.", SDL_LIB_TRACE_KEY);
- }
- } // end-method
-
-
- private final static Object CYCLE_LOCK = new Object();
-
- private boolean _cycling = false;
-
- // Method to cycle the proxy, only called in ALM
- protected void cycleProxy(SdlDisconnectedReason disconnectedReason) {
- if (_cycling) return;
-
- synchronized(CYCLE_LOCK)
- {
- try{
- _cycling = true;
- cleanProxy(disconnectedReason);
-
- initializeProxy();
- if(!SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED.equals(disconnectedReason)
- && !SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST.equals(disconnectedReason)){//We don't want to alert higher if we are just cycling for legacy bluetooth
- notifyProxyClosed("Sdl Proxy Cycled", new SdlException("Sdl Proxy Cycled", SdlExceptionCause.SDL_PROXY_CYCLED), disconnectedReason);
- }
- }
- catch (SdlException e) {
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "cycleProxy");
- updateBroadcastIntent(sendIntent, "COMMENT1", "Proxy cycled, exception cause: " + e.getSdlExceptionCause());
- sendBroadcastIntent(sendIntent);
-
- switch(e.getSdlExceptionCause()) {
- case BLUETOOTH_DISABLED:
- notifyProxyClosed("Bluetooth is disabled. Bluetooth must be enabled to connect to SDL. Reattempt a connection once Bluetooth is enabled.",
- new SdlException("Bluetooth is disabled. Bluetooth must be enabled to connect to SDL. Reattempt a connection once Bluetooth is enabled.", SdlExceptionCause.BLUETOOTH_DISABLED), SdlDisconnectedReason.BLUETOOTH_DISABLED);
- break;
- case BLUETOOTH_ADAPTER_NULL:
- notifyProxyClosed("Cannot locate a Bluetooth adapater. A SDL connection is impossible on this device until a Bluetooth adapter is added.",
- new SdlException("Cannot locate a Bluetooth adapater. A SDL connection is impossible on this device until a Bluetooth adapter is added.", SdlExceptionCause.BLUETOOTH_ADAPTER_NULL), SdlDisconnectedReason.BLUETOOTH_ADAPTER_ERROR);
- break;
- default :
- notifyProxyClosed("Cycling the proxy failed.", e, SdlDisconnectedReason.GENERIC_ERROR);
- break;
- }
- } catch (Exception e) {
- notifyProxyClosed("Cycling the proxy failed.", e, SdlDisconnectedReason.GENERIC_ERROR);
- }
- _cycling = false;
- }
- }
-
-
-
- /************* Functions used by the Message Dispatching Queues ****************/
- private void dispatchIncomingMessage(ProtocolMessage message) {
- try{
- // Dispatching logic
- if (message.getSessionType().equals(SessionType.RPC)
- ||message.getSessionType().equals(SessionType.BULK_DATA) ) {
- try {
- if (protocolVersion!= null && protocolVersion.getMajor() == 1 && message.getVersion() > 1) {
- if(sdlSession != null
- && sdlSession.getProtocolVersion()!= null
- && sdlSession.getProtocolVersion().getMajor() > 1){
- setProtocolVersion(sdlSession.getProtocolVersion());
- }else{
- setProtocolVersion(new Version(message.getVersion(),0,0));
- }
- }
-
- Hashtable<String, Object> hash = new Hashtable<String, Object>();
- if (protocolVersion!= null && protocolVersion.getMajor() > 1) {
- Hashtable<String, Object> hashTemp = new Hashtable<String, Object>();
- hashTemp.put(RPCMessage.KEY_CORRELATION_ID, message.getCorrID());
- if (message.getJsonSize() > 0) {
- final Hashtable<String, Object> mhash = JsonRPCMarshaller.unmarshall(message.getData());
- //hashTemp.put(Names.parameters, mhash.get(Names.parameters));
- if (mhash != null) {
- hashTemp.put(RPCMessage.KEY_PARAMETERS, mhash);
- }
- }
-
- String functionName = FunctionID.getFunctionName(message.getFunctionID());
- if (functionName != null) {
- hashTemp.put(RPCMessage.KEY_FUNCTION_NAME, functionName);
- } else {
- DebugTool.logWarning(TAG, "Dispatch Incoming Message - function name is null unknown RPC. FunctionId: " + message.getFunctionID());
- return;
- }
- if (message.getRPCType() == 0x00) {
- hash.put(RPCMessage.KEY_REQUEST, hashTemp);
- } else if (message.getRPCType() == 0x01) {
- hash.put(RPCMessage.KEY_RESPONSE, hashTemp);
- } else if (message.getRPCType() == 0x02) {
- hash.put(RPCMessage.KEY_NOTIFICATION, hashTemp);
- }
- if (message.getBulkData() != null) hash.put(RPCStruct.KEY_BULK_DATA, message.getBulkData());
- if (message.getPayloadProtected()) hash.put(RPCStruct.KEY_PROTECTED, true);
- } else {
- hash = JsonRPCMarshaller.unmarshall(message.getData());
- }
- handleRPCMessage(hash);
- } catch (final Exception excp) {
- DebugTool.logError(TAG, "Failure handling protocol message: " + excp.toString(), excp);
- passErrorToProxyListener("Error handing incoming protocol message.", excp);
- } // end-catch
- } //else { Handle other protocol message types here}
- } catch (final Exception e) {
- // Pass error to application through listener
- DebugTool.logError(TAG, "Error handing proxy event.", e);
- passErrorToProxyListener("Error handing incoming protocol message.", e);
- }
- }
-
- /**
- * Get the SDL protocol spec version being used
- * @return Version of the protocol spec
- */
- public @NonNull Version getProtocolVersion(){
- if(this.protocolVersion == null){
- this.protocolVersion = new Version(1,0,0);
- }
- return this.protocolVersion;
- }
-
- private void setProtocolVersion(@NonNull Version version) {
- this.protocolVersion = version;
- }
-
- public String serializeJSON(RPCMessage msg)
- {
- try
- {
- return msg.serializeJSON((byte)this.getProtocolVersion().getMajor()).toString(2);
- }
- catch (final Exception e)
- {
- DebugTool.logError(TAG, "Error handing proxy event.", e);
- passErrorToProxyListener("Error serializing message.", e);
- return null;
- }
- }
-
- private void handleErrorsFromIncomingMessageDispatcher(String info, Exception e) {
- passErrorToProxyListener(info, e);
- }
-
- private void dispatchOutgoingMessage(ProtocolMessage message) {
- synchronized(CONNECTION_REFERENCE_LOCK) {
- if (sdlSession != null) {
- sdlSession.sendMessage(message);
- }
- }
- SdlTrace.logProxyEvent("SdlProxy sending Protocol Message: " + message.toString(), SDL_LIB_TRACE_KEY);
- }
-
- private void handleErrorsFromOutgoingMessageDispatcher(String info, Exception e) {
- passErrorToProxyListener(info, e);
- }
-
- void dispatchInternalMessage(final InternalProxyMessage message) {
- try{
- switch (message.getFunctionName()) {
- case InternalProxyMessage.OnProxyError: {
- final OnError msg = (OnError) message;
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onError(msg.getInfo(), msg.getException());
- }
- });
- } else {
- _proxyListener.onError(msg.getInfo(), msg.getException());
- }
- break;
- }
- case InternalProxyMessage.OnServiceEnded: {
- final OnServiceEnded msg = (OnServiceEnded) message;
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onServiceEnded(msg);
- }
- });
- } else {
- _proxyListener.onServiceEnded(msg);
- }
- break;
- }
- case InternalProxyMessage.OnServiceNACKed: {
- final OnServiceNACKed msg = (OnServiceNACKed) message;
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onServiceNACKed(msg);
- }
- });
- } else {
- _proxyListener.onServiceNACKed(msg);
- }
-
- /* *************Start Legacy Specific Call-backs************/
- break;
- }
- case InternalProxyMessage.OnProxyOpened:
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- ((IProxyListener) _proxyListener).onProxyOpened();
- }
- });
- } else {
- ((IProxyListener) _proxyListener).onProxyOpened();
- }
- break;
- case InternalProxyMessage.OnProxyClosed: {
- final OnProxyClosed msg = (OnProxyClosed) message;
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onProxyClosed(msg.getInfo(), msg.getException(), msg.getReason());
- }
- });
- } else {
- _proxyListener.onProxyClosed(msg.getInfo(), msg.getException(), msg.getReason());
- }
- /* ***************End Legacy Specific Call-backs************/
- break;
- }
- default:
- // Diagnostics
- SdlTrace.logProxyEvent("Unknown RPC Message encountered. Check for an updated version of the SDL Proxy.", SDL_LIB_TRACE_KEY);
- DebugTool.logError(TAG, "Unknown RPC Message encountered. Check for an updated version of the SDL Proxy.");
- break;
- }
-
- SdlTrace.logProxyEvent("Proxy fired callback: " + message.getFunctionName(), SDL_LIB_TRACE_KEY);
- } catch(final Exception e) {
- // Pass error to application through listener
- DebugTool.logError(TAG, "Error handing proxy event.", e);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onError("Error handing proxy event.", e);
- }
- });
- } else {
- _proxyListener.onError("Error handing proxy event.", e);
- }
- }
- }
-
- private void handleErrorsFromInternalMessageDispatcher(String info, Exception e) {
- DebugTool.logError(TAG, info, e);
- // This error cannot be passed to the user, as it indicates an error
- // in the communication between the proxy and the application.
-
- DebugTool.logError(TAG, "InternalMessageDispatcher failed.", e);
-
- // Note, this is the only place where the _proxyListener should be referenced asdlhronously,
- // with an error on the internalMessageDispatcher, we have no other reliable way of
- // communicating with the application.
- notifyProxyClosed("Proxy callback dispatcher is down. Proxy instance is invalid.", e, SdlDisconnectedReason.GENERIC_ERROR);
- _proxyListener.onError("Proxy callback dispatcher is down. Proxy instance is invalid.", e);
- }
- /************* END Functions used by the Message Dispatching Queues ****************/
-
-
- private OnRPCNotificationListener onPermissionsChangeListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- List<PermissionItem> permissionItems = ((OnPermissionsChange) notification).getPermissionItem();
- Boolean requireEncryptionAppLevel = ((OnPermissionsChange) notification).getRequireEncryption();
- encryptionRequiredRPCs.clear();
- if (requireEncryptionAppLevel == null || requireEncryptionAppLevel) {
- if (permissionItems != null && !permissionItems.isEmpty()) {
- for (PermissionItem permissionItem : permissionItems) {
- if (permissionItem != null && Boolean.TRUE.equals(permissionItem.getRequireEncryption())) {
- String rpcName = permissionItem.getRpcName();
- if (rpcName != null) {
- encryptionRequiredRPCs.add(rpcName);
- }
- }
- }
- }
- checkStatusAndInitSecuredService();
- }
- }
- };
-
- private ISdlServiceListener securedServiceListener = new ISdlServiceListener() {
- @Override
- public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
- if(_proxyDisposed){
- DebugTool.logInfo(TAG, "Ignoring start service packet, proxy is disposed");
- return;
- }
- if(SessionType.RPC.equals(type)){
- rpcSecuredServiceStarted = isEncrypted;
- }
- if (serviceEncryptionListener != null) {
- serviceEncryptionListener.onEncryptionServiceUpdated(type, isEncrypted, null);
- }
- DebugTool.logInfo(TAG, "onServiceStarted, session Type: " + type.getName() + ", isEncrypted: " + isEncrypted);
- }
-
- @Override
- public void onServiceEnded(SdlSession session, SessionType type) {
- if(_proxyDisposed){
- DebugTool.logInfo(TAG, "Ignoring end service packet, proxy is disposed");
- return;
- }
- if (SessionType.RPC.equals(type)) {
- rpcSecuredServiceStarted = false;
- }
- if (serviceEncryptionListener != null) {
- serviceEncryptionListener.onEncryptionServiceUpdated(type, false, null);
- }
- DebugTool.logInfo(TAG, "onServiceEnded, session Type: " + type.getName());
- }
-
- @Override
- public void onServiceError(SdlSession session, SessionType type, String reason) {
- if(_proxyDisposed){
- DebugTool.logInfo(TAG, "Ignoring start service error, proxy is disposed");
- return;
- }
- if (SessionType.RPC.equals(type)) {
- rpcSecuredServiceStarted = false;
- }
- if (serviceEncryptionListener != null) {
- serviceEncryptionListener.onEncryptionServiceUpdated(type, false, "onServiceError: " + reason);
- }
- DebugTool.logError(TAG, "onServiceError, session Type: " + type.getName() + ", reason: " + reason);
- }
- };
-
- /**
- * Checks if an RPC requires encryption
- *
- * @param rpcName the rpc name (FunctionID) to check
- * @return true if the given RPC requires encryption; false, otherwise
- */
- public boolean getRPCRequiresEncryption(@NonNull FunctionID rpcName) {
- return encryptionRequiredRPCs.contains(rpcName.toString());
- }
-
- /**
- * Gets the encryption requirement
- * @return true if encryption is required; false otherwise
- */
- public boolean getRequiresEncryption() {
- return !encryptionRequiredRPCs.isEmpty();
- }
-
- private void checkStatusAndInitSecuredService() {
- if ((_hmiLevel != null && _hmiLevel != HMILevel.HMI_NONE) && getRequiresEncryption() && !rpcSecuredServiceStarted) {
- startProtectedRPCService();
- }
- }
-
- // Private sendRPCMessagePrivate method. All RPCMessages are funneled through this method after error checking.
- protected void sendRPCMessagePrivate(RPCMessage message) throws SdlException {
- try {
- SdlTrace.logRPCEvent(InterfaceActivityDirection.Transmit, message, SDL_LIB_TRACE_KEY);
-
- //FIXME this is temporary until the next major release of the library where OK is removed
- if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
- RPCRequest request = (RPCRequest) message;
- if (FunctionID.SUBSCRIBE_BUTTON.toString().equals(request.getFunctionName())
- || FunctionID.UNSUBSCRIBE_BUTTON.toString().equals(request.getFunctionName())
- || FunctionID.BUTTON_PRESS.toString().equals(request.getFunctionName())) {
-
- ButtonName buttonName = (ButtonName) request.getObject(ButtonName.class, SubscribeButton.KEY_BUTTON_NAME);
-
-
- if (rpcSpecVersion != null) {
- if (rpcSpecVersion.getMajor() < 5) {
-
- if (ButtonName.PLAY_PAUSE.equals(buttonName)) {
- request.setParameters(SubscribeButton.KEY_BUTTON_NAME, ButtonName.OK);
- }
- } else { //Newer than version 5.0.0
- if (ButtonName.OK.equals(buttonName)) {
- RPCRequest request2 = new RPCRequest(request);
- request2.setParameters(SubscribeButton.KEY_BUTTON_NAME, ButtonName.PLAY_PAUSE);
- request2.setOnRPCResponseListener(request.getOnRPCResponseListener());
- sendRPCMessagePrivate(request2);
- return;
- }
- }
- }
-
- }
- }
-
- message.format(rpcSpecVersion,true);
- byte[] msgBytes = JsonRPCMarshaller.marshall(message, (byte)getProtocolVersion().getMajor());
-
- ProtocolMessage pm = new ProtocolMessage();
- pm.setData(msgBytes);
- pm.setMessageType(MessageType.RPC);
- pm.setSessionType(SessionType.RPC);
- pm.setFunctionID(FunctionID.getFunctionId(message.getFunctionName()));
- if (rpcSecuredServiceStarted && getRPCRequiresEncryption(message.getFunctionID())) {
- pm.setPayloadProtected(true);
- } else {
- pm.setPayloadProtected(message.isPayloadProtected());
- }
- if (pm.getPayloadProtected() && (!rpcSecuredServiceStarted || !rpcProtectedStartResponse)){
- String errorInfo = "Trying to send an encrypted message and there is no secured service";
- if (message.getMessageType().equals((RPCMessage.KEY_REQUEST))) {
- RPCRequest request = (RPCRequest) message;
- OnRPCResponseListener listener = ((RPCRequest) message).getOnRPCResponseListener();
- if (listener != null) {
- GenericResponse response = new GenericResponse(false, Result.REJECTED);
- response.setInfo(errorInfo);
- listener.onResponse(request.getCorrelationID(), response);
- }
- }
- DebugTool.logWarning(TAG, errorInfo);
- return;
- }
-
- if (sdlSession != null) {
- pm.setSessionID((byte)sdlSession.getSessionId());
- }
-
- if (message.getBulkData() != null) {
- pm.setBulkData(message.getBulkData());
- }
-
-
- if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) { // Request Specifics
- pm.setRPCType((byte)0x00);
- RPCRequest request = (RPCRequest) message;
- if (request.getCorrelationID() == null) {
- //Log error here
- throw new SdlException("CorrelationID cannot be null. RPC: " + request.getFunctionName(), SdlExceptionCause.INVALID_ARGUMENT);
- } else {
- pm.setCorrID(request.getCorrelationID());
- }
- if (request.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.name())) {
- pm.setPriorityCoefficient(1);
- }
- } else if (message.getMessageType().equals(RPCMessage.KEY_RESPONSE)) { // Response Specifics
- pm.setRPCType((byte)0x01);
- RPCResponse response = (RPCResponse) message;
- if (response.getCorrelationID() == null) {
- //Log error here
- throw new SdlException("CorrelationID cannot be null. RPC: " + response.getFunctionName(), SdlExceptionCause.INVALID_ARGUMENT);
- } else {
- pm.setCorrID(response.getCorrelationID());
- }
- } else if (message.getMessageType().equals(RPCMessage.KEY_NOTIFICATION)) { // Notification Specifics
- pm.setRPCType((byte)0x02);
- } else {
- //Log error here
- throw new SdlException("RPC message is not a valid type", SdlExceptionCause.INVALID_ARGUMENT);
- }
-
- // Queue this outgoing message
- synchronized(OUTGOING_MESSAGE_QUEUE_THREAD_LOCK) {
- if (_outgoingProxyMessageDispatcher != null) {
- _outgoingProxyMessageDispatcher.queueMessage(pm);
- //Since the message is queued we can add it's listener to our list, if it is a Request
- if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
- RPCRequest request = (RPCRequest) message;
- OnRPCResponseListener listener = request.getOnRPCResponseListener();
- addOnRPCResponseListener(listener, request.getCorrelationID(), msgBytes.length);
- }
- }
- }
- } catch (OutOfMemoryError e) {
- SdlTrace.logProxyEvent("OutOfMemory exception while sending message " + message.getFunctionName(), SDL_LIB_TRACE_KEY);
- throw new SdlException("OutOfMemory exception while sending message " + message.getFunctionName(), e, SdlExceptionCause.INVALID_ARGUMENT);
- }
- }
-
- /**
- * Will provide callback to the listener either onFinish or onError depending on the RPCResponses result code,
- * <p>Will automatically remove the listener for the list of listeners on completion.
- * @param msg The RPCResponse message that was received
- * @return if a listener was called or not
- */
- @SuppressWarnings("UnusedReturnValue")
- private boolean onRPCResponseReceived(RPCResponse msg){
- synchronized(ON_UPDATE_LISTENER_LOCK){
- int correlationId = msg.getCorrelationID();
- if(rpcResponseListeners !=null
- && rpcResponseListeners.indexOfKey(correlationId)>=0){
- OnRPCResponseListener listener = rpcResponseListeners.get(correlationId);
- listener.onResponse(correlationId, msg);
- rpcResponseListeners.remove(correlationId);
- return true;
- }
- return false;
- }
- }
-
-/**
- * Add a listener that will receive the response to the specific RPCRequest sent with the corresponding correlation id
- * @param listener that will get called back when a response is received
- * @param correlationId of the RPCRequest that was sent
- * @param totalSize only include if this is an OnPutFileUpdateListener. Otherwise it will be ignored.
- */
- public void addOnRPCResponseListener(OnRPCResponseListener listener,int correlationId, int totalSize){
- synchronized(ON_UPDATE_LISTENER_LOCK){
- if(rpcResponseListeners!=null
- && listener !=null){
- listener.onStart(correlationId);
- rpcResponseListeners.put(correlationId, listener);
- }
- }
- }
-
- @SuppressWarnings("unused")
- public SparseArray<OnRPCResponseListener> getResponseListeners(){
- synchronized(ON_UPDATE_LISTENER_LOCK){
- return this.rpcResponseListeners;
- }
- }
-
- @SuppressWarnings("UnusedReturnValue")
- public boolean onRPCNotificationReceived(RPCNotification notification){
- synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- CopyOnWriteArrayList<OnRPCNotificationListener> listeners = rpcNotificationListeners.get(FunctionID.getFunctionId(notification.getFunctionName()));
- if(listeners!=null && listeners.size()>0) {
- for (OnRPCNotificationListener listener : listeners) {
- listener.onNotified(notification);
- }
- return true;
- }
- return false;
- }
- }
-
- @SuppressWarnings("UnusedReturnValue")
- public boolean onRPCReceived(RPCMessage message){
- synchronized(RPC_LISTENER_LOCK){
- CopyOnWriteArrayList<OnRPCListener> listeners = rpcListeners.get(FunctionID.getFunctionId(message.getFunctionName()));
- if(listeners!=null && listeners.size()>0) {
- for (OnRPCListener listener : listeners) {
- listener.onReceived(message);
- }
- return true;
- }
- return false;
- }
- }
-
- @SuppressWarnings("UnusedReturnValue")
- public boolean onRPCRequestReceived(RPCRequest request){
- synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- CopyOnWriteArrayList<OnRPCRequestListener> listeners = rpcRequestListeners.get(FunctionID.getFunctionId(request.getFunctionName()));
- if(listeners!=null && listeners.size()>0) {
- for (OnRPCRequestListener listener : listeners) {
- listener.onRequest(request);
- }
- return true;
- }
- return false;
- }
- }
-
- /**
- * This will ad a listener for the specific type of notification. As of now it will only allow
- * a single listener per notification function id
- * @param notificationId The notification type that this listener is designated for
- * @param listener The listener that will be called when a notification of the provided type is received
- */
- @SuppressWarnings("unused")
- public void addOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener){
- synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- if(notificationId != null && listener != null){
- if(rpcNotificationListeners.indexOfKey(notificationId.getId()) < 0 ){
- rpcNotificationListeners.put(notificationId.getId(),new CopyOnWriteArrayList<OnRPCNotificationListener>());
- }
- rpcNotificationListeners.get(notificationId.getId()).add(listener);
- }
- }
- }
-
- /**
- * This will add a listener for the specific type of message. As of now it will only allow
- * a single listener per request function id
- * @param messageId The message type that this listener is designated for
- * @param listener The listener that will be called when a request of the provided type is received
- */
- @SuppressWarnings("unused")
- public void addOnRPCListener(FunctionID messageId, OnRPCListener listener){
- synchronized(RPC_LISTENER_LOCK){
- if(messageId != null && listener != null){
- if(rpcListeners.indexOfKey(messageId.getId()) < 0 ){
- rpcListeners.put(messageId.getId(),new CopyOnWriteArrayList<OnRPCListener>());
- }
- rpcListeners.get(messageId.getId()).add(listener);
- }
- }
- }
-
- public boolean removeOnRPCListener(FunctionID messageId, OnRPCListener listener){
- synchronized(RPC_LISTENER_LOCK){
- if(rpcListeners!= null
- && messageId != null
- && listener != null
- && rpcListeners.indexOfKey(messageId.getId()) >= 0){
- return rpcListeners.get(messageId.getId()).remove(listener);
- }
- }
- return false;
- }
-
- /**
- * This will add a listener for the specific type of request. As of now it will only allow
- * a single listener per request function id
- * @param requestId The request type that this listener is designated for
- * @param listener The listener that will be called when a request of the provided type is received
- */
- @SuppressWarnings("unused")
- public void addOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
- synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- if(requestId != null && listener != null){
- if(rpcRequestListeners.indexOfKey(requestId.getId()) < 0 ){
- rpcRequestListeners.put(requestId.getId(),new CopyOnWriteArrayList<OnRPCRequestListener>());
- }
- rpcRequestListeners.get(requestId.getId()).add(listener);
- }
- }
- }
-
- /**
- * This method is no longer valid and will not remove the listener for the supplied notificaiton id
- * @param notificationId n/a
- * @see #removeOnRPCNotificationListener(FunctionID, OnRPCNotificationListener)
- */
- @SuppressWarnings("unused")
- @Deprecated
- public void removeOnRPCNotificationListener(FunctionID notificationId){
- synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- //rpcNotificationListeners.delete(notificationId.getId());
- }
- }
-
- public boolean removeOnRPCNotificationListener(FunctionID notificationId, OnRPCNotificationListener listener){
- synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- if(rpcNotificationListeners!= null
- && notificationId != null
- && listener != null
- && rpcNotificationListeners.indexOfKey(notificationId.getId()) >= 0){
- return rpcNotificationListeners.get(notificationId.getId()).remove(listener);
- }
- }
- return false;
- }
-
- public boolean removeOnRPCRequestListener(FunctionID requestId, OnRPCRequestListener listener){
- synchronized(ON_NOTIFICATION_LISTENER_LOCK){
- if(rpcRequestListeners!= null
- && requestId != null
- && listener != null
- && rpcRequestListeners.indexOfKey(requestId.getId()) >= 0){
- return rpcRequestListeners.get(requestId.getId()).remove(listener);
- }
- }
- return false;
- }
-
- private void processRaiResponse(RegisterAppInterfaceResponse rai)
- {
- if (rai == null) return;
-
- this.raiResponse = rai;
-
- VehicleType vt = rai.getVehicleType();
- if (vt == null) return;
-
- String make = vt.getMake();
- if (make == null) return;
-
- if (_secList == null) return;
-
- SdlSecurityBase sec;
- Service svc = getService();
- SdlSecurityBase.setAppService(svc);
- if (svc != null && svc.getApplicationContext() != null){
- SdlSecurityBase.setContext(svc.getApplicationContext());
- } else {
- SdlSecurityBase.setContext(_appContext);
- }
-
- for (Class<? extends SdlSecurityBase> cls : _secList)
- {
- try
- {
- sec = cls.newInstance();
- }
- catch (Exception e)
- {
- continue;
- }
-
- if ( (sec != null) && (sec.getMakeList() != null) )
- {
- if (sec.getMakeList().contains(make))
- {
- setSdlSecurity(sec);
- sec.setAppId(_appID);
- if (sdlSession != null)
- sec.handleSdlSession(sdlSession);
- return;
- }
- }
- }
- }
-
- private void handleRPCMessage(Hashtable<String, Object> hash) {
-
- if (hash == null){
- DebugTool.logError(TAG, "handleRPCMessage: hash is null, returning.");
- return;
- }
-
- RPCMessage rpcMsg = RpcConverter.convertTableToRpc(hash);
-
- if (rpcMsg == null){
- DebugTool.logError(TAG, "handleRPCMessage: rpcMsg is null, returning.");
- return;
- }
-
- SdlTrace.logRPCEvent(InterfaceActivityDirection.Receive, rpcMsg, SDL_LIB_TRACE_KEY);
-
- String functionName = rpcMsg.getFunctionName();
- String messageType = rpcMsg.getMessageType();
-
- rpcMsg.format(rpcSpecVersion, true);
-
- onRPCReceived(rpcMsg); // Should only be called for internal use
-
- // Requests need to be listened for using the SDLManager's addOnRPCRequestListener method.
- // Requests are not supported by IProxyListenerBase
- if (messageType.equals(RPCMessage.KEY_REQUEST)) {
-
- onRPCRequestReceived((RPCRequest) rpcMsg);
-
- } else if (messageType.equals(RPCMessage.KEY_RESPONSE)) {
- // Check to ensure response is not from an internal message (reserved correlation ID)
- if (isCorrelationIDProtected((new RPCResponse(hash)).getCorrelationID())) {
- // This is a response generated from an internal message, it can be trapped here
- // The app should not receive a response for a request it did not send
- if ((new RPCResponse(hash)).getCorrelationID() == REGISTER_APP_INTERFACE_CORRELATION_ID
- && _advancedLifecycleManagementEnabled
- && functionName.equals(FunctionID.REGISTER_APP_INTERFACE.toString())) {
- final RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (msg.getSuccess()) {
- _appInterfaceRegisterd = true;
- }
- processRaiResponse(msg);
-
- //Populate the system capability manager with the RAI response
- //_systemCapabilityManager.parseRAIResponse(msg);
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.REGISTER_APP_INTERFACE.toString());
- updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
- updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
- updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
- updateBroadcastIntent(sendIntent, "COMMENT2", msg.getResultCode().toString());
- updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
- updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
- sendBroadcastIntent(sendIntent);
-
- //_autoActivateIdReturned = msg.getAutoActivateID();
- /*Place holder for legacy support*/ _autoActivateIdReturned = "8675309";
- _prerecordedSpeech = msg.getPrerecordedSpeech();
- _sdlLanguage = msg.getLanguage();
- _hmiDisplayLanguage = msg.getHmiDisplayLanguage();
- _sdlMsgVersion = msg.getSdlMsgVersion();
- if(_sdlMsgVersion != null){
- rpcSpecVersion = new com.smartdevicelink.util.Version(_sdlMsgVersion.getMajorVersion(),_sdlMsgVersion.getMinorVersion(), _sdlMsgVersion.getPatchVersion());
- }else{
- rpcSpecVersion = MAX_SUPPORTED_RPC_VERSION;
- }
- DebugTool.logInfo(TAG, "Negotiated RPC Spec version = " + rpcSpecVersion);
-
- _vehicleType = msg.getVehicleType();
- _systemSoftwareVersion = msg.getSystemSoftwareVersion();
- _proxyVersionInfo = BuildConfig.VERSION_NAME;
- _iconResumed = msg.getIconResumed();
-
- if (_iconResumed == null){
- _iconResumed = false;
- }
-
- if (_bAppResumeEnabled)
- {
- if ( (_sdlMsgVersion.getMajorVersion() > 2) && (_lastHashID != null) && (msg.getSuccess()) && (msg.getResultCode() != Result.RESUME_FAILED) )
- _bResumeSuccess = true;
- else
- {
- _bResumeSuccess = false;
- _lastHashID = null;
- }
- }
- _diagModes = msg.getSupportedDiagModes();
-
- String sVersionInfo = "SDL Proxy Version: " + _proxyVersionInfo;
-
- if (!isDebugEnabled())
- {
- enableDebugTool();
- DebugTool.logInfo(TAG, sVersionInfo, false);
- disableDebugTool();
- }
- else
- DebugTool.logInfo(TAG, sVersionInfo, false);
-
- sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "RAI_RESPONSE");
- updateBroadcastIntent(sendIntent, "COMMENT1", sVersionInfo);
- sendBroadcastIntent(sendIntent);
-
- // Send onSdlConnected message in ALM
- //_sdlConnectionState = SdlConnectionState.SDL_CONNECTED;
-
- // If registerAppInterface failed, exit with OnProxyUnusable
- if (!msg.getSuccess()) {
- notifyProxyClosed("Unable to register app interface. Review values passed to the SdlProxy constructor. RegisterAppInterface result code: ",
- new SdlException("Unable to register app interface. Review values passed to the SdlProxy constructor. RegisterAppInterface result code: " + msg.getResultCode(), SdlExceptionCause.SDL_REGISTRATION_ERROR), SdlDisconnectedReason.SDL_REGISTRATION_ERROR);
- }
-
- //If the RPC version is too low we should simply dispose this proxy
- if (minimumRPCVersion != null && minimumRPCVersion.isNewerThan(rpcSpecVersion) == 1) {
- DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum RPC version %s is greater than the supported RPC version %s", minimumRPCVersion, rpcSpecVersion));
- try {
- disposeInternal(SdlDisconnectedReason.MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- return;
- }
-
-
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- if (_proxyListener instanceof IProxyListener) {
- ((IProxyListener)_proxyListener).onRegisterAppInterfaceResponse(msg);
- }
- onRPCResponseReceived(msg);
- }
- });
- } else {
- if (_proxyListener instanceof IProxyListener) {
- ((IProxyListener)_proxyListener).onRegisterAppInterfaceResponse(msg);
- }
- onRPCResponseReceived(msg);
- }
- } else if ((new RPCResponse(hash)).getCorrelationID() == POLICIES_CORRELATION_ID
- && functionName.equals(FunctionID.ON_ENCODED_SYNC_P_DATA.toString())) {
-
- DebugTool.logInfo(TAG, "POLICIES_CORRELATION_ID SystemRequest Notification (Legacy)");
-
- final OnSystemRequest msg = new OnSystemRequest(hash);
-
- // If url is not null, then send to URL
- if ( (msg.getUrl() != null) )
- {
- // URL has data, attempt to post request to external server
- Thread handleOffboardTransmissionThread = new Thread() {
- @Override
- public void run() {
- sendOnSystemRequestToUrl(msg);
- }
- };
-
- handleOffboardTransmissionThread.start();
- }
- }
- else if ((new RPCResponse(hash)).getCorrelationID() == POLICIES_CORRELATION_ID
- && functionName.equals(FunctionID.ENCODED_SYNC_P_DATA.toString())) {
-
- DebugTool.logInfo(TAG, "POLICIES_CORRELATION_ID SystemRequest Response (Legacy)");
- final SystemRequestResponse msg = new SystemRequestResponse(hash);
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
- updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
- updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
- updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
- updateBroadcastIntent(sendIntent, "COMMENT2", msg.getResultCode().toString());
- updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
- sendBroadcastIntent(sendIntent);
- }
- else if ((new RPCResponse(hash)).getCorrelationID() == POLICIES_CORRELATION_ID
- && functionName.equals(FunctionID.SYSTEM_REQUEST.toString())) {
- final SystemRequestResponse msg = new SystemRequestResponse(hash);
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
- updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
- updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
- updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
- updateBroadcastIntent(sendIntent, "COMMENT2", msg.getResultCode().toString());
- updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
- updateBroadcastIntent(sendIntent, "DATA", serializeJSON(msg));
- sendBroadcastIntent(sendIntent);
- }
- else if (functionName.equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
- // UnregisterAppInterface
- _appInterfaceRegisterd = false;
- synchronized(APP_INTERFACE_REGISTERED_LOCK) {
- APP_INTERFACE_REGISTERED_LOCK.notify();
- }
- final UnregisterAppInterfaceResponse msg = new UnregisterAppInterfaceResponse(hash);
- msg.format(rpcSpecVersion, true);
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE.toString());
- updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
- updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
- updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
- updateBroadcastIntent(sendIntent, "COMMENT2", msg.getResultCode().toString());
- updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
- updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
- sendBroadcastIntent(sendIntent);
- }
- return;
- }
-
- if (functionName.equals(FunctionID.REGISTER_APP_INTERFACE.toString())) {
- final RegisterAppInterfaceResponse msg = new RegisterAppInterfaceResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (msg.getSuccess()) {
- _appInterfaceRegisterd = true;
- }
- processRaiResponse(msg);
- //Populate the system capability manager with the RAI response
- //_systemCapabilityManager.parseRAIResponse(msg);
-
- //_autoActivateIdReturned = msg.getAutoActivateID();
- /*Place holder for legacy support*/ _autoActivateIdReturned = "8675309";
- _prerecordedSpeech = msg.getPrerecordedSpeech();
- _sdlLanguage = msg.getLanguage();
- _hmiDisplayLanguage = msg.getHmiDisplayLanguage();
- _sdlMsgVersion = msg.getSdlMsgVersion();
- if(_sdlMsgVersion != null){
- rpcSpecVersion = new com.smartdevicelink.util.Version(_sdlMsgVersion.getMajorVersion(),_sdlMsgVersion.getMinorVersion(), _sdlMsgVersion.getPatchVersion());
- } else {
- rpcSpecVersion = MAX_SUPPORTED_RPC_VERSION;
- }
- DebugTool.logInfo(TAG, "Negotiated RPC Spec version = " + rpcSpecVersion);
-
- _vehicleType = msg.getVehicleType();
- _systemSoftwareVersion = msg.getSystemSoftwareVersion();
- _proxyVersionInfo = BuildConfig.VERSION_NAME;
-
- if (_bAppResumeEnabled)
- {
- if ( (_sdlMsgVersion.getMajorVersion() > 2) && (_lastHashID != null) && (msg.getSuccess()) && (msg.getResultCode() != Result.RESUME_FAILED) )
- _bResumeSuccess = true;
- else
- {
- _bResumeSuccess = false;
- _lastHashID = null;
- }
- }
-
- _diagModes = msg.getSupportedDiagModes();
-
- if (!isDebugEnabled())
- {
- enableDebugTool();
- DebugTool.logInfo(TAG, "SDL Proxy Version: " + _proxyVersionInfo);
- disableDebugTool();
- }
- else
- DebugTool.logInfo(TAG, "SDL Proxy Version: " + _proxyVersionInfo);
-
- // RegisterAppInterface
- if (_advancedLifecycleManagementEnabled) {
-
- // Send onSdlConnected message in ALM
- //_sdlConnectionState = SdlConnectionState.SDL_CONNECTED;
-
- // If registerAppInterface failed, exit with OnProxyUnusable
- if (!msg.getSuccess()) {
- notifyProxyClosed("Unable to register app interface. Review values passed to the SdlProxy constructor. RegisterAppInterface result code: ",
- new SdlException("Unable to register app interface. Review values passed to the SdlProxy constructor. RegisterAppInterface result code: " + msg.getResultCode(), SdlExceptionCause.SDL_REGISTRATION_ERROR), SdlDisconnectedReason.SDL_REGISTRATION_ERROR);
- }
- //If the RPC version is too low we should simply dispose this proxy
- if (minimumRPCVersion != null && minimumRPCVersion.isNewerThan(rpcSpecVersion) == 1) {
- DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum RPC version %s is greater than the supported RPC version %s", minimumRPCVersion, rpcSpecVersion));
- try {
- disposeInternal(SdlDisconnectedReason.MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- return;
- }
- } else {
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- if (_proxyListener instanceof IProxyListener) {
- ((IProxyListener)_proxyListener).onRegisterAppInterfaceResponse(msg);
- }
- onRPCResponseReceived(msg);
- }
- });
- } else {
- if (_proxyListener instanceof IProxyListener) {
- ((IProxyListener)_proxyListener).onRegisterAppInterfaceResponse(msg);
- }
- onRPCResponseReceived(msg);
- }
- }
- } else if (functionName.equals(FunctionID.SPEAK.toString())) {
- // SpeakResponse
-
- final SpeakResponse msg = new SpeakResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSpeakResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSpeakResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ALERT.toString())) {
- // AlertResponse
-
- final AlertResponse msg = new AlertResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onAlertResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onAlertResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SHOW.toString())) {
- // ShowResponse
-
- final ShowResponse msg = new ShowResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onShowResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onShowResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ADD_COMMAND.toString())) {
- // AddCommand
-
- final AddCommandResponse msg = new AddCommandResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onAddCommandResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onAddCommandResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.DELETE_COMMAND.toString())) {
- // DeleteCommandResponse
-
- final DeleteCommandResponse msg = new DeleteCommandResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onDeleteCommandResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onDeleteCommandResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ADD_SUB_MENU.toString())) {
- // AddSubMenu
-
- final AddSubMenuResponse msg = new AddSubMenuResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onAddSubMenuResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onAddSubMenuResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.DELETE_SUB_MENU.toString())) {
- // DeleteSubMenu
-
- final DeleteSubMenuResponse msg = new DeleteSubMenuResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onDeleteSubMenuResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onDeleteSubMenuResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SUBSCRIBE_BUTTON.toString())) {
- // SubscribeButton
-
- final SubscribeButtonResponse msg = new SubscribeButtonResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSubscribeButtonResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSubscribeButtonResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.UNSUBSCRIBE_BUTTON.toString())) {
- // UnsubscribeButton
-
- final UnsubscribeButtonResponse msg = new UnsubscribeButtonResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onUnsubscribeButtonResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onUnsubscribeButtonResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SET_MEDIA_CLOCK_TIMER.toString())) {
- // SetMediaClockTimer
-
- final SetMediaClockTimerResponse msg = new SetMediaClockTimerResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSetMediaClockTimerResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSetMediaClockTimerResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ENCODED_SYNC_P_DATA.toString())) {
-
- final SystemRequestResponse msg = new SystemRequestResponse(hash);
- msg.format(rpcSpecVersion,true);
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.SYSTEM_REQUEST.toString());
- updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
- updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
- updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
- updateBroadcastIntent(sendIntent, "COMMENT2", msg.getResultCode().toString());
- updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
- sendBroadcastIntent(sendIntent);
-
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSystemRequestResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSystemRequestResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.CREATE_INTERACTION_CHOICE_SET.toString())) {
- // CreateInteractionChoiceSet
-
- final CreateInteractionChoiceSetResponse msg = new CreateInteractionChoiceSetResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onCreateInteractionChoiceSetResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onCreateInteractionChoiceSetResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.DELETE_INTERACTION_CHOICE_SET.toString())) {
- // DeleteInteractionChoiceSet
-
- final DeleteInteractionChoiceSetResponse msg = new DeleteInteractionChoiceSetResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onDeleteInteractionChoiceSetResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onDeleteInteractionChoiceSetResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.PERFORM_INTERACTION.toString())) {
- // PerformInteraction
-
- final PerformInteractionResponse msg = new PerformInteractionResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onPerformInteractionResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onPerformInteractionResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SET_GLOBAL_PROPERTIES.toString())) {
- // SetGlobalPropertiesResponse
-
- final SetGlobalPropertiesResponse msg = new SetGlobalPropertiesResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSetGlobalPropertiesResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSetGlobalPropertiesResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.RESET_GLOBAL_PROPERTIES.toString())) {
- // ResetGlobalProperties
-
- final ResetGlobalPropertiesResponse msg = new ResetGlobalPropertiesResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onResetGlobalPropertiesResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onResetGlobalPropertiesResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
- // UnregisterAppInterface
-
- _appInterfaceRegisterd = false;
- synchronized(APP_INTERFACE_REGISTERED_LOCK) {
- APP_INTERFACE_REGISTERED_LOCK.notify();
- }
-
- final UnregisterAppInterfaceResponse msg = new UnregisterAppInterfaceResponse(hash);
- msg.format(rpcSpecVersion,true);
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE.toString());
- updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_RESPONSE);
- updateBroadcastIntent(sendIntent, "SUCCESS", msg.getSuccess());
- updateBroadcastIntent(sendIntent, "COMMENT1", msg.getInfo());
- updateBroadcastIntent(sendIntent, "COMMENT2", msg.getResultCode().toString());
- updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
- updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
- sendBroadcastIntent(sendIntent);
-
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- if (_proxyListener instanceof IProxyListener) {
- ((IProxyListener)_proxyListener).onUnregisterAppInterfaceResponse(msg);
- }
- onRPCResponseReceived(msg);
- }
- });
- } else {
- if (_proxyListener instanceof IProxyListener) {
- ((IProxyListener)_proxyListener).onUnregisterAppInterfaceResponse(msg);
- }
- onRPCResponseReceived(msg);
- }
-
- notifyProxyClosed("UnregisterAppInterfaceResponse", null, SdlDisconnectedReason.APP_INTERFACE_UNREG);
- } else if (functionName.equals(FunctionID.GENERIC_RESPONSE.toString())) {
- // GenericResponse (Usually and error)
- final GenericResponse msg = new GenericResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onGenericResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onGenericResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SLIDER.toString())) {
- // Slider
- final SliderResponse msg = new SliderResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSliderResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSliderResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.PUT_FILE.toString())) {
- // PutFile
- final PutFileResponse msg = new PutFileResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onPutFileResponse(msg);
- onRPCResponseReceived(msg);
- notifyPutFileStreamResponse(msg);
- }
- });
- } else {
- _proxyListener.onPutFileResponse(msg);
- onRPCResponseReceived(msg);
- notifyPutFileStreamResponse(msg);
- }
- } else if (functionName.equals(FunctionID.DELETE_FILE.toString())) {
- // DeleteFile
- final DeleteFileResponse msg = new DeleteFileResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onDeleteFileResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onDeleteFileResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.LIST_FILES.toString())) {
- // ListFiles
- final ListFilesResponse msg = new ListFilesResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onListFilesResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onListFilesResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SET_APP_ICON.toString())) {
- // SetAppIcon
- final SetAppIconResponse msg = new SetAppIconResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSetAppIconResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSetAppIconResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SCROLLABLE_MESSAGE.toString())) {
- // ScrollableMessage
- final ScrollableMessageResponse msg = new ScrollableMessageResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onScrollableMessageResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onScrollableMessageResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.CHANGE_REGISTRATION.toString())) {
- // ChangeLanguageRegistration
- final ChangeRegistrationResponse msg = new ChangeRegistrationResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onChangeRegistrationResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onChangeRegistrationResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SET_DISPLAY_LAYOUT.toString())) {
- // SetDisplayLayout
- final SetDisplayLayoutResponse msg = new SetDisplayLayoutResponse(hash);
- msg.format(rpcSpecVersion,true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSetDisplayLayoutResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSetDisplayLayoutResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.PERFORM_AUDIO_PASS_THRU.toString())) {
- // PerformAudioPassThru
- final PerformAudioPassThruResponse msg = new PerformAudioPassThruResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onPerformAudioPassThruResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onPerformAudioPassThruResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.END_AUDIO_PASS_THRU.toString())) {
- // EndAudioPassThru
- final EndAudioPassThruResponse msg = new EndAudioPassThruResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onEndAudioPassThruResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onEndAudioPassThruResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SUBSCRIBE_VEHICLE_DATA.toString())) {
- // SubscribeVehicleData
- final SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSubscribeVehicleDataResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSubscribeVehicleDataResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.UNSUBSCRIBE_VEHICLE_DATA.toString())) {
- // UnsubscribeVehicleData
- final UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onUnsubscribeVehicleDataResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onUnsubscribeVehicleDataResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.GET_VEHICLE_DATA.toString())) {
- // GetVehicleData
- final GetVehicleDataResponse msg = new GetVehicleDataResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onGetVehicleDataResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onGetVehicleDataResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SUBSCRIBE_WAY_POINTS.toString())) {
- // SubscribeWayPoints
- final SubscribeWayPointsResponse msg = new SubscribeWayPointsResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSubscribeWayPointsResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSubscribeWayPointsResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.UNSUBSCRIBE_WAY_POINTS.toString())) {
- // UnsubscribeWayPoints
- final UnsubscribeWayPointsResponse msg = new UnsubscribeWayPointsResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onUnsubscribeWayPointsResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onUnsubscribeWayPointsResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.GET_WAY_POINTS.toString())) {
- // GetWayPoints
- final GetWayPointsResponse msg = new GetWayPointsResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onGetWayPointsResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onGetWayPointsResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.READ_DID.toString())) {
- final ReadDIDResponse msg = new ReadDIDResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onReadDIDResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onReadDIDResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.GET_DTCS.toString())) {
- final GetDTCsResponse msg = new GetDTCsResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onGetDTCsResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onGetDTCsResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.DIAGNOSTIC_MESSAGE.toString())) {
- final DiagnosticMessageResponse msg = new DiagnosticMessageResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onDiagnosticMessageResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onDiagnosticMessageResponse(msg);
- onRPCResponseReceived(msg);
- }
- }
- else if (functionName.equals(FunctionID.SYSTEM_REQUEST.toString())) {
-
- final SystemRequestResponse msg = new SystemRequestResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSystemRequestResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSystemRequestResponse(msg);
- onRPCResponseReceived(msg);
- }
- }
- else if (functionName.equals(FunctionID.SEND_LOCATION.toString())) {
-
- final SendLocationResponse msg = new SendLocationResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSendLocationResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSendLocationResponse(msg);
- onRPCResponseReceived(msg);
- }
- }
- else if (functionName.equals(FunctionID.DIAL_NUMBER.toString())) {
-
- final DialNumberResponse msg = new DialNumberResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onDialNumberResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onDialNumberResponse(msg);
- onRPCResponseReceived(msg);
- }
- }
- else if (functionName.equals(FunctionID.SHOW_CONSTANT_TBT.toString())) {
- final ShowConstantTbtResponse msg = new ShowConstantTbtResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onShowConstantTbtResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onShowConstantTbtResponse(msg);
- onRPCResponseReceived(msg);
- }
- }
- else if (functionName.equals(FunctionID.ALERT_MANEUVER.toString())) {
- final AlertManeuverResponse msg = new AlertManeuverResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onAlertManeuverResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onAlertManeuverResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.UPDATE_TURN_LIST.toString())) {
- final UpdateTurnListResponse msg = new UpdateTurnListResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onUpdateTurnListResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onUpdateTurnListResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SET_INTERIOR_VEHICLE_DATA.toString())) {
- final SetInteriorVehicleDataResponse msg = new SetInteriorVehicleDataResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSetInteriorVehicleDataResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSetInteriorVehicleDataResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.GET_INTERIOR_VEHICLE_DATA.toString())) {
- final GetInteriorVehicleDataResponse msg = new GetInteriorVehicleDataResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onGetInteriorVehicleDataResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onGetInteriorVehicleDataResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.CREATE_WINDOW.toString())) {
- final CreateWindowResponse msg = new CreateWindowResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onCreateWindowResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onCreateWindowResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.DELETE_WINDOW.toString())) {
- final DeleteWindowResponse msg = new DeleteWindowResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onDeleteWindowResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onDeleteWindowResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.GET_SYSTEM_CAPABILITY.toString())) {
- // GetSystemCapabilityResponse
- final GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onGetSystemCapabilityResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onGetSystemCapabilityResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.BUTTON_PRESS.toString())) {
- final ButtonPressResponse msg = new ButtonPressResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onButtonPressResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onButtonPressResponse(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SEND_HAPTIC_DATA.toString())) {
- final SendHapticDataResponse msg = new SendHapticDataResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSendHapticDataResponse( msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSendHapticDataResponse( msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SET_CLOUD_APP_PROPERTIES.toString())) {
- final SetCloudAppPropertiesResponse msg = new SetCloudAppPropertiesResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onSetCloudAppProperties(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onSetCloudAppProperties(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.GET_CLOUD_APP_PROPERTIES.toString())) {
- final GetCloudAppPropertiesResponse msg = new GetCloudAppPropertiesResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onGetCloudAppProperties(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onGetCloudAppProperties(msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.PUBLISH_APP_SERVICE.toString())) {
- final PublishAppServiceResponse msg = new PublishAppServiceResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onPublishAppServiceResponse( msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onPublishAppServiceResponse( msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.GET_APP_SERVICE_DATA.toString())) {
- final GetAppServiceDataResponse msg = new GetAppServiceDataResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onGetAppServiceDataResponse( msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onGetAppServiceDataResponse( msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.GET_FILE.toString())) {
- final GetFileResponse msg = new GetFileResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onGetFileResponse( msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onGetFileResponse( msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.PERFORM_APP_SERVICES_INTERACTION.toString())) {
- final PerformAppServiceInteractionResponse msg = new PerformAppServiceInteractionResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onPerformAppServiceInteractionResponse( msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onPerformAppServiceInteractionResponse( msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.CLOSE_APPLICATION.toString())) {
- final CloseApplicationResponse msg = new CloseApplicationResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onCloseApplicationResponse(msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _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);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onUnpublishAppServiceResponse( msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _proxyListener.onUnpublishAppServiceResponse( msg);
- onRPCResponseReceived(msg);
- }
- } else if (functionName.equals(FunctionID.SHOW_APP_MENU.toString())) {
- final ShowAppMenuResponse msg = new ShowAppMenuResponse(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onShowAppMenuResponse( msg);
- onRPCResponseReceived(msg);
- }
- });
- } else {
- _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 {
- if (_sdlMsgVersion != null) {
- DebugTool.logError(TAG, "Unrecognized response Message: " + functionName +
- " SDL Message Version = " + _sdlMsgVersion);
- } else {
- DebugTool.logError(TAG, "Unrecognized response Message: " + functionName);
- }
- } // end-if
-
-
- } else if (messageType.equals(RPCMessage.KEY_NOTIFICATION)) {
- if (functionName.equals(FunctionID.ON_HMI_STATUS.toString())) {
- // OnHMIStatus
-
- final OnHMIStatus msg = new OnHMIStatus(hash);
-
- //setup lockscreeninfo
- if (sdlSession != null)
- {
- //sdlSession.getLockScreenMan().setHMILevel(msg.getHmiLevel());
- }
-
- msg.setFirstRun(firstTimeFull);
- if (msg.getHmiLevel() == HMILevel.HMI_FULL) firstTimeFull = false;
-
- _hmiLevel = msg.getHmiLevel();
- if (_hmiLevel != HMILevel.HMI_NONE) {
- checkStatusAndInitSecuredService();
- }
- _audioStreamingState = msg.getAudioStreamingState();
-
- msg.format(rpcSpecVersion, true);
- lastHmiStatus = msg;
-
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnHMIStatus(msg);
- //_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnHMIStatus(msg);
- //_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
- onRPCNotificationReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ON_COMMAND.toString())) {
- // OnCommand
-
- final OnCommand msg = new OnCommand(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnCommand(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnCommand(msg);
- onRPCNotificationReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ON_DRIVER_DISTRACTION.toString())) {
- // OnDriverDistration
-
- final OnDriverDistraction msg = new OnDriverDistraction(hash);
-
- //setup lockscreeninfo
- if (sdlSession != null)
- {
- DriverDistractionState drDist = msg.getState();
- //sdlSession.getLockScreenMan().setDriverDistStatus(drDist == DriverDistractionState.DD_ON);
- }
-
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnDriverDistraction(msg);
- //_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnDriverDistraction(msg);
- //_proxyListener.onOnLockScreenNotification(sdlSession.getLockScreenMan().getLockObj());
- onRPCNotificationReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ON_ENCODED_SYNC_P_DATA.toString())) {
-
- final OnSystemRequest msg = new OnSystemRequest(hash);
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.ON_SYSTEM_REQUEST.toString());
- updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_NOTIFICATION);
-
- // If url is null, then send notification to the app, otherwise, send to URL
- if (msg.getUrl() == null) {
- updateBroadcastIntent(sendIntent, "COMMENT1", "URL is a null value (received)");
- sendBroadcastIntent(sendIntent);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnSystemRequest(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnSystemRequest(msg);
- onRPCNotificationReceived(msg);
- }
- } else {
- updateBroadcastIntent(sendIntent, "COMMENT1", "Sending to cloud: " + msg.getUrl());
- sendBroadcastIntent(sendIntent);
-
- DebugTool.logInfo(TAG, "send to url");
-
- if ( (msg.getUrl() != null) )
- {
- Thread handleOffboardTransmissionThread = new Thread() {
- @Override
- public void run() {
- sendOnSystemRequestToUrl(msg);
- }
- };
-
- handleOffboardTransmissionThread.start();
- }
- }
- } else if (functionName.equals(FunctionID.ON_PERMISSIONS_CHANGE.toString())) {
- //OnPermissionsChange
-
- final OnPermissionsChange msg = new OnPermissionsChange(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnPermissionsChange(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnPermissionsChange(msg);
- onRPCNotificationReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ON_TBT_CLIENT_STATE.toString())) {
- // OnTBTClientState
-
- final OnTBTClientState msg = new OnTBTClientState(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnTBTClientState(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnTBTClientState(msg);
- onRPCNotificationReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ON_BUTTON_PRESS.toString())) {
- // OnButtonPress
-
- final OnButtonPress msg = new OnButtonPress(hash);
- msg.format(rpcSpecVersion, true);
- final OnButtonPress onButtonPressCompat = (OnButtonPress)handleButtonNotificationFormatting(msg);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnButtonPress(msg);
- onRPCNotificationReceived(msg);
- if(onButtonPressCompat != null){
- onRPCNotificationReceived(onButtonPressCompat);
- _proxyListener.onOnButtonPress(onButtonPressCompat);
- }
- }
- });
- } else {
- _proxyListener.onOnButtonPress(msg);
- onRPCNotificationReceived(msg);
- if(onButtonPressCompat != null){
- onRPCNotificationReceived(onButtonPressCompat);
- _proxyListener.onOnButtonPress(onButtonPressCompat);
- }
- }
- } else if (functionName.equals(FunctionID.ON_BUTTON_EVENT.toString())) {
- // OnButtonEvent
-
- final OnButtonEvent msg = new OnButtonEvent(hash);
- msg.format(rpcSpecVersion, true);
- final OnButtonEvent onButtonEventCompat = (OnButtonEvent)handleButtonNotificationFormatting(msg);
-
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnButtonEvent(msg);
- onRPCNotificationReceived(msg);
- if(onButtonEventCompat != null){
- onRPCNotificationReceived(onButtonEventCompat);
- _proxyListener.onOnButtonEvent(onButtonEventCompat);
- }
- }
- });
- } else {
- _proxyListener.onOnButtonEvent(msg);
- onRPCNotificationReceived(msg);
- if(onButtonEventCompat != null){
- onRPCNotificationReceived(onButtonEventCompat);
- _proxyListener.onOnButtonEvent(onButtonEventCompat);
- }
- }
- } else if (functionName.equals(FunctionID.ON_LANGUAGE_CHANGE.toString())) {
- // OnLanguageChange
-
- final OnLanguageChange msg = new OnLanguageChange(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnLanguageChange(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnLanguageChange(msg);
- onRPCNotificationReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ON_HASH_CHANGE.toString())) {
- // OnLanguageChange
-
- final OnHashChange msg = new OnHashChange(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnHashChange(msg);
- onRPCNotificationReceived(msg);
- if (_bAppResumeEnabled)
- {
- _lastHashID = msg.getHashID();
- }
- }
- });
- } else {
- _proxyListener.onOnHashChange(msg);
- onRPCNotificationReceived(msg);
- if (_bAppResumeEnabled)
- {
- _lastHashID = msg.getHashID();
- }
- }
- } else if (functionName.equals(FunctionID.ON_SYSTEM_REQUEST.toString())) {
- // OnSystemRequest
-
- final OnSystemRequest msg = new OnSystemRequest(hash);
- msg.format(rpcSpecVersion,true);
- RequestType requestType = msg.getRequestType();
- if(msg.getUrl() != null) {
- if (((requestType == RequestType.PROPRIETARY) && (msg.getFileType() == FileType.JSON))
- || ((requestType == RequestType.HTTP) && (msg.getFileType() == FileType.BINARY))) {
- Thread handleOffboardTransmissionThread = new Thread() {
- @Override
- public void run() {
- sendOnSystemRequestToUrl(msg);
- }
- };
-
- handleOffboardTransmissionThread.start();
- } else if (requestType == RequestType.LOCK_SCREEN_ICON_URL) {
- //Cache this for when the lockscreen is displayed
- lockScreenIconRequest = msg;
- } else if (requestType == RequestType.ICON_URL) {
- if (msg.getUrl() != null) {
- //Download the icon file and send SystemRequest RPC
- Thread handleOffBoardTransmissionThread = new Thread() {
- @Override
- public void run() {
- String urlHttps = msg.getUrl().replaceFirst("http://", "https://");
- byte[] file = FileUtls.downloadFile(urlHttps);
- if (file != null) {
- SystemRequest systemRequest = new SystemRequest();
- systemRequest.setFileName(msg.getUrl());
- systemRequest.setBulkData(file);
- systemRequest.setRequestType(RequestType.ICON_URL);
- try {
- sendRPCMessagePrivate(systemRequest);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- } else {
- DebugTool.logError(TAG, "File was null at: " + urlHttps);
- }
- }
- };
- handleOffBoardTransmissionThread.start();
- }
- }
- }
-
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnSystemRequest(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnSystemRequest(msg);
- onRPCNotificationReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ON_AUDIO_PASS_THRU.toString())) {
- // OnAudioPassThru
- final OnAudioPassThru msg = new OnAudioPassThru(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnAudioPassThru(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnAudioPassThru(msg);
- onRPCNotificationReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ON_VEHICLE_DATA.toString())) {
- // OnVehicleData
- final OnVehicleData msg = new OnVehicleData(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnVehicleData(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnVehicleData(msg);
- onRPCNotificationReceived(msg);
- }
- }
- else if (functionName.equals(FunctionID.ON_APP_INTERFACE_UNREGISTERED.toString())) {
- // OnAppInterfaceUnregistered
-
- _appInterfaceRegisterd = false;
- synchronized(APP_INTERFACE_REGISTERED_LOCK) {
- APP_INTERFACE_REGISTERED_LOCK.notify();
- }
-
- final OnAppInterfaceUnregistered msg = new OnAppInterfaceUnregistered(hash);
- msg.format(rpcSpecVersion,true);
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.ON_APP_INTERFACE_UNREGISTERED.toString());
- updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_NOTIFICATION);
- updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
- sendBroadcastIntent(sendIntent);
-
- if (_advancedLifecycleManagementEnabled) {
- // This requires the proxy to be cycled
-
- if(_mainUIHandler == null){
- _mainUIHandler = new Handler(Looper.getMainLooper());
- }
-
- //This needs to be ran on the main thread
-
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- cycleProxy(SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(msg.getReason()));
- }
- });
- } else {
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- ((IProxyListener)_proxyListener).onOnAppInterfaceUnregistered(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- ((IProxyListener)_proxyListener).onOnAppInterfaceUnregistered(msg);
- onRPCNotificationReceived(msg);
- }
- notifyProxyClosed("OnAppInterfaceUnregistered", null, SdlDisconnectedReason.APP_INTERFACE_UNREG);
- }
- }
- else if (functionName.equals(FunctionID.ON_KEYBOARD_INPUT.toString())) {
- final OnKeyboardInput msg = new OnKeyboardInput(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnKeyboardInput(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnKeyboardInput(msg);
- onRPCNotificationReceived(msg);
- }
- }
- else if (functionName.equals(FunctionID.ON_TOUCH_EVENT.toString())) {
- final OnTouchEvent msg = new OnTouchEvent(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnTouchEvent(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnTouchEvent(msg);
- onRPCNotificationReceived(msg);
- }
- }
- else if (functionName.equals(FunctionID.ON_WAY_POINT_CHANGE.toString())) {
- final OnWayPointChange msg = new OnWayPointChange(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnWayPointChange(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnWayPointChange(msg);
- onRPCNotificationReceived(msg);
- }
- }
- else if (functionName.equals(FunctionID.ON_INTERIOR_VEHICLE_DATA.toString())) {
- final OnInteriorVehicleData msg = new OnInteriorVehicleData(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnInteriorVehicleData(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnInteriorVehicleData(msg);
- onRPCNotificationReceived(msg);
- }
- }
- else if (functionName.equals(FunctionID.ON_RC_STATUS.toString())) {
- final OnRCStatus msg = new OnRCStatus(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnRCStatus(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnRCStatus(msg);
- onRPCNotificationReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ON_APP_SERVICE_DATA.toString())) {
- final OnAppServiceData msg = new OnAppServiceData(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnAppServiceData(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnAppServiceData(msg);
- onRPCNotificationReceived(msg);
- }
- } else if (functionName.equals(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.toString())) {
- final OnSystemCapabilityUpdated msg = new OnSystemCapabilityUpdated(hash);
- msg.format(rpcSpecVersion, true);
- if (_callbackToUIThread) {
- // Run in UI thread
- _mainUIHandler.post(new Runnable() {
- @Override
- public void run() {
- _proxyListener.onOnSystemCapabilityUpdated(msg);
- onRPCNotificationReceived(msg);
- }
- });
- } else {
- _proxyListener.onOnSystemCapabilityUpdated(msg);
- onRPCNotificationReceived(msg);
- }
- } else {
- if (_sdlMsgVersion != null) {
- DebugTool.logInfo(TAG, "Unrecognized notification Message: " + functionName +
- " connected to SDL using message version: " + _sdlMsgVersion.getMajorVersion() + "." + _sdlMsgVersion.getMinorVersion());
- } else {
- DebugTool.logInfo(TAG, "Unrecognized notification Message: " + functionName);
- }
- } // end-if
- } // end-if notification
-
- SdlTrace.logProxyEvent("Proxy received RPC Message: " + functionName, SDL_LIB_TRACE_KEY);
- }
-
- //FIXME
- /**
- * Temporary method to bridge the new PLAY_PAUSE and OKAY button functionality with the old
- * OK button name. This should be removed during the next major release
- * @param notification
- */
- private RPCNotification handleButtonNotificationFormatting(RPCNotification notification){
- if(FunctionID.ON_BUTTON_EVENT.toString().equals(notification.getFunctionName())
- || FunctionID.ON_BUTTON_PRESS.toString().equals(notification.getFunctionName())){
-
- ButtonName buttonName = (ButtonName)notification.getObject(ButtonName.class, OnButtonEvent.KEY_BUTTON_NAME);
- ButtonName compatBtnName = null;
-
- if(rpcSpecVersion != null && rpcSpecVersion.getMajor() >= 5){
- if(ButtonName.PLAY_PAUSE.equals(buttonName)){
- compatBtnName = ButtonName.OK;
- }
- }else{ // rpc spec version is either null or less than 5
- if(ButtonName.OK.equals(buttonName)){
- compatBtnName = ButtonName.PLAY_PAUSE;
- }
- }
-
- try {
- if (compatBtnName != null) { //There is a button name that needs to be swapped out
- RPCNotification notification2;
- //The following is done because there is currently no way to make a deep copy
- //of an RPC. Since this code will be removed, it's ugliness is borderline acceptable.
- if (notification instanceof OnButtonEvent) {
- OnButtonEvent onButtonEvent = new OnButtonEvent();
- onButtonEvent.setButtonEventMode(((OnButtonEvent) notification).getButtonEventMode());
- onButtonEvent.setCustomButtonID(((OnButtonEvent) notification).getCustomButtonID());
- notification2 = onButtonEvent;
- } else if (notification instanceof OnButtonPress) {
- OnButtonPress onButtonPress = new OnButtonPress();
- onButtonPress.setButtonPressMode(((OnButtonPress) notification).getButtonPressMode());
- onButtonPress.setCustomButtonID(((OnButtonPress) notification).getCustomButtonID());
- notification2 = onButtonPress;
- } else {
- return null;
- }
-
- notification2.setParameters(OnButtonEvent.KEY_BUTTON_NAME, compatBtnName);
- return notification2;
- }
- }catch (Exception e){
- //Should never get here
- }
- }
- return null;
- }
-
- /**
- * Get SDL Message Version
- * @return SdlMsgVersion
- * @throws SdlException
- */
- public SdlMsgVersion getSdlMsgVersion() throws SdlException{
- return _sdlMsgVersion;
- }
-
- /**
- * Takes a list of RPCMessages and sends it to SDL in a synchronous fashion. Responses are captured through callback on OnMultipleRequestListener.
- * For sending requests asynchronously, use sendRequests <br>
- *
- * <strong>NOTE: This will override any listeners on individual RPCs</strong>
- *
- * @param rpcs is the list of RPCMessages being sent
- * @param listener listener for updates and completions
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void sendSequentialRequests(final List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener) throws SdlException {
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- SdlTrace.logProxyEvent("Application called sendSequentialRequests", SDL_LIB_TRACE_KEY);
-
- synchronized(CONNECTION_REFERENCE_LOCK) {
- if (!getIsConnected()) {
- SdlTrace.logProxyEvent("Application attempted to call sendSequentialRequests without a connected transport.", SDL_LIB_TRACE_KEY);
- throw new SdlException("There is no valid connection to SDL. sendSequentialRequests cannot be called until SDL has been connected.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- }
-
- if (rpcs == null){
- //Log error here
- throw new SdlException("You must send some RPCs", SdlExceptionCause.INVALID_ARGUMENT);
- }
-
- // Break out of recursion, we have finished the requests
- if (rpcs.size() == 0) {
- if(listener != null){
- listener.onFinished();
- }
- return;
- }
-
- RPCMessage rpc = rpcs.remove(0);
-
- // Request Specifics
- if (rpc.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
- RPCRequest request = (RPCRequest) rpc;
- request.setCorrelationID(CorrelationIdGenerator.generateId());
-
- final OnRPCResponseListener devOnRPCResponseListener = request.getOnRPCResponseListener();
-
- request.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (devOnRPCResponseListener != null){
- devOnRPCResponseListener.onResponse(correlationId, response);
- }
- if (listener != null) {
- listener.onResponse(correlationId, response);
- listener.onUpdate(rpcs.size());
-
- }
- try {
- // recurse after onResponse
- sendSequentialRequests(rpcs, listener);
- } catch (SdlException e) {
- e.printStackTrace();
- if (listener != null) {
- GenericResponse genericResponse = new GenericResponse(false, Result.GENERIC_ERROR);
- genericResponse.setInfo(e.toString());
- listener.onResponse(correlationId, genericResponse);
- }
- }
- }
- });
- sendRPCMessagePrivate(request);
- } else {
- // Notifications and Responses
- sendRPCMessagePrivate(rpc);
- if (listener != null) {
- listener.onUpdate(rpcs.size());
- }
- // recurse after sending a notification or response as there is no response.
- try {
- sendSequentialRequests(rpcs, listener);
- } catch (SdlException e) {
- e.printStackTrace();
- if (listener != null) {
- GenericResponse response = new GenericResponse(false, Result.REJECTED);
- response.setInfo(e.toString());
- listener.onResponse(0, response);
- }
- }
- }
-
-
- }
-
- /**
- * Takes a list of RPCMessages and sends it to SDL. Responses are captured through callback on OnMultipleRequestListener.
- * For sending requests synchronously, use sendSequentialRequests <br>
- *
- * <strong>NOTE: This will override any listeners on individual RPCs</strong>
- *
- * @param rpcs is the list of RPCMessages being sent
- * @param listener listener for updates and completions
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void sendRequests(List<? extends RPCMessage> rpcs, final OnMultipleRequestListener listener) throws SdlException {
-
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- SdlTrace.logProxyEvent("Application called sendRequests", SDL_LIB_TRACE_KEY);
-
- synchronized(CONNECTION_REFERENCE_LOCK) {
- if (!getIsConnected()) {
- SdlTrace.logProxyEvent("Application attempted to call sendRequests without a connected transport.", SDL_LIB_TRACE_KEY);
- throw new SdlException("There is no valid connection to SDL. sendRequests cannot be called until SDL has been connected.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- }
-
- if (rpcs == null){
- //Log error here
- throw new SdlException("You must send some RPCs, the array is null", SdlExceptionCause.INVALID_ARGUMENT);
- }
-
- int arraySize = rpcs.size();
-
- if (arraySize == 0) {
- throw new SdlException("You must send some RPCs, the array is empty", SdlExceptionCause.INVALID_ARGUMENT);
- }
-
- for (int i = 0; i < arraySize; i++) {
- RPCMessage rpc = rpcs.get(i);
- // Request Specifics
- if (rpc.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
- RPCRequest request = (RPCRequest) rpc;
- final OnRPCResponseListener devOnRPCResponseListener = request.getOnRPCResponseListener();
- request.setCorrelationID(CorrelationIdGenerator.generateId());
- if (listener != null) {
- listener.addCorrelationId(request.getCorrelationID());
- request.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- if (devOnRPCResponseListener != null){
- devOnRPCResponseListener.onResponse(correlationId, response);
- }
- if (listener.getSingleRpcResponseListener() != null) {
- listener.getSingleRpcResponseListener().onResponse(correlationId, response);
- }
- }
- });
- }
- sendRPCMessagePrivate(request);
- }else {
- // Notifications and Responses
- sendRPCMessagePrivate(rpc);
- if (listener != null){
- listener.onUpdate(rpcs.size());
- if (rpcs.size() == 0){
- listener.onFinished();
- }
- }
- }
- }
- }
-
- public void sendRPC(RPCMessage message) throws SdlException {
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test if request is null
- if (message == null) {
- SdlTrace.logProxyEvent("Application called sendRPCRequest method with a null RPCRequest.", SDL_LIB_TRACE_KEY);
- throw new IllegalArgumentException("sendRPCRequest cannot be called with a null request.");
- }
-
- SdlTrace.logProxyEvent("Application called sendRPCRequest method for RPCRequest: ." + message.getFunctionName(), SDL_LIB_TRACE_KEY);
-
- // Test if SdlConnection is null
- synchronized(CONNECTION_REFERENCE_LOCK) {
- if (!getIsConnected()) {
- SdlTrace.logProxyEvent("Application attempted to send and RPCRequest without a connected transport.", SDL_LIB_TRACE_KEY);
- throw new SdlException("There is no valid connection to SDL. sendRPCRequest cannot be called until SDL has been connected.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- }
-
- // Test for illegal correlation ID
- if (message.getMessageType().equals(RPCMessage.KEY_REQUEST)) {
- RPCRequest request = (RPCRequest) message;
- if (isCorrelationIDProtected(request.getCorrelationID())) {
-
- SdlTrace.logProxyEvent("Application attempted to use the reserved correlation ID, " + request.getCorrelationID(), SDL_LIB_TRACE_KEY);
- throw new SdlException("Invalid correlation ID. The correlation ID, " + request.getCorrelationID()
- + " , is a reserved correlation ID.", SdlExceptionCause.RESERVED_CORRELATION_ID);
- }
- }
- // Throw exception if RPCRequest is sent when SDL is unavailable
- if (!_appInterfaceRegisterd && !message.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE.toString())) {
-
- SdlTrace.logProxyEvent("Application attempted to send an RPCRequest (non-registerAppInterface), before the interface was registerd.", SDL_LIB_TRACE_KEY);
- throw new SdlException("SDL is currently unavailable. RPC Requests cannot be sent.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
-
- if (_advancedLifecycleManagementEnabled) {
- if (message.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE.toString())
- || message.getFunctionName().equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
-
- SdlTrace.logProxyEvent("Application attempted to send a RegisterAppInterface or UnregisterAppInterface while using ALM.", SDL_LIB_TRACE_KEY);
- throw new SdlException("The RPCRequest, " + message.getFunctionName() +
- ", is un-allowed using the Advanced Lifecycle Management Model.", SdlExceptionCause.INCORRECT_LIFECYCLE_MODEL);
- }
- }
-
- sendRPCMessagePrivate(message);
- }
-
- /**
- * Takes an RPCRequest and sends it to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param request is the RPCRequest being sent
- * @throws SdlException if an unrecoverable error is encountered
- * @deprecated - use sendRPC instead
- */
- @Deprecated
- public void sendRPCRequest(RPCRequest request) throws SdlException {
- sendRPC(request);
- }
-
- protected void notifyProxyClosed(final String info, final Exception e, final SdlDisconnectedReason reason) {
- SdlTrace.logProxyEvent("NotifyProxyClose", SDL_LIB_TRACE_KEY);
- DebugTool.logInfo(TAG, "notifyProxyClosed: " + info);
- OnProxyClosed message = new OnProxyClosed(info, e, reason);
- queueInternalMessage(message);
- }
-
- private void passErrorToProxyListener(final String info, final Exception e) {
-
- OnError message = new OnError(info, e);
- queueInternalMessage(message);
- }
-
- private void startRPCProtocolSession() {
-
- // Set Proxy Lifecyclek Available
- if (_advancedLifecycleManagementEnabled) {
-
- try {
- registerAppInterfacePrivate(
- _sdlMsgVersionRequest,
- _applicationName,
- _ttsName,
- _ngnMediaScreenAppName,
- _vrSynonyms,
- _isMediaApp,
- _sdlLanguageDesired,
- _hmiDisplayLanguageDesired,
- _appType,
- _appID,
- _dayColorScheme,
- _nightColorScheme,
- REGISTER_APP_INTERFACE_CORRELATION_ID);
-
- } catch (Exception e) {
- notifyProxyClosed("Failed to register application interface with SDL. Check parameter values given to SdlProxy constructor.", e, SdlDisconnectedReason.SDL_REGISTRATION_ERROR);
- }
- } else {
- InternalProxyMessage message = new InternalProxyMessage(InternalProxyMessage.OnProxyOpened);
- queueInternalMessage(message);
- }
- }
-
- // Queue internal callback message
- private void queueInternalMessage(InternalProxyMessage message) {
- synchronized(INTERNAL_MESSAGE_QUEUE_THREAD_LOCK) {
- if (_internalProxyMessageDispatcher != null) {
- _internalProxyMessageDispatcher.queueMessage(message);
- }
- }
- }
-
- // Queue incoming ProtocolMessage
- private void queueIncomingMessage(ProtocolMessage message) {
- synchronized(INCOMING_MESSAGE_QUEUE_THREAD_LOCK) {
- if (_incomingProxyMessageDispatcher != null) {
- _incomingProxyMessageDispatcher.queueMessage(message);
- }
- }
- }
-
- private FileInputStream getFileInputStream(String sLocalFile)
- {
- FileInputStream is = null;
- try
- {
- is = new FileInputStream(sLocalFile);
- }
- catch (IOException e1)
- {
- e1.printStackTrace();
- }
- return is;
- }
-
- private Long getFileInputStreamSize(FileInputStream is)
- {
- Long lSize = null;
-
- try
- {
- lSize = is.getChannel().size();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- return lSize;
- }
-
- private void closeFileInputStream(FileInputStream is)
- {
- try
- {
- is.close();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- @SuppressWarnings("unchecked")
- private RPCStreamController startRPCStream(String sLocalFile, PutFile request, SessionType sType, byte rpcSessionID, Version protocolVersion)
- {
- if (sdlSession == null) return null;
-
- FileInputStream is = getFileInputStream(sLocalFile);
- if (is == null) return null;
-
- Long lSize = getFileInputStreamSize(is);
- if (lSize == null)
- {
- closeFileInputStream(is);
- return null;
- }
-
- try {
- StreamRPCPacketizer rpcPacketizer = null;//new StreamRPCPacketizer((SdlProxyBase<IProxyListenerBase>) this, sdlSession, is, request, sType, rpcSessionID, protocolVersion, rpcSpecVersion, lSize, sdlSession);
- rpcPacketizer.start();
- return new RPCStreamController(rpcPacketizer, request.getCorrelationID());
- } catch (Exception e) {
- DebugTool.logError(TAG, "SyncConnectionUnable to start streaming:", e);
- return null;
- }
- }
-
- @SuppressWarnings({"unchecked", "UnusedReturnValue"})
- private RPCStreamController startRPCStream(InputStream is, PutFile request, SessionType sType, byte rpcSessionID, Version protocolVersion)
- {
- if (sdlSession == null) return null;
- Long lSize = request.getLength();
-
- if (lSize == null)
- {
- return null;
- }
-
- try {
- StreamRPCPacketizer rpcPacketizer = null;//new StreamRPCPacketizer((SdlProxyBase<IProxyListenerBase>) this, sdlSession, is, request, sType, rpcSessionID, protocolVersion, rpcSpecVersion, lSize, sdlSession);
- rpcPacketizer.start();
- return new RPCStreamController(rpcPacketizer, request.getCorrelationID());
- } catch (Exception e) {
- DebugTool.logError(TAG, "SyncConnection Unable to start streaming:", e);
- return null;
- }
- }
-
- private RPCStreamController startPutFileStream(String sPath, PutFile msg) {
- if (sdlSession == null) return null;
- return startRPCStream(sPath, msg, SessionType.RPC, (byte)sdlSession.getSessionId(), protocolVersion);
- }
-
- private RPCStreamController startPutFileStream(InputStream is, PutFile msg) {
- if (sdlSession == null) return null;
- if (is == null) return null;
- return startRPCStream(is, msg, SessionType.RPC, (byte)sdlSession.getSessionId(), protocolVersion);
- }
-
- @SuppressWarnings("UnusedReturnValue")
- public boolean startRPCStream(InputStream is, RPCRequest msg) {
- if (sdlSession == null) return false;
- //sdlSession.startRPCStream(is, msg, SessionType.RPC, sdlSession.getSessionId(), (byte)getProtocolVersion().getMajor());
- return true;
- }
-
- public OutputStream startRPCStream(RPCRequest msg) {
- if (sdlSession == null) return null;
- return null;//sdlSession.startRPCStream(msg, SessionType.RPC, sdlSession.getSessionId(), (byte)getProtocolVersion().getMajor());
- }
-
- public void endRPCStream() {
- if (sdlSession == null) return;
- //sdlSession.stopRPCStream();
- }
-
- private class CallableMethod implements Callable<Void> {
-
- private final long waitTime;
-
- public CallableMethod(int timeInMillis){
- this.waitTime=timeInMillis;
- }
- @Override
- public Void call() {
- try {
- Thread.sleep(waitTime);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- return null;
- }
- }
-
- public FutureTask<Void> createFutureTask(CallableMethod callMethod){
- return new FutureTask<Void>(callMethod);
- }
-
- public ScheduledExecutorService createScheduler(){
- return Executors.newSingleThreadScheduledExecutor();
- }
-
- @SuppressWarnings("unused")
- public void startService(SessionType serviceType, boolean isEncrypted){
- sdlSession.startService(serviceType, isEncrypted);
- }
-
- @SuppressWarnings("unused")
- public void endService(SessionType serviceType){
- sdlSession.endService(serviceType);
- }
-
-
-
- /**
- * @deprecated
- *Opens the video service (serviceType 11) and subsequently streams raw H264 video from an InputStream provided by the app
- *@return true if service is opened successfully and stream is started, return false otherwise
- * @see #startRemoteDisplayStream(Context, Class, VideoStreamingParameters, boolean) startRemoteDisplayStream
- * @see #startVideoStream(boolean, VideoStreamingParameters) startVideoStream
- * @see #createOpenGLInputSurface(int, int, int, int, int, boolean) createOpenGLInputSurface
- */
- @SuppressWarnings("unused")
- @Deprecated
- public boolean startH264(InputStream is, boolean isEncrypted) {
-
- if (sdlSession == null) return false;
-
- navServiceStartResponseReceived = false;
- navServiceStartResponse = false;
- navServiceStartRejectedParams = null;
-
- // When startH264() API is used, we will not send video format / width / height information
- // with StartService. (Reasons: InputStream does not provide timestamp information so RTP
- // cannot be used. startH264() does not provide with/height information.)
- VideoStreamingParameters emptyParam = new VideoStreamingParameters();
- emptyParam.setResolution(null);
- emptyParam.setFormat(null);
- sdlSession.setDesiredVideoParams(emptyParam);
-
- sdlSession.startService(SessionType.NAV, isEncrypted);
- addNavListener();
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- //noinspection StatementWithEmptyBody
- while (!navServiceStartResponseReceived && !fTask.isDone());
- scheduler.shutdown();
-
- if (navServiceStartResponse) {
- try {
- //sdlSession.startStream(is, SessionType.NAV, sdlSession.getSessionId());
- return true;
- } catch (Exception e) {
- return false;
- }
- } else {
- return false;
- }
- }
-
- /**
- * @deprecated
- *Opens the video service (serviceType 11) and subsequently provides an OutputStream to the app to use for a raw H264 video stream
- *@return OutputStream if service is opened successfully and stream is started, return null otherwise
- * @see #startRemoteDisplayStream(Context, Class, VideoStreamingParameters, boolean) startRemoteDisplayStream
- * @see #startVideoStream(boolean, VideoStreamingParameters) startVideoStream
- * @see #createOpenGLInputSurface(int, int, int, int, int, boolean) createOpenGLInputSurface
- */
- @SuppressWarnings("unused")
- @Deprecated
- public OutputStream startH264(boolean isEncrypted) {
-
- if (sdlSession == null) return null;
-
- navServiceStartResponseReceived = false;
- navServiceStartResponse = false;
- navServiceStartRejectedParams = null;
-
- // When startH264() API is used, we will not send video format / width / height information
- // with StartService. (Reasons: OutputStream does not provide timestamp information so RTP
- // cannot be used. startH264() does not provide with/height information.)
- VideoStreamingParameters emptyParam = new VideoStreamingParameters();
- emptyParam.setResolution(null);
- emptyParam.setFormat(null);
- sdlSession.setDesiredVideoParams(emptyParam);
-
- sdlSession.startService(SessionType.NAV, isEncrypted);
- addNavListener();
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- //noinspection StatementWithEmptyBody
- while (!navServiceStartResponseReceived && !fTask.isDone());
- scheduler.shutdown();
-
- if (navServiceStartResponse) {
- try {
- return null;//sdlSession.startStream(SessionType.NAV, sdlSession.getSessionId());
- } catch (Exception e) {
- return null;
- }
- } else {
- return null;
- }
- }
-
- /**
- *Closes the opened video service (serviceType 11)
- *@return true if the video service is closed successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- @Deprecated
- public boolean endH264() {
- return endVideoStream();
- }
- /**
- *Pauses the stream for the opened audio service (serviceType 10)
- *@return true if the audio service stream is paused successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- @Deprecated
- public boolean pausePCM() {
- return pauseAudioStream();
- }
-
- /**
- *Pauses the stream for the opened video service (serviceType 11)
- *@return true if the video service stream is paused successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- @Deprecated
- public boolean pauseH264() {
- return pauseVideoStream();
- }
-
- /**
- *Resumes the stream for the opened audio service (serviceType 10)
- *@return true if the audio service stream is resumed successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- @Deprecated
- public boolean resumePCM() {
- return resumeAudioStream();
- }
-
- /**
- *Resumes the stream for the opened video service (serviceType 11)
- *@return true if the video service is resumed successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- @Deprecated
- public boolean resumeH264() {
- return resumeVideoStream();
- }
-
-
- /**
- *Opens the audio service (serviceType 10) and subsequently streams raw PCM audio from an InputStream provided by the app
- *@return true if service is opened successfully and stream is started, return false otherwise
- */
- @SuppressWarnings("unused")
- @Deprecated
- public boolean startPCM(InputStream is, boolean isEncrypted) {
- if (sdlSession == null) return false;
-
- pcmServiceStartResponseReceived = false;
- pcmServiceStartResponse = false;
- sdlSession.startService(SessionType.PCM, isEncrypted);
-
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- //noinspection StatementWithEmptyBody
- while (!pcmServiceStartResponseReceived && !fTask.isDone());
- scheduler.shutdown();
-
- if (pcmServiceStartResponse) {
- try {
- //sdlSession.startStream(is, SessionType.PCM, sdlSession.getSessionId());
- return true;
- } catch (Exception e) {
- return false;
- }
- } else {
- return false;
- }
- }
-
- /**
- *Opens the audio service (serviceType 10) and subsequently provides an OutputStream to the app
- *@return OutputStream if service is opened successfully and stream is started, return null otherwise
- */
- @SuppressWarnings("unused")
- @Deprecated
- public OutputStream startPCM(boolean isEncrypted) {
- if (sdlSession == null) return null;
-
- pcmServiceStartResponseReceived = false;
- pcmServiceStartResponse = false;
- sdlSession.startService(SessionType.PCM, isEncrypted);
-
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- //noinspection StatementWithEmptyBody
- while (!pcmServiceStartResponseReceived && !fTask.isDone());
- scheduler.shutdown();
-
- if (pcmServiceStartResponse) {
- try {
- return null;
- //return sdlSession.startStream(SessionType.PCM, sdlSession.getSessionId());
- } catch (Exception e) {
- return null;
- }
- } else {
- if (pcmServiceStartRejectedParams != null) {
- StringBuilder builder = new StringBuilder();
- for (String paramName : pcmServiceStartRejectedParams) {
- if (builder.length() > 0) {
- builder.append(", ");
- }
- builder.append(paramName);
- }
- DebugTool.logWarning(TAG, "StartService for nav failed. Rejected params: " + builder.toString());
-
- } else {
- DebugTool.logWarning(TAG, "StartService for nav failed (rejected params not supplied)");
- }
- return null;
- }
- }
-
- /**
- *Closes the opened audio service (serviceType 10)
- *@return true if the audio service is closed successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- @Deprecated
- public boolean endPCM() {
- return endAudioStream();
- }
-
- /**
- * Opens a video service (service type 11) and subsequently provides an IVideoStreamListener
- * to the app to send video data. The supplied VideoStreamingParameters will be set as desired parameters
- * that will be used to negotiate
- *
- * <br><br><b>NOTE: IF USING SECONDARY TRANSPORTS, THE VIDEO SERVICE MUST BE STARTED BEFORE CALLING THIS
- * THIS METHOD. USE A `ISdlServiceListener` TO BE NOTIFIED THAT IT STARTS THEN CALL THIS METHOD TO
- * START STREAMING. ADD A LISTENER USE {@link #addServiceListener(SessionType, ISdlServiceListener)}.</b>
- *
- * @param isEncrypted Specify true if packets on this service have to be encrypted
- * @param parameters Video streaming parameters including: codec which will be used for streaming (currently, only
- * VideoStreamingCodec.H264 is accepted), height and width of the video in pixels.
- *
- * @return IVideoStreamListener interface if service is opened successfully and streaming is
- * started, null otherwise
- *
- * @see ISdlServiceListener
- */
- @SuppressWarnings("unused")
- public IVideoStreamListener startVideoStream(boolean isEncrypted, VideoStreamingParameters parameters) {
- if (sdlSession == null) {
- DebugTool.logWarning(TAG, "SdlSession is not created yet.");
- return null;
- }
- if (!sdlSession.getIsConnected()) {
- DebugTool.logWarning(TAG, "Connection is not available.");
- return null;
- }
-
- sdlSession.setDesiredVideoParams(parameters);
-
- VideoStreamingParameters acceptedParams = tryStartVideoStream(isEncrypted, parameters);
- if (acceptedParams != null) {
- return null;// sdlSession.startVideoStream();
- } else {
- return null;
- }
- }
-
- /**
- * This method will try to start the video service with the requested parameters.
- * When it returns it will attempt to store the accepted parameters if available.
- * @param isEncrypted if the service should be encrypted
- * @param parameters the desiered video streaming parameters
- */
- public void startVideoService(boolean isEncrypted, VideoStreamingParameters parameters) {
- if (sdlSession == null) {
- DebugTool.logWarning(TAG, "SdlSession is not created yet.");
- return;
- }
- if (!sdlSession.getIsConnected()) {
- DebugTool.logWarning(TAG, "Connection is not available.");
- return;
- }
-
- sdlSession.setDesiredVideoParams(parameters);
-
- tryStartVideoStream(isEncrypted, parameters);
- }
-
- /**
- *Closes the opened video service (serviceType 11)
- *@return true if the video service is closed successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- public boolean endVideoStream() {
- if (sdlSession == null){ return false; }
-
- navServiceEndResponseReceived = false;
- navServiceEndResponse = false;
- //sdlSession.stopVideoStream();
-
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- //noinspection StatementWithEmptyBody
- while (!navServiceEndResponseReceived && !fTask.isDone());
- scheduler.shutdown();
-
- return navServiceEndResponse;
- }
-
- /**
- *Pauses the stream for the opened video service (serviceType 11)
- *@return true if the video service stream is paused successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- public boolean pauseVideoStream() {
- return false;//sdlSession != null && sdlSession.pauseVideoStream();
- }
-
- /**
- *Resumes the stream for the opened video service (serviceType 11)
- *@return true if the video service is resumed successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- public boolean resumeVideoStream() {
- return false;//sdlSession != null && sdlSession.resumeVideoStream();
- }
-
- /**
- * Opens the video service (serviceType 11) and creates a Surface (used for streaming video) with input parameters provided by the app
- * @param frameRate - specified rate of frames to utilize for creation of Surface
- * @param iFrameInterval - specified interval to utilize for creation of Surface
- * @param width - specified width to utilize for creation of Surface
- * @param height - specified height to utilize for creation of Surface
- * @param bitrate - specified bitrate to utilize for creation of Surface
- *@return Surface if service is opened successfully and stream is started, return null otherwise
- */
- @SuppressWarnings("unused")
- public Surface createOpenGLInputSurface(int frameRate, int iFrameInterval, int width,
- int height, int bitrate, boolean isEncrypted) {
-
- if (sdlSession == null || !sdlSession.getIsConnected()){
- return null;
- }
-
- VideoStreamingParameters desired = new VideoStreamingParameters();
- desired.setFrameRate(frameRate);
- desired.setInterval(iFrameInterval);
- ImageResolution resolution = new ImageResolution();
- resolution.setResolutionWidth(width);
- resolution.setResolutionHeight(height);
- desired.setResolution(resolution);
- desired.setBitrate(bitrate);
-
- VideoStreamingParameters acceptedParams = tryStartVideoStream(isEncrypted, desired);
- if (acceptedParams != null) {
- return null;//sdlSession.createOpenGLInputSurface(frameRate, iFrameInterval, width,
- //height, bitrate, SessionType.NAV, sdlSession.getSessionId());
- } else {
- return null;
- }
- }
-
- /**
- * Starts streaming a remote display to the module if there is a connected session. This method of streaming requires the device to be on API level 19 or higher
- * @param context a context that can be used to create the remote display
- * @param remoteDisplay class object of the remote display. This class will be used to create an instance of the remote display and will be projected to the module
- * @param parameters streaming parameters to be used when streaming. If null is sent in, the default/optimized options will be used.
- * If you are unsure about what parameters to be used it is best to just send null and let the system determine what
- * works best for the currently connected module.
- *
- * @param encrypted a flag of if the stream should be encrypted. Only set if you have a supplied encryption library that the module can understand.
- */
- @TargetApi(19)
- public void startRemoteDisplayStream(Context context, final Class<? extends SdlRemoteDisplay> remoteDisplay, final VideoStreamingParameters parameters, final boolean encrypted){
- if(protocolVersion!= null && protocolVersion.getMajor() >= 5 && !_systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
- DebugTool.logError(TAG, "Video streaming not supported on this module");
- return;
- }
- //Create streaming manager
- if(manager == null){
- manager = new VideoStreamingManager(context,this._internalInterface);
- }
-
- if(parameters == null){
- if(protocolVersion!= null && protocolVersion.getMajor() >= 5) {
- _systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
- @Override
- public void onCapabilityRetrieved(Object capability) {
- VideoStreamingParameters params = new VideoStreamingParameters();
- params.update((VideoStreamingCapability)capability); //Streaming parameters are ready time to stream
- sdlSession.setDesiredVideoParams(params);
- manager.startVideoStreaming(remoteDisplay, params, encrypted);
- }
-
- @Override
- public void onError(String info) {
- DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info);
-
- }
- });
- }else{
- //We just use default video streaming params
- VideoStreamingParameters params = new VideoStreamingParameters();
- DisplayCapabilities dispCap = (DisplayCapabilities)_systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY);
- if(dispCap !=null){
- params.setResolution(dispCap.getScreenParams().getImageResolution());
- }
- sdlSession.setDesiredVideoParams(params);
- manager.startVideoStreaming(remoteDisplay,params, encrypted);
- }
- }else{
- sdlSession.setDesiredVideoParams(parameters);
- manager.startVideoStreaming(remoteDisplay,parameters, encrypted);
- }
- }
-
- /**
- * Stops the remote display stream if one has been started
- */
- public void stopRemoteDisplayStream(){
- if(manager!=null){
- manager.dispose();
- }
- manager = null;
- }
-
- /**
- * Try to open a video service by using the video streaming parameters supplied.
- *
- * Only information from codecs, width and height are used during video format negotiation.
- *
- * @param isEncrypted Specify true if packets on this service have to be encrypted
- * @param parameters VideoStreamingParameters that are desired. Does not guarantee this is what will be accepted.
- *
- * @return If the service is opened successfully, an instance of VideoStreamingParams is
- * returned which contains accepted video format. If the service is opened with legacy
- * mode (i.e. without any negotiation) then an instance of VideoStreamingParams is
- * returned. If the service was not opened then null is returned.
- */
- @SuppressWarnings("unused")
- private VideoStreamingParameters tryStartVideoStream(boolean isEncrypted, VideoStreamingParameters parameters) {
- if (sdlSession == null) {
- DebugTool.logWarning(TAG, "SdlSession is not created yet.");
- return null;
- }
- if(protocolVersion!= null && protocolVersion.getMajor() >= 5 && !_systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
- DebugTool.logWarning(TAG, "Module doesn't support video streaming.");
- return null;
- }
- if (parameters == null) {
- DebugTool.logWarning(TAG, "Video parameters were not supplied.");
- return null;
- }
-
- if(!navServiceStartResponseReceived || !navServiceStartResponse //If we haven't started the service before
- || (navServiceStartResponse && isEncrypted && !sdlSession.isServiceProtected(SessionType.NAV))) { //Or the service has been started but we'd like to start an encrypted one
- sdlSession.setDesiredVideoParams(parameters);
-
- navServiceStartResponseReceived = false;
- navServiceStartResponse = false;
- navServiceStartRejectedParams = null;
-
- sdlSession.startService(SessionType.NAV, isEncrypted);
- addNavListener();
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- //noinspection StatementWithEmptyBody
- while (!navServiceStartResponseReceived && !fTask.isDone()) ;
- scheduler.shutdown();
- }
-
- if (navServiceStartResponse) {
- if(protocolVersion!= null && protocolVersion.getMajor() < 5){ //Versions 1-4 do not support streaming parameter negotiations
- sdlSession.setAcceptedVideoParams(parameters);
- }
- return sdlSession.getAcceptedVideoParams();
- }
-
- if (navServiceStartRejectedParams != null) {
- StringBuilder builder = new StringBuilder();
- for (String paramName : navServiceStartRejectedParams) {
- if (builder.length() > 0) {
- builder.append(", ");
- }
- builder.append(paramName);
- }
-
- DebugTool.logWarning(TAG, "StartService for nav failed. Rejected params: " + builder.toString());
-
- } else {
- DebugTool.logWarning(TAG, "StartService for nav failed (rejected params not supplied)");
- }
-
- return null;
- }
-
- /**
- *Starts the MediaCodec encoder utilized in conjunction with the Surface returned via the createOpenGLInputSurface method
- */
- @SuppressWarnings("unused")
- public void startEncoder () {
- if (sdlSession == null || !sdlSession.getIsConnected()) return;
-
- //sdlSession.startEncoder();
- }
-
- /**
- *Releases the MediaCodec encoder utilized in conjunction with the Surface returned via the createOpenGLInputSurface method
- */
- @SuppressWarnings("unused")
- public void releaseEncoder() {
- if (sdlSession == null || !sdlSession.getIsConnected()) return;
-
- //sdlSession.releaseEncoder();
- }
-
- /**
- *Releases the MediaCodec encoder utilized in conjunction with the Surface returned via the createOpenGLInputSurface method
- */
- @SuppressWarnings("unused")
- public void drainEncoder(boolean endOfStream) {
- if (sdlSession == null || !sdlSession.getIsConnected()) return;
-
- //sdlSession.drainEncoder(endOfStream);
- }
-
- private void addNavListener(){
-
- // videos may be started and stopped. Only add this once
- if (navServiceListener == null){
-
- navServiceListener = new ISdlServiceListener() {
- @Override
- public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) { }
-
- @Override
- public void onServiceEnded(SdlSession session, SessionType type) {
- // reset nav flags so nav can start upon the next transport connection
- resetNavStartFlags();
- // propagate notification up to proxy listener so the developer will know that the service is ended
- if (_proxyListener != null) {
- _proxyListener.onServiceEnded(new OnServiceEnded(type));
- }
- }
-
- @Override
- public void onServiceError(SdlSession session, SessionType type, String reason) {
- // if there is an error reset the flags so that there is a chance to restart streaming
- resetNavStartFlags();
- }
- };
- this.sdlSession.addServiceListener(SessionType.NAV, navServiceListener);
- }
- }
-
- /**
- * Opens a audio service (service type 10) and subsequently provides an IAudioStreamListener
- * to the app to send audio data.
- *
- * Currently information passed by "params" are ignored, since Audio Streaming feature lacks
- * capability negotiation mechanism. App should configure audio stream data to align with
- * head unit's capability by checking (upcoming) pcmCapabilities. The default format is in
- * 16kHz and 16 bits.
- *
- * @param isEncrypted Specify true if packets on this service have to be encrypted
- * @param codec Audio codec which will be used for streaming. Currently, only
- * AudioStreamingCodec.LPCM is accepted.
- * @param params (Reserved for future use) Additional configuration information for each
- * codec. If "codec" is AudioStreamingCodec.LPCM, "params" must be an
- * instance of LPCMParams class.
- *
- * @return IAudioStreamListener interface if service is opened successfully and streaming is
- * started, null otherwise
- */
- @SuppressWarnings("unused")
- public IAudioStreamListener startAudioStream(boolean isEncrypted, AudioStreamingCodec codec,
- AudioStreamingParams params) {
- if (sdlSession == null) {
- DebugTool.logWarning(TAG, "SdlSession is not created yet.");
- return null;
- }
- if (!sdlSession.getIsConnected()) {
- DebugTool.logWarning(TAG, "Connection is not available.");
- return null;
- }
- if (codec != AudioStreamingCodec.LPCM) {
- DebugTool.logWarning(TAG, "Audio codec " + codec + " is not supported.");
- return null;
- }
-
- pcmServiceStartResponseReceived = false;
- pcmServiceStartResponse = false;
- sdlSession.startService(SessionType.PCM, isEncrypted);
-
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- //noinspection StatementWithEmptyBody
- while (!pcmServiceStartResponseReceived && !fTask.isDone());
- scheduler.shutdown();
-
- if (pcmServiceStartResponse) {
- DebugTool.logInfo(TAG, "StartService for audio succeeded");
- return null;//sdlSession.startAudioStream();
- } else {
- if (pcmServiceStartRejectedParams != null) {
- StringBuilder builder = new StringBuilder();
- for (String paramName : pcmServiceStartRejectedParams) {
- if (builder.length() > 0) {
- builder.append(", ");
- }
- builder.append(paramName);
- }
- DebugTool.logWarning(TAG, "StartService for audio failed. Rejected params: " + builder.toString());
- } else {
- DebugTool.logWarning(TAG, "StartService for audio failed (rejected params not supplied)");
- }
- return null;
- }
- }
-
- /**
- *Closes the opened audio service (serviceType 10)
- *@return true if the audio service is closed successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- public boolean endAudioStream() {
- if (sdlSession == null || !sdlSession.getIsConnected()) return false;
-
- pcmServiceEndResponseReceived = false;
- pcmServiceEndResponse = false;
- //sdlSession.stopAudioStream();
-
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- //noinspection StatementWithEmptyBody
- while (!pcmServiceEndResponseReceived && !fTask.isDone());
- scheduler.shutdown();
-
- return pcmServiceEndResponse;
- }
-
- /**
- *Pauses the stream for the opened audio service (serviceType 10)
- *@return true if the audio service stream is paused successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- public boolean pauseAudioStream() {
- return false;//sdlSession != null && sdlSession.pauseAudioStream();
- }
-
- /**
- *Resumes the stream for the opened audio service (serviceType 10)
- *@return true if the audio service stream is resumed successfully, return false otherwise
- */
- @SuppressWarnings("unused")
- public boolean resumeAudioStream() {
- return false;//sdlSession != null && sdlSession.resumeAudioStream();
- }
-
- private void NavServiceStarted() {
- navServiceStartResponseReceived = true;
- navServiceStartResponse = true;
- }
-
- private void NavServiceStartedNACK(List<String> rejectedParams) {
- navServiceStartResponseReceived = true;
- navServiceStartResponse = false;
- navServiceStartRejectedParams = rejectedParams;
- }
-
- private void AudioServiceStarted() {
- pcmServiceStartResponseReceived = true;
- pcmServiceStartResponse = true;
- }
-
- private void RPCProtectedServiceStarted() {
- rpcProtectedResponseReceived = true;
- rpcProtectedStartResponse = true;
- }
- private void AudioServiceStartedNACK(List<String> rejectedParams) {
- pcmServiceStartResponseReceived = true;
- pcmServiceStartResponse = false;
- pcmServiceStartRejectedParams = rejectedParams;
- }
-
- private void NavServiceEnded() {
- navServiceEndResponseReceived = true;
- navServiceEndResponse = true;
- }
-
- private void NavServiceEndedNACK() {
- navServiceEndResponseReceived = true;
- navServiceEndResponse = false;
- }
-
- private void AudioServiceEnded() {
- pcmServiceEndResponseReceived = true;
- pcmServiceEndResponse = true;
- }
-
- private void AudioServiceEndedNACK() {
- pcmServiceEndResponseReceived = true;
- pcmServiceEndResponse = false;
- }
-
- private void resetNavStartFlags() {
- navServiceStartResponseReceived = false;
- navServiceStartResponse = false;
- navServiceStartRejectedParams = null;
- }
-
- public void setAppService(Service mService)
- {
- _appService = mService;
- }
-
- @SuppressWarnings("unused")
- public boolean startProtectedRPCService() {
- rpcProtectedResponseReceived = false;
- rpcProtectedStartResponse = false;
- sdlSession.startService(SessionType.RPC, true);
-
- FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
- ScheduledExecutorService scheduler = createScheduler();
- scheduler.execute(fTask);
-
- //noinspection StatementWithEmptyBody
- while (!rpcProtectedResponseReceived && !fTask.isDone());
- scheduler.shutdown();
-
- return rpcProtectedStartResponse;
- }
-
- @SuppressWarnings("unused")
- public void getLockScreenIcon(final OnLockScreenIconDownloadedListener l){
- if(lockScreenIconRequest == null){
- l.onLockScreenIconDownloadError(new SdlException("This version of SDL core may not support lock screen icons.",
- SdlExceptionCause.LOCK_SCREEN_ICON_NOT_SUPPORTED));
- return;
- }
-
- LockScreenManager lockMan = null;//sdlSession.getLockScreenMan();
- Bitmap bitmap = lockMan.getLockScreenIcon();
-
- // read bitmap if it was already downloaded so we don't have to download it every time
- if(bitmap != null){
- l.onLockScreenIconDownloaded(bitmap);
- }
- else{
- String url = lockScreenIconRequest.getUrl().replaceFirst("http://", "https://");
- //sdlSession.getLockScreenMan().downloadLockScreenIcon(url, l);
- }
- }
-
- /* ******************* Public Helper Methods *************************/
-
- /*Begin V1 Enhanced helper*/
-
- /**
- *Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- *@param commandID -Unique command ID of the command to add.
- *@param menuText -Menu text for optional sub value containing menu parameters.
- *@param parentID -Menu parent ID for optional sub value containing menu parameters.
- *@param position -Menu position for optional sub value containing menu parameters.
- *@param vrCommands -VR synonyms for this AddCommand.
- *@param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
- *@param IconType -Describes whether the image is static or dynamic
- *@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("SameParameterValue")
- public void addCommand(@NonNull Integer commandID,
- String menuText, Integer parentID, Integer position,
- Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
- throws SdlException {
-
-
- AddCommand msg = new AddCommand(commandID);
- msg.setCorrelationID(correlationID);
-
- if (vrCommands != null) msg.setVrCommands(vrCommands);
-
- Image cmdIcon = null;
-
- if (IconValue != null && IconType != null)
- {
- cmdIcon = new Image();
- cmdIcon.setValue(IconValue);
- cmdIcon.setImageType(IconType);
- }
-
- if (cmdIcon != null) msg.setCmdIcon(cmdIcon);
-
- if(menuText != null || parentID != null || position != null) {
- MenuParams menuParams = new MenuParams();
- menuParams.setMenuName(menuText);
- menuParams.setPosition(position);
- menuParams.setParentID(parentID);
- msg.setMenuParams(menuParams);
- }
-
- sendRPCRequest(msg);
- }
-
- /**
- *Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- *@param commandID -Unique command ID of the command to add.
- *@param menuText -Menu text for optional sub value containing menu parameters.
- *@param position -Menu position for optional sub value containing menu parameters.
- *@param vrCommands -VR synonyms for this AddCommand.
- *@param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
- *@param IconType -Describes whether the image is static or dynamic
- *@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void addCommand(Integer commandID,
- String menuText, Integer position,
- Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
- throws SdlException {
-
- addCommand(commandID, menuText, null, position, vrCommands, IconValue, IconType, correlationID);
- }
-
- /**
- *Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- *@param commandID -Unique command ID of the command to add.
- *@param menuText -Menu text for optional sub value containing menu parameters.
- *@param position -Menu position for optional sub value containing menu parameters.
- *@param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
- *@param IconType -Describes whether the image is static or dynamic
- *@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void addCommand(Integer commandID,
- String menuText, Integer position, String IconValue, ImageType IconType,
- Integer correlationID)
- throws SdlException {
-
- addCommand(commandID, menuText, null, position, null, IconValue, IconType, correlationID);
- }
-
- /**
- *Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- *@param commandID -Unique command ID of the command to add.
- *@param menuText -Menu text for optional sub value containing menu parameters.
- *@param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
- *@param IconType -Describes whether the image is static or dynamic
- *@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void addCommand(Integer commandID,
- String menuText, String IconValue, ImageType IconType, Integer correlationID)
- throws SdlException {
-
- addCommand(commandID, menuText, null, null, null, IconValue, IconType, correlationID);
- }
-
- /**
- * Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param commandID -Unique command ID of the command to add.
- * @param menuText -Menu text for optional sub value containing menu parameters.
- * @param vrCommands -VR synonyms for this AddCommand.
- * @param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
- * @param IconType -Describes whether the image is static or dynamic
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void addCommand(Integer commandID,
- String menuText, Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
- throws SdlException {
-
- addCommand(commandID, menuText, null, null, vrCommands, IconValue, IconType, correlationID);
- }
-
- /**
- * Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param commandID -Unique command ID of the command to add.
- * @param vrCommands -VR synonyms for this AddCommand.
- * @param IconValue -A static hex icon value or the binary image file name identifier (sent by the PutFile RPC).
- * @param IconType -Describes whether the image is static or dynamic
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void addCommand(Integer commandID,
- Vector<String> vrCommands, String IconValue, ImageType IconType, Integer correlationID)
- throws SdlException {
-
- addCommand(commandID, null, null, null, vrCommands, IconValue, IconType, correlationID);
- }
-
- /*End V1 Enhanced helper*/
-
- /**
- *Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- *@param commandID -Unique command ID of the command to add.
- *@param menuText -Menu text for optional sub value containing menu parameters.
- *@param parentID -Menu parent ID for optional sub value containing menu parameters.
- *@param position -Menu position for optional sub value containing menu parameters.
- *@param vrCommands -VR synonyms for this AddCommand.
- *@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("SameParameterValue")
- public void addCommand(@NonNull Integer commandID,
- String menuText, Integer parentID, Integer position,
- Vector<String> vrCommands, Integer correlationID)
- throws SdlException {
-
- AddCommand msg = new AddCommand(commandID);
- msg.setCorrelationID(correlationID);
- msg.setVrCommands(vrCommands);
- if(menuText != null || parentID != null || position != null) {
- MenuParams menuParams = new MenuParams();
- menuParams.setMenuName(menuText);
- menuParams.setPosition(position);
- menuParams.setParentID(parentID);
- msg.setMenuParams(menuParams);
- }
-
- sendRPCRequest(msg);
- }
-
- /**
- *Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- *@param commandID -Unique command ID of the command to add.
- *@param menuText -Menu text for optional sub value containing menu parameters.
- *@param position -Menu position for optional sub value containing menu parameters.
- *@param vrCommands -VR synonyms for this AddCommand.
- *@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void addCommand(Integer commandID,
- String menuText, Integer position,
- Vector<String> vrCommands, Integer correlationID)
- throws SdlException {
-
- addCommand(commandID, menuText, null, position, vrCommands, correlationID);
- }
-
- /**
- *Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- *@param commandID -Unique command ID of the command to add.
- *@param menuText -Menu text for optional sub value containing menu parameters.
- *@param position -Menu position for optional sub value containing menu parameters.
- *@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void addCommand(Integer commandID,
- String menuText, Integer position,
- Integer correlationID)
- throws SdlException {
-
- addCommand(commandID, menuText, null, position, null, correlationID);
- }
-
- /**
- *Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- *@param commandID -Unique command ID of the command to add.
- *@param menuText -Menu text for optional sub value containing menu parameters.
- *@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void addCommand(Integer commandID,
- String menuText, Integer correlationID)
- throws SdlException {
- addCommand(commandID, menuText, null, null, (Vector<String>)null, correlationID);
- }
-
- /**
- * Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- *@param commandID -Unique command ID of the command to add.
- *@param menuText -Menu text for optional sub value containing menu parameters.
- *@param vrCommands -VR synonyms for this AddCommand.
- *@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void addCommand(Integer commandID,
- String menuText, Vector<String> vrCommands, Integer correlationID)
- throws SdlException {
-
- addCommand(commandID, menuText, null, null, vrCommands, correlationID);
- }
-
- /**
- * Sends an AddCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- *@param commandID -Unique command ID of the command to add.
- *@param vrCommands -VR synonyms for this AddCommand.
- *@param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void addCommand(Integer commandID,
- Vector<String> vrCommands, Integer correlationID)
- throws SdlException {
-
- addCommand(commandID, null, null, null, vrCommands, correlationID);
- }
-
- /**
- * Sends an AddSubMenu RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param menuID -Unique ID of the sub menu to add.
- * @param menuName -Text to show in the menu for this sub menu.
- * @param position -Position within the items that are are at top level of the in application menu.
- * @param menuIcon -Image to be be shown along with the submenu item
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("SameParameterValue")
- public void addSubMenu(@NonNull Integer menuID, @NonNull String menuName,
- Integer position, Image menuIcon, Integer correlationID)
- throws SdlException {
-
- AddSubMenu msg = new AddSubMenu(menuID, menuName);
- msg.setCorrelationID(correlationID);
- msg.setPosition(position);
- msg.setMenuIcon(menuIcon);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends an AddSubMenu RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param menuID -Unique ID of the sub menu to add.
- * @param menuName -Text to show in the menu for this sub menu.
- * @param position -Position within the items that are are at top level of the in application menu.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @Deprecated
- @SuppressWarnings("SameParameterValue")
- public void addSubMenu(@NonNull Integer menuID, @NonNull String menuName,
- Integer position, Integer correlationID)
- throws SdlException {
-
- addSubMenu(menuID, menuName, position, null, correlationID);
- }
-
- /**
- * Sends an AddSubMenu RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param menuID -Unique ID of the sub menu to add.
- * @param menuName -Text to show in the menu for this sub menu.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @Deprecated
- @SuppressWarnings("unused")
- public void addSubMenu(Integer menuID, String menuName,
- Integer correlationID) throws SdlException {
-
- addSubMenu(menuID, menuName, null, null, correlationID);
- }
-
- /*Begin V1 Enhanced helper*/
- /**
- * Sends an Alert RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param ttsText -The text to speech message in the form of a string.
- * @param alertText1 -The first line of the alert text field.
- * @param alertText2 -The second line of the alert text field.
- * @param alertText3 -The optional third line of the alert text field.
- * @param playTone -Defines if tone should be played.
- * @param duration -Timeout in milliseconds.
- * @param softButtons -A list of App defined SoftButtons.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("SameParameterValue")
- public void alert(String ttsText, String alertText1,
- String alertText2, String alertText3, Boolean playTone, Integer duration, Vector<SoftButton> softButtons,
- Integer correlationID) throws SdlException {
-
- Vector<TTSChunk> chunks = TTSChunkFactory.createSimpleTTSChunks(ttsText);
- Alert msg = new Alert();
- msg.setCorrelationID(correlationID);
- msg.setAlertText1(alertText1);
- msg.setAlertText2(alertText2);
- msg.setAlertText3(alertText3);
- msg.setDuration(duration);
- msg.setPlayTone(playTone);
- msg.setTtsChunks(chunks);
- msg.setSoftButtons(softButtons);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends an Alert RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param ttsChunks -Text/phonemes to speak in the form of ttsChunks.
- * @param alertText1 -The first line of the alert text field.
- * @param alertText2 -The second line of the alert text field.
- * @param alertText3 -The optional third line of the alert text field.
- * @param playTone -Defines if tone should be played.
- * @param duration -Timeout in milliseconds.
- * @param softButtons -A list of App defined SoftButtons.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- public void alert(Vector<TTSChunk> ttsChunks,
- String alertText1, String alertText2, String alertText3, Boolean playTone,
- Integer duration, Vector<SoftButton> softButtons, Integer correlationID) throws SdlException {
-
- Alert msg = new Alert();
- msg.setCorrelationID(correlationID);
- msg.setAlertText1(alertText1);
- msg.setAlertText2(alertText2);
- msg.setAlertText3(alertText3);
- msg.setDuration(duration);
- msg.setPlayTone(playTone);
- msg.setTtsChunks(ttsChunks);
- msg.setSoftButtons(softButtons);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends an Alert RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param ttsText -The text to speech message in the form of a string.
- * @param playTone -Defines if tone should be played.
- * @param softButtons -A list of App defined SoftButtons.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void alert(String ttsText, Boolean playTone, Vector<SoftButton> softButtons,
- Integer correlationID) throws SdlException {
-
- alert(ttsText, null, null, null, playTone, null, softButtons, correlationID);
- }
-
- /**
- * Sends an Alert RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param chunks -A list of text/phonemes to speak in the form of ttsChunks.
- * @param playTone -Defines if tone should be played.
- * @param softButtons -A list of App defined SoftButtons.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void alert(Vector<TTSChunk> chunks, Boolean playTone, Vector<SoftButton> softButtons,
- Integer correlationID) throws SdlException {
-
- alert(chunks, null, null, null, playTone, null, softButtons, correlationID);
- }
-
- /**
- * Sends an Alert RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param alertText1 -The first line of the alert text field.
- * @param alertText2 -The second line of the alert text field.
- * @param alertText3 -The optional third line of the alert text field.
- * @param playTone -Defines if tone should be played.
- * @param duration -Timeout in milliseconds.
- * @param softButtons -A list of App defined SoftButtons.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void alert(String alertText1, String alertText2, String alertText3,
- Boolean playTone, Integer duration, Vector<SoftButton> softButtons, Integer correlationID)
- throws SdlException {
-
- alert((Vector<TTSChunk>)null, alertText1, alertText2, alertText3, playTone, duration, softButtons, correlationID);
- }
-
- /*End V1 Enhanced helper*/
-
- /**
- * Sends an Alert RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param ttsText -The text to speech message in the form of a string.
- * @param alertText1 -The first line of the alert text field.
- * @param alertText2 -The second line of the alert text field.
- * @param playTone -Defines if tone should be played.
- * @param duration -Timeout in milliseconds.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("SameParameterValue")
- public void alert(String ttsText, String alertText1,
- String alertText2, Boolean playTone, Integer duration,
- Integer correlationID) throws SdlException {
-
- Vector<TTSChunk> chunks = TTSChunkFactory.createSimpleTTSChunks(ttsText);
- Alert msg = new Alert();
- msg.setCorrelationID(correlationID);
- msg.setAlertText1(alertText1);
- msg.setAlertText2(alertText2);
- msg.setDuration(duration);
- msg.setPlayTone(playTone);
- msg.setTtsChunks(chunks);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends an Alert RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param ttsChunks -A list of text/phonemes to speak in the form of ttsChunks.
- * @param alertText1 -The first line of the alert text field.
- * @param alertText2 -The second line of the alert text field.
- * @param playTone -Defines if tone should be played.
- * @param duration -Timeout in milliseconds.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- public void alert(Vector<TTSChunk> ttsChunks,
- String alertText1, String alertText2, Boolean playTone,
- Integer duration, Integer correlationID) throws SdlException {
-
- Alert msg = new Alert();
- msg.setCorrelationID(correlationID);
- msg.setAlertText1(alertText1);
- msg.setAlertText2(alertText2);
- msg.setDuration(duration);
- msg.setPlayTone(playTone);
- msg.setTtsChunks(ttsChunks);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends an Alert RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param ttsText -The text to speech message in the form of a string.
- * @param playTone -Defines if tone should be played.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void alert(String ttsText, Boolean playTone,
- Integer correlationID) throws SdlException {
-
- alert(ttsText, null, null, playTone, null, correlationID);
- }
-
- /**
- * Sends an Alert RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param chunks -A list of text/phonemes to speak in the form of ttsChunks.
- * @param playTone -Defines if tone should be played.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void alert(Vector<TTSChunk> chunks, Boolean playTone,
- Integer correlationID) throws SdlException {
-
- alert(chunks, null, null, playTone, null, correlationID);
- }
-
- /**
- * Sends an Alert RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param alertText1 -The first line of the alert text field.
- * @param alertText2 -The second line of the alert text field.
- * @param playTone -Defines if tone should be played.
- * @param duration -Timeout in milliseconds.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void alert(String alertText1, String alertText2,
- Boolean playTone, Integer duration, Integer correlationID)
- throws SdlException {
-
- alert((Vector<TTSChunk>)null, alertText1, alertText2, playTone, duration, correlationID);
- }
-
- /**
- * Sends a CreateInteractionChoiceSet RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param choiceSet to be sent to the module
- * @param interactionChoiceSetID to be used in reference to the supplied choiceSet
- * @param correlationID to be set to the RPCRequest
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void createInteractionChoiceSet(
- @NonNull Vector<Choice> choiceSet, @NonNull Integer interactionChoiceSetID,
- Integer correlationID) throws SdlException {
-
- CreateInteractionChoiceSet msg = new CreateInteractionChoiceSet(interactionChoiceSetID, choiceSet);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a DeleteCommand RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param commandID -ID of the command(s) to delete.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void deleteCommand(@NonNull Integer commandID,
- Integer correlationID) throws SdlException {
-
- DeleteCommand msg = new DeleteCommand(commandID);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a DeleteInteractionChoiceSet RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param interactionChoiceSetID -ID of the interaction choice set to delete.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void deleteInteractionChoiceSet(
- @NonNull Integer interactionChoiceSetID, Integer correlationID)
- throws SdlException {
-
- DeleteInteractionChoiceSet msg = new DeleteInteractionChoiceSet(interactionChoiceSetID);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a DeleteSubMenu RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param menuID -The menuID of the submenu to delete.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void deleteSubMenu(Integer menuID,
- Integer correlationID) throws SdlException {
-
- DeleteSubMenu msg = new DeleteSubMenu(menuID);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
-
-
- /*Begin V1 Enhanced helper*/
-
- /**
- * Sends a PerformInteraction RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param initPrompt -Intial prompt spoken to the user at the start of an interaction.
- * @param displayText -Text to be displayed first.
- * @param interactionChoiceSetID -Interaction choice set IDs to use with an interaction.
- * @param vrHelp -Suggested VR Help Items to display on-screen during Perform Interaction.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void performInteraction(String initPrompt,
- @NonNull String displayText, @NonNull Integer interactionChoiceSetID, Vector<VrHelpItem> vrHelp,
- Integer correlationID) throws SdlException {
-
- Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
- interactionChoiceSetIDs.add(interactionChoiceSetID);
- Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
- PerformInteraction msg = new PerformInteraction(displayText, InteractionMode.BOTH, interactionChoiceSetIDs);
- msg.setInitialPrompt(initChunks);
- msg.setVrHelp(vrHelp);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a PerformInteraction RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param initPrompt -Intial prompt spoken to the user at the start of an interaction.
- * @param displayText -Text to be displayed first.
- * @param interactionChoiceSetID -Interaction choice set IDs to use with an interaction.
- * @param helpPrompt -Help text that is spoken when a user speaks "help" during the interaction.
- * @param timeoutPrompt -Timeout text that is spoken when a VR interaction times out.
- * @param interactionMode - The method in which the user is notified and uses the interaction (Manual,VR,Both).
- * @param timeout -Timeout in milliseconds.
- * @param vrHelp -Suggested VR Help Items to display on-screen during Perform Interaction.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void performInteraction(String initPrompt,
- @NonNull String displayText, @NonNull Integer interactionChoiceSetID,
- String helpPrompt, String timeoutPrompt,
- @NonNull InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
- Integer correlationID) throws SdlException {
-
- Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
- interactionChoiceSetIDs.add(interactionChoiceSetID);
- Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
- Vector<TTSChunk> helpChunks = TTSChunkFactory.createSimpleTTSChunks(helpPrompt);
- Vector<TTSChunk> timeoutChunks = TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt);
- PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDs);
- msg.setInitialPrompt(initChunks);
- msg.setTimeout(timeout);
- msg.setHelpPrompt(helpChunks);
- msg.setTimeoutPrompt(timeoutChunks);
- msg.setVrHelp(vrHelp);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a PerformInteraction RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param initPrompt -Intial prompt spoken to the user at the start of an interaction.
- * @param displayText -Text to be displayed first.
- * @param interactionChoiceSetIDList -A list of interaction choice set IDs to use with an interaction.
- * @param helpPrompt -Help text that is spoken when a user speaks "help" during the interaction.
- * @param timeoutPrompt -Timeout text that is spoken when a VR interaction times out.
- * @param interactionMode - The method in which the user is notified and uses the interaction (Manual,VR,Both).
- * @param timeout -Timeout in milliseconds.
- * @param vrHelp -Suggested VR Help Items to display on-screen during Perform Interaction.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void performInteraction(String initPrompt,
- @NonNull String displayText, @NonNull Vector<Integer> interactionChoiceSetIDList,
- String helpPrompt, String timeoutPrompt,
- @NonNull InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
- Integer correlationID) throws SdlException {
-
- Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
- Vector<TTSChunk> helpChunks = TTSChunkFactory.createSimpleTTSChunks(helpPrompt);
- Vector<TTSChunk> timeoutChunks = TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt);
- PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDList);
- msg.setInitialPrompt(initChunks);
- msg.setTimeout(timeout);
- msg.setHelpPrompt(helpChunks);
- msg.setTimeoutPrompt(timeoutChunks);
- msg.setVrHelp(vrHelp);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a PerformInteraction RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param initChunks -A list of text/phonemes to speak for the initial prompt in the form of ttsChunks.
- * @param displayText -Text to be displayed first.
- * @param interactionChoiceSetIDList -A list of interaction choice set IDs to use with an interaction.
- * @param helpChunks -A list of text/phonemes to speak for the help text that is spoken when a user speaks "help" during the interaction.
- * @param timeoutChunks A list of text/phonems to speak for the timeout text that is spoken when a VR interaction times out.
- * @param interactionMode - The method in which the user is notified and uses the interaction (Manual,VR,Both).
- * @param timeout -Timeout in milliseconds.
- * @param vrHelp -Suggested VR Help Items to display on-screen during Perform Interaction.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void performInteraction(
- Vector<TTSChunk> initChunks, @NonNull String displayText,
- @NonNull Vector<Integer> interactionChoiceSetIDList,
- Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks,
- @NonNull InteractionMode interactionMode, Integer timeout, Vector<VrHelpItem> vrHelp,
- Integer correlationID) throws SdlException {
-
- PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDList);
- msg.setInitialPrompt(initChunks);
- msg.setTimeout(timeout);
- msg.setHelpPrompt(helpChunks);
- msg.setTimeoutPrompt(timeoutChunks);
- msg.setVrHelp(vrHelp);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /*End V1 Enhanced*/
-
- /**
- * Sends a PerformInteraction RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param initPrompt -Intial prompt spoken to the user at the start of an interaction.
- * @param displayText -Text to be displayed first.
- * @param interactionChoiceSetID -Interaction choice set IDs to use with an interaction.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void performInteraction(String initPrompt,
- @NonNull String displayText, @NonNull Integer interactionChoiceSetID,
- Integer correlationID) throws SdlException {
-
- Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
- interactionChoiceSetIDs.add(interactionChoiceSetID);
- Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
- PerformInteraction msg = new PerformInteraction(displayText, InteractionMode.BOTH, interactionChoiceSetIDs);
- msg.setInitialPrompt(initChunks);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a PerformInteraction RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param initPrompt -Intial prompt spoken to the user at the start of an interaction.
- * @param displayText -Text to be displayed first.
- * @param interactionChoiceSetID -Interaction choice set IDs to use with an interaction.
- * @param helpPrompt -Help text that is spoken when a user speaks "help" during the interaction.
- * @param timeoutPrompt -Timeout text that is spoken when a VR interaction times out.
- * @param interactionMode - The method in which the user is notified and uses the interaction (Manual,VR,Both).
- * @param timeout -Timeout in milliseconds.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void performInteraction(String initPrompt,
- @NonNull String displayText, @NonNull Integer interactionChoiceSetID,
- String helpPrompt, String timeoutPrompt,
- @NonNull InteractionMode interactionMode, Integer timeout,
- Integer correlationID) throws SdlException {
-
- Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
- interactionChoiceSetIDs.add(interactionChoiceSetID);
- Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
- Vector<TTSChunk> helpChunks = TTSChunkFactory.createSimpleTTSChunks(helpPrompt);
- Vector<TTSChunk> timeoutChunks = TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt);
- PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDs);
- msg.setInitialPrompt(initChunks);
- msg.setTimeout(timeout);
- msg.setHelpPrompt(helpChunks);
- msg.setTimeoutPrompt(timeoutChunks);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a PerformInteraction RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param initPrompt -Intial prompt spoken to the user at the start of an interaction.
- * @param displayText -Text to be displayed first.
- * @param interactionChoiceSetIDList -A list of interaction choice set IDs to use with an interaction.
- * @param helpPrompt -Help text that is spoken when a user speaks "help" during the interaction.
- * @param timeoutPrompt -Timeout text that is spoken when a VR interaction times out.
- * @param interactionMode - The method in which the user is notified and uses the interaction (Manual,VR,Both).
- * @param timeout -Timeout in milliseconds.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void performInteraction(String initPrompt,
- @NonNull String displayText, @NonNull Vector<Integer> interactionChoiceSetIDList,
- String helpPrompt, String timeoutPrompt,
- @NonNull InteractionMode interactionMode, Integer timeout,
- Integer correlationID) throws SdlException {
-
- Vector<TTSChunk> initChunks = TTSChunkFactory.createSimpleTTSChunks(initPrompt);
- Vector<TTSChunk> helpChunks = TTSChunkFactory.createSimpleTTSChunks(helpPrompt);
- Vector<TTSChunk> timeoutChunks = TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt);
- PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDList);
- msg.setInitialPrompt(initChunks);
- msg.setTimeout(timeout);
- msg.setHelpPrompt(helpChunks);
- msg.setTimeoutPrompt(timeoutChunks);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a PerformInteraction RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param initChunks -A list of text/phonemes to speak for the initial prompt in the form of ttsChunks.
- * @param displayText -Text to be displayed first.
- * @param interactionChoiceSetIDList -A list of interaction choice set IDs to use with an interaction.
- * @param helpChunks -A list of text/phonemes to speak for the help text that is spoken when a user speaks "help" during the interaction.
- * @param timeoutChunks A list of text/phonems to speak for the timeout text that is spoken when a VR interaction times out.
- * @param interactionMode - The method in which the user is notified and uses the interaction (Manual,VR,Both).
- * @param timeout -Timeout in milliseconds.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void performInteraction(
- Vector<TTSChunk> initChunks, @NonNull String displayText,
- @NonNull Vector<Integer> interactionChoiceSetIDList,
- Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks,
- @NonNull InteractionMode interactionMode, Integer timeout,
- Integer correlationID) throws SdlException {
-
- PerformInteraction msg = new PerformInteraction(displayText, interactionMode, interactionChoiceSetIDList);
- msg.setInitialPrompt(initChunks);
- msg.setTimeout(timeout);
- msg.setHelpPrompt(helpChunks);
- msg.setTimeoutPrompt(timeoutChunks);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- // Protected registerAppInterface used to ensure only non-ALM applications call
- // reqisterAppInterface
- protected void registerAppInterfacePrivate(
- @NonNull SdlMsgVersion sdlMsgVersion, @NonNull String appName, Vector<TTSChunk> ttsName,
- String ngnMediaScreenAppName, Vector<String> vrSynonyms, @NonNull Boolean isMediaApp,
- @NonNull Language languageDesired, @NonNull Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType,
- @NonNull String appID, TemplateColorScheme dayColorScheme, TemplateColorScheme nightColorScheme, Integer correlationID)
- throws SdlException {
- String carrierName = null;
- if(telephonyManager != null){
- carrierName = telephonyManager.getNetworkOperatorName();
- }
-
- DeviceInfo deviceInfo = new DeviceInfo();
- deviceInfo.setHardware(android.os.Build.MODEL);
- deviceInfo.setOs("Android");
- deviceInfo.setOsVersion(Build.VERSION.RELEASE);
- deviceInfo.setCarrier(carrierName);
-
- if (sdlMsgVersion == null) {
- sdlMsgVersion = new SdlMsgVersion();
- if(protocolVersion.getMajor() == 1) {
- DebugTool.logInfo(TAG, "Connected to an older module, must send 1.0.0 as RPC spec");
- sdlMsgVersion.setMajorVersion(1);
- sdlMsgVersion.setMinorVersion(0);
- }else {
- sdlMsgVersion.setMajorVersion(MAX_SUPPORTED_RPC_VERSION.getMajor());
- sdlMsgVersion.setMinorVersion(MAX_SUPPORTED_RPC_VERSION.getMinor());
- }
- }
- if (languageDesired == null) {
- languageDesired = Language.EN_US;
- }
- if (hmiDisplayLanguageDesired == null) {
- hmiDisplayLanguageDesired = Language.EN_US;
- }
-
- RegisterAppInterface msg = new RegisterAppInterface(sdlMsgVersion, appName, isMediaApp, languageDesired, hmiDisplayLanguageDesired, appID);
-
- if (correlationID != null) {
- msg.setCorrelationID(correlationID);
- }
-
- msg.setDeviceInfo(deviceInfo);
-
- msg.setTtsName(ttsName);
-
- if (ngnMediaScreenAppName == null) {
- ngnMediaScreenAppName = appName;
- }
-
- msg.setNgnMediaScreenAppName(ngnMediaScreenAppName);
-
- if (vrSynonyms == null) {
- vrSynonyms = new Vector<String>();
- vrSynonyms.add(appName);
- }
- msg.setVrSynonyms(vrSynonyms);
-
- msg.setAppHMIType(appType);
-
- msg.setDayColorScheme(dayColorScheme);
- msg.setNightColorScheme(nightColorScheme);
-
- if (_bAppResumeEnabled)
- {
- if (_lastHashID != null)
- msg.setHashID(_lastHashID);
- }
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.REGISTER_APP_INTERFACE.toString());
- updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_REQUEST);
- updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
- updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
- sendBroadcastIntent(sendIntent);
-
- sendRPCMessagePrivate(msg);
- }
-
- /*Begin V1 Enhanced helper function*/
-
- /**
- * Sends a SetGlobalProperties RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param helpPrompt that will be used for the VR screen
- * @param timeoutPrompt string to be displayed after timeout
- * @param vrHelpTitle string that may be displayed on VR prompt dialog
- * @param vrHelp a list of VR synonyms that may be displayed to user
- * @param correlationID to be attached to the request
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void setGlobalProperties(
- String helpPrompt, String timeoutPrompt, String vrHelpTitle, Vector<VrHelpItem> vrHelp, Integer correlationID)
- throws SdlException {
-
- SetGlobalProperties req = new SetGlobalProperties();
- req.setCorrelationID(correlationID);
- req.setHelpPrompt(TTSChunkFactory.createSimpleTTSChunks(helpPrompt));
- req.setTimeoutPrompt(TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt));
- req.setVrHelpTitle(vrHelpTitle);
- req.setVrHelp(vrHelp);
-
- sendRPCRequest(req);
- }
-
- /**
- * Sends a SetGlobalProperties RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param helpChunks tts chunks that should be used when prompting the user
- * @param timeoutChunks tts chunks that will be used when a timeout occurs
- * @param vrHelpTitle string that may be displayed on VR prompt dialog
- * @param vrHelp a list of VR synonyms that may be displayed to user
- * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void setGlobalProperties(
- Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, String vrHelpTitle, Vector<VrHelpItem> vrHelp,
- Integer correlationID) throws SdlException {
-
- SetGlobalProperties req = new SetGlobalProperties();
- req.setCorrelationID(correlationID);
- req.setHelpPrompt(helpChunks);
- req.setTimeoutPrompt(timeoutChunks);
- req.setVrHelpTitle(vrHelpTitle);
- req.setVrHelp(vrHelp);
-
- sendRPCRequest(req);
- }
-
- /*End V1 Enhanced helper function*/
-
- /**
- * Sends a SetGlobalProperties RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param helpPrompt that will be used for the VR screen
- * @param timeoutPrompt string to be displayed after timeout
- * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void setGlobalProperties(
- String helpPrompt, String timeoutPrompt, Integer correlationID)
- throws SdlException {
-
- SetGlobalProperties req = new SetGlobalProperties();
- req.setCorrelationID(correlationID);
- req.setHelpPrompt(TTSChunkFactory.createSimpleTTSChunks(helpPrompt));
- req.setTimeoutPrompt(TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt));
-
- sendRPCRequest(req);
- }
-
- /**
- * Sends a SetGlobalProperties RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param helpChunks tts chunks that should be used when prompting the user
- * @param timeoutChunks tts chunks that will be used when a timeout occurs
- * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void setGlobalProperties(
- Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks,
- Integer correlationID) throws SdlException {
-
- SetGlobalProperties req = new SetGlobalProperties();
- req.setCorrelationID(correlationID);
- req.setHelpPrompt(helpChunks);
- req.setTimeoutPrompt(timeoutChunks);
-
- sendRPCRequest(req);
- }
-
- @SuppressWarnings("unused")
- public void resetGlobalProperties(Vector<GlobalProperty> properties,
- Integer correlationID) throws SdlException {
-
- ResetGlobalProperties req = new ResetGlobalProperties();
-
- req.setCorrelationID(correlationID);
- req.setProperties(properties);
-
- sendRPCRequest(req);
- }
-
-
- /**
- * Sends a SetMediaClockTimer RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param hours integer for hours
- * @param minutes integer for minutes
- * @param seconds integer for seconds
- * @param updateMode mode in which the media clock timer should be updated
- * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void setMediaClockTimer(Integer hours,
- Integer minutes, Integer seconds, @NonNull UpdateMode updateMode,
- Integer correlationID) throws SdlException {
-
- SetMediaClockTimer msg = new SetMediaClockTimer(updateMode);
- if (hours != null || minutes != null || seconds != null) {
- StartTime startTime = new StartTime(hours, minutes, seconds);
- msg.setStartTime(startTime);
- }
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Pauses the media clock. Responses are captured through callback on IProxyListener.
- *
- * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void pauseMediaClockTimer(Integer correlationID)
- throws SdlException {
-
- SetMediaClockTimer msg = new SetMediaClockTimer(UpdateMode.PAUSE);
- StartTime startTime = new StartTime(0, 0, 0);
- msg.setStartTime(startTime);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Resumes the media clock. Responses are captured through callback on IProxyListener.
- *
- * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void resumeMediaClockTimer(Integer correlationID)
- throws SdlException {
-
- SetMediaClockTimer msg = new SetMediaClockTimer(UpdateMode.RESUME);
- StartTime startTime = new StartTime(0, 0, 0);
- msg.setStartTime(startTime);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Clears the media clock. Responses are captured through callback on IProxyListener.
- *
- * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void clearMediaClockTimer(Integer correlationID)
- throws SdlException {
-
- Show msg = new Show();
- msg.setCorrelationID(correlationID);
- msg.setMediaClock(" ");
-
- sendRPCRequest(msg);
- }
-
- /*Begin V1 Enhanced helper*/
- /**
- * Sends a Show RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param mainText1 text displayed in a single or upper display line.
- * @param mainText2 text displayed on the second display line.
- * @param mainText3 text displayed on the second "page" first display line.
- * @param mainText4 text displayed on the second "page" second display line.
- * @param statusBar text is placed in the status bar area (Only valid for NAVIGATION apps)
- * @param mediaClock text value for MediaClock field.
- * @param mediaTrack text displayed in the track field.
- * @param graphic image struct determining whether static or dynamic image to display in app.
- * @param softButtons app defined SoftButtons.
- * @param customPresets app labeled on-screen presets.
- * @param alignment specifies how mainText1 and mainText2s texts should be aligned on display.
- * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("SameParameterValue")
- public void show(String mainText1, String mainText2, String mainText3, String mainText4,
- String statusBar, String mediaClock, String mediaTrack,
- Image graphic, Vector<SoftButton> softButtons, Vector <String> customPresets,
- TextAlignment alignment, Integer correlationID)
- throws SdlException {
-
- Show msg = new Show();
- msg.setCorrelationID(correlationID);
- msg.setMainField1(mainText1);
- msg.setMainField2(mainText2);
- msg.setStatusBar(statusBar);
- msg.setMediaClock(mediaClock);
- msg.setMediaTrack(mediaTrack);
- msg.setAlignment(alignment);
- msg.setMainField3(mainText3);
- msg.setMainField4(mainText4);
- msg.setGraphic(graphic);
- msg.setSoftButtons(softButtons);
- msg.setCustomPresets(customPresets);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a Show RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param mainText1 -Text displayed in a single or upper display line.
- * @param mainText2 -Text displayed on the second display line.
- * @param mainText3 -Text displayed on the second "page" first display line.
- * @param mainText4 -Text displayed on the second "page" second display line.
- * @param graphic -Image struct determining whether static or dynamic image to display in app.
- * @param softButtons -App defined SoftButtons.
- * @param customPresets -App labeled on-screen presets.
- * @param alignment -Specifies how mainText1 and mainText2s texts should be aligned on display.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void show(String mainText1, String mainText2, String mainText3, String mainText4,
- Image graphic, Vector<SoftButton> softButtons, Vector <String> customPresets,
- TextAlignment alignment, Integer correlationID)
- throws SdlException {
-
- show(mainText1, mainText2, mainText3, mainText4, null, null, null, graphic, softButtons, customPresets, alignment, correlationID);
- }
- /*End V1 Enhanced helper*/
-
- /**
- * Sends a Show RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param mainText1 text displayed in a single or upper display line.
- * @param mainText2 text displayed on the second display line.
- * @param statusBar text is placed in the status bar area (Only valid for NAVIGATION apps)
- * @param mediaClock text value for MediaClock field.
- * @param mediaTrack text displayed in the track field.
- * @param alignment specifies how mainText1 and mainText2s texts should be aligned on display.
- * @param correlationID unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("SameParameterValue")
- public void show(String mainText1, String mainText2,
- String statusBar, String mediaClock, String mediaTrack,
- TextAlignment alignment, Integer correlationID)
- throws SdlException {
-
- Show msg = new Show();
- msg.setCorrelationID(correlationID);
- msg.setMainField1(mainText1);
- msg.setMainField2(mainText2);
- msg.setStatusBar(statusBar);
- msg.setMediaClock(mediaClock);
- msg.setMediaTrack(mediaTrack);
- msg.setAlignment(alignment);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a Show RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param mainText1 -Text displayed in a single or upper display line.
- * @param mainText2 -Text displayed on the second display line.
- * @param alignment -Specifies how mainText1 and mainText2s texts should be aligned on display.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void show(String mainText1, String mainText2,
- TextAlignment alignment, Integer correlationID)
- throws SdlException {
-
- show(mainText1, mainText2, null, null, null, alignment, correlationID);
- }
-
- /**
- * Sends a Speak RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param ttsText -The text to speech message in the form of a string.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void speak(@NonNull String ttsText, Integer correlationID)
- throws SdlException {
-
- Speak msg = new Speak(TTSChunkFactory.createSimpleTTSChunks(ttsText));
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a Speak RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param ttsChunks -Text/phonemes to speak in the form of ttsChunks.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void speak(@NonNull Vector<TTSChunk> ttsChunks,
- Integer correlationID) throws SdlException {
-
- Speak msg = new Speak(ttsChunks);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Sends a SubscribeButton RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param buttonName -Name of the button to subscribe.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void subscribeButton(@NonNull ButtonName buttonName,
- Integer correlationID) throws SdlException {
-
- SubscribeButton msg = new SubscribeButton(buttonName);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- // Protected unregisterAppInterface used to ensure no non-ALM app calls
- // unregisterAppInterface.
- protected void unregisterAppInterfacePrivate(Integer correlationID)
- throws SdlException {
-
- UnregisterAppInterface msg = new UnregisterAppInterface();
- msg.setCorrelationID(correlationID);
-
- Intent sendIntent = createBroadcastIntent();
-
- updateBroadcastIntent(sendIntent, "RPC_NAME", FunctionID.UNREGISTER_APP_INTERFACE.toString());
- updateBroadcastIntent(sendIntent, "TYPE", RPCMessage.KEY_REQUEST);
- updateBroadcastIntent(sendIntent, "CORRID", msg.getCorrelationID());
- updateBroadcastIntent(sendIntent, "DATA",serializeJSON(msg));
- sendBroadcastIntent(sendIntent);
-
- sendRPCMessagePrivate(msg);
- }
-
- /**
- * Sends an UnsubscribeButton RPCRequest to SDL. Responses are captured through callback on IProxyListener.
- *
- * @param buttonName -Name of the button to unsubscribe.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void unsubscribeButton(@NonNull ButtonName buttonName,
- Integer correlationID) throws SdlException {
-
- UnsubscribeButton msg = new UnsubscribeButton(buttonName);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Creates a choice to be added to a choiceset. Choice has both a voice and a visual menu component.
- *
- * @param choiceID -Unique ID used to identify this choice (returned in callback).
- * @param choiceMenuName -Text name displayed for this choice.
- * @param choiceVrCommands -Vector of vrCommands used to select this choice by voice. Must contain
- * at least one non-empty element.
- * @return Choice created.
- */
- @SuppressWarnings("unused")
- public Choice createChoiceSetChoice(Integer choiceID, String choiceMenuName,
- Vector<String> choiceVrCommands) {
- Choice returnChoice = new Choice();
-
- returnChoice.setChoiceID(choiceID);
- returnChoice.setMenuName(choiceMenuName);
- returnChoice.setVrCommands(choiceVrCommands);
-
- return returnChoice;
- }
-
- /**
- * Starts audio pass thru session. Responses are captured through callback on IProxyListener.
- *
- * @param initialPrompt -SDL will speak this prompt before opening the audio pass thru session.
- * @param audioPassThruDisplayText1 -First line of text displayed during audio capture.
- * @param audioPassThruDisplayText2 -Second line of text displayed during audio capture.
- * @param samplingRate -Allowable values of 8 khz or 16 or 22 or 44 khz.
- * @param maxDuration -The maximum duration of audio recording in milliseconds.
- * @param bitsPerSample -Specifies the quality the audio is recorded. Currently 8 bit or 16 bit.
- * @param audioType -Specifies the type of audio data being requested.
- * @param muteAudio -Defines if the current audio source should be muted during the APT session.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void performaudiopassthru(String initialPrompt, String audioPassThruDisplayText1, String audioPassThruDisplayText2,
- @NonNull SamplingRate samplingRate, @NonNull Integer maxDuration, @NonNull BitsPerSample bitsPerSample,
- @NonNull AudioType audioType, Boolean muteAudio, Integer correlationID) throws SdlException {
- Vector<TTSChunk> chunks = TTSChunkFactory.createSimpleTTSChunks(initialPrompt);
- PerformAudioPassThru msg = new PerformAudioPassThru(samplingRate, maxDuration, bitsPerSample, audioType);
- msg.setCorrelationID(correlationID);
- msg.setInitialPrompt(chunks);
- msg.setAudioPassThruDisplayText1(audioPassThruDisplayText1);
- msg.setAudioPassThruDisplayText2(audioPassThruDisplayText2);
- msg.setMuteAudio(muteAudio);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Ends audio pass thru session. Responses are captured through callback on IProxyListener.
- *
- * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void endaudiopassthru(Integer correlationID) throws SdlException
- {
- EndAudioPassThru msg = new EndAudioPassThru();
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Subscribes for specific published data items. The data will be only sent if it has changed.
- * Responses are captured through callback on IProxyListener.
- *
- * @param gps -Subscribes to GPS data.
- * @param speed -Subscribes to vehicle speed data in kilometers per hour.
- * @param rpm -Subscribes to number of revolutions per minute of the engine.
- * @param fuelLevel -Subscribes to fuel level in the tank (percentage).
- * @param fuelLevel_State -Subscribes to fuel level state.
- * @param instantFuelConsumption -Subscribes to instantaneous fuel consumption in microlitres.
- * @param externalTemperature -Subscribes to the external temperature in degrees celsius.
- * @param prndl -Subscribes to PRNDL data that houses the selected gear.
- * @param tirePressure -Subscribes to the TireStatus data containing status and pressure of tires.
- * @param odometer -Subscribes to Odometer data in km.
- * @param beltStatus -Subscribes to status of the seat belts.
- * @param bodyInformation -Subscribes to body information including power modes.
- * @param deviceStatus -Subscribes to device status including signal and battery strength.
- * @param driverBraking -Subscribes to the status of the brake pedal.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- @Deprecated
- public void subscribevehicledata(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure,
- boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID) throws SdlException
- {
- SubscribeVehicleData msg = new SubscribeVehicleData();
- msg.setGps(gps);
- msg.setSpeed(speed);
- msg.setRpm(rpm);
- msg.setFuelLevel(fuelLevel);
- msg.setFuelLevelState(fuelLevel_State);
- msg.setInstantFuelConsumption(instantFuelConsumption);
- msg.setExternalTemperature(externalTemperature);
- msg.setPrndl(prndl);
- msg.setTirePressure(tirePressure);
- msg.setOdometer(odometer);
- msg.setBeltStatus(beltStatus);
- msg.setBodyInformation(bodyInformation);
- msg.setDeviceStatus(deviceStatus);
- msg.setDriverBraking(driverBraking);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
-
- /**
- * Subscribes for specific published data items. The data will be only sent if it has changed.
- * Responses are captured through callback on IProxyListener.
- *
- * @param gps -Subscribes to GPS data.
- * @param speed -Subscribes to vehicle speed data in kilometers per hour.
- * @param rpm -Subscribes to number of revolutions per minute of the engine.
- * @param fuelLevel -Subscribes to fuel level in the tank (percentage).
- * @param fuelLevel_State -Subscribes to fuel level state.
- * @param instantFuelConsumption -Subscribes to instantaneous fuel consumption in microlitres.
- * @param externalTemperature -Subscribes to the external temperature in degrees celsius.
- * @param prndl -Subscribes to PRNDL data that houses the selected gear.
- * @param tirePressure -Subscribes to the TireStatus data containing status and pressure of tires.
- * @param engineOilLife -Subscribes to Engine Oil Life data.
- * @param odometer -Subscribes to Odometer data in km.
- * @param beltStatus -Subscribes to status of the seat belts.
- * @param bodyInformation -Subscribes to body information including power modes.
- * @param deviceStatus -Subscribes to device status including signal and battery strength.
- * @param driverBraking -Subscribes to the status of the brake pedal.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void subscribevehicledata(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure,
- boolean engineOilLife, boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID) throws SdlException
- {
- SubscribeVehicleData msg = new SubscribeVehicleData();
- msg.setGps(gps);
- msg.setSpeed(speed);
- msg.setRpm(rpm);
- msg.setFuelLevel(fuelLevel);
- msg.setFuelLevelState(fuelLevel_State);
- msg.setInstantFuelConsumption(instantFuelConsumption);
- msg.setExternalTemperature(externalTemperature);
- msg.setPrndl(prndl);
- msg.setTirePressure(tirePressure);
- msg.setEngineOilLife(engineOilLife);
- msg.setOdometer(odometer);
- msg.setBeltStatus(beltStatus);
- msg.setBodyInformation(bodyInformation);
- msg.setDeviceStatus(deviceStatus);
- msg.setDriverBraking(driverBraking);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
-
- /**
- * Unsubscribes for specific published data items.
- * Responses are captured through callback on IProxyListener.
- *
- * @param gps -Unsubscribes to GPS data.
- * @param speed -Unsubscribes to vehicle speed data in kilometers per hour.
- * @param rpm -Unsubscribes to number of revolutions per minute of the engine.
- * @param fuelLevel -Unsubscribes to fuel level in the tank (percentage).
- * @param fuelLevel_State -Unsubscribes to fuel level state.
- * @param instantFuelConsumption -Unsubscribes to instantaneous fuel consumption in microlitres.
- * @param externalTemperature -Unsubscribes to the external temperature in degrees celsius.
- * @param prndl -Unsubscribes to PRNDL data that houses the selected gear.
- * @param tirePressure -Unsubscribes to the TireStatus data containing status and pressure of tires.
- * @param odometer -Unsubscribes to Odometer data in km.
- * @param beltStatus -Unsubscribes to status of the seat belts.
- * @param bodyInformation -Unsubscribes to body information including power modes.
- * @param deviceStatus -Unsubscribes to device status including signal and battery strength.
- * @param driverBraking -Unsubscribes to the status of the brake pedal.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
-
- @SuppressWarnings("unused")
- @Deprecated
- public void unsubscribevehicledata(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure,
- boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID) throws SdlException
- {
- UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
- msg.setGps(gps);
- msg.setSpeed(speed);
- msg.setRpm(rpm);
- msg.setFuelLevel(fuelLevel);
- msg.setFuelLevelState(fuelLevel_State);
- msg.setInstantFuelConsumption(instantFuelConsumption);
- msg.setExternalTemperature(externalTemperature);
- msg.setPrndl(prndl);
- msg.setTirePressure(tirePressure);
- msg.setOdometer(odometer);
- msg.setBeltStatus(beltStatus);
- msg.setBodyInformation(bodyInformation);
- msg.setDeviceStatus(deviceStatus);
- msg.setDriverBraking(driverBraking);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
-
- /**
- * Unsubscribes for specific published data items.
- * Responses are captured through callback on IProxyListener.
- *
- * @param gps -Unsubscribes to GPS data.
- * @param speed -Unsubscribes to vehicle speed data in kilometers per hour.
- * @param rpm -Unsubscribes to number of revolutions per minute of the engine.
- * @param fuelLevel -Unsubscribes to fuel level in the tank (percentage).
- * @param fuelLevel_State -Unsubscribes to fuel level state.
- * @param instantFuelConsumption -Unsubscribes to instantaneous fuel consumption in microlitres.
- * @param externalTemperature -Unsubscribes to the external temperature in degrees celsius.
- * @param prndl -Unsubscribes to PRNDL data that houses the selected gear.
- * @param tirePressure -Unsubscribes to the TireStatus data containing status and pressure of tires.
- * @param engineOilLife -Unsubscribes to Engine Oil Life data.
- * @param odometer -Unsubscribes to Odometer data in km.
- * @param beltStatus -Unsubscribes to status of the seat belts.
- * @param bodyInformation -Unsubscribes to body information including power modes.
- * @param deviceStatus -Unsubscribes to device status including signal and battery strength.
- * @param driverBraking -Unsubscribes to the status of the brake pedal.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
-
- @SuppressWarnings("unused")
- public void unsubscribevehicledata(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean prndl, boolean tirePressure,
- boolean engineOilLife, boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID) throws SdlException
- {
- UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
- msg.setGps(gps);
- msg.setSpeed(speed);
- msg.setRpm(rpm);
- msg.setFuelLevel(fuelLevel);
- msg.setFuelLevelState(fuelLevel_State);
- msg.setInstantFuelConsumption(instantFuelConsumption);
- msg.setExternalTemperature(externalTemperature);
- msg.setPrndl(prndl);
- msg.setTirePressure(tirePressure);
- msg.setEngineOilLife(engineOilLife);
- msg.setOdometer(odometer);
- msg.setBeltStatus(beltStatus);
- msg.setBodyInformation(bodyInformation);
- msg.setDeviceStatus(deviceStatus);
- msg.setDriverBraking(driverBraking);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
-
- /**
- * Performs a Non periodic vehicle data read request.
- * Responses are captured through callback on IProxyListener.
- *
- * @param gps -Performs an ad-hoc request for GPS data.
- * @param speed -Performs an ad-hoc request for vehicle speed data in kilometers per hour.
- * @param rpm -Performs an ad-hoc request for number of revolutions per minute of the engine.
- * @param fuelLevel -Performs an ad-hoc request for fuel level in the tank (percentage).
- * @param fuelLevel_State -Performs an ad-hoc request for fuel level state.
- * @param instantFuelConsumption -Performs an ad-hoc request for instantaneous fuel consumption in microlitres.
- * @param externalTemperature -Performs an ad-hoc request for the external temperature in degrees celsius.
- * @param vin -Performs an ad-hoc request for the Vehicle identification number
- * @param prndl -Performs an ad-hoc request for PRNDL data that houses the selected gear.
- * @param tirePressure -Performs an ad-hoc request for the TireStatus data containing status and pressure of tires.
- * @param odometer -Performs an ad-hoc request for Odometer data in km.
- * @param beltStatus -Performs an ad-hoc request for status of the seat belts.
- * @param bodyInformation -Performs an ad-hoc request for body information including power modes.
- * @param deviceStatus -Performs an ad-hoc request for device status including signal and battery strength.
- * @param driverBraking -Performs an ad-hoc request for the status of the brake pedal.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- @Deprecated
- public void getvehicledata(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean vin, boolean prndl, boolean tirePressure,
- boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID) throws SdlException
- {
- GetVehicleData msg = new GetVehicleData();
- msg.setGps(gps);
- msg.setSpeed(speed);
- msg.setRpm(rpm);
- msg.setFuelLevel(fuelLevel);
- msg.setFuelLevelState(fuelLevel_State);
- msg.setInstantFuelConsumption(instantFuelConsumption);
- msg.setExternalTemperature(externalTemperature);
- msg.setVin(vin);
- msg.setPrndl(prndl);
- msg.setTirePressure(tirePressure);
- msg.setOdometer(odometer);
- msg.setBeltStatus(beltStatus);
- msg.setBodyInformation(bodyInformation);
- msg.setDeviceStatus(deviceStatus);
- msg.setDriverBraking(driverBraking);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
-
- /**
- * Performs a Non periodic vehicle data read request.
- * Responses are captured through callback on IProxyListener.
- *
- * @param gps -Performs an ad-hoc request for GPS data.
- * @param speed -Performs an ad-hoc request for vehicle speed data in kilometers per hour.
- * @param rpm -Performs an ad-hoc request for number of revolutions per minute of the engine.
- * @param fuelLevel -Performs an ad-hoc request for fuel level in the tank (percentage).
- * @param fuelLevel_State -Performs an ad-hoc request for fuel level state.
- * @param instantFuelConsumption -Performs an ad-hoc request for instantaneous fuel consumption in microlitres.
- * @param externalTemperature -Performs an ad-hoc request for the external temperature in degrees celsius.
- * @param vin -Performs an ad-hoc request for the Vehicle identification number
- * @param prndl -Performs an ad-hoc request for PRNDL data that houses the selected gear.
- * @param tirePressure -Performs an ad-hoc request for the TireStatus data containing status and pressure of tires.
- * @param engineOilLife -Performs an ad-hoc request for Engine Oil Life data.
- * @param odometer -Performs an ad-hoc request for Odometer data in km.
- * @param beltStatus -Performs an ad-hoc request for status of the seat belts.
- * @param bodyInformation -Performs an ad-hoc request for body information including power modes.
- * @param deviceStatus -Performs an ad-hoc request for device status including signal and battery strength.
- * @param driverBraking -Performs an ad-hoc request for the status of the brake pedal.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void getvehicledata(boolean gps, boolean speed, boolean rpm, boolean fuelLevel, boolean fuelLevel_State,
- boolean instantFuelConsumption, boolean externalTemperature, boolean vin, boolean prndl, boolean tirePressure,
- boolean engineOilLife, boolean odometer, boolean beltStatus, boolean bodyInformation, boolean deviceStatus,
- boolean driverBraking, Integer correlationID) throws SdlException
- {
- GetVehicleData msg = new GetVehicleData();
- msg.setGps(gps);
- msg.setSpeed(speed);
- msg.setRpm(rpm);
- msg.setFuelLevel(fuelLevel);
- msg.setFuelLevelState(fuelLevel_State);
- msg.setInstantFuelConsumption(instantFuelConsumption);
- msg.setExternalTemperature(externalTemperature);
- msg.setVin(vin);
- msg.setPrndl(prndl);
- msg.setTirePressure(tirePressure);
- msg.setEngineOilLife(engineOilLife);
- msg.setOdometer(odometer);
- msg.setBeltStatus(beltStatus);
- msg.setBodyInformation(bodyInformation);
- msg.setDeviceStatus(deviceStatus);
- msg.setDriverBraking(driverBraking);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
-
- /**
- * Creates a full screen overlay containing a large block of formatted text that can be scrolled with up to 8 SoftButtons defined.
- * Responses are captured through callback on IProxyListener.
- *
- * @param scrollableMessageBody -Body of text that can include newlines and tabs.
- * @param timeout -App defined timeout. Indicates how long of a timeout from the last action.
- * @param softButtons -App defined SoftButtons.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void scrollablemessage(@NonNull String scrollableMessageBody, Integer timeout, Vector<SoftButton> softButtons, Integer correlationID) throws SdlException
- {
- ScrollableMessage msg = new ScrollableMessage(scrollableMessageBody);
- msg.setCorrelationID(correlationID);
- msg.setTimeout(timeout);
- msg.setSoftButtons(softButtons);
-
- sendRPCRequest(msg);
- }
-
-
- /**
- * Creates a full screen or pop-up overlay (depending on platform) with a single user controlled slider.
- * Responses are captured through callback on IProxyListener.
- *
- * @param numTicks -Number of selectable items on a horizontal axis.
- * @param position -Initial position of slider control (cannot exceed numTicks).
- * @param sliderHeader -Text header to display.
- * @param sliderFooter - Text footer to display (meant to display min/max threshold descriptors).
- * @param timeout -App defined timeout. Indicates how long of a timeout from the last action.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void slider(@NonNull Integer numTicks, @NonNull Integer position, @NonNull String sliderHeader, Vector<String> sliderFooter, Integer timeout, Integer correlationID) throws SdlException
- {
- Slider msg = new Slider(numTicks, position, sliderHeader);
- msg.setCorrelationID(correlationID);
- msg.setSliderFooter(sliderFooter);
- msg.setTimeout(timeout);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Responses are captured through callback on IProxyListener.
- *
- * @param language requested SDL voice engine (VR+TTS) language registration
- * @param hmiDisplayLanguage request display language registration.
- * @param correlationID ID to be attached to the RPCRequest that correlates the RPCResponse
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void changeregistration(@NonNull Language language, @NonNull Language hmiDisplayLanguage, Integer correlationID) throws SdlException
- {
- ChangeRegistration msg = new ChangeRegistration(language, hmiDisplayLanguage);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- * Responses are captured through callback on IProxyListener.
- *
- * @param is - The input stream of byte data that putFileStream will read from
- * @param sdlFileName - The file reference name used by the putFile RPC.
- * @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of the file.
- * A value greater than zero is used for resuming partial data chunks.
- * @param iLength - The total length of the file being sent.
- * @throws SdlException if an unrecoverable error is encountered
- * @see #putFileStream(InputStream, String, Long, Long)
- */
- @SuppressWarnings("unused")
- @Deprecated
- public void putFileStream(InputStream is, @NonNull String sdlFileName, Integer iOffset, Integer iLength) throws SdlException
- {
- PutFile msg = new PutFile(sdlFileName, FileType.BINARY);
- msg.setCorrelationID(10000);
- msg.setSystemFile(true);
- msg.setOffset(iOffset);
- msg.setLength(iLength);
-
- startRPCStream(is, msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile
- * device. Responses are captured through callback on IProxyListener.
- *
- * @param inputStream The input stream of byte data that will be read from.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length) throws SdlException {
- PutFile msg = new PutFile(fileName, FileType.BINARY);
- msg.setCorrelationID(10000);
- msg.setSystemFile(true);
- msg.setOffset(offset);
- msg.setLength(length);
-
- startRPCStream(inputStream, msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- * Responses are captured through callback on IProxyListener.
- *
- * @param sdlFileName - The file reference name used by the putFile RPC.
- * @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of a file.
- * A value greater than zero is used for resuming partial data chunks.
- * @param iLength - The total length of the file being sent.
- *
- * @return OutputStream - The output stream of byte data that is written to by the app developer
- * @throws SdlException if an unrecoverable error is encountered
- * @see #putFileStream(String, Long, Long)
- */
- @SuppressWarnings("unused")
- @Deprecated
- public OutputStream putFileStream(@NonNull String sdlFileName, Integer iOffset, Integer iLength) throws SdlException
- {
- PutFile msg = new PutFile(sdlFileName, FileType.BINARY);
- msg.setCorrelationID(10000);
- msg.setSystemFile(true);
- msg.setOffset(iOffset);
- msg.setLength(iLength);
-
- return startRPCStream(msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile
- * device. Responses are captured through callback on IProxyListener.
- *
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public OutputStream putFileStream(@NonNull String fileName, Long offset, Long length) throws SdlException {
- PutFile msg = new PutFile(fileName, FileType.BINARY);
- msg.setCorrelationID(10000);
- msg.setSystemFile(true);
- msg.setOffset(offset);
- msg.setLength(length);
-
- return startRPCStream(msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- * Responses are captured through callback on IProxyListener.
- *
- * @param is - The input stream of byte data that PutFileStream will read from
- * @param sdlFileName - The file reference name used by the putFile RPC.
- * @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of the file.
- * A value greater than zero is used for resuming partial data chunks.
- * @param iLength - The total length of the file being sent.
- * @param fileType - The selected file type -- see the FileType enumeration for details
- * @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
- * @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
- * @throws SdlException if an unrecoverable error is encountered
- * @see #putFileStream(InputStream, String, Long, Long, FileType, Boolean, Boolean, OnPutFileUpdateListener)
- */
- @SuppressWarnings("unused")
- @Deprecated
- public void putFileStream(InputStream is, @NonNull String sdlFileName, Integer iOffset, Integer iLength, @NonNull FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
- {
- PutFile msg = new PutFile(sdlFileName, fileType);
- msg.setCorrelationID(10000);
- msg.setPersistentFile(bPersistentFile);
- msg.setSystemFile(bSystemFile);
- msg.setOffset(iOffset);
- msg.setLength(iLength);
-
- startRPCStream(is, msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile
- * device. Responses are captured through callback on IProxyListener.
- *
- * @param inputStream The input stream of byte data that will be read from.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- * @throws SdlException if an unrecoverable error is encountered
- */
-// @SuppressWarnings("unused")
-// public void putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
-// PutFile msg = new PutFile(fileName, FileType.BINARY);
-// msg.setCorrelationID(10000);
-// msg.setSystemFile(true);
-// msg.setOffset(offset);
-// msg.setLength(length);
-// //msg.setOnPutFileUpdateListener(cb);
-// startRPCStream(inputStream, msg);
-// }
-//
- /**
- * Used to push a binary stream of file data onto the module from a mobile device.
- * Responses are captured through callback on IProxyListener.
- *
- * @param sdlFileName - The file reference name used by the putFile RPC.
- * @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of a file.
- * A value greater than zero is used for resuming partial data chunks.
- * @param iLength - The total length of the file being sent.
- * @param fileType - The selected file type -- see the FileType enumeration for details
- * @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
- * @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
- * @return OutputStream - The output stream of byte data that is written to by the app developer
- * @throws SdlException if an unrecoverable error is encountered
- * @see #putFileStream(String, Long, Long, FileType, Boolean, Boolean, OnPutFileUpdateListener)
- */
- @SuppressWarnings("unused")
- @Deprecated
- public OutputStream putFileStream(@NonNull String sdlFileName, Integer iOffset, Integer iLength, @NonNull FileType fileType, Boolean bPersistentFile, Boolean bSystemFile) throws SdlException
- {
- PutFile msg = new PutFile(sdlFileName, fileType);
- msg.setCorrelationID(10000);
- msg.setPersistentFile(bPersistentFile);
- msg.setSystemFile(bSystemFile);
- msg.setOffset(iOffset);
- msg.setLength(iLength);
-
- return startRPCStream(msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile
- * device. Responses are captured through callback on IProxyListener.
- *
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- * @throws SdlException if an unrecoverable error is encountered
- */
-// @SuppressWarnings("unused")
-// public OutputStream putFileStream(@NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
-// PutFile msg = new PutFile(fileName, FileType.BINARY);
-// msg.setCorrelationID(10000);
-// msg.setSystemFile(true);
-// msg.setOffset(offset);
-// msg.setLength(length);
-// //msg.setOnPutFileUpdateListener(cb);
-//
-// return startRPCStream(msg);
-// }
-
- /**
- * Used to push a stream of putfile RPC's containing binary data from a mobile device to the module.
- * Responses are captured through callback on IProxyListener.
- *
- * @param sPath - The physical file path on the mobile device.
- * @param sdlFileName - The file reference name used by the putFile RPC.
- * @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of a file.
- * A value greater than zero is used for resuming partial data chunks.
- * @param fileType - The selected file type -- see the FileType enumeration for details
- * @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
- * @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
- * @param iCorrelationID - A unique ID that correlates each RPCRequest and RPCResponse.
- * @return RPCStreamController - If the putFileStream was not started successfully null is returned, otherwise a valid object reference is returned
- * @throws SdlException if an unrecoverable error is encountered
-// * @see #putFileStream(String, String, Long, FileType, Boolean, Boolean, Boolean, Integer, OnPutFileUpdateListener)
- */
- @SuppressWarnings("unused")
- @Deprecated
- public RPCStreamController putFileStream(String sPath, @NonNull String sdlFileName, Integer iOffset, @NonNull FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) throws SdlException
- {
- PutFile msg = new PutFile(sdlFileName, fileType);
- msg.setCorrelationID(iCorrelationID);
- msg.setPersistentFile(bPersistentFile);
- msg.setSystemFile(bSystemFile);
- msg.setOffset(iOffset);
- msg.setLength(0);
-
- return startPutFileStream(sPath, msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile
- * device. Responses are captured through callback on IProxyListener.
- *
- * @param path The physical file path on the mobile device.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- * @param correlationId A unique id that correlates each RPCRequest and
- * RPCResponse.
- * @return RPCStreamController If the putFileStream was not started
- * successfully null is returned, otherwise a valid object reference is
- * returned .
- * @throws SdlException if an unrecoverable error is encountered
- */
-// @SuppressWarnings("unused")
-// public RPCStreamController putFileStream(String path, @NonNull String fileName, Long offset, @NonNull FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId, OnPutFileUpdateListener cb ) throws SdlException {
-// PutFile msg = new PutFile(fileName, fileType);
-// msg.setCorrelationID(correlationId);
-// msg.setPersistentFile(isPersistentFile);
-// msg.setSystemFile(isSystemFile);
-// msg.setOffset(offset);
-// msg.setLength(0L);
-// msg.setPayloadProtected(isPayloadProtected);
-// //msg.setOnPutFileUpdateListener(cb);
-//
-// return startPutFileStream(path,msg);
-// }
-
- /**
- * Used to push a stream of putfile RPC's containing binary data from a mobile device to the module.
- * Responses are captured through callback on IProxyListener.
- *
- * @param is - The input stream of byte data that putFileStream will read from.
- * @param sdlFileName - The file reference name used by the putFile RPC.
- * @param iOffset - The data offset in bytes, a value of zero is used to indicate data starting from the beginging of a file.
- * A value greater than zero is used for resuming partial data chunks.
- * @param fileType - The selected file type -- see the FileType enumeration for details
- * @param bPersistentFile - Indicates if the file is meant to persist between sessions / ignition cycles.
- * @param bSystemFile - Indicates if the file is meant to be passed thru core to elsewhere on the system.
- * @param iCorrelationID - A unique ID that correlates each RPCRequest and RPCResponse.
- * @return RPCStreamController - If the putFileStream was not started successfully null is returned, otherwise a valid object reference is returned
- * @throws SdlException if an unrecoverable error is encountered
- * @see #putFileStream(InputStream, String, Long, Long, FileType, Boolean, Boolean, Boolean, Integer)
- */
- @SuppressWarnings("unused")
- @Deprecated
- public RPCStreamController putFileStream(InputStream is, @NonNull String sdlFileName, Integer iOffset, Integer iLength, @NonNull FileType fileType, Boolean bPersistentFile, Boolean bSystemFile, Integer iCorrelationID) throws SdlException
- {
- PutFile msg = new PutFile(sdlFileName, fileType);
- msg.setCorrelationID(iCorrelationID);
- msg.setPersistentFile(bPersistentFile);
- msg.setSystemFile(bSystemFile);
- msg.setOffset(Long.valueOf(iOffset));
- msg.setLength(Long.valueOf(iLength));
-
- return startPutFileStream(is, msg);
- }
-
- /**
- * Used to push a binary stream of file data onto the module from a mobile
- * device. Responses are captured through callback on IProxyListener.
- *
- * @param inputStream The input stream of byte data that will be read from.
- * @param fileName The SDL file reference name used by the RPC.
- * @param offset The data offset in bytes. A value of zero is used to
- * indicate data starting from the beginning of the file and a value greater
- * than zero is used for resuming partial data chunks.
- * @param length The total length of the file being sent.
- * @param fileType The selected file type. See the {@link FileType} enum for
- * details.
- * @param isPersistentFile Indicates if the file is meant to persist between
- * sessions / ignition cycles.
- * @param isSystemFile Indicates if the file is meant to be passed through
- * core to elsewhere in the system.
- * @param correlationId A unique id that correlates each RPCRequest and
- * RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public RPCStreamController putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length, @NonNull FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId) throws SdlException {
- PutFile msg = new PutFile(fileName, fileType);
- msg.setCorrelationID(correlationId);
- msg.setPersistentFile(isPersistentFile);
- msg.setSystemFile(isSystemFile);
- msg.setOffset(offset);
- msg.setLength(length);
- msg.setPayloadProtected(isPayloadProtected);
-
- return startPutFileStream(inputStream, msg);
- }
-
- /**
- *
- * Used to end an existing putFileStream that was previously initiated with any putFileStream method.
- *
- */
- @SuppressWarnings("unused")
- public void endPutFileStream()
- {
- endRPCStream();
- }
-
-
- /**
- * Used to push a binary data onto the SDL module from a mobile device, such as icons and album art. Not supported on first generation SDL vehicles.
- * Responses are captured through callback on IProxyListener.
- *
- * @param sdlFileName -File reference name.
- * @param fileType -Selected file type.
- * @param persistentFile -Indicates if the file is meant to persist between sessions / ignition cycles.
- * @param fileData byte array of data of the file that is to be sent
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void putfile(@NonNull String sdlFileName, @NonNull FileType fileType, Boolean persistentFile, byte[] fileData, Integer correlationID) throws SdlException
- {
- PutFile msg = new PutFile(sdlFileName, fileType);
- msg.setCorrelationID(correlationID);
- msg.setPersistentFile(persistentFile);
- msg.setBulkData(fileData);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Used to delete a file resident on the SDL module in the app's local cache. Not supported on first generation SDL vehicles.
- * Responses are captured through callback on IProxyListener.
- *
- * @param sdlFileName -File reference name.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void deletefile(@NonNull String sdlFileName, Integer correlationID) throws SdlException
- {
- DeleteFile msg = new DeleteFile(sdlFileName);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Requests the current list of resident filenames for the registered app. Not supported on first generation SDL vehicles.
- * Responses are captured through callback on IProxyListener.
- *
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void listfiles(Integer correlationID) throws SdlException
- {
- ListFiles msg = new ListFiles();
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Used to set existing local file on SDL as the app's icon. Not supported on first generation SDL vehicles.
- * Responses are captured through callback on IProxyListener.
- *
- * @param sdlFileName -File reference name.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void setappicon(@NonNull String sdlFileName, Integer correlationID) throws SdlException
- {
- SetAppIcon msg = new SetAppIcon(sdlFileName);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Set an alternate display layout. If not sent, default screen for given platform will be shown.
- * Responses are captured through callback on IProxyListener.
- *
- * @param displayLayout -Predefined or dynamically created screen layout.
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void setdisplaylayout(@NonNull String displayLayout, Integer correlationID) throws SdlException
- {
- SetDisplayLayout msg = new SetDisplayLayout(displayLayout);
- msg.setCorrelationID(correlationID);
-
- sendRPCRequest(msg);
- }
-
- /**
- * Set an alternate display layout. If not sent, default screen for given platform will be shown.
- * Responses are captured through callback on IProxyListener.
- *
- * @param displayLayout -Predefined or dynamically created screen layout.
- * @param dayColorScheme a TemplateColorScheme object representing the colors that will be used for day color scheme
- * @param nightColorScheme a TemplateColorScheme object representing the colors that will be used for night color scheme
- * @param correlationID -A unique ID that correlates each RPCRequest and RPCResponse.
- * @throws SdlException if an unrecoverable error is encountered
- */
- @SuppressWarnings("unused")
- public void setdisplaylayout(String displayLayout, TemplateColorScheme dayColorScheme, TemplateColorScheme nightColorScheme, Integer correlationID) throws SdlException
- {
- SetDisplayLayout msg = new SetDisplayLayout(displayLayout);
- msg.setCorrelationID(correlationID);
- msg.setDayColorScheme(dayColorScheme);
- msg.setNightColorScheme(nightColorScheme);
- sendRPCRequest(msg);
- }
-
- /**
- * Gets the SystemCapabilityManager. <br>
- * @return a SystemCapabilityManager object
- */
- public SystemCapabilityManager getSystemCapabilityManager() {
- return _systemCapabilityManager;
- }
-
- @SuppressWarnings("unused")
- public boolean isCapabilitySupported(SystemCapabilityType systemCapabilityType) {
- return _systemCapabilityManager != null && _systemCapabilityManager.isCapabilitySupported(systemCapabilityType);
- }
-
- @SuppressWarnings("unused")
- public void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener){
- if(_systemCapabilityManager != null){
- _systemCapabilityManager.getCapability(systemCapabilityType, scListener);
- }
- }
-
- @SuppressWarnings("unused")
- public Object getCapability(SystemCapabilityType systemCapabilityType){
- if(_systemCapabilityManager != null ){
- return _systemCapabilityManager.getCapability(systemCapabilityType);
- }else{
- return null;
- }
- }
-
- /**
- * Add a listener to be called whenever a new capability is retrieved
- * @param systemCapabilityType Type of capability desired
- * @param listener callback to execute upon retrieving capability
- */
- public void addOnSystemCapabilityListener(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener listener) {
- if(_systemCapabilityManager != null){
- _systemCapabilityManager.addOnSystemCapabilityListener(systemCapabilityType, listener);
- }
- }
-
- /**
- * Remove an OnSystemCapabilityListener that was previously added
- * @param systemCapabilityType Type of capability
- * @param listener the listener that should be removed
- */
- public boolean removeOnSystemCapabilityListener(final SystemCapabilityType systemCapabilityType, final OnSystemCapabilityListener listener){
- if(_systemCapabilityManager != null){
- return _systemCapabilityManager.removeOnSystemCapabilityListener(systemCapabilityType, listener);
- }
- return false;
- }
-
- /* ******************* END Public Helper Methods *************************/
-
- /**
- * Gets type of transport currently used by this SdlProxy.
- *
- * @return One of TransportType enumeration values.
- *
- * @see TransportType
- */
- @SuppressWarnings("unused")
- public TransportType getCurrentTransportType() throws IllegalStateException {
- if (sdlSession == null) {
- throw new IllegalStateException("Incorrect state of SdlProxyBase: Calling for getCurrentTransportType() while connection is not initialized");
- }
-
- return sdlSession.getCurrentTransportType();
- }
-
- @Deprecated
- public void setSdlSecurityClassList(List<Class<? extends SdlSecurityBase>> list) {
- _secList = list;
- }
-
- /**
- * Sets the security libraries and a callback to notify caller when there is update to encryption service
- * @param secList The list of security class(es)
- * @param listener The callback object
- */
- public void setSdlSecurity(@NonNull List<Class<? extends SdlSecurityBase>> secList, ServiceEncryptionListener listener) {
- _secList = secList;
- serviceEncryptionListener = listener;
- }
-
- private void setSdlSecurity(SdlSecurityBase sec) {
- if (sdlSession != null)
- {
- sdlSession.setSdlSecurity(sec);
- }
- }
-
- /**
- * Sets the minimum protocol version that will be permitted to connect.
- * If the protocol version of the head unit connected is below this version,
- * the app will disconnect with an EndService protocol message and will not register.
- * @param minimumProtocolVersion
- */
- public void setMinimumProtocolVersion(Version minimumProtocolVersion){
- this.minimumProtocolVersion = minimumProtocolVersion;
- }
-
- /**
- * The minimum RPC version that will be permitted to connect.
- * If the RPC version of the head unit connected is below this version, an UnregisterAppInterface will be sent.
- * @param minimumRPCVersion
- */
- public void setMinimumRPCVersion(Version minimumRPCVersion){
- this.minimumRPCVersion = minimumRPCVersion;
- }
-
- @SuppressWarnings("unused")
- public boolean isServiceTypeProtected(SessionType sType) {
- return sdlSession != null && sdlSession.isServiceProtected(sType);
-
- }
-
-
- public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener){
- if(serviceType != null && sdlSession != null && sdlServiceListener != null){
- sdlSession.addServiceListener(serviceType, sdlServiceListener);
- }
- }
-
- public void removeServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener){
- if(serviceType != null && sdlSession != null && sdlServiceListener != null){
- sdlSession.removeServiceListener(serviceType, sdlServiceListener);
- }
- }
-
- @SuppressWarnings("unused")
- public VideoStreamingParameters getAcceptedVideoParams(){
- return sdlSession.getAcceptedVideoParams();
- }
-
- public IProxyListenerBase getProxyListener()
- {
- return _proxyListener;
- }
-
- @SuppressWarnings("unused")
- public String getAppName()
- {
- return _applicationName;
- }
-
- @SuppressWarnings("unused")
- public String getNgnAppName()
- {
- return _ngnMediaScreenAppName;
- }
-
- @SuppressWarnings("unused")
- public String getAppID()
- {
- return _appID;
- }
- @SuppressWarnings("unused")
- public DeviceInfo getDeviceInfo()
- {
- return deviceInfo;
- }
- @SuppressWarnings("unused")
- public long getInstanceDT()
- {
- return instanceDateTime;
- }
- @SuppressWarnings("unused")
- public void setConnectionDetails(String sDetails)
- {
- sConnectionDetails = sDetails;
- }
- @SuppressWarnings("unused")
- public String getConnectionDetails()
- {
- return sConnectionDetails;
- }
- //for testing only
- @SuppressWarnings("unused")
- public void setPoliciesURL(String sText)
- {
- sPoliciesURL = sText;
- }
- //for testing only
- public String getPoliciesURL()
- {
- return sPoliciesURL;
- }
-
- /**
- * Tells developer whether or not their app icon has been resumed on core.
- * @return boolean - true if icon was resumed, false if not
- * @throws SdlException if proxy is disposed or app is not registered
- */
- public boolean getIconResumed() throws SdlException {
- // Test if proxy has been disposed
- if (_proxyDisposed) {
- throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
- }
-
- // Test SDL availability
- if (!_appInterfaceRegisterd) {
- throw new SdlException("SDL is not connected. Unable to determine if app icon was resumed.", SdlExceptionCause.SDL_UNAVAILABLE);
- }
- return _iconResumed;
- }
-
- /**
- * Method to retrieve the RegisterAppInterface Response message that was sent back from the
- * module. It contains various attributes about the connected module and can be used to adapt
- * to different module types and their supported features.
- *
- * @return RegisterAppInterfaceResponse received from the module or null if the app has not yet
- * registered with the module.
- */
- public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse(){
- return this.raiResponse;
- }
-
- /**
- * Get the current OnHMIStatus
- * @return OnHMIStatus object represents the current OnHMIStatus
- */
- public OnHMIStatus getCurrentHMIStatus(){
- return lastHmiStatus;
- }
-
- /**
- * Retrieves the auth token, if any, that was attached to the StartServiceACK for the RPC
- * service from the module. For example, this should be used to login to a user account.
- * @return the string representation of the auth token
- */
- public String getAuthToken(){
- return this.authToken;
- }
-
- /**
- * VideoStreamingManager houses all the elements needed to create a scoped, streaming manager for video projection. It is only a private, instance
- * dependant class at the moment until it can become public. Once the class is public and API defined, it will be moved into the SdlSession class
- */
- @TargetApi(19)
- private class VideoStreamingManager implements ISdlServiceListener{
- Context context;
- ISdl internalInterface;
- volatile VirtualDisplayEncoder encoder;
- private Class<? extends SdlRemoteDisplay> remoteDisplayClass = null;
- SdlRemoteDisplay remoteDisplay;
- IVideoStreamListener streamListener;
- float[] touchScalar = {1.0f,1.0f}; //x, y
- //private HapticInterfaceManager hapticManager;
- SdlMotionEvent sdlMotionEvent = null;
- VideoStreamingParameters videoStreamingParameters;
-
- public VideoStreamingManager(Context context,ISdl iSdl){
- this.context = context;
- this.internalInterface = iSdl;
- encoder = new VirtualDisplayEncoder();
- internalInterface.addServiceListener(SessionType.NAV,this);
- //Take care of the touch events
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_TOUCH_EVENT, new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- if (notification != null && remoteDisplay != null) {
- List<MotionEvent> events = convertTouchEvent((OnTouchEvent) notification);
- if (events != null && !events.isEmpty()) {
- for (MotionEvent ev : events) {
- remoteDisplay.handleMotionEvent(ev);
- }
- }
- }
- }
- });
- }
-
- /**
- * Starts the video service, caches the supplied params and prepares for the stream to start.
- * @param remoteDisplayClass the extension of SdlRemoteDisplay that will be streamed
- * @param parameters desired video streaming params
- * @param encrypted if the service is to be encrypted or not
- */
- public void startVideoStreaming(Class<? extends SdlRemoteDisplay> remoteDisplayClass, VideoStreamingParameters parameters, boolean encrypted){
- this.remoteDisplayClass = remoteDisplayClass;
- this.videoStreamingParameters = parameters;
- //Make sure the service is started, allows multi transports to connect and register without timing out
- internalInterface.startVideoService(parameters, encrypted);
- //After this, look to the
- }
-
- /**
- * The video service should already be started at this point. Once called, it will start
- * the encoders and fire up the remote display supplied by the user
- * @param parameters
- * @param encrypted
- */
- private void startStream(VideoStreamingParameters parameters, boolean encrypted){
- //Start the service first
- //streamListener = startVideoStream(encrypted,parameters);d
- //streamListener = sdlSession.startVideoStream();
- if(streamListener == null){
- DebugTool.logError(TAG, "Error starting video service");
- return;
- }
- VideoStreamingCapability capability = (VideoStreamingCapability)_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING);
- if(capability != null && Boolean.TRUE.equals(capability.getIsHapticSpatialDataSupported())){
- //hapticManager = new HapticInterfaceManager(internalInterface);
- }
-
- try {
- encoder.init(context, streamListener, parameters);
- //We are all set so we can start streaming at at this point
- encoder.start();
- //Encoder should be up and running
- createRemoteDisplay(encoder.getVirtualDisplay());
- } catch (Exception e) {
- e.printStackTrace();
- }
- DebugTool.logInfo(TAG, parameters.toString());
- }
-
- public void stopStreaming(){
- if(remoteDisplay!=null){
- remoteDisplay.stop();
- remoteDisplay = null;
- }
- if(encoder!=null){
- encoder.shutDown();
- }
- if(internalInterface!=null){
-// internalInterface.stopVideoService();
- }
- }
-
- public void dispose(){
- stopStreaming();
- internalInterface.removeServiceListener(SessionType.NAV,this);
- }
-
- private void createRemoteDisplay(final Display disp){
- try{
- if (disp == null){
- return;
- }
-
- // Dismiss the current presentation if the display has changed.
- if (remoteDisplay != null && remoteDisplay.getDisplay() != disp) {
- remoteDisplay.dismissPresentation();
- }
-
- FutureTask<Boolean> fTask = new FutureTask<Boolean>( new SdlRemoteDisplay.Creator(context, disp, remoteDisplay, remoteDisplayClass, new SdlRemoteDisplay.Callback(){
- @Override
- public void onCreated(final SdlRemoteDisplay remoteDisplay) {
- //Remote display has been created.
- //Now is a good time to do parsing for spatial data
- SdlProxyBase.VideoStreamingManager.this.remoteDisplay = remoteDisplay;
-// if(hapticManager != null) {
-// remoteDisplay.getMainView().post(new Runnable() {
-// @Override
-// public void run() {
-// hapticManager.refreshHapticData(remoteDisplay.getMainView());
-// }
-// });
-// }
- //Get touch scalars
- ImageResolution resolution = null;
- if(protocolVersion!= null && protocolVersion.getMajor()>=5){ //At this point we should already have the capability
- VideoStreamingCapability capability = (VideoStreamingCapability)_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING);
- if (capability != null) {
- resolution = capability.getPreferredResolution();
- }
- }
-
- if(resolution == null){ //Either the protocol version is too low to access video streaming caps, or they were null
- DisplayCapabilities dispCap = (DisplayCapabilities) internalInterface.getCapability(SystemCapabilityType.DISPLAY);
- if (dispCap != null) {
- resolution = (dispCap.getScreenParams().getImageResolution());
- }
- }
-
- if(resolution != null){
- DisplayMetrics displayMetrics = new DisplayMetrics();
- disp.getMetrics(displayMetrics);
- touchScalar[0] = ((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
- touchScalar[1] = ((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
- }
-
- }
-
- @Override
- public void onInvalidated(final SdlRemoteDisplay remoteDisplay) {
- //Our view has been invalidated
- //A good time to refresh spatial data
-// if(hapticManager != null) {
-// remoteDisplay.getMainView().post(new Runnable() {
-// @Override
-// public void run() {
-// hapticManager.refreshHapticData(remoteDisplay.getMainView());
-// }
-// });
-// }
- }
- } ));
- Thread showPresentation = new Thread(fTask);
-
- showPresentation.start();
- } catch (Exception ex) {
- DebugTool.logError(TAG, "Unable to create Virtual Display.");
- }
- }
-
- @Override
- public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
- if(SessionType.NAV.equals(type) && session != null ){
- DebugTool.logInfo(TAG, "Video service has been started. Starting video stream from proxy");
- if(session.getAcceptedVideoParams() != null){
- videoStreamingParameters = session.getAcceptedVideoParams();
- }
- startStream(videoStreamingParameters, isEncrypted);
- }
- }
-
- @Override
- public void onServiceEnded(SdlSession session, SessionType type) {
- if(SessionType.NAV.equals(type)){
- if(remoteDisplay!=null){
- stopStreaming();
- }
- }
- }
-
- @Override
- public void onServiceError(SdlSession session, SessionType type, String reason) {
-
- }
-
- private List<MotionEvent> convertTouchEvent(OnTouchEvent onTouchEvent) {
- List<MotionEvent> motionEventList = new ArrayList<MotionEvent>();
-
- List<TouchEvent> touchEventList = onTouchEvent.getEvent();
- if (touchEventList == null || touchEventList.size() == 0) return null;
-
- TouchType touchType = onTouchEvent.getType();
- if (touchType == null) {
- return null;
- }
-
- if (sdlMotionEvent == null) {
- if (touchType == TouchType.BEGIN) {
- sdlMotionEvent = new SdlMotionEvent();
- } else {
- return null;
- }
- }
-
- SdlMotionEvent.Pointer pointer;
- MotionEvent motionEvent;
-
- for (TouchEvent touchEvent : touchEventList) {
- if (touchEvent == null || touchEvent.getId() == null) {
- continue;
- }
-
- List<TouchCoord> touchCoordList = touchEvent.getTouchCoordinates();
- if (touchCoordList == null || touchCoordList.size() == 0) {
- continue;
- }
-
- TouchCoord touchCoord = touchCoordList.get(touchCoordList.size() - 1);
- if (touchCoord == null) {
- continue;
- }
-
- int motionEventAction = sdlMotionEvent.getMotionEventAction(touchType, touchEvent);
- long downTime = sdlMotionEvent.downTime;
- long eventTime = sdlMotionEvent.eventTime;
- pointer = sdlMotionEvent.getPointerById(touchEvent.getId());
- if (pointer != null) {
- pointer.setCoords(touchCoord.getX() * touchScalar[0], touchCoord.getY() * touchScalar[1]);
- }
-
- MotionEvent.PointerProperties[] pointerProperties = new MotionEvent.PointerProperties[sdlMotionEvent.pointers.size()];
- MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[sdlMotionEvent.pointers.size()];
-
- for (int i = 0; i < sdlMotionEvent.pointers.size(); i++) {
- pointerProperties[i] = new MotionEvent.PointerProperties();
- pointerProperties[i].id = sdlMotionEvent.getPointerByIndex(i).id;
- pointerProperties[i].toolType = MotionEvent.TOOL_TYPE_FINGER;
-
- pointerCoords[i] = new MotionEvent.PointerCoords();
- pointerCoords[i].x = sdlMotionEvent.getPointerByIndex(i).x;
- pointerCoords[i].y = sdlMotionEvent.getPointerByIndex(i).y;
- pointerCoords[i].orientation = 0;
- pointerCoords[i].pressure = 1.0f;
- pointerCoords[i].size = 1;
- }
-
- motionEvent = MotionEvent.obtain(downTime, eventTime, motionEventAction,
- sdlMotionEvent.pointers.size(), pointerProperties, pointerCoords, 0, 0, 1,
- 1, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);
- motionEventList.add(motionEvent);
-
- if (motionEventAction == MotionEvent.ACTION_UP || motionEventAction == MotionEvent.ACTION_CANCEL) {
- //If the motion event should be finished we should clear our reference
- sdlMotionEvent.pointers.clear();
- sdlMotionEvent = null;
- break;
- } else if ((motionEventAction & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP) {
- sdlMotionEvent.removePointerById(touchEvent.getId());
- }
- }
-
- return motionEventList;
- }
- }
-
- /**
- * Keeps track of the current motion event for VPM
- */
- private static class SdlMotionEvent {
- class Pointer {
- int id;
- float x;
- float y;
-
- Pointer(int id) {
- this.id = id;
- this.x = 0.0f;
- this.y = 0.0f;
- }
-
- void setCoords(float x, float y) {
- this.x = x;
- this.y = y;
- }
- }
-
- private CopyOnWriteArrayList<Pointer> pointers = new CopyOnWriteArrayList<>();
- private long downTime;
- private long downTimeOnHMI;
- private long eventTime;
-
- SdlMotionEvent() {
- downTimeOnHMI = 0;
- }
-
- /**
- * Handles the SDL Touch Event to keep track of pointer status and returns the appropriate
- * Android MotionEvent according to this events status
- *
- * @param touchType The SDL TouchType that was received from the module
- * @param touchEvent The SDL TouchEvent that was received from the module
- * @return the correct native Android MotionEvent action to dispatch
- */
- synchronized int getMotionEventAction(TouchType touchType, TouchEvent touchEvent) {
- eventTime = 0;
- int motionEventAction = -1;
- switch (touchType) {
- case BEGIN:
- if (pointers.size() == 0) {
- //The motion event has just begun
- motionEventAction = MotionEvent.ACTION_DOWN;
- downTime = SystemClock.uptimeMillis();
- downTimeOnHMI = touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1);
- eventTime = downTime;
- } else {
- motionEventAction = MotionEvent.ACTION_POINTER_DOWN | pointers.size() << MotionEvent.ACTION_POINTER_INDEX_SHIFT;
- eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
- }
- pointers.add(new Pointer(touchEvent.getId()));
- break;
- case MOVE:
- motionEventAction = MotionEvent.ACTION_MOVE;
- eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
- break;
- case END:
- if(pointers.size() <= 1){
- //The motion event has just ended
- motionEventAction = MotionEvent.ACTION_UP;
- } else {
- int pointerIndex = pointers.indexOf(getPointerById(touchEvent.getId()));
- if (pointerIndex != -1) {
- motionEventAction = MotionEvent.ACTION_POINTER_UP | pointerIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT;
- } else {
- motionEventAction = MotionEvent.ACTION_UP;
- }
- }
- eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
- break;
- case CANCEL:
- //Assuming this cancels the entire event
- motionEventAction = MotionEvent.ACTION_CANCEL;
- eventTime = downTime + touchEvent.getTimestamps().get(touchEvent.getTimestamps().size() - 1) - downTimeOnHMI;
- break;
- default:
- break;
- }
- return motionEventAction;
- }
-
- Pointer getPointerById(int id) {
- if (pointers != null && !pointers.isEmpty()) {
- for (Pointer pointer : pointers) {
- if (pointer.id == id) {
- return pointer;
- }
- }
- }
- return null;
- }
-
- Pointer getPointerByIndex(int index) {
- return pointers.get(index);
- }
-
- void removePointerById(int id) {
- pointers.remove(getPointerById(id));
- }
- }
-
-} // end-class
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
deleted file mode 100644
index 5240c4813..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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;
-
-import android.app.Service;
-import android.content.Context;
-
-import com.smartdevicelink.exception.SdlException;
-import com.smartdevicelink.proxy.interfaces.IProxyListenerALM;
-import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
-import com.smartdevicelink.proxy.rpc.TTSChunk;
-import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
-import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
-import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.security.SdlSecurityBase;
-import com.smartdevicelink.transport.BTTransportConfig;
-import com.smartdevicelink.transport.BaseTransportConfig;
-import com.smartdevicelink.transport.MultiplexTransportConfig;
-
-import java.util.List;
-import java.util.Vector;
-
-@Deprecated
-public class SdlProxyBuilder {
- // Required parameters
- private IProxyListenerALM listener;
- private String appId;
- private String appName;
- private Boolean isMediaApp;
- private Context context;
- private BaseTransportConfig mTransport;
-
- // Optional parameters
- private Service service;
- private SdlProxyConfigurationResources sdlProxyConfigurationResources;
- private Vector<TTSChunk> ttsChunks;
- private String sShortAppName;
- private Vector<String> vrSynonyms;
- private SdlMsgVersion sdlMessageVersion;
- private Language lang;
- private Language hmiLang;
- private Vector<AppHMIType> vrAppHMITypes;
- private String autoActivateID;
- private boolean callbackToUIThread;
- private boolean preRegister;
- private String sAppResumeHash;
- private List<Class<? extends SdlSecurityBase>> sdlSecList;
- private TemplateColorScheme dayColorScheme, nightColorScheme;
-
- private SdlProxyBuilder() {
- service = null;
- sdlProxyConfigurationResources = null;
- ttsChunks = null;
- sShortAppName = null;
- vrSynonyms = null;
- sdlMessageVersion = null;
- lang = Language.EN_US;
- hmiLang = Language.EN_US;
- vrAppHMITypes = null;
- autoActivateID = null;
- callbackToUIThread = false;
- preRegister = false;
- sAppResumeHash = null;
- sdlSecList = null;
- dayColorScheme = null;
- nightColorScheme = null;
-}
-
- public static class Builder {
- SdlProxyBuilder sdlProxyBuilder;
-
- /**
- * @deprecated Use Builder(IProxyListenerALM, String, String, Boolean, Context) instead
- */
- @Deprecated
- public Builder(IProxyListenerALM listener, String appId, String appName, Boolean isMediaApp) {
- sdlProxyBuilder = new SdlProxyBuilder();
- sdlProxyBuilder.listener = listener;
- sdlProxyBuilder.appId = appId;
- sdlProxyBuilder.appName = appName;
- sdlProxyBuilder.isMediaApp = isMediaApp;
- sdlProxyBuilder.mTransport = new BTTransportConfig();
- }
-
- public Builder(IProxyListenerALM listener, String appId, String appName, Boolean isMediaApp, Context context) {
- sdlProxyBuilder = new SdlProxyBuilder();
- sdlProxyBuilder.listener = listener;
- sdlProxyBuilder.appId = appId;
- sdlProxyBuilder.appName = appName;
- sdlProxyBuilder.isMediaApp = isMediaApp;
- sdlProxyBuilder.context = context;
- sdlProxyBuilder.mTransport = new MultiplexTransportConfig(context, appId);
- }
-
- public Builder setService(Service val) {
- sdlProxyBuilder.service = val;
- return this;
- }
-
- public Builder setSdlProxyConfigurationResources(SdlProxyConfigurationResources val) {
- sdlProxyBuilder.sdlProxyConfigurationResources = val;
- return this;
- }
-
- public Builder setTtsName(Vector<TTSChunk> val) {
- sdlProxyBuilder.ttsChunks = val;
- return this;
- }
-
- public Builder setShortAppName(String val) {
- sdlProxyBuilder.sShortAppName = val;
- return this;
- }
-
- public Builder setVrSynonyms(Vector<String> val) {
- sdlProxyBuilder.vrSynonyms = val;
- return this;
- }
-
- public Builder setSdlMessageVersion(SdlMsgVersion val) {
- sdlProxyBuilder.sdlMessageVersion = val;
- return this;
- }
-
- public Builder setLangDesired(Language val) {
- sdlProxyBuilder.lang = val;
- return this;
- }
-
- public Builder setHMILangDesired(Language val) {
- sdlProxyBuilder.hmiLang = val;
- return this;
- }
-
- public Builder setVrAppHMITypes(Vector<AppHMIType> val) {
- sdlProxyBuilder.vrAppHMITypes = val;
- return this;
- }
-
- public Builder setAutoActivateID(String val) {
- sdlProxyBuilder.autoActivateID = val;
- return this;
- }
-
- public Builder setCallbackToUIThread(boolean val) {
- sdlProxyBuilder.callbackToUIThread = val;
- return this;
- }
-
- public Builder setPreRegister(boolean val) {
- sdlProxyBuilder.preRegister = val;
- return this;
- }
-
- public Builder setAppResumeDataHash(String val) {
- sdlProxyBuilder.sAppResumeHash = val;
- return this;
- }
-
- public Builder setTransportType(BaseTransportConfig val) {
- sdlProxyBuilder.mTransport = val;
- return this;
- }
-
- public Builder setSdlSecurity(List<Class<? extends SdlSecurityBase>> val) {
- sdlProxyBuilder.sdlSecList = val;
- return this;
- }
- public Builder setDayColorScheme(TemplateColorScheme val) {
- sdlProxyBuilder.dayColorScheme = val;
- return this;
- }
-
- public Builder setNightColorScheme(TemplateColorScheme val) {
- sdlProxyBuilder.nightColorScheme = val;
- return this;
- }
-
- public SdlProxyALM build() throws SdlException {
- SdlProxyALM proxy = new SdlProxyALM(sdlProxyBuilder.service, sdlProxyBuilder.listener,
- sdlProxyBuilder.sdlProxyConfigurationResources, sdlProxyBuilder.appName,
- sdlProxyBuilder.ttsChunks, sdlProxyBuilder.sShortAppName, sdlProxyBuilder.vrSynonyms,
- sdlProxyBuilder.isMediaApp, sdlProxyBuilder.sdlMessageVersion, sdlProxyBuilder.lang,
- sdlProxyBuilder.hmiLang, sdlProxyBuilder.vrAppHMITypes, sdlProxyBuilder.appId,
- sdlProxyBuilder.autoActivateID, sdlProxyBuilder.dayColorScheme, sdlProxyBuilder.nightColorScheme,
- sdlProxyBuilder.callbackToUIThread, sdlProxyBuilder.preRegister,
- sdlProxyBuilder.sAppResumeHash, sdlProxyBuilder.mTransport);
- proxy.setSdlSecurityClassList(sdlProxyBuilder.sdlSecList);
- return proxy;
- }
- }
-}
-
-
-
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java
deleted file mode 100644
index 6e76db82a..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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;
-
-import android.telephony.TelephonyManager;
-
-@Deprecated
-public class SdlProxyConfigurationResources {
- private String _sdlConfigurationFilePath;
- private TelephonyManager _telephonyManager;
-
- public SdlProxyConfigurationResources() {
- this(null, null);
- }
-
- public SdlProxyConfigurationResources(String sdlConfigurationFilePath,
- TelephonyManager telephonyManager) {
- _sdlConfigurationFilePath = sdlConfigurationFilePath;
- _telephonyManager = telephonyManager;
- }
-
- public void setSdlConfigurationFilePath(String sdlConfigurationFilePath) {
- _sdlConfigurationFilePath = sdlConfigurationFilePath;
- }
-
- public String getSdlConfigurationFilePath() {
- return _sdlConfigurationFilePath;
- }
-
- public void setTelephonyManager(TelephonyManager telephonyManager) {
- _telephonyManager = telephonyManager;
- }
-
- public TelephonyManager getTelephonyManager() {
- return _telephonyManager;
- }
-}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
index 91623dd9d..6d93205c1 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
@@ -39,8 +39,6 @@ import com.smartdevicelink.protocol.enums.MessageType;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.proxy.SdlProxyBase;
-import com.smartdevicelink.proxy.interfaces.IProxyListenerBase;
import com.smartdevicelink.proxy.interfaces.IPutFileResponseListener;
import com.smartdevicelink.proxy.rpc.PutFile;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
@@ -57,8 +55,8 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
private Thread thread = null;
private long lFileSize = 0;
private String sFileName;
- private SdlProxyBase<IProxyListenerBase> _proxy;
- private IProxyListenerBase _proxyListener;
+ private Object _proxy;
+ private Object _proxyListener;
private Object mPauseLock;
private boolean mPaused;
@@ -67,7 +65,7 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
private Version rpcSpecVersion;
- public StreamRPCPacketizer(SdlProxyBase<IProxyListenerBase> proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion, long lLength, SdlSession session) throws IOException {
+ public StreamRPCPacketizer(Object proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, byte wiproVersion, long lLength, SdlSession session) throws IOException {
super(streamListener, is, request, sType, rpcSessionID, wiproVersion, session);
lFileSize = lLength;
iInitialCorrID = request.getCorrelationID();
@@ -77,15 +75,15 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
if (proxy != null)
{
_proxy = proxy;
- _proxyListener = _proxy.getProxyListener();
- _proxy.addPutFileResponseListener(this);
+ //_proxyListener = _proxy.getProxyListener();
+ //_proxy.addPutFileResponseListener(this);
}
if(_request.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.toString())){
//callBack = ((PutFile)_request).getOnPutFileUpdateListener();
}
}
- public StreamRPCPacketizer(SdlProxyBase<IProxyListenerBase> proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, Version wiproVersion, Version rpcSpecVersion, long lLength, SdlSession session) throws IOException {
+ public StreamRPCPacketizer(Object proxy, IStreamListener streamListener, InputStream is, RPCRequest request, SessionType sType, byte rpcSessionID, Version wiproVersion, Version rpcSpecVersion, long lLength, SdlSession session) throws IOException {
super(streamListener, is, request, sType, rpcSessionID, wiproVersion, session);
this.rpcSpecVersion = rpcSpecVersion;
lFileSize = lLength;
@@ -95,8 +93,8 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
isRPCProtected = request.isPayloadProtected();
if (proxy != null) {
_proxy = proxy;
- _proxyListener = _proxy.getProxyListener();
- _proxy.addPutFileResponseListener(this);
+ //_proxyListener = _proxy.getProxyListener();
+ //_proxy.addPutFileResponseListener(this);
}
if(_request.getFunctionName().equalsIgnoreCase(FunctionID.PUT_FILE.toString())){
//callBack = ((PutFile)_request).getOnPutFileUpdateListener();
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransportConfig.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransportConfig.java
deleted file mode 100644
index 3b4123b3a..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/BTTransportConfig.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.transport;
-
-import com.smartdevicelink.transport.enums.TransportType;
-
-/**
- * Container of Bluetooth transport specific configuration.
- */
-@Deprecated
-public final class BTTransportConfig extends BaseTransportConfig {
-
- private boolean bKeepSocketActive = true;
-
- /**
- * Overridden abstract method which returns specific type of this transport configuration.
- *
- * @return Constant value TransportType.BLUETOOTH.
- *
- * @see TransportType
- */
- public TransportType getTransportType() {
- return TransportType.BLUETOOTH;
- }
-
- public BTTransportConfig() {
- this(true);
- }
-
- public BTTransportConfig(boolean shareConnection) {
- super.shareConnection = shareConnection;
- }
-
- public void setKeepSocketActive(boolean bValue) {
- bKeepSocketActive = bValue;
- }
-
- public boolean getKeepSocketActive() {
- return bKeepSocketActive;
- }
-
-}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
index 4ed1b85f4..1ad6a3e9a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
@@ -113,14 +113,14 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}
if(!(action.equalsIgnoreCase(BluetoothDevice.ACTION_ACL_CONNECTED)
- || action.equalsIgnoreCase(USBTransport.ACTION_USB_ACCESSORY_ATTACHED)
+ || action.equalsIgnoreCase(TransportConstants.ACTION_USB_ACCESSORY_ATTACHED)
|| action.equalsIgnoreCase(TransportConstants.START_ROUTER_SERVICE_ACTION))){
//We don't want anything else here if the child class called super and has different intent filters
//Log.i(TAG, "Unwanted intent from child class");
return;
}
- if(action.equalsIgnoreCase(USBTransport.ACTION_USB_ACCESSORY_ATTACHED)){
+ if(action.equalsIgnoreCase(TransportConstants.ACTION_USB_ACCESSORY_ATTACHED)){
DebugTool.logInfo(TAG,"Usb connected");
intent.setAction(null);
onSdlEnabled(context, intent);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlTransport.java
deleted file mode 100644
index 32fe26fee..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlTransport.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.transport;
-
-import com.smartdevicelink.exception.SdlException;
-import com.smartdevicelink.protocol.SdlPacket;
-import com.smartdevicelink.trace.SdlTrace;
-import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
-import com.smartdevicelink.transport.enums.TransportType;
-import com.smartdevicelink.util.DebugTool;
-
-public abstract class SdlTransport {
- private static final String TAG = "SdlTransport";
- private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
-
- private final static String FailurePropagating_Msg = "Failure propagating ";
- private Boolean isConnected = false;
-
- private String _sendLockObj = "lock";
-
-
- // Get status of transport connection
- public Boolean getIsConnected() {
- return isConnected;
- }
-
- //protected SdlTransport(String endpointName, String param2, ITransportListener transportListener)
- protected SdlTransport(ITransportListener transportListener) {
- if (transportListener == null) {
- throw new IllegalArgumentException("Provided transport listener interface reference is null");
- } // end-if
- _transportListener = transportListener;
- } // end-method
-
- // This method is called by the subclass to indicate that data has arrived from
- // the transport.
- protected void handleReceivedPacket(SdlPacket packet) {
- try {
- // Trace received data
- if (packet!=null) {
- // Send transport data to the siphon server
- //FIXME SiphonServer.sendBytesFromSDL(receivedBytes, 0, receivedBytesLength);
- //SdlTrace.logTransportEvent("", null, InterfaceActivityDirection.Receive, receivedBytes, receivedBytesLength, SDL_LIB_TRACE_KEY);
-
- _transportListener.onTransportPacketReceived(packet);
- } // end-if
- } catch (Exception excp) {
- DebugTool.logError(TAG, FailurePropagating_Msg + "handleBytesFromTransport: " + excp.toString(), excp);
- handleTransportError(FailurePropagating_Msg, excp);
- } // end-catch
- } // end-method
-
- // This method must be implemented by transport subclass, and is called by this
- // base class to actually send an array of bytes out over the transport. This
- // method is meant to only be callable within the class hierarchy.
- protected abstract boolean sendBytesOverTransport(SdlPacket packet);
-
- // This method is called by whomever has reference to transport to have bytes
- // sent out over transport.
- /* public boolean sendBytes(byte[] message) {
- return sendBytes(message, 0, message.length);
- }*/ // end-method
-
- // This method is called by whomever has reference to transport to have bytes
- // sent out over transport.
- public boolean sendBytes(SdlPacket packet) {
- boolean bytesWereSent = false;
- synchronized (_sendLockObj) {
- bytesWereSent = sendBytesOverTransport(packet);//message, offset, length);
- } // end-lock
- // Send transport data to the siphon server
- //FIXME SiphonServer.sendBytesFromAPP(message, offset, length);
-
- //FIXME SdlTrace.logTransportEvent("", null, InterfaceActivityDirection.Transmit, message, offset, length, SDL_LIB_TRACE_KEY);
- return bytesWereSent;
- } // end-method
-
- private ITransportListener _transportListener = null;
-
- // This method is called by the subclass to indicate that transport connection
- // has been established.
- protected void handleTransportConnected() {
- isConnected = true;
- try {
- SdlTrace.logTransportEvent("Transport.connected", null, InterfaceActivityDirection.Receive, null, 0, SDL_LIB_TRACE_KEY);
- _transportListener.onTransportConnected();
- } catch (Exception excp) {
- DebugTool.logError(TAG, FailurePropagating_Msg + "onTransportConnected: " + excp.toString(), excp);
- handleTransportError(FailurePropagating_Msg + "onTransportConnected", excp);
- } // end-catch
- } // end-method
-
- // This method is called by the subclass to indicate that transport disconnection
- // has occurred.
- protected void handleTransportDisconnected(final String info) {
- isConnected = false;
-
- try {
- SdlTrace.logTransportEvent("Transport.disconnect: " + info, null, InterfaceActivityDirection.Transmit, null, 0, SDL_LIB_TRACE_KEY);
- _transportListener.onTransportDisconnected(info);
- } catch (Exception excp) {
- DebugTool.logError(TAG, FailurePropagating_Msg + "onTransportDisconnected: " + excp.toString(), excp);
- } // end-catch
- } // end-method
-
- // This method is called by the subclass to indicate a transport error has occurred.
- protected void handleTransportError(final String message, final Exception ex) {
- isConnected = false;
- _transportListener.onTransportError(message, ex);
- }
-
- public abstract void openConnection() throws SdlException;
- public abstract void disconnect();
-
- /**
- * Abstract method which should be implemented by subclasses in order to return actual type of the transport.
- *
- * @return One of {@link TransportType} enumeration values.
- *
- * @see TransportType
- */
- public abstract TransportType getTransportType();
-
- public abstract String getBroadcastComment();
-} // end-class
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
deleted file mode 100644
index cc123d041..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- * 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.transport;
-
-import android.annotation.SuppressLint;
-import android.os.NetworkOnMainThreadException;
-
-import com.smartdevicelink.exception.SdlException;
-import com.smartdevicelink.exception.SdlExceptionCause;
-import com.smartdevicelink.protocol.SdlPacket;
-import com.smartdevicelink.transport.enums.TransportType;
-import com.smartdevicelink.util.DebugTool;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-
-/**
- * General comments:
- *
- * 1) Transport layer can be reorganized to properly incapsulate thread-related code according to Android OS guidelines
- * 2) Currently there are different cases when transport error information sent to listener components
- * a) when there are some errors during writing data to transport
- * b) when there are errors during connection establishing/reading data
- * But information about transport disconnection is sent only if disconnection was successful. So we have following
- * sequences:
- * a) handleTransportConnected -> read without errors -> handleTransportDisconnected
- * b) handleTransportConnected -> handleTransportError(write with errors) -> handleTransportDisconnected
- * c) handleTransportConnected -> handleTransportError(read with errors) -> handleTransportError(socket closed)
- *
- * They can be changed to be more natural and easy to use.
- *
- * 3) Public api is inconsistent. During single call of some api method (for example "openConnection") some of the
- * following result can appears:
- * a) SdlException thrown
- * b) onTransportError callback called on listeners
- *
- * 4) Handling of connection must be more stable
- * 5) General solution in case of reconnecting must be implemented
- * 6) It must be common and same solution for handling information about physical device adapters (BT, WiFi etc.)
- */
-
-/**
- * Class that implements TCP transport
- */
-public class TCPTransport extends SdlTransport {
- private static final String TAG = "TCPTransport";
- /**
- * Size of the read buffer.
- */
- private static final int READ_BUFFER_SIZE = 4096;
-
- /**
- * Delay between reconnect attempts
- */
- private static final int RECONNECT_DELAY = 5000;
-
- /**
- * Count of the reconnect retries
- */
- private static final int RECONNECT_RETRY_COUNT = 30;
-
- /**
- * Instance of TCP transport configuration
- */
- private TCPTransportConfig mConfig = null;
-
- /**
- * Instance of the client socket
- */
- private Socket mSocket = null;
-
- /**
- * Instance of the input stream. Used to read data from SmartDeviceLinkCore
- */
- private InputStream mInputStream = null;
-
- /**
- * Instance of the output stream. Used to send data to SmartDeviceLinkCore
- */
- private OutputStream mOutputStream = null;
-
- /**
- * Instance of the separate thread, that does actual work, related to connecting/reading/writing data
- */
- private TCPTransportThread mThread = null;
-
- /**
- * Initial internal state of the component. Used like a simple lightweight FSM replacement while component
- * must behave differently in response to it's public function calls depending of it's current state
- */
- private TCPTransportState mCurrentState = TCPTransportState.IDLE;
-
- /**
- * Constructs TCP transport component instance
- *
- * @param tcpTransportConfig Instance of the TCP transport configuration
- * @param transportListener Listener that will be notified on different TCP transport activities
- */
- public TCPTransport(TCPTransportConfig tcpTransportConfig, ITransportListener transportListener) {
- super(transportListener);
- this.mConfig = tcpTransportConfig;
- }
-
- /**
- * Performs actual work of sending array of bytes over the transport
- * @param packet The SdlPacket that should be sent over the transport
- * @return True if data was sent successfully, False otherwise
- */
- @SuppressLint("DefaultLocale")
- @Override
- protected boolean sendBytesOverTransport(SdlPacket packet) {
- TCPTransportState currentState = getCurrentState();
- byte[] msgBytes = packet.constructPacket();
- logInfo(String.format("TCPTransport: sendBytesOverTransport requested. Size: %d, Offset: %d, Length: %d, Current state is: %s"
- , msgBytes.length, 0, msgBytes.length, currentState.name()));
-
- boolean bResult = false;
-
- if(currentState == TCPTransportState.CONNECTED) {
- if (mOutputStream != null) {
- logInfo("TCPTransport: sendBytesOverTransport request accepted. Trying to send data");
- try {
- mOutputStream.write(msgBytes, 0, msgBytes.length);
- bResult = true;
- logInfo("TCPTransport.sendBytesOverTransport: successfully send data");
- } catch (IOException | NetworkOnMainThreadException e) {
- logError("TCPTransport.sendBytesOverTransport: error during sending data: " + e.getMessage());
- bResult = false;
- }
- } else {
- logError("TCPTransport: sendBytesOverTransport request accepted, but output stream is null");
- }
- }
- else {
- logInfo("TCPTransport: sendBytesOverTransport request rejected. Transport is not connected");
- bResult = false;
- }
-
- return bResult;
- }
-
- /**
- * Tries to open connection to SmartDeviceLinkCore.
- * Actual try will be performed only if no actual connection is available
- * @throws SdlException
- */
- @Override
- public void openConnection() throws SdlException {
- TCPTransportState currentState = getCurrentState();
- logInfo(String.format("TCPTransport: openConnection requested. Current state is: %s", currentState.name()));
-
- if(currentState == TCPTransportState.IDLE) {
- synchronized (this) {
- setCurrentState(TCPTransportState.CONNECTING);
- logInfo("TCPTransport: openConnection request accepted. Starting transport thread");
- try {
- mThread = new TCPTransportThread();
- mThread.setDaemon(true);
- mThread.start();
-
- // Initialize the SiphonServer
- if (SiphonServer.getSiphonEnabledStatus()) {
- SiphonServer.init();
- }
-
- } catch (Exception e) {
- logError("TCPTransport: Exception during transport thread starting", e);
- throw new SdlException(e);
- }
- }
- } else {
- logInfo("TCPTransport: openConnection request rejected. Another connection is not finished");
- }
- }
-
-
- /**
- * Tries to disconnect from SmartDeviceLinkCore.
- * Actual try will be performed only if connection is available
- */
- @Override
- public void disconnect() {
- TCPTransportState currentState = getCurrentState();
- logInfo(String.format("TCPTransport: disconnect requested from client. Current state is: %s", currentState.name()));
-
- if(currentState == TCPTransportState.CONNECTED) {
- logInfo("TCPTransport: disconnect request accepted.");
- synchronized (this) {
- disconnect(null, null, true);
- }
- } else {
- logInfo("TCPTransport: disconnect request rejected. Transport is not connected");
- }
- }
-
- /**
- * Performs actual work related to disconnecting from SmartDeviceLinkCore.
- *
- * @param message Message that describes disconnect reason
- * @param exception Some of the possible exceptions that was the reason of disconnecting
- * @param stopThread True if not only disconnection must be done but also thread that handles connection must be
- * also stopped so no reconnect attempts will be made
- */
- private synchronized void disconnect(String message, Exception exception, boolean stopThread) {
-
- if(getCurrentState() == TCPTransportState.DISCONNECTING) {
- logInfo("TCPTransport: disconnecting already in progress");
- return;
- }
-
- setCurrentState(TCPTransportState.DISCONNECTING);
-
- String disconnectMsg = (message == null ? "" : message);
- if (exception != null) {
- disconnectMsg += ", " + exception.toString();
- }
-
- try {
- if(mThread != null && stopThread) {
- mThread.halt();
- mThread.interrupt();
- }
-
- if(mSocket != null){
- mSocket.close();
- }
- mSocket = null;
- } catch (IOException e) {
- logError("TCPTransport.disconnect: Exception during disconnect: " + e.getMessage());
- }
-
- if (exception == null) {
- // This disconnect was not caused by an error, notify the proxy that
- // the transport has been disconnected.
- logInfo("Disconnect is correct. Handling it");
- handleTransportDisconnected(disconnectMsg);
- } else {
- // This disconnect was caused by an error, notify the proxy
- // that there was a transport error.
- logError("Disconnect is incorrect. Handling it as error");
- handleTransportError(disconnectMsg, exception);
- }
- }
-
- /**
- * Overridden abstract method which returns specific type of this transport.
- *
- * @return Constant value - TransportType.TCP.
- *
- * @see TransportType
- */
- public TransportType getTransportType() {
- return TransportType.TCP;
- }
-
- /**
- * Internal method for logging information messages
- * @param message Message to log
- */
- protected void logInfo(String message) {
- DebugTool.logInfo(TAG, message);
- }
-
- /**
- * Internal method for logging error messages
- * @param message Message to log
- */
- protected void logError(String message) {
- DebugTool.logError(TAG, message);
- }
-
- /**
- * Internal method for logging warning messages
- * @param message Message to log
- */
- protected void logWarning(String message) {
- DebugTool.logWarning(TAG, message);
- }
-
- /**
- * Internal method for logging error message together with information about exception that was the reason of it
- * @param message Message to log
- * @param throwable Exception, that was the main reason for logged error message
- */
- protected void logError(String message, Throwable throwable) {
- DebugTool.logError(TAG, message, throwable);
- }
-
- /**
- * Internal class that represents separate thread, that does actual work, related to connecting/reading/writing data
- */
- private class TCPTransportThread extends Thread {
- SdlPsm psm;
- public TCPTransportThread(){
- psm = new SdlPsm();
- }
- /**
- * Represents current thread state - halted or not. This flag is used to change internal behavior depending
- * on current state.
- */
- private Boolean isHalted = false;
-
- /**
- * Method that marks thread as halted.
- */
- public void halt() {
- isHalted = true;
- }
-
- /**
- * Tries to connect to the SmartDeviceLink core. Behavior depends autoReconnect configuration param:
- * a) If autoReconnect is false, then only one connect try will be performed.
- * b) If autoReconnect is true, then in case of connection error continuous reconnect will be performed
- * after short delay until connection will be established or retry count will be reached
- *
- * @return true if connection established and false otherwise
- */
- @SuppressLint("DefaultLocale")
- private boolean connect() {
- boolean bConnected;
- int remainingRetry = RECONNECT_RETRY_COUNT;
-
- synchronized (TCPTransport.this) {
- do {
- try {
-
- if ((null != mSocket) && (!mSocket.isClosed())) {
- logInfo("TCPTransport.connect: Socket is not closed. Trying to close it");
- mSocket.close();
- }
-
- logInfo(String.format("TCPTransport.connect: Socket is closed. Trying to connect to %s", mConfig));
- mSocket = new Socket();
- mSocket.connect(new InetSocketAddress(mConfig.getIPAddress(), mConfig.getPort()));
- mOutputStream = mSocket.getOutputStream();
- mInputStream = mSocket.getInputStream();
-
- } catch (IOException e) {
- logError("TCPTransport.connect: Exception during connect stage: " + e.getMessage());
- }
-
- bConnected = (null != mSocket) && mSocket.isConnected();
-
- if(bConnected){
- logInfo("TCPTransport.connect: Socket connected");
- }else{
- if(mConfig.getAutoReconnect()){
- remainingRetry--;
- logInfo(String.format("TCPTransport.connect: Socket not connected. AutoReconnect is ON. retryCount is: %d. Waiting for reconnect delay: %d"
- , remainingRetry, RECONNECT_DELAY));
- waitFor(RECONNECT_DELAY);
- } else {
- logInfo("TCPTransport.connect: Socket not connected. AutoReconnect is OFF");
- }
- }
- } while ((!bConnected) && (mConfig.getAutoReconnect()) && (remainingRetry > 0) && (!isHalted));
-
- return bConnected;
- }
- }
-
- /**
- * Performs actual thread work
- */
- @Override
- public void run() {
- logInfo("TCPTransport.run: transport thread created. Starting connect stage");
- psm.reset();
- while(!isHalted) {
- setCurrentState(TCPTransportState.CONNECTING);
- if(!connect()){
- if (isHalted) {
- logInfo("TCPTransport.run: Connection failed, but thread already halted");
- } else {
- disconnect("Failed to connect to Sdl", new SdlException("Failed to connect to Sdl"
- , SdlExceptionCause.SDL_CONNECTION_FAILED), true);
- }
- break;
- }
-
- synchronized (TCPTransport.this) {
- setCurrentState(TCPTransportState.CONNECTED);
- handleTransportConnected();
- }
-
- byte input;
- byte[] buffer = new byte[READ_BUFFER_SIZE];
- int bytesRead;
- boolean stateProgress = false;
- while (!isHalted) {
- //logInfo("TCPTransport.run: Waiting for data...");
- try {
- //input = (byte) mInputStream.read();
- bytesRead = mInputStream.read(buffer);
- } catch (IOException e) {
- internalHandleStreamReadError();
- break;
- }
-
- synchronized (TCPTransport.this) {
- if (mThread.isInterrupted()) {
- logInfo("TCPTransport.run: Got new data but thread is interrupted");
- break;
- }
- }
- for (int i = 0; i < bytesRead; i++) {
- //logInfo("TCPTransport.run: Got new data");
- // Send the response of what we received
- input = buffer[i];
- stateProgress = psm.handleByte(input);
- if (!stateProgress) {//We are trying to weed through the bad packet info until we get something
-
- //Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
- psm.reset();
- }
-
- if (psm.getState() == SdlPsm.FINISHED_STATE)
- {
- synchronized (TCPTransport.this) {
- //Log.d(TAG, "Packet formed, sending off");
- handleReceivedPacket((SdlPacket) psm.getFormedPacket());
- }
- //We put a trace statement in the message read so we can avoid all the extra bytes
- psm.reset();
- }
- //FIXME logInfo(String.format("TCPTransport.run: Received %d bytes", bytesRead));
- }
- }
- }
-
- logInfo("TCPTransport.run: Thread terminated");
- setCurrentState(TCPTransportState.IDLE);
- }
-
- /**
- * Internal handling of Tcp disconnection
- */
- private void internalHandleTCPDisconnect() {
- if(isHalted){
- logInfo("TCPTransport.run: TCP disconnect received, but thread already halted");
- } else {
- logInfo("TCPTransport.run: TCP disconnect received");
- disconnect("TCPTransport.run: End of stream reached", null, false);
- }
- }
-
- /**
- * Internal handling of reading data from input stream
- */
- private void internalHandleStreamReadError() {
- if(isHalted){
- logError("TCPTransport.run: Exception during reading data, but thread already halted");
- } else {
- logError("TCPTransport.run: Exception during reading data");
- disconnect("Failed to read data from Sdl", new SdlException("Failed to read data from Sdl"
- , SdlExceptionCause.SDL_CONNECTION_FAILED), false);
- }
- }
- }
-
- /**
- * Returns current TCP transport state
- *
- * @return current state
- */
- private synchronized TCPTransportState getCurrentState() {
- return mCurrentState;
- }
-
- /**
- * Sets current TCP transport state
- * @param currentState New state
- */
- private synchronized void setCurrentState(TCPTransportState currentState) {
- logInfo(String.format("Current state changed to: %s", currentState));
- this.mCurrentState = currentState;
- }
-
- /**
- * Implementation of waiting required delay that cannot be interrupted
- * @param timeMs Time in milliseconds of required delay
- */
- private void waitFor(long timeMs) {
- long endTime = System.currentTimeMillis() +timeMs;
- while (System.currentTimeMillis() < endTime) {
- synchronized (this) {
- try {
- wait(endTime - System.currentTimeMillis());
- } catch (Exception e) {
- // Nothing To Do, simple wait
- }
- }
- }
- }
-
- /**
- * Defines available states of the TCP transport
- */
- private enum TCPTransportState {
- /**
- * TCP transport is created. No connection opened
- */
- IDLE,
-
- /**
- * TCP transport is in progress of establishing connection.
- */
- CONNECTING,
-
- /**
- * TCP transport is connected to SmartDeviceLink core
- */
- CONNECTED,
-
- /**
- * TCP transport is in progress of disconnecting
- */
- DISCONNECTING
- }
-
- @Override
- public String getBroadcastComment() {
- return "";
- }
-} // end-class
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
index 17942b49d..dbe7898ef 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
@@ -222,7 +222,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
private void attemptLegacyUsbConnection(UsbAccessory usbAccessory){
if(usbAccessory != null) {
DebugTool.logInfo(TAG, "Attempting to send USB connection intent using legacy method");
- Intent usbAccessoryAttachedIntent = new Intent(USBTransport.ACTION_USB_ACCESSORY_ATTACHED);
+ Intent usbAccessoryAttachedIntent = new Intent(TransportConstants.ACTION_USB_ACCESSORY_ATTACHED);
usbAccessoryAttachedIntent.putExtra(UsbManager.EXTRA_ACCESSORY, usbAccessory);
usbAccessoryAttachedIntent.putExtra(UsbManager.EXTRA_PERMISSION_GRANTED, permissionGranted);
AndroidTools.sendExplicitBroadcast(getApplicationContext(), usbAccessoryAttachedIntent, null);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
deleted file mode 100644
index 0ab2f2fcf..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
+++ /dev/null
@@ -1,915 +0,0 @@
-/*
- * 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.transport;
-
-import android.annotation.SuppressLint;
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.hardware.usb.UsbAccessory;
-import android.hardware.usb.UsbManager;
-import android.os.ParcelFileDescriptor;
-
-import com.smartdevicelink.exception.SdlException;
-import com.smartdevicelink.exception.SdlExceptionCause;
-import com.smartdevicelink.protocol.SdlPacket;
-import com.smartdevicelink.trace.SdlTrace;
-import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
-import com.smartdevicelink.transport.enums.TransportType;
-import com.smartdevicelink.util.DebugTool;
-
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * Class that implements USB transport.
- *
- * A note about USB Accessory protocol. If the device is already in the USB
- * accessory mode, any side (computer or Android) can open connection even if
- * the other side is not connected. Conversely, if one side simply disconnects,
- * the other side will NOT be notified and unblocked from reading data until
- * some data is sent again or the USB is physically disconnected.
- */
-@SuppressLint("NewApi")
-@Deprecated
-public class USBTransport extends SdlTransport {
-
- // Boolean to monitor if the transport is in a disconnecting state
- private boolean _disconnecting = false;
- /**
- * Broadcast action: sent when a USB accessory is attached.
- *
- * UsbManager.EXTRA_ACCESSORY extra contains UsbAccessory object that has
- * been attached.
- */
- public static final String ACTION_USB_ACCESSORY_ATTACHED =
- "com.smartdevicelink.USB_ACCESSORY_ATTACHED";
- /**
- * String tag for logging.
- */
- private static final String TAG = USBTransport.class.getSimpleName();
- /**
- * Key for SdlTrace.
- */
- private static final String SDL_LIB_TRACE_KEY =
- "42baba60-eb57-11df-98cf-0800200c9a66";
- /**
- * Broadcast action: sent when the user has granted access to the USB
- * accessory.
- */
- private static final String ACTION_USB_PERMISSION =
- "com.smartdevicelink.USB_PERMISSION";
- /**
- * Manufacturer name of the accessory we want to connect to. Must be the
- * same as in accessory_filter.xml to work properly.
- */
- private final static String ACCESSORY_MANUFACTURER = "SDL";
- /**
- * Model name of the accessory we want to connect to. Must be the same as
- * in accessory_filter.xml to work properly.
- */
- private final static String ACCESSORY_MODEL = "Core";
- /**
- * Version of the accessory we want to connect to. Must be the same as in
- * accessory_filter.xml to work properly.
- */
- private final static String ACCESSORY_VERSION = "1.0";
- /**
- * Prefix string to indicate debug output.
- */
- private static final String DEBUG_PREFIX = "DEBUG: ";
- /**
- * String to prefix exception output.
- */
- private static final String EXCEPTION_STRING = " Exception String: ";
- /**
- * Broadcast receiver that receives different USB-related intents: USB
- * accessory connected, disconnected, and permission granted.
- */
- private final BroadcastReceiver mUSBReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- logD("USBReceiver Action: " + action);
-
- UsbAccessory accessory =
- intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
- if (accessory != null) {
- if (ACTION_USB_ACCESSORY_ATTACHED.equals(action)) {
- logI("Accessory " + accessory + " attached");
- if (isAccessorySupported(accessory)) {
- connectToAccessory(accessory);
- } else {
- logW("Attached accessory is not supported!");
- }
- } else if (UsbManager.ACTION_USB_ACCESSORY_DETACHED
- .equals(action)) {
- logI("Accessory " + accessory + " detached");
- final String msg = "USB accessory has been detached";
- disconnect(msg, new SdlException(msg,
- SdlExceptionCause.SDL_USB_DETACHED));
- } else if (ACTION_USB_PERMISSION.equals(action)) {
- boolean permissionGranted = intent.getBooleanExtra(
- UsbManager.EXTRA_PERMISSION_GRANTED, false);
- if (permissionGranted) {
- logI("Permission granted for accessory " + accessory);
- openAccessory(accessory);
- } else {
- final String msg =
- "Permission denied for accessory " + accessory;
- logW(msg);
- disconnect(msg, new SdlException(msg,
- SdlExceptionCause.SDL_USB_PERMISSION_DENIED));
- }
- }
- } else {
- logW("Accessory is null");
- }
- }
- };
- /**
- * USB config object.
- */
- private USBTransportConfig mConfig = null;
- /**
- * Current state of transport.
- *
- * Use setter and getter to access it.
- */
- private State mState = State.IDLE;
- /**
- * Current accessory the transport is working with if any.
- */
- private UsbAccessory mAccessory = null;
- /**
- * FileDescriptor that owns the input and output streams. We have to keep
- * it, otherwise it will be garbage collected and the streams will become
- * invalid.
- */
- private ParcelFileDescriptor mParcelFD = null;
- /**
- * Data input stream to read data from USB accessory.
- */
- private InputStream mInputStream = null;
- /**
- * Data output stream to write data to USB accessory.
- */
- private OutputStream mOutputStream = null;
- /**
- * Thread that connects and reads data from USB accessory.
- *
- * @see USBTransportReader
- */
- private Thread mReaderThread = null;
-
- /**
- * Constructs the USBTransport instance.
- *
- * @param usbTransportConfig Config object for the USB transport
- * @param transportListener Listener that gets notified on different
- * transport events
- */
- public USBTransport(USBTransportConfig usbTransportConfig,
- ITransportListener transportListener) {
- super(transportListener);
- this.mConfig = usbTransportConfig;
- registerReciever();
- }
-
- /**
- * Returns the current state of transport.
- *
- * @return Current state of transport
- */
- public State getState() {
- return this.mState;
- }
-
- /**
- * Changes current state of transport.
- *
- * @param state New state
- */
- private void setState(State state) {
- logD("Changing state " + this.mState + " to " + state);
- this.mState = state;
- }
-
- /**
- * Sends the array of bytes over USB.
- *
- * @param packet The packet that is to be written out on the USB transport
- * @return true if the bytes are sent successfully
- */
- @Override
- protected boolean sendBytesOverTransport(SdlPacket packet) {
- byte[] msgBytes = packet.constructPacket();
- logD("SendBytes: array size " + msgBytes.length + ", offset " + 0 +
- ", length " + msgBytes.length);
-
- boolean result = false;
- final State state = getState();
- switch (state) {
- case CONNECTED:
- if (mOutputStream != null) {
- try {
- mOutputStream.write(msgBytes, 0, msgBytes.length);
- result = true;
-
- logI("Bytes successfully sent");
- SdlTrace.logTransportEvent(TAG + ": bytes sent",
- null, InterfaceActivityDirection.Transmit,
- msgBytes, 0, msgBytes.length,
- SDL_LIB_TRACE_KEY);
- } catch (IOException e) {
- final String msg = "Failed to send bytes over USB";
- logW(msg, e);
- disconnect(msg, e);
- }
- } else {
- final String msg =
- "Can't send bytes when output stream is null";
- logW(msg);
- disconnect(msg, null);
- }
- break;
-
- default:
- logW("Can't send bytes from " + state + " state");
- break;
- }
-
- return result;
- }
-
-
- public void registerReciever()
- {
- IntentFilter filter = new IntentFilter();
- filter.addAction(ACTION_USB_ACCESSORY_ATTACHED);
- filter.addAction(UsbManager.ACTION_USB_ACCESSORY_DETACHED);
- filter.addAction(ACTION_USB_PERMISSION);
- filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
- getContext().registerReceiver(mUSBReceiver, filter);
- }
-
- /**
- * Opens a USB connection if not open yet.
- *
- * @throws SdlException
- */
- @Override
- public void openConnection() throws SdlException {
- final State state = getState();
- switch (state) {
- case IDLE:
- synchronized (this) {
- logI("openConnection()");
- setState(State.LISTENING);
- }
-
- logD("Registering receiver");
- try {
- IntentFilter filter = new IntentFilter();
- filter.addAction(ACTION_USB_ACCESSORY_ATTACHED);
- filter.addAction(UsbManager.ACTION_USB_ACCESSORY_DETACHED);
- filter.addAction(ACTION_USB_PERMISSION);
- getContext().registerReceiver(mUSBReceiver, filter);
- initializeAccessory();
- } catch (Exception e) {
- String msg = "Couldn't start opening connection";
- logE(msg, e);
- throw new SdlException(msg, e,
- SdlExceptionCause.SDL_CONNECTION_FAILED);
- }
-
- break;
-
- default:
- logW("openConnection() called from state " + state +
- "; doing nothing");
- break;
- }
- }
-
- /**
- * Closes the USB connection if open.
- */
- @Override
- public void disconnect() {
- disconnect(null, null);
- }
-
- /**
- * Asks the reader thread to stop while it's possible. If it's blocked on
- * read(), there is no way to stop it except for physical USB disconnect.
- */
- //@Override
- public void stopReading() {
- DebugTool.logInfo(TAG, "USBTransport: stop reading requested, doing nothing");
- // TODO - put back stopUSBReading(); @see <a href="https://adc.luxoft.com/jira/browse/SmartDeviceLink-3450">SmartDeviceLink-3450</a>
- }
-
- @SuppressWarnings("unused")
- private void stopUSBReading() {
- final State state = getState();
- switch (state) {
- case CONNECTED:
- logI("Stopping reading");
- synchronized (this) {
- stopReaderThread();
- }
- break;
-
- default:
- logW("Stopping reading called from state " + state +
- "; doing nothing");
- break;
- }
- }
-
- /**
- * Actually asks the reader thread to interrupt.
- */
- private void stopReaderThread() {
- if (mReaderThread != null) {
- logI("Interrupting USB reader");
- mReaderThread.interrupt();
- // don't join() now
- mReaderThread = null;
- } else {
- logD("USB reader is null");
- }
- }
-
- /**
- * Closes the USB connection from inside the transport with some extra info.
- *
- * @param msg Disconnect reason message, if any
- * @param ex Disconnect exception, if any
- */
- private void disconnect(String msg, Exception ex) {
-
- // If already disconnecting, return
- if (_disconnecting) {
- // No need to recursively call
- return;
- }
- _disconnecting = true;
-
- mConfig.setUsbAccessory(null);
-
- final State state = getState();
- switch (state) {
- case LISTENING:
- case CONNECTED:
- synchronized (this) {
- logI("Disconnect from state " + getState() + "; message: " +
- msg + "; exception: " + ex);
- setState(State.IDLE);
-
- SdlTrace.logTransportEvent(TAG + ": disconnect", null,
- InterfaceActivityDirection.None, null, 0,
- SDL_LIB_TRACE_KEY);
-
- stopReaderThread();
-
- if (mAccessory != null) {
- if (mOutputStream != null) {
- try {
- mOutputStream.close();
- mOutputStream = null;
- } catch (IOException e) {
- logW("Can't close output stream", e);
- mOutputStream = null;
- }
- }
- if (mInputStream != null) {
- try {
- mInputStream.close();
- mInputStream = null;
- } catch (IOException e) {
- logW("Can't close input stream", e);
- mInputStream = null;
- }
- }
- if (mParcelFD != null) {
- try {
- mParcelFD.close();
- mParcelFD = null;
- } catch (IOException e) {
- logW("Can't close file descriptor", e);
- mParcelFD = null;
- }
- }
-
- mAccessory = null;
- }
- }
-
- logD("Unregistering receiver");
- try {
- getContext().unregisterReceiver(mUSBReceiver);
- } catch (IllegalArgumentException e) {
- logW("Receiver was already unregistered", e);
- }
-
- String disconnectMsg = (msg == null ? "" : msg);
- if (ex != null) {
- disconnectMsg += ", " + ex.toString();
-
- if(ex instanceof SdlException
- && SdlExceptionCause.SDL_USB_PERMISSION_DENIED.equals(((SdlException)ex).getSdlExceptionCause())){
- //If the USB device disconnected we don't want to cycle the proxy ourselves
- ex = null;
- }
- }
-
- if (ex == null) {
- // This disconnect was not caused by an error, notify the
- // proxy that the transport has been disconnected.
- logI("Disconnect is correct. Handling it");
- handleTransportDisconnected(disconnectMsg);
- } else {
- // This disconnect was caused by an error, notify the proxy
- // that there was a transport error.
- logI("Disconnect is incorrect. Handling it as error");
- handleTransportError(disconnectMsg, ex);
- }
- break;
-
- default:
- logW("Disconnect called from state " + state +
- "; doing nothing");
- break;
- }
- _disconnecting = false;
- }
-
- /**
- * Returns the type of the transport.
- *
- * @return TransportType.USB
- * @see com.smartdevicelink.transport.enums.TransportType
- */
- @Override
- public TransportType getTransportType() {
- return TransportType.USB;
- }
-
- /**
- * Looks for an already connected compatible accessory and connect to it.
- */
- private void initializeAccessory() {
- UsbAccessory acc = mConfig.getUsbAccessory();
-
- if (!mConfig.getQueryUsbAcc() && acc == null){
- logI("Query for accessory is disabled and accessory in config was null.");
- return;
- }
- logI("Looking for connected accessories");
-
- if( acc == null || !isAccessorySupported(acc)){ //Check to see if our config included an accessory and that it is supported. If not, see if there are any other accessories connected.
- UsbManager usbManager = getUsbManager();
- UsbAccessory[] accessories = usbManager.getAccessoryList();
- if (accessories != null) {
- logD("Found total " + accessories.length + " accessories");
- for (UsbAccessory accessory : accessories) {
- if (isAccessorySupported(accessory)) {
- acc = accessory;
- break;
- }
- }
- } else {
- logI("No connected accessories found");
- return;
- }
- }
- connectToAccessory(acc);
- }
-
- /**
- * Checks if the specified connected USB accessory is what we expect.
- *
- * @param accessory Accessory to check
- * @return true if the accessory is right
- */
- public static boolean isAccessorySupported(final UsbAccessory accessory) {
- if (accessory == null) {
- return false;
- }
-
- boolean manufacturerMatches =
- ACCESSORY_MANUFACTURER.equals(accessory.getManufacturer());
- boolean modelMatches = ACCESSORY_MODEL.equals(accessory.getModel());
- boolean versionMatches =
- ACCESSORY_VERSION.equals(accessory.getVersion());
- return manufacturerMatches && modelMatches && versionMatches;
- }
-
- /**
- * Attempts to connect to the specified accessory.
- *
- * If the permission is already granted, opens the accessory. Otherwise,
- * requests permission to use it.
- *
- * @param accessory Accessory to connect to
- */
- private void connectToAccessory(UsbAccessory accessory) {
-
- if (accessory == null) {
- handleTransportError("Can't connect to null accessory", null);
- }
-
- final State state = getState();
- switch (state) {
- case LISTENING:
- UsbManager usbManager = getUsbManager();
- if (usbManager.hasPermission(accessory)) {
- logI("Already have permission to use " + accessory);
- openAccessory(accessory);
- } else {
- logI("Requesting permission to use " + accessory);
-
- PendingIntent permissionIntent = PendingIntent
- .getBroadcast(getContext(), 0,
- new Intent(ACTION_USB_PERMISSION), 0);
- usbManager.requestPermission(accessory, permissionIntent);
- }
-
- break;
-
- default:
- logW("connectToAccessory() called from state " + state +
- "; doing nothing");
- }
- }
-
- /**
- * Returns the UsbManager to use with accessories.
- *
- * @return System UsbManager
- */
- private UsbManager getUsbManager() {
- return (UsbManager) getContext().getSystemService(Context.USB_SERVICE);
- }
-
- /**
- * Opens a connection to the accessory.
- *
- * When this function is called, the permission to use it must have already
- * been granted.
- *
- * @param accessory Accessory to open connection to
- */
- private void openAccessory(UsbAccessory accessory) {
- final State state = getState();
- switch (state) {
- case LISTENING:
- synchronized (this) {
- logI("Opening accessory " + accessory);
- mAccessory = accessory;
-
- mReaderThread = new Thread(new USBTransportReader());
- mReaderThread.setDaemon(true);
- mReaderThread
- .setName(USBTransportReader.class.getSimpleName());
- mReaderThread.start();
-
- // Initialize the SiphonServer
- if (SiphonServer.getSiphonEnabledStatus()) {
- SiphonServer.init();
- }
- }
-
- break;
-
- default:
- logW("openAccessory() called from state " + state +
- "; doing nothing");
- }
- }
-
- /**
- * Logs the string and the throwable with ERROR level.
- *
- * @param s string to log
- * @param tr throwable to log
- */
- private void logE(String s, Throwable tr) {
- DebugTool.logError(TAG, s, tr);
- }
-
- /**
- * Logs the string with WARN level.
- *
- * @param s string to log
- */
- private void logW(String s) {
- DebugTool.logWarning(TAG, s);
- }
-
- /**
- * Logs the string and the throwable with WARN level.
- *
- * @param s string to log
- * @param tr throwable to log
- */
- private void logW(String s, Throwable tr) {
- StringBuilder res = new StringBuilder(s);
- if (tr != null) {
- res.append(EXCEPTION_STRING);
- res.append(tr.toString());
- }
- logW(res.toString());
- }
-
- /**
- * Logs the string with INFO level.
- *
- * @param s string to log
- */
- private void logI(String s) {
- DebugTool.logInfo(TAG, s);
- }
-
- /**
- * Logs the string with DEBUG level.
- *
- * @param s string to log
- */
- private void logD(String s) {
- // DebugTool doesn't support DEBUG level, so we use INFO instead
- DebugTool.logInfo(TAG, DEBUG_PREFIX + s);
- }
-
- /**
- * Returns Context to communicate with the OS.
- *
- * @return current context to be used by the USB transport
- */
- private Context getContext() {
- return mConfig.getUSBContext();
- }
-
- /**
- * Possible states of the USB transport.
- */
- private enum State {
- /**
- * Transport initialized; no connections.
- */
- IDLE,
-
- /**
- * USB accessory not attached; SdlProxy wants connection as soon as
- * accessory is attached.
- */
- LISTENING,
-
- /**
- * USB accessory attached; permission granted; data IO in progress.
- */
- CONNECTED
- }
-
- /**
- * Internal task that connects to and reads data from a USB accessory.
- *
- * Since the class has to have access to the parent class' variables,
- * synchronization must be taken in consideration! For now, all access
- * to variables of USBTransport must be surrounded with
- * synchronized (USBTransport.this) { … }
- */
- private class USBTransportReader implements Runnable {
- /**
- * String tag for logging inside the task.
- */
- private final String TAG = USBTransportReader.class.getSimpleName();
-
- SdlPsm psm;
-
- /**
- * Checks if the thread has been interrupted.
- *
- * @return true if the thread has been interrupted
- */
- private boolean isInterrupted() {
- return Thread.interrupted();
- }
-
- /**
- * Entry function that is called when the task is started. It attempts
- * to connect to the accessory, then starts a read loop until
- * interrupted.
- */
- @Override
- public void run() {
- logD("USB reader started!");
- psm = new SdlPsm();
- psm.reset();
- if (connect()) {
- readFromTransport();
- }
-
- logD("USB reader finished!");
- }
-
- /**
- * Attemps to open connection to USB accessory.
- *
- * @return true if connected successfully
- */
- private boolean connect() {
- if (isInterrupted()) {
- logI("Thread is interrupted, not connecting");
- return false;
- }
-
- final State state = getState();
- switch (state) {
- case LISTENING:
-
- synchronized (USBTransport.this) {
- try {
- mParcelFD =
- getUsbManager().openAccessory(mAccessory);
- } catch (Exception e) {
- final String msg =
- "Have no permission to open the accessory";
- logE(msg, e);
- disconnect(msg, e);
- return false;
- }
- if (mParcelFD == null) {
- if (isInterrupted()) {
- logW("Can't open accessory, and thread is interrupted");
- } else {
- logW("Can't open accessory, disconnecting!");
- String msg = "Failed to open USB accessory";
- disconnect(msg, new SdlException(msg,
- SdlExceptionCause.SDL_CONNECTION_FAILED));
- }
- return false;
- }
- FileDescriptor fd = mParcelFD.getFileDescriptor();
- mInputStream = new FileInputStream(fd);
- mOutputStream = new FileOutputStream(fd);
- }
-
- logI("Accessory opened!");
-
- synchronized (USBTransport.this) {
- setState(State.CONNECTED);
- handleTransportConnected();
- }
- break;
-
- default:
- logW("connect() called from state " + state +
- ", will not try to connect");
- return false;
- }
-
- return true;
- }
-
- /**
- * Continuously reads data from the transport's input stream, blocking
- * when no data is available.
- */
- private void readFromTransport() {
- final int READ_BUFFER_SIZE = 4096;
- byte[] buffer = new byte[READ_BUFFER_SIZE];
- int bytesRead;
- // byte input;
- boolean stateProgress = false;
-
- // read loop
- while (!isInterrupted()) {
- try {
- if (mInputStream == null)
- continue;
-
- bytesRead = mInputStream.read(buffer);
- if (bytesRead == -1) {
- if (isInterrupted()) {
- logI("EOF reached, and thread is interrupted");
- } else {
- logI("EOF reached, disconnecting!");
- disconnect("EOF reached", null);
- }
- return;
- }
- } catch (IOException e) {
- if (isInterrupted()) {
- logW("Can't read data, and thread is interrupted", e);
- } else {
- logW("Can't read data, disconnecting!", e);
- disconnect("Can't read data from USB", e);
- }
- return;
- }
-
- logD("Read " + bytesRead + " bytes");
- //FIXME SdlTrace.logTransportEvent(TAG + ": read bytes", null,
- // InterfaceActivityDirection.Receive, buffer, bytesRead,
- // SDL_LIB_TRACE_KEY);
-
- if (isInterrupted()) {
- logI("Read some data, but thread is interrupted");
- return;
- }
- byte input;
- for(int i=0;i<bytesRead; i++){
- input=buffer[i];
- stateProgress = psm.handleByte(input);
- if(!stateProgress){//We are trying to weed through the bad packet info until we get something
- //Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
- psm.reset();
- buffer = new byte[READ_BUFFER_SIZE];
- }
-
- if(psm.getState() == SdlPsm.FINISHED_STATE){
- synchronized (USBTransport.this) {
- //Log.d(TAG, "Packet formed, sending off");
- handleReceivedPacket((SdlPacket)psm.getFormedPacket());
- }
- //We put a trace statement in the message read so we can avoid all the extra bytes
- psm.reset();
- buffer = new byte[READ_BUFFER_SIZE]; //FIXME just do an array copy and send off
-
- }
- }
- }
- }
-
- // Log functions
-
- private void logD(String s) {
- DebugTool.logInfo(TAG, DEBUG_PREFIX + s);
- }
-
- private void logI(String s) {
- DebugTool.logInfo(TAG, s);
- }
-
- private void logW(String s) {
- DebugTool.logWarning(TAG, s);
- }
-
- private void logW(String s, Throwable tr) {
- StringBuilder res = new StringBuilder(s);
- if (tr != null) {
- res.append(EXCEPTION_STRING);
- res.append(tr.toString());
- }
- logW(res.toString());
- }
-
- private void logE(String s, Throwable tr) {
- DebugTool.logError(TAG, s, tr);
- }
- }
-
- @Override
- public String getBroadcastComment() {
- // TODO Auto-generated method stub
- return null;
- }
-}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransportConfig.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransportConfig.java
deleted file mode 100644
index 9aeb1a33a..000000000
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransportConfig.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.transport;
-
-import android.content.Context;
-import android.hardware.usb.UsbAccessory;
-
-import com.smartdevicelink.transport.enums.TransportType;
-
-/**
- * <b>NOTE: </b> This should no longer be used. See the MultplexTransportConfig and guides to
- * understand how to implement USB multiplexing. This class and method of USB connection will be
- * removed in the next major release. If a router service is available to handle multiplexing of the
- * usb transport it will be used, and this app will connect to whatever router service hosts the USB
- * connection.
- * @see MultiplexTransportConfig
- */
-@Deprecated
-public class USBTransportConfig extends BaseTransportConfig {
-
- private Context mainActivity = null;
- private UsbAccessory usbAccessory = null;
- private Boolean queryUsbAcc = true;
-
- /**
- * <b>NOTE: </b> This should no longer be used. See the MultplexTransportConfig and guides to
- * understand how to implement USB multiplexing. This class and method of USB connection will be
- * removed in the next major release. If a router service is available to handle multiplexing of the
- * usb transport it will be used, and this app will connect to whatever router service hosts the USB
- * connection.
- * @param mainActivity context used to start USB transport
- * @see MultiplexTransportConfig
- */
- public USBTransportConfig (Context mainActivity) {
- this.mainActivity = mainActivity;
- }
-
- /**
- * <b>NOTE: </b> This should no longer be used. See the MultplexTransportConfig and guides to
- * understand how to implement USB multiplexing. This class and method of USB connection will be
- * removed in the next major release. If a router service is available to handle multiplexing of the
- * usb transport it will be used, and this app will connect to whatever router service hosts the USB
- * connection.
- * @param mainActivity context used to start USB transport
- * @param usbAccessory the accessory that was given to this app
- * @see MultiplexTransportConfig
- */
- public USBTransportConfig (Context mainActivity, UsbAccessory usbAccessory) {
- this.mainActivity = mainActivity;
- this.usbAccessory = usbAccessory;
- }
-
- /**
- * <b>NOTE: </b> This should no longer be used. See the MultplexTransportConfig and guides to
- * understand how to implement USB multiplexing. This class and method of USB connection will be
- * removed in the next major release. If a router service is available to handle multiplexing of the
- * usb transport it will be used, and this app will connect to whatever router service hosts the USB
- * connection.
- * @param mainActivity context used to start USB transport
- * @param shareConnection enable other sessions on this app to use this USB connection
- * @param queryUsbAcc attempt to query the USB accessory if none is provided
- * @see MultiplexTransportConfig
- */
- public USBTransportConfig (Context mainActivity, boolean shareConnection, boolean queryUsbAcc) {
- this.mainActivity = mainActivity;
- this.queryUsbAcc = queryUsbAcc;
- super.shareConnection = shareConnection;
- }
-
- /**
- * <b>NOTE: </b> This should no longer be used. See the MultplexTransportConfig and guides to
- * understand how to implement USB multiplexing. This class and method of USB connection will be
- * removed in the next major release. If a router service is available to handle multiplexing of the
- * usb transport it will be used, and this app will connect to whatever router service hosts the USB
- * connection.
- * @param mainActivity context used to start USB transport
- * @param usbAccessory the accessory that was given to this app
- * @param shareConnection enable other sessions on this app to use this USB connection
- * @param queryUsbAcc attempt to query the USB accessory if none is provided
- * @see MultiplexTransportConfig
- */
- public USBTransportConfig (Context mainActivity, UsbAccessory usbAccessory, boolean shareConnection, boolean queryUsbAcc) {
- this.mainActivity = mainActivity;
- this.queryUsbAcc = queryUsbAcc;
- this.usbAccessory = usbAccessory;
- super.shareConnection = shareConnection;
- }
-
- public Boolean getQueryUsbAcc () {
- return queryUsbAcc;
- }
-
- public Context getUSBContext () {
- return mainActivity;
- }
-
- public UsbAccessory getUsbAccessory () {
- return usbAccessory;
- }
-
- public void setUsbAccessory (UsbAccessory value) { usbAccessory = value; }
-
- public TransportType getTransportType() {
- return TransportType.USB;
- }
-} \ No newline at end of file
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 80daf4d2e..6d05b93eb 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
@@ -78,6 +78,7 @@ abstract class BaseScreenManager extends BaseSubManager {
// Sub manager listener
private final CompletionListener subManagerListener = new CompletionListener() {
+
@Override
public synchronized void onComplete(boolean success) {
if (softButtonManager != null && textAndGraphicManager != null && voiceCommandManager != null && menuManager != null && choiceSetManager != null && subscribeButtonManager != null) {
@@ -248,6 +249,9 @@ abstract class BaseScreenManager extends BaseSubManager {
* @return an SdlArtwork object represents the current primaryGraphic
*/
public SdlArtwork getPrimaryGraphic() {
+ if (this.textAndGraphicManager.getPrimaryGraphic() == null || textAndGraphicManager.getPrimaryGraphic().getName() == null || this.textAndGraphicManager.getPrimaryGraphic().getName().equals(textAndGraphicManager.getBlankArtwork().getName())) {
+ return null;
+ }
return this.textAndGraphicManager.getPrimaryGraphic();
}
@@ -267,6 +271,9 @@ abstract class BaseScreenManager extends BaseSubManager {
* @return an SdlArtwork object represents the current secondaryGraphic
*/
public SdlArtwork getSecondaryGraphic() {
+ if (this.textAndGraphicManager.getSecondaryGraphic() == null || textAndGraphicManager.getSecondaryGraphic().getName() == null || this.textAndGraphicManager.getSecondaryGraphic().getName().equals(textAndGraphicManager.getBlankArtwork().getName())) {
+ return null;
+ }
return this.textAndGraphicManager.getSecondaryGraphic();
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
index ad43b5526..9c756e758 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Livio, Inc.
+ * Copyright (c) 2019 - 2020 Livio, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,61 +33,51 @@ package com.smartdevicelink.managers.screen;
import androidx.annotation.NonNull;
+import com.livio.taskmaster.Queue;
+import com.livio.taskmaster.Task;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
-import com.smartdevicelink.managers.ManagerUtility;
import com.smartdevicelink.managers.file.FileManager;
-import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
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.DisplayCapability;
-import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
-import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
-import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
-import com.smartdevicelink.util.CompareUtils;
import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import static com.smartdevicelink.proxy.rpc.enums.TextAlignment.CENTERED;
/**
* <strong>TextAndGraphicManager</strong> <br>
- *
+ * <p>
* Note: This class must be accessed through the SdlManager. Do not instantiate it by itself. <br>
- *
*/
abstract class BaseTextAndGraphicManager extends BaseSubManager {
private static final String TAG = "TextAndGraphicManager";
- boolean isDirty, hasQueuedUpdate;
- volatile Show inProgressUpdate;
- Show currentScreenData, queuedImageUpdate;
+ boolean isDirty;
+ Show currentScreenData;
HMILevel currentHMILevel;
+ private final WeakReference<SoftButtonManager> softButtonManager;
WindowCapability defaultMainWindowCapability;
- private boolean pendingHMIFull, batchingUpdates;
+ private boolean batchingUpdates;
private final WeakReference<FileManager> fileManager;
- private final WeakReference<SoftButtonManager> softButtonManager;
- private CompletionListener queuedUpdateListener, inProgressListener, pendingHMIListener;
SdlArtwork blankArtwork;
private OnRPCNotificationListener hmiListener;
private OnSystemCapabilityListener onDisplaysCapabilityListener;
@@ -95,6 +85,9 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
private TextAlignment textAlignment;
private String textField1, textField2, textField3, textField4, mediaTrackTextField, title;
private MetadataType textField1Type, textField2Type, textField3Type, textField4Type;
+ TextAndGraphicUpdateOperation updateOperation;
+ private CompletionListener currentOperationListener;
+ Queue transactionQueue;
//Constructors
@@ -105,12 +98,11 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
this.softButtonManager = new WeakReference<>(softButtonManager);
batchingUpdates = false;
isDirty = false;
- pendingHMIFull = false;
textAlignment = CENTERED;
currentHMILevel = HMILevel.HMI_NONE;
currentScreenData = new Show();
+ this.transactionQueue = newTransactionQueue();
addListeners();
- getBlankArtwork();
}
@Override
@@ -120,8 +112,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
}
@Override
- public void dispose(){
-
+ public void dispose() {
textField1 = null;
textField1Type = null;
textField2 = null;
@@ -137,15 +128,15 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
secondaryGraphic = null;
blankArtwork = null;
defaultMainWindowCapability = null;
- inProgressUpdate = null;
- queuedImageUpdate = null;
currentScreenData = null;
- queuedUpdateListener = null;
- pendingHMIListener = null;
- inProgressListener = null;
- hasQueuedUpdate = false;
isDirty = false;
- pendingHMIFull = false;
+ updateOperation = null;
+
+ // Cancel the operations
+ if (transactionQueue != null) {
+ transactionQueue.close();
+ transactionQueue = null;
+ }
// remove listeners
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
@@ -154,66 +145,32 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
super.dispose();
}
- private void addListeners() {
- // add listener
- hmiListener = new OnRPCNotificationListener() {
- @Override
- public void onNotified(RPCNotification notification) {
- OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
- if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
- return;
- }
- currentHMILevel = onHMIStatus.getHmiLevel();
- if (currentHMILevel == HMILevel.HMI_FULL){
- if (pendingHMIFull){
- DebugTool.logInfo(TAG, "Acquired HMI_FULL with pending update. Sending now");
- pendingHMIFull = false;
- sdlUpdate(pendingHMIListener);
- pendingHMIListener = null;
- }
- }
- }
- };
- internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
-
-
- onDisplaysCapabilityListener = new OnSystemCapabilityListener() {
- @Override
- public void onCapabilityRetrieved(Object capability) {
- // instead of using the parameter it's more safe to use the convenience method
- List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
- if (capabilities == null || capabilities.size() == 0) {
- DebugTool.logError(TAG, "TextAndGraphic Manager - Capabilities sent here are null or empty");
- }else {
- DisplayCapability display = capabilities.get(0);
- for (WindowCapability windowCapability : display.getWindowCapabilities()) {
- int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
- if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
- defaultMainWindowCapability = windowCapability;
- }
- }
- }
- }
+ private Queue newTransactionQueue() {
+ Queue queue = internalInterface.getTaskmaster().createQueue("TextAndGraphicManager", 3, false);
+ queue.pause();
+ return queue;
+ }
- @Override
- public void onError(String info) {
- DebugTool.logError(TAG, "Display Capability cannot be retrieved");
- defaultMainWindowCapability = null;
- }
- };
- this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
+ // Suspend the queue if the WindowCapabilities are null
+ // OR if the HMI level is NONE since we want to delay sending RPCs until we're in non-NONE
+ private void updateTransactionQueueSuspended() {
+ if (defaultMainWindowCapability == null || HMILevel.HMI_NONE.equals(currentHMILevel)) {
+ DebugTool.logInfo(TAG, String.format("Suspending the transaction queue. Current HMI level is NONE: %b, window capabilities are null: %b", HMILevel.HMI_NONE.equals(currentHMILevel), defaultMainWindowCapability == null));
+ transactionQueue.pause();
+ } else {
+ DebugTool.logInfo(TAG, "Starting the transaction queue");
+ transactionQueue.resume();
+ }
}
// Upload / Send
protected void update(CompletionListener listener) {
-
// check if is batch update
if (batchingUpdates) {
return;
}
-
- if (isDirty){
+ if (isDirty) {
isDirty = false;
sdlUpdate(listener);
} else if (listener != null) {
@@ -221,754 +178,330 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
}
}
- private synchronized void sdlUpdate(CompletionListener listener){
-
- // make sure hmi is not none
- if (currentHMILevel == null || currentHMILevel == HMILevel.HMI_NONE){
- //Trying to send show on HMI_NONE, waiting for full
- pendingHMIFull = true;
- if (listener != null){
- pendingHMIListener = listener;
- }
- return;
- }
-
- //Updating Text and Graphics
- if (inProgressUpdate != null){
-
- //In progress update exists, queueing update
- if (queuedUpdateListener != null){
-
- //Queued update already exists, superseding previous queued update
- queuedUpdateListener.onComplete(false);
- queuedUpdateListener = null;
- }
-
- if (listener != null){
- queuedUpdateListener = listener;
- }
-
- hasQueuedUpdate = true;
-
- return;
- }
-
- Show fullShow = new Show();
- fullShow.setAlignment(textAlignment);
- fullShow = assembleShowText(fullShow);
- fullShow = assembleShowImages(fullShow);
-
- inProgressListener = listener;
-
- if (!shouldUpdatePrimaryImage() && !shouldUpdateSecondaryImage()){
-
- //No Images to send, only sending text
- inProgressUpdate = extractTextFromShow(fullShow);
- sendShow();
-
- }else if (!sdlArtworkNeedsUpload(primaryGraphic) && (secondaryGraphic == blankArtwork || !sdlArtworkNeedsUpload(secondaryGraphic))){
-
- //Images already uploaded, sending full update
- // The files to be updated are already uploaded, send the full show immediately
- inProgressUpdate = fullShow;
- sendShow();
- } else{
-
- // Images need to be uploaded, sending text and uploading images
- inProgressUpdate = fullShow;
- final Show thisUpdate = fullShow;
-
- uploadImages(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- if (!success){
- DebugTool.logError(TAG, "Error uploading image");
- inProgressUpdate = extractTextFromShow(inProgressUpdate);
- sendShow();
- }
- // Check if queued image update still matches our images (there could have been a new Show in the meantime)
- // and send a new update if it does. Since the images will already be on the head unit, the whole show will be sent
- if (thisUpdate.getGraphic() != null && thisUpdate.getGraphic().equals(queuedImageUpdate.getGraphic()) ||
- (thisUpdate.getSecondaryGraphic() != null && queuedImageUpdate.getSecondaryGraphic() != null) && thisUpdate.getSecondaryGraphic().equals(queuedImageUpdate.getSecondaryGraphic())){
- // Queued image update matches the images we need, sending update
- sendShow();
- }
- // Else, Queued image update does not match the images we need, skipping update
- }
- });
- queuedImageUpdate = fullShow;
- }
- }
-
- private void sendShow(){
- inProgressUpdate.setOnRPCResponseListener(new OnRPCResponseListener() {
- @Override
- public void onResponse(int correlationId, RPCResponse response) {
- handleResponse(response.getSuccess());
- }
-
- private void handleResponse(boolean success){
- if (success){
- updateCurrentScreenDataState(inProgressUpdate);
- }
-
- inProgressUpdate = null;
- if (inProgressListener != null){
- inProgressListener.onComplete(success);
- inProgressListener = null;
- }
-
- if (hasQueuedUpdate){
- //Queued update exists, sending another update
- hasQueuedUpdate = false;
- CompletionListener temp = queuedUpdateListener;
- queuedUpdateListener = null;
- sdlUpdate(temp);
- }
- }
- });
-
- if (this.softButtonManager.get() != null) {
- this.softButtonManager.get().setCurrentMainField1(inProgressUpdate.getMainField1());
- }
- internalInterface.sendRPC(inProgressUpdate);
- }
-
- // Images
-
- private void uploadImages(final CompletionListener listener) {
-
- List<SdlArtwork> artworksToUpload = new ArrayList<>();
-
- // add primary image
- if (shouldUpdatePrimaryImage() && !primaryGraphic.isStaticIcon()){
- artworksToUpload.add(primaryGraphic);
- }
-
- // add secondary image
- if (shouldUpdateSecondaryImage() && !secondaryGraphic.isStaticIcon()){
- artworksToUpload.add(secondaryGraphic);
- }
-
- if (artworksToUpload.size() == 0 && (primaryGraphic.isStaticIcon() || secondaryGraphic.isStaticIcon())){
- DebugTool.logInfo(TAG, "Upload attempted on static icons, sending them without upload instead");
- listener.onComplete(true);
- }
-
- // use file manager to upload art
- if (fileManager.get() != null) {
- fileManager.get().uploadArtworks(artworksToUpload, new MultipleFileCompletionListener() {
- @Override
- public void onComplete(Map<String, String> errors) {
- if (errors != null) {
- DebugTool.logError(TAG, "Error Uploading Artworks. Error: " + errors.toString());
- listener.onComplete(false);
- } else {
- listener.onComplete(true);
- }
- }
- });
- }
- }
-
- private Show assembleShowImages(Show show){
-
- if (shouldUpdatePrimaryImage()){
- show.setGraphic(primaryGraphic.getImageRPC());
- }
-
- if (shouldUpdateSecondaryImage()){
- show.setSecondaryGraphic(secondaryGraphic.getImageRPC());
- }
-
- return show;
- }
-
- // Text
-
- Show assembleShowText(Show show){
-
- show = setBlankTextFields(show);
-
- if (mediaTrackTextField != null && shouldUpdateMediaTrackField()) {
- show.setMediaTrack(mediaTrackTextField);
- }
-
- if (title != null && shouldUpdateTitleField()) {
- show.setTemplateTitle(title);
- }
-
- List<String> nonNullFields = findValidMainTextFields();
- if (nonNullFields.isEmpty()){
- return show;
- }
-
- int numberOfLines = defaultMainWindowCapability != null ? ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(defaultMainWindowCapability) : 4;
-
- switch (numberOfLines) {
- case 1: show = assembleOneLineShowText(show, nonNullFields);
- break;
- case 2: show = assembleTwoLineShowText(show);
- break;
- case 3: show = assembleThreeLineShowText(show);
- break;
- case 4: show = assembleFourLineShowText(show);
- break;
- }
-
- return show;
- }
-
- private Show assembleOneLineShowText(Show show, List<String> showFields){
-
- StringBuilder showString1 = new StringBuilder();
- for (int i = 0; i < showFields.size(); i++) {
- if (i > 0) {
- showString1.append(" - ").append(showFields.get(i));
- }else{
- showString1.append(showFields.get(i));
- }
- }
- show.setMainField1(showString1.toString());
-
- MetadataTags tags = new MetadataTags();
- tags.setMainField1(findNonNullMetadataFields());
-
- show.setMetadataTags(tags);
-
- return show;
- }
-
- private Show assembleTwoLineShowText(Show show){
-
- StringBuilder tempString = new StringBuilder();
- MetadataTags tags = new MetadataTags();
-
- if (textField1 != null && textField1.length() > 0) {
- tempString.append(textField1);
- if (textField1Type != null){
- tags.setMainField1(textField1Type);
+ private synchronized void sdlUpdate(final CompletionListener listener) {
+ if (this.transactionQueue.getTasksAsList().size() > 0) {
+ // Transactions already in queue, we need to clear it out
+ transactionQueue.clear();
+ updateOperation = null;
+ if (currentOperationListener != null) {
+ currentOperationListener.onComplete(false);
}
}
- if (textField2 != null && textField2.length() > 0) {
- if (( textField3 == null || !(textField3.length() > 0)) && (textField4 == null || !(textField4.length() > 0))){
- // text does not exist in slots 3 or 4, put text2 in slot 2
- show.setMainField2(textField2);
- if (textField2Type != null){
- tags.setMainField2(textField2Type);
- }
- } else if (textField1 != null && textField1.length() > 0) {
- // If text 1 exists, put it in slot 1 formatted
- tempString.append(" - ").append(textField2);
- if (textField2Type != null){
- List<MetadataType> typeList = new ArrayList<>();
- typeList.add(textField2Type);
- if (textField1Type != null){
- typeList.add(textField1Type);
- }
- tags.setMainField1(typeList);
- }
- }else {
- // If text 1 does not exist, put it in slot 1 unformatted
- tempString.append(textField2);
- if (textField2Type != null){
- tags.setMainField1(textField2Type);
- }
+ // Task can be READY, about to start and popped of the queue, so we have to cancel it, to prevent it from starting
+ if (updateOperation != null && updateOperation.getState() == Task.READY) {
+ updateOperation.cancelTask();
+ if (currentOperationListener != null) {
+ currentOperationListener.onComplete(false);
}
}
- // set mainfield 1
- show.setMainField1(tempString.toString());
-
- // new stringbuilder object
- tempString = new StringBuilder();
-
- if (textField3 != null && textField3.length() > 0){
- // If text 3 exists, put it in slot 2
- tempString.append(textField3);
- if (textField3Type != null){
- List<MetadataType> typeList = new ArrayList<>();
- typeList.add(textField3Type);
- tags.setMainField2(typeList);
- }
+ // If Task is IN_PROGRESS, it’s not on the queue, we need to mark it as cancelled. The task will return at some point when it checks its status and call the listener back
+ if (updateOperation != null && updateOperation.getState() == Task.IN_PROGRESS) {
+ updateOperation.cancelTask();
}
- if (textField4 != null && textField4.length() > 0){
- if (textField3 != null && textField3.length() > 0){
- // If text 3 exists, put it in slot 2 formatted
- tempString.append(" - ").append(textField4);
- if (textField4Type != null){
- List<MetadataType> typeList = new ArrayList<>();
- typeList.add(textField4Type);
- if (textField3Type != null){
- typeList.add(textField3Type);
- }
- tags.setMainField2(typeList);
- }
- } else {
- // If text 3 does not exist, put it in slot 3 unformatted
- tempString.append(textField4);
- if (textField4Type != null){
- tags.setMainField2(textField4Type);
- }
- }
- }
+ currentOperationListener = listener;
- if (tempString.toString().length() > 0){
- show.setMainField2(tempString.toString());
- }
-
- show.setMetadataTags(tags);
- return show;
- }
-
- private Show assembleThreeLineShowText(Show show){
-
- MetadataTags tags = new MetadataTags();
-
- if (textField1 != null && textField1.length() > 0) {
- show.setMainField1(textField1);
- if (textField1Type != null){
- tags.setMainField1(textField1Type);
- }
- }
-
- if (textField2 != null && textField2.length() > 0) {
- show.setMainField2(textField2);
- if (textField2Type != null){
- tags.setMainField2(textField2Type);
- }
- }
-
- StringBuilder tempString = new StringBuilder();
-
- if (textField3 != null && textField3.length() > 0){
- tempString.append(textField3);
- if (textField3Type != null){
- tags.setMainField3(textField3Type);
- }
- }
-
- if (textField4 != null && textField4.length() > 0) {
- if (textField3 != null && textField3.length() > 0) {
- // If text 3 exists, put it in slot 3 formatted
- tempString.append(" - ").append(textField4);
- if (textField4Type != null){
- List<MetadataType> tags4 = new ArrayList<>();
- if (textField3Type != null){
- tags4.add(textField3Type);
- }
- tags4.add(textField4Type);
- tags.setMainField3(tags4);
- }
- } else {
- // If text 3 does not exist, put it in slot 3 formatted
- tempString.append(textField4);
- if (textField4Type != null){
- tags.setMainField3(textField4Type);
- }
+ CurrentScreenDataUpdatedListener currentScreenDataUpdateListener = new CurrentScreenDataUpdatedListener() {
+ @Override
+ public void onUpdate(Show show) {
+ updatePendingOperationsWithNewScreenData(show);
+ currentScreenData = show;
}
- }
+ };
- show.setMainField3(tempString.toString());
- show.setMetadataTags(tags);
- return show;
+ updateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager.get(), defaultMainWindowCapability, currentScreenData, currentState(), currentOperationListener, currentScreenDataUpdateListener);
+ transactionQueue.add(updateOperation, false);
}
- private Show assembleFourLineShowText(Show show){
-
- MetadataTags tags = new MetadataTags();
-
- if (textField1 != null && textField1.length() > 0) {
- show.setMainField1(textField1);
- if (textField1Type != null){
- tags.setMainField1(textField1Type);
+ //Updates pending task with current screen data
+ void updatePendingOperationsWithNewScreenData(Show newScreenData) {
+ for (Task task : transactionQueue.getTasksAsList()) {
+ if (!(task instanceof TextAndGraphicUpdateOperation)) {
+ continue;
}
+ ((TextAndGraphicUpdateOperation) task).setCurrentScreenData(newScreenData);
}
-
- if (textField2 != null && textField2.length() > 0) {
- show.setMainField2(textField2);
- if (textField2Type != null){
- tags.setMainField2(textField2Type);
- }
+ if (this.softButtonManager.get() != null && newScreenData.getMainField1() != null) {
+ this.softButtonManager.get().setCurrentMainField1(currentScreenData.getMainField1());
}
-
- if (textField3 != null && textField3.length() > 0) {
- show.setMainField3(textField3);
- if (textField3Type != null){
- tags.setMainField3(textField3Type);
- }
- }
-
- if (textField4 != null && textField4.length() > 0) {
- show.setMainField4(textField4);
- if (textField4Type != null){
- tags.setMainField4(textField4Type);
- }
- }
-
- show.setMetadataTags(tags);
- return show;
}
- // Extraction
-
- Show extractTextFromShow(Show show){
-
- Show newShow = new Show();
- newShow.setMainField1(show.getMainField1());
- newShow.setMainField2(show.getMainField2());
- newShow.setMainField3(show.getMainField3());
- newShow.setMainField4(show.getMainField4());
- newShow.setTemplateTitle(show.getTemplateTitle());
-
- return newShow;
- }
-
- private Show setBlankTextFields(Show newShow){
-
- newShow.setMainField1("");
- newShow.setMainField2("");
- newShow.setMainField3("");
- newShow.setMainField4("");
- newShow.setMediaTrack("");
- newShow.setTemplateTitle("");
-
- return newShow;
- }
-
- private void updateCurrentScreenDataState(Show show){
-
- if (show == null){
- DebugTool.logError(TAG, "can not updateCurrentScreenDataFromShow from null show");
- return;
- }
-
- // If the items are null, they were not updated, so we can't just set it directly
- if (show.getMainField1() != null){
- currentScreenData.setMainField1(show.getMainField1());
- }
- if (show.getMainField2() != null){
- currentScreenData.setMainField2(show.getMainField2());
- }
- if (show.getMainField3() != null){
- currentScreenData.setMainField3(show.getMainField3());
- }
- if (show.getMainField4() != null){
- currentScreenData.setMainField4(show.getMainField4());
- }
- if (show.getTemplateTitle() != null){
- currentScreenData.setTemplateTitle(show.getTemplateTitle());
- }
- if (show.getMediaTrack() != null){
- currentScreenData.setMediaTrack(show.getMediaTrack());
- }
- if (show.getMetadataTags() != null){
- currentScreenData.setMetadataTags(show.getMetadataTags());
- }
- if (show.getAlignment() != null){
- currentScreenData.setAlignment(show.getAlignment());
- }
- if (show.getGraphic() != null){
- currentScreenData.setGraphic(show.getGraphic());
- }
- if (show.getSecondaryGraphic() != null){
- currentScreenData.setSecondaryGraphic(show.getSecondaryGraphic());
- }
+ interface CurrentScreenDataUpdatedListener {
+ void onUpdate(Show show);
}
- // Helpers
- private List<String> findValidMainTextFields(){
+ private List<String> findNonNullTextFields() {
List<String> array = new ArrayList<>();
- if (textField1 != null && textField1.length() > 0) {
+ if (textField1 != null) {
array.add(textField1);
}
- if (textField2 != null && textField2.length() > 0) {
+ if (textField2 != null) {
array.add(textField2);
}
- if (textField3 != null && textField3.length() > 0) {
+ if (textField3 != null) {
array.add(textField3);
}
- if (textField4 != null && textField4.length() > 0) {
+ if (textField4 != null) {
array.add(textField4);
}
- return array;
- }
-
-
- private List<MetadataType> findNonNullMetadataFields(){
- List<MetadataType> array = new ArrayList<>();
-
- if (textField1Type != null) {
- array.add(textField1Type);
- }
-
- if (textField2Type != null) {
- array.add(textField2Type);
+ if (title != null) {
+ array.add(title);
}
- if (textField3Type != null) {
- array.add(textField3Type);
- }
-
- if (textField4Type != null) {
- array.add(textField4Type);
+ if (mediaTrackTextField != null) {
+ array.add(mediaTrackTextField);
}
return array;
}
- abstract SdlArtwork getBlankArtwork();
+ Boolean hasData() {
+ boolean hasTextFields = (findNonNullTextFields().size() > 0);
+ boolean hasImageFields = (primaryGraphic != null) || (secondaryGraphic != null);
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- private boolean sdlArtworkNeedsUpload(SdlArtwork artwork){
- if (fileManager.get() != null) {
- return artwork != null && !fileManager.get().hasUploadedFile(artwork) && !artwork.isStaticIcon();
- }
- return false;
+ return hasTextFields || hasImageFields;
}
- /**
- * Check to see if primaryGraphic should be updated
- * @return true if primaryGraphic should be updated, false if not
- */
- private boolean shouldUpdatePrimaryImage() {
- boolean templateSupportsPrimaryArtwork = templateSupportsImageField(ImageFieldName.graphic);
-
- String currentScreenDataPrimaryGraphicName = (currentScreenData != null && currentScreenData.getGraphic() != null) ? currentScreenData.getGraphic().getValue() : null;
- String primaryGraphicName = primaryGraphic != null ? primaryGraphic.getName() : null;
- return templateSupportsPrimaryArtwork
- && !CompareUtils.areStringsEqual(currentScreenDataPrimaryGraphicName, primaryGraphicName, true, true)
- && primaryGraphic != null;
- }
-
- /**
- * Check to see if secondaryGraphic should be updated
- * @return true if secondaryGraphic should be updated, false if not
- */
- private boolean shouldUpdateSecondaryImage() {
- boolean templateSupportsSecondaryArtwork = (templateSupportsImageField(ImageFieldName.graphic) || templateSupportsImageField(ImageFieldName.secondaryGraphic));
-
- String currentScreenDataSecondaryGraphicName = (currentScreenData != null && currentScreenData.getSecondaryGraphic() != null) ? currentScreenData.getSecondaryGraphic().getValue() : null;
- String secondaryGraphicName = secondaryGraphic != null ? secondaryGraphic.getName() : null;
- return templateSupportsSecondaryArtwork
- && !CompareUtils.areStringsEqual(currentScreenDataSecondaryGraphicName, secondaryGraphicName, true, true)
- && secondaryGraphic != null;
- }
-
- /**
- * Check to see if template supports the specified image field
- * @return true if image field is supported, false if not
- */
- private boolean templateSupportsImageField(ImageFieldName name) {
- return defaultMainWindowCapability == null || ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(defaultMainWindowCapability, name);
- }
+ abstract SdlArtwork getBlankArtwork();
- /**
- * Check to see if mediaTrackTextField should be updated
- * @return true if mediaTrackTextField should be updated, false if not
- */
- private boolean shouldUpdateMediaTrackField() {
- return templateSupportsTextField(TextFieldName.mediaTrack);
- }
- /**
- * Check to see if title should be updated
- * @return true if title should be updated, false if not
- */
- private boolean shouldUpdateTitleField() {
- return templateSupportsTextField(TextFieldName.templateTitle);
- }
+ // Convert to State
- /**
- * Check to see if field should be updated
- * @return true if field should be updated, false if not
- */
- private boolean templateSupportsTextField(TextFieldName name) {
- return defaultMainWindowCapability == null || ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(defaultMainWindowCapability, name);
+ private TextsAndGraphicsState currentState() {
+ return new TextsAndGraphicsState(textField1, textField2, textField3, textField4, mediaTrackTextField,
+ title, primaryGraphic, secondaryGraphic, textAlignment, textField1Type, textField2Type, textField3Type, textField4Type);
}
- // SCREEN ITEM SETTERS AND GETTERS
+ // Getters / Setters
- void setTextAlignment(TextAlignment textAlignment){
+ void setTextAlignment(TextAlignment textAlignment) {
this.textAlignment = textAlignment;
// If we aren't batching, send the update immediately, if we are, set ourselves as dirty (so we know we should send an update after the batch ends)
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- TextAlignment getTextAlignment(){
+ TextAlignment getTextAlignment() {
return textAlignment;
}
- void setMediaTrackTextField(String mediaTrackTextField){
+ void setMediaTrackTextField(String mediaTrackTextField) {
this.mediaTrackTextField = mediaTrackTextField;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- String getMediaTrackTextField(){
+ String getMediaTrackTextField() {
return mediaTrackTextField;
}
- void setTextField1(String textField1){
+ void setTextField1(String textField1) {
this.textField1 = textField1;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- String getTextField1(){
+ String getTextField1() {
return textField1;
}
- void setTextField2(String textField2){
+ void setTextField2(String textField2) {
this.textField2 = textField2;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- String getTextField2(){
+ String getTextField2() {
return textField2;
}
- void setTextField3(String textField3){
+ void setTextField3(String textField3) {
this.textField3 = textField3;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- String getTextField3(){
+ String getTextField3() {
return textField3;
}
- void setTextField4(String textField4){
+ void setTextField4(String textField4) {
this.textField4 = textField4;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- String getTextField4(){
+ String getTextField4() {
return textField4;
}
- void setTextField1Type(MetadataType textField1Type){
+ void setTextField1Type(MetadataType textField1Type) {
this.textField1Type = textField1Type;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- MetadataType getTextField1Type(){
+ MetadataType getTextField1Type() {
return textField1Type;
}
- void setTextField2Type(MetadataType textField2Type){
+ void setTextField2Type(MetadataType textField2Type) {
this.textField2Type = textField2Type;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- MetadataType getTextField2Type(){
+ MetadataType getTextField2Type() {
return textField2Type;
}
- void setTextField3Type(MetadataType textField3Type){
+ void setTextField3Type(MetadataType textField3Type) {
this.textField3Type = textField3Type;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- MetadataType getTextField3Type(){
+ MetadataType getTextField3Type() {
return textField3Type;
}
- void setTextField4Type(MetadataType textField4Type){
+ void setTextField4Type(MetadataType textField4Type) {
this.textField4Type = textField4Type;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- MetadataType getTextField4Type(){
+ MetadataType getTextField4Type() {
return textField4Type;
}
- void setTitle(String title){
+ void setTitle(String title) {
this.title = title;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- String getTitle(){
+ String getTitle() {
return title;
}
- void setPrimaryGraphic(SdlArtwork primaryGraphic){
+ void setPrimaryGraphic(SdlArtwork primaryGraphic) {
this.primaryGraphic = primaryGraphic;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- SdlArtwork getPrimaryGraphic(){
+ SdlArtwork getPrimaryGraphic() {
return primaryGraphic;
}
- void setSecondaryGraphic(SdlArtwork secondaryGraphic){
+ void setSecondaryGraphic(SdlArtwork secondaryGraphic) {
this.secondaryGraphic = secondaryGraphic;
- if (!batchingUpdates){
+ if (!batchingUpdates) {
sdlUpdate(null);
- }else{
+ } else {
isDirty = true;
}
}
- SdlArtwork getSecondaryGraphic(){
+ SdlArtwork getSecondaryGraphic() {
return secondaryGraphic;
}
- void setBatchUpdates(boolean batching){
+ void setBatchUpdates(boolean batching) {
this.batchingUpdates = batching;
}
+ private void addListeners() {
+ // add listener
+ hmiListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ currentHMILevel = onHMIStatus.getHmiLevel();
+ updateTransactionQueueSuspended();
+ }
+ };
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+
+ onDisplaysCapabilityListener = new OnSystemCapabilityListener() {
+ @Override
+ public void onCapabilityRetrieved(Object capability) {
+ // instead of using the parameter it's more safe to use the convenience method
+ List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
+ if (capabilities == null || capabilities.size() == 0) {
+ DebugTool.logError(TAG, "TextAndGraphic Manager - Capabilities sent here are null or empty");
+ defaultMainWindowCapability = null;
+ } else {
+ DisplayCapability display = capabilities.get(0);
+ for (WindowCapability windowCapability : display.getWindowCapabilities()) {
+ int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ defaultMainWindowCapability = windowCapability;
+ }
+ }
+ }
+ // Update the queue's suspend state
+ updateTransactionQueueSuspended();
+ if (hasData()) {
+ sdlUpdate(null);
+ }
+ }
+
+ @Override
+ public void onError(String info) {
+ DebugTool.logError(TAG, "Display Capability cannot be retrieved");
+ defaultMainWindowCapability = null;
+ updateTransactionQueueSuspended();
+ }
+ };
+ this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java
new file mode 100644
index 000000000..5f29e0cf9
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java
@@ -0,0 +1,638 @@
+package com.smartdevicelink.managers.screen;
+
+import com.livio.taskmaster.Task;
+import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.ManagerUtility;
+import com.smartdevicelink.managers.file.FileManager;
+import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
+import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.MetadataTags;
+import com.smartdevicelink.proxy.rpc.Show;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.util.CompareUtils;
+import com.smartdevicelink.util.DebugTool;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by Julian Kast on 8/23/20.
+ */
+class TextAndGraphicUpdateOperation extends Task {
+
+ private static final String TAG = "TextAndGraphicUpdateOperation";
+ private final WeakReference<ISdl> internalInterface;
+ private final WeakReference<FileManager> fileManager;
+ WindowCapability defaultMainWindowCapability;
+ private Show currentScreenData;
+ private TextsAndGraphicsState updatedState;
+ private CompletionListener listener;
+ private TextAndGraphicManager.CurrentScreenDataUpdatedListener currentScreenDataUpdateListener;
+
+ TextAndGraphicUpdateOperation(ISdl internalInterface, FileManager fileManager, WindowCapability currentCapabilities,
+ Show currentScreenData, TextsAndGraphicsState newState, CompletionListener listener, TextAndGraphicManager.CurrentScreenDataUpdatedListener currentScreenDataUpdateListener) {
+ super("TextAndGraphicUpdateOperation");
+ this.internalInterface = new WeakReference<>(internalInterface);
+ this.fileManager = new WeakReference<>(fileManager);
+ this.defaultMainWindowCapability = currentCapabilities;
+ this.currentScreenData = currentScreenData;
+ this.updatedState = newState;
+ this.listener = listener;
+ this.currentScreenDataUpdateListener = currentScreenDataUpdateListener;
+ }
+
+ @Override
+ public void onExecute() {
+ start();
+ }
+
+ private void start() {
+ if (getState() == Task.CANCELED) {
+ finishOperation(false);
+ return;
+ }
+
+ // Build a show with everything from `self.newState`, we'll pull things out later if we can.
+ Show fullShow = new Show();
+ fullShow.setAlignment(updatedState.getTextAlignment());
+ fullShow = assembleShowText(fullShow);
+ fullShow = assembleShowImages(fullShow);
+
+ if (!shouldUpdatePrimaryImage() && !shouldUpdateSecondaryImage()) {
+ DebugTool.logInfo(TAG, "No images to send, sending text");
+ // If there are no images to update, just send the text
+ sendShow(extractTextFromShow(fullShow), new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ finishOperation(success);
+ }
+ });
+
+ } else if (!sdlArtworkNeedsUpload(updatedState.getPrimaryGraphic()) && !sdlArtworkNeedsUpload(updatedState.getSecondaryGraphic())) {
+ DebugTool.logInfo(TAG, "Images already uploaded, sending full update");
+ // The files to be updated are already uploaded, send the full show immediately
+ sendShow(fullShow, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ finishOperation(success);
+ }
+ });
+ } else {
+ DebugTool.logInfo(TAG, "Images need to be uploaded, sending text and uploading images");
+
+ sendShow(extractTextFromShow(fullShow), new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ if (getState() == Task.CANCELED) {
+ finishOperation(false);
+ return;
+ }
+ uploadImagesAndSendWhenDone(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ finishOperation(success);
+ }
+ });
+
+ }
+ });
+ }
+ }
+
+ private void sendShow(final Show show, final CompletionListener listener) {
+ show.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ DebugTool.logInfo(TAG, "Text and Graphic update completed");
+ if (response.getSuccess()) {
+ updateCurrentScreenDataFromShow(show);
+ }
+ listener.onComplete(response.getSuccess());
+
+ }
+ });
+ internalInterface.get().sendRPC(show);
+ }
+
+
+ private void uploadImagesAndSendWhenDone(final CompletionListener listener) {
+ uploadImages(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ Show showWithGraphics = createImageOnlyShowWithPrimaryArtwork(updatedState.getPrimaryGraphic(), updatedState.getSecondaryGraphic());
+ if (showWithGraphics != null) {
+ DebugTool.logInfo(TAG, "Sending update with the successfully uploaded images");
+ sendShow(showWithGraphics, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ listener.onComplete(success);
+ }
+ });
+ } else {
+ DebugTool.logWarning(TAG, "All images failed to upload. No graphics to show, skipping update.");
+ listener.onComplete(false);
+ }
+ }
+ });
+ }
+
+ private void uploadImages(final CompletionListener listener) {
+ List<SdlArtwork> artworksToUpload = new ArrayList<>();
+
+ // add primary image
+ if (shouldUpdatePrimaryImage() && !updatedState.getPrimaryGraphic().isStaticIcon()) {
+ artworksToUpload.add(updatedState.getPrimaryGraphic());
+ }
+
+ // add secondary image
+ if (shouldUpdateSecondaryImage() && !updatedState.getSecondaryGraphic().isStaticIcon()) {
+ artworksToUpload.add(updatedState.getSecondaryGraphic());
+ }
+
+ if (artworksToUpload.size() == 0) {
+ DebugTool.logInfo(TAG, "No artworks need an upload, sending them without upload instead");
+ listener.onComplete(true);
+ }
+
+ // use file manager to upload art
+ if (fileManager.get() != null) {
+ fileManager.get().uploadArtworks(artworksToUpload, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ if (getState() == Task.CANCELED) {
+ finishOperation(false);
+ return;
+ }
+ if (errors != null) {
+ DebugTool.logError(TAG, "Text and graphic manager artwork failed to upload with error: " + errors.toString());
+ listener.onComplete(false);
+ } else {
+ listener.onComplete(true);
+ }
+ }
+ });
+ }
+ }
+
+ private Show assembleShowImages(Show show) {
+ if (shouldUpdatePrimaryImage()) {
+ show.setGraphic(updatedState.getPrimaryGraphic().getImageRPC());
+ }
+
+ if (shouldUpdateSecondaryImage()) {
+ show.setSecondaryGraphic(updatedState.getSecondaryGraphic().getImageRPC());
+ }
+
+ return show;
+ }
+
+ Show createImageOnlyShowWithPrimaryArtwork(SdlArtwork primaryArtwork, SdlArtwork secondaryArtwork) {
+ Show newShow = new Show();
+ newShow.setGraphic((primaryArtwork != null && !(sdlArtworkNeedsUpload(primaryArtwork))) ? primaryArtwork.getImageRPC() : null);
+ newShow.setSecondaryGraphic((secondaryArtwork != null && !(sdlArtworkNeedsUpload(secondaryArtwork))) ? secondaryArtwork.getImageRPC() : null);
+ if (newShow.getGraphic() == null && newShow.getSecondaryGraphic() == null) {
+ DebugTool.logInfo(TAG, "No graphics to upload");
+ return null;
+ }
+ return newShow;
+ }
+
+ Show assembleShowText(Show show) {
+ show = setBlankTextFields(show);
+
+ if (updatedState.getMediaTrackTextField() != null && shouldUpdateMediaTrackField()) {
+ show.setMediaTrack(updatedState.getMediaTrackTextField());
+ }
+
+ if (updatedState.getTitle() != null && shouldUpdateTitleField()) {
+ show.setTemplateTitle(updatedState.getTitle());
+ }
+
+ List<String> nonNullFields = findValidMainTextFields();
+ if (nonNullFields.isEmpty()) {
+ return show;
+ }
+
+ int numberOfLines = defaultMainWindowCapability != null ? ManagerUtility.WindowCapabilityUtility.getMaxNumberOfMainFieldLines(defaultMainWindowCapability) : 4;
+
+ switch (numberOfLines) {
+ case 1:
+ show = assembleOneLineShowText(show, nonNullFields);
+ break;
+ case 2:
+ show = assembleTwoLineShowText(show);
+ break;
+ case 3:
+ show = assembleThreeLineShowText(show);
+ break;
+ case 4:
+ show = assembleFourLineShowText(show);
+ break;
+ }
+ return show;
+ }
+
+ private Show assembleOneLineShowText(Show show, List<String> showFields) {
+ StringBuilder showString1 = new StringBuilder();
+ for (int i = 0; i < showFields.size(); i++) {
+ if (i > 0) {
+ showString1.append(" - ").append(showFields.get(i));
+ } else {
+ showString1.append(showFields.get(i));
+ }
+ }
+ show.setMainField1(showString1.toString());
+ MetadataTags tags = new MetadataTags();
+ tags.setMainField1(findNonNullMetadataFields());
+ show.setMetadataTags(tags);
+
+ return show;
+ }
+
+ private Show assembleTwoLineShowText(Show show) {
+ StringBuilder tempString = new StringBuilder();
+ MetadataTags tags = new MetadataTags();
+
+ if (updatedState.getTextField1() != null && updatedState.getTextField1().length() > 0) {
+ tempString.append(updatedState.getTextField1());
+ if (updatedState.getTextField1Type() != null) {
+ tags.setMainField1(updatedState.getTextField1Type());
+ }
+ }
+
+ if (updatedState.getTextField2() != null && updatedState.getTextField2().length() > 0) {
+ if ((updatedState.getTextField3() == null || !(updatedState.getTextField3().length() > 0)) && (updatedState.getTextField4() == null || !(updatedState.getTextField4().length() > 0))) {
+ // text does not exist in slots 3 or 4, put text2 in slot 2
+ show.setMainField2(updatedState.getTextField2());
+ if (updatedState.getTextField2Type() != null) {
+ tags.setMainField2(updatedState.getTextField2Type());
+ }
+ } else if (updatedState.getTextField1() != null && updatedState.getTextField1().length() > 0) {
+ // If text 1 exists, put it in slot 1 formatted
+ tempString.append(" - ").append(updatedState.getTextField2());
+ if (updatedState.getTextField2Type() != null) {
+ List<MetadataType> typeList = new ArrayList<>();
+ typeList.add(updatedState.getTextField2Type());
+ if (updatedState.getTextField1Type() != null) {
+ typeList.add(updatedState.getTextField1Type());
+ }
+ tags.setMainField1(typeList);
+ }
+ } else {
+ // If text 1 does not exist, put it in slot 1 unformatted
+ tempString.append(updatedState.getTextField2());
+ if (updatedState.getTextField2Type() != null) {
+ tags.setMainField1(updatedState.getTextField2Type());
+ }
+ }
+ }
+
+ // set mainField1
+ show.setMainField1(tempString.toString());
+
+ // new stringBuilder object
+ tempString = new StringBuilder();
+
+ if (updatedState.getTextField3() != null && updatedState.getTextField3().length() > 0) {
+ // If text 3 exists, put it in slot 2
+ tempString.append(updatedState.getTextField3());
+ if (updatedState.getTextField3Type() != null) {
+ List<MetadataType> typeList = new ArrayList<>();
+ typeList.add(updatedState.getTextField3Type());
+ tags.setMainField2(typeList);
+ }
+ }
+
+ if (updatedState.getTextField4() != null && updatedState.getTextField4().length() > 0) {
+ if (updatedState.getTextField3() != null && updatedState.getTextField3().length() > 0) {
+ // If text 3 exists, put it in slot 2 formatted
+ tempString.append(" - ").append(updatedState.getTextField4());
+ if (updatedState.getTextField4Type() != null) {
+ List<MetadataType> typeList = new ArrayList<>();
+ typeList.add(updatedState.getTextField4Type());
+ if (updatedState.getTextField3Type() != null) {
+ typeList.add(updatedState.getTextField3Type());
+ }
+ tags.setMainField2(typeList);
+ }
+ } else {
+ // If text 3 does not exist, put it in slot 3 unformatted
+ tempString.append(updatedState.getTextField4());
+ if (updatedState.getTextField4Type() != null) {
+ tags.setMainField2(updatedState.getTextField4Type());
+ }
+ }
+ }
+
+ if (tempString.toString().length() > 0) {
+ show.setMainField2(tempString.toString());
+ }
+
+ show.setMetadataTags(tags);
+ return show;
+ }
+
+ private Show assembleThreeLineShowText(Show show) {
+ MetadataTags tags = new MetadataTags();
+
+ if (updatedState.getTextField1() != null && updatedState.getTextField1().length() > 0) {
+ show.setMainField1(updatedState.getTextField1());
+ if (updatedState.getTextField1Type() != null) {
+ tags.setMainField1(updatedState.getTextField1Type());
+ }
+ }
+
+ if (updatedState.getTextField2() != null && updatedState.getTextField2().length() > 0) {
+ show.setMainField2(updatedState.getTextField2());
+ if (updatedState.getTextField2Type() != null) {
+ tags.setMainField2(updatedState.getTextField2Type());
+ }
+ }
+
+ StringBuilder tempString = new StringBuilder();
+
+ if (updatedState.getTextField3() != null && updatedState.getTextField3().length() > 0) {
+ tempString.append(updatedState.getTextField3());
+ if (updatedState.getTextField3Type() != null) {
+ tags.setMainField3(updatedState.getTextField3Type());
+ }
+ }
+
+ if (updatedState.getTextField4() != null && updatedState.getTextField4().length() > 0) {
+ if (updatedState.getTextField3() != null && updatedState.getTextField3().length() > 0) {
+ // If text 3 exists, put it in slot 3 formatted
+ tempString.append(" - ").append(updatedState.getTextField4());
+ if (updatedState.getTextField4Type() != null) {
+ List<MetadataType> tags4 = new ArrayList<>();
+ if (updatedState.getTextField3Type() != null) {
+ tags4.add(updatedState.getTextField3Type());
+ }
+ tags4.add(updatedState.getTextField4Type());
+ tags.setMainField3(tags4);
+ }
+ } else {
+ // If text 3 does not exist, put it in slot 3 formatted
+ tempString.append(updatedState.getTextField4());
+ if (updatedState.getTextField4Type() != null) {
+ tags.setMainField3(updatedState.getTextField4Type());
+ }
+ }
+ }
+ show.setMainField3(tempString.toString());
+ show.setMetadataTags(tags);
+ return show;
+ }
+
+ private Show assembleFourLineShowText(Show show) {
+ MetadataTags tags = new MetadataTags();
+ if (updatedState.getTextField1() != null && updatedState.getTextField1().length() > 0) {
+ show.setMainField1(updatedState.getTextField1());
+ if (updatedState.getTextField1Type() != null) {
+ tags.setMainField1(updatedState.getTextField1Type());
+ }
+ }
+
+ if (updatedState.getTextField2() != null && updatedState.getTextField2().length() > 0) {
+ show.setMainField2(updatedState.getTextField2());
+ if (updatedState.getTextField2Type() != null) {
+ tags.setMainField2(updatedState.getTextField2Type());
+ }
+ }
+
+ if (updatedState.getTextField3() != null && updatedState.getTextField3().length() > 0) {
+ show.setMainField3(updatedState.getTextField3());
+ if (updatedState.getTextField3Type() != null) {
+ tags.setMainField3(updatedState.getTextField3Type());
+ }
+ }
+
+ if (updatedState.getTextField4() != null && updatedState.getTextField4().length() > 0) {
+ show.setMainField4(updatedState.getTextField4());
+ if (updatedState.getTextField4Type() != null) {
+ tags.setMainField4(updatedState.getTextField4Type());
+ }
+ }
+
+ show.setMetadataTags(tags);
+
+ return show;
+ }
+
+ // Extraction
+
+ Show extractTextFromShow(Show show) {
+ Show newShow = new Show();
+ newShow.setMainField1(show.getMainField1());
+ newShow.setMainField2(show.getMainField2());
+ newShow.setMainField3(show.getMainField3());
+ newShow.setMainField4(show.getMainField4());
+ newShow.setTemplateTitle(show.getTemplateTitle());
+ newShow.setMetadataTags(show.getMetadataTags());
+ newShow.setAlignment(show.getAlignment());
+
+ return newShow;
+ }
+
+ private Show setBlankTextFields(Show newShow) {
+ newShow.setMainField1("");
+ newShow.setMainField2("");
+ newShow.setMainField3("");
+ newShow.setMainField4("");
+ newShow.setMediaTrack("");
+ newShow.setTemplateTitle("");
+
+ return newShow;
+ }
+
+ private void updateCurrentScreenDataFromShow(Show show) {
+ if (show == null) {
+ DebugTool.logError(TAG, "can not updateCurrentScreenDataFromShow from null show");
+ return;
+ }
+
+ // If the items are null, they were not updated, so we can't just set it directly
+ if (show.getMainField1() != null) {
+ currentScreenData.setMainField1(show.getMainField1());
+ }
+ if (show.getMainField2() != null) {
+ currentScreenData.setMainField2(show.getMainField2());
+ }
+ if (show.getMainField3() != null) {
+ currentScreenData.setMainField3(show.getMainField3());
+ }
+ if (show.getMainField4() != null) {
+ currentScreenData.setMainField4(show.getMainField4());
+ }
+ if (show.getTemplateTitle() != null) {
+ currentScreenData.setTemplateTitle(show.getTemplateTitle());
+ }
+ if (show.getMediaTrack() != null) {
+ currentScreenData.setMediaTrack(show.getMediaTrack());
+ }
+ if (show.getMetadataTags() != null) {
+ currentScreenData.setMetadataTags(show.getMetadataTags());
+ }
+ if (show.getAlignment() != null) {
+ currentScreenData.setAlignment(show.getAlignment());
+ }
+ if (show.getGraphic() != null) {
+ currentScreenData.setGraphic(show.getGraphic());
+ }
+ if (show.getSecondaryGraphic() != null) {
+ currentScreenData.setSecondaryGraphic(show.getSecondaryGraphic());
+ }
+ if (currentScreenDataUpdateListener != null) {
+ currentScreenDataUpdateListener.onUpdate(currentScreenData);
+ }
+ }
+
+ // Helpers
+
+ private List<String> findValidMainTextFields() {
+ List<String> array = new ArrayList<>();
+
+ if (updatedState.getTextField1() != null && updatedState.getTextField1().length() > 0) {
+ array.add(updatedState.getTextField1());
+ }
+
+ if (updatedState.getTextField2() != null && updatedState.getTextField2().length() > 0) {
+ array.add(updatedState.getTextField2());
+ }
+
+ if (updatedState.getTextField3() != null && updatedState.getTextField3().length() > 0) {
+ array.add(updatedState.getTextField3());
+ }
+
+ if (updatedState.getTextField4() != null && updatedState.getTextField4().length() > 0) {
+ array.add(updatedState.getTextField4());
+ }
+
+ return array;
+ }
+
+
+ private List<MetadataType> findNonNullMetadataFields() {
+ List<MetadataType> array = new ArrayList<>();
+
+ if (updatedState.getTextField1Type() != null) {
+ array.add(updatedState.getTextField1Type());
+ }
+
+ if (updatedState.getTextField2Type() != null) {
+ array.add(updatedState.getTextField2Type());
+ }
+
+ if (updatedState.getTextField3Type() != null) {
+ array.add(updatedState.getTextField3Type());
+ }
+
+ if (updatedState.getTextField4Type() != null) {
+ array.add(updatedState.getTextField4Type());
+ }
+
+ return array;
+ }
+
+ @SuppressWarnings("BooleanMethodIsAlwaysInverted")
+ private boolean sdlArtworkNeedsUpload(SdlArtwork artwork) {
+ if (fileManager.get() != null) {
+ return artwork != null && !fileManager.get().hasUploadedFile(artwork) && !artwork.isStaticIcon();
+ }
+ return false;
+ }
+
+ /**
+ * Check to see if primaryGraphic should be updated
+ *
+ * @return true if primaryGraphic should be updated, false if not
+ */
+ private boolean shouldUpdatePrimaryImage() {
+ boolean templateSupportsPrimaryArtwork = templateSupportsImageField(ImageFieldName.graphic);
+ String currentScreenDataPrimaryGraphicName = (currentScreenData != null && currentScreenData.getGraphic() != null) ? currentScreenData.getGraphic().getValue() : null;
+ String primaryGraphicName = updatedState.getPrimaryGraphic() != null ? updatedState.getPrimaryGraphic().getName() : null;
+
+ boolean graphicMatchesExisting = CompareUtils.areStringsEqual(currentScreenDataPrimaryGraphicName, primaryGraphicName, true, true);
+
+ return templateSupportsPrimaryArtwork && !graphicMatchesExisting;
+ }
+
+ /**
+ * Check to see if secondaryGraphic should be updated
+ *
+ * @return true if secondaryGraphic should be updated, false if not
+ */
+ private boolean shouldUpdateSecondaryImage() {
+ boolean templateSupportsSecondaryArtwork = templateSupportsImageField(ImageFieldName.secondaryGraphic);
+ String currentScreenDataSecondaryGraphicName = (currentScreenData != null && currentScreenData.getSecondaryGraphic() != null) ? currentScreenData.getSecondaryGraphic().getValue() : null;
+ String secondaryGraphicName = updatedState.getSecondaryGraphic() != null ? updatedState.getSecondaryGraphic().getName() : null;
+
+ boolean graphicMatchesExisting = CompareUtils.areStringsEqual(currentScreenDataSecondaryGraphicName, secondaryGraphicName, true, true);
+
+ // Cannot detect if there is a secondary image below v5.0, so we'll just try to detect if the primary image is allowed and allow the secondary image if it is.
+ if (internalInterface.get().getSdlMsgVersion().getMajorVersion() >= 5) {
+ return templateSupportsSecondaryArtwork && !graphicMatchesExisting;
+ } else {
+ return templateSupportsImageField(ImageFieldName.graphic) && !graphicMatchesExisting;
+ }
+ }
+
+ /**
+ * Check to see if template supports the specified image field
+ *
+ * @return true if image field is supported, false if not
+ */
+ private boolean templateSupportsImageField(ImageFieldName name) {
+ return defaultMainWindowCapability == null || ManagerUtility.WindowCapabilityUtility.hasImageFieldOfName(defaultMainWindowCapability, name);
+ }
+
+ /**
+ * Check to see if mediaTrackTextField should be updated
+ *
+ * @return true if mediaTrackTextField should be updated, false if not
+ */
+ private boolean shouldUpdateMediaTrackField() {
+ return templateSupportsTextField(TextFieldName.mediaTrack);
+ }
+
+ /**
+ * Check to see if title should be updated
+ *
+ * @return true if title should be updated, false if not
+ */
+ private boolean shouldUpdateTitleField() {
+ return templateSupportsTextField(TextFieldName.templateTitle);
+ }
+
+ /**
+ * Check to see if field should be updated
+ *
+ * @return true if field should be updated, false if not
+ */
+ private boolean templateSupportsTextField(TextFieldName name) {
+ return defaultMainWindowCapability == null || ManagerUtility.WindowCapabilityUtility.hasTextFieldOfName(defaultMainWindowCapability, name);
+ }
+
+ Show getCurrentScreenData() {
+ return currentScreenData;
+ }
+
+ void setCurrentScreenData(Show currentScreenData) {
+ this.currentScreenData = currentScreenData;
+ }
+
+ private void finishOperation(boolean success) {
+ DebugTool.logInfo(TAG, "Finishing text and graphic update operation");
+ if(listener != null){
+ listener.onComplete(success);
+ }
+ onFinished();
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/TextsAndGraphicsState.java b/base/src/main/java/com/smartdevicelink/managers/screen/TextsAndGraphicsState.java
new file mode 100644
index 000000000..bd6f749a3
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/TextsAndGraphicsState.java
@@ -0,0 +1,122 @@
+package com.smartdevicelink.managers.screen;
+
+import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
+
+class TextsAndGraphicsState {
+ private String textField1, textField2, textField3, textField4, mediaTrackTextField, title;
+ private MetadataType textField1Type, textField2Type, textField3Type, textField4Type;
+ private TextAlignment textAlignment;
+ private SdlArtwork primaryGraphic, secondaryGraphic;
+
+ TextsAndGraphicsState(String textField1, String textField2, String textField3, String textField4, String mediaTrackTextField,
+ String title, SdlArtwork primaryGraphic, SdlArtwork secondaryGraphic, TextAlignment textAlignment,
+ MetadataType textField1Type, MetadataType textField2Type, MetadataType textField3Type, MetadataType textField4Type) {
+ this.textField1 = textField1;
+ this.textField2 = textField2;
+ this.textField3 = textField3;
+ this.textField4 = textField4;
+ this.mediaTrackTextField = mediaTrackTextField;
+ this.title = title;
+ this.primaryGraphic = primaryGraphic;
+ this.secondaryGraphic = secondaryGraphic;
+ this.textAlignment = textAlignment;
+ this.textField1Type = textField1Type;
+ this.textField2Type = textField2Type;
+ this.textField3Type = textField3Type;
+ this.textField4Type = textField4Type;
+ }
+
+ String getTextField1() {
+ return textField1;
+ }
+
+ void setTextField1(String textField1) {
+ this.textField1 = textField1;
+ }
+
+ String getTextField2() {
+ return textField2;
+ }
+
+ void setTextField2(String textField2) {
+ this.textField2 = textField2;
+ }
+
+ String getTextField3() {
+ return textField3;
+ }
+
+ void setTextField3(String textField3) {
+ this.textField3 = textField3;
+ }
+
+ String getTextField4() {
+ return textField4;
+ }
+
+ void setTextField4(String textField4) {
+ this.textField4 = textField4;
+ }
+
+ String getMediaTrackTextField() {
+ return mediaTrackTextField;
+ }
+
+ void setMediaTrackTextField(String mediaTrackTextField) {
+ this.mediaTrackTextField = mediaTrackTextField;
+ }
+
+ String getTitle() {
+ return title;
+ }
+
+ void setTitle(String title) {
+ this.title = title;
+ }
+
+ MetadataType getTextField1Type() {
+ return textField1Type;
+ }
+
+ void setTextField1Type(MetadataType textField1Type) {
+ this.textField1Type = textField1Type;
+ }
+
+ MetadataType getTextField2Type() {
+ return textField2Type;
+ }
+
+ void setTextField2Type(MetadataType textField2Type) {
+ this.textField2Type = textField2Type;
+ }
+
+ MetadataType getTextField3Type() {
+ return textField3Type;
+ }
+
+ void setTextField3Type(MetadataType textField3Type) {
+ this.textField3Type = textField3Type;
+ }
+
+ MetadataType getTextField4Type() {
+ return textField4Type;
+ }
+
+ void setTextField4Type(MetadataType textField4Type) {
+ this.textField4Type = textField4Type;
+ }
+
+ TextAlignment getTextAlignment() {
+ return textAlignment;
+ }
+
+ SdlArtwork getPrimaryGraphic() {
+ return primaryGraphic;
+ }
+
+ SdlArtwork getSecondaryGraphic() {
+ return secondaryGraphic;
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/FrameData.java b/base/src/main/java/com/smartdevicelink/protocol/enums/FrameData.java
deleted file mode 100644
index 745faf5f3..000000000
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/FrameData.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.protocol.enums;
-
-import com.smartdevicelink.util.ByteEnumer;
-
-import java.util.Vector;
-
-public class FrameData extends ByteEnumer {
-
- private static Vector<FrameData> theList = new Vector<FrameData>();
- public static Vector<FrameData> getList() { return theList; }
-
- byte i = 0x00;
-
- protected FrameData(byte value, String name) {
- super(value, name);
- }
-
- public final static FrameData StartSession = new FrameData((byte)0x01, "StartSession");
- public final static FrameData StartSessionACK = new FrameData((byte)0x02, "StartSessionACK");
- public final static FrameData StartSessionNACK = new FrameData((byte)0x03, "StartSessionNACK");
- public final static FrameData EndSession = new FrameData((byte)0x04, "EndSession");
-
- public final static FrameData SingleFrame = new FrameData((byte)0x00, "SingleFrame");
- public final static FrameData FirstFrame = new FrameData((byte)0x00, "FirstFrame");
- public final static FrameData ConsecutiveFrame = new FrameData((byte)0x00, "ConsecutiveFrame");
- public final static byte LastFrame = (byte)0x00;
-
- static {
- theList.addElement(StartSession);
- theList.addElement(StartSessionACK);
- theList.addElement(StartSessionNACK);
- theList.addElement(EndSession);
- }
-
- public static FrameData valueOf(String passedButton) {
- return (FrameData) get(theList, passedButton);
- }
-
- public static FrameData[] values() {
- return theList.toArray(new FrameData[theList.size()]);
- }
-}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/IProxyListener.java b/base/src/main/java/com/smartdevicelink/proxy/IProxyListener.java
deleted file mode 100644
index c8c2bbf42..000000000
--- a/base/src/main/java/com/smartdevicelink/proxy/IProxyListener.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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;
-
-import com.smartdevicelink.proxy.interfaces.IProxyListenerBase;
-import com.smartdevicelink.proxy.rpc.OnAppInterfaceUnregistered;
-import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
-import com.smartdevicelink.proxy.rpc.UnregisterAppInterfaceResponse;
-
-@Deprecated
-public interface IProxyListener extends IProxyListenerBase{
- // Adds Legacy Life-cycle Management call-backs to the IProxyListenerAbstract interface
-
- public void onProxyOpened();
-
- public void onRegisterAppInterfaceResponse(RegisterAppInterfaceResponse response);
-
- public void onOnAppInterfaceUnregistered(OnAppInterfaceUnregistered notification);
-
- public void onUnregisterAppInterfaceResponse(UnregisterAppInterfaceResponse response);
-
-}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java
deleted file mode 100644
index eb3d00c6b..000000000
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.interfaces;
-
-@Deprecated
-public interface IProxyListenerALM extends IProxyListenerBase {
- // All methods moved into base interface
-}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
deleted file mode 100644
index e00309fb5..000000000
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * 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.interfaces;
-
-import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
-import com.smartdevicelink.proxy.callbacks.OnServiceNACKed;
-import com.smartdevicelink.proxy.rpc.AddCommandResponse;
-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;
-import com.smartdevicelink.proxy.rpc.CreateWindowResponse;
-import com.smartdevicelink.proxy.rpc.DeleteCommandResponse;
-import com.smartdevicelink.proxy.rpc.DeleteFileResponse;
-import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSetResponse;
-import com.smartdevicelink.proxy.rpc.DeleteSubMenuResponse;
-import com.smartdevicelink.proxy.rpc.DeleteWindowResponse;
-import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
-import com.smartdevicelink.proxy.rpc.DialNumberResponse;
-import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
-import com.smartdevicelink.proxy.rpc.GenericResponse;
-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;
-import com.smartdevicelink.proxy.rpc.GetWayPointsResponse;
-import com.smartdevicelink.proxy.rpc.ListFilesResponse;
-import com.smartdevicelink.proxy.rpc.OnAppServiceData;
-import com.smartdevicelink.proxy.rpc.OnAudioPassThru;
-import com.smartdevicelink.proxy.rpc.OnButtonEvent;
-import com.smartdevicelink.proxy.rpc.OnButtonPress;
-import com.smartdevicelink.proxy.rpc.OnCommand;
-import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
-import com.smartdevicelink.proxy.rpc.OnHMIStatus;
-import com.smartdevicelink.proxy.rpc.OnHashChange;
-import com.smartdevicelink.proxy.rpc.OnInteriorVehicleData;
-import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
-import com.smartdevicelink.proxy.rpc.OnLanguageChange;
-import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
-import com.smartdevicelink.proxy.rpc.OnRCStatus;
-import com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated;
-import com.smartdevicelink.proxy.rpc.OnSystemRequest;
-import com.smartdevicelink.proxy.rpc.OnTBTClientState;
-import com.smartdevicelink.proxy.rpc.OnTouchEvent;
-import com.smartdevicelink.proxy.rpc.OnVehicleData;
-import com.smartdevicelink.proxy.rpc.OnWayPointChange;
-import com.smartdevicelink.proxy.rpc.PerformAppServiceInteractionResponse;
-import com.smartdevicelink.proxy.rpc.PerformAudioPassThruResponse;
-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;
-import com.smartdevicelink.proxy.rpc.SendLocationResponse;
-import com.smartdevicelink.proxy.rpc.SetAppIconResponse;
-import com.smartdevicelink.proxy.rpc.SetCloudAppPropertiesResponse;
-import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
-import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
-import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
-import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
-import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
-import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
-import com.smartdevicelink.proxy.rpc.ShowResponse;
-import com.smartdevicelink.proxy.rpc.SliderResponse;
-import com.smartdevicelink.proxy.rpc.SpeakResponse;
-import com.smartdevicelink.proxy.rpc.SubscribeButtonResponse;
-import com.smartdevicelink.proxy.rpc.SubscribeVehicleDataResponse;
-import com.smartdevicelink.proxy.rpc.SubscribeWayPointsResponse;
-import com.smartdevicelink.proxy.rpc.SystemRequestResponse;
-import com.smartdevicelink.proxy.rpc.UnpublishAppServiceResponse;
-import com.smartdevicelink.proxy.rpc.UnsubscribeButtonResponse;
-import com.smartdevicelink.proxy.rpc.UnsubscribeVehicleDataResponse;
-import com.smartdevicelink.proxy.rpc.UnsubscribeWayPointsResponse;
-import com.smartdevicelink.proxy.rpc.UpdateTurnListResponse;
-import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-
-@Deprecated
-public interface IProxyListenerBase {
-
- /**
- * onOnHMIStatus being called indicates that there has been an HMI Level change,
- * system context change or audio streaming state change.
- *
- * @param notification - Contains information about the HMI Level,
- * system context and audio streaming state.
- */
- public void onOnHMIStatus(OnHMIStatus notification);
-
- /**
- * onProxyClosed has different functionality for the different models.
- * In the non-ALM model this indicates that the proxy has experienced an unrecoverable error.
- * A new proxy object must be initiated to reestablish connection with SDL.
- * In the ALM model this indicates that the app is no longer registered with SDL
- * All resources on SDL (addCommands and ChoiceSets) have been deleted and will have to be
- * recreated upon the next onReadyForInitialization() call-back.
- *
- * @param info - Includes information about the reason the proxy has been closed.
- * @param e - The exception that occurred.
- */
- public void onProxyClosed(String info, Exception e, SdlDisconnectedReason reason);
-
- public void onServiceEnded(OnServiceEnded serviceEnded);
-
- public void onServiceNACKed(OnServiceNACKed serviceNACKed);
-
- //public void onOnStreamRPC(OnStreamRPC notification);
-
- //public void onStreamRPCResponse(StreamRPCResponse response);
-
- /**
- * onProxyError() being called indicates that the SDL Proxy experenced an error.
- *
- * @param info - Includes information about the Exception that occurred.
- * @param e - The exception that occurred.
- */
- public void onError(String info, Exception e);
-
- /**
- * onGenericResponse() being called indicates that SDL could not determine the
- * type of request it is responding to. This is usually result of an unknown RPC Request
- * being sent.
- *
- * @param response - Includes detailed information about the response.
- */
- public void onGenericResponse(GenericResponse response);
-
- /**
- * onOnCommand() being called indicates that the user selected a command on SDL.
- *
- * @param notification - Contains information about the command chosen.
- */
- public void onOnCommand(OnCommand notification);
-
- /**
- * onAddCommandResponse() being called indicates that SDL has responded to
- * a request to add a command.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onAddCommandResponse(AddCommandResponse response);
-
- /**
- * onAddSubMenuResponse() being called indicates that SDL has responded to
- * a request to add a command.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onAddSubMenuResponse(AddSubMenuResponse response);
-
- /**
- * onCreateInteractionChoiceSetResponse() being called indicates that SDL has
- * responded to a request to add an interactionChoiceSet.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onCreateInteractionChoiceSetResponse(CreateInteractionChoiceSetResponse response);
-
- /**
- * onAlertResponse being called indicates that SDL has
- * responded to a request to alert the user.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onAlertResponse(AlertResponse response);
-
- /**
- * onDeleteCommandResponse being called indicates that SDL has
- * responded to a request to delete a command.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onDeleteCommandResponse(DeleteCommandResponse response);
-
- /**
- * onDeleteCommandResponse being called indicates that SDL has
- * responded to a request to delete an interaction choice set.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onDeleteInteractionChoiceSetResponse(DeleteInteractionChoiceSetResponse response);
-
- /**
- * onDeleteCommandResponse being called indicates that SDL has
- * responded to a request to delete a submenu.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onDeleteSubMenuResponse(DeleteSubMenuResponse response);
-
- /**
- * onPerformInteractionResponse being called indicates that SDL has
- * responded to a request to perform an interaction.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onPerformInteractionResponse(PerformInteractionResponse response);
-
- /**
- * onResetGlobalPropertiesResponse being called indicates that SDL has
- * responded to a request to reset global properties.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onResetGlobalPropertiesResponse(ResetGlobalPropertiesResponse response);
-
- /**
- * onSetGlobalPropertiesResponse being called indicates that SDL has
- * responded to a request to set global properties.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onSetGlobalPropertiesResponse(SetGlobalPropertiesResponse response);
-
- /**
- * onSetMediaClockTimerResponse being called indicates that SDL has
- * responded to a request to set the media clock timer.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onSetMediaClockTimerResponse(SetMediaClockTimerResponse response);
-
- /**
- * onShowResponse being called indicates that SDL has
- * responded to a request to display information to the user.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onShowResponse(ShowResponse response);
-
- /**
- * onSpeakResponse being called indicates that SDL has
- * responded to a request to speak information to the user.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onSpeakResponse(SpeakResponse response);
-
- /**
- * onButtonEvent being called indicates that a button event has occurred.
- *
- * @param notification - Contains information about the notification sent from SDL.
- */
- public void onOnButtonEvent(OnButtonEvent notification);
-
- /**
- * onButtonPress being called indicates that SDL has a button has
- * been pressed by the user.
- *
- * @param notification - Contains information about the notification sent from SDL.
- */
- public void onOnButtonPress(OnButtonPress notification);
-
- /**
- * onSubscribeButtonResponse being called indicates that SDL has
- * responded to a request to subscribe to button events and button presses.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onSubscribeButtonResponse(SubscribeButtonResponse response);
-
- /**
- * onUnsubscribeButtonResponse being called indicates that SDL has
- * responded to a request to unsubscribe from button events and button presses.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onUnsubscribeButtonResponse(UnsubscribeButtonResponse response);
-
- /**
- * onOnPermissionsChange being called indicates that your app permissions have
- * changed due to a policy table change. This can mean your app has received additional
- * permissions OR lost permissions.
- *
- * @param notification - Contains information about the changed permissions.
- */
- public void onOnPermissionsChange(OnPermissionsChange notification);
-
- public void onSubscribeVehicleDataResponse(SubscribeVehicleDataResponse response);
-
- public void onUnsubscribeVehicleDataResponse(UnsubscribeVehicleDataResponse response);
-
- public void onGetVehicleDataResponse(GetVehicleDataResponse response);
-
- public void onOnVehicleData(OnVehicleData notification);
-
- public void onPerformAudioPassThruResponse(PerformAudioPassThruResponse response);
-
- public void onEndAudioPassThruResponse(EndAudioPassThruResponse response);
-
- public void onOnAudioPassThru(OnAudioPassThru notification);
-
- public void onPutFileResponse(PutFileResponse response);
-
- public void onDeleteFileResponse(DeleteFileResponse response);
-
- public void onListFilesResponse(ListFilesResponse response);
-
- public void onSetAppIconResponse(SetAppIconResponse response);
-
- public void onScrollableMessageResponse(ScrollableMessageResponse response);
-
- public void onChangeRegistrationResponse(ChangeRegistrationResponse response);
-
- public void onSetDisplayLayoutResponse(SetDisplayLayoutResponse response);
-
- public void onOnLanguageChange(OnLanguageChange notification);
-
- public void onOnHashChange(OnHashChange notification);
-
- public void onSliderResponse(SliderResponse response);
-
- public void onOnDriverDistraction(OnDriverDistraction notification);
-
- public void onOnTBTClientState(OnTBTClientState notification);
-
- public void onOnSystemRequest(OnSystemRequest notification);
-
- public void onSystemRequestResponse(SystemRequestResponse response);
-
- public void onOnKeyboardInput(OnKeyboardInput notification);
-
- public void onOnTouchEvent(OnTouchEvent notification);
-
- public void onDiagnosticMessageResponse(DiagnosticMessageResponse response);
-
- public void onReadDIDResponse(ReadDIDResponse response);
-
- public void onGetDTCsResponse(GetDTCsResponse response);
-
- //public void onOnLockScreenNotification(OnLockScreenStatus notification);
-
- public void onDialNumberResponse(DialNumberResponse response);
-
- public void onSendLocationResponse(SendLocationResponse response);
-
- public void onShowConstantTbtResponse(ShowConstantTbtResponse response);
-
- public void onAlertManeuverResponse(AlertManeuverResponse response);
-
- public void onUpdateTurnListResponse(UpdateTurnListResponse response);
-
- public void onServiceDataACK(int dataSize);
-
- public void onGetWayPointsResponse(GetWayPointsResponse response);
-
- public void onSubscribeWayPointsResponse(SubscribeWayPointsResponse response);
-
- public void onUnsubscribeWayPointsResponse(UnsubscribeWayPointsResponse response);
-
- public void onOnWayPointChange(OnWayPointChange notification);
-
- public void onGetSystemCapabilityResponse(GetSystemCapabilityResponse response);
-
- public void onGetInteriorVehicleDataResponse(GetInteriorVehicleDataResponse response);
-
- public void onCreateWindowResponse(CreateWindowResponse response);
-
- public void onDeleteWindowResponse(DeleteWindowResponse response);
-
- public void onButtonPressResponse(ButtonPressResponse response);
-
- public void onSetInteriorVehicleDataResponse(SetInteriorVehicleDataResponse response);
-
- public void onOnInteriorVehicleData(OnInteriorVehicleData notification);
-
- public void onSendHapticDataResponse(SendHapticDataResponse response);
-
- public void onOnRCStatus(OnRCStatus notification);
-
- public void onSetCloudAppProperties(SetCloudAppPropertiesResponse response);
-
- public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response);
-
- public void onPublishAppServiceResponse(PublishAppServiceResponse response);
-
- public void onGetAppServiceDataResponse(GetAppServiceDataResponse response);
-
- public void onGetFileResponse(GetFileResponse response);
-
- public void onPerformAppServiceInteractionResponse(PerformAppServiceInteractionResponse response);
-
- public void onOnAppServiceData(OnAppServiceData notification);
-
- public void onGetInteriorVehicleDataConsentResponse(GetInteriorVehicleDataConsentResponse response);
-
- public void onReleaseInteriorVehicleDataModuleResponse(ReleaseInteriorVehicleDataModuleResponse response);
-
- public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification);
-
- /**
- * onCloseApplicationResponse being called indicates that SDL has
- * responded to a request to close the application on the module.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- 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.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onUnpublishAppServiceResponse(UnpublishAppServiceResponse response);
-
- /**
- * onShowAppMenuResponse being called indicates that SDL has
- * responded to a request to close the application on the module.
- *
- * @param response - Contains information about the response sent from SDL.
- */
- public void onShowAppMenuResponse(ShowAppMenuResponse response);
-}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/FuelRange.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/FuelRange.java
index 1457a7459..334f6eb4e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/FuelRange.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/FuelRange.java
@@ -32,14 +32,84 @@
package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.CapacityUnit;
+import com.smartdevicelink.proxy.rpc.enums.ComponentVolumeStatus;
import com.smartdevicelink.proxy.rpc.enums.FuelType;
import com.smartdevicelink.util.SdlDataTypeConverter;
import java.util.Hashtable;
-public class FuelRange extends RPCStruct{
+/**
+ *
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Required</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>type</td>
+ * <td>FuelType</td>
+ * <td></td>
+ * <td>N</td>
+ * <td></td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>range</td>
+ * <td>Float</td>
+ * <td>The estimate range in KM the vehicle can travel based on fuel level and consumption.</td>
+ * <td>N</td>
+ * <td>{"num_min_value": 0.0, "num_max_value": 10000.0}</td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>level</td>
+ * <td>Float</td>
+ * <td>The relative remaining capacity of this fuel type (percentage).</td>
+ * <td>N</td>
+ * <td>{"num_min_value": -6.0, "num_max_value": 1000000.0}</td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
+ * <tr>
+ * <td>levelState</td>
+ * <td>ComponentVolumeStatus</td>
+ * <td>The fuel level state</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
+ * <tr>
+ * <td>capacity</td>
+ * <td>Float</td>
+ * <td>The absolute capacity of this fuel type.</td>
+ * <td>N</td>
+ * <td>{"num_min_value": 0.0, "num_max_value": 1000000.0}</td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
+ * <tr>
+ * <td>capacityUnit</td>
+ * <td>CapacityUnit</td>
+ * <td>The unit of the capacity of this fuel type such as liters for gasoline or kWh forbatteries.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
+ * </table>
+ * @since SmartDeviceLink 5.0.0
+ */
+public class FuelRange extends RPCStruct {
public static final String KEY_TYPE = "type";
public static final String KEY_RANGE = "range";
+ public static final String KEY_LEVEL = "level";
+ public static final String KEY_LEVEL_STATE = "levelState";
+ public static final String KEY_CAPACITY = "capacity";
+ public static final String KEY_CAPACITY_UNIT = "capacityUnit";
/**
* Constructs a new FuelRange object
@@ -96,4 +166,92 @@ public class FuelRange extends RPCStruct{
public void setRange(Float range) {
setValue(KEY_RANGE, range);
}
+
+ /**
+ * Sets the level.
+ *
+ * @param level The relative remaining capacity of this fuel type (percentage).
+ * {"num_min_value": -6.0, "num_max_value": 1000000.0}
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setLevel(Float level) {
+ setValue(KEY_LEVEL, level);
+ }
+
+ /**
+ * Gets the level.
+ *
+ * @return Float The relative remaining capacity of this fuel type (percentage).
+ * {"num_min_value": -6.0, "num_max_value": 1000000.0}
+ * @since SmartDeviceLink 7.0.0
+ */
+ public Float getLevel() {
+ Object object = getValue(KEY_LEVEL);
+ return SdlDataTypeConverter.objectToFloat(object);
+ }
+
+ /**
+ * Sets the levelState.
+ *
+ * @param levelState The fuel level state
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setLevelState(ComponentVolumeStatus levelState) {
+ setValue(KEY_LEVEL_STATE, levelState);
+ }
+
+ /**
+ * Gets the levelState.
+ *
+ * @return ComponentVolumeStatus The fuel level state
+ * @since SmartDeviceLink 7.0.0
+ */
+ public ComponentVolumeStatus getLevelState() {
+ return (ComponentVolumeStatus) getObject(ComponentVolumeStatus.class, KEY_LEVEL_STATE);
+ }
+
+ /**
+ * Sets the capacity.
+ *
+ * @param capacity The absolute capacity of this fuel type.
+ * {"num_min_value": 0.0, "num_max_value": 1000000.0}
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setCapacity(Float capacity) {
+ setValue(KEY_CAPACITY, capacity);
+ }
+
+ /**
+ * Gets the capacity.
+ *
+ * @return Float The absolute capacity of this fuel type.
+ * {"num_min_value": 0.0, "num_max_value": 1000000.0}
+ * @since SmartDeviceLink 7.0.0
+ */
+ public Float getCapacity() {
+ Object object = getValue(KEY_CAPACITY);
+ return SdlDataTypeConverter.objectToFloat(object);
+ }
+
+ /**
+ * Sets the capacityUnit.
+ *
+ * @param capacityUnit The unit of the capacity of this fuel type such as liters for gasoline or kWh for
+ * batteries.
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setCapacityUnit(CapacityUnit capacityUnit) {
+ setValue(KEY_CAPACITY_UNIT, capacityUnit);
+ }
+
+ /**
+ * Gets the capacityUnit.
+ *
+ * @return CapacityUnit The unit of the capacity of this fuel type such as liters for gasoline or kWh for
+ * batteries.
+ * @since SmartDeviceLink 7.0.0
+ */
+ public CapacityUnit getCapacityUnit() {
+ return (CapacityUnit) getObject(CapacityUnit.class, KEY_CAPACITY_UNIT);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
index 4699de61f..d1400d8f3 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
@@ -76,18 +76,26 @@ import java.util.Hashtable;
* <tr>
* <td>fuelLevel</td>
* <td>Boolean</td>
- * <td>The fuel level in the tank (percentage)</td>
+ * <td>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec7.0, please see fuelRange.</td>
* <td>N</td>
* <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0</td>
+ * <td>SmartDeviceLink 7.0.0</td>
* </tr>
* <tr>
* <td>fuelLevel_State</td>
* <td>Boolean</td>
- * <td>The fuel level state</td>
+ * <td>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please seefuelRange.</td>
* <td>N</td>
* <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0</td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
+ * <tr>
+ * <td>fuelRange</td>
+ * <td>Boolean</td>
+ * <td>The fuel type, estimated range in KM, fuel level/capacity and fuel level state for thevehicle. See struct FuelRange for details.</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
+ * <td>SmartDeviceLink 5.0.0</td>
* </tr>
* <tr>
* <td>instantFuelConsumption</td>
@@ -239,6 +247,13 @@ import java.util.Hashtable;
* <td>N</td>
* <td>Subscribable</td>
* <td>SmartDeviceLink 5.1 </td>
+ * <tr>
+ * <td>stabilityControlsStatus</td>
+ * <td>Boolean</td>
+ * <td>See StabilityControlsStatus</td>
+ * <td>N</td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
* </tr>
* <tr>
* <td>handsOffSteering</td>
@@ -281,7 +296,6 @@ public class GetVehicleData extends RPCRequest {
public static final String KEY_SPEED = "speed";
public static final String KEY_RPM = "rpm";
public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_FUEL_LEVEL = "fuelLevel";
public static final String KEY_VIN = "vin";
public static final String KEY_PRNDL = "prndl";
public static final String KEY_TIRE_PRESSURE = "tirePressure";
@@ -289,7 +303,6 @@ public class GetVehicleData extends RPCRequest {
public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
public static final String KEY_ODOMETER = "odometer";
public static final String KEY_GPS = "gps";
- public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
public static final String KEY_BELT_STATUS = "beltStatus";
public static final String KEY_BODY_INFORMATION = "bodyInformation";
@@ -311,6 +324,18 @@ public class GetVehicleData extends RPCRequest {
public static final String KEY_WINDOW_STATUS = "windowStatus";
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
public static final String KEY_GEAR_STATUS = "gearStatus";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL = "fuelLevel";
+
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
+ public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
/**
* Constructs a new GetVehicleData object
@@ -350,15 +375,35 @@ public class GetVehicleData extends RPCRequest {
public Boolean getRpm() {
return getBoolean(KEY_RPM);
}
+
+ /**
+ * Sets the fuelLevel.
+ *
+ * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
+ */
+ @Deprecated
public void setFuelLevel(Boolean fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
}
+
+ /**
+ * Gets the fuelLevel.
+ *
+ * @return Boolean The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
+ */
+ @Deprecated
public Boolean getFuelLevel() {
return getBoolean(KEY_FUEL_LEVEL);
}
+
+ @Deprecated
public void setFuelLevelState(Boolean fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
}
+
+ @Deprecated
public Boolean getFuelLevelState() {
return getBoolean(KEY_FUEL_LEVEL_STATE);
}
@@ -368,6 +413,15 @@ public class GetVehicleData extends RPCRequest {
public Boolean getInstantFuelConsumption() {
return getBoolean(KEY_INSTANT_FUEL_CONSUMPTION);
}
+
+ public void setFuelRange(Boolean fuelRange) {
+ setParameters(KEY_FUEL_RANGE, fuelRange);
+ }
+
+ public Boolean getFuelRange() {
+ return getBoolean(KEY_FUEL_RANGE);
+ }
+
public void setExternalTemperature(Boolean externalTemperature) {
setParameters(KEY_EXTERNAL_TEMPERATURE, externalTemperature);
}
@@ -510,25 +564,6 @@ public class GetVehicleData extends RPCRequest {
}
/**
- * Sets a boolean value. If true, gets fuelRange data
- * @param fuelRange
- * a boolean value
- */
- public void setFuelRange(Boolean fuelRange) {
- setParameters(KEY_FUEL_RANGE, fuelRange);
- }
-
- /**
- * Gets a boolean value.
- *
- * @return Boolean -a Boolean value.
- *
- */
- public Boolean getFuelRange() {
- return getBoolean(KEY_FUEL_RANGE);
- }
-
- /**
* Sets a boolean value. If true, subscribes turnSignal data
* @param turnSignal a boolean value
*/
@@ -648,4 +683,24 @@ public class GetVehicleData extends RPCRequest {
public Boolean getGearStatus() {
return getBoolean(KEY_GEAR_STATUS);
}
+
+ /**
+ * Sets the stabilityControlsStatus.
+ *
+ * @param stabilityControlsStatus See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setStabilityControlsStatus(Boolean stabilityControlsStatus) {
+ setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
+ }
+
+ /**
+ * Gets the stabilityControlsStatus.
+ *
+ * @return Boolean See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public Boolean getStabilityControlsStatus() {
+ return getBoolean(KEY_STABILITY_CONTROLS_STATUS);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
index 1226baa45..2e7df80a9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
@@ -54,39 +54,48 @@ import java.util.List;
* @since SmartDeviceLink 2.0
*/
public class GetVehicleDataResponse extends RPCResponse {
+ public static final String KEY_GPS = "gps";
public static final String KEY_SPEED = "speed";
public static final String KEY_RPM = "rpm";
- public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
+ /**
+ * @deprecated
+ */
+ @Deprecated
public static final String KEY_FUEL_LEVEL = "fuelLevel";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
+ public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
+ public static final String KEY_FUEL_RANGE = "fuelRange";
+ public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
+ public static final String KEY_TURN_SIGNAL = "turnSignal";
public static final String KEY_VIN = "vin";
public static final String KEY_PRNDL = "prndl";
public static final String KEY_TIRE_PRESSURE = "tirePressure";
- public static final String KEY_ENGINE_TORQUE = "engineTorque";
- public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
public static final String KEY_ODOMETER = "odometer";
- public static final String KEY_GPS = "gps";
- public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
- public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
public static final String KEY_BELT_STATUS = "beltStatus";
public static final String KEY_BODY_INFORMATION = "bodyInformation";
public static final String KEY_DEVICE_STATUS = "deviceStatus";
public static final String KEY_DRIVER_BRAKING = "driverBraking";
public static final String KEY_WIPER_STATUS = "wiperStatus";
public static final String KEY_HEAD_LAMP_STATUS = "headLampStatus";
+ public static final String KEY_ENGINE_TORQUE = "engineTorque";
public static final String KEY_ACC_PEDAL_POSITION = "accPedalPosition";
public static final String KEY_STEERING_WHEEL_ANGLE = "steeringWheelAngle";
+ public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
+ public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
+ public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
public static final String KEY_E_CALL_INFO = "eCallInfo";
public static final String KEY_AIRBAG_STATUS = "airbagStatus";
public static final String KEY_EMERGENCY_EVENT = "emergencyEvent";
public static final String KEY_CLUSTER_MODE_STATUS = "clusterModeStatus";
public static final String KEY_MY_KEY = "myKey";
- public static final String KEY_FUEL_RANGE = "fuelRange";
- public static final String KEY_TURN_SIGNAL = "turnSignal";
- public static final String KEY_ELECTRONIC_PARK_BRAKE_STATUS = "electronicParkBrakeStatus";
- public static final String KEY_CLOUD_APP_VEHICLE_ID = "cloudAppVehicleID";
public static final String KEY_WINDOW_STATUS = "windowStatus";
public static final String KEY_GEAR_STATUS = "gearStatus";
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
+ public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
/**
* Constructs a new GetVehicleDataResponse object
@@ -128,19 +137,49 @@ public class GetVehicleDataResponse extends RPCResponse {
public Integer getRpm() {
return getInteger(KEY_RPM);
}
- public void setFuelLevel(Double fuelLevel) {
- setParameters(KEY_FUEL_LEVEL, fuelLevel);
- }
- public Double getFuelLevel() {
- Object object = getParameters(KEY_FUEL_LEVEL);
- return SdlDataTypeConverter.objectToDouble(object);
- }
+
+ /**
+ * Sets Fuel Level State
+ * @param fuelLevelState a ComponentVolumeStatus related to FuelLevel State
+ */
+ @Deprecated
public void setFuelLevelState(ComponentVolumeStatus fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
}
+ /**
+ * Gets Fuel Level State
+ * @return a ComponentVolumeStatus related to FuelLevel State
+ */
+ @Deprecated
+ @SuppressWarnings("unchecked")
public ComponentVolumeStatus getFuelLevelState() {
return (ComponentVolumeStatus) getObject(ComponentVolumeStatus.class, KEY_FUEL_LEVEL_STATE);
}
+
+ /**
+ * Sets the fuelLevel.
+ *
+ * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
+ * @since SmartDeviceLink 7.0.0
+ */
+ @Deprecated
+ public void setFuelLevel(Double fuelLevel) {
+ setParameters(KEY_FUEL_LEVEL, fuelLevel);
+ }
+
+ /**
+ * Gets the fuelLevel.
+ *
+ * @return Double The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
+ * @since SmartDeviceLink 7.0.0
+ */
+ @Deprecated
+ public Double getFuelLevel() {
+ Object object = getParameters(KEY_FUEL_LEVEL);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
public void setInstantFuelConsumption(Double instantFuelConsumption) {
setParameters(KEY_INSTANT_FUEL_CONSUMPTION, instantFuelConsumption);
}
@@ -462,4 +501,24 @@ public class GetVehicleDataResponse extends RPCResponse {
public GearStatus getGearStatus() {
return (GearStatus) getObject(GearStatus.class, KEY_GEAR_STATUS);
}
+
+ /**
+ * Gets the stabilityControlsStatus.
+ *
+ * @return StabilityControlsStatus See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public StabilityControlsStatus getStabilityControlsStatus() {
+ return (StabilityControlsStatus) getObject(StabilityControlsStatus.class, KEY_STABILITY_CONTROLS_STATUS);
+ }
+
+ /**
+ * Sets the stabilityControlsStatus.
+ *
+ * @param stabilityControlsStatus See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setStabilityControlsStatus(StabilityControlsStatus stabilityControlsStatus) {
+ setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
index 74fcda171..a5cbb162c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
@@ -93,19 +93,27 @@ import java.util.List;
* </tr>
* <tr>
* <td>fuelLevel</td>
- * <td>Float</td>
- * <td>The fuel level in the tank (percentage)</td>
+ * <td>Boolean</td>
+ * <td>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec7.0, please see fuelRange.</td>
* <td>N</td>
* <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0</td>
+ * <td>SmartDeviceLink 7.0.0</td>
* </tr>
* <tr>
* <td>fuelLevel_State</td>
- * <td>ComponentVolumeStatus</td>
- * <td>The fuel level state (Ok/Low)</td>
+ * <td>Boolean</td>
+ * <td>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please seefuelRange.</td>
* <td>N</td>
* <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0</td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
+ * <tr>
+ * <td>fuelRange</td>
+ * <td>Boolean</td>
+ * <td>The fuel type, estimated range in KM, fuel level/capacity and fuel level state for thevehicle. See struct FuelRange for details.</td>
+ * <td>N</td>
+ * <td>{"array_min_size": 0, "array_max_size": 100}</td>
+ * <td>SmartDeviceLink 5.0.0</td>
* </tr>
* <tr>
* <td>instantFuelConsumption</td>
@@ -311,6 +319,13 @@ import java.util.List;
* <td>N</td>
* <td>SmartDeviceLink 7.0.0</td>
* </tr>
+ * <tr>
+ * <td>stabilityControlsStatus</td>
+ * <td>StabilityControlsStatus</td>
+ * <td>See StabilityControlsStatus</td>
+ * <td>N</td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
* </table>
*
* @since SmartDeviceLink 1.0
@@ -324,7 +339,6 @@ public class OnVehicleData extends RPCNotification {
public static final String KEY_SPEED = "speed";
public static final String KEY_RPM = "rpm";
public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_FUEL_LEVEL = "fuelLevel";
public static final String KEY_VIN = "vin";
public static final String KEY_PRNDL = "prndl";
public static final String KEY_TIRE_PRESSURE = "tirePressure";
@@ -332,7 +346,6 @@ public class OnVehicleData extends RPCNotification {
public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
public static final String KEY_ODOMETER = "odometer";
public static final String KEY_GPS = "gps";
- public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
public static final String KEY_BELT_STATUS = "beltStatus";
public static final String KEY_BODY_INFORMATION = "bodyInformation";
@@ -354,7 +367,18 @@ public class OnVehicleData extends RPCNotification {
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
public static final String KEY_WINDOW_STATUS = "windowStatus";
public static final String KEY_GEAR_STATUS = "gearStatus";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL = "fuelLevel";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
+ public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
public OnVehicleData() {
super(FunctionID.ON_VEHICLE_DATA.toString());
@@ -382,16 +406,34 @@ public class OnVehicleData extends RPCNotification {
public Integer getRpm() {
return getInteger(KEY_RPM);
}
+
+ /**
+ * Sets the fuelLevel.
+ *
+ * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
+ */
+ @Deprecated
public void setFuelLevel(Double fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
}
+
+ /**
+ * Gets the fuelLevel.
+ *
+ * @return Float The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
+ */
+ @Deprecated
public Double getFuelLevel() {
Object object = getParameters(KEY_FUEL_LEVEL);
return SdlDataTypeConverter.objectToDouble(object);
}
+ @Deprecated
public void setFuelLevelState(ComponentVolumeStatus fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
}
+ @Deprecated
public ComponentVolumeStatus getFuelLevelState() {
return (ComponentVolumeStatus) getObject(ComponentVolumeStatus.class, KEY_FUEL_LEVEL_STATE);
}
@@ -561,17 +603,25 @@ public class OnVehicleData extends RPCNotification {
}
/**
- * Sets Fuel Range List. Fuel Range - The estimate range in KM the vehicle can travel based on fuel level and consumption.
- * @param fuelRange
+ * Sets the fuelRange.
+ *
+ * @param fuelRange The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * {"array_min_size": 0, "array_max_size": 100}
+ * @since SmartDeviceLink 5.0.0
*/
public void setFuelRange(List<FuelRange> fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
}
/**
- * Gets Fuel Range List.
- * @return List<FuelRange>
- * Fuel Range - The estimate range in KM the vehicle can travel based on fuel level and consumption.
+ * Gets the fuelRange.
+ *
+ * @return List<FuelRange> The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * {"array_min_size": 0, "array_max_size": 100}
+ * @since SmartDeviceLink 5.0.0
+
*/
@SuppressWarnings("unchecked")
public List<FuelRange> getFuelRange() {
@@ -666,6 +716,26 @@ public class OnVehicleData extends RPCNotification {
}
/**
+ * Gets the stabilityControlsStatus.
+ *
+ * @return StabilityControlsStatus See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public StabilityControlsStatus getStabilityControlsStatus() {
+ return (StabilityControlsStatus) getObject(StabilityControlsStatus.class, KEY_STABILITY_CONTROLS_STATUS);
+ }
+
+ /**
+ * Sets the stabilityControlsStatus.
+ *
+ * @param stabilityControlsStatus See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setStabilityControlsStatus(StabilityControlsStatus stabilityControlsStatus) {
+ setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
+ }
+
+ /**
* Sets the handsOffSteering.
*
* @param handsOffSteering To indicate whether driver hands are off the steering wheel
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/StabilityControlsStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/StabilityControlsStatus.java
new file mode 100644
index 000000000..5ee5eb0b4
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/StabilityControlsStatus.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2017 - 2020, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.VehicleDataStatus;
+
+import java.util.Hashtable;
+
+/**
+ *
+ * <p><b>Parameter List</b></p>
+ *
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Param Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * <th>Required</th>
+ * <th>Notes</th>
+ * <th>Version Available</th>
+ * </tr>
+ * <tr>
+ * <td>escSystem</td>
+ * <td>VehicleDataStatus</td>
+ * <td>true if vehicle stability control is ON, else false</td>
+ * <td>N</td>
+ * <td></td>
+ * <td></td>
+ * </tr>
+ * <tr>
+ * <td>trailerSwayControl</td>
+ * <td>VehicleDataStatus</td>
+ * <td>true if vehicle trailer sway control is ON, else false</td>
+ * <td>N</td>
+ * <td></td>
+ * <td></td>
+ * </tr>
+ * </table>
+ * @since SmartDeviceLink 7.0.0
+ */
+public class StabilityControlsStatus extends RPCStruct {
+ public static final String KEY_ESC_SYSTEM = "escSystem";
+ public static final String KEY_TRAILER_SWAY_CONTROL = "trailerSwayControl";
+
+
+ /**
+ * Constructs a new StabilityControlsStatus object
+ */
+ public StabilityControlsStatus() { }
+
+ /**
+ * Constructs a new StabilityControlsStatus object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public StabilityControlsStatus(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Gets the escSystem.
+ *
+ * @return VehicleDataStatus true if vehicle stability control is ON, else false
+ */
+ public VehicleDataStatus getEscSystem() {
+ return (VehicleDataStatus) getObject(VehicleDataStatus.class, KEY_ESC_SYSTEM);
+ }
+
+ /**
+ * Sets the escSystem.
+ *
+ * @param escSystem true if vehicle stability control is ON, else false
+ */
+ public void setEscSystem(VehicleDataStatus escSystem) {
+ setValue(KEY_ESC_SYSTEM, escSystem);
+ }
+
+ /**
+ * Sets the trailerSwayControl.
+ *
+ * @param trailerSwayControl true if vehicle trailer sway control is ON, else false
+ */
+ public void setTrailerSwayControl(VehicleDataStatus trailerSwayControl) {
+ setValue(KEY_TRAILER_SWAY_CONTROL, trailerSwayControl);
+ }
+
+ /**
+ * Gets the trailerSwayControl.
+ *
+ * @return VehicleDataStatus true if vehicle trailer sway control is ON, else false
+ */
+ public VehicleDataStatus getTrailerSwayControl() {
+ return (VehicleDataStatus) getObject(VehicleDataStatus.class, KEY_TRAILER_SWAY_CONTROL);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
index 9b67c145f..20822e451 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
@@ -84,18 +84,26 @@ import java.util.Hashtable;
* <tr>
* <td>fuelLevel</td>
* <td>Boolean</td>
- * <td>The fuel level in the tank (percentage)</td>
+ * <td>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec7.0, please see fuelRange.</td>
* <td>N</td>
* <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
+ * <td>SmartDeviceLink 7.0.0</td>
* </tr>
* <tr>
* <td>fuelLevel_State</td>
* <td>Boolean</td>
- * <td>The fuel level state</td>
+ * <td>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please seefuelRange.</td>
* <td>N</td>
* <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
+ * <tr>
+ * <td>fuelRange</td>
+ * <td>Boolean</td>
+ * <td>The fuel type, estimated range in KM, fuel level/capacity and fuel level state for thevehicle. See struct FuelRange for details.</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
+ * <td>SmartDeviceLink 5.0.0</td>
* </tr>
* <tr>
* <td>instantFuelConsumption</td>
@@ -293,6 +301,13 @@ import java.util.Hashtable;
* <td>N</td>
* <td>SmartDeviceLink 7.0.0</td>
* </tr>
+ * <tr>
+ * <td>stabilityControlsStatus</td>
+ * <td>Boolean</td>
+ * <td>See StabilityControlsStatus</td>
+ * <td>N</td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
* </table>
*
* <p> <b>Response</b></p>
@@ -315,14 +330,12 @@ import java.util.Hashtable;
public class SubscribeVehicleData extends RPCRequest {
public static final String KEY_RPM = "rpm";
public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_FUEL_LEVEL = "fuelLevel";
public static final String KEY_PRNDL = "prndl";
public static final String KEY_TIRE_PRESSURE = "tirePressure";
public static final String KEY_ENGINE_TORQUE = "engineTorque";
public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
public static final String KEY_ODOMETER = "odometer";
public static final String KEY_GPS = "gps";
- public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
public static final String KEY_BELT_STATUS = "beltStatus";
public static final String KEY_BODY_INFORMATION = "bodyInformation";
@@ -345,6 +358,17 @@ public class SubscribeVehicleData extends RPCRequest {
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
public static final String KEY_WINDOW_STATUS = "windowStatus";
public static final String KEY_GEAR_STATUS = "gearStatus";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL = "fuelLevel";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
+ public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
/**
* Constructs a new SubscribeVehicleData object
@@ -426,22 +450,23 @@ public class SubscribeVehicleData extends RPCRequest {
}
/**
- * Sets a boolean value. If true, subscribes FuelLevel data
+ * Sets the fuelLevel.
*
- * @param fuelLevel
- * a boolean value
+ * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
*/
+ @Deprecated
public void setFuelLevel(Boolean fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
}
/**
- * Gets a boolean value. If true, means the FuelLevel data has been
- * subscribed.
+ * Gets the fuelLevel.
*
- * @return Boolean -a Boolean value. If true, means the FuelLevel data has
- * been subscribed.
+ * @return Float The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
*/
+ @Deprecated
public Boolean getFuelLevel() {
return getBoolean(KEY_FUEL_LEVEL);
}
@@ -452,6 +477,7 @@ public class SubscribeVehicleData extends RPCRequest {
* @param fuelLevelState
* a boolean value
*/
+ @Deprecated
public void setFuelLevelState(Boolean fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
}
@@ -463,7 +489,8 @@ public class SubscribeVehicleData extends RPCRequest {
* @return Boolean -a Boolean value. If true, means the fuelLevelState data
* has been subscribed.
*/
- public Boolean getFuelLevelState() {
+ @Deprecated
+ public Boolean getFuelLevelState() {
return getBoolean(KEY_FUEL_LEVEL_STATE);
}
@@ -821,22 +848,22 @@ public class SubscribeVehicleData extends RPCRequest {
}
/**
- * Sets a boolean value. If true, subscribes fuelRange data
+ * Sets the fuelRange.
*
- * @param fuelRange
- * a boolean value
+ * @param fuelRange The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
*/
public void setFuelRange(Boolean fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
}
/**
- * Gets a boolean value. If true, means the Fuel Range data has been
- * subscribed.
- *
- * @return Boolean -a Boolean value. If true, means the Fuel Range data
- * has been subscribed.
+ * Gets the fuelRange.
*
+ * @return Boolean The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
*/
public Boolean getFuelRange() {
return getBoolean(KEY_FUEL_RANGE);
@@ -942,4 +969,24 @@ public class SubscribeVehicleData extends RPCRequest {
public Boolean getHandsOffSteering() {
return getBoolean(KEY_HANDS_OFF_STEERING);
}
+
+ /**
+ * Gets the stabilityControlsStatus.
+ *
+ * @return Boolean See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public Boolean getStabilityControlsStatus() {
+ return getBoolean(KEY_STABILITY_CONTROLS_STATUS);
+ }
+
+ /**
+ * Sets the stabilityControlsStatus.
+ *
+ * @param stabilityControlsStatus See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setStabilityControlsStatus(Boolean stabilityControlsStatus) {
+ setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
index cb869336a..670687814 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
@@ -47,7 +47,6 @@ import java.util.Hashtable;
public class SubscribeVehicleDataResponse extends RPCResponse {
public static final String KEY_SPEED = "speed";
public static final String KEY_RPM = "rpm";
- public static final String KEY_FUEL_LEVEL = "fuelLevel";
public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
public static final String KEY_PRNDL = "prndl";
public static final String KEY_TIRE_PRESSURE = "tirePressure";
@@ -55,7 +54,6 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
public static final String KEY_ODOMETER = "odometer";
public static final String KEY_GPS = "gps";
- public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
public static final String KEY_BELT_STATUS = "beltStatus";
public static final String KEY_BODY_INFORMATION = "bodyInformation";
@@ -77,6 +75,17 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public static final String KEY_GEAR_STATUS = "gearStatus";
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
public static final String KEY_WINDOW_STATUS = "windowStatus";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL = "fuelLevel";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
+ public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
/**
* Constructs a new SubscribeVehicleDataResponse object
@@ -151,17 +160,23 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_RPM);
}
/**
- * Sets Fuel Level
- * @param fuelLevel a VehicleDataResult related to Fuel Level
+ * Sets the fuelLevel.
+ *
+ * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
*/
+ @Deprecated
public void setFuelLevel(VehicleDataResult fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
}
/**
- * Gets Fuel Level
- * @return a VehicleDataResult related to FuelLevel
+ * Gets the fuelLevel.
+ *
+ * @return VehicleDataResult The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
*/
@SuppressWarnings("unchecked")
+ @Deprecated
public VehicleDataResult getFuelLevel() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_FUEL_LEVEL);
}
@@ -169,6 +184,7 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* Sets Fuel Level State
* @param fuelLevelState a VehicleDataResult related to FuelLevel State
*/
+ @Deprecated
public void setFuelLevelState(VehicleDataResult fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
}
@@ -176,6 +192,7 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
* Gets Fuel Level State
* @return a VehicleDataResult related to FuelLevel State
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public VehicleDataResult getFuelLevelState() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_FUEL_LEVEL_STATE);
@@ -443,16 +460,22 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
}
/**
- * Sets Fuel Range
- * @param fuelRange a VehicleDataResult related to the fuel range
+ * Sets the fuelRange.
+ *
+ * @param fuelRange The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
*/
public void setFuelRange(VehicleDataResult fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
}
/**
- * Gets Fuel Range
- * @return a VehicleDataResult related to the fuel range
+ * Gets the fuelRange.
+ *
+ * @return VehicleDataResult The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
*/
@SuppressWarnings("unchecked")
public VehicleDataResult getFuelRange() {
@@ -584,4 +607,24 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getWindowStatus() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_WINDOW_STATUS);
}
+
+ /**
+ * Gets the stabilityControlsStatus.
+ *
+ * @return VehicleDataResult See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public VehicleDataResult getStabilityControlsStatus() {
+ return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_STABILITY_CONTROLS_STATUS);
+ }
+
+ /**
+ * Sets the stabilityControlsStatus.
+ *
+ * @param stabilityControlsStatus See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setStabilityControlsStatus(VehicleDataResult stabilityControlsStatus) {
+ setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
index 5a998a268..663f8fbf8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
@@ -79,18 +79,26 @@ import java.util.Hashtable;
* <tr>
* <td>fuelLevel</td>
* <td>Boolean</td>
- * <td>The fuel level in the tank (percentage)</td>
+ * <td>The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec7.0, please see fuelRange.</td>
* <td>N</td>
* <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
+ * <td>SmartDeviceLink 7.0.0</td>
* </tr>
* <tr>
* <td>fuelLevel_State</td>
* <td>Boolean</td>
- * <td>The fuel level state</td>
+ * <td>The fuel level state. This parameter is deprecated starting RPC Spec 7.0, please seefuelRange.</td>
* <td>N</td>
* <td>Subscribable</td>
- * <td>SmartDeviceLink 2.0 </td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
+ * <tr>
+ * <td>fuelRange</td>
+ * <td>Boolean</td>
+ * <td>The fuel type, estimated range in KM, fuel level/capacity and fuel level state for thevehicle. See struct FuelRange for details.</td>
+ * <td>N</td>
+ * <td>Subscribable</td>
+ * <td>SmartDeviceLink 5.0.0</td>
* </tr>
* <tr>
* <td>instantFuelConsumption</td>
@@ -280,6 +288,15 @@ import java.util.Hashtable;
* <td>N</td>
* <td>SmartDeviceLink 7.0.0</td>
* </tr>
+ * <tr>
+ * <td>stabilityControlsStatus</td>
+ * <td>Boolean</td>
+ * <td>See StabilityControlsStatus</td>
+ * <td>N</td>
+ * <td>SmartDeviceLink 7.0.0</td>
+ * </tr>
+ *
+
* </table>
* <p><b> Response</b></p>
* <p><b>Non-default Result Codes:</b></p>
@@ -301,14 +318,12 @@ public class UnsubscribeVehicleData extends RPCRequest {
public static final String KEY_SPEED = "speed";
public static final String KEY_RPM = "rpm";
public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
- public static final String KEY_FUEL_LEVEL = "fuelLevel";
public static final String KEY_PRNDL = "prndl";
public static final String KEY_TIRE_PRESSURE = "tirePressure";
public static final String KEY_ENGINE_TORQUE = "engineTorque";
public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
public static final String KEY_ODOMETER = "odometer";
public static final String KEY_GPS = "gps";
- public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
public static final String KEY_BELT_STATUS = "beltStatus";
public static final String KEY_BODY_INFORMATION = "bodyInformation";
@@ -330,6 +345,17 @@ public class UnsubscribeVehicleData extends RPCRequest {
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
public static final String KEY_GEAR_STATUS = "gearStatus";
public static final String KEY_WINDOW_STATUS = "windowStatus";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL = "fuelLevel";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
+ public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
/**
* Constructs a new UnsubscribeVehicleData object
@@ -411,43 +437,47 @@ public class UnsubscribeVehicleData extends RPCRequest {
}
/**
- * Sets a boolean value. If true, unsubscribes from FuelLevel data
+ * Sets the fuelLevel.
*
- * @param fuelLevel
- * a boolean value
+ * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
*/
+ @Deprecated
public void setFuelLevel(Boolean fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
}
/**
- * Gets a boolean value. If true, means the FuelLevel data has been
- * unsubscribed.
+ * Gets the fuelLevel.
*
- * @return Boolean -a Boolean value. If true, means the FuelLevel data has
- * been unsubscribed.
+ * @return Boolean The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
*/
+ @Deprecated
public Boolean getFuelLevel() {
return getBoolean(KEY_FUEL_LEVEL);
}
- /**
- * Sets a boolean value. If true, unsubscribes from fuelLevelState data
- *
- * @param fuelLevelState
- * a boolean value
- */
+ /**
+ * Sets the fuelRange.
+ *
+ * @param fuelLevelState The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
+ */
+ @Deprecated
public void setFuelLevelState(Boolean fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
}
- /**
- * Gets a boolean value. If true, means the fuelLevel_State data has been
- * unsubscribed.
- *
- * @return Boolean -a Boolean value. If true, means the fuelLevelState data
- * has been unsubscribed.
- */
+ /**
+ * Gets the fuelRange.
+ *
+ * @return Boolean The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
+ */
+ @Deprecated
public Boolean getFuelLevelState() {
return getBoolean(KEY_FUEL_LEVEL_STATE);
}
@@ -928,4 +958,24 @@ public class UnsubscribeVehicleData extends RPCRequest {
public Boolean getWindowStatus() {
return getBoolean(KEY_WINDOW_STATUS);
}
+
+ /**
+ * Sets the stabilityControlsStatus.
+ *
+ * @param stabilityControlsStatus See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setStabilityControlsStatus(Boolean stabilityControlsStatus) {
+ setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
+ }
+
+ /**
+ * Gets the stabilityControlsStatus.
+ *
+ * @return Boolean See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public Boolean getStabilityControlsStatus() {
+ return getBoolean(KEY_STABILITY_CONTROLS_STATUS);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
index 37b1f0c51..5abf391d1 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
@@ -47,7 +47,6 @@ import java.util.Hashtable;
public class UnsubscribeVehicleDataResponse extends RPCResponse {
public static final String KEY_SPEED = "speed";
public static final String KEY_RPM = "rpm";
- public static final String KEY_FUEL_LEVEL = "fuelLevel";
public static final String KEY_EXTERNAL_TEMPERATURE = "externalTemperature";
public static final String KEY_PRNDL = "prndl";
public static final String KEY_TIRE_PRESSURE = "tirePressure";
@@ -55,7 +54,6 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public static final String KEY_ENGINE_OIL_LIFE = "engineOilLife";
public static final String KEY_ODOMETER = "odometer";
public static final String KEY_GPS = "gps";
- public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
public static final String KEY_INSTANT_FUEL_CONSUMPTION = "instantFuelConsumption";
public static final String KEY_BELT_STATUS = "beltStatus";
public static final String KEY_BODY_INFORMATION = "bodyInformation";
@@ -77,6 +75,17 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public static final String KEY_HANDS_OFF_STEERING = "handsOffSteering";
public static final String KEY_WINDOW_STATUS = "windowStatus";
public static final String KEY_GEAR_STATUS = "gearStatus";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL = "fuelLevel";
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public static final String KEY_FUEL_LEVEL_STATE = "fuelLevel_State";
+ public static final String KEY_STABILITY_CONTROLS_STATUS = "stabilityControlsStatus";
/**
* Constructs a new UnsubscribeVehicleDataResponse object
@@ -153,17 +162,23 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_RPM);
}
/**
- * Sets Fuel Level
- * @param fuelLevel a VehicleDataResult related to Fuel Level
+ * Sets the fuelLevel.
+ *
+ * @param fuelLevel The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
*/
+ @Deprecated
public void setFuelLevel(VehicleDataResult fuelLevel) {
setParameters(KEY_FUEL_LEVEL, fuelLevel);
}
/**
- * Gets Fuel Level
- * @return a VehicleDataResult related to FuelLevel
+ * Gets the fuelLevel.
+ *
+ * @return VehicleDataResult The fuel level in the tank (percentage). This parameter is deprecated starting RPC Spec
+ * 7.0, please see fuelRange.
*/
@SuppressWarnings("unchecked")
+ @Deprecated
public VehicleDataResult getFuelLevel() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_FUEL_LEVEL);
}
@@ -171,6 +186,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
* Sets Fuel Level State
* @param fuelLevelState a VehicleDataResult related to FuelLevel State
*/
+ @Deprecated
public void setFuelLevelState(VehicleDataResult fuelLevelState) {
setParameters(KEY_FUEL_LEVEL_STATE, fuelLevelState);
}
@@ -178,6 +194,7 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
* Gets Fuel Level State
* @return a VehicleDataResult related to FuelLevel State
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public VehicleDataResult getFuelLevelState() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_FUEL_LEVEL_STATE);
@@ -445,18 +462,23 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
}
/**
- * Sets Fuel Range
- * @param fuelRange a VehicleDataResult related to the fuel range
+ * Sets the fuelRange.
+ *
+ * @param fuelRange The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
*/
public void setFuelRange(VehicleDataResult fuelRange) {
setParameters(KEY_FUEL_RANGE, fuelRange);
}
/**
- * Gets Fuel Range
- * @return a VehicleDataResult related to the fuel range
+ * Gets the fuelRange.
+ *
+ * @return VehicleDataResult The fuel type, estimated range in KM, fuel level/capacity and fuel level state for the
+ * vehicle. See struct FuelRange for details.
+ * @since SmartDeviceLink 5.0.0
*/
- @SuppressWarnings("unchecked")
public VehicleDataResult getFuelRange() {
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_FUEL_RANGE);
}
@@ -587,4 +609,24 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getGearStatus(){
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_GEAR_STATUS);
}
+
+ /**
+ * Gets the stabilityControlsStatus.
+ *
+ * @return VehicleDataResult See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public VehicleDataResult getStabilityControlsStatus() {
+ return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_STABILITY_CONTROLS_STATUS);
+ }
+
+ /**
+ * Sets the stabilityControlsStatus.
+ *
+ * @param stabilityControlsStatus See StabilityControlsStatus
+ * @since SmartDeviceLink 7.0.0
+ */
+ public void setStabilityControlsStatus(VehicleDataResult stabilityControlsStatus) {
+ setParameters(KEY_STABILITY_CONTROLS_STATUS, stabilityControlsStatus);
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/Version.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CapacityUnit.java
index 9b6f0d971..a8b3c4817 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/Version.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/CapacityUnit.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * Copyright (c) 2017 - 2020, SmartDeviceLink Consortium, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -13,9 +13,9 @@
* 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.
+ * 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
@@ -29,11 +29,29 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.proxy;
-
-import com.smartdevicelink.BuildConfig;
-
-@Deprecated
-public class Version {
- public static final String VERSION = BuildConfig.VERSION_NAME;
-}
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * @since SmartDeviceLink 7.0.0
+ */
+public enum CapacityUnit {
+ LITERS,
+
+ KILOWATTHOURS,
+
+ KILOGRAMS;
+
+ /**
+ * Convert String to CapacityUnit
+ *
+ * @param value String
+ * @return CapacityUnit
+ */
+ public static CapacityUnit valueForString(String value) {
+ try{
+ return valueOf(value);
+ }catch(Exception e){
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
index 7682e16f8..294d50f1e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
@@ -50,10 +50,12 @@ public enum VehicleDataType {
VEHICLEDATA_RPM,
/**
* Notifies FUELLEVELData may be subscribed
+ * until Smart Device Link 7.0
*/
VEHICLEDATA_FUELLEVEL,
/**
* Notifies FUELLEVEL_STATEData may be subscribed
+ * until Smart Device Link 7.0
*/
VEHICLEDATA_FUELLEVEL_STATE,
/**
@@ -172,6 +174,11 @@ public enum VehicleDataType {
* @since SmartDeviceLink 7.0.0
*/
VEHICLEDATA_HANDSOFFSTEERING,
+
+ /**
+ * @since SmartDeviceLink 7.0.0
+ */
+ VEHICLEDATA_STABILITYCONTROLSSTATUS,
/**
* @since SmartDeviceLink 7.0.0
*/
diff --git a/base/src/main/java/com/smartdevicelink/transport/ITransportListener.java b/base/src/main/java/com/smartdevicelink/transport/ITransportListener.java
deleted file mode 100644
index 46baf5296..000000000
--- a/base/src/main/java/com/smartdevicelink/transport/ITransportListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.transport;
-
-import com.smartdevicelink.protocol.SdlPacket;
-
-public interface ITransportListener {
- // Called to indicate and deliver a packet received from transport
- void onTransportPacketReceived(SdlPacket packet);
-
- // Called to indicate that transport connection was established
- void onTransportConnected();
-
- // Called to indicate that transport was disconnected (by either side)
- void onTransportDisconnected(String info);
-
- // Called to indicate that some error occurred on the transport
- void onTransportError(String info, Exception e);
-} // end-interface \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java b/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java
index 9b2eba9ed..19579c19b 100644
--- a/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java
+++ b/base/src/main/java/com/smartdevicelink/transport/TransportConstants.java
@@ -294,4 +294,14 @@ public class TransportConstants {
public static final String AOA_USB = "AOA_USB";
public static final String TCP_WIFI = "TCP_WIFI";
+
+ /**
+ * Broadcast action: sent when a USB accessory is attached.
+ *
+ * UsbManager.EXTRA_ACCESSORY extra contains UsbAccessory object that has
+ * been attached.
+ */
+ public static final String ACTION_USB_ACCESSORY_ATTACHED = "com.smartdevicelink.USB_ACCESSORY_ATTACHED";
+
+
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/file/FileManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/file/FileManager.java
index 959a9ced5..54896f273 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/file/FileManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/file/FileManager.java
@@ -36,8 +36,13 @@ import androidx.annotation.NonNull;
import com.smartdevicelink.managers.file.filetypes.SdlFile;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.PutFile;
+import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.FileUtls;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
/**
* <strong>FileManager</strong> <br>
*
@@ -94,6 +99,14 @@ public class FileManager extends BaseFileManager {
}else{
throw new IllegalArgumentException("File at path was empty");
}
+ }else if(file.getURI() != null){
+ // Use URI to upload file
+ byte[] data = contentsOfUri(file.getURI());
+ if(data != null){
+ putFile.setFileData(data);
+ }else{
+ throw new IllegalArgumentException("Uri was empty");
+ }
}else if(file.getFileData() != null){
// Use file data (raw bytes) to upload file
putFile.setFileData(file.getFileData());
@@ -110,4 +123,28 @@ public class FileManager extends BaseFileManager {
return putFile;
}
+
+ /**
+ * Helper method to take Uri and turn it into byte array
+ * @param uri Uri for desired file
+ * @return Resulting byte array
+ */
+ private byte[] contentsOfUri(URI uri){
+ InputStream is = null;
+ try{
+ is = uri.toURL().openStream();
+ return contentsOfInputStream(is);
+ } catch (IOException e){
+ DebugTool.logError(TAG, "Can't read from URI", e);
+ return null;
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java b/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
index 69bfb9238..a63c3e27b 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
@@ -38,6 +38,8 @@ import com.smartdevicelink.proxy.rpc.enums.ImageType;
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
import com.smartdevicelink.util.DebugTool;
+import java.net.URI;
+
/**
* A class that extends SdlFile, representing artwork (JPEG, PNG, or BMP) to be uploaded to core
*/
@@ -65,6 +67,17 @@ public class SdlArtwork extends SdlFile implements Cloneable{
* Creates a new instance of SdlArtwork
* @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
* @param fileType a FileType enum value representing the type of the file
+ * @param uri a URI value representing a file's location. Currently, it only supports local files
+ * @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
+ */
+ public SdlArtwork(String fileName, @NonNull FileType fileType, URI uri, boolean persistentFile) {
+ super(fileName, fileType, uri, persistentFile);
+ }
+
+ /**
+ * Creates a new instance of SdlArtwork
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
* @param data a byte array representing the data of the file
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java b/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
index 60b3f42e9..bb1c170d4 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
@@ -36,6 +36,7 @@ import androidx.annotation.NonNull;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
+import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -45,6 +46,7 @@ import java.security.NoSuchAlgorithmException;
public class SdlFile{
private String fileName;
private String filePath;
+ private URI uri;
private byte[] fileData;
private FileType fileType;
private boolean persistentFile;
@@ -76,6 +78,20 @@ public class SdlFile{
* Creates a new instance of SdlFile
* @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
* @param fileType a FileType enum value representing the type of the file
+ * @param uri a URI value representing a file's location. Currently, it only supports local files
+ * @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
+ */
+ public SdlFile(String fileName, @NonNull FileType fileType, URI uri, boolean persistentFile){
+ setName(fileName);
+ setType(fileType);
+ setURI(uri);
+ setPersistent(persistentFile);
+ }
+
+ /**
+ * Creates a new instance of SdlFile
+ * @param fileName a String value representing the name that will be used to store the file in the head unit. You can pass null if you want the library to auto generate the name
+ * @param fileType a FileType enum value representing the type of the file
* @param data a byte array representing the data of the file
* @param persistentFile a boolean value that indicates if the file is meant to persist between sessions / ignition cycles
*/
@@ -109,6 +125,8 @@ public class SdlFile{
this.shouldAutoGenerateName = true;
if (this.getFileData() != null) {
this.fileName = generateFileNameFromData(this.getFileData());
+ } else if (this.getURI() != null) {
+ this.fileName = generateFileNameFromUri(this.getURI());
} else if (this.getFilePath() != null) {
this.fileName = generateFileNameFromFilePath(this.getFilePath());
}
@@ -143,6 +161,25 @@ public class SdlFile{
}
/**
+ * Sets the uri of the file
+ * @param uri a URI value representing a file's location. Currently, it only supports local files
+ */
+ public void setURI(URI uri){
+ this.uri = uri;
+ if (shouldAutoGenerateName && uri != null) {
+ this.fileName = generateFileNameFromUri(uri);
+ }
+ }
+
+ /**
+ * Gets the uri of the file
+ * @return a URI value representing a file's location. Currently, it only supports local files
+ */
+ public URI getURI(){
+ return uri;
+ }
+
+ /**
* Sets the byte array that represents the content of the file
* @param data a byte array representing the data of the file
*/
@@ -262,6 +299,15 @@ public class SdlFile{
}
/**
+ * Generates a file name from uri by hashing the uri string and returning the last 16 chars
+ * @param uri a URI value representing a file's location
+ * @return a String value representing the name that will be used to store the file in the head unit
+ */
+ private String generateFileNameFromUri(@NonNull URI uri) {
+ return generateFileNameFromData(uri.toString().getBytes());
+ }
+
+ /**
* Used to compile hashcode for SdlFile for use to compare in equals method
* @return Custom hashcode of SdlFile variables
*/
@@ -269,11 +315,12 @@ public class SdlFile{
public int hashCode() {
int result = 1;
result += ((getName() == null) ? 0 : Integer.rotateLeft(getName().hashCode(), 1));
- result += ((getFilePath() == null) ? 0 : Integer.rotateLeft(getFilePath().hashCode(), 2));
- result += ((getFileData() == null) ? 0 : Integer.rotateLeft(getFileData().hashCode(), 3));
- result += ((getType() == null) ? 0 : Integer.rotateLeft(getType().hashCode(), 4));
- result += Integer.rotateLeft(Boolean.valueOf(isStaticIcon()).hashCode(), 5);
- result += Integer.rotateLeft(Boolean.valueOf(isPersistent()).hashCode(), 6);
+ result += ((getURI() == null) ? 0 : Integer.rotateLeft(getURI().hashCode(), 2));
+ result += ((getFilePath() == null) ? 0 : Integer.rotateLeft(getFilePath().hashCode(), 3));
+ result += ((getFileData() == null) ? 0 : Integer.rotateLeft(getFileData().hashCode(), 4));
+ result += ((getType() == null) ? 0 : Integer.rotateLeft(getType().hashCode(), 5));
+ result += Integer.rotateLeft(Boolean.valueOf(isStaticIcon()).hashCode(), 6);
+ result += Integer.rotateLeft(Boolean.valueOf(isPersistent()).hashCode(), 7);
return result;
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
index 961e9e196..b84734a52 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java
@@ -45,10 +45,10 @@ import com.smartdevicelink.proxy.rpc.enums.FileType;
*/
class TextAndGraphicManager extends BaseTextAndGraphicManager {
- TextAndGraphicManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager, @NonNull SoftButtonManager softButtonManager) {
+ TextAndGraphicManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager, @NonNull SoftButtonManager softButtonManager) {
super(internalInterface, fileManager, softButtonManager);
}
-
+
@Override
SdlArtwork getBlankArtwork(){
if (blankArtwork == null){