[680][core] 优雅停服后的异常提示优化 收到命令回执后将不在进行消息盒子弹出提示

This commit is contained in:
xinfengkun
2024-11-21 10:22:12 +08:00
parent 0bcfd98242
commit 72c5d68c91
6 changed files with 63 additions and 4 deletions

View File

@@ -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
}
/**

View File

@@ -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 ||//设置演示模式

View File

@@ -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

View File

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

View File

@@ -0,0 +1,8 @@
package com.mogo.eagle.core.function.api.autopilot
interface IMoGoIpcConnectStateToastListener {
fun onIpcConnectStateToast(isToast: Boolean)
}

View File

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