diff --git a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt index 899ee755a8..e691962e86 100644 --- a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt +++ b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt @@ -1,10 +1,13 @@ package com.mogo.eagle.core.function.report import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.report.ReportEntity import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.util.TimeUtils import mogo_msg.MogoReportMsg @@ -48,7 +51,6 @@ class IPCReportManager : IMoGoAutopilotStatusListener { */ override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) { guardianInfo?.let{ - //Error 弹窗并有提示音 if(it.resultList.contains(RESULT_AUTOPILOT_DISABLE) || it.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED) @@ -56,9 +58,10 @@ class IPCReportManager : IMoGoAutopilotStatusListener { if(ipcErrorReportList.size>19){ ipcErrorReportList.removeLast() } - ipcErrorReportList.add(0, - ReportEntity(TimeUtils.millis2String(System.currentTimeMillis()), - it.src,it.level,it.msg,it.code,it.resultList,it.actionsList)) + val reportEntity = ReportEntity(TimeUtils.millis2String(System.currentTimeMillis()), + it.src,it.level,it.msg,it.code,it.resultList,it.actionsList) + CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.REPORT, reportEntity)) + ipcErrorReportList.add(0, reportEntity) //当前不处于美化模式时,展示监控节点上报 if(!FunctionBuildConfig.isDemoMode){ if(FunctionBuildConfig.isReportWarning){ diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle index a20e15fcd9..6aedc92099 100644 --- a/core/function-impl/mogo-core-function-hmi/build.gradle +++ b/core/function-impl/mogo-core-function-hmi/build.gradle @@ -104,6 +104,7 @@ dependencies { api rootProject.ext.dependencies.mogo_core_function_carcorder api rootProject.ext.dependencies.mogo_core_function_call api rootProject.ext.dependencies.mogo_core_function_api + api rootProject.ext.dependencies.mogo_core_function_msgbox implementation project(':libraries:map-usbcamera') implementation project(':libraries:mogo-adas-other') @@ -134,6 +135,7 @@ dependencies { api project(':core:function-impl:mogo-core-function-dispatch') api project(':core:function-impl:mogo-core-function-chat') api project(':core:function-impl:mogo-core-function-bindingcar') + api project(':core:function-impl:mogo-core-function-msgbox') api project(':core:mogo-core-function-call') api project(':core:mogo-core-function-api') diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt index 9a52b93f15..bec65df4af 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt @@ -3,8 +3,11 @@ package com.mogo.eagle.core.function.hmi.receiver import android.content.BroadcastReceiver import android.content.Context import android.content.Intent +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.utilcode.util.SharedPrefs /** @@ -47,7 +50,6 @@ class NoticeNormalBroadcastReceiver : BroadcastReceiver() { data.content = contentTv data.videoUrl = videoUrl data.fileType = fileType - CallerHmiManager.showNoticeNormalData(data) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt index 7486583818..654cd73d26 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt @@ -8,6 +8,10 @@ import com.mogo.eagle.core.function.hmi.WaringConst import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.data.enums.EventTypeEnum +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.V2XMsg +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager /** * V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式弹出预警提示框 @@ -53,7 +57,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() { * 分发处理关闭场景 */ private fun dispatchCloseWaring(tag: String?) { - CallerHmiManager.disableWarningV2X(tag) +// CallerHmiManager.disableWarningV2X(tag) } /** @@ -73,6 +77,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() { if (EventTypeEnum.TYPE_USECASE_ID_IVP.poiType == v2xType.toString()) { CallerHmiManager.showLimitingVelocity(1) } - CallerHmiManager.showWarningV2X(v2xType.toString(), alertContent, ttsContent, tag, null, true, 5000L) + CallerHmiManager.warningV2X(v2xType.toString(), alertContent, ttsContent, + tag, null, true, 5000L, MsgBoxType.V2X) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 754de2d65e..6c440aaf32 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -40,6 +40,9 @@ import com.mogo.eagle.core.data.enums.SidePattern import com.mogo.eagle.core.data.enums.SidePattern.* import com.mogo.eagle.core.data.enums.WarningDirectionEnum import com.mogo.eagle.core.data.map.Infrastructure +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.RecordBagMsg import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData import com.mogo.eagle.core.data.report.ReportEntity @@ -63,6 +66,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.WaringConst @@ -318,6 +322,8 @@ class MoGoHmiFragment : MvpFragment(), override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) { CallerLogger.d("$M_HMI$TAG", "recordKey=${recordPanel.key},stat=${recordPanel.stat}") + CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.RECORD, RecordBagMsg(recordPanel.key, recordPanel.stat, recordPanel.id, + recordPanel.type, recordPanel.filename, recordPanel.note))) if (BadCaseConfig.recordKeyList.contains(recordPanel.key)) { if (recordPanel.stat == 100 || recordPanel.stat == 101) { //成功结束录制 @@ -898,6 +904,71 @@ class MoGoHmiFragment : MvpFragment(), } } + /** + * 不展示顶部弹窗,其它保留 + */ + @Synchronized + override fun warningV2X( + v2xType: String, + alertContent: CharSequence?, + ttsContent: String?, + tag: String?, + listener: IMoGoWarningStatusListener?, + playTts: Boolean, + expireTime: Long + ) { + val playTTS = + playTts && !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) + activity?.let { + val warningContent = alertContent + ?: EventTypeEnum.getWarningContent(v2xType) + + //占道施工预警 + if (v2xType.equals("10006") || v2xType.equals("100061")) { + val currentTime = System.currentTimeMillis() / 1000 + val oldTime = + context?.let { it -> SharedPrefsMgr.getInstance(it).getLong("roadwork", 0) } + if (currentTime - oldTime!! > 60) { //超过一分钟,才会继续播报重复提醒 + context?.let { it -> + SharedPrefsMgr.getInstance(it) + .putLong("roadwork", System.currentTimeMillis() / 1000) + } + CallerAutoPilotManager.sendTripInfo(5, "", "", "", false); + } + } + + if (warningContent.isEmpty()) { + CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!") + return + } + listener?.onShow() + CallerLogger.d( + "$M_HMI$TAG", + "--- show v2x dialog 1 ---: info -> v2x-type: $v2xType : expireTime: $expireTime" + ) + + lastShowV2XJob?.safeCancel() + lastSpeakJob?.safeCancel() + + lifecycleScope.launch { + delay(expireTime) + }.also { itx -> + lastShowV2XJob = itx + }.invokeOnCompletion { _ -> + listener?.onDismiss() + showWarning(WarningDirectionEnum.ALERT_WARNING_NON) + } + + if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) { + lifecycleScope.launch { + speak(it, ttsContent) + }.also { itx -> + lastSpeakJob = itx + } + } + } + } + private suspend fun speak(ctx: Context, text: String) = suspendCancellableCoroutine { try { val voiceCallback = object : IMogoVoiceCmdCallBack { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java index 3fc2839ae2..89a40ae47a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java @@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.main; import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI; +import android.annotation.SuppressLint; import android.content.Context; import android.os.Process; @@ -19,12 +20,14 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths; import com.mogo.eagle.core.function.api.chat.biz.ChatConsts; import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager; import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager; +import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb; import com.mogo.eagle.core.function.overview.OverviewDb; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.util.ProcessUtils; +import com.mogo.eagle.core.utilcode.util.SPUtils; import com.mogo.map.MapApiPath; import com.zhidao.support.obu.ami.AmiClientManager; import com.zhjt.mogo_core_function_devatools.monitor.db.CpuInfo; @@ -32,6 +35,8 @@ import com.zhjt.mogo_core_function_devatools.monitor.db.MemInfo; import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb; import java.lang.reflect.Field; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; /** @@ -62,6 +67,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { } //查询是否有版本的更新 queryAppUpgrade(); + clearMessageBoxTable(); checkMonitorDb(); } @@ -80,6 +86,24 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { },9000); } + @SuppressLint("SimpleDateFormat") + private void clearMessageBoxTable() { + new Thread(() -> { + String lastLaunchTimeStr = SPUtils.getInstance().getString("last_launch", ""); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + if (lastLaunchTimeStr != null && !lastLaunchTimeStr.isEmpty()) { + Date currDate = new Date(System.currentTimeMillis()); + String currTimeStr = format.format(currDate); + boolean isSameDay = currTimeStr.equals(lastLaunchTimeStr); + // 超过一天需要清除消息盒子中的数据,并把时间戳存入SP + if (!isSameDay) { + this.deleteDatabase(MsgBoxDb.INTERNAL_DB_NAME); + SPUtils.getInstance().put("last_launch", currTimeStr); + } + } + }).start(); + } + private void checkMonitorDb() { new Thread(() -> { long limitId = 50001; diff --git a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt index 385613203b..5822ad2128 100644 --- a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt +++ b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt @@ -1,55 +1,91 @@ package com.mogo.eagle.core.function.msgbox +import android.content.Context import android.os.Looper -import com.mogo.eagle.core.data.msgbox.MsgBoxBean -import com.mogo.eagle.core.data.msgbox.MsgBoxType -import com.mogo.eagle.core.data.msgbox.MsgCategory +import com.mogo.eagle.core.data.msgbox.* +import com.mogo.eagle.core.data.notice.NoticeNormalData +import com.mogo.eagle.core.data.report.ReportEntity import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager +import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb +import com.mogo.eagle.core.function.msgbox.db.MsgBoxInfo import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope +import com.mogo.eagle.core.utilcode.util.GsonUtils import com.mogo.eagle.core.utilcode.util.Utils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext object DataManager { // private val msgBoxMap: EnumMap> = EnumMap(MsgBoxType::class.java) + // 消失时间5000ms + const val DISMISS_TIME = 5000L + private val notifyList by lazy { mutableListOf() } + /** + * 当天缓存的通知消息 + */ + private val cacheNotifyList by lazy { + mutableListOf() + } + private val sysInfoList by lazy { mutableListOf() } + /** + * 当天缓存的系统消息 + */ + private val cacheSysInfoList by lazy { + mutableListOf() + } + private val recordBagList by lazy { mutableListOf() } - @Volatile - private var isUpdate = false + /** + * 当天缓存的录包消息 + */ + private val cacheRecordList by lazy { + mutableListOf() + } private val scope by lazy { Utils.getApp().lifeCycleScope } + /** + * 用户取消给录制的Bag包打标签 + */ + private val removedRecordMap by lazy { + HashMap() + } + /** * 存储时保证按时序排列 */ fun saveMsg(bean: MsgBoxBean) { if (Thread.currentThread() == Looper.getMainLooper().thread) { - scope.launch(Dispatchers.Default) { - realSaveMsg(bean) + scope.launch { + withContext(Dispatchers.Default) { + realSaveMsg(bean) + } } } else { realSaveMsg(bean) } } - fun realSaveMsg(bean: MsgBoxBean) { + private fun realSaveMsg(bean: MsgBoxBean) { val type = bean.type bean.timestamp = System.currentTimeMillis() - when(type) { + bean.bean2Json = GsonUtils.toJson(bean) + when (type) { MsgBoxType.V2X, MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION -> { synchronized(this) { notifyList.add(bean) @@ -76,20 +112,170 @@ object DataManager { * 通知消息:V2X、云公告、运营信息 */ fun getNotifyData(): List { - return notifyList + return cacheNotifyList } /** * 工控机Report信息 */ fun getSysInfoData(): List { - return sysInfoList + return cacheSysInfoList } /** * 录包信息 */ fun getRecordBagData(): List { - return recordBagList + return cacheRecordList + } + + fun removeRecordInfo(key: String, value: Any) { + if (Thread.currentThread() == Looper.getMainLooper().thread) { + scope.launch { + withContext(Dispatchers.Default) { + removedRecordMap[key] = value + } + } + } else { + removedRecordMap[key] = value + } + } + + /** + * 从本地数据库中查询数据 + */ + fun queryAllMessages(context: Context) { + scope.launch { + getCacheMessages(context) + } + } + + private suspend fun getCacheMessages(context: Context): List = withContext(Dispatchers.IO) { + return@withContext MsgBoxDb.getDb(context) + .monitorDao() + .getAllCachedMessages() + .map { msgInfo -> + val json = msgInfo.bean2Json + when (msgInfo.obj2JsonType) { + MsgBoxType.V2X.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.V2X, + GsonUtils.fromJson(json, V2XMsg::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheNotifyList.add(this@apply) + } + } + } + MsgBoxType.OBU.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.OBU, + GsonUtils.fromJson(json, V2XMsg::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheNotifyList.add(this@apply) + } + } + } + MsgBoxType.OPERATION.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.OPERATION, + GsonUtils.fromJson(json, OperationMsg::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheNotifyList.add(this@apply) + } + } + } + MsgBoxType.REPORT.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.REPORT, + GsonUtils.fromJson(json, ReportEntity::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheSysInfoList.add(this@apply) + } + } + } + MsgBoxType.RECORD.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.RECORD, + GsonUtils.fromJson(json, RecordBagMsg::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheRecordList.add(this@apply) + } + } + } + MsgBoxType.NOTICE.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.NOTICE, + GsonUtils.fromJson(json, NoticeNormalData::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheNotifyList.add(this@apply) + } + } + } + else -> { + return@map MsgBoxBean(MsgBoxType.V2X, V2XMsg()) + } + } + } + } + + /** + * 存储到本地数据库 + */ + fun saveAllMessages2Disk(context: Context) { + synchronized(this) { + val msgInfoList = ArrayList() + if (notifyList.isNotEmpty()) { + notifyList.forEach { + msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp)) + } + notifyList.clear() + } + + if (sysInfoList.isNotEmpty()) { + sysInfoList.forEach { + msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp)) + } + sysInfoList.clear() + } + + if (recordBagList.isNotEmpty()) { + recordBagList.forEach { + var recordKey = "" + if (it.bean is RecordBagMsg) { + recordKey = (it.bean as RecordBagMsg).key.toString() + } + // 用户未处理的Bag包才存本地 + if (!removedRecordMap.contains(recordKey)) { + msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp)) + } else {// 用户已处理的Bag包 + removedRecordMap.remove(recordKey) + } + } + recordBagList.clear() + } + + if (msgInfoList.isNotEmpty()) { + MsgBoxDb.getDb(context) + .monitorDao() + .insertMessages(*msgInfoList.toTypedArray()) + } + } + } + + fun delMsgBoxBean(context: Context, msgBoxBean: MsgBoxBean) { + scope.launch { + withContext(Dispatchers.Default) { + val msgBoxInfo = MsgBoxInfo(msgBoxBean.bean2Json, msgBoxBean.type.ordinal, msgBoxBean.timestamp) + MsgBoxDb.getDb(context) + .monitorDao() + .deleteMsg(msgBoxInfo) + } + } } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/MsgBoxProvider.kt b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/MsgBoxProvider.kt index b58206e909..b7a05e8ac8 100644 --- a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/MsgBoxProvider.kt +++ b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/MsgBoxProvider.kt @@ -5,6 +5,7 @@ import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_MSG_BOX_MODULE import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.function.api.msgbox.IMsgBoxProvider +import com.mogo.eagle.core.function.msgbox.DataManager.saveAllMessages2Disk @Route(path = PATH_MSG_BOX_MODULE) class MsgBoxProvider : IMsgBoxProvider { @@ -13,25 +14,46 @@ class MsgBoxProvider : IMsgBoxProvider { get() = "MsgBoxProvider" override fun init(context: Context) { - context + Thread { + while (true) { + try { + saveAllMessages2Disk(context) + Thread.sleep(3000) + } catch (e: Exception) { + e.printStackTrace() + } + } + }.start() } override fun saveMsg(bean: MsgBoxBean) { DataManager.saveMsg(bean) } - override fun getNotifyData(): List { + override fun getCachedNotifyData(): List { return DataManager.getNotifyData() } - override fun getSysInfoData(): List { + override fun getCachedSysInfoData(): List { return DataManager.getSysInfoData() } - override fun getRecordBagData(): List { + override fun getCachedRecordBagData(): List { return DataManager.getRecordBagData() } + override fun removeRecordInfo(key: String, value: Any) { + return DataManager.removeRecordInfo(key, value) + } + + override fun deleteBoxBean(context: Context, msgBoxBean: MsgBoxBean) { + DataManager.delMsgBoxBean(context, msgBoxBean) + } + + override fun getDismissTime(): Long { + return DataManager.DISMISS_TIME + } + override fun onDestroy() { } diff --git a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxDao.kt b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxDao.kt index 1ffddc4182..af3b02de24 100644 --- a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxDao.kt +++ b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxDao.kt @@ -5,5 +5,14 @@ import androidx.room.* @Dao interface MsgBoxDao { @Insert(onConflict = OnConflictStrategy.REPLACE) - fun saveMsg(info: MsgBoxInfo) + fun insertMessage(info: MsgBoxInfo) + + @Insert(onConflict = OnConflictStrategy.REPLACE) + fun insertMessages(vararg info: MsgBoxInfo) + + @Delete + suspend fun deleteMsg(info: MsgBoxInfo) + + @Query("SELECT * FROM t_msg_box") + fun getAllCachedMessages(): List } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxInfo.kt b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxInfo.kt index 14dd1b667a..c6d5627caa 100644 --- a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxInfo.kt +++ b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxInfo.kt @@ -6,10 +6,13 @@ import androidx.room.PrimaryKey @Entity(tableName = "t_msg_box") data class MsgBoxInfo( - @PrimaryKey(autoGenerate = true) - @ColumnInfo(name = "id") - val uuid: Long = 0, + @PrimaryKey + @ColumnInfo(name = "obj_json") + val bean2Json: String, - @ColumnInfo(name = "obj_str") - val objString: String + @ColumnInfo(name = "json_obj_type") + val obj2JsonType: Int = 0, + + @ColumnInfo(name = "time_stamp") + val timeStamp: Long = 0 ) \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java index 9719604d9d..bc750ef0f0 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java @@ -5,9 +5,12 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_NOT import android.content.Context; import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager; +import com.mogo.eagle.core.data.msgbox.MsgBoxBean; +import com.mogo.eagle.core.data.msgbox.MsgBoxType; import com.mogo.eagle.core.data.notice.NoticeNormalData; import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.network.utils.GsonUtil; import com.mogo.aicloud.services.socket.IMogoOnMessageListener; diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt index ac32af7da4..00d0964f8d 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt @@ -4,6 +4,7 @@ import android.content.Context import android.util.Log import com.alibaba.android.arouter.launcher.ARouter import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.commons.voice.AIAssist import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.constants.MogoServicePaths @@ -22,6 +23,10 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.eagle.core.data.enums.EventTypeEnum import com.mogo.eagle.core.data.enums.EventTypeHelper +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.V2XMsg +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.service.IMogoServiceApis import com.zhidao.support.obu.MogoObuManager import com.zhidao.support.obu.OnMogoObuListener @@ -374,7 +379,7 @@ class MogoPrivateObuManager private constructor() { // CallerHmiManager.showWarning(direction) //显示弹框,语音提示 - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -386,7 +391,8 @@ class MogoPrivateObuManager private constructor() { } }, true, - 5000L + 5000L, + MsgBoxType.OBU ) // 更新数据 TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { @@ -400,7 +406,7 @@ class MogoPrivateObuManager private constructor() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) // 移除顶部弹窗 - CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) +// CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) // 更新数据 TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { CallerObuListenerManager.removeTrackerWarningInfo(it) @@ -493,7 +499,7 @@ class MogoPrivateObuManager private constructor() { // if (level == 2 || level == 3) { //不考虑level //显示警告红边 CallerHmiManager.showWarning(direction) - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( v2xType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -505,7 +511,8 @@ class MogoPrivateObuManager private constructor() { } }, true, - 5000L + 5000L, + MsgBoxType.OBU ) // } // 更新数据 @@ -527,7 +534,7 @@ class MogoPrivateObuManager private constructor() { CallerMapUIServiceManager.getMarkerService() ?.updateITrafficThreatLevelInfo(it) } - CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString()) +// CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString()) } } @@ -664,7 +671,7 @@ class MogoPrivateObuManager private constructor() { ObuConstants.STATUS.DELETE -> { // 移除顶部弹窗 CallerHmiManager.disableWarningTrafficLight() - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) } } } @@ -695,14 +702,15 @@ class MogoPrivateObuManager private constructor() { 0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE } 0x1 -> {//无违规 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) } 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT ttsContent = EventTypeEnum.getWarningTts(appId.toString()) alertContent = EventTypeEnum.getWarningContent(appId.toString()) - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 5000L + appId.toString(), null, true, 5000L, + MsgBoxType.OBU ) } 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT @@ -717,7 +725,7 @@ class MogoPrivateObuManager private constructor() { // 红灯 0x1 -> { if (!isRedLight) { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) isRedLight = true } isGreenLight = false @@ -732,7 +740,7 @@ class MogoPrivateObuManager private constructor() { // 绿灯 0x2 -> { if (!isGreenLight) { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) isGreenLight = true } isRedLight = false @@ -767,20 +775,21 @@ class MogoPrivateObuManager private constructor() { val maxSpeed = currentLight.glosa_suggested_speed_max.toInt() if (maxSpeed > 0) { - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 appId.toString(), null, true, - 5000L + 5000L, + MsgBoxType.OBU ) } } // 黄灯 0x3 -> { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) CallerHmiManager.showWarningTrafficLight(2, 2) val yellow = currentLight.count_down.toInt() CallerHmiManager.changeCountdownYellow(yellow) @@ -890,8 +899,9 @@ class MogoPrivateObuManager private constructor() { "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" ) if (level == 2 || level == 3) { + // TODO:(只是不显示顶部弹窗,其它逻辑保留) //显示弹框,语音提示 - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -914,7 +924,8 @@ class MogoPrivateObuManager private constructor() { } }, true, - 5000L + 5000L, + MsgBoxType.OBU ) //显示警告红边 CallerHmiManager.showWarning(direction) @@ -930,7 +941,7 @@ class MogoPrivateObuManager private constructor() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) // 移除顶部弹窗 - CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) +// CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) //更新周边车辆进行预警颜色变换,车辆实时移动和变色 TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let { CallerObuListenerManager.removeTrackerWarningInfo(it) diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt index e56526a8d4..4c737d8af9 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt @@ -19,6 +19,10 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.enums.V2iEventTypeEnum +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.V2XMsg +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.support.obu.MogoObuManager import com.mogo.support.obu.OnMogoObuListener import com.mogo.support.obu.constants.MogoObuComType @@ -389,7 +393,7 @@ class MogoPrivateObuNewManager private constructor() { //显示警告红边 // CallerHmiManager.showWarning(direction) //显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -401,7 +405,8 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L + 3000L, + MsgBoxType.OBU ) // 更新数据 TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let { @@ -466,7 +471,7 @@ class MogoPrivateObuNewManager private constructor() { // if (level == 2 || level == 3) { //不考虑level //显示警告红边 CallerHmiManager.showWarning(direction) - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( v2xType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -478,7 +483,8 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L + 3000L, + MsgBoxType.OBU ) // } // 更新数据 @@ -663,7 +669,7 @@ class MogoPrivateObuNewManager private constructor() { ) if (level == 2 || level == 3) { //显示弹框,语音提示 - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -685,7 +691,8 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L + 3000L, + MsgBoxType.OBU ) //显示警告红边 CallerHmiManager.showWarning(direction) @@ -700,7 +707,7 @@ class MogoPrivateObuNewManager private constructor() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) // 移除顶部弹窗 - CallerHmiManager.disableWarningV2X((appId + direction.direction)) +// CallerHmiManager.disableWarningV2X((appId + direction.direction)) //更新周边车辆进行预警颜色变换,车辆实时移动和变色 TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { it.threatLevel = 0x01 @@ -734,7 +741,7 @@ class MogoPrivateObuNewManager private constructor() { MogoObuConstants.STATUS.DELETE -> { // 移除顶部弹窗 CallerHmiManager.disableWarningTrafficLight() - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) } } } @@ -767,14 +774,14 @@ class MogoPrivateObuNewManager private constructor() { 0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE } 0x1 -> {//无违规 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) } 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 3000L + appId.toString(), null, true, 3000L, MsgBoxType.OBU ) } 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT @@ -789,7 +796,7 @@ class MogoPrivateObuNewManager private constructor() { // 红灯 0x1 -> { if (!isRedLight) { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) isRedLight = true } isGreenLight = false @@ -803,7 +810,7 @@ class MogoPrivateObuNewManager private constructor() { // 绿灯 0x2 -> { if (!isGreenLight) { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) isGreenLight = true } isRedLight = false @@ -835,20 +842,21 @@ class MogoPrivateObuNewManager private constructor() { val maxSpeed = currentLight.suggestMaxSpeed if (maxSpeed > 0) { - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 appId.toString(), null, true, - 3000L + 3000L, + MsgBoxType.OBU ) } } // 黄灯 0x3 -> { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) CallerHmiManager.showWarningTrafficLight(2, 2) val yellow = currentLight.countDown.toInt() CallerHmiManager.changeCountdownYellow(yellow) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index cbc9709814..dc3f3c1fe1 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -25,6 +25,9 @@ import com.mogo.eagle.core.data.map.entity.MarkerExploreWay import com.mogo.eagle.core.data.map.entity.MarkerShowEntity import com.mogo.eagle.core.data.map.entity.V2XMessageEntity import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.V2XMsg import com.mogo.eagle.core.data.traffic.* import com.mogo.eagle.core.function.api.hmi.warning.* import com.mogo.eagle.core.function.api.map.listener.* @@ -32,6 +35,7 @@ import com.mogo.eagle.core.function.call.hmi.* import com.mogo.eagle.core.function.call.map.* import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.v2x.events.alarm.* import com.mogo.eagle.core.function.v2x.events.bridge.* import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context @@ -572,7 +576,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } } // 显示弹框,语音提示 - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( tempAppId.toString(), tempContent, tempTts, @@ -592,7 +596,8 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } }, true, - 5000L + 5000L, + MsgBoxType.V2X ) CallerMapUIServiceManager.getMarkerService()?.updateITrafficInfo(trafficData) } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java index 8ccb7815ce..9f11092a54 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java @@ -7,9 +7,13 @@ import com.mogo.eagle.core.data.enums.WarningDirectionEnum; import com.mogo.eagle.core.data.map.entity.MarkerExploreWay; import com.mogo.eagle.core.data.map.entity.V2XMessageEntity; import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity; +import com.mogo.eagle.core.data.msgbox.MsgBoxBean; +import com.mogo.eagle.core.data.msgbox.MsgBoxType; +import com.mogo.eagle.core.data.msgbox.V2XMsg; import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager; +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; @@ -93,8 +97,10 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp V2XMessageEntity entity = getV2XMessageEntity(); V2XRoadEventEntity content = entity != null ? entity.getContent() : null; if (content != null) { - //显示警告红边 - CallerHmiManager.INSTANCE.showWarningV2X(content.getPoiType(), content.getAlarmContent(), content.getTts(), TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(5)); +// //显示警告红边 + CallerHmiManager.INSTANCE.warningV2X(content.getPoiType(), content.getAlarmContent(), + content.getTts(), TAG, this, !entity.isOnlyShow(), + TimeUnit.SECONDS.toMillis(5), MsgBoxType.V2X); } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java index bc12e44e79..a091955b76 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java @@ -5,8 +5,12 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X import androidx.annotation.Nullable; import com.mogo.eagle.core.data.map.entity.V2XMessageEntity; +import com.mogo.eagle.core.data.msgbox.MsgBoxBean; +import com.mogo.eagle.core.data.msgbox.MsgBoxType; +import com.mogo.eagle.core.data.msgbox.V2XMsg; import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes; @@ -53,7 +57,10 @@ public class V2XOptimalRouteVREventScenario if (entity != null) { V2XOptimalRouteDataRes content = entity.getContent(); if (content != null) { - CallerHmiManager.INSTANCE.showWarningV2X(entity.getType() + "", "为您推荐最优路线", "已为您选择最优路线", TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(30)); + CallerHmiManager.INSTANCE.warningV2X(entity.getType() + "", + "为您推荐最优路线", "已为您选择最优路线", TAG, + this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(30), + MsgBoxType.V2X); } } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java index e45788e227..0682923143 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java @@ -10,9 +10,13 @@ import androidx.annotation.Nullable; import com.mogo.eagle.core.data.enums.WarningDirectionEnum; import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.data.map.entity.V2XMessageEntity; +import com.mogo.eagle.core.data.msgbox.MsgBoxBean; +import com.mogo.eagle.core.data.msgbox.MsgBoxType; +import com.mogo.eagle.core.data.msgbox.V2XMsg; import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener; import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; @@ -59,7 +63,10 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL int v2xType = getV2XTypeForFrontWarning(mMarkerEntity); V2XMessageEntity entity = getV2XMessageEntity(); if (v2xType != 0) { - CallerHmiManager.INSTANCE.showWarningV2X(v2xType + "", getAlertContentForFrontWarning(mMarkerEntity), mMarkerEntity.getTts(), TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(3)); + CallerHmiManager.INSTANCE.warningV2X(v2xType + "", + getAlertContentForFrontWarning(mMarkerEntity), mMarkerEntity.getTts(), + TAG, this, !entity.isOnlyShow(), + TimeUnit.SECONDS.toMillis(3), MsgBoxType.V2X); } } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt index dd7f938765..6d72796f41 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt @@ -20,6 +20,10 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.data.enums.EventTypeEnum +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.V2XMsg +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.zhjt.service_biz.BizConfig import kotlin.math.abs import kotlin.math.ceil @@ -200,14 +204,15 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, private fun redLightWarning() { CallerLogger.d("$M_V2X$TAG", "=====闯红灯预警=====") ThreadUtils.runOnUiThread { - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, EventTypeEnum.TYPE_USECASE_ID_IVP.content, EventTypeEnum.TYPE_USECASE_ID_IVP.tts, EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, null, true, - 5000L + 5000L, + MsgBoxType.V2X ) } } @@ -227,14 +232,15 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), speed ) - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, content, tts, EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, null, true, - 5000L + 5000L, + MsgBoxType.V2X ) } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt index 031de57a8d..449357c729 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt @@ -26,6 +26,10 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler import com.mogo.eagle.core.data.enums.EventTypeEnum +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.V2XMsg +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.zhjt.service_biz.BizConfig class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListener, @@ -241,14 +245,15 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe ttsContent: String, tag: String ) { - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( v2xType, alertContent, ttsContent, tag, object : IMoGoWarningStatusListener { override fun onShow() {} override fun onDismiss() {} }, true, - 5000L + 5000L, + MsgBoxType.V2X ) } 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 171d472e6b..7a08d71212 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 @@ -1,3 +1,6 @@ package com.mogo.eagle.core.data.msgbox -data class MsgBoxBean(val type: MsgBoxType, val bean: Any, var timestamp: Long = 0) +data class MsgBoxBean(val type: MsgBoxType, val bean: Any) { + var timestamp: Long = 0 + var bean2Json: String = "" +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/RecordBagMsg.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/RecordBagMsg.kt new file mode 100644 index 0000000000..370d46ed4d --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/RecordBagMsg.kt @@ -0,0 +1,3 @@ +package com.mogo.eagle.core.data.msgbox + +data class RecordBagMsg(var key: Long, var stat: Int, var id: Int, var type: Int, var fileName: String, var note: String) \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/V2XMsg.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/V2XMsg.kt new file mode 100644 index 0000000000..cd92ae18cd --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/V2XMsg.kt @@ -0,0 +1,3 @@ +package com.mogo.eagle.core.data.msgbox + +data class V2XMsg(var type: String = "", var content: String? = "", var tts: String? = "") \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt index 1a7ff34247..715155ac8e 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt @@ -99,6 +99,11 @@ interface IMoGoWaringProvider : IMoGoHmiViewProxy { */ fun showWarningV2X(v2xType: String, alertContent: CharSequence?, ttsContent: String?, tag: String?, listener: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) + /** + * 不展示顶部弹窗,其它保留 + */ + fun warningV2X(v2xType: String, alertContent: CharSequence?, ttsContent: String?, tag: String?, listener: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) + /** * 关闭指定floatTag 的 VR下V2X预警弹窗 * @param tag 弹窗标识 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxProvider.kt index 254ca20d6c..b9178c0a1e 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxProvider.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.api.msgbox +import android.content.Context import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider @@ -7,16 +8,22 @@ interface IMsgBoxProvider: IMoGoFunctionServerProvider { fun saveMsg(bean: MsgBoxBean) /** - * 通知消息:V2X、云公告、运营信息 + * 获取本地数据库缓存的通知消息:V2X、云公告、运营信息 */ - fun getNotifyData(): List + fun getCachedNotifyData(): List /** - * 工控机Report信息 + * 获取本地数据库缓存的工控机Report信息 */ - fun getSysInfoData(): List + fun getCachedSysInfoData(): List /** - * 录包信息 + * 获取本地数据库缓存的录包信息 */ - fun getRecordBagData(): List + fun getCachedRecordBagData(): List + + fun removeRecordInfo(key: String, value: Any) + + fun deleteBoxBean(context: Context, msgBoxBean: MsgBoxBean) + + fun getDismissTime(): Long } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index d9b215b235..355c7d50a3 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -9,6 +9,9 @@ import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_SLW import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I import com.mogo.eagle.core.data.enums.WarningDirectionEnum import com.mogo.eagle.core.data.map.Infrastructure +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.V2XMsg import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData import com.mogo.eagle.core.data.report.ReportEntity @@ -19,6 +22,8 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener 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.msgbox.CallerMsgBoxManager.saveMsgBox import com.zhjt.service_biz.BizConfig /** @@ -145,6 +150,31 @@ object CallerHmiManager : CallerBase() { ) } + /** + * 不展示顶部弹窗,其它保留 + */ + fun warningV2X( + v2xType: String, + alertContent: CharSequence?, + ttsContent: String?, + tag: String?, + listenerIMoGo: IMoGoWarningStatusListener?, + playTts: Boolean, + expireTime: Long = 5000L, + msgBoxType: MsgBoxType + ) { + saveMsgBox(MsgBoxBean(msgBoxType, V2XMsg(v2xType, alertContent?.toString() ?: "", ttsContent))) + waringProviderApi?.warningV2X( + v2xType, + alertContent, + ttsContent, + tag, + listenerIMoGo, + playTts, + expireTime + ) + } + /** * 关闭指定floatTag 的 VR下V2X预警弹窗 * @param tag 弹窗标识 @@ -271,6 +301,7 @@ object CallerHmiManager : CallerBase() { * */ fun showNoticeNormalData(noticeNormal: NoticeNormalData) { + saveMsgBox(MsgBoxBean(MsgBoxType.NOTICE, noticeNormal)) waringProviderApi?.showNoticeNormalData(noticeNormal) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxManager.kt index e94b38e74f..da9256e613 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxManager.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.call.msgbox +import android.content.Context import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.function.api.msgbox.IMsgBoxProvider @@ -25,21 +26,40 @@ object CallerMsgBoxManager { /** * 通知消息:V2X、云公告、运营信息 */ - fun getNotifyData(): List? { - return providerApi?.getNotifyData() + fun getCachedNotifyData(): List? { + return providerApi?.getCachedNotifyData() } /** * 工控机Report信息 */ - fun getSysInfoData(): List? { - return providerApi?.getSysInfoData() + fun getCachedSysInfoData(): List? { + return providerApi?.getCachedSysInfoData() } /** * 录包信息 */ - fun getRecordBagData(): List? { - return providerApi?.getRecordBagData() + fun getCachedRecordBagData(): List? { + return providerApi?.getCachedRecordBagData() + } + + /** + * 用户已处理的Bag包需要删除 + * key: Bag包的唯一标识key,value:任意非空的值 + */ + fun removeRecordInfo(key: String, value: Any) { + providerApi?.removeRecordInfo(key, value) + } + + /** + * 删除消息盒子中存入数据库的数据,比如已经处理的录制bag信息 + */ + fun deleteBoxBean(context: Context, msgBoxBean: MsgBoxBean) { + providerApi?.deleteBoxBean(context, msgBoxBean) + } + + fun getDismissTime(): Long { + return providerApi?.getDismissTime() ?: 0L } } \ No newline at end of file