From 891cdc97cac135591860a65d6d2cbd93f1cdb305 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 24 Feb 2023 18:36:30 +0800 Subject: [PATCH] =?UTF-8?q?[dev=5Farch=5Fopt=5F3.0]=20=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0obu=E7=9B=B8=E5=85=B3tts=E5=92=8C=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E5=B1=95=E7=A4=BA=E9=A2=91=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/biz/v2x/obu/V2xObuEventManager.kt | 16 +++++++++++++++- .../datacenter/obu/MogoPrivateObuNewManager.kt | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt index ca97cd6b45..a1153493fe 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt @@ -27,13 +27,27 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener { CallerObuSaveMessageListenerManager.removeListener(TAG) } + private val obuDataMap = mutableMapOf() + /** * @param type 事件id,类似与uuid * @param content 事件内容 - * @param tts 事件语音播报 + * @param tts 事件语音播报 //30秒内同一个事件只出现一次 TODO 临时添加,后面宏宇统一在数据中心处理 */ override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, source: DataSourceType) { if (content.isNotEmpty()) { + if (obuDataMap.containsKey(type)) { + var oldTime = obuDataMap[type] + var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 + if (timeDiff < 30) { + return + } + obuDataMap.remove(type) + obuDataMap[type] = System.currentTimeMillis() + } else { + obuDataMap[type] = System.currentTimeMillis() + } + CallerMsgBoxManager.saveMsgBox( MsgBoxBean( MsgBoxType.V2X, diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt index a4b0d19ddb..0c64d6a0b1 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt @@ -1037,6 +1037,8 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener { ) } + private val ttsMap = mutableMapOf() + /** * 消息盒子对应消息的语音播报 */ @@ -1046,6 +1048,19 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener { tts: String, direction: WarningDirectionEnum ) { + //30秒内同一个事件只出现一次 TODO 临时添加,后面宏宇统一在数据中心处理 + if (ttsMap.containsKey(type)) { + var oldTime = ttsMap[type] + var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 + if (timeDiff < 30) { + return + } + ttsMap.remove(type) + ttsMap[type] = System.currentTimeMillis() + } else { + ttsMap[type] = System.currentTimeMillis() + } + CallerHmiManager.warningV2X( type, content,