From c223edae68030674e710bfab4a5749883560b778 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Sat, 28 Jan 2023 19:02:54 +0800 Subject: [PATCH] =?UTF-8?q?[dev=5Farch=5Fopt=5F3.0]=20=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E8=80=81=E7=9A=84obu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/AndroidManifest.xml | 7 ++ .../core/function/obu/mogo/MoGoObuProvider.kt | 7 +- .../obu/mogo/MogoPrivateObuManager.kt | 91 ++++++++----------- .../mogo/receiver/ObuTestNewObuRsiReceiver.kt | 57 ++++++++++++ .../eagle/core/data/enums/EventTypeEnum.kt | 2 +- 5 files changed, 105 insertions(+), 59 deletions(-) create mode 100644 core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestNewObuRsiReceiver.kt diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/AndroidManifest.xml b/core/function-impl/mogo-core-function-obu-mogo/src/main/AndroidManifest.xml index dc0250ec9b..1f72d0c85c 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/AndroidManifest.xml +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/AndroidManifest.xml @@ -33,6 +33,13 @@ + + + + + + + \ No newline at end of file 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 9d8693a859..a4de8e25d8 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 @@ -32,7 +32,9 @@ class MoGoObuProvider : IMoGoObuProvider { } override fun init(context: Context) { - CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress() + "--") + //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 @@ -55,8 +57,6 @@ class MoGoObuProvider : IMoGoObuProvider { //old obu MogoPrivateObuManager.INSTANCE.init(context, ipAddress) - CallerLogger.d("$M_OBU$TAG", "bus 司机 ipAddress = $ipAddress ---localIp = ${CommonUtils.getIpAddressString()}") - } else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端 val ipAddress = SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp) @@ -69,7 +69,6 @@ class MoGoObuProvider : IMoGoObuProvider { //old obu MogoPrivateObuManager.INSTANCE.init(context, ipAddress) - CallerLogger.d("$M_OBU$TAG", "taxi 司机端和乘客端 ipAddress = $ipAddress ---localIp = ${CommonUtils.getIpAddressString()}") } } } 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 455baa8490..973c7da6ee 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,16 +2,13 @@ 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.enums.EventTypeEnum -import com.mogo.eagle.core.data.enums.EventTypeHelper +import com.mogo.eagle.core.data.constants.MogoServicePaths 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 @@ -19,12 +16,18 @@ 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 @@ -45,11 +48,14 @@ 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) @@ -226,7 +232,7 @@ class MogoPrivateObuManager private constructor() { // (3) 道路事件预警信息:CVX_RTI_THREAT_IND override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) { - if (HmiBuildConfig.isShowObuV2iView) { +// if (HmiBuildConfig.isShowObuV2iView) { CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxRtiThreatIndInfo ------> $info" @@ -322,8 +328,7 @@ class MogoPrivateObuManager private constructor() { } //事故易发路段 0x1B -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType + appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType } //环岛行驶 0x1C -> { @@ -370,21 +375,16 @@ class MogoPrivateObuManager private constructor() { // 添加 ObuConstants.STATUS.ADD -> { //不显示弹框,其它保留 - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "old onCvxRtiThreatIndInfo ------> appId = $appId --- alertContent = $alertContent --- ttsContent = $ttsContent " - ) + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxRtiThreatIndInfo ------> appId = $appId --- alertContent = $alertContent --- ttsContent = $ttsContent ") if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { Log.d("MsgBox-PriObuManager4", "alertContent或ttsContent为空!") } CallerMsgBoxManager.saveMsgBox( MsgBoxBean( MsgBoxType.OBU, - V2XMsg( - appId, + V2XMsg(appId, alertContent, - ttsContent - ) + ttsContent) ) ) CallerHmiManager.warningV2X( @@ -432,8 +432,7 @@ class MogoPrivateObuManager private constructor() { } } } - } - +// } } // (4) V2I预警信息:CVX_IVP_THREAT_IND,红绿灯 @@ -447,20 +446,20 @@ class MogoPrivateObuManager private constructor() { && info.ext_info.lights != null && info.ext_info.lights.isNotEmpty() ) { - if (HmiBuildConfig.isShowObuV2iView) { +// if (HmiBuildConfig.isShowObuV2iView) { handlerTrafficLight( info.threat_info.app_id, info.status, info.ext_info.lights, info.ext_info.index ) - } +// } } } // (2) 弱势交通参与者预警信息:CVX_PTC_THREAT_IND override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) { - if (HmiBuildConfig.isShowObuV2iView) { +// if (HmiBuildConfig.isShowObuV2iView) { CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxPtcInfoIndInfo ------> $info" @@ -502,21 +501,16 @@ class MogoPrivateObuManager private constructor() { // if (level == 2 || level == 3) { //不考虑level //显示警告红边 CallerHmiManager.showWarning(direction) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "old onCvxPtcThreatIndInfo ------> v2xType = $v2xType --- alertContent = $alertContent --- ttsContent = $ttsContent " - ) + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxPtcThreatIndInfo ------> v2xType = $v2xType --- alertContent = $alertContent --- ttsContent = $ttsContent ") if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { Log.d("MsgBox-PriObuManager5", "alertContent或ttsContent为空!") } CallerMsgBoxManager.saveMsgBox( MsgBoxBean( MsgBoxType.OBU, - V2XMsg( - v2xType, + V2XMsg(v2xType, alertContent, - ttsContent - ) + ttsContent) ) ) CallerHmiManager.warningV2X( @@ -563,7 +557,7 @@ class MogoPrivateObuManager private constructor() { } } - } +// } } // (5) 限速预警信息:CVX_SLW_THREAT_IND @@ -596,7 +590,7 @@ class MogoPrivateObuManager private constructor() { // (1) V2V预警信息:CVX_V2V_THREAT_IND override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) { - if (HmiBuildConfig.isShowObuV2vView) { +// if (HmiBuildConfig.isShowObuV2vView) { CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxV2vThreatIndInfo ------> $info" @@ -624,7 +618,7 @@ class MogoPrivateObuManager private constructor() { } } } - } +// } } /** @@ -733,10 +727,7 @@ class MogoPrivateObuManager private constructor() { 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT ttsContent = EventTypeEnum.getWarningTts(appId.toString()) alertContent = EventTypeEnum.getWarningContent(appId.toString()) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "old changeTrafficLightStatus ------> appId.toString() = ${appId.toString()} --- alertContent = $alertContent --- ttsContent = $ttsContent " - ) + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old changeTrafficLightStatus ------> appId.toString() = ${appId.toString()} --- alertContent = $alertContent --- ttsContent = $ttsContent ") if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { Log.d("MsgBox-PriObuManager1", "alertContent或ttsContent为空!") } @@ -758,7 +749,7 @@ class MogoPrivateObuManager private constructor() { when (currentLight.phase) { // 灯光不可用 0x0 -> { - CallerHmiManager.showWarningTrafficLight(0, 2) + CallerHmiManager.showWarningTrafficLight(0, 3) } // 红灯 0x1 -> { @@ -767,7 +758,7 @@ class MogoPrivateObuManager private constructor() { isRedLight = true } isGreenLight = false - CallerHmiManager.showWarningTrafficLight(1, 2) + CallerHmiManager.showWarningTrafficLight(1, 3) val red = currentLight.count_down.toInt() CallerHmiManager.changeCountdownRed(red) @@ -782,7 +773,7 @@ class MogoPrivateObuManager private constructor() { isGreenLight = true } isRedLight = false - CallerHmiManager.showWarningTrafficLight(3, 2) + CallerHmiManager.showWarningTrafficLight(3, 3) val green = currentLight.count_down.toInt() CallerHmiManager.changeCountdownGreen(green) //防止数据出现问题的容错 @@ -813,21 +804,16 @@ class MogoPrivateObuManager private constructor() { val maxSpeed = currentLight.glosa_suggested_speed_max.toInt() if (maxSpeed > 0) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "old changeTrafficLightStatus ------> TYPE_USECASE_ID_IVP_GREEN --- alertContent = $alertContent --- ttsContent = $ttsContent " - ) + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old changeTrafficLightStatus ------> TYPE_USECASE_ID_IVP_GREEN --- alertContent = $alertContent --- ttsContent = $ttsContent ") if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { Log.d("MsgBox-PriObuManager2", "alertContent或ttsContent为空!") } CallerMsgBoxManager.saveMsgBox( MsgBoxBean( MsgBoxType.OBU, - V2XMsg( - EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, + V2XMsg(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, - ttsContent - ) + ttsContent) ) ) CallerHmiManager.warningV2X( @@ -954,8 +940,7 @@ class MogoPrivateObuManager private constructor() { ) if (level == 2 || level == 3) { //不显示顶部弹框,其它保留 - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" ) if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { @@ -964,11 +949,9 @@ class MogoPrivateObuManager private constructor() { CallerMsgBoxManager.saveMsgBox( MsgBoxBean( MsgBoxType.OBU, - V2XMsg( - appId.toString(), + V2XMsg(appId.toString(), alertContent, - ttsContent - ) + ttsContent) ) ) CallerHmiManager.warningV2X( diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestNewObuRsiReceiver.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestNewObuRsiReceiver.kt new file mode 100644 index 0000000000..c216a9e7be --- /dev/null +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/receiver/ObuTestNewObuRsiReceiver.kt @@ -0,0 +1,57 @@ +package com.mogo.eagle.core.function.obu.mogo.receiver + +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.util.Log +import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuNewManager +import com.mogo.support.obu.model.MogoObuRsiWarningData +import com.mogo.support.obu.model.MogoObuRvWarningData +import com.mogo.support.obu.model.advance.RsiWarning +import com.mogo.support.obu.model.advance.V2xWarning +import com.mogo.support.obu.model.advance.VehBasics +import com.mogo.support.obu.model.advance.WarningData + +/** + * @author lixiaopeng + * @date 2023/1/13 10:50 上午 + * + * 自研OBU RSI 模拟场景 + */ +class ObuTestNewObuRsiReceiver : BroadcastReceiver() { + private var mContext: Context? = null + + companion object { + private const val TAG = "ObuTestNewObuReceiver" + } + + override fun onReceive(context: Context, intent: Intent) { + mContext = context + /** + * OBU 场景类型 + */ + val obuSceneType = intent.getIntExtra("sceneType", 0) + val obuStatus = intent.getIntExtra("status", 0) +// val obuDistance = intent.getDoubleExtra("distance", 0.0) + val obuEventSeriaNum = intent.getIntExtra("seriaNum", 0) + val obuSignSerialNum = intent.getIntExtra("signSerialNum", 0) + + val rsiWarning = RsiWarning(1) + rsiWarning.warningLevel = 1 + + rsiWarning.setDistance(1000) + rsiWarning.sceneType = obuSceneType //预警类型 0:无效 1:限速信息 2:道路危险 3:车内标牌 4:前方拥堵 + rsiWarning.eventSerialNum = obuEventSeriaNum //根据预警类型匹配 101 车辆故障 + rsiWarning.signSerialNum = obuSignSerialNum // 2:急转弯,8:桥梁 + + val rsiWarningList = listOf(rsiWarning) //TODO + + val cvxObuRsiInfo = MogoObuRsiWarningData(obuStatus, 1, rsiWarningList) + + MogoPrivateObuNewManager.INSTANCE + .getMogoObuListener() + .onMogoObuRsiWarning(cvxObuRsiInfo) + + } + +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnum.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnum.kt index 604d540451..e291c91433 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnum.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnum.kt @@ -619,7 +619,7 @@ enum class EventTypeEnum( fun getMarker3DRes(poiType: String?): Int { return when (poiType) { FOURS_BLOCK_UP.poiType -> R.raw.v2x_yongdu - FOURS_ACCIDENT.poiType -> R.raw.v2x_shigu + FOURS_ACCIDENT.poiType,FOURS_ACCIDENT_04.poiType -> R.raw.v2x_shigu FOURS_LIVING.poiType -> R.raw.v2x_shishilukuang FOURS_FOG.poiType -> R.raw.v2x_nongwu TRAFFIC_CHECK.poiType -> R.raw.v2x_jiaotongjiancha