diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt index 6d0d5ba1d6..16afda3c40 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MoGoObuProvider.kt @@ -36,6 +36,7 @@ class MoGoObuProvider : IMoGoObuProvider { //obu融合数据 MogoObuDcCombineManager.INSTANCE.init(context) CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress()) + //bus乘客版本obu功能去掉 if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt index de0079b86c..f400cd5c15 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt @@ -10,17 +10,23 @@ 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.obucombine.IMoGoObuDcCombineListener +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningMapListener +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsmListener +import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningSpatListener 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.call.obu.CallerObuMapMathListenerManager +import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager +import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager +import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager 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.ObuScene import com.mogo.support.obu.constants.MogoObuConstants -import mogo.v2x.ObuWarningEvent import mogo.v2x.ObuWarningEvent.* import kotlin.math.roundToInt @@ -31,7 +37,8 @@ import kotlin.math.roundToInt * @since 2021/11/30 * @description 工控机融合数据 */ -class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener { +class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener, + IMoGoObuWarningRsmListener, IMoGoObuWarningMapListener, IMoGoObuWarningSpatListener { companion object { val INSTANCE: MogoObuDcCombineManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { MogoObuDcCombineManager() @@ -44,49 +51,40 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener fun init(context: Context) { mContext = context - CallerObuDcCombineListenerManager.addListener(TAG, this) + CallerObuWarningRsiListenerManager.addListener(TAG, this) + CallerObuWarningRsmListenerManager.addListener(TAG, this) + CallerObuMapMathListenerManager.addListener(TAG, this) + CallerObuWarningSpatListenerManager.addListener(TAG, this) } fun destoryListener() { - CallerObuDcCombineListenerManager.removeListener(TAG) + CallerObuWarningRsiListenerManager.removeListener(TAG) + CallerObuWarningRsmListenerManager.removeListener(TAG) + CallerObuMapMathListenerManager.removeListener(TAG) + CallerObuWarningSpatListenerManager.removeListener(TAG) } - /** - * 通过工控机中转的obu数据,包括rsi,rsm,spat - * - */ - override fun onMoGoObuDcCombineData(obuWarningData: ObuWarningEvent.ObuWarningData?) { - CallerLogger.d( - "${M_OBU}${TAG}", - "MogoObuDcCombineManager onMoGoObuDcCombineData obuWarningData = ${obuWarningData.toString()} ---obuWarningData.msgDataType = ${obuWarningData?.msgDataType}" - ) - - obuWarningData?.let { - when (obuWarningData.msgDataType) { - 1 -> { //rsiEvent - onMogoObuDcRsiWarning(obuWarningData.rsiEvent) - } - - 2 -> { //RsmEvent - onMogoObuDcRsmWarning(obuWarningData.rsmEvent) - } - - 3 -> { //SpatEvent - onMogoObuDcSpatWarning(obuWarningData.spatEvent) - } - - 4 -> { //map - onMogoObuMapMath(obuWarningData.mapMatchData) - } - } - } - + override fun onMoGoObuRsiWarning(rsiWarningData: ObuScene.RsiWarningData) { + onMogoObuDcRsiWarning(rsiWarningData) } + override fun onMoGoObuRsmWarning(rsmWarningData: ObuScene.RsmWarningData) { + onMogoObuDcRsmWarning(rsmWarningData) + } + + override fun onMoGoObuSpatWarning(spatWarningData: ObuScene.SpatWarningData) { + onMogoObuDcSpatWarning(spatWarningData) + } + + override fun onMoGoObuMapMath(mapMatchData: ObuScene.MapMatchData) { + onMogoObuMapMath(mapMatchData) + } + + /** * RSI预警信息 CvxRtiThreatIndInfo(交通标志预警(前方限速、前方学校等等),交通事件预警(前方拥堵、前方积水等等)) */ - fun onMogoObuDcRsiWarning(rsiWarningData: RsiWarningData?) { + private fun onMogoObuDcRsiWarning(rsiWarningData: ObuScene.RsiWarningData?) { CallerLogger.d( "${M_OBU}${TAG}", "MogoObuDcCombineManager onMogoObuRsiWarning ------> ${rsiWarningData.toString()}" @@ -316,22 +314,22 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener /** * RSM预警信息 CvxPtcThreatIndInfo CvxPtcInfoIndInfo(主车与弱势交通参与者之间的预警(如:弱势交通参与者碰撞预警)) */ - fun onMogoObuDcRsmWarning(rsmWarningData: RsmWarningData?) { + fun onMogoObuDcRsmWarning(rsmWarningData: ObuScene.RsmWarningData?) { if (HmiBuildConfig.isShowObuWeaknessTrafficView) { CallerLogger.d( "${M_OBU}${TAG}", "MogoObuDcCombineManager onMogoObuRsmWarning ------> ${rsmWarningData.toString()}" ) // 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu - if (rsmWarningData != null && rsmWarningData.participantOfOne != null) { + if (rsmWarningData != null && rsmWarningData.participant != null) { var v2xType = "" - if (rsmWarningData.participantOfOne.ptcType == 1) { //机动车 + if (rsmWarningData.participant.ptcType == 1) { //机动车 v2xType = EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType - } else if (rsmWarningData.participantOfOne.ptcType == 2) { //非机动车 + } else if (rsmWarningData.participant.ptcType == 2) { //非机动车 v2xType = EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType - } else if (rsmWarningData.participantOfOne.ptcType == 3) { //行人 + } else if (rsmWarningData.participant.ptcType == 3) { //行人 v2xType = EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType } else { //未知 @@ -342,7 +340,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener EventTypeEnumNew.getWarningContent(v2xType) var level = -1 val direction = - getMessageDirection(rsmWarningData.participantOfOne.targetPosition) //TODO 只有一个 + getMessageDirection(rsmWarningData.participant.targetPosition) //TODO 只有一个 if (rsmWarningData.warningMsg != null && rsmWarningData.warningMsg.warningDataList != null && rsmWarningData.warningMsg.warningDataList.size > 0) { level = rsmWarningData.warningMsg.warningDataList[0].warningLevel CallerLogger.d( @@ -409,7 +407,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener // } //删除弱势交通元素 CallerMapUIServiceManager.getMarkerService() - ?.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString()) + ?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString()) // TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString()) } } @@ -422,7 +420,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener /** * 红绿灯预警信息 */ - fun onMogoObuDcSpatWarning(spatWarningData: SpatWarningData?) { + fun onMogoObuDcSpatWarning(spatWarningData: ObuScene.SpatWarningData?) { CallerLogger.d( "${M_OBU}${TAG}", "onMogoObuDcSpatWarning warningType = ${spatWarningData!!.warningType} --status = ${spatWarningData?.status} --lightsList = ${spatWarningData.lightsList}" @@ -437,7 +435,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener /** * 地图匹配 是OBU算法输出地图匹配结果,主车匹配道路哪条路或者哪条车道 */ - fun onMogoObuMapMath(data: MapMatchData?) { + fun onMogoObuMapMath(data: ObuScene.MapMatchData?) { CallerLogger.d( "${M_OBU}${TAG}", "MogoObuDcCombineManager onMogoObuMapMath HmiBuildConfig.isShowObuLimitSpeedView = " + HmiBuildConfig.isShowObuLimitSpeedView @@ -453,7 +451,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener } --- data.speedMaxLimit = ${data.speedMaxLimit}" ) when (data.status) { - MogoObuConstants.STATUS.ADD -> { // 添加 TODO + MogoObuConstants.STATUS.ADD -> { // 添加 CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange( (data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(), DataSourceType.OBU @@ -513,7 +511,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener private fun handlerTrafficLight( appId: Int, status: Int, - lights: List + lights: List ) { CallerLogger.d( "${M_OBU}${TAG}", @@ -547,7 +545,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener @Synchronized private fun changeTrafficLightStatus( appId: Int, - lights: List + lights: List ) { var ttsContent = "" var alertContent = "" @@ -666,7 +664,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener DataSourceType.TELEMATIC ) val red = currentLight.countDown / 10 - CallerTrafficLightListenerManager.changeCountdownRed(red) + CallerTrafficLightListenerManager.changeCountdownRed(red.toInt()) } // 绿灯 @@ -676,7 +674,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener DataSourceType.TELEMATIC ) val green = currentLight.countDown / 10 - CallerTrafficLightListenerManager.changeCountdownGreen(green) + CallerTrafficLightListenerManager.changeCountdownGreen(green.toInt()) } // 黄灯 @@ -686,7 +684,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener DataSourceType.TELEMATIC ) val yellow = currentLight.countDown / 10 - CallerTrafficLightListenerManager.changeCountdownYellow(yellow) + CallerTrafficLightListenerManager.changeCountdownYellow(yellow.toInt()) } } }