[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

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