diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/telematic/TeleMsgHandler.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/telematic/TeleMsgHandler.kt index 11c5c832ff..0592eb97a2 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/telematic/TeleMsgHandler.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/telematic/TeleMsgHandler.kt @@ -68,6 +68,7 @@ class TeleMsgHandler : IMsgHandler { invokeReqStatusLog(mapOf("dataParseError" to "${e.message}")) } } + MogoProtocolMsg.SYNC_MODE_STATUS -> { val content = String(it.body) if (content.contains(";")) { @@ -75,18 +76,20 @@ class TeleMsgHandler : IMsgHandler { if (strArr.size == 2) { val currTime = strArr[1].toLong() if (currTime > demoModeTime) { - FunctionBuildConfig.isDemoMode = when (strArr[0]) { + val demoMode = when (strArr[0]) { "1" -> true else -> false } + CallerTelematicListenerManager.dispatchDemoMode(demoMode) demoModeTime = currTime - invokeNettyConnResult("乘客屏收到的美化模式DemoMode为:${FunctionBuildConfig.isDemoMode}") + invokeNettyConnResult("乘客屏收到的美化模式DemoMode为:${demoMode}") } else { - invokeNettyConnResult("乘客屏收到过时的美化模式DemoMode为:${FunctionBuildConfig.isDemoMode}") + invokeNettyConnResult("乘客屏收到过时的美化模式DemoMode") } } } } + MogoProtocolMsg.REQ_MAC_ADDRESS -> { val carConfig = MessagePad.CarConfigResp.parseFrom(msg.body) AppConfigInfo.plateNumber = carConfig.plateNumber @@ -132,12 +135,14 @@ class TeleMsgHandler : IMsgHandler { } } } + TelematicConstant.BUSINESS_STRING -> { CallerTelematicListenerManager.invokeReceivedMsg( TelematicConstant.BUSINESS_STRING, it.body ) } + TelematicConstant.SHOW_TRAFFIC_LIGHT -> { val trafficLightJson = String(it.body) CallerTrafficLightListenerManager.invokeTrafficLightStatus( @@ -147,11 +152,13 @@ class TeleMsgHandler : IMsgHandler { ) ) } + TelematicConstant.HIDE_TRAFFIC_LIGHT -> { ThreadUtils.runOnUiThread { CallerTrafficLightListenerManager.invokeEnterCrossRoad(false) } } + TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR -> { ThreadUtils.runOnUiThread { CallerTelematicListenerManager.invokeReceivedMsg( @@ -166,16 +173,19 @@ class TeleMsgHandler : IMsgHandler { "0" -> { HmiBuildConfig.isShowRunRedLightView = false } + "1" -> { HmiBuildConfig.isShowRunRedLightView = true } } } + TelematicConstant.OBU_GREENWAVE_WARNING -> { when (String(it.body)) { "0" -> { HmiBuildConfig.isShowGreenWaveView = false } + "1" -> { HmiBuildConfig.isShowGreenWaveView = true } @@ -213,6 +223,7 @@ class TeleMsgHandler : IMsgHandler { MogoProtocolMsg.NORMAL_DATA -> { AdasManager.getInstance().sendWsMessage(it.body) } + 10 -> { val sn = MoGoAiCloudClientConfig.getInstance().sn if (!sn.isNullOrEmpty()) { @@ -226,12 +237,14 @@ class TeleMsgHandler : IMsgHandler { invokeNettyConnResult("司机屏SN未获取到,不发送给乘客屏") } } + TelematicConstant.BUSINESS_STRING -> { CallerTelematicListenerManager.invokeReceivedMsg( TelematicConstant.BUSINESS_STRING, it.body ) } + else -> { } } @@ -272,6 +285,7 @@ class TeleMsgHandler : IMsgHandler { // 请求司机屏SN reqServerSN() } + ConnectState.STATUS_CONNECT_CLOSED -> {// 由于重连机制会回调多次 if (isFirstDisc) { isFirstDisc = false @@ -282,12 +296,14 @@ class TeleMsgHandler : IMsgHandler { AdasManager.getInstance().stopDispatchHandler() } } + ConnectState.STATUS_CONNECT_ERROR -> { AppConfigInfo.plateNumber = "" ToastUtils.showLong("和司机端连接异常!") invokeReqStatusLog(mapOf("dpConnectErrorMsg" to "$content")) AdasManager.getInstance().stopDispatchHandler() } + else -> { AdasManager.getInstance().stopDispatchHandler() } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/telematic/IReceivedMsgListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/telematic/IReceivedMsgListener.kt index c52314f9d0..403be36126 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/telematic/IReceivedMsgListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/telematic/IReceivedMsgListener.kt @@ -4,4 +4,6 @@ interface IReceivedMsgListener { fun onReceivedMsg(type: Int, byteArray: ByteArray) fun onReceivedServerSn(sn: String?) {} + + fun onDemoMode(isDemoMode: Boolean) {} } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/telematic/CallerTelematicListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/telematic/CallerTelematicListenerManager.kt index c6016a1d3b..45c9c16f6c 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/telematic/CallerTelematicListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/telematic/CallerTelematicListenerManager.kt @@ -1,6 +1,7 @@ package com.mogo.eagle.core.function.call.telematic import android.util.Log +import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener import com.mogo.eagle.core.function.call.base.CallerBase @@ -29,4 +30,18 @@ object CallerTelematicListenerManager: CallerBase() { } } } + + fun dispatchDemoMode(isDemoMode: Boolean) { + if (isDemoMode != FunctionBuildConfig.isDemoMode) { + FunctionBuildConfig.isDemoMode = isDemoMode + M_LISTENERS.forEach { + val listener = it.value + try { + listener.onDemoMode(isDemoMode) + } catch (e: Exception) { + Log.e(TAG, "转发美化模式出现异常:${e.message}") + } + } + } + } } \ No newline at end of file