[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

@@ -215,11 +215,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
)
)
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.content,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.tts
)
CallerHmiManager.warningV2X(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.content, EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.tts, isFromObu = false)
}
}
@@ -251,11 +247,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
)
)
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
content,
tts
)
CallerHmiManager.warningV2X(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, content, tts, isFromObu = false)
}
}

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.function.biz.v2x.v2n
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Handler
@@ -10,7 +9,6 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_V2N
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CLOUD_V2N
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.EventTypeHelper
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
@@ -29,7 +27,6 @@ import com.mogo.eagle.core.function.api.map.angle.*
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapIdentifyManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
@@ -51,7 +48,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.eagle.function.biz.v2x.v2n.network.callback.IV2XCallback
import com.mogo.eagle.function.biz.v2x.v2n.utils.toV2XRoadEventEntity
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants
import kotlinx.coroutines.CoroutineScope
@@ -60,7 +56,6 @@ import kotlinx.coroutines.android.asCoroutineDispatcher
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import java.util.concurrent.atomic.AtomicBoolean
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.PlanningObject
object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
@@ -199,15 +194,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
}
}
Logger.d("$M_V2X$TAG", "poiType : $poiType , 触发道路事件")
val trackedObj =
CallerMapIdentifyManager.getIdentifyObj(first.uuid.toString())
trackedObj?.let { t ->
Logger.d("$M_V2X$TAG", "polygon size : ${(t.polygonList.size)}")
val v2XMessageEntity = V2XMessageEntity<V2XRoadEventEntity>()
v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING
v2XMessageEntity.content = t.toRoadMarker(poiType).toV2XRoadEventEntity()
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
}
CallerHmiManager.warningV2X(poiType, )
}
}
}
@@ -321,25 +308,20 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IV2XCallback,
)
)
)
CallerHmiManager.warningV2X(
tempAppId.toString(),
tempContent,
tempTts,
object : IMoGoWarningStatusListener {
val change = changeVisualAngle
override fun onShow() {
if (change) {
CallerVisualAngleManager.changeAngle(TooClose)
}
}
override fun onDismiss() {
if (change) {
CallerVisualAngleManager.changeAngle(Default())
}
CallerHmiManager.warningV2X(tempAppId.toString(), tempContent, tempTts, object : IMoGoWarningStatusListener {
val change = changeVisualAngle
override fun onShow() {
if (change) {
CallerVisualAngleManager.changeAngle(TooClose)
}
}
)
override fun onDismiss() {
if (change) {
CallerVisualAngleManager.changeAngle(Default())
}
}
}, isFromObu = false)
CallerMapUIServiceManager.getMarkerService()?.updateITrafficInfo(trafficData)
}
2 -> {

View File

@@ -79,7 +79,7 @@ internal object V2NIdentifyDrawer {
super.onDismiss()
CallerVisualAngleManager.changeAngle(Default())
}
}, ALERT_WARNING_TOP, 10000)
}, ALERT_WARNING_TOP, 10000, false)
}
}.receive()
}

View File

@@ -129,7 +129,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
);
CallerHmiManager.INSTANCE.warningV2X(poiType, alarmText,
ttsText, this,WarningDirectionEnum.ALERT_WARNING_TOP,
TimeUnit.SECONDS.toMillis(5));
TimeUnit.SECONDS.toMillis(5), false);
}
}

View File

@@ -84,7 +84,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoChas
CallerHmiManager.INSTANCE.warningV2X(v2xType + "",
getAlertContentForFrontWarning(mMarkerEntity), mMarkerEntity.getTts(),
this,getDirection(),
TimeUnit.SECONDS.toMillis(5));
TimeUnit.SECONDS.toMillis(5), false);
}
}
}

View File

@@ -274,7 +274,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(MsgBoxType.V2X, V2XMsg(v2xType, alertContent.toString(), ttsContent))
)
CallerHmiManager.warningV2X(v2xType, alertContent, ttsContent)
CallerHmiManager.warningV2X(v2xType, alertContent, ttsContent, isFromObu = false)
}
fun destroy() {

View File

@@ -613,13 +613,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
* 消息盒子对应消息的语音播报
*/
private fun showWarning(type: String, content: String, tts: String, direction: WarningDirectionEnum) {
CallerHmiManager.warningV2X(
type,
content,
tts,
null,
direction
)
CallerHmiManager.warningV2X(type, content, tts, null, direction, isFromObu = true)
}
}

View File

@@ -1,7 +1,6 @@
package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import android.util.Log
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.*
@@ -11,7 +10,6 @@ import com.mogo.eagle.core.function.api.map.angle.Default
import com.mogo.eagle.core.function.api.map.angle.TooClose
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
@@ -893,10 +891,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
if (level == 2 || level == 3) {
//不显示弹框,其它保留
saveObuData(v2xType, alertContent, ttsContent)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
CallerHmiManager.warningV2X(v2xType, alertContent, ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
object : IMoGoWarningStatusListener {
override fun onShow() {
super.onShow()
@@ -910,8 +905,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
CallerVisualAngleManager.changeAngle(Default())
}
}
}, direction
)
}, direction, isFromObu = true)
}
//更新周边车辆进行预警颜色变换,车辆实时移动和变色 UUID不需要匹配了
@@ -1124,13 +1118,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
tts: String,
direction: WarningDirectionEnum
) {
CallerHmiManager.warningV2X(
type,
content,
tts,
null,
direction
)
CallerHmiManager.warningV2X(type, content, tts, null, direction, isFromObu = true)
}
}

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