From ef4f81e32dc22eb9d14be2b6a78044e4f0cdf470 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 13 Feb 2023 17:52:16 +0800 Subject: [PATCH] =?UTF-8?q?[dev=5Farch=5Fopt=5F3.0]=20=E4=BF=AE=E6=94=B9ob?= =?UTF-8?q?u=E7=9B=B4=E8=BF=9E=E7=9A=84=E6=95=B0=E6=8D=AE=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E5=92=8C=E5=92=8C=E5=9B=9E=E8=B0=83=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../build.gradle | 8 +- .../obu/MogoPrivateObuNewManager.kt | 870 +++++++++--------- .../obu/receiver/ObuTestNewObuReceiver.kt | 8 +- .../obu/receiver/ObuTestNewObuRsiReceiver.kt | 10 +- .../obu/utils/TrafficDataConvertUtilsNew.kt | 42 +- .../mogo-core-function-hmi/build.gradle | 3 +- core/mogo-core-function-api/build.gradle | 2 +- .../api/obu/IMoGoObuLocationWGS84Listener.kt | 2 +- core/mogo-core-function-call/build.gradle | 4 +- 9 files changed, 468 insertions(+), 481 deletions(-) diff --git a/core/function-impl/mogo-core-function-datacenter/build.gradle b/core/function-impl/mogo-core-function-datacenter/build.gradle index 7b49429b23..a689c55ff7 100644 --- a/core/function-impl/mogo-core-function-datacenter/build.gradle +++ b/core/function-impl/mogo-core-function-datacenter/build.gradle @@ -55,20 +55,18 @@ dependencies { implementation rootProject.ext.dependencies.androidxroomktx implementation rootProject.ext.dependencies.mogoaicloudtelematic - - implementation rootProject.ext.dependencies.mogoobu implementation rootProject.ext.dependencies.amapnavi3dmap + implementation project(':libraries:mogo-obu') + implementation project(':libraries:mogo-adas') + implementation project(':libraries:mogo-adas-data') if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_utils implementation rootProject.ext.dependencies.mogo_core_function_call - - implementation project(':libraries:mogo-adas') implementation rootProject.ext.dependencies.mogocommons } else { implementation project(':core:mogo-core-utils') implementation project(':core:mogo-core-function-call') - implementation project(':libraries:mogo-adas') implementation project(':foudations:mogo-commons') } } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt index 501cb50af4..953aae4898 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt @@ -23,8 +23,8 @@ import com.mogo.eagle.core.function.datacenter.obu.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.util.UiThreadHandler -import com.mogo.support.obu.MogoObuManager -import com.mogo.support.obu.OnMogoObuListener +import com.mogo.support.obu.ObuBase +import com.mogo.support.obu.ObuScene import com.mogo.support.obu.constants.MogoObuComType import com.mogo.support.obu.constants.MogoObuConstants import com.mogo.support.obu.constants.MogoObuTopicId @@ -32,6 +32,9 @@ import com.mogo.support.obu.model.* import com.mogo.support.obu.model.advance.SpatLight import com.mogo.support.obu.option.MogoObuCom import com.mogo.support.obu.option.MogoObuOptions +import com.zhidao.support.obu.ObuManager +import com.zhidao.support.obu.OnObuListener +import mogo.telematics.pad.MessagePad import kotlin.math.roundToInt /** @@ -50,7 +53,7 @@ class MogoPrivateObuNewManager private constructor() { private var mObuStatusInfo = CallerObuConnectListenerManager.getObuStatusInfo() fun connectObu(context: Context, obuIpAddress: String, padIpAddress: String) { - MogoObuManager.getInstance().registerMogoObuListener(mogoObuListener) + ObuManager.getInstance().registerObuListener(mogoObuListener) val com = MogoObuCom.newBuilder() .setLocalIp(padIpAddress) .setComType(MogoObuComType.UDP) @@ -70,27 +73,27 @@ class MogoPrivateObuNewManager private constructor() { .build() //每次连接的时候如果连接连接了,先断开 - if (MogoObuManager.getInstance().connectStatus == 1) { + if (ObuManager.getInstance().connectStatus == 1) { try { - MogoObuManager.getInstance().disconnect() + ObuManager.getInstance().disconnect() } catch (e: Exception) { e.printStackTrace() } } - MogoObuManager.getInstance().connect(options) + ObuManager.getInstance().connect(options) } - fun getMogoObuListener(): OnMogoObuListener { + fun getMogoObuListener(): OnObuListener { return mogoObuListener } fun disconnect() { - MogoObuManager.getInstance().disconnect() + ObuManager.getInstance().disconnect() } - private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() { + private val mogoObuListener: OnObuListener = object : OnObuListener { /** * 连接状态的改变 */ @@ -105,23 +108,23 @@ class MogoPrivateObuNewManager private constructor() { } /** - * HV车辆基础信息 CvxHvCarIndInfo CvxHvInfoIndInfo + * HV车辆基础信息 gnssInfo */ - override fun onMogoObuHvBasics(mogoObuHvBasicsData: MogoObuHvBasicsData?) { - if (mogoObuHvBasicsData != null && mogoObuHvBasicsData.vehBasicsMsg != null) { + override fun onGnssInfo(gnssInfo: MessagePad.GnssInfo?) { + if (gnssInfo != null ) { CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "onMogoObuHvBasics lon = ${mogoObuHvBasicsData.vehBasicsMsg.longitude} --- lat = ${mogoObuHvBasicsData.vehBasicsMsg.latitude} ---speed = ${mogoObuHvBasicsData.vehBasicsMsg.speed} ---heading = ${mogoObuHvBasicsData.vehBasicsMsg.heading} --acceleration = ${mogoObuHvBasicsData.vehBasicsMsg.accFourAxes.accLat} --yawRate = ${mogoObuHvBasicsData.vehBasicsMsg.accFourAxes.accYaw}" + "onGnssInfo lon = ${gnssInfo.longitude} --- lat = ${gnssInfo.latitude} ---speed = ${gnssInfo.gnssSpeed} ---heading = ${gnssInfo.heading} --acceleration = ${gnssInfo.acceleration} --yawRate = ${gnssInfo.yawRate}" ) // 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统,1-工控机,2-OBU if (2 == FunctionBuildConfig.gpsProvider) { - // 同步给MAP地图 - CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(mogoObuHvBasicsData) + // 同步给MAP地图 TODO +// CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo) // 同步更新经纬度和系统时间至 AutoPilotStatusListener CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon( System.currentTimeMillis() / 1000.0, - mogoObuHvBasicsData.vehBasicsMsg.longitude, - mogoObuHvBasicsData.vehBasicsMsg.latitude + gnssInfo.longitude, + gnssInfo.latitude ) } } @@ -130,12 +133,11 @@ class MogoPrivateObuNewManager private constructor() { /** * v2v预警信息 CvxRvInfoIndInfo CvxV2vThreatIndInfo 他车 */ - override fun onMogoObuRvWarning(data: MogoObuRvWarningData) { - super.onMogoObuRvWarning(data) + override fun onObuRvWarning(data: ObuScene.RvWarningData) { // if (HmiBuildConfig.isShowObuV2vView) { //TODO 临时需要关闭v2v开关 - if (!data.warningMsg.warningData.isNullOrEmpty()) { + if (data.warningMsg != null && !data.warningMsg.warningDataList.isNullOrEmpty()) { // 更新数据,远车数据,之前要匹配uuid - TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data)?.let { + TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data.vehBasicsMsg)?.let { CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it) } @@ -150,10 +152,10 @@ class MogoPrivateObuNewManager private constructor() { var level = -1 var status = -1 data.warningMsg?.let { - if (data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { - level = data.warningMsg.warningData[0].warningLevel - appId = data.warningMsg.warningData[0].warningType.toString() - status = data.warningMsg.warningData[0].status + if (data.warningMsg.warningDataList != null && data.warningMsg.warningDataList.size > 0) { + level = data.warningMsg.warningDataList[0].warningLevel + appId = data.warningMsg.warningDataList[0].warningType.toString() + status = data.warningMsg.warningDataList[0].status //拼凑数据 handleSdkObu(appId, direction, status, level, data) } @@ -174,38 +176,36 @@ class MogoPrivateObuNewManager private constructor() { /** * 红绿灯预警信息 CvxIvpThreatIndInfo */ - override fun onMogoObuSpatWarning(data: MogoObuSpatWarningData) { - super.onMogoObuSpatWarning(data) + override fun onObuSpatWarning(data: ObuScene.SpatWarningData) { handlerTrafficLight( data.warningType, data.status, - data.lights + data.lightsList ) } /** * RSI预警信息 onMogoObuRsiWarning(交通标志预警(前方限速、前方学校等等),交通事件预警(前方拥堵、前方积水等等)) */ - override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) { - super.onMogoObuRsiWarning(data) + override fun onObuRsiWarning(data: ObuScene.RsiWarningData) { // if (HmiBuildConfig.isShowObuV2iView) { - if (data.warningMsg != null && data.warningMsg.size > 0) { + if (data.warningMsgList != null && data.warningMsgList.size > 0) { var alertContent = "" var ttsContent = "" - var appId = data.warningMsg[0].sceneType.toString() + var appId = data.warningMsgList[0].sceneType.toString() val status = data.status - val level = data.warningMsg[0].warningLevel - val direction = getMessageDirection(data.warningMsg[0].targetPosition) + val level = data.warningMsgList[0].warningLevel + val direction = getMessageDirection(data.warningMsgList[0].targetPosition) CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "onMogoObuRsiWarning appId = $appId --status = $status --level = $level -- eventSerialNum = ${data.warningMsg[0].eventSerialNum} ---signSerialNum = ${data.warningMsg[0].signSerialNum} --- direction = $direction -- targetPosition = ${data.warningMsg[0].targetPosition}" + "onMogoObuRsiWarning appId = $appId --status = $status --level = $level -- eventSerialNum = ${data.warningMsgList[0].eventSerialNum} ---signSerialNum = ${data.warningMsgList[0].signSerialNum} --- direction = $direction -- targetPosition = ${data.warningMsgList[0].targetPosition}" ) if (appId != "0") { when (appId) { // 道路危险情况预警 MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> { - when (data.warningMsg[0].eventSerialNum) { + when (data.warningMsgList[0].eventSerialNum) { MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障 appId = EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType @@ -231,19 +231,19 @@ class MogoPrivateObuNewManager private constructor() { ttsContent = EventTypeEnumNew.getWarningTts(appId) alertContent = String.format( //事件才有影响范围 alertContent, - Math.round(data.warningMsg[0].distance).toString(), - Math.round(data.warningMsg[0].eventRadius).toString() + Math.round(data.warningMsgList[0].distance).toString(), + Math.round(data.warningMsgList[0].eventRadius).toString() ) ttsContent = String.format( ttsContent, - Math.round(data.warningMsg[0].distance).toString(), - Math.round(data.warningMsg[0].eventRadius).toString() + Math.round(data.warningMsgList[0].distance).toString(), + Math.round(data.warningMsgList[0].eventRadius).toString() ) } //车内标牌 MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> { - when (data.warningMsg[0].signSerialNum) { + when (data.warningMsgList[0].signSerialNum) { // MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口 // appId = EventTypeEnumNew.TYPE_ID_NTERSECTION.poiType // } @@ -323,11 +323,11 @@ class MogoPrivateObuNewManager private constructor() { ttsContent = EventTypeEnumNew.getWarningTts(appId) alertContent = String.format( //标牌是没有影响范围的 alertContent, - Math.round(data.warningMsg[0].distance).toString() + Math.round(data.warningMsgList[0].distance).toString() ) ttsContent = String.format( ttsContent, - Math.round(data.warningMsg[0].distance).toString() + Math.round(data.warningMsgList[0].distance).toString() ) } @@ -338,13 +338,13 @@ class MogoPrivateObuNewManager private constructor() { ttsContent = EventTypeEnumNew.getWarningTts(appId) alertContent = String.format( //事件才有影响范围 alertContent, - Math.round(data.warningMsg[0].distance).toString(), - Math.round(data.warningMsg[0].eventRadius).toString() + Math.round(data.warningMsgList[0].distance).toString(), + Math.round(data.warningMsgList[0].eventRadius).toString() ) ttsContent = String.format( ttsContent, - Math.round(data.warningMsg[0].distance).toString(), - Math.round(data.warningMsg[0].eventRadius).toString() + Math.round(data.warningMsgList[0].distance).toString(), + Math.round(data.warningMsgList[0].eventRadius).toString() ) } @@ -358,9 +358,9 @@ class MogoPrivateObuNewManager private constructor() { 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 = ${ - Math.round(data.warningMsg[0].distance) - } ---eventRadius = ${Math.round(data.warningMsg[0].eventRadius)} --speedMaxLimit = ${data.warningMsg[0].speedMaxLimit.toInt()}" + "new onMogoObuRsiWarning appId = $appId ---status = $status --- ttsContent = $ttsContent --alertContent = $alertContent -- eventSerialNum = ${data.warningMsgList[0].eventSerialNum} ---signSerialNum = ${data.warningMsgList[0].signSerialNum} ---direction = ${direction.direction} --distance = ${ + Math.round(data.warningMsgList[0].distance) + } ---eventRadius = ${Math.round(data.warningMsgList[0].eventRadius)} --speedMaxLimit = ${data.warningMsgList[0].speedMaxLimit.toInt()}" ) when (status) { @@ -425,10 +425,9 @@ class MogoPrivateObuNewManager private constructor() { * 3:行人 * 4:OBU自身 */ - override fun onMogoObuRsmWarning( - data: MogoObuRsmWarningData? + override fun onObuRsmWarning( + data: ObuScene.RsmWarningData? ) { - super.onMogoObuRsmWarning(data) CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "onMogoObuRsmWarning ------> ${data.toString()}" @@ -505,13 +504,13 @@ class MogoPrivateObuNewManager private constructor() { } //预警status - if (data.warningMsg != null && data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { - level = data.warningMsg.warningData[0].warningLevel //默认是1个 + if (data.warningMsg != null && data.warningMsg.warningDataList != null && data.warningMsg.warningDataList.size > 0) { + level = data.warningMsg.warningDataList[0].warningLevel //默认是1个 CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "onMogoObuRsmWarning ---status---> ${data.status} ---data.warningMsg.warningData[0].status = ${data.warningMsg.warningData[0].status} ---v2xType = $v2xType ---alertContent = $alertContent ---ttsContent = $ttsContent ---level = $level" + "onMogoObuRsmWarning ---status---> ${data.status} ---data.warningMsg.warningData[0].status = ${data.warningMsg.warningDataList[0].status} ---v2xType = $v2xType ---alertContent = $alertContent ---ttsContent = $ttsContent ---level = $level" ) - when (data.warningMsg.warningData[0].status) { + when (data.warningMsg.warningDataList[0].status) { MogoObuConstants.STATUS.ADD -> { // 添加 //更新模型的颜色 TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data) @@ -564,8 +563,7 @@ class MogoPrivateObuNewManager private constructor() { /** * 地图匹配 是OBU算法输出地图匹配结果,主车匹配道路哪条路或者哪条车道 */ - override fun onMogoObuMapMath(data: MogoObuMapMathData?) { - super.onMogoObuMapMath(data) + override fun onObuMapMath(data: ObuScene.MapMatchData?) { if (data != null) { CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", @@ -595,371 +593,200 @@ class MogoPrivateObuNewManager private constructor() { } } } + } + } + } + + /** + * 获取消息的方位 车辆相关 + */ + private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum { + // CallerLogger.d("$M_OBU${TAG_MOGO_NEW_OBU}", "预警红边:预警方向->$targetClassification") + return when (targetClassification) { + MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE, + MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方 + + MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方 + + MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方 + + MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方 + + MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT, + MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT + -> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方 + + MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT, + MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT + -> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方 + + MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT, + -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方 + + MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT, + -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方 + + MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知 + else -> WarningDirectionEnum.ALERT_WARNING_ALL } } -} + /** + * 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示 + * + * @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 TODO 添加事件频繁播报拦截 + * + * @see com.mogo.module.common.enums.EventTypeEnum + */ + private fun handleSdkObu( + appId: String, + direction: WarningDirectionEnum, + status: Int, + level: Int, + info: ObuScene.RvWarningData + ) { + // 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnumNew 提供的 + var alertContent: String = "" + var ttsContent: String = "" + var changeVisualAngle = false + when (appId) { + //交叉路口碰撞预警 + MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> { + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType) + } -/** - * 获取消息的方位 车辆相关 - */ -private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum { - // CallerLogger.d("$M_OBU${TAG_MOGO_NEW_OBU}", "预警红边:预警方向->$targetClassification") - return when (targetClassification) { - MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE, - MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方 + //交叉路口碰撞预警 + MogoObuConstants.V2X_WARNING_TYPE.ICW.toString() -> { + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType) + } - MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方 + //左转辅助预警 + MogoObuConstants.V2X_WARNING_TYPE.LTA.toString() -> { + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType) + } - MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方 + //盲区预警 + MogoObuConstants.V2X_WARNING_TYPE.BSW.toString() -> { + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType) + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType) + if ( + direction == WarningDirectionEnum.ALERT_WARNING_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT + ) { //左后 + changeVisualAngle = true + ttsContent = String.format(ttsContent, "左") + alertContent = String.format(alertContent, "左") + } else if ( + direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT + ) { //右后 + changeVisualAngle = true + ttsContent = String.format(ttsContent, "右") + alertContent = String.format(alertContent, "右") + } + } - MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方 + // 变道预警,注意左后车辆/注意右后车辆 + MogoObuConstants.V2X_WARNING_TYPE.LCW.toString() -> { + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType) + if ( + direction == WarningDirectionEnum.ALERT_WARNING_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT + ) { + ttsContent = String.format(ttsContent, "左") + alertContent = String.format(alertContent, "左") + } else if ( + direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT + ) { + ttsContent = String.format(ttsContent, "右") + alertContent = String.format(alertContent, "右") + } + } - MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT, - MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT - -> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方 + //逆向超车预警 + MogoObuConstants.V2X_WARNING_TYPE.DNPW.toString() -> { + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType) + } - MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT, - MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT - -> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方 + //紧急制动预警 + MogoObuConstants.V2X_WARNING_TYPE.EBW.toString() -> { + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType) + } - MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT, - -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方 + //异常车辆提醒 + MogoObuConstants.V2X_WARNING_TYPE.AVW.toString() -> { + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType) + alertContent = String.format(alertContent, direction.desc) + ttsContent = String.format(ttsContent, direction.desc) + } - MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT, - -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方 + //车辆失控预警 + MogoObuConstants.V2X_WARNING_TYPE.CLW.toString() -> { + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType) + alertContent = String.format(alertContent, direction.desc) + ttsContent = String.format(ttsContent, direction.desc) + } + //车辆失控预警 + MogoObuConstants.V2X_WARNING_TYPE.EVW.toString() -> { + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType) + } - MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知 - else -> WarningDirectionEnum.ALERT_WARNING_ALL - } -} - -/** - * 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示 - * - * @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 TODO 添加事件频繁播报拦截 - * - * @see com.mogo.module.common.enums.EventTypeEnum - */ -private fun handleSdkObu( - appId: String, - direction: WarningDirectionEnum, - status: Int, - level: Int, - info: MogoObuRvWarningData -) { - // 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnumNew 提供的 - var alertContent: String = "" - var ttsContent: String = "" - var changeVisualAngle = false - when (appId) { - //交叉路口碰撞预警 - MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> { - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType) - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType) - } - - //交叉路口碰撞预警 - MogoObuConstants.V2X_WARNING_TYPE.ICW.toString() -> { - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType) - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType) - } - - //左转辅助预警 - MogoObuConstants.V2X_WARNING_TYPE.LTA.toString() -> { - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType) - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType) - } - - //盲区预警 - MogoObuConstants.V2X_WARNING_TYPE.BSW.toString() -> { - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType) - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType) - if ( - direction == WarningDirectionEnum.ALERT_WARNING_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT - ) { //左后 - changeVisualAngle = true - ttsContent = String.format(ttsContent, "左") - alertContent = String.format(alertContent, "左") - } else if ( - direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT - ) { //右后 - changeVisualAngle = true - ttsContent = String.format(ttsContent, "右") - alertContent = String.format(alertContent, "右") + // 这里处理固定的提示信息,包括了<紧急车辆提醒> + else -> { //TODO + // ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) + // alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) } } - // 变道预警,注意左后车辆/注意右后车辆 - MogoObuConstants.V2X_WARNING_TYPE.LCW.toString() -> { - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType) - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType) - if ( - direction == WarningDirectionEnum.ALERT_WARNING_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT - ) { - ttsContent = String.format(ttsContent, "左") - alertContent = String.format(alertContent, "左") - } else if ( - direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT - ) { - ttsContent = String.format(ttsContent, "右") - alertContent = String.format(alertContent, "右") - } - } - - //逆向超车预警 - MogoObuConstants.V2X_WARNING_TYPE.DNPW.toString() -> { - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType) - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType) - } - - //紧急制动预警 - MogoObuConstants.V2X_WARNING_TYPE.EBW.toString() -> { - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType) - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType) - } - - //异常车辆提醒 - MogoObuConstants.V2X_WARNING_TYPE.AVW.toString() -> { - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType) - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType) - alertContent = String.format(alertContent, direction.desc) - ttsContent = String.format(ttsContent, direction.desc) - } - - //车辆失控预警 - MogoObuConstants.V2X_WARNING_TYPE.CLW.toString() -> { - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType) - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType) - alertContent = String.format(alertContent, direction.desc) - ttsContent = String.format(ttsContent, direction.desc) - } - //车辆失控预警 - MogoObuConstants.V2X_WARNING_TYPE.EVW.toString() -> { - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType) - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType) - } - - // 这里处理固定的提示信息,包括了<紧急车辆提醒> - else -> { //TODO -// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) -// alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) - } - } - - when (status) { - // 添加,更新 add的时候,可能级别是2, - MogoObuConstants.STATUS.ADD, - MogoObuConstants.STATUS.UPDATE -> { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "new handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" - ) - if (level == 2 || level == 3) { - //不显示弹框,其它保留 - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.V2X, - V2XMsg( - appId, - alertContent, - ttsContent - ) - ).apply { - sourceType = DataSourceType.OBU - } - ) - CallerHmiManager.warningV2X( - appId, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - object : IMoGoWarningStatusListener { - override fun onShow() { - super.onShow() - if (changeVisualAngle) { - CallerVisualAngleManager.changeVisualAngle(TooClose) - } - } - - override fun onDismiss() { - if (changeVisualAngle) { - CallerVisualAngleManager.changeVisualAngle(Default()) - } - } - }, direction - ) - } - //更新周边车辆进行预警颜色变换,车辆实时移动和变色 ,UUID不需要匹配了 - TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } - } - // 删除 - MogoObuConstants.STATUS.DELETE -> { - // 关闭警告红边 - CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL) - //更新周边车辆进行预警颜色变换,车辆实时移动和变色 - TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } - } - } -} - -/** - * 处理红绿灯 - */ -private fun handlerTrafficLight(appId: Int, status: Int, lights: List) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId" - ) - when (status) { - // 添加 - MogoObuConstants.STATUS.ADD, - MogoObuConstants.STATUS.UPDATE - -> { - if (lights != null && lights.isNotEmpty()) { - changeTrafficLightStatus(appId, lights) - } - } - // 删除 - MogoObuConstants.STATUS.DELETE -> { - // 移除顶部弹窗 - CallerTrafficLightListenerManager.disableTrafficLight() - isShowGreenWave = false - isShowRunRedLight = false -// lightCountDownRed = 1 -// lightCountDownGreen = 1 -// lightCountDownYellow = 1 - } - } -} - -private var isShowGreenWave = false -private var isShowRunRedLight = false - - -/** - * 修改红绿灯 - */ -@Synchronized -private fun changeTrafficLightStatus( - appId: Int, - lights: List -) { - var ttsContent = "" - var alertContent = "" - //这里需要根据真实数据确定 index 取值方式 - val currentLight = lights[0] - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "changeTrafficLightStatus currentLight = $currentLight ----currentLight.light = ${currentLight.light} ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId --countDown = ${currentLight.countDown.toInt()}" - ) - // 闯红灯预警,绿波通行和闯红灯是互斥的 - when (appId) { - 0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效 - - } - 1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次 - if (!isShowRunRedLight) { - isShowRunRedLight = true + when (status) { + // 添加,更新 add的时候,可能级别是2, + MogoObuConstants.STATUS.ADD, + MogoObuConstants.STATUS.UPDATE -> { CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "changeTrafficLightStatus 闯红灯 --------> " + "new handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" ) - ttsContent = - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType) - alertContent = - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType) - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.V2X, - V2XMsg( - EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, - alertContent, - ttsContent - ) - ).apply { - sourceType = DataSourceType.OBU - } - ) - - CallerHmiManager.warningV2X( - EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, - alertContent, - ttsContent// 只有第一次才tts,防止更新的时候不断的提醒 - ) - } - } - - 2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候 - if (!isShowGreenWave) { - isShowGreenWave = true - - var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6) - var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6) - if (minSpeedTemp == maxSpeedTemp) { - minSpeedTemp -= 5 - } - - val adviceSpeed = "$minSpeedTemp - $maxSpeedTemp" - val adviceSpeedTts = "$minSpeedTemp 到 $maxSpeedTemp" - -// val adviceSpeed = -// "${Math.round(currentLight.suggestMinSpeed*3.6)} - ${Math.round(currentLight.suggestMaxSpeed*3.6)}" -// val adviceSpeedTts = -// "${Math.round(currentLight.suggestMinSpeed*3.6)} 到 ${Math.round(currentLight.suggestMaxSpeed*3.6)}" - - ttsContent = - String.format( - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), - adviceSpeedTts - ) - alertContent = - String.format( - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), - adviceSpeed - ) - - val maxSpeed = currentLight.suggestMaxSpeed - if (maxSpeed > 0) { + if (level == 2 || level == 3) { + //不显示弹框,其它保留 CallerMsgBoxManager.saveMsgBox( MsgBoxBean( MsgBoxType.V2X, V2XMsg( - EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + appId, alertContent, ttsContent ) @@ -968,50 +795,213 @@ private fun changeTrafficLightStatus( } ) CallerHmiManager.warningV2X( - EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + appId, alertContent, - ttsContent// 只有第一次才tts,防止更新的时候不断的提醒 + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + object : IMoGoWarningStatusListener { + override fun onShow() { + super.onShow() + if (changeVisualAngle) { + CallerVisualAngleManager.changeVisualAngle(TooClose) + } + } + + override fun onDismiss() { + if (changeVisualAngle) { + CallerVisualAngleManager.changeVisualAngle(Default()) + } + } + }, direction ) } + //更新周边车辆进行预警颜色变换,车辆实时移动和变色 ,UUID不需要匹配了 + TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } + } + // 删除 + MogoObuConstants.STATUS.DELETE -> { + // 关闭警告红边 + CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL) + //更新周边车辆进行预警颜色变换,车辆实时移动和变色 + TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { + it.threatLevel = 0x01 + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } } } } - when (currentLight.light) { - // 灯光不可用 - 0 -> { - CallerTrafficLightListenerManager.invokeTrafficLightPlusSource( - TrafficLightEnum.BLACK, - -1, - DataSourceType.OBU - ) - } - // 红灯 - 2, 3 -> { - val red = currentLight.countDown.toInt() - CallerTrafficLightListenerManager.invokeTrafficLightPlusSource( - TrafficLightEnum.RED, - red, - DataSourceType.OBU - ) - } - // 绿灯 - 4, 5, 6 -> { - val green = currentLight.countDown.toInt() - CallerTrafficLightListenerManager.invokeTrafficLightPlusSource( - TrafficLightEnum.GREEN, - green, - DataSourceType.OBU - ) - } - // 黄灯 - 7, 8 -> { - val yellow = currentLight.countDown.toInt() - CallerTrafficLightListenerManager.invokeTrafficLightPlusSource( - TrafficLightEnum.YELLOW, - yellow, - DataSourceType.OBU - ) + /** + * 处理红绿灯 + */ + private fun handlerTrafficLight(appId: Int, status: Int, lights: MutableList) { + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", + "handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId" + ) + when (status) { + // 添加 + MogoObuConstants.STATUS.ADD, + MogoObuConstants.STATUS.UPDATE + -> { + if (lights != null && lights.isNotEmpty()) { + changeTrafficLightStatus(appId, lights) + } + } + // 删除 + MogoObuConstants.STATUS.DELETE -> { + // 移除顶部弹窗 + CallerTrafficLightListenerManager.disableTrafficLight() + isShowGreenWave = false + isShowRunRedLight = false + // lightCountDownRed = 1 + // lightCountDownGreen = 1 + // lightCountDownYellow = 1 + } } } -} + + private var isShowGreenWave = false + private var isShowRunRedLight = false + + + /** + * 修改红绿灯 + */ + @Synchronized + private fun changeTrafficLightStatus( + appId: Int, + lights: MutableList + ) { + var ttsContent = "" + var alertContent = "" + //这里需要根据真实数据确定 index 取值方式 + val currentLight = lights[0] + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", + "changeTrafficLightStatus currentLight = $currentLight ----currentLight.light = ${currentLight.light} ---currentLight.phase = ${currentLight.phaseID} ---appId = $appId --countDown = ${currentLight.countDown.toInt()}" + ) + // 闯红灯预警,绿波通行和闯红灯是互斥的 + when (appId) { + 0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效 + + } + 1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次 + if (!isShowRunRedLight) { + isShowRunRedLight = true + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", + "changeTrafficLightStatus 闯红灯 --------> " + ) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType) + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, + alertContent, + ttsContent + ) + ).apply { + sourceType = DataSourceType.OBU + } + ) + + CallerHmiManager.warningV2X( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, + alertContent, + ttsContent// 只有第一次才tts,防止更新的时候不断的提醒 + ) + } + } + + 2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候 + if (!isShowGreenWave) { + isShowGreenWave = true + var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6) + var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6) + if (minSpeedTemp == maxSpeedTemp) { + minSpeedTemp -= 5 + } + + val adviceSpeed = "$minSpeedTemp - $maxSpeedTemp" + val adviceSpeedTts = "$minSpeedTemp 到 $maxSpeedTemp" + ttsContent = + String.format( + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), + adviceSpeedTts + ) + alertContent = + String.format( + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), + adviceSpeed + ) + + val maxSpeed = currentLight.suggestMaxSpeed + if (maxSpeed > 0) { + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + alertContent, + ttsContent + ) + ).apply { + sourceType = DataSourceType.OBU + } + ) + CallerHmiManager.warningV2X( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + alertContent, + ttsContent// 只有第一次才tts,防止更新的时候不断的提醒 + ) + } + } + } + } + + when (currentLight.light) { + // 灯光不可用 + 0 -> { + CallerTrafficLightListenerManager.invokeTrafficLightPlusSource( + TrafficLightEnum.BLACK, + -1, + DataSourceType.OBU + ) + } + // 红灯 + 2, 3 -> { + val red = currentLight.countDown.toInt() + CallerTrafficLightListenerManager.invokeTrafficLightPlusSource( + TrafficLightEnum.RED, + red, + DataSourceType.OBU + ) + } + // 绿灯 + 4, 5, 6 -> { + val green = currentLight.countDown.toInt() + CallerTrafficLightListenerManager.invokeTrafficLightPlusSource( + TrafficLightEnum.GREEN, + green, + DataSourceType.OBU + ) + } + // 黄灯 + 7, 8 -> { + val yellow = currentLight.countDown.toInt() + CallerTrafficLightListenerManager.invokeTrafficLightPlusSource( + TrafficLightEnum.YELLOW, + yellow, + DataSourceType.OBU + ) + } + } + } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/receiver/ObuTestNewObuReceiver.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/receiver/ObuTestNewObuReceiver.kt index ed1abd5575..8a6eb1f7c0 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/receiver/ObuTestNewObuReceiver.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/receiver/ObuTestNewObuReceiver.kt @@ -47,11 +47,11 @@ class ObuTestNewObuReceiver : BroadcastReceiver() { val warningList = listOf(warningData1) warningMsg.warningData = warningList - val cvxHvInfoIndInfo = MogoObuRvWarningData(0, vehBasicsMsg, warningMsg) +// val cvxHvInfoIndInfo = MogoRvWarningData(0, vehBasicsMsg, warningMsg) - MogoPrivateObuNewManager.INSTANCE - .getMogoObuListener() - .onMogoObuRvWarning(cvxHvInfoIndInfo) +// MogoPrivateObuNewManager.INSTANCE +// .getMogoObuListener() +// .onGnssInfo(cvxHvInfoIndInfo) } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/receiver/ObuTestNewObuRsiReceiver.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/receiver/ObuTestNewObuRsiReceiver.kt index f0b78a14f8..abfa91fddd 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/receiver/ObuTestNewObuRsiReceiver.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/receiver/ObuTestNewObuRsiReceiver.kt @@ -41,11 +41,11 @@ class ObuTestNewObuRsiReceiver : BroadcastReceiver() { val rsiWarningList = listOf(rsiWarning) //TODO - val cvxObuRsiInfo = MogoObuRsiWarningData(obuStatus, 1, rsiWarningList) - - MogoPrivateObuNewManager.INSTANCE - .getMogoObuListener() - .onMogoObuRsiWarning(cvxObuRsiInfo) +// val cvxObuRsiInfo = MogoObuRsiWarningData(obuStatus, 1, rsiWarningList) +// +// MogoPrivateObuNewManager.INSTANCE +// .getMogoObuListener() +// .onObuRsiWarning(cvxObuRsiInfo) } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/utils/TrafficDataConvertUtilsNew.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/utils/TrafficDataConvertUtilsNew.kt index 551c4d9c8b..d3bae2a27b 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/utils/TrafficDataConvertUtilsNew.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/utils/TrafficDataConvertUtilsNew.kt @@ -4,6 +4,8 @@ import com.mogo.eagle.core.data.enums.TrafficTypeEnum import com.mogo.eagle.core.data.traffic.TrafficData 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.ObuBase +import com.mogo.support.obu.ObuScene import com.mogo.support.obu.model.MogoObuRsiWarningData import com.mogo.support.obu.model.MogoObuRsmWarningData import com.mogo.support.obu.model.MogoObuRvWarningData @@ -20,18 +22,18 @@ object TrafficDataConvertUtilsNew { /** * OBU 远车 转换交通元素数据,是否需要 */ - fun cvxRvInfoIndInfo2TrafficData(info: MogoObuRvWarningData): TrafficData? { - if (info.vehBasicsMsg == null) { + fun cvxRvInfoIndInfo2TrafficData(info: ObuBase.VehicleBasics): TrafficData? { + if (info == null) { CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全") return null } val trafficData = TrafficData() trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE - trafficData.uuid = info.vehBasicsMsg.id - trafficData.lat = info.vehBasicsMsg.latitude - trafficData.lon = info.vehBasicsMsg.longitude - trafficData.heading = info.vehBasicsMsg.heading - trafficData.speed = info.vehBasicsMsg.speed + trafficData.uuid = info.id + trafficData.lat = info.latitude + trafficData.lon = info.longitude + trafficData.heading = info.heading + trafficData.speed = info.speed return trafficData } @@ -39,25 +41,25 @@ object TrafficDataConvertUtilsNew { /** * OBU RSU道路事件预警信息 转换交通元素数据 标牌 为何要显示level */ - fun cvxRtiThreatIndInfo2TrafficData(info: MogoObuRsiWarningData): TrafficData? { - if (info.warningMsg == null || info.warningMsg.size < 1 || info.warningMsg[0].position == null) { + fun cvxRtiThreatIndInfo2TrafficData(info: ObuScene.RsiWarningData): TrafficData? { + if (info.warningMsgList == null || info.warningMsgList.size < 1 || info.warningMsgList[0].position == null) { CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") return null } val trafficData = TrafficData() trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG - trafficData.uuid = info.warningMsg[0].signSerialNum.toString() - trafficData.lat = info.warningMsg[0].position.latitude - trafficData.lon = info.warningMsg[0].position.longitude - trafficData.threatLevel = info.warningMsg[0].warningLevel + trafficData.uuid = info.warningMsgList[0].signSerialNum.toString() + trafficData.lat = info.warningMsgList[0].position.position.positionLatLon.latitude + trafficData.lon = info.warningMsgList[0].position.position.positionLatLon.longitude + trafficData.threatLevel = info.warningMsgList[0].warningLevel return trafficData } /** * OBU 预警事件 转换交通元素数据 他车预警 */ - fun cvxV2vThreatIndInfo2TrafficData(info: MogoObuRvWarningData): TrafficData? { - if (info == null || info.vehBasicsMsg == null || info.warningMsg == null) { + fun cvxV2vThreatIndInfo2TrafficData(info: ObuScene.RvWarningData): TrafficData? { + if (info?.vehBasicsMsg == null || info.warningMsg == null) { CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") return null } @@ -68,8 +70,8 @@ object TrafficDataConvertUtilsNew { trafficData.heading = info.vehBasicsMsg.heading trafficData.speed = info.vehBasicsMsg.speed // 判断车辆V2X预警级别,调整车辆颜色 - if (info.warningMsg.warningData != null) { - trafficData.threatLevel = info.warningMsg.warningData[0].warningLevel + if (info.warningMsg.warningDataList != null) { + trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel } else { trafficData.threatLevel = 1 } @@ -81,7 +83,7 @@ object TrafficDataConvertUtilsNew { /** * OBU 弱势交通参与者信息 转换交通元素数据 */ - fun cvxPtcThreatIndInfo2TrafficData(info: MogoObuRsmWarningData): TrafficData? { + fun cvxPtcThreatIndInfo2TrafficData(info: ObuScene.RsmWarningData): TrafficData? { if (info.participant == null) { CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") return null @@ -121,8 +123,8 @@ object TrafficDataConvertUtilsNew { } // 判断车辆V2X预警级别,调整车辆颜色 - if (info.warningMsg != null && info.warningMsg.warningData != null) { - trafficData.threatLevel = info.warningMsg.warningData[0].warningLevel + if (info.warningMsg != null && info.warningMsg.warningDataList != null) { + trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel } else { trafficData.threatLevel = 1 } diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle index 39490b0d6c..852be9bd7f 100644 --- a/core/function-impl/mogo-core-function-hmi/build.gradle +++ b/core/function-impl/mogo-core-function-hmi/build.gradle @@ -68,8 +68,7 @@ dependencies { // debugImplementation rootProject.ext.dependencies.debugleakcanary // releaseImplementation rootProject.ext.dependencies.releaseleakcanary - - implementation rootProject.ext.dependencies.mogoobu + implementation project(':libraries:mogo-obu') implementation rootProject.ext.dependencies.arouter kapt rootProject.ext.dependencies.aroutercompiler diff --git a/core/mogo-core-function-api/build.gradle b/core/mogo-core-function-api/build.gradle index bb7c323f18..8672b4a8da 100644 --- a/core/mogo-core-function-api/build.gradle +++ b/core/mogo-core-function-api/build.gradle @@ -47,7 +47,7 @@ dependencies { kapt rootProject.ext.dependencies.aroutercompiler implementation rootProject.ext.dependencies.coroutinescore implementation rootProject.ext.dependencies.coroutinesandroid - implementation rootProject.ext.dependencies.mogoobu + implementation project(':libraries:mogo-obu') if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_data diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuLocationWGS84Listener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuLocationWGS84Listener.kt index c98d8f8982..16c5fd57b3 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuLocationWGS84Listener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuLocationWGS84Listener.kt @@ -11,7 +11,7 @@ interface IMoGoObuLocationWGS84Listener { /** * HV车辆基础信息 - * + s * @param data 数据 * @since 1.0.0 */ diff --git a/core/mogo-core-function-call/build.gradle b/core/mogo-core-function-call/build.gradle index 94acda38e5..13a6502f25 100644 --- a/core/mogo-core-function-call/build.gradle +++ b/core/mogo-core-function-call/build.gradle @@ -50,9 +50,7 @@ dependencies { // MoGo 数据埋点工具 implementation rootProject.ext.dependencies.analytics compileOnly rootProject.ext.dependencies.mogocustommap - - implementation rootProject.ext.dependencies.mogoobu - + implementation project(':libraries:mogo-obu') if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_data