diff options
author | Joey Grover <joeygrover@gmail.com> | 2021-02-11 14:48:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 14:48:21 -0500 |
commit | 3a84cea88ad75f1fa72152ac513f7198c758ab06 (patch) | |
tree | 0da6d6266253b22d933e490ca7c8ff7057526cc1 /javaSE | |
parent | a9dd49ada852755d67ca7c08c028a1ac199d250a (diff) | |
download | sdl_android-3a84cea88ad75f1fa72152ac513f7198c758ab06.tar.gz |
[SDL-0293] OEM Exclusive App Support - Protocol & Manager layers (#1618)
* Implement 0293
Does not include android specific implementaiton pieces
* Update hello world apps
* Update unit tests
* Increase max protocol version
* Add missing nullable tag in SystemInfo
* Add missing nullable tag to method in SystemInfo
* Apply suggestions from code review
Correctly format if statement
Co-authored-by: Julian Kast <Julian.kast@livio.io>
Co-authored-by: Julian Kast <Julian.kast@livio.io>
Diffstat (limited to 'javaSE')
3 files changed, 23 insertions, 2 deletions
diff --git a/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java b/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java index 176d6010e..d4eef253b 100644 --- a/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java +++ b/javaSE/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java @@ -52,6 +52,7 @@ import com.smartdevicelink.proxy.rpc.enums.*; import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener; import com.smartdevicelink.transport.BaseTransportConfig; import com.smartdevicelink.util.DebugTool; +import com.smartdevicelink.util.SystemInfo; import java.util.*; @@ -170,6 +171,12 @@ public class SdlService { return null; } } + + @Override + public boolean onSystemInfoReceived(SystemInfo systemInfo) { + //Check the SystemInfo object to ensure that the connection to the device should continue + return true; + } }; diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java index cf3e7d04c..fbe236f08 100644 --- a/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java +++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java @@ -33,6 +33,7 @@ package com.smartdevicelink.managers; import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate; import com.smartdevicelink.proxy.rpc.enums.Language; +import com.smartdevicelink.util.SystemInfo; public interface SdlManagerListener extends BaseSdlManagerListener { @@ -67,4 +68,12 @@ public interface SdlManagerListener extends BaseSdlManagerListener { * otherwise null to indicate that the language is not supported. */ LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage); + + /** + * A way to determine if this SDL session should continue to be active while + * connected to the determined system information of the vehicle. + * @param systemInfo systemInfo - the system information of the vehicle that this session is currently active on. + * @return Return true if this session should continue, false if the session should end + */ + boolean onSystemInfoReceived(SystemInfo systemInfo); } diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/session/SdlSession.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/session/SdlSession.java index 3fa84ed27..91df403f9 100644 --- a/javaSE/javaSE/src/main/java/com/smartdevicelink/session/SdlSession.java +++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/session/SdlSession.java @@ -42,6 +42,7 @@ import com.smartdevicelink.protocol.SdlProtocolBase; import com.smartdevicelink.protocol.enums.SessionType; import com.smartdevicelink.transport.BaseTransportConfig; import com.smartdevicelink.util.DebugTool; +import com.smartdevicelink.util.SystemInfo; import com.smartdevicelink.util.Version; import java.util.concurrent.CopyOnWriteArrayList; @@ -67,7 +68,11 @@ public class SdlSession extends BaseSdlSession { if (serviceType != null && serviceType.eq(SessionType.RPC) && this.sessionId == -1) { this.sessionId = sessionID; - this.sessionListener.onSessionStarted(sessionID, version); + SystemInfo systemInfo = null; + if (version != null && version.isNewerThan(new Version(5, 4, 0)) >= 0) { + systemInfo = extractSystemInfo(packet); + } + this.sessionListener.onSessionStarted(sessionID, version, systemInfo); } if (isEncrypted) { @@ -109,4 +114,4 @@ public class SdlSession extends BaseSdlSession { } } -}
\ No newline at end of file +} |