diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt index 18894c47d6..b68f765d6b 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt @@ -16,6 +16,8 @@ import com.mogo.eagle.core.utilcode.util.GsonUtils import com.mogo.eagle.core.utilcode.util.ProcessUtils import com.mogo.eagle.core.utilcode.util.SPUtils import com.mogo.eagle.core.utilcode.util.Utils +import com.zhjt.mogo.adas.utils.ByteUtil +import fault_management.FmInfo import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -118,7 +120,9 @@ object DataManager { private fun realSaveMsg(msg: MsgBoxBean) { val type = msg.type msg.timestamp = System.currentTimeMillis() - msg.bean2Json = GsonUtils.toJson(msg.bean) + if (msg.pbStr.isEmpty()) { + msg.bean2Json = GsonUtils.toJson(msg.bean) + } when (type) { MsgBoxType.V2X -> { // 汇总消息不存数据库 @@ -129,39 +133,47 @@ object DataManager { } CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg) } + MsgBoxType.FMINFO -> { synchronized(this) { fmInfoList.add(msg) } CallerMsgBoxListenerManager.invokeListener(MsgCategory.FM_INFO, msg) } + MsgBoxType.VOICE -> { CallerMsgBoxListenerManager.invokeListener(MsgCategory.VOICE_INFO, msg) } + MsgBoxType.AUTOPILOT -> {// 不存数据库 CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg) } + MsgBoxType.SSMINFO -> {// 不存数据库 CallerMsgBoxListenerManager.invokeListener(MsgCategory.SYS_INFO, msg) } + MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION -> { synchronized(this) { notifyList.add(msg) } CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg) } + MsgBoxType.REPORT -> { synchronized(this) { sysInfoList.add(msg) } CallerMsgBoxListenerManager.invokeListener(MsgCategory.SYS_INFO, msg) } + MsgBoxType.RECORD -> { synchronized(this) { recordBagList.add(msg) } CallerMsgBoxListenerManager.invokeListener(MsgCategory.RECORD_BAG, msg) } + else -> {} } } @@ -273,6 +285,7 @@ object DataManager { } } } + MsgBoxType.OBU.ordinal -> { return@map MsgBoxBean( MsgBoxType.OBU, @@ -284,6 +297,7 @@ object DataManager { } } } + MsgBoxType.OPERATION.ordinal -> { return@map MsgBoxBean( MsgBoxType.OPERATION, @@ -295,6 +309,7 @@ object DataManager { } } } + MsgBoxType.REPORT.ordinal -> { return@map MsgBoxBean( MsgBoxType.REPORT, @@ -306,6 +321,7 @@ object DataManager { } } } + MsgBoxType.RECORD.ordinal -> { return@map MsgBoxBean( MsgBoxType.RECORD, @@ -317,6 +333,7 @@ object DataManager { } } } + MsgBoxType.NOTICE.ordinal -> { return@map MsgBoxBean( MsgBoxType.NOTICE, @@ -328,6 +345,7 @@ object DataManager { } } } + else -> { return@map null } @@ -373,7 +391,7 @@ object DataManager { if (fmInfoList.isNotEmpty()) { fmInfoList.forEach { - msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp)) + msgInfoList.add(MsgBoxInfo(it.pbStr, it.type.ordinal, it.timestamp)) } fmInfoList.clear() } @@ -402,8 +420,19 @@ object DataManager { return MsgBoxDb.getDb(context).monitorDao() .getFMInfoList(MsgBoxType.FMINFO.ordinal, startTime, endTime) .map { boxInfo -> - MsgBoxBean(MsgBoxType.FMINFO, GsonUtils.fromJson(boxInfo.bean2Json, FMInfoMsg::class.java)).apply { - timestamp = boxInfo.timeStamp + val bytes = ByteUtil.hexToByteArr(boxInfo.bean2Json) + if (bytes == null) { + MsgBoxBean( + MsgBoxType.FMINFO, + FMInfoMsg(null, "", 0, false) + ) + } else { + MsgBoxBean( + MsgBoxType.FMINFO, + FMInfoMsg(FmInfo.FaultResultMsg.parseFrom(bytes).infosList, "", 0, false) + ).apply { + timestamp = boxInfo.timeStamp + } } } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxBean.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxBean.kt index 166d5ba9fb..52e3c42d4f 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxBean.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxBean.kt @@ -6,6 +6,7 @@ data class MsgBoxBean(val type: MsgBoxType, val bean: Any) { var timestamp: Long = 0 var bean2Json: String = "" var sourceType: DataSourceType = DataSourceType.DEFAULT + var pbStr: String = "" override fun toString(): String { return "MsgBoxBean(type=$type, bean=$bean, timestamp=$timestamp, bean2Json='$bean2Json', sourceType=$sourceType)" } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerFaultManagementStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerFaultManagementStateListenerManager.kt index 27cf20598e..a8963eb918 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerFaultManagementStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerFaultManagementStateListenerManager.kt @@ -4,11 +4,11 @@ import com.mogo.eagle.core.data.msgbox.FMFilterInfoMsg import com.mogo.eagle.core.data.msgbox.FMInfoMsg import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType -import com.mogo.eagle.core.data.msgbox.MsgFmData import com.mogo.eagle.core.function.api.autopilot.IMoGoFaultManagementStateListener import com.mogo.eagle.core.function.call.base.CallerBase import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.trace.CallerTrace +import com.zhjt.mogo.adas.utils.ByteUtil import fault_management.FmInfo /** @@ -64,7 +64,9 @@ object CallerFaultManagementStateListenerManager : CallerBase