[2.15.0] 30秒间隔只针对obu类型事件类型有效

This commit is contained in:
renwj
2023-03-30 15:25:15 +08:00
parent 0060a76b6a
commit 96bd93ee18
13 changed files with 53 additions and 114 deletions

View File

@@ -89,6 +89,6 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
)
)
//预留调试入口
CallerHmiManager.warningV2X(v2xType.toString(), alertContent, ttsContent)
CallerHmiManager.warningV2X(v2xType.toString(), alertContent, ttsContent, isFromObu = false)
}
}

View File

@@ -96,25 +96,21 @@ class MoGoHmiProvider : IMoGoHmiProvider {
* 不展示顶部弹窗,其它保留
*/
@Synchronized
override fun warningV2X(
v2xType: String,
alertContent: CharSequence?,
ttsContent: String?,
listener: IMoGoWarningStatusListener?,
direction: WarningDirectionEnum,
expireTime: Long
) {
//30秒内同一个事件只出现一次 TODO 临时添加,后面宏宇统一在数据中心处理
if (ttsMap.containsKey(v2xType)) {
var oldTime = ttsMap[v2xType]
var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000
if (timeDiff < 30) {
return
override fun warningV2X(v2xType: String, alertContent: CharSequence?, ttsContent: String?, listener: IMoGoWarningStatusListener?, direction: WarningDirectionEnum, expireTime: Long, isFromObu: Boolean) {
if (isFromObu) {
// 修改: 只有来自obu的事件这样处理
//30秒内同一个事件只出现一次 TODO 临时添加,后面宏宇统一在数据中心处理
if (ttsMap.containsKey(v2xType)) {
val oldTime = ttsMap[v2xType]
val timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000
if (timeDiff < 30) {
return
}
ttsMap.remove(v2xType)
ttsMap[v2xType] = System.currentTimeMillis()
} else {
ttsMap[v2xType] = System.currentTimeMillis()
}
ttsMap.remove(v2xType)
ttsMap[v2xType] = System.currentTimeMillis()
} else {
ttsMap[v2xType] = System.currentTimeMillis()
}
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "warningV2X v2xType = $v2xType ---alertContent = $alertContent ---ttsContent = $ttsContent ")
val playTTS = !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
@@ -124,7 +120,6 @@ class MoGoHmiProvider : IMoGoHmiProvider {
CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!")
return
}
listener?.onShow()
CallerV2XWarningListenerManager.show(v2xType, direction, expireTime)
CallerLogger.d(

View File

@@ -55,22 +55,17 @@ class TakeOverView @JvmOverloads constructor(
MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_LOCATION,
MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_CHASSIS,
MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_DISTANCE -> {
CallerHmiManager.warningV2X(
EventTypeEnumNew.TAKE_OVER_EVENT.poiType,
EventTypeEnumNew.TAKE_OVER_EVENT.content,
EventTypeEnumNew.TAKE_OVER_EVENT.tts,
object : IMoGoWarningStatusListener {
override fun onShow() {
takeOver = true
visibility = View.VISIBLE
}
override fun onDismiss() {
takeOver = false
visibility = View.GONE
}
CallerHmiManager.warningV2X(EventTypeEnumNew.TAKE_OVER_EVENT.poiType, EventTypeEnumNew.TAKE_OVER_EVENT.content, EventTypeEnumNew.TAKE_OVER_EVENT.tts, object : IMoGoWarningStatusListener {
override fun onShow() {
takeOver = true
visibility = View.VISIBLE
}
)
override fun onDismiss() {
takeOver = false
visibility = View.GONE
}
}, isFromObu = false)
}
}
}