diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt index 82625092e3..5494a0ca96 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt @@ -32,6 +32,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotControlProvider import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_RAIN import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerIpcConnectStateToastManager import com.mogo.eagle.core.function.call.cloud.CallerCloudCertManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager @@ -1022,8 +1023,10 @@ class MoGoAutopilotControlProvider : nodeAliasCode = CHAIN_CODE_ADAS_POWER_OFF, paramIndexes = [-1] ) - override fun sendIpcPowerOff() : Long{ - return AdasManager.getInstance().sendIpcPowerOff() + override fun sendIpcPowerOff(): Long { + val id = AdasManager.getInstance().sendIpcPowerOff() + CallerIpcConnectStateToastManager.powerOffMsgId = id + return id } /** diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index 5d041b5468..8eb030a736 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -67,6 +67,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerMa import com.mogo.eagle.core.function.call.autopilot.CallerColdStartStateListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerFaultManagementStateListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerIpcConnectStateToastManager import com.mogo.eagle.core.function.call.autopilot.CallerLocalizationStateListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerNodeStateListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager @@ -1310,6 +1311,7 @@ class MoGoAdasListenerImpl : OnAdasListener { * @param receivedAck 回执 */ override fun onReceiveReceivedAck(receivedAck: ReceivedAck) { + CallerIpcConnectStateToastManager.receivedAck(receivedAck) CallerReceiveReceivedAckListenerManager.invokeReceiveReceivedAck(receivedAck) if (receivedAck.messageType == MessageType.TYPE_SEND_SET_AUTOPILOT_MODE_REQ ||//设置自动驾驶模式 receivedAck.messageType == MessageType.TYPE_SEND_SET_DEMO_MODE_REQ ||//设置演示模式 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 f0a623775c..48bb9d778c 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 @@ -21,6 +21,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerIpcConnectStateToastManager 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 @@ -32,7 +33,6 @@ import com.mogo.eagle.core.utilcode.util.ToastUtils import com.zhidao.support.adas.high.AdasManager import com.zhidao.support.adas.high.OnAdasConnectStatusListener import com.zhidao.support.adas.high.bean.VersionCompatibility -import com.zhidao.support.adas.high.chain.AdasChain import com.zhidao.support.adas.high.common.Constants.ENVIRONMENT.DEMO import com.zhidao.support.adas.high.common.Constants.ENVIRONMENT.DEVELOP import com.zhidao.support.adas.high.common.Constants.ENVIRONMENT.PRODUCTION @@ -76,7 +76,9 @@ class MoGoAdasMsgConnectStatusListenerImpl : } private fun connectToast(reason: String) { - ToastUtils.showShort(reason) + if (CallerIpcConnectStateToastManager.isToast) { + ToastUtils.showShort(reason) + } } private fun resetArgs() { @@ -122,6 +124,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : AdasConstants.IpcConnectionStatus.CONNECTED -> { connectStatusDescribe = "已连接" CallerLogger.d("$M_D_C$TAG", connectStatusDescribe) + CallerIpcConnectStateToastManager.ipcConnected() // 初始化自动驾驶状态信息 CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP = AdasManager.getInstance().ipcConnectedIp diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MsgBoxToastView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MsgBoxToastView.kt index 0b695bc18b..733f4e46fc 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MsgBoxToastView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MsgBoxToastView.kt @@ -20,6 +20,7 @@ import com.mogo.eagle.core.data.msgbox.MsgFmData import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener import com.mogo.eagle.core.function.api.datacenter.msgbox.IMsgBoxListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerIpcConnectStateToastManager import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager @@ -87,6 +88,9 @@ class MsgBoxToastView @JvmOverloads constructor( UiThreadHandler.post({ when (category) { MsgCategory.NOTICE -> { + if (msgBoxBean.type == MsgBoxType.AUTOPILOT && !CallerIpcConnectStateToastManager.isToast) { + return@post + } MsgBoxConfig.noticeList.add(msgBoxBean) } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoIpcConnectStateToastListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoIpcConnectStateToastListener.kt new file mode 100644 index 0000000000..77217e518c --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoIpcConnectStateToastListener.kt @@ -0,0 +1,8 @@ +package com.mogo.eagle.core.function.api.autopilot + + +interface IMoGoIpcConnectStateToastListener { + + + fun onIpcConnectStateToast(isToast: Boolean) +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerIpcConnectStateToastManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerIpcConnectStateToastManager.kt new file mode 100644 index 0000000000..8c9bd08804 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerIpcConnectStateToastManager.kt @@ -0,0 +1,39 @@ +package com.mogo.eagle.core.function.call.autopilot + +import com.mogo.eagle.core.function.api.autopilot.IMoGoIpcConnectStateToastListener +import com.mogo.eagle.core.function.call.base.CallerBase +import com.zhjt.mogo.adas.common.MessageType +import com.zhjt.mogo.adas.data.bean.ReceivedAck + +/** + * 执行关机命令成功后 消息盒子弹出管理 + * 关机命令执行成功后 域控连接失败时将不进行消息盒子弹出提醒 + * 目前 IMoGoIpcConnectStateBoxToastListener 暂时用不到,直接使用 isToast 获取状态,Toast和消息盒子Toast都属于主动触发式 + */ +object CallerIpcConnectStateToastManager : CallerBase() { + + var powerOffMsgId = -1L + var isToast = true//是否展示提示信息 + + fun receivedAck(receivedAck: ReceivedAck) { + if (powerOffMsgId != -1L && receivedAck.messageType == MessageType.TYPE_SEND_SYSTEM_CMD_REQ && receivedAck.msgId == powerOffMsgId) { + powerOffMsgId = -1L + if (receivedAck.status == ReceivedAck.Status.NORMAL) { + invoke(false) + } + } + } + + fun ipcConnected() { + powerOffMsgId = -1L + invoke(true) + } + + private fun invoke(isToast: Boolean) { + this.isToast = isToast + M_LISTENERS.forEach { + val listener = it.value + listener.onIpcConnectStateToast(isToast) + } + } +} \ No newline at end of file