summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Kast <julian@livio.com>2020-08-11 11:14:27 -0400
committerJulian Kast <julian@livio.com>2020-08-11 11:14:27 -0400
commit8926e73e37fe85e3aeb99896f5adb68f3d94b5a7 (patch)
treed65b1b0883fc257c395e9c5cb0e43a544b6c26c0
parent7bf204021ac1b723c2449c1f98ecb313831c0302 (diff)
parent9af716055b16c1de3a4e274a8590166d9d642555 (diff)
downloadsdl_android-8926e73e37fe85e3aeb99896f5adb68f3d94b5a7.tar.gz
Merge branch 'develop' into AndroidX
# Conflicts: # android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java # javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java77
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedLayoutTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java9
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java65
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java47
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java117
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java26
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java237
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/SdlConnection/BaseSdlSession.java189
-rw-r--r--base/src/main/java/com/smartdevicelink/SdlConnection/ISdlSessionListener.java (renamed from base/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java)91
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java177
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java92
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java65
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java68
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java72
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java66
-rw-r--r--base/src/main/java/com/smartdevicelink/security/AbstractSdlSecurityBase.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java2
l---------baseAndroid/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java1
l---------baseAndroid/src/main/java/com/smartdevicelink/SdlConnection/ISdlSessionListener.java1
l---------baseAndroid/src/main/java/com/smartdevicelink/protocol/IProtocolListener.java1
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java69
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java3
28 files changed, 594 insertions, 911 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
index 6c270a7be..e05767aac 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java
@@ -10,7 +10,7 @@ import com.smartdevicelink.test.SampleRpc;
import com.smartdevicelink.test.SdlUnitTestContants;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
-import com.smartdevicelink.transport.RouterServiceValidator;
+import com.smartdevicelink.util.Version;
import junit.framework.Assert;
@@ -20,13 +20,11 @@ import org.junit.runner.RunWith;
import java.io.ByteArrayOutputStream;
import java.lang.reflect.Method;
-import java.util.List;
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.Mockito.mock;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
@@ -49,8 +47,7 @@ public class SdlProtocolTests {
public boolean didReceive(){
return didReceive;
}
- @Override
- public void onProtocolMessageBytesToSend(SdlPacket packet) {}
+
@Override
public void onProtocolMessageReceived(ProtocolMessage msg) {
didReceive = true;
@@ -58,42 +55,62 @@ public class SdlProtocolTests {
Log.d("DidReceiveListener", "Function Id: " + msg.getFunctionID());
Log.d("DidReceiveListener", "JSON Size: " + msg.getJsonSize());
}
+
@Override
- public void onProtocolSessionStarted(SessionType sessionType,byte sessionID, byte version, String correlationID, int hashID,boolean isEncrypted){}
- @Override
- public void onProtocolSessionNACKed(SessionType sessionType,byte sessionID, byte version, String correlationID, List<String> rejectedParams) {}
- @Override
- public void onProtocolSessionEnded(SessionType sessionType,byte sessionID, String correlationID) {}
- @Override
- public void onProtocolSessionEndedNACKed(SessionType sessionType,byte sessionID, String correlationID) {}
- @Override
- public void onProtocolHeartbeat(SessionType sessionType, byte sessionID) {}
- @Override
- public void onProtocolHeartbeatACK(SessionType sessionType,byte sessionID) {}
- @Override
- public void onProtocolServiceDataACK(SessionType sessionType,int dataSize, byte sessionID) {}
- @Override
- public void onResetOutgoingHeartbeat(SessionType sessionType,byte sessionID) {}
+ public void onServiceStarted(SdlPacket packet, SessionType serviceType, int sessionID, Version version, boolean isEncrypted) {
+
+ }
+
@Override
- public void onResetIncomingHeartbeat(SessionType sessionType,byte sessionID) {}
+ public void onServiceEnded(SdlPacket packet, SessionType serviceType, int sessionID) {
+
+ }
+
@Override
- public void onProtocolError(String info, Exception e) {}
+ public void onServiceError(SdlPacket packet, SessionType serviceType, int sessionID, String error) {
+
+ }
+
@Override
- public byte getSessionId() {return 0;}
+ public void onProtocolError(String info, Exception e) {
+
+ }
+
@Override
- public void shutdown(String info) {}
+ public int getSessionId() {
+ return 0;
+ }
+
@Override
- public void onTransportDisconnected(String info, boolean altTransportAvailable, BaseTransportConfig transportConfig) {}
+ public void shutdown(String info) {
+
+ }
+
@Override
- public SdlSecurityBase getSdlSecurity() {return null;}
+ public void onTransportDisconnected(String info, boolean altTransportAvailable, BaseTransportConfig transportConfig) {
+
+ }
+
@Override
- public VideoStreamingParameters getDesiredVideoParams() {return null; }
+ public SdlSecurityBase getSdlSecurity() {
+ return null;
+ }
+
@Override
- public void setAcceptedVideoParams(VideoStreamingParameters acceptedVideoParams) {}
+ public VideoStreamingParameters getDesiredVideoParams() {
+ return null;
+ }
+
@Override
- public void stopStream(SessionType serviceType) {}
+ public void setAcceptedVideoParams(VideoStreamingParameters acceptedVideoParams) {
+
+ }
+
@Override
- public void onAuthTokenReceived(String token){}
+ public void onAuthTokenReceived(String authToken) {
+
+ }
+
};
DidReceiveListener onProtocolMessageReceivedListener = new DidReceiveListener();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java
index 85c74e8e4..af0881ad6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppHmiTypeTests.java
@@ -42,6 +42,8 @@ public class AppHmiTypeTests extends TestCase {
AppHMIType enumSystem = AppHMIType.valueForString(example);
example = "REMOTE_CONTROL";
AppHMIType enumRemoteControl = AppHMIType.valueForString(example);
+ example = "WEB_VIEW";
+ AppHMIType enumWebView = AppHMIType.valueForString(example);
assertNotNull("DEFAULT returned null", enumDefault);
assertNotNull("COMMUNICATION returned null", enumCommunication);
@@ -55,6 +57,7 @@ public class AppHmiTypeTests extends TestCase {
assertNotNull("TESTING returned null", enumTesting);
assertNotNull("SYSTEM returned null", enumSystem);
assertNotNull("REMOTE_CONTROL returned null", enumRemoteControl);
+ assertNotNull("WEB_VIEW returned null", enumWebView);
}
/**
@@ -104,6 +107,7 @@ public class AppHmiTypeTests extends TestCase {
enumTestList.add(AppHMIType.TESTING);
enumTestList.add(AppHMIType.SYSTEM);
enumTestList.add(AppHMIType.REMOTE_CONTROL);
+ enumTestList.add(AppHMIType.WEB_VIEW);
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/AppInterfaceUnregisteredReasonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java
index cc59924d4..bf1d5e65b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java
@@ -44,6 +44,8 @@ public class AppInterfaceUnregisteredReasonTests extends TestCase {
AppInterfaceUnregisteredReason enumProtocolViolation = AppInterfaceUnregisteredReason.valueForString(example);
example = "UNSUPPORTED_HMI_RESOURCE";
AppInterfaceUnregisteredReason enumUnsupportedHMIResource = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "RESOURCE_CONSTRAINT";
+ AppInterfaceUnregisteredReason enumResourceConstraint = AppInterfaceUnregisteredReason.valueForString(example);
assertNotNull("USER_EXIT returned null", enumUserExit);
assertNotNull("IGNITION_OFF returned null", enumIgnitionOff);
@@ -58,6 +60,7 @@ public class AppInterfaceUnregisteredReasonTests extends TestCase {
assertNotNull("APP_UNAUTHORIZED returned null", enumAppAuthorized);
assertNotNull("PROTOCOL_VIOLATION returned null", enumProtocolViolation);
assertNotNull("UNSUPPORTED_HMI_RESOURCE returned null", enumUnsupportedHMIResource);
+ assertNotNull("RESOURCE_CONSTRAINT returned null", enumResourceConstraint);
}
/**
@@ -108,6 +111,7 @@ public class AppInterfaceUnregisteredReasonTests extends TestCase {
enumTestList.add(AppInterfaceUnregisteredReason.APP_UNAUTHORIZED);
enumTestList.add(AppInterfaceUnregisteredReason.PROTOCOL_VIOLATION);
enumTestList.add(AppInterfaceUnregisteredReason.UNSUPPORTED_HMI_RESOURCE);
+ enumTestList.add(AppInterfaceUnregisteredReason.RESOURCE_CONSTRAINT);
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/PredefinedLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedLayoutTests.java
index 26b32d08b..4c5526eec 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedLayoutTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedLayoutTests.java
@@ -58,6 +58,8 @@ public class PredefinedLayoutTests extends TestCase {
PredefinedLayout double_graphic_with_softbuttons = PredefinedLayout.valueForString(example);
example = "LARGE_GRAPHIC_ONLY";
PredefinedLayout large_graphic_only = PredefinedLayout.valueForString(example);
+ example = "WEB_VIEW";
+ PredefinedLayout web_view = PredefinedLayout.valueForString(example);
assertNotNull("DEFAULT returned null", defaultenum);
assertNotNull("MEDIA returned null", media);
@@ -79,6 +81,7 @@ public class PredefinedLayoutTests extends TestCase {
assertNotNull("LARGE_GRAPHIC_WITH_SOFTBUTTONS returned null", large_graphic_with_softbuttons);
assertNotNull("DOUBLE_GRAPHIC_WITH_SOFTBUTTONS returned null", double_graphic_with_softbuttons);
assertNotNull("LARGE_GRAPHIC_ONLY returned null", large_graphic_only);
+ assertNotNull("WEB_VIEW returned null", web_view);
}
/**
@@ -137,6 +140,7 @@ public class PredefinedLayoutTests extends TestCase {
enumTestList.add(PredefinedLayout.LARGE_GRAPHIC_WITH_SOFTBUTTONS);
enumTestList.add(PredefinedLayout.DOUBLE_GRAPHIC_WITH_SOFTBUTTONS);
enumTestList.add(PredefinedLayout.LARGE_GRAPHIC_ONLY);
+ enumTestList.add(PredefinedLayout.WEB_VIEW);
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/SdlDisconnectedReasonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java
index d4c22354e..3f2ee110d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SdlDisconnectedReasonTests.java
@@ -64,7 +64,9 @@ public class SdlDisconnectedReasonTests extends TestCase {
SdlDisconnectedReason enumLegacyMode = SdlDisconnectedReason.valueForString(example);
example = "RPC_SESSION_ENDED";
SdlDisconnectedReason enumRpcSessionEnded = SdlDisconnectedReason.valueForString(example);
-
+ example = "RESOURCE_CONSTRAINT";
+ SdlDisconnectedReason resourceConstraint = SdlDisconnectedReason.valueForString(example);
+
assertNotNull("USER_EXIT returned null", enumUserExit);
assertNotNull("IGNITION_OFF returned null", enumIgnitionOff);
assertNotNull("BLUETOOTH_OFF returned null", enumBluetoothOff);
@@ -87,6 +89,7 @@ public class SdlDisconnectedReasonTests extends TestCase {
assertNotNull("GENERIC_ERROR returned null", enumGenericError);
assertNotNull("LEGACY_BLUETOOTH_MODE_ENABLED returned null", enumLegacyMode);
assertNotNull("RPC_SESSION_ENDED returned null", enumRpcSessionEnded);
+ assertNotNull("RESOURCE_CONSTRAINT returned null", resourceConstraint);
}
/**
@@ -149,6 +152,7 @@ public class SdlDisconnectedReasonTests extends TestCase {
enumTestList.add(SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST);
enumTestList.add(SdlDisconnectedReason.MINIMUM_PROTOCOL_VERSION_HIGHER_THAN_SUPPORTED);
enumTestList.add(SdlDisconnectedReason.MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED);
+ enumTestList.add(SdlDisconnectedReason.RESOURCE_CONSTRAINT);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
@@ -156,7 +160,7 @@ public class SdlDisconnectedReasonTests extends TestCase {
/**
* Verifies the valid returns of the conversion method,
- * {@link com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason#convertAppInterfaceunregisteredReason(AppInterfaceUnregisteredReason)}
+ * {@link com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason#convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason)}
*/
public void testConvertMethod () {
assertEquals(TestValues.MATCH, SdlDisconnectedReason.DEFAULT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.APP_UNAUTHORIZED));
@@ -170,6 +174,7 @@ public class SdlDisconnectedReasonTests extends TestCase {
assertEquals(TestValues.MATCH, SdlDisconnectedReason.TOO_MANY_REQUESTS, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.TOO_MANY_REQUESTS));
assertEquals(TestValues.MATCH, SdlDisconnectedReason.USB_DISCONNECTED, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USB_DISCONNECTED));
assertEquals(TestValues.MATCH, SdlDisconnectedReason.USER_EXIT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.USER_EXIT));
+ assertEquals(TestValues.MATCH, SdlDisconnectedReason.RESOURCE_CONSTRAINT, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(AppInterfaceUnregisteredReason.RESOURCE_CONSTRAINT));
assertNull(TestValues.MATCH, SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(null));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
index 61ec6000b..aeb73e3de 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/security/SdlSecurityBaseTest.java
@@ -2,16 +2,12 @@ package com.smartdevicelink.test.security;
import androidx.test.ext.junit.runners.AndroidJUnit4;
-import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
import com.smartdevicelink.SdlConnection.SdlSession;
-import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.test.TestValues;
-import com.smartdevicelink.transport.BTTransportConfig;
-import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.test.streaming.MockInterfaceBroker;
import com.smartdevicelink.transport.MultiplexTransportConfig;
-import com.smartdevicelink.transport.TCPTransportConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -61,65 +57,6 @@ public class SdlSecurityBaseTest {
startServiceList = list;
}
}
-
- class MockInterfaceBroker implements ISdlConnectionListener {
- public MockInterfaceBroker () { }
- @Override
- public void onTransportDisconnected(String info) {
-
- }
-
- @Override
- public void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
-
- }
-
- @Override
- public void onTransportError(String info, Exception e) {
-
- }
- @Override
- public void onProtocolMessageReceived(ProtocolMessage msg) {
-
- }
- @Override
- public void onProtocolSessionStartedNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
-
- }
- @Override
- public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, int hashID,
- boolean isEncrypted) {
-
- }
- @Override
- public void onProtocolSessionEnded(SessionType sessionType, byte sessionID,
- String correlationID) {
-
- }
- @Override
- public void onProtocolSessionEndedNACKed(SessionType sessionType,
- byte sessionID, String correlationID) {
-
- }
- @Override
- public void onProtocolError(String info, Exception e) {
-
- }
- @Override
- public void onHeartbeatTimedOut(byte sessionID) {
-
- }
- @Override
- public void onProtocolServiceDataACK(SessionType sessionType, int dataSize,
- byte sessionID) {
-
- }
- @Override
- public void onAuthTokenReceived(String token, byte bytes){}
-
- }
@Test
public void testMakeListSetAndGet(){
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
index f3bcc38ee..1c7005012 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/MockInterfaceBroker.java
@@ -1,22 +1,16 @@
package com.smartdevicelink.test.streaming;
-import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
-import com.smartdevicelink.protocol.ProtocolMessage;
-import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.SdlConnection.ISdlSessionListener;
+import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.transport.BaseTransportConfig;
-
-import java.util.List;
+import com.smartdevicelink.util.Version;
/**
* This is a mock class for testing the following :
* {@link com.smartdevicelink.streaming.AbstractPacketizer}
*/
-public class MockInterfaceBroker implements ISdlConnectionListener {
+public class MockInterfaceBroker implements ISdlSessionListener {
public MockInterfaceBroker () { }
- @Override
- public void onTransportDisconnected(String info) {
-
- }
@Override
public void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
@@ -24,47 +18,22 @@ public class MockInterfaceBroker implements ISdlConnectionListener {
}
@Override
- public void onTransportError(String info, Exception e) {
+ public void onRPCMessageReceived(RPCMessage rpcMessage) {
}
- @Override
- public void onProtocolMessageReceived(ProtocolMessage msg) {
- }
@Override
- public void onProtocolSessionStartedNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
+ public void onSessionStarted(int sessionID, Version version) {
}
- @Override
- public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, int hashID,
- boolean isEncrypted) {
- }
@Override
- public void onProtocolSessionEnded(SessionType sessionType, byte sessionID,
- String correlationID) {
+ public void onSessionEnded(int sessionID) {
}
- @Override
- public void onProtocolSessionEndedNACKed(SessionType sessionType,
- byte sessionID, String correlationID) {
- }
- @Override
- public void onProtocolError(String info, Exception e) {
-
- }
@Override
- public void onHeartbeatTimedOut(byte sessionID) {
+ public void onAuthTokenReceived(String authToken, int sessionID) {
}
- @Override
- public void onProtocolServiceDataACK(SessionType sessionType, int dataSize,
- byte sessionID) {
-
- }
- @Override
- public void onAuthTokenReceived(String token, byte bytes){}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
index 3c5c063c7..f4bdb7136 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
@@ -59,7 +59,6 @@ import com.smartdevicelink.util.Version;
import java.io.IOException;
import java.lang.ref.WeakReference;
-import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
public class SdlSession extends BaseSdlSession {
@@ -69,9 +68,8 @@ public class SdlSession extends BaseSdlSession {
MediaStreamingStatus mediaStreamingStatus;
boolean requiresAudioSupport = false;
- public SdlSession(ISdlConnectionListener listener, MultiplexTransportConfig config) {
+ public SdlSession(ISdlSessionListener listener, MultiplexTransportConfig config) {
super(listener, config);
- this.transportConfig = config;
if (config != null) {
contextWeakReference = new WeakReference<>(config.getContext());
this.requiresAudioSupport = Boolean.TRUE.equals(config.requiresAudioSupport()); //handle null case
@@ -81,9 +79,8 @@ public class SdlSession extends BaseSdlSession {
}
- public SdlSession(ISdlConnectionListener listener, TCPTransportConfig config) {
+ public SdlSession(ISdlSessionListener listener, TCPTransportConfig config) {
super(listener, config);
- this.transportConfig = config;
this.sessionListener = listener;
}
@@ -155,88 +152,68 @@ public class SdlSession extends BaseSdlSession {
/* ***********************************************************************************************************************************************************************
- * ***************************************************************** IProtocol Listener ********************************************************************************
+ * ***************************************************************** ISdlProtocol Listener ********************************************************************************
*************************************************************************************************************************************************************************/
@Override
- public void onProtocolMessageBytesToSend(SdlPacket packet) {
- sdlProtocol.sendPacket(packet);
- }
-
- @Override
- public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
+ public void onServiceStarted(SdlPacket packet, SessionType serviceType, int sessionID, Version version, boolean isEncrypted) {
+ DebugTool.logInfo(TAG, serviceType.getName() + " service started");
- DebugTool.logInfo(TAG, "Protocol session started");
-
- this.sessionId = sessionID;
- if (sessionType.eq(SessionType.RPC)) {
- sessionHashId = hashID;
+ if (serviceType != null && serviceType.eq(SessionType.RPC) && this.sessionId == -1) {
+ this.sessionId = sessionID;
+ this.sessionListener.onSessionStarted(sessionID, version);
}
if (isEncrypted) {
- encryptedServices.addIfAbsent(sessionType);
+ encryptedServices.addIfAbsent(serviceType);
}
- this.sessionListener.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, hashID, isEncrypted);
- if (serviceListeners != null && serviceListeners.containsKey(sessionType)) {
- CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
+ if (serviceListeners != null && serviceListeners.containsKey(serviceType)) {
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(serviceType);
for (ISdlServiceListener listener : listeners) {
- listener.onServiceStarted(this, sessionType, isEncrypted);
+ listener.onServiceStarted(this, serviceType, isEncrypted);
}
}
-
- }
-
- public void onProtocolSessionStartedNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
- onProtocolSessionNACKed(sessionType, sessionID, version, correlationID, rejectedParams);
}
@Override
- public void onProtocolSessionNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
- this.sessionListener.onProtocolSessionStartedNACKed(sessionType,
- sessionID, version, correlationID, rejectedParams);
- if (serviceListeners != null && serviceListeners.containsKey(sessionType)) {
- CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
- if (listeners != null) {
- for (ISdlServiceListener listener : listeners) {
- listener.onServiceError(this, sessionType, "Start " + sessionType.toString() + " Service NAKed");
- }
- }
+ public void onServiceEnded(SdlPacket packet, SessionType serviceType, int sessionID) {
+
+ if (SessionType.RPC.equals(serviceType)) {
+ this.sessionListener.onSessionEnded(sessionID);
+ } else if (SessionType.NAV.equals(serviceType)) {
+ stopVideoStream();
+ } else if (SessionType.PCM.equals(serviceType)) {
+ stopAudioStream();
}
- }
- @Override
- public void onProtocolSessionEnded(SessionType sessionType, byte sessionID,
- String correlationID) {
- this.sessionListener.onProtocolSessionEnded(sessionType, sessionID, correlationID);
- if (serviceListeners != null && serviceListeners.containsKey(sessionType)) {
- CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
+ if (serviceListeners != null && serviceListeners.containsKey(serviceType)) {
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(serviceType);
for (ISdlServiceListener listener : listeners) {
- listener.onServiceEnded(this, sessionType);
+ listener.onServiceEnded(this, serviceType);
}
}
- encryptedServices.remove(sessionType);
+ encryptedServices.remove(serviceType);
}
@Override
- public void onProtocolSessionEndedNACKed(SessionType sessionType,
- byte sessionID, String correlationID) {
- this.sessionListener.onProtocolSessionEndedNACKed(sessionType, sessionID, correlationID);
- if (serviceListeners != null && serviceListeners.containsKey(sessionType)) {
- CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
+ public void onServiceError(SdlPacket packet, SessionType serviceType, int sessionID, String error) {
+ if (SessionType.NAV.equals(serviceType)) {
+ stopVideoStream();
+ } else if (SessionType.PCM.equals(serviceType)) {
+ stopAudioStream();
+ }
+
+ if (serviceListeners != null && serviceListeners.containsKey(serviceType)) {
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(serviceType);
for (ISdlServiceListener listener : listeners) {
- listener.onServiceError(this, sessionType, "End " + sessionType.toString() + " Service NACK'ed");
+ listener.onServiceError(this, serviceType, "End " + serviceType.toString() + " Service NACK'ed");
}
}
}
- /* Not supported methods from IProtocolListener */
@Override
- public void onHeartbeatTimedOut(byte sessionId) { /* Not supported */}
-
- @Override
- public void onAuthTokenReceived(String authToken, byte sessionID) {/* Do nothing */ }
+ public void onAuthTokenReceived(String authToken) {/* Do nothing */ }
/* ***********************************************************************************************************************************************************************
* ***************************************************************** Fix after initial refactor *********************************************************************************
@@ -273,13 +250,13 @@ public class SdlSession extends BaseSdlSession {
try {
switch (protocol) {
case RAW: {
- videoPacketizer = new StreamPacketizer(streamListener, null, SessionType.NAV, this.sessionId, this);
+ videoPacketizer = new StreamPacketizer(streamListener, null, SessionType.NAV, (byte) this.sessionId, this);
videoPacketizer.start();
return (IVideoStreamListener) videoPacketizer;
}
case RTP: {
//FIXME why is this not an extension of StreamPacketizer?
- videoPacketizer = new RTPH264Packetizer(streamListener, SessionType.NAV, this.sessionId, this);
+ videoPacketizer = new RTPH264Packetizer(streamListener, SessionType.NAV, (byte) this.sessionId, this);
videoPacketizer.start();
return (IVideoStreamListener) videoPacketizer;
}
@@ -294,7 +271,7 @@ public class SdlSession extends BaseSdlSession {
public IAudioStreamListener startAudioStream() {
try {
- audioPacketizer = new StreamPacketizer(streamListener, null, SessionType.PCM, this.sessionId, this);
+ audioPacketizer = new StreamPacketizer(streamListener, null, SessionType.PCM, (byte) this.sessionId, this);
audioPacketizer.start();
return audioPacketizer;
} catch (IOException e) {
@@ -303,24 +280,6 @@ public class SdlSession extends BaseSdlSession {
}
- @Override
- public void stopStream(SessionType serviceType) {
- if (SessionType.NAV.equals(serviceType)) {
- stopVideoStream();
- } else if (SessionType.PCM.equals(serviceType)) {
- stopAudioStream();
- }
- // Notify any listeners of the service being ended
- if (serviceListeners != null && serviceListeners.containsKey(serviceType)) {
- CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(serviceType);
- if (listeners != null && listeners.size() > 0) {
- for (ISdlServiceListener listener : listeners) {
- listener.onServiceEnded(this, serviceType);
- }
- }
- }
- }
-
public boolean stopVideoStream() {
if (videoPacketizer != null) {
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 8304405ea..73757292b 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
@@ -93,9 +93,9 @@ public class LifecycleManager extends BaseLifecycleManager {
}
if (_transportConfig != null && _transportConfig.getTransportType().equals(TransportType.MULTIPLEX)) {
- this.session = new SdlSession(sdlConnectionListener, (MultiplexTransportConfig) _transportConfig);
+ this.session = new SdlSession(sdlSessionListener, (MultiplexTransportConfig) _transportConfig);
} else if (_transportConfig != null && _transportConfig.getTransportType().equals(TransportType.TCP)) {
- this.session = new SdlSession(sdlConnectionListener, (TCPTransportConfig) _transportConfig);
+ this.session = new SdlSession(sdlSessionListener, (TCPTransportConfig) _transportConfig);
} else {
DebugTool.logError(TAG,"Unable to create session for transport type");
}
@@ -141,15 +141,6 @@ public class LifecycleManager extends BaseLifecycleManager {
}
@Override
- void onServiceStarted(SessionType sessionType) {
- super.onServiceStarted(sessionType);
- if (sessionType.eq(SessionType.NAV)) {
- videoServiceStartResponseReceived = true;
- videoServiceStartResponse = true;
- }
- }
-
- @Override
void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
super.onTransportDisconnected(info, availablePrimary, transportConfig);
if (availablePrimary) {
@@ -161,15 +152,6 @@ public class LifecycleManager extends BaseLifecycleManager {
}
}
- @Override
- void onStartServiceNACKed(SessionType sessionType) {
- super.onStartServiceNACKed(sessionType);
- if (sessionType.eq(SessionType.NAV)) {
- videoServiceStartResponseReceived = true;
- videoServiceStartResponse = false;
- }
- }
-
/**
* 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.
@@ -226,7 +208,7 @@ public class LifecycleManager extends BaseLifecycleManager {
videoServiceStartResponse = false;
addVideoServiceListener();
- session.startService(SessionType.NAV, session.getSessionId(), isEncrypted);
+ session.startService(SessionType.NAV, isEncrypted);
}
}
@@ -289,7 +271,7 @@ public class LifecycleManager extends BaseLifecycleManager {
DebugTool.logWarning(TAG, "Connection is not available.");
return;
}
- session.startService(SessionType.PCM, session.getSessionId(), isEncrypted);
+ session.startService(SessionType.PCM, isEncrypted);
}
/**
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 7763f7cfd..6277bb57d 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
@@ -40,8 +40,7 @@ import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
-import android.os.TransactionTooLargeException;
-import androidx.annotation.NonNull;
+import android.support.annotation.NonNull;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.SparseArray;
@@ -54,7 +53,7 @@ import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.BuildConfig;
import com.smartdevicelink.Dispatcher.IDispatchingStrategy;
import com.smartdevicelink.Dispatcher.ProxyMessageDispatcher;
-import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
+import com.smartdevicelink.SdlConnection.ISdlSessionListener;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.encoder.VirtualDisplayEncoder;
import com.smartdevicelink.exception.SdlException;
@@ -148,7 +147,6 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
-import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -357,7 +355,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public void startVideoService(VideoStreamingParameters parameters, boolean encrypted) {
if(isConnected()){
sdlSession.setDesiredVideoParams(parameters);
- sdlSession.startService(SessionType.NAV,sdlSession.getSessionId(),encrypted);
+ sdlSession.startService(SessionType.NAV,encrypted);
addNavListener();
}
}
@@ -365,13 +363,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void stopVideoService() {
if(isConnected()){
- sdlSession.endService(SessionType.NAV,sdlSession.getSessionId());
+ sdlSession.endService(SessionType.NAV);
}
}
@Override public void stopAudioService() {
if(isConnected()){
- sdlSession.endService(SessionType.PCM,sdlSession.getSessionId());
+ sdlSession.endService(SessionType.PCM);
}
}
@@ -520,7 +518,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void startAudioService(boolean encrypted) {
if(isConnected()){
- sdlSession.startService(SessionType.PCM,sdlSession.getSessionId(),encrypted);
+ sdlSession.startService(SessionType.PCM,encrypted);
}
}
@@ -582,21 +580,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
// Private Class to Interface with SdlConnection
- private class SdlInterfaceBroker implements ISdlConnectionListener {
-
- @Override
- public void onTransportDisconnected(String info) {
- // proxyOnTransportDisconnect is called to alert the proxy that a requested
- // disconnect has completed
- notifyPutFileStreamError(null, info);
-
- //if (!_advancedLifecycleManagementEnabled) {
- // If original model, notify app the proxy is closed so it will delete and reinstanciate
- DebugTool.logInfo(TAG, "notifying proxy of closed");
- notifyProxyClosed(info, new SdlException("Transport disconnected.", SdlExceptionCause.SDL_UNAVAILABLE), SdlDisconnectedReason.TRANSPORT_DISCONNECT);
- //}// else If ALM, nothing is required to be done here
-
- }
+ private class SdlInterfaceBroker implements ISdlSessionListener {
@Override
public void onTransportDisconnected(String info, boolean altTransportAvailable, BaseTransportConfig transportConfig) {
@@ -612,198 +596,27 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
- @Override
- public void onTransportError(String info, Exception e) {
- DebugTool.logError(TAG, "Transport failure: " + info, e);
-
- notifyPutFileStreamError(e, info);
-
- if (_advancedLifecycleManagementEnabled) {
- // Cycle the proxy
- if(false){ //FIXME
- cycleProxy(SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED);
-
- }else{
- cycleProxy(SdlDisconnectedReason.TRANSPORT_ERROR);
- }
- } else {
- notifyProxyClosed(info, e, SdlDisconnectedReason.TRANSPORT_ERROR);
- }
- }
@Override
- public void onProtocolMessageReceived(ProtocolMessage msg) {
+ public void onRPCMessageReceived(RPCMessage rpcMessage) {
- // AudioPathThrough is coming WITH BulkData but WITHOUT JSON Data
- // Policy Snapshot is coming WITH BulkData and WITH JSON Data
- if ((msg.getData() != null && msg.getData().length > 0) ||
- (msg.getBulkData() != null && msg.getBulkData().length > 0)) {
- queueIncomingMessage(msg);
- }
}
@Override
- public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionStarted");
- updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
- updateBroadcastIntent(sendIntent, "COMMENT2", " ServiceType: " + sessionType.getName());
- updateBroadcastIntent(sendIntent, "COMMENT3", " Encrypted: " + isEncrypted);
- sendBroadcastIntent(sendIntent);
-
- if(sdlSession!= null){
- setProtocolVersion(sdlSession.getProtocolVersion());
- }else{
- setProtocolVersion(new com.smartdevicelink.util.Version(version,0,0));
- }
-
-
- if (minimumProtocolVersion != null && minimumProtocolVersion.isNewerThan(getProtocolVersion()) == 1){
- DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum protocol version %s is greater than the supported protocol version %s", minimumProtocolVersion, getProtocolVersion()));
- try {
- disposeInternal(SdlDisconnectedReason.MINIMUM_PROTOCOL_VERSION_HIGHER_THAN_SUPPORTED);
- } catch (SdlException e) {
- e.printStackTrace();
- }
- return;
- }
-
-
- if (sessionType.eq(SessionType.RPC)) {
-
- if (!isEncrypted)
- {
- if ( (_transportConfig.getHeartBeatTimeout() != Integer.MAX_VALUE) && (version > 2))
- {
- HeartbeatMonitor outgoingHeartbeatMonitor = new HeartbeatMonitor();
- outgoingHeartbeatMonitor.setInterval(_transportConfig.getHeartBeatTimeout());
- //sdlSession.setOutgoingHeartbeatMonitor(outgoingHeartbeatMonitor);
-
- HeartbeatMonitor incomingHeartbeatMonitor = new HeartbeatMonitor();
- incomingHeartbeatMonitor.setInterval(_transportConfig.getHeartBeatTimeout());
- //sdlSession.setIncomingHeartbeatMonitor(incomingHeartbeatMonitor);
- }
-
- startRPCProtocolSession();
- }
- else
- {
- RPCProtectedServiceStarted();
- }
- } else if (sessionType.eq(SessionType.NAV)) {
- NavServiceStarted();
- } else if (sessionType.eq(SessionType.PCM)) {
- AudioServiceStarted();
- } else if (sessionType.eq(SessionType.RPC)){
- cycleProxy(SdlDisconnectedReason.RPC_SESSION_ENDED);
- }
- else if (protocolVersion!= null && protocolVersion.getMajor() > 1) {
- //If version is 2 or above then don't need to specify a Session Type
- startRPCProtocolSession();
- } //else{} Handle other protocol session types here
+ public void onSessionStarted(int sessionID, Version version) {
}
@Override
- public void onProtocolSessionStartedNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
- OnServiceNACKed message = new OnServiceNACKed(sessionType);
- queueInternalMessage(message);
-
- if (sessionType.eq(SessionType.NAV)) {
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionStartedNACKed");
- updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
- updateBroadcastIntent(sendIntent, "COMMENT2", " NACK ServiceType: " + sessionType.getName());
- sendBroadcastIntent(sendIntent);
-
- NavServiceStartedNACK(rejectedParams);
- }
- else if (sessionType.eq(SessionType.PCM)) {
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionStartedNACKed");
- updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
- updateBroadcastIntent(sendIntent, "COMMENT2", " NACK ServiceType: " + sessionType.getName());
- sendBroadcastIntent(sendIntent);
-
- AudioServiceStartedNACK(rejectedParams);
- }
- }
+ public void onSessionEnded(int sessionID) {
- @Override
- public void onProtocolSessionEnded(SessionType sessionType,
- byte sessionID, String correlationID) {
- OnServiceEnded message = new OnServiceEnded(sessionType);
- queueInternalMessage(message);
-
- if (sessionType.eq(SessionType.NAV)) {
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionEnded");
- updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
- updateBroadcastIntent(sendIntent, "COMMENT2", " End ServiceType: " + sessionType.getName());
- sendBroadcastIntent(sendIntent);
-
- NavServiceEnded();
- }
- else if (sessionType.eq(SessionType.PCM)) {
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionEnded");
- updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
- updateBroadcastIntent(sendIntent, "COMMENT2", " End ServiceType: " + sessionType.getName());
- sendBroadcastIntent(sendIntent);
-
- AudioServiceEnded();
- }
}
@Override
- public void onProtocolError(String info, Exception e) {
- notifyPutFileStreamError(e, info);
- passErrorToProxyListener(info, e);
- }
+ public void onAuthTokenReceived(String authToken, int sessionID) {
- @Override
- public void onHeartbeatTimedOut(byte sessionID) {
- final String msg = "Heartbeat timeout";
- DebugTool.logInfo(TAG, msg);
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onHeartbeatTimedOut");
- updateBroadcastIntent(sendIntent, "COMMENT1", "Heartbeat timeout for SessionID: " + sessionID);
- sendBroadcastIntent(sendIntent);
-
- notifyProxyClosed(msg, new SdlException(msg, SdlExceptionCause.HEARTBEAT_PAST_DUE), SdlDisconnectedReason.HB_TIMEOUT);
-
}
- @Override
- public void onProtocolSessionEndedNACKed(SessionType sessionType,
- byte sessionID, String correlationID) {
- if (sessionType.eq(SessionType.NAV)) {
-
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionEndedNACKed");
- updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
- updateBroadcastIntent(sendIntent, "COMMENT2", " End NACK ServiceType: " + sessionType.getName());
- sendBroadcastIntent(sendIntent);
-
- NavServiceEndedNACK();
- }
- else if (sessionType.eq(SessionType.PCM)) {
- Intent sendIntent = createBroadcastIntent();
- updateBroadcastIntent(sendIntent, "FUNCTION_NAME", "onProtocolSessionEndedNACKed");
- updateBroadcastIntent(sendIntent, "COMMENT1", "SessionID: " + sessionID);
- updateBroadcastIntent(sendIntent, "COMMENT2", " End NACK ServiceType: " + sessionType.getName());
- sendBroadcastIntent(sendIntent);
-
- AudioServiceEndedNACK();
- }
-
- }
public void onProtocolServiceDataACK(SessionType sessionType, final int dataSize,
byte sessionID) {
@@ -820,10 +633,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
- @Override
- public void onAuthTokenReceived(String authToken, byte sessionID) {
- SdlProxyBase.this.authToken = authToken;
- }
}
protected SdlProxyBase(){}
@@ -2343,7 +2152,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
if (sdlSession != null) {
- pm.setSessionID(sdlSession.getSessionId());
+ pm.setSessionID((byte)sdlSession.getSessionId());
}
if (message.getBulkData() != null) {
@@ -5050,13 +4859,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private RPCStreamController startPutFileStream(String sPath, PutFile msg) {
if (sdlSession == null) return null;
- return startRPCStream(sPath, msg, SessionType.RPC, sdlSession.getSessionId(), protocolVersion);
+ 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, sdlSession.getSessionId(), protocolVersion);
+ return startRPCStream(is, msg, SessionType.RPC, (byte)sdlSession.getSessionId(), protocolVersion);
}
@SuppressWarnings("UnusedReturnValue")
@@ -5104,12 +4913,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@SuppressWarnings("unused")
public void startService(SessionType serviceType, boolean isEncrypted){
- sdlSession.startService(serviceType, sdlSession.getSessionId(), isEncrypted);
+ sdlSession.startService(serviceType, isEncrypted);
}
@SuppressWarnings("unused")
public void endService(SessionType serviceType){
- sdlSession.endService(serviceType, sdlSession.getSessionId());
+ sdlSession.endService(serviceType);
}
@@ -5140,7 +4949,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
emptyParam.setFormat(null);
sdlSession.setDesiredVideoParams(emptyParam);
- sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
+ sdlSession.startService(SessionType.NAV, isEncrypted);
addNavListener();
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
@@ -5188,7 +4997,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
emptyParam.setFormat(null);
sdlSession.setDesiredVideoParams(emptyParam);
- sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
+ sdlSession.startService(SessionType.NAV, isEncrypted);
addNavListener();
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
@@ -5270,7 +5079,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
pcmServiceStartResponseReceived = false;
pcmServiceStartResponse = false;
- sdlSession.startService(SessionType.PCM, sdlSession.getSessionId(), isEncrypted);
+ sdlSession.startService(SessionType.PCM, isEncrypted);
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
@@ -5303,7 +5112,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
pcmServiceStartResponseReceived = false;
pcmServiceStartResponse = false;
- sdlSession.startService(SessionType.PCM, sdlSession.getSessionId(), isEncrypted);
+ sdlSession.startService(SessionType.PCM, isEncrypted);
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
@@ -5584,7 +5393,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
navServiceStartResponse = false;
navServiceStartRejectedParams = null;
- sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
+ sdlSession.startService(SessionType.NAV, isEncrypted);
addNavListener();
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
@@ -5716,7 +5525,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
pcmServiceStartResponseReceived = false;
pcmServiceStartResponse = false;
- sdlSession.startService(SessionType.PCM, sdlSession.getSessionId(), isEncrypted);
+ sdlSession.startService(SessionType.PCM, isEncrypted);
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
@@ -5848,7 +5657,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
public boolean startProtectedRPCService() {
rpcProtectedResponseReceived = false;
rpcProtectedStartResponse = false;
- sdlSession.startService(SessionType.RPC, sdlSession.getSessionId(), true);
+ sdlSession.startService(SessionType.RPC, true);
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
index db02be687..accb59948 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
@@ -183,7 +183,7 @@ public class StreamPacketizer extends AbstractPacketizer implements IVideoStream
}
finally
{
- _session.endService(_serviceType, _rpcSessionID);
+ _session.endService(_serviceType);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/SdlConnection/BaseSdlSession.java b/base/src/main/java/com/smartdevicelink/SdlConnection/BaseSdlSession.java
index 7bd7edb01..c3e6158dd 100644
--- a/base/src/main/java/com/smartdevicelink/SdlConnection/BaseSdlSession.java
+++ b/base/src/main/java/com/smartdevicelink/SdlConnection/BaseSdlSession.java
@@ -33,11 +33,13 @@
package com.smartdevicelink.SdlConnection;
import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.managers.lifecycle.RpcConverter;
import com.smartdevicelink.protocol.ISdlProtocol;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.protocol.SdlProtocolBase;
import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
@@ -54,26 +56,25 @@ import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.CopyOnWriteArrayList;
-public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionListener, ISecurityInitializedListener {
+public abstract class BaseSdlSession implements ISdlProtocol, ISecurityInitializedListener {
private static final String TAG = "SdlSession";
final protected SdlProtocolBase sdlProtocol;
protected BaseTransportConfig transportConfig;
- protected ISdlConnectionListener sessionListener;
+ protected ISdlSessionListener sessionListener;
protected SdlSecurityBase sdlSecurity = null;
protected VideoStreamingParameters desiredVideoParams = null;
protected VideoStreamingParameters acceptedVideoParams = null;
- protected byte sessionId;
- protected int sessionHashId = 0;
+ protected int sessionId = -1;
protected HashMap<SessionType, CopyOnWriteArrayList<ISdlServiceListener>> serviceListeners;
protected CopyOnWriteArrayList<SessionType> encryptedServices = new CopyOnWriteArrayList<SessionType>();
boolean sdlSecurityInitializing = false;
- public BaseSdlSession(ISdlConnectionListener listener, BaseTransportConfig config){
+ public BaseSdlSession(ISdlSessionListener listener, BaseTransportConfig config){
this.transportConfig = config;
this.sessionListener = listener;
this.sdlProtocol = getSdlProtocolImplementation();
@@ -105,12 +106,12 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionList
sdlSecurity.shutDown();
}
if(sdlProtocol != null){
- sdlProtocol.endSession(sessionId, sessionHashId);
+ sdlProtocol.endSession((byte)sessionId);
}
}
- public void startService (SessionType serviceType, byte sessionID, boolean isEncrypted) {
+ public void startService (SessionType serviceType, boolean isEncrypted) {
if (isEncrypted){
if (sdlSecurity != null){
List<SessionType> serviceList = sdlSecurity.getServiceList();
@@ -125,14 +126,14 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionList
}
}
}
- sdlProtocol.startService(serviceType, sessionID, isEncrypted);
+ sdlProtocol.startService(serviceType, (byte)this.sessionId, isEncrypted);
}
- public void endService (SessionType serviceType, byte sessionID) {
+ public void endService (SessionType serviceType) {
if (sdlProtocol == null) {
return;
}
- sdlProtocol.endService(serviceType,sessionID);
+ sdlProtocol.endService(serviceType, (byte)this.sessionId);
}
@@ -156,18 +157,6 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionList
return sdlProtocol != null && sdlProtocol.isConnected();
}
-
- public void shutdown(String info){
- DebugTool.logInfo(TAG, "Shutdown - " + info);
- this.sessionListener.onTransportDisconnected(info);
-
- }
-
- @Override
- public void onTransportDisconnected(String info, boolean altTransportAvailable, BaseTransportConfig transportConfig) {
- this.sessionListener.onTransportDisconnected(info, altTransportAvailable, this.transportConfig);
- }
-
/**
* Get the current protocol version used by this session
* @return Version that represents the Protocol version being used
@@ -184,22 +173,10 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionList
return this.transportConfig;
}
- public int getSessionHashId() {
- return this.sessionHashId;
- }
-
- public byte getSessionId() {
- return this.sessionId;
- }
-
public void setSdlSecurity(SdlSecurityBase sec) {
sdlSecurity = sec;
}
- public SdlSecurityBase getSdlSecurity() {
- return sdlSecurity;
- }
-
protected void processControlService(ProtocolMessage msg) {
if (sdlSecurity == null)
@@ -222,7 +199,7 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionList
protocolMessage.setData(returnBytes);
protocolMessage.setFunctionID(0x01);
protocolMessage.setVersion((byte)sdlProtocol.getProtocolVersion().getMajor());
- protocolMessage.setSessionID(getSessionId());
+ protocolMessage.setSessionID((byte)this.sessionId);
//sdlSecurity.hs();
@@ -234,53 +211,6 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionList
return encryptedServices.contains(sType);
}
- @Override
- public void onTransportDisconnected(String info) {
- this.sessionListener.onTransportDisconnected(info);
- }
-
-
- @Override
- public void onTransportError(String info, Exception e) {
- this.sessionListener.onTransportError(info, e);
- }
-
- @Override
- public void onProtocolMessageReceived(ProtocolMessage msg) {
- if (msg.getSessionType().equals(SessionType.CONTROL)) {
- processControlService(msg);
- return;
- }
-
- this.sessionListener.onProtocolMessageReceived(msg);
- }
-
- @Override
- public void onHeartbeatTimedOut(byte sessionID) {
- this.sessionListener.onHeartbeatTimedOut(sessionID);
-
- }
-
- @Override
- public void onProtocolError(String info, Exception e) {
- this.sessionListener.onProtocolError(info, e);
- DebugTool.logError(TAG,"on protocol error", e);
- }
-
- @Override
- public void onProtocolServiceDataACK(SessionType sessionType, int dataSize, byte sessionID) {
- this.sessionListener.onProtocolServiceDataACK(sessionType, dataSize, sessionID);
- }
-
-
-
- @Override
- public void onAuthTokenReceived(String token, byte sessionID) {
- //This is not used in the base library. Will only be used in the Android library while it has the SdlConnection class
- //See onAuthTokenReceived(String token) in this class instead
-
- }
-
public void addServiceListener(SessionType serviceType, ISdlServiceListener sdlServiceListener){
if(serviceListeners == null){
serviceListeners = new HashMap<>();
@@ -309,22 +239,6 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionList
this.desiredVideoParams = params;
}
- /**
- * Returns the currently set desired video streaming parameters. If there haven't been any set,
- * the default options will be returned and set for this instance.
- * @return the desired video streaming parameters
- */
- public VideoStreamingParameters getDesiredVideoParams(){
- if(desiredVideoParams == null){
- desiredVideoParams = new VideoStreamingParameters();
- }
- return desiredVideoParams;
- }
-
- public void setAcceptedVideoParams(VideoStreamingParameters params){
- this.acceptedVideoParams = params;
- }
-
public VideoStreamingParameters getAcceptedVideoParams(){
return acceptedVideoParams;
}
@@ -347,17 +261,72 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionList
/* ***********************************************************************************************************************************************************************
- * ***************************************************************** IProtocol Listener ********************************************************************************
+ * ***************************************************************** ISdlProtocol Listener ********************************************************************************
*************************************************************************************************************************************************************************/
- public void onProtocolMessageBytesToSend(SdlPacket packet) {
- //DebugTool.logInfo(TAG, "onProtocolMessageBytesToSend - " + packet.getTransportType());
- sdlProtocol.sendPacket(packet);
+ @Override
+ public void onProtocolMessageReceived(ProtocolMessage msg) {
+ if (msg.getSessionType().equals(SessionType.CONTROL)) {
+ processControlService(msg);
+ } else if (SessionType.RPC.equals(msg.getSessionType())
+ || SessionType.BULK_DATA.equals(msg.getSessionType())) {
+ RPCMessage rpc = RpcConverter.extractRpc(msg, this.sdlProtocol.getProtocolVersion());
+ this.sessionListener.onRPCMessageReceived(rpc);
+ }
+
+ }
+ //To be implemented by child class
+ @Override
+ public abstract void onServiceStarted(SdlPacket packet, SessionType sessionType, int sessionID, Version version, boolean isEncrypted);
+ @Override
+ public abstract void onServiceEnded(SdlPacket packet, SessionType sessionType, int sessionID);
+ @Override
+ public abstract void onServiceError(SdlPacket packet, SessionType sessionType, int sessionID, String error);
+
+
+ @Override
+ public void onProtocolError(String info, Exception e) {
+ //TODO is there anything to pass forward here?
+ DebugTool.logError(TAG,"on protocol error", e);
}
+ @Override
+ public int getSessionId() {
+ return this.sessionId;
+ }
- public void onProtocolSessionStartedNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID, List<String> rejectedParams){
- onProtocolSessionNACKed(sessionType,sessionID,version,correlationID,rejectedParams);
+ @Override
+ public void shutdown(String info) {
+ DebugTool.logInfo(TAG, "Shutdown - " + info);
+ this.sessionListener.onTransportDisconnected(info, false, this.transportConfig);
+ }
+
+ @Override
+ public void onTransportDisconnected(String info, boolean altTransportAvailable, BaseTransportConfig transportConfig) {
+ this.sessionListener.onTransportDisconnected(info, altTransportAvailable, this.transportConfig);
+ }
+
+ @Override
+ public SdlSecurityBase getSdlSecurity() {
+ return sdlSecurity;
+ }
+
+ /**
+ * Returns the currently set desired video streaming parameters. If there haven't been any set,
+ * the default options will be returned and set for this instance.
+ * @return the desired video streaming parameters
+ */
+ @Override
+ public VideoStreamingParameters getDesiredVideoParams() {
+ if (desiredVideoParams == null) {
+ desiredVideoParams = new VideoStreamingParameters();
+ }
+ return desiredVideoParams;
+ }
+
+ @Override
+ public void setAcceptedVideoParams(VideoStreamingParameters params) {
+ this.acceptedVideoParams = params;
}
@Override
@@ -365,12 +334,6 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionList
this.sessionListener.onAuthTokenReceived(authToken, sessionId);
}
- /* Not supported methods from IProtocolListener */
- public void onProtocolHeartbeat(SessionType sessionType, byte sessionID) { /* Not supported */}
- public void onProtocolHeartbeatACK(SessionType sessionType, byte sessionID) {/* Not supported */}
- public void onResetOutgoingHeartbeat(SessionType sessionType, byte sessionID) {/* Not supported */}
- public void onResetIncomingHeartbeat(SessionType sessionType, byte sessionID) {/* Not supported */}
-
/* ***********************************************************************************************************************************************************************
* ***************************************************************** Security Listener *********************************************************************************
*************************************************************************************************************************************************************************/
@@ -390,17 +353,13 @@ public abstract class BaseSdlSession implements ISdlProtocol, ISdlConnectionList
service = iter.next();
if (service != null)
- sdlProtocol.startService(service, getSessionId(), true);
+ sdlProtocol.startService(service, (byte)this.sessionId, true);
iter.remove();
}
}
}
- @Override
- public void stopStream(SessionType serviceType) {
- //Currently does nothing as streaming is not available. Also should only be managed through managers
- }
/**
diff --git a/base/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java b/base/src/main/java/com/smartdevicelink/SdlConnection/ISdlSessionListener.java
index 87fd35122..caab51b74 100644
--- a/base/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
+++ b/base/src/main/java/com/smartdevicelink/SdlConnection/ISdlSessionListener.java
@@ -29,44 +29,53 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.SdlConnection;
-
-import com.smartdevicelink.protocol.ProtocolMessage;
-import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.transport.BaseTransportConfig;
-
-import java.util.List;
-
-
-public interface ISdlConnectionListener {
- @Deprecated
- void onTransportDisconnected(String info);
-
- void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig);
-
-
- void onTransportError(String info, Exception e);
-
- void onProtocolMessageReceived(ProtocolMessage msg);
-
- void onProtocolSessionStartedNACKed(SessionType sessionType,
- byte sessionID, byte version, String correlationID, List<String> rejectedParams);
-
- void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted);
-
- void onProtocolSessionEnded(SessionType sessionType,
- byte sessionID, String correlationID);
-
- void onProtocolSessionEndedNACKed(SessionType sessionType,
- byte sessionID, String correlationID);
-
- void onProtocolError(String info, Exception e);
-
- @Deprecated
- void onHeartbeatTimedOut(byte sessionID);
-
- void onProtocolServiceDataACK(SessionType sessionType, int dataSize, byte sessionID);
-
- void onAuthTokenReceived(String authToken, byte sessionID);
-}
+package com.smartdevicelink.SdlConnection;
+
+import android.support.annotation.RestrictTo;
+
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.util.Version;
+
+@RestrictTo(RestrictTo.Scope.LIBRARY)
+public interface ISdlSessionListener {
+
+ /**
+ * Called when a transport disconnects
+ * @param info a human readable string including information on the disconnected transport
+ * @param availablePrimary a boolean flag indicating if there is another transport that can
+ * be used to connect with the SDL enabled device.
+ * @param transportConfig the previously supplied transport config
+ */
+ void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig);
+
+ /**
+ * Called when an RPC message has been received from the connected SDL device
+ * @param rpcMessage the RPC message that was received
+ */
+ void onRPCMessageReceived(RPCMessage rpcMessage);
+
+ /**
+ * Called to indicate that a session has started with the connected SDL device. This means the
+ * RPC and Bulk service types have also been started.
+ * @param sessionID session ID associated with the session that was established
+ * @param version the protocol version that has been negotiated for this session
+ */
+ void onSessionStarted(int sessionID, Version version);
+
+ /**
+ * Called to indicate that the session that was previously established has now ended. This means
+ * that all services previously started on this session are also closed.
+ * @param sessionID the session ID that was assigned to this now closed session
+ */
+ void onSessionEnded( int sessionID);
+
+ /**
+ * Called when an auth token has been received. This should always happen after the session
+ * has been created.
+ * @param authToken the actual auth token that has been stringified
+ * @param sessionID the session ID that this auth token is associated with
+ */
+ void onAuthTokenReceived(String authToken, int sessionID);
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
index 64a919206..75469a69d 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
@@ -36,7 +36,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import com.livio.taskmaster.Taskmaster;
-import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
+import com.smartdevicelink.SdlConnection.ISdlSessionListener;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.managers.SdlManager;
@@ -158,7 +158,7 @@ abstract class BaseLifecycleManager {
*/
public void startRPCEncryption() {
if (session != null) {
- session.startService(SessionType.RPC, session.getSessionId(), true);
+ session.startService(SessionType.RPC, true);
}
}
@@ -785,7 +785,7 @@ abstract class BaseLifecycleManager {
final ProtocolMessage pm = new ProtocolMessage();
pm.setData(msgBytes);
if (session != null) {
- pm.setSessionID(session.getSessionId());
+ pm.setSessionID((byte)session.getSessionId());
}
pm.setMessageType(MessageType.RPC);
@@ -855,106 +855,98 @@ abstract class BaseLifecycleManager {
}
/* *******************************************************************************************************
- *************************************** ISdlConnectionListener START ************************************
+ **************************************** ISdlSessionListener START **************************************
*********************************************************************************************************/
- final ISdlConnectionListener sdlConnectionListener = new ISdlConnectionListener() {
- @Override
- public void onTransportDisconnected(String info) {
- onClose(info, null, null);
-
- }
+ final ISdlSessionListener sdlSessionListener = new ISdlSessionListener() {
@Override
public void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
BaseLifecycleManager.this.onTransportDisconnected(info, availablePrimary, transportConfig);
-
- }
-
- @Override
- public void onTransportError(String info, Exception e) {
- onClose(info, e, null);
-
}
@Override
- public void onProtocolMessageReceived(ProtocolMessage msg) {
+ public void onRPCMessageReceived(RPCMessage rpc) {
//Incoming message
- if (SessionType.RPC.equals(msg.getSessionType())
- || SessionType.BULK_DATA.equals(msg.getSessionType())) {
-
- RPCMessage rpc = RpcConverter.extractRpc(msg, session.getProtocolVersion());
- if (rpc != null) {
- String messageType = rpc.getMessageType();
- DebugTool.logInfo(TAG, "RPC received - " + messageType);
+ if (rpc != null) {
+ String messageType = rpc.getMessageType();
+ DebugTool.logInfo(TAG, "RPC received - " + messageType);
- rpc.format(rpcSpecVersion, true);
+ rpc.format(rpcSpecVersion, true);
- onRPCReceived(rpc);
+ BaseLifecycleManager.this.onRPCReceived(rpc);
- if (RPCMessage.KEY_RESPONSE.equals(messageType)) {
+ if (RPCMessage.KEY_RESPONSE.equals(messageType)) {
- onRPCResponseReceived((RPCResponse) rpc);
+ onRPCResponseReceived((RPCResponse) rpc);
- } else if (RPCMessage.KEY_NOTIFICATION.equals(messageType)) {
- FunctionID functionID = rpc.getFunctionID();
- if (functionID != null && (functionID.equals(FunctionID.ON_BUTTON_PRESS)) || functionID.equals(FunctionID.ON_BUTTON_EVENT)) {
- RPCNotification notificationCompat = handleButtonNotificationFormatting(rpc);
- if (notificationCompat != null) {
- onRPCNotificationReceived((notificationCompat));
- }
+ } else if (RPCMessage.KEY_NOTIFICATION.equals(messageType)) {
+ FunctionID functionID = rpc.getFunctionID();
+ if (functionID != null && (functionID.equals(FunctionID.ON_BUTTON_PRESS)) || functionID.equals(FunctionID.ON_BUTTON_EVENT)) {
+ RPCNotification notificationCompat = handleButtonNotificationFormatting(rpc);
+ if (notificationCompat != null) {
+ onRPCNotificationReceived((notificationCompat));
}
+ }
- onRPCNotificationReceived((RPCNotification) rpc);
+ onRPCNotificationReceived((RPCNotification) rpc);
- } else if (RPCMessage.KEY_REQUEST.equals(messageType)) {
+ } else if (RPCMessage.KEY_REQUEST.equals(messageType)) {
- onRPCRequestReceived((RPCRequest) rpc);
+ onRPCRequestReceived((RPCRequest) rpc);
- }
- } else {
- DebugTool.logWarning(TAG, "Shouldn't be here");
}
+ } else {
+ DebugTool.logWarning(TAG, "Shouldn't be here");
}
-
}
- @Override
- public void onProtocolSessionStartedNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
- DebugTool.logWarning(TAG, sessionType.getName() + " onProtocolSessionStartedNACKed " + sessionID + " RejectedParams: " + rejectedParams);
- BaseLifecycleManager.this.onStartServiceNACKed(sessionType);
- }
@Override
- public void onProtocolSessionStarted(SessionType sessionType, byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
+ public void onSessionStarted(int sessionID, Version version) {
DebugTool.logInfo(TAG, "on protocol session started");
- BaseLifecycleManager.this.onServiceStarted(sessionType);
- }
-
- @Override
- public void onProtocolSessionEnded(SessionType sessionType, byte sessionID, String correlationID) {
- //Currently not necessary
- }
-
- @Override
- public void onProtocolSessionEndedNACKed(SessionType sessionType, byte sessionID, String correlationID) {
- //Currently not necessary
+ if (minimumProtocolVersion != null && minimumProtocolVersion.isNewerThan(version) == 1) {
+ DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum protocol version %s is greater than the supported protocol version %s", minimumProtocolVersion, getProtocolVersion()));
+ session.endService(SessionType.RPC);
+ clean();
+ return;
+ }
+ if (appConfig != null) {
+ appConfig.prepare();
+
+ SdlMsgVersion sdlMsgVersion = new SdlMsgVersion();
+ sdlMsgVersion.setMajorVersion(MAX_SUPPORTED_RPC_VERSION.getMajor());
+ sdlMsgVersion.setMinorVersion(MAX_SUPPORTED_RPC_VERSION.getMinor());
+ sdlMsgVersion.setPatchVersion(MAX_SUPPORTED_RPC_VERSION.getPatch());
+
+ RegisterAppInterface rai = new RegisterAppInterface(sdlMsgVersion,
+ appConfig.getAppName(), appConfig.isMediaApp(), appConfig.getLanguageDesired(),
+ appConfig.getHmiDisplayLanguageDesired(), appConfig.getAppID());
+ rai.setCorrelationID(REGISTER_APP_INTERFACE_CORRELATION_ID);
+
+ rai.setTtsName(appConfig.getTtsName());
+ rai.setNgnMediaScreenAppName(appConfig.getNgnMediaScreenAppName());
+ rai.setVrSynonyms(appConfig.getVrSynonyms());
+ rai.setAppHMIType(appConfig.getAppType());
+ rai.setDayColorScheme(appConfig.getDayColorScheme());
+ rai.setNightColorScheme(appConfig.getNightColorScheme());
+ rai.setHashID(appConfig.getResumeHash());
+
+ //Add device/system info in the future
+
+ sendRPCMessagePrivate(rai, true);
+ } else {
+ DebugTool.logError(TAG, "App config was null, soo...");
+ }
}
@Override
- public void onProtocolError(String info, Exception e) {
- DebugTool.logError(TAG, "Protocol Error - " + info, e);
+ public void onSessionEnded(int sessionID) {
+ DebugTool.logInfo(TAG, "on protocol session ended");
}
@Override
- public void onHeartbeatTimedOut(byte sessionID) { /* Deprecated */ }
-
- @Override
- public void onProtocolServiceDataACK(SessionType sessionType, int dataSize, byte sessionID) {/* Unused */ }
-
-
- @Override
- public void onAuthTokenReceived(String token, byte sessionID) {
+ public void onAuthTokenReceived(String token, int sessionID) {
BaseLifecycleManager.this.authToken = token;
}
};
@@ -1317,57 +1309,12 @@ abstract class BaseLifecycleManager {
setupInternalRpcListeners();
}
- void onServiceStarted(SessionType sessionType) {
- if (sessionType != null) {
- if (minimumProtocolVersion != null && minimumProtocolVersion.isNewerThan(getProtocolVersion()) == 1) {
- DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum protocol version %s is greater than the supported protocol version %s", minimumProtocolVersion, getProtocolVersion()));
- session.endService(sessionType, session.getSessionId());
- clean();
- return;
- }
-
- if (sessionType.equals(SessionType.RPC)) {
- if (appConfig != null) {
-
- appConfig.prepare();
-
- SdlMsgVersion sdlMsgVersion = new SdlMsgVersion();
- sdlMsgVersion.setMajorVersion(MAX_SUPPORTED_RPC_VERSION.getMajor());
- sdlMsgVersion.setMinorVersion(MAX_SUPPORTED_RPC_VERSION.getMinor());
- sdlMsgVersion.setPatchVersion(MAX_SUPPORTED_RPC_VERSION.getPatch());
-
- RegisterAppInterface rai = new RegisterAppInterface(sdlMsgVersion,
- appConfig.getAppName(), appConfig.isMediaApp(), appConfig.getLanguageDesired(),
- appConfig.getHmiDisplayLanguageDesired(), appConfig.getAppID());
- rai.setCorrelationID(REGISTER_APP_INTERFACE_CORRELATION_ID);
-
- rai.setTtsName(appConfig.getTtsName());
- rai.setNgnMediaScreenAppName(appConfig.getNgnMediaScreenAppName());
- rai.setVrSynonyms(appConfig.getVrSynonyms());
- rai.setAppHMIType(appConfig.getAppType());
- rai.setDayColorScheme(appConfig.getDayColorScheme());
- rai.setNightColorScheme(appConfig.getNightColorScheme());
- rai.setHashID(appConfig.getResumeHash());
-
- //Add device/system info in the future
-
- sendRPCMessagePrivate(rai, true);
- } else {
- DebugTool.logError(TAG, "App config was null, soo...");
- }
- }
- }
- }
abstract void cycle(SdlDisconnectedReason disconnectedReason);
void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
}
- void onStartServiceNACKed(SessionType sessionType) {
- }
-
-
void startVideoService(boolean encrypted, VideoStreamingParameters parameters) {
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java b/base/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java
index 9875178f1..decc8205d 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/ISdlProtocol.java
@@ -33,26 +33,110 @@
package com.smartdevicelink.protocol;
+import android.support.annotation.RestrictTo;
+
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.util.Version;
+
+@RestrictTo(RestrictTo.Scope.LIBRARY)
+public interface ISdlProtocol {
+
+ /**
+ * Called to indicate that a complete message (RPC, BULK, etc.) has been received.
+ * @param msg the message that was received
+ */
+ void onProtocolMessageReceived(ProtocolMessage msg);
+
+ /**
+ * Called to indicate that a service has been started
+ * @param packet the control packet StartServiceACK received from the connected device
+ * @param serviceType the service type that has been started
+ * @param sessionID the session ID that this service has been started on
+ * @param version the protocol version used for this session and service
+ * @param isEncrypted if the service is encrypted
+ */
+ void onServiceStarted(SdlPacket packet, SessionType serviceType, int sessionID, Version version, boolean isEncrypted);
-public interface ISdlProtocol extends IProtocolListener {
+ /**
+ * This will get called when a service has ended
+ * @param packet the packet received that ended this service
+ * @param serviceType the service type that has ended
+ * @param sessionID the id of the session that this service was operating on
+ */
+ void onServiceEnded(SdlPacket packet, SessionType serviceType, int sessionID);
- byte getSessionId();
+ /**
+ * If there is an error with starting or stopping the service or any other error this method
+ * will be called. This will also be called if the service was operating on a transport that
+ * has been disconnected.
+ * @param packet if there is a packet that caused this error it will be included, however this
+ * can be null.
+ * @param serviceType the service type that experienced the error
+ * @param sessionID the session ID that this service was associated with
+ * @param error a human readable string of the error
+ */
+ void onServiceError(SdlPacket packet, SessionType serviceType, int sessionID, String error);
+ /**
+ * Called to indicate that a protocol error was detected in received data.
+ * @param info a human readable string of the error
+ * @param e the exception if one occurred
+ */
+ void onProtocolError(String info, Exception e);
+
+ /**
+ * Method that the protocol layer will use to obtain the session ID
+ * @return the session ID associated with the protocol instance
+ */
+ int getSessionId();
+
+ /**
+ * A request made by the protocol layer to shutdown the layers above it. Likely due to
+ * the RPC service being shutdown or the primary transport disconnecting.
+ * @param info human readable string on why the shutdown should occur
+ */
void shutdown(String info);
+ /**
+ * Called when a transport disconnects
+ * @param info a human readable string including information on the disconnected transport
+ * @param altTransportAvailable a boolean flag indicating if there is another transport that can
+ * be used to connect with the SDL enabled device.
+ * @param transportConfig the previously supplied transport config
+ */
void onTransportDisconnected(String info, boolean altTransportAvailable, BaseTransportConfig transportConfig);
+ /**
+ * A method that should be implemented by the hosting class of the SdlProtocol instance that will
+ * return the currently being used security library if any.
+ * @return the security library to be used to encrypt/decrypt packets
+ */
SdlSecurityBase getSdlSecurity();
+ /**
+ * A method that should be implemented by the hosting class of the SdlProtocol instance that will
+ * return the desired video streaming parameters. These parameters will be requested if
+ * another component has requested the video streaming service to start.
+ * @return the developer supplied desired video streaming parameters
+ */
VideoStreamingParameters getDesiredVideoParams();
+ /**
+ * A callback that will be called when the video service has been successfully started and the
+ * streaming parameters have been negotiated. This should be called prior to the video service
+ * started callback.
+ * @param acceptedVideoParams the negotiated and accepted video parameters that should be used
+ * to stream to the SDL enabled device.
+ */
void setAcceptedVideoParams(VideoStreamingParameters acceptedVideoParams);
- void stopStream(SessionType serviceType);
-
+ /**
+ * A callback to indicate the SDL connected device has supplied an authentication token to this
+ * application. It will be called after the service start callback.
+ * @param authToken
+ */
void onAuthTokenReceived(String authToken);
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
index 1019961a1..18eebbbbc 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
@@ -383,7 +383,7 @@ public class SdlProtocolBase {
for(TransportRecord record: transports){
if(secondaryTransportListeners.get(record.getType()) != null
&& !secondaryTransportListeners.get(record.getType()).isEmpty()){
- registerSecondaryTransport(iSdlProtocol.getSessionId(), record);
+ registerSecondaryTransport((byte)iSdlProtocol.getSessionId(), record);
}
}
}
@@ -531,8 +531,8 @@ public class SdlProtocolBase {
}
}
- public void endSession(byte sessionID, int hashId) {
- SdlPacket header = SdlPacketFactory.createEndSession(SessionType.RPC, sessionID, hashId, (byte)protocolVersion.getMajor(), hashId);
+ public void endSession(byte sessionID) {
+ SdlPacket header = SdlPacketFactory.createEndSession(SessionType.RPC, sessionID, hashID, (byte)protocolVersion.getMajor(), hashID);
handlePacketToSend(header);
if(transportManager != null) {
transportManager.close(sessionID);
@@ -540,12 +540,6 @@ public class SdlProtocolBase {
} // end-method
- public void sendPacket(SdlPacket packet){
- if(transportManager != null){
- transportManager.sendPacket(packet);
- }
- }
-
public void sendMessage(ProtocolMessage protocolMsg) {
SessionType sessionType = protocolMsg.getSessionType();
byte sessionID = protocolMsg.getSessionID();
@@ -819,7 +813,7 @@ public class SdlProtocolBase {
public void endService(SessionType serviceType, byte sessionID) {
if(serviceType.equals(SessionType.RPC)){ //RPC session will close all other sessions so we want to make sure we use the correct EndProtocolSession method
- endSession(sessionID,hashID);
+ endSession(sessionID);
}else {
SdlPacket header = SdlPacketFactory.createEndSession(serviceType, sessionID, hashID, (byte)protocolVersion.getMajor(), new byte[0]);
TransportRecord transportRecord = activeTransports.get(serviceType);
@@ -843,8 +837,8 @@ public class SdlProtocolBase {
protected void handlePacketToSend(SdlPacket packet) {
synchronized(FRAME_LOCK) {
- if(packet!=null){
- iSdlProtocol.onProtocolMessageBytesToSend(packet);
+ if(packet!=null && transportManager != null) {
+ transportManager.sendPacket(packet);
}
}
@@ -854,6 +848,7 @@ public class SdlProtocolBase {
* sent to the protocol listener.
**/
protected void handleServiceEndedNAK(SdlPacket packet, SessionType serviceType) {
+ String error = "Service ended NAK received for service type " + serviceType.getName();
if(packet.version >= 5){
if(DebugTool.isDebugEnabled()) {
//Currently this is only during a debugging session. Might pass back in the future
@@ -876,30 +871,32 @@ public class SdlProtocolBase {
builder.append(rejectedParam);
builder.append(" ");
}
- DebugTool.logWarning(TAG, builder.toString());
+ error = builder.toString();
+ DebugTool.logWarning(TAG, error);
}
}
}
- iSdlProtocol.onProtocolSessionEndedNACKed(serviceType, (byte)packet.getSessionId(), "");
+ iSdlProtocol.onServiceError(packet, serviceType, packet.getSessionId(), error);
}
// This method handles the end of a protocol session. A callback is
// sent to the protocol listener.
- protected void handleServiceEnded(SdlPacket packet, SessionType sessionType) {
-
- iSdlProtocol.onProtocolSessionEnded(sessionType, (byte)packet.getSessionId(), "");
+ //FIXME do we do anything in this class for this?
+ protected void handleServiceEnded(SdlPacket packet, SessionType sessionType) {
+ iSdlProtocol.onServiceEnded(packet, sessionType, packet.getSessionId());
}
+
/**
* This method handles the startup of a protocol session. A callback is sent
* to the protocol listener.
* @param packet StarServiceACK packet
* @param serviceType the service type that has just been started
*/
- protected void handleProtocolSessionStarted(SdlPacket packet, SessionType serviceType) {
+ protected void handleStartServiceACK(SdlPacket packet, SessionType serviceType) {
// Use this sessionID to create a message lock
Object messageLock = _messageLocks.get((byte)packet.getSessionId());
if (messageLock == null) {
@@ -999,7 +996,7 @@ public class SdlProtocolBase {
} else {
DebugTool.logInfo(TAG, "Received a start service ack for RPC service while already active on a different transport.");
- iSdlProtocol.onProtocolSessionStarted(serviceType, (byte) packet.getSessionId(), (byte)protocolVersion.getMajor(), "", hashID, packet.isEncrypted());
+ iSdlProtocol.onServiceStarted(packet, serviceType, (byte) packet.getSessionId(), protocolVersion, packet.isEncrypted());
return;
}
@@ -1070,10 +1067,11 @@ public class SdlProtocolBase {
iSdlProtocol.setAcceptedVideoParams(iSdlProtocol.getDesiredVideoParams());
}
}
- iSdlProtocol.onProtocolSessionStarted(serviceType, (byte) packet.getSessionId(), (byte)protocolVersion.getMajor(), "", hashID, packet.isEncrypted());
+ iSdlProtocol.onServiceStarted(packet, serviceType, (byte) packet.getSessionId(), protocolVersion, packet.isEncrypted());
}
protected void handleProtocolSessionNAKed(SdlPacket packet, SessionType serviceType) {
+ String error = "Service start NAK received for service type " + serviceType.getName();
List<String> rejectedParams = null;
if(packet.version >= 5){
if(DebugTool.isDebugEnabled()) {
@@ -1097,15 +1095,18 @@ public class SdlProtocolBase {
builder.append(rejectedParam);
builder.append(" ");
}
- DebugTool.logWarning(TAG, builder.toString());
+ error = builder.toString();
+ DebugTool.logWarning(TAG, error);
}
}
}
if (serviceType.eq(SessionType.NAV) || serviceType.eq(SessionType.PCM)) {
- iSdlProtocol.onProtocolSessionNACKed(serviceType, (byte)packet.sessionId, (byte)protocolVersion.getMajor(), "", rejectedParams);
+ iSdlProtocol.onServiceError(packet, serviceType, (byte)packet.sessionId, error);
} else {
+ //TODO should there be any additional checks here? Or should this be more explicit in
+ // what types of services would cause this protocol error
handleProtocolError("Got StartSessionNACK for protocol sessionID = " + packet.getSessionId(), null);
}
}
@@ -1120,14 +1121,6 @@ public class SdlProtocolBase {
sendHeartBeatACK(sessionType,sessionID);
}
- protected void handleServiceDataACK(SdlPacket packet, SessionType sessionType) {
-
- if (packet.getPayload() != null && packet.getDataSize() == 4){ //service data ack will be 4 bytes in length
- int serviceDataAckSize = BitConverter.intFromByteArray(packet.getPayload(), 0);
- iSdlProtocol.onProtocolServiceDataACK(sessionType, serviceDataAckSize, (byte)packet.getSessionId ());
-
- }
- }
/* --------------------------------------------------------------------------------------------
----------------------------------- TRANSPORT_TYPE LISTENER ---------------------------------
@@ -1176,13 +1169,11 @@ public class SdlProtocolBase {
//a single transport record per transport.
//TransportType type = disconnectedTransport.getType();
if(getTransportForSession(SessionType.NAV) != null && disconnectedTransport.equals(getTransportForSession(SessionType.NAV))){
- //stopVideoStream();
- iSdlProtocol.stopStream(SessionType.NAV);
+ iSdlProtocol.onServiceError(null, SessionType.NAV, iSdlProtocol.getSessionId(), "Transport disconnected");
activeTransports.remove(SessionType.NAV);
}
if(getTransportForSession(SessionType.PCM) != null && disconnectedTransport.equals(getTransportForSession(SessionType.PCM))){
- //stopAudioStream();
- iSdlProtocol.stopStream(SessionType.PCM);
+ iSdlProtocol.onServiceError(null, SessionType.PCM, iSdlProtocol.getSessionId(), "Transport disconnected");
activeTransports.remove(SessionType.PCM);
}
@@ -1400,7 +1391,7 @@ public class SdlProtocolBase {
}else if (frameInfo == FrameDataControlFrameType.StartSessionACK.getValue()) {
- handleProtocolSessionStarted(packet, serviceType);
+ handleStartServiceACK(packet, serviceType);
} else if (frameInfo == FrameDataControlFrameType.StartSessionNACK.getValue()) {
@@ -1409,7 +1400,7 @@ public class SdlProtocolBase {
} else if (frameInfo == FrameDataControlFrameType.EndSession.getValue()
|| frameInfo == FrameDataControlFrameType.EndSessionACK.getValue()) {
- handleServiceEnded(packet,serviceType);
+ handleServiceEnded(packet, serviceType);
} else if (frameInfo == FrameDataControlFrameType.EndSessionNACK.getValue()) {
@@ -1417,7 +1408,7 @@ public class SdlProtocolBase {
} else if (frameInfo == FrameDataControlFrameType.ServiceDataACK.getValue()) {
- handleServiceDataACK(packet, serviceType);
+ //Currently unused
} else if (frameInfo == FrameDataControlFrameType.RegisterSecondaryTransportACK.getValue()) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java
index f15fa34c5..e34a8f431 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppHMIType.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
@@ -81,6 +81,12 @@ public enum AppHMIType {
* Remote Control
*/
REMOTE_CONTROL,
+ /**
+ * Web View
+ *
+ * @since SmartDeviceLink 7.0.0
+ */
+ WEB_VIEW
;
/**
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
index 31690e0ab..425671b64 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
@@ -119,6 +119,16 @@ public enum AppInterfaceUnregisteredReason {
* @since SmartDeviceLink 4.1
*/
UNSUPPORTED_HMI_RESOURCE,
+
+
+ /**
+ * The application is unregistered due to hardware resource constraints.
+ * The system will shortly close the application to free up hardware resources
+ *
+ * @since SmartDeviceLink 7.0
+ *
+ */
+ RESOURCE_CONSTRAINT
;
/**
* Convert String to AppInterfaceUnregisteredReason
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java
index 23439b007..ca130d38c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java
@@ -137,6 +137,12 @@ public enum PredefinedLayout {
A layout with only a single large graphic
*/
LARGE_GRAPHIC_ONLY("LARGE_GRAPHIC_ONLY"),
+
+ /**
+ * Custom root template allowing in-vehicle WebEngine applications with
+ * appropriate permissions to show the application's own web view.
+ */
+ WEB_VIEW("WEB_VIEW")
;
private final String VALUE;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java
index e344fb87f..7513d56af 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SdlDisconnectedReason.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
public enum SdlDisconnectedReason {
@@ -43,6 +43,7 @@ public enum SdlDisconnectedReason {
MASTER_RESET,
FACTORY_DEFAULTS,
TRANSPORT_ERROR,
+ RESOURCE_CONSTRAINT,
APPLICATION_REQUESTED_DISCONNECT,
DEFAULT,
TRANSPORT_DISCONNECT,
@@ -109,6 +110,9 @@ public enum SdlDisconnectedReason {
case FACTORY_DEFAULTS:
returnReason = SdlDisconnectedReason.FACTORY_DEFAULTS;
break;
+ case RESOURCE_CONSTRAINT:
+ returnReason = SdlDisconnectedReason.RESOURCE_CONSTRAINT;
+ break;
default:
break;
}
diff --git a/base/src/main/java/com/smartdevicelink/security/AbstractSdlSecurityBase.java b/base/src/main/java/com/smartdevicelink/security/AbstractSdlSecurityBase.java
index 3f1c54a6a..55e0fae2f 100644
--- a/base/src/main/java/com/smartdevicelink/security/AbstractSdlSecurityBase.java
+++ b/base/src/main/java/com/smartdevicelink/security/AbstractSdlSecurityBase.java
@@ -77,11 +77,11 @@ abstract class AbstractSdlSecurityBase {
session.onSecurityInitialized();
}
- public void handleSdlSession(SdlSession val) {
- if (val == null) return;
+ public void handleSdlSession(SdlSession sdlSession) {
+ if (sdlSession == null) return;
- setSessionId(val.getSessionId());
- setSdlSession(val);
+ setSessionId((byte)sdlSession.getSessionId());
+ setSdlSession(sdlSession);
}
private void setInitSuccess(boolean val) {
diff --git a/base/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java b/base/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
index a031defec..64ee4f795 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/StreamPacketizer.java
@@ -182,7 +182,7 @@ public class StreamPacketizer extends AbstractPacketizer implements IVideoStream
finally
{
if(_session != null) {
- _session.endService(_serviceType,_rpcSessionID);
+ _session.endService(_serviceType);
}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java b/base/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java
index 2da7b5133..9236be7a9 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/RTPH264Packetizer.java
@@ -246,7 +246,7 @@ public class RTPH264Packetizer extends AbstractPacketizer implements IVideoStrea
// XXX: This is added to sync with StreamPacketizer. Actually it shouldn't be here since
// it's confusing that a packetizer takes care of End Service request.
if (_session != null) {
- _session.endService(_serviceType, _rpcSessionID);
+ _session.endService(_serviceType);
}
}
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java b/baseAndroid/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
deleted file mode 120000
index 0e22d9dc9..000000000
--- a/baseAndroid/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../../base/src/main/java/com/smartdevicelink/SdlConnection/ISdlConnectionListener.java \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/SdlConnection/ISdlSessionListener.java b/baseAndroid/src/main/java/com/smartdevicelink/SdlConnection/ISdlSessionListener.java
new file mode 120000
index 000000000..2c9daabfa
--- /dev/null
+++ b/baseAndroid/src/main/java/com/smartdevicelink/SdlConnection/ISdlSessionListener.java
@@ -0,0 +1 @@
+../../../../../../../base/src/main/java/com/smartdevicelink/SdlConnection/ISdlSessionListener.java \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/protocol/IProtocolListener.java b/baseAndroid/src/main/java/com/smartdevicelink/protocol/IProtocolListener.java
deleted file mode 120000
index 05acb054b..000000000
--- a/baseAndroid/src/main/java/com/smartdevicelink/protocol/IProtocolListener.java
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../../base/src/main/java/com/smartdevicelink/protocol/IProtocolListener.java \ No newline at end of file
diff --git a/javaSE/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java b/javaSE/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
index 98150b218..542ff6b35 100644
--- a/javaSE/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
+++ b/javaSE/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
@@ -33,14 +33,15 @@
package com.smartdevicelink.SdlConnection;
+import com.smartdevicelink.protocol.SdlPacket;
import com.smartdevicelink.protocol.SdlProtocol;
import com.smartdevicelink.protocol.SdlProtocolBase;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.util.DebugTool;
+import com.smartdevicelink.util.Version;
-import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
public class SdlSession extends BaseSdlSession {
@@ -48,7 +49,7 @@ public class SdlSession extends BaseSdlSession {
private static final String TAG = "SdlSession";
- public SdlSession(ISdlConnectionListener listener, BaseTransportConfig config) {
+ public SdlSession(ISdlSessionListener listener, BaseTransportConfig config) {
super(listener, config);
}
@@ -57,50 +58,46 @@ public class SdlSession extends BaseSdlSession {
return new SdlProtocol(this, transportConfig);
}
-
@Override
- public void onProtocolSessionStarted(SessionType sessionType,
- byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
-
- DebugTool.logInfo(TAG, "Protocol session started");
+ public void onServiceStarted(SdlPacket packet, SessionType serviceType, int sessionID, Version version, boolean isEncrypted) {
+ DebugTool.logInfo(TAG, serviceType.getName() + " service started");
- this.sessionId = sessionID;
- if (sessionType.eq(SessionType.RPC)) {
- sessionHashId = hashID;
+ if (serviceType != null && serviceType.eq(SessionType.RPC) && this.sessionId == -1) {
+ this.sessionId = sessionID;
+ this.sessionListener.onSessionStarted(sessionID, version);
}
if (isEncrypted) {
- encryptedServices.addIfAbsent(sessionType);
+ encryptedServices.addIfAbsent(serviceType);
}
- this.sessionListener.onProtocolSessionStarted(sessionType, sessionID, version, correlationID, hashID, isEncrypted);
- if (serviceListeners != null && serviceListeners.containsKey(sessionType)) {
- CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
+ if (serviceListeners != null && serviceListeners.containsKey(serviceType)) {
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(serviceType);
for (ISdlServiceListener listener : listeners) {
- listener.onServiceStarted(this, sessionType, isEncrypted);
+ listener.onServiceStarted(this, serviceType, isEncrypted);
}
}
-
}
@Override
- public void onProtocolSessionEnded(SessionType sessionType, byte sessionID,
- String correlationID) {
- this.sessionListener.onProtocolSessionEnded(sessionType, sessionID, correlationID);
- if (serviceListeners != null && serviceListeners.containsKey(sessionType)) {
- CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
+ public void onServiceEnded(SdlPacket packet, SessionType serviceType, int sessionID) {
+
+ if (SessionType.RPC.equals(serviceType)) {
+ this.sessionListener.onSessionEnded(sessionID);
+ }
+
+ if (serviceListeners != null && serviceListeners.containsKey(serviceType)) {
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(serviceType);
for (ISdlServiceListener listener : listeners) {
- listener.onServiceEnded(this, sessionType);
+ listener.onServiceEnded(this, serviceType);
}
}
- encryptedServices.remove(sessionType);
- }
+ encryptedServices.remove(serviceType);
+ }
@Override
- public void onProtocolSessionEndedNACKed(SessionType sessionType,
- byte sessionID, String correlationID) {
- this.sessionListener.onProtocolSessionEndedNACKed(sessionType, sessionID, correlationID);
+ public void onServiceError(SdlPacket packet, SessionType sessionType, int sessionID, String error) {
if (serviceListeners != null && serviceListeners.containsKey(sessionType)) {
CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
for (ISdlServiceListener listener : listeners) {
@@ -109,22 +106,4 @@ public class SdlSession extends BaseSdlSession {
}
}
-
-
-
-
- /* ***********************************************************************************************************************************************************************
- * ***************************************************************** IProtocol Listener ********************************************************************************
- *************************************************************************************************************************************************************************/
-
- public void onProtocolSessionNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
- this.sessionListener.onProtocolSessionStartedNACKed(sessionType,
- sessionID, version, correlationID, rejectedParams);
- if (serviceListeners != null && serviceListeners.containsKey(sessionType)) {
- CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
- for (ISdlServiceListener listener : listeners) {
- listener.onServiceError(this, sessionType, "Start " + sessionType.toString() + " Service NAKed");
- }
- }
- }
} \ No newline at end of file
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
index edca46f1d..b7167b81c 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
@@ -33,7 +33,6 @@
package com.smartdevicelink.managers.lifecycle;
import androidx.annotation.RestrictTo;
-import com.smartdevicelink.util.Log;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.exception.SdlException;
@@ -53,7 +52,7 @@ public class LifecycleManager extends BaseLifecycleManager {
@Override
void initialize() {
super.initialize();
- this.session = new SdlSession(sdlConnectionListener, _transportConfig);
+ this.session = new SdlSession(this.sdlSessionListener, _transportConfig);
}
@Override