diff options
author | Joey Grover <joeygrover@gmail.com> | 2018-09-28 14:30:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-28 14:30:37 -0400 |
commit | 8aa8bb330e6d3cdc158d0a1f10c19955e87b5528 (patch) | |
tree | 952b71116c38384eeed348f8320fe6ab1a00a356 | |
parent | 1de09ffbbe97f47fd95f965ae2499435224a8c15 (diff) | |
parent | 3284e755177358c5b5009bec71c6c1bbfab970b1 (diff) | |
download | sdl_android-8aa8bb330e6d3cdc158d0a1f10c19955e87b5528.tar.gz |
Merge pull request #878 from smartdevicelink/feature/cleanup_managers
Minor cleanup to managers
10 files changed, 95 insertions, 149 deletions
diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamingManagerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamingManagerTests.java index c7e4256a4..baddc8182 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamingManagerTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamingManagerTests.java @@ -25,6 +25,7 @@ import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener; import com.smartdevicelink.streaming.video.SdlRemoteDisplay; import com.smartdevicelink.streaming.video.VideoStreamingParameters; import com.smartdevicelink.test.Test; +import com.smartdevicelink.util.Version; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -116,7 +117,7 @@ public class VideoStreamingManagerTests extends AndroidTestCase { public void testHMILevelNotFull(){ ISdl internalInterface = mock(ISdl.class); - when(internalInterface.getWiProVersion()).thenReturn((byte)5); + when(internalInterface.getProtocolVersion()).thenReturn((new Version(5,0,0))); when(internalInterface.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(true); final VideoStreamingManager videoStreamingManager = new VideoStreamingManager(internalInterface); @@ -134,7 +135,7 @@ public class VideoStreamingManagerTests extends AndroidTestCase { final Set<Object> listenerSet = new HashSet<>(); - when(internalInterface.getWiProVersion()).thenReturn((byte)5); + when(internalInterface.getProtocolVersion()).thenReturn(new Version(5,0,0)); when(internalInterface.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(true); Answer<Void> onGetCapability = new Answer<Void>() { diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java index b459fc3f6..accd50f40 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/protocol/SdlProtocolTests.java @@ -20,6 +20,8 @@ import java.io.ByteArrayOutputStream; import java.lang.reflect.Method; import java.util.List; +import static org.mockito.Mockito.mock; + public class SdlProtocolTests extends AndroidTestCase { int max_int = 2147483647; @@ -27,102 +29,7 @@ public class SdlProtocolTests extends AndroidTestCase { MultiplexTransportConfig config; SdlProtocol protocol; - ISdlProtocol defaultListener = new ISdlProtocol() { - @Override - public byte getSessionId() { - return 0; - } - - @Override - public void shutdown(String info) { - - } - - @Override - public void onTransportDisconnected(String info, boolean altTransportAvailable, MultiplexTransportConfig transportConfig) { - - } - - @Override - public SdlSecurityBase getSdlSecurity() { - return null; - } - - @Override - public VideoStreamingParameters getDesiredVideoParams() { - return null; - } - - @Override - public void setAcceptedVideoParams(VideoStreamingParameters acceptedVideoParams) { - - } - - @Override - public void stopStream(SessionType serviceType) { - - } - - @Override - public void onProtocolMessageBytesToSend(SdlPacket packet) { - - } - - @Override - public void onProtocolMessageReceived(ProtocolMessage msg) { - - } - - @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) { - - } - - @Override - public void onResetIncomingHeartbeat(SessionType sessionType, byte sessionID) { - - } - - @Override - public void onProtocolError(String info, Exception e) { - - } - }; + ISdlProtocol defaultListener = mock(ISdlProtocol.class); public static class DidReceiveListener implements ISdlProtocol{ boolean didReceive = false; diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java index d3768c53b..8916fe054 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java @@ -202,8 +202,8 @@ public class SystemCapabilityManagerTests extends AndroidTestCase { } @Override - public byte getWiProVersion() { - return 0; + public Version getProtocolVersion() { + return new Version(1,0,0); } diff --git a/sdl_android/src/main/AndroidManifest.xml b/sdl_android/src/main/AndroidManifest.xml index a958fb2fc..4c5fd52e2 100644 --- a/sdl_android/src/main/AndroidManifest.xml +++ b/sdl_android/src/main/AndroidManifest.xml @@ -1,3 +1,2 @@ <manifest package="com.smartdevicelink" xmlns:android="http://schemas.android.com/apk/res/android">
- <uses-sdk android:minSdkVersion="8"/>
</manifest>
diff --git a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java index 7c3b63b27..24c9e1763 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java +++ b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java @@ -31,6 +31,7 @@ import com.smartdevicelink.transport.BaseTransportConfig; import com.smartdevicelink.transport.MultiplexTransport;
import com.smartdevicelink.transport.MultiplexTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.util.Version;
import java.io.IOException;
import java.io.InputStream;
@@ -760,6 +761,11 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList return protocol;
}
+ public Version getProtocolVersion(){
+ //Since this session version never supported a minor protocol version this should be fine
+ return new Version(wiproProcolVer,0,0);
+ }
+
/**
* Check to see if a transport is available to start/use the supplied service.
* @param sessionType the session that should be checked for transport availability
diff --git a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java index adafbb4ef..497e3da95 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java +++ b/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java @@ -45,6 +45,7 @@ import com.smartdevicelink.proxy.interfaces.ISdlServiceListener; import com.smartdevicelink.transport.BaseTransportConfig; import com.smartdevicelink.transport.MultiplexTransportConfig; import com.smartdevicelink.transport.enums.TransportType; +import com.smartdevicelink.util.Version; import java.util.List; import java.util.ListIterator; @@ -173,8 +174,20 @@ public class SdlSession2 extends SdlSession implements ISdlProtocol{ this.sessionListener.onTransportDisconnected(info, altTransportAvailable, (MultiplexTransportConfig)this.transportConfig); } + /** + * Get the current protocol version used by this session + * @return Version that represents the Protocol version being used + */ + @Override + public Version getProtocolVersion(){ + if(sdlProtocol!=null){ + return sdlProtocol.getProtocolVersion(); + } + return new Version(1,0,0); + } - /* *********************************************************************************************************************************************************************** + + /* *********************************************************************************************************************************************************************** * ***************************************************************** IProtocol Listener ******************************************************************************** *************************************************************************************************************************************************************************/ diff --git a/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java b/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java index e0594d3a3..1c478b8c4 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java +++ b/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java @@ -805,8 +805,8 @@ public class SdlManager{ } @Override - public byte getWiProVersion() { - return proxy.getWiProVersion(); + public com.smartdevicelink.util.Version getProtocolVersion() { + return proxy.getProtocolVersion(); } }; diff --git a/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamingManager.java b/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamingManager.java index 2690a8b6b..3ececf0b0 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamingManager.java +++ b/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamingManager.java @@ -142,13 +142,14 @@ public class VideoStreamingManager extends BaseSubManager { public void startRemoteDisplayStream(Context context, Class<? extends SdlRemoteDisplay> remoteDisplayClass, VideoStreamingParameters parameters, final boolean encrypted){ this.context = new WeakReference<>(context); this.remoteDisplayClass = remoteDisplayClass; - if(internalInterface.getWiProVersion() >= 5 && !internalInterface.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){ + int majorProtocolVersion = internalInterface.getProtocolVersion().getMajor(); + if(majorProtocolVersion >= 5 && !internalInterface.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){ Log.e(TAG, "Video streaming not supported on this module"); stateMachine.transitionToState(StreamingStateMachine.ERROR); return; } if(parameters == null){ - if(internalInterface.getWiProVersion() >= 5) { + if(majorProtocolVersion >= 5) { internalInterface.getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() { @Override public void onCapabilityRetrieved(Object capability) { @@ -357,7 +358,7 @@ public class VideoStreamingManager extends BaseSubManager { } //Get touch scalars ImageResolution resolution = null; - if(internalInterface.getWiProVersion() >=5){ //At this point we should already have the capability + if(internalInterface.getProtocolVersion().getMajor() >= 5){ //At this point we should already have the capability VideoStreamingCapability capability = (VideoStreamingCapability) internalInterface.getCapability(SystemCapabilityType.VIDEO_STREAMING); resolution = capability.getPreferredResolution(); }else { diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java index c8cbd1a96..6b2be9725 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java @@ -93,6 +93,7 @@ import com.smartdevicelink.transport.SiphonServer; import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.CorrelationIdGenerator;
import com.smartdevicelink.util.DebugTool;
+import com.smartdevicelink.util.Version;
import org.json.JSONArray;
import org.json.JSONException;
@@ -243,7 +244,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> private final CopyOnWriteArrayList<IPutFileResponseListener> _putFileListenerList = new CopyOnWriteArrayList<IPutFileResponseListener>();
- protected byte _wiproVersion = 1;
+ protected com.smartdevicelink.util.Version protocolVersion = new com.smartdevicelink.util.Version(1,0,0);
protected com.smartdevicelink.util.Version rpcSpecVersion;
protected SparseArray<OnRPCResponseListener> rpcResponseListeners = null;
@@ -371,8 +372,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
@Override
- public byte getWiProVersion() {
- return getWiProVersion();
+ public com.smartdevicelink.util.Version getProtocolVersion() {
+ return SdlProxyBase.this.protocolVersion;
}
@Override
@@ -512,8 +513,12 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> updateBroadcastIntent(sendIntent, "COMMENT2", " ServiceType: " + sessionType.getName());
updateBroadcastIntent(sendIntent, "COMMENT3", " Encrypted: " + isEncrypted);
sendBroadcastIntent(sendIntent);
-
- setWiProVersion(version);
+
+ if(sdlSession!= null){
+ setProtocolVersion(sdlSession.getProtocolVersion());
+ }else{
+ setProtocolVersion(new com.smartdevicelink.util.Version(version,0,0));
+ }
if (sessionType.eq(SessionType.RPC)) {
@@ -543,7 +548,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> } else if (sessionType.eq(SessionType.RPC)){
cycleProxy(SdlDisconnectedReason.RPC_SESSION_ENDED);
}
- else if (_wiproVersion > 1) {
+ 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
@@ -731,8 +736,8 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> boolean callbackToUIThread, Boolean preRegister, String sHashID, Boolean bAppResumeEnab,
BaseTransportConfig transportConfig) throws SdlException
{
- Log.i(TAG, "SDL_LIB_VERSION: " + Version.VERSION);
- setWiProVersion((byte)PROX_PROT_VER_ONE);
+ Log.i(TAG, "SDL_LIB_VERSION: " + com.smartdevicelink.proxy.Version.VERSION);
+ setProtocolVersion(new Version(PROX_PROT_VER_ONE,0,0));
if (preRegister != null && preRegister)
{
@@ -1463,8 +1468,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> if(_transportConfig.getTransportType().equals(TransportType.MULTIPLEX)){
this.sdlSession = new SdlSession2(_interfaceBroker,(MultiplexTransportConfig)_transportConfig);
}else{
- //FIXME this won't actually work
- this.sdlSession = SdlSession.createSession(_wiproVersion,_interfaceBroker, _transportConfig);
+ this.sdlSession = SdlSession.createSession((byte)getProtocolVersion().getMajor(),_interfaceBroker, _transportConfig);
}
}
@@ -1753,12 +1757,18 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> if (message.getSessionType().equals(SessionType.RPC)
||message.getSessionType().equals(SessionType.BULK_DATA) ) {
try {
- if (_wiproVersion == 1) {
- if (message.getVersion() > 1) setWiProVersion(message.getVersion());
+ if (protocolVersion!= null && protocolVersion.getMajor() == 1 && message.getVersion() > 1) {
+ if(sdlSession != null
+ && sdlSession.getProtocolVersion()!= null
+ && sdlSession.getProtocolVersion().getMajor() > 1){
+ setProtocolVersion(sdlSession.getProtocolVersion());
+ }else{
+ setProtocolVersion(new Version(message.getVersion(),0,0));
+ }
}
Hashtable<String, Object> hash = new Hashtable<String, Object>();
- if (_wiproVersion > 1) {
+ if (protocolVersion!= null && protocolVersion.getMajor() > 1) {
Hashtable<String, Object> hashTemp = new Hashtable<String, Object>();
hashTemp.put(RPCMessage.KEY_CORRELATION_ID, message.getCorrID());
if (message.getJsonSize() > 0) {
@@ -1800,20 +1810,27 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> passErrorToProxyListener("Error handing incoming protocol message.", e);
}
}
-
- public byte getWiProVersion() {
- return this._wiproVersion;
+
+ /**
+ * Get the SDL protocol spec version being used
+ * @return Version of the protocol spec
+ */
+ public @NonNull Version getProtocolVersion(){
+ if(this.protocolVersion == null){
+ this.protocolVersion = new Version(1,0,0);
+ }
+ return this.protocolVersion;
}
-
- private void setWiProVersion(byte version) {
- this._wiproVersion = version;
+
+ private void setProtocolVersion(@NonNull Version version) {
+ this.protocolVersion = version;
}
-
+
public String serializeJSON(RPCMessage msg)
{
try
{
- return msg.serializeJSON(getWiProVersion()).toString(2);
+ return msg.serializeJSON((byte)this.getProtocolVersion().getMajor()).toString(2);
}
catch (final Exception e)
{
@@ -1966,7 +1983,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> SdlTrace.logRPCEvent(InterfaceActivityDirection.Transmit, request, SDL_LIB_TRACE_KEY);
request.format(rpcSpecVersion,true);
- byte[] msgBytes = JsonRPCMarshaller.marshall(request, _wiproVersion);
+ byte[] msgBytes = JsonRPCMarshaller.marshall(request, (byte)getProtocolVersion().getMajor());
ProtocolMessage pm = new ProtocolMessage();
pm.setData(msgBytes);
@@ -4128,7 +4145,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
@SuppressWarnings("unchecked")
- private RPCStreamController startRPCStream(String sLocalFile, PutFile request, SessionType sType, byte rpcSessionID, byte wiproVersion)
+ private RPCStreamController startRPCStream(String sLocalFile, PutFile request, SessionType sType, byte rpcSessionID, Version protocolVersion)
{
if (sdlSession == null) return null;
@@ -4143,7 +4160,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
try {
- StreamRPCPacketizer rpcPacketizer = new StreamRPCPacketizer((SdlProxyBase<IProxyListenerBase>) this, sdlSession, is, request, sType, rpcSessionID, wiproVersion, lSize, sdlSession);
+ StreamRPCPacketizer rpcPacketizer = new StreamRPCPacketizer((SdlProxyBase<IProxyListenerBase>) this, sdlSession, is, request, sType, rpcSessionID, protocolVersion, rpcSpecVersion, lSize, sdlSession);
rpcPacketizer.start();
return new RPCStreamController(rpcPacketizer, request.getCorrelationID());
} catch (Exception e) {
@@ -4153,7 +4170,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
@SuppressWarnings({"unchecked", "UnusedReturnValue"})
- private RPCStreamController startRPCStream(InputStream is, PutFile request, SessionType sType, byte rpcSessionID, byte wiproVersion)
+ private RPCStreamController startRPCStream(InputStream is, PutFile request, SessionType sType, byte rpcSessionID, Version protocolVersion)
{
if (sdlSession == null) return null;
Long lSize = request.getLength();
@@ -4164,7 +4181,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
try {
- StreamRPCPacketizer rpcPacketizer = new StreamRPCPacketizer((SdlProxyBase<IProxyListenerBase>) this, sdlSession, is, request, sType, rpcSessionID, wiproVersion, lSize, sdlSession);
+ StreamRPCPacketizer rpcPacketizer = new StreamRPCPacketizer((SdlProxyBase<IProxyListenerBase>) this, sdlSession, is, request, sType, rpcSessionID, protocolVersion, rpcSpecVersion, lSize, sdlSession);
rpcPacketizer.start();
return new RPCStreamController(rpcPacketizer, request.getCorrelationID());
} catch (Exception e) {
@@ -4175,25 +4192,25 @@ 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(), _wiproVersion);
+ return startRPCStream(sPath, msg, SessionType.RPC, 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(), _wiproVersion);
+ return startRPCStream(is, msg, SessionType.RPC, sdlSession.getSessionId(), protocolVersion);
}
@SuppressWarnings("UnusedReturnValue")
public boolean startRPCStream(InputStream is, RPCRequest msg) {
- if (sdlSession == null) return false;
- sdlSession.startRPCStream(is, msg, SessionType.RPC, sdlSession.getSessionId(), _wiproVersion);
+ if (sdlSession == null) return false;
+ sdlSession.startRPCStream(is, msg, SessionType.RPC, sdlSession.getSessionId(), (byte)getProtocolVersion().getMajor());
return true;
}
public OutputStream startRPCStream(RPCRequest msg) {
if (sdlSession == null) return null;
- return sdlSession.startRPCStream(msg, SessionType.RPC, sdlSession.getSessionId(), _wiproVersion);
+ return sdlSession.startRPCStream(msg, SessionType.RPC, sdlSession.getSessionId(), (byte)getProtocolVersion().getMajor());
}
public void endRPCStream() {
@@ -4593,7 +4610,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> */
@TargetApi(19)
public void startRemoteDisplayStream(Context context, final Class<? extends SdlRemoteDisplay> remoteDisplay, final VideoStreamingParameters parameters, final boolean encrypted){
- if(getWiProVersion() >= 5 && !_systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
+ if(protocolVersion!= null && protocolVersion.getMajor() >= 5 && !_systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
Log.e(TAG, "Video streaming not supported on this module");
return;
}
@@ -4603,7 +4620,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
if(parameters == null){
- if(getWiProVersion() >= 5) {
+ if(protocolVersion!= null && protocolVersion.getMajor() >= 5) {
_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING, new OnSystemCapabilityListener() {
@Override
public void onCapabilityRetrieved(Object capability) {
@@ -4664,7 +4681,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> DebugTool.logWarning("SdlSession is not created yet.");
return null;
}
- if(getWiProVersion() >= 5 && !_systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
+ if(protocolVersion!= null && protocolVersion.getMajor() >= 5 && !_systemCapabilityManager.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
DebugTool.logWarning("Module doesn't support video streaming.");
return null;
}
@@ -4690,7 +4707,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> scheduler.shutdown();
if (navServiceStartResponse) {
- if(getWiProVersion() < 5){ //Versions 1-4 do not support streaming parameter negotiations
+ if(protocolVersion!= null && protocolVersion.getMajor() < 5){ //Versions 1-4 do not support streaming parameter negotiations
sdlSession.setAcceptedVideoParams(parameters);
}
return sdlSession.getAcceptedVideoParams();
@@ -7436,7 +7453,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> public void onCreated(final SdlRemoteDisplay remoteDisplay) {
//Remote display has been created.
//Now is a good time to do parsing for spatial data
- VideoStreamingManager.this.remoteDisplay = remoteDisplay;
+ SdlProxyBase.VideoStreamingManager.this.remoteDisplay = remoteDisplay;
if(hapticManager != null) {
remoteDisplay.getMainView().post(new Runnable() {
@Override
@@ -7447,7 +7464,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> }
//Get touch scalars
ImageResolution resolution = null;
- if(getWiProVersion()>=5){ //At this point we should already have the capability
+ if(protocolVersion!= null && protocolVersion.getMajor()>=5){ //At this point we should already have the capability
VideoStreamingCapability capability = (VideoStreamingCapability)_systemCapabilityManager.getCapability(SystemCapabilityType.VIDEO_STREAMING);
resolution = capability.getPreferredResolution();
}else {
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java index d7e2758c6..29d3b9073 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java @@ -1,5 +1,7 @@ package com.smartdevicelink.proxy.interfaces; +import android.support.annotation.NonNull; + import com.smartdevicelink.protocol.enums.FunctionID; import com.smartdevicelink.protocol.enums.SessionType; import com.smartdevicelink.proxy.RPCRequest; @@ -201,15 +203,15 @@ public interface ISdl { boolean removeOnSystemCapabilityListener(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener listener); /** - * Get SdlMsgVersion - * @return SdlMsgVersion + * Get the RPC specification version currently being used for the SDL messages + * @return SdlMsgVersion the current RPC specification version */ - SdlMsgVersion getSdlMsgVersion(); + @NonNull SdlMsgVersion getSdlMsgVersion(); /** - * Get WiPro version + * Get the protocol version of this session * @return byte value representing WiPro version */ - byte getWiProVersion(); + @NonNull Version getProtocolVersion(); } |