diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt index e897c2e87a..7d5ddf1729 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt @@ -8,6 +8,9 @@ import com.mogo.commons.debug.DebugConfig.getNetMode import com.mogo.commons.storage.SharedPrefsMgr import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.msgbox.AutopilotMsg +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager @@ -15,6 +18,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_D_C @@ -198,6 +202,48 @@ class MoGoAdasMsgConnectStatusListenerImpl : CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatusDescribe = reason CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus() CallerAutoPilotStatusListenerManager.invokeAutoPilotIPCStatusChanged(status, reason) + saveIntoMsgBox(status, reason) + } + + private fun saveIntoMsgBox( + status: AdasConstants.IpcConnectionStatus, + reason: String? + ) { + var title = "" + var content = "" + when (status) { + AdasConstants.IpcConnectionStatus.DISCONNECTED -> { + title = "连接异常" + content = "域控未连接或主动断开连接" + } + + AdasConstants.IpcConnectionStatus.CONNECT_EXCEPTION -> { + title = "连接异常" + content = "域控连接异常:$reason" + } + + AdasConstants.IpcConnectionStatus.NOT_FOUND_ADDRESS -> { + title = "连接异常" + content = "找不到可用的域控地址" + } + AdasConstants.IpcConnectionStatus.HEARTBEAT_TIMEOUT -> { + title = "连接异常" + content = "域控心跳超时" + } + AdasConstants.IpcConnectionStatus.SERVER_DISCONNECTED -> { + title = "连接异常" + content = "域控主动断开连接" + } + else -> {} + } + if (title.isNotEmpty() && content.isNotEmpty()) { + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.AUTOPILOT, + AutopilotMsg(0, title, content, System.currentTimeMillis()) + ) + ) + } } override fun onCompatibility(versionCompatibility: VersionCompatibility?) { diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt index a3197239f6..fb74c36f47 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt @@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.call.autopilot import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo -import com.mogo.eagle.core.data.msgbox.AutopilotMsg import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.SSMMsg @@ -217,14 +216,6 @@ object CallerAutoPilotStatusListenerManager : CallerBase { - CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.AUTOPILOT, AutopilotMsg(0, "连接异常", "域控未连接或主动断开连接", System.currentTimeMillis()))) - } - AdasConstants.IpcConnectionStatus.CONNECT_EXCEPTION -> { - CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.AUTOPILOT, AutopilotMsg(0, "连接异常", "域控连接异常:$reason", System.currentTimeMillis()))) - } - } } /**