[6.2.0][Opt]新增乘客屏美化模式变化回调

This commit is contained in:
chenfufeng
2023-11-13 11:45:53 +08:00
parent c95700933d
commit 6a5bc955b2
3 changed files with 36 additions and 3 deletions

View File

@@ -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()
}

View File

@@ -4,4 +4,6 @@ interface IReceivedMsgListener {
fun onReceivedMsg(type: Int, byteArray: ByteArray)
fun onReceivedServerSn(sn: String?) {}
fun onDemoMode(isDemoMode: Boolean) {}
}

View File

@@ -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<IReceivedMsgListener>() {
}
}
}
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}")
}
}
}
}
}