From 339d38b5f16e028489da783d308fcd659a167aed Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 30 Jan 2023 12:06:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=8F=90=E7=A4=BA=E9=A2=91?= =?UTF-8?q?=E7=B9=81=E7=9A=84=E9=99=90=E5=88=B6=EF=BC=8C=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/obu/mogo/MoGoObuProvider.kt | 2 +- .../obu/mogo/MogoObuDcCombineManager.kt | 32 +++---- .../obu/mogo/MogoPrivateObuManager.kt | 19 ++-- .../obu/mogo/MogoPrivateObuNewManager.kt | 90 +++++-------------- 4 files changed, 41 insertions(+), 102 deletions(-) diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt index a4de8e25d8..f9c946d9f7 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt @@ -33,7 +33,7 @@ class MoGoObuProvider : IMoGoObuProvider { override fun init(context: Context) { //obu融合数据 -// MogoObuDcCombineManager.INSTANCE.init(context) + MogoObuDcCombineManager.INSTANCE.init(context) CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress()) //bus乘客版本obu功能去掉 if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger( diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoObuDcCombineManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoObuDcCombineManager.kt index c5fc15016d..f95f73480d 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoObuDcCombineManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoObuDcCombineManager.kt @@ -4,6 +4,7 @@ import android.content.Context import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.enums.WarningDirectionEnum +import com.mogo.eagle.core.data.msgbox.DataSourceType import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.V2XMsg @@ -13,7 +14,6 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.obucombine.CallerObuDcCombineListenerManager -import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU import com.mogo.support.obu.constants.MogoObuConstants @@ -89,7 +89,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener ) if (rsiWarningData != null && rsiWarningData.warningMsgList != null && rsiWarningData.warningMsgList.size > 0) { var alertContent = "" - var ttsContent = "" //TODO 列表还是只有一项吗? + var ttsContent = "" //列表只有一项 var appId = rsiWarningData.warningMsgList[0].sceneType.toString() val status = rsiWarningData.status val level = rsiWarningData.warningMsgList[0].warningLevel @@ -265,10 +265,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener alertContent, ttsContent ) - ) -// .apply { -// sourceType = DataSourceType.TELEMATIC -// } + ).apply { + sourceType = DataSourceType.TELEMATIC + } ) CallerHmiManager.warningV2X( appId, @@ -363,10 +362,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener alertContent, ttsContent ) - ) -// .apply { //TODO -// sourceType = DataSourceType.TELEMATIC -// } + ).apply { + sourceType = DataSourceType.TELEMATIC + } ) CallerHmiManager.warningV2X( v2xType, @@ -560,10 +558,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener alertContent, ttsContent ) - ) -// .apply { -// sourceType = DataSourceType.TELEMATIC -// } + ).apply { + sourceType = DataSourceType.TELEMATIC + } ) CallerHmiManager.warningV2X( @@ -604,10 +601,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener alertContent, ttsContent ) - ) -// .apply { //TODO -// sourceType = DataSourceType.TELEMATIC -// } + ).apply { + sourceType = DataSourceType.TELEMATIC + } ) CallerHmiManager.warningV2X( 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 973c7da6ee..a942a7556e 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 @@ -2,13 +2,15 @@ package com.mogo.eagle.core.function.obu.mogo import android.content.Context import android.util.Log -import com.alibaba.android.arouter.launcher.ARouter import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig -import com.mogo.eagle.core.data.config.HmiBuildConfig -import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.data.enums.EventTypeEnum +import com.mogo.eagle.core.data.enums.EventTypeHelper import com.mogo.eagle.core.data.enums.WarningDirectionEnum +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.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager @@ -16,18 +18,12 @@ 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.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.call.obu.CallerObuListenerManager import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU 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 import com.zhidao.support.obu.constants.ObuConstants @@ -48,14 +44,11 @@ class MogoPrivateObuManager private constructor() { } } -// private var mMogoServiceApis: IMogoServiceApis? = null private var mContext: Context? = null private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo() fun init(context: Context, ipAddress: String) { CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "obuManager初始化--") -// mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS) -// .navigation(context) as IMogoServiceApis mContext = context //连接obu设备 connectObu(context, ipAddress) 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 961844e834..93706d2adc 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 @@ -4,7 +4,7 @@ import android.content.Context import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.enums.* -//import com.mogo.eagle.core.data.msgbox.DataSourceType +import com.mogo.eagle.core.data.msgbox.DataSourceType import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.V2XMsg @@ -193,20 +193,6 @@ class MogoPrivateObuNewManager private constructor() { level = data.warningMsg.warningData[0].warningLevel appId = data.warningMsg.warningData[0].warningType.toString() status = data.warningMsg.warningData[0].status - - //30秒内同一个事件只出现一次 - if (rvMap.containsKey(appId)) { - var oldTime = rvMap[appId] - var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 - if (timeDiff < 30) { - return - } - rvMap.remove(appId) - rvMap[appId] = System.currentTimeMillis() - } else { - rvMap[appId] = System.currentTimeMillis() - } - //拼凑数据 if (appId != null) { handleSdkObu(appId, direction, status, level, data) @@ -242,11 +228,6 @@ class MogoPrivateObuNewManager private constructor() { } } - val rvMap = mutableMapOf() - val rsiMap = mutableMapOf() - val rsmMap = mutableMapOf() - val rsmPtcIdMap = mutableMapOf() - /** * RSI预警信息 onMogoObuRsiWarning(交通标志预警(前方限速、前方学校等等),交通事件预警(前方拥堵、前方积水等等)) */ @@ -317,9 +298,9 @@ class MogoPrivateObuNewManager private constructor() { MogoObuConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁 appId = EventTypeEnumNew.TYPE_ID_BRIDGE.poiType } -// MogoObuConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人 TODO 暂时去掉 -// appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType -// } + MogoObuConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人 + appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType + } MogoObuConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑 appId = EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD.poiType } @@ -420,19 +401,6 @@ class MogoPrivateObuNewManager private constructor() { } } - //30秒内同一个事件只出现一次 - if (rsiMap.containsKey(appId)) { - var oldTime = rsiMap[appId] - var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 - if (timeDiff < 30) { - return - } - rsiMap.remove(appId) - rsiMap[appId] = System.currentTimeMillis() - } else { - rsiMap[appId] = System.currentTimeMillis() - } - CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "new onMogoObuRsiWarning appId = $appId ---status = $status --- ttsContent = $ttsContent --alertContent = $alertContent -- eventSerialNum = ${data.warningMsg[0].eventSerialNum} ---signSerialNum = ${data.warningMsg[0].signSerialNum} ---direction = ${direction.direction} --distance = ${ @@ -456,10 +424,9 @@ class MogoPrivateObuNewManager private constructor() { alertContent, ttsContent ) - ) -// .apply { -// sourceType = DataSourceType.OBU -// } + ).apply { + sourceType = DataSourceType.OBU + } ) CallerHmiManager.warningV2X( appId, @@ -543,7 +510,7 @@ class MogoPrivateObuNewManager private constructor() { var level = -1 val direction = getMessageDirection(data.participant.targetPosition) - //物体数据绘制 TODO 这里与dc通过工控机有区别 + //物体数据绘制 CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "onMogoObuRsmWarning ---- data.status = ${data.status} ---data.participant.ptcId = ${data.participant.ptcId} ---data.participant.ptcType = ${data.participant.ptcType} ---data.warningMsg = ${data.warningMsg} -----data = ${data.toString()}") when (data.status) { @@ -598,19 +565,6 @@ class MogoPrivateObuNewManager private constructor() { when (data.warningMsg.warningData[0].status) { MogoObuConstants.STATUS.ADD -> { // 添加 //更新模型的颜色 - //30秒内同一个事件只出现一次 - if (rsmMap.containsKey(v2xType)) { - var oldTime = rsmMap[v2xType] - var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 - if (timeDiff < 30) { - return - } - rsmMap.remove(v2xType) - rsmMap[v2xType] = System.currentTimeMillis() - } else { - rsmMap[v2xType] = System.currentTimeMillis() - } - TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data) ?.let { CallerMapUIServiceManager.getMarkerService() @@ -630,10 +584,9 @@ class MogoPrivateObuNewManager private constructor() { alertContent, ttsContent ) - ) -// .apply { //TODO -// sourceType = DataSourceType.OBU -// } + ).apply { + sourceType = DataSourceType.OBU + } ) CallerHmiManager.warningV2X( @@ -883,10 +836,9 @@ class MogoPrivateObuNewManager private constructor() { alertContent, ttsContent ) - ) -// .apply { -// sourceType = DataSourceType.OBU -// } + ).apply { + sourceType = DataSourceType.OBU + } ) CallerHmiManager.warningV2X( appId, @@ -1021,10 +973,9 @@ class MogoPrivateObuNewManager private constructor() { alertContent, ttsContent ) - ) -// .apply { -// sourceType = DataSourceType.OBU -// } + ).apply { + sourceType = DataSourceType.OBU + } ) CallerHmiManager.warningV2X( @@ -1079,10 +1030,9 @@ class MogoPrivateObuNewManager private constructor() { alertContent, ttsContent ) - ) -// .apply { //TODO -// sourceType = DataSourceType.OBU -// } + ).apply { + sourceType = DataSourceType.OBU + } ) CallerHmiManager.warningV2X(