From c9c64774d72a3f0bd78e1488e589340ad8335bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Tue, 10 Aug 2021 20:04:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9V2V=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/obu/mogo/MogoPrivateObuManager.kt | 115 ++++++++++-------- 1 file changed, 61 insertions(+), 54 deletions(-) diff --git a/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/MogoPrivateObuManager.kt b/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/MogoPrivateObuManager.kt index 041b4a67fa..f2731524d5 100644 --- a/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/MogoPrivateObuManager.kt +++ b/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/MogoPrivateObuManager.kt @@ -14,6 +14,7 @@ import com.zhidao.support.obu.MogoObuManager import com.zhidao.support.obu.OnMogoObuListener import com.zhidao.support.obu.constants.ObuConstants import com.zhidao.support.obu.model.* +import com.zhidao.support.obu.model.advance.MovingObjectInfo /** * @description @@ -251,53 +252,34 @@ class MogoPrivateObuManager private constructor() { override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) { Logger.e(MogoObuConst.TAG_MOGO_OBU, "onCvxV2vThreatIndInfo ------> $info") info?.let { - when (info.status) { - // 添加 - ObuConstants.STATUS.ADD -> { - //预警信息,预警类型 threat_level 3 - info.threat_info?.let { - if (info.threat_info.threat_level > 1) { - //预警方位 - val direction = info.ext_info.target_classification - //显示警告红边 - mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection( - getMessageDirection(direction), - "ACTION_V2X_FRONT_WARNING" - ) + //预警信息,预警类型 threat_level 3 + info.threat_info?.let { + if (info.threat_info.threat_level > 1) { + //预警方位 + val direction = info.ext_info.target_classification + //显示警告红边 + mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection( + getMessageDirection(direction), + "ACTION_V2X_FRONT_WARNING" + ) - //处理预警类型 - val appId = info.threat_info.app_id - Logger.d( - MogoObuConst.TAG_MOGO_OBU, - "direction = " + direction + "----" + getMessageDirection( - direction - ) + "--appId = " + appId - ) - handleSdkObu( - appId, - info.threat_info.threat_level, - getMessageDirection(direction), - info.status - ) - // 这里不主动添加元素,原因是onCvxRvInfoIndInfo中会展示周边车,只用修改对应的车辆位置即可 - } - } - } - // 删除 - ObuConstants.STATUS.DELETE -> { - // 移除顶部弹窗 - mIMoGoWaringProvider?.disableWarningV2X(info.vehicle_id) - // 移除地图元素 - mObuRecognizedResultDrawer?.removeCvxRvInfoIndInfo(info.vehicle_id) - } - // 更新 - else -> { - //更新周边车辆进行预警颜色变换,车辆实时移动和变色 - mObuRecognizedResultDrawer?.updateCvxRvInfoIndInfo( - info.threat_info.threat_level, + //处理预警类型 + val appId = info.threat_info.app_id + Logger.d( + MogoObuConst.TAG_MOGO_OBU, + "direction = " + direction + "----" + getMessageDirection( + direction + ) + "--appId = " + appId + ) + handleSdkObu( info.vehicle_id, + appId, + info.threat_info.threat_level, + getMessageDirection(direction), + info.status, info.basic_info ) + // 这里不主动添加元素,原因是onCvxRvInfoIndInfo中会展示周边车,只用修改对应的车辆位置即可 } } } @@ -336,7 +318,14 @@ class MogoPrivateObuManager private constructor() { * * @see com.mogo.module.common.enum.WarningTypeEnum */ - private fun handleSdkObu(useCaseId: Int, level: Int, direction: Int, status: Int) { + private fun handleSdkObu( + vehicleId: String, + useCaseId: Int, + level: Int, + direction: Int, + status: Int, + basicInfo: MovingObjectInfo + ) { var alertContent = "" var ttsContent = "" Log.d(MogoObuConst.TAG_MOGO_OBU, "useCaseId = $ " + useCaseId) @@ -433,16 +422,34 @@ class MogoPrivateObuManager private constructor() { } } - //显示弹框,语音提示 - if (status == ObuConstants.STATUS.ADD) { - mIMoGoWaringProvider!!.showWarningV2X( - useCaseId, - alertContent, - if (level == 3) ttsContent else "", - useCaseId.toString() - ) - } else if (status == ObuConstants.STATUS.DELETE) { - mIMoGoWaringProvider!!.disableWarningV2X(useCaseId.toString()) + + when (status) { + // 添加 + ObuConstants.STATUS.ADD -> { + //显示弹框,语音提示 + mIMoGoWaringProvider!!.showWarningV2X( + useCaseId, + alertContent, + if (level == 3) ttsContent else "", + useCaseId.toString() + ) + } + // 删除 + ObuConstants.STATUS.DELETE -> { + // 移除顶部弹窗 + mIMoGoWaringProvider?.disableWarningV2X(useCaseId.toString()) + // 移除地图元素 + mObuRecognizedResultDrawer?.removeCvxRvInfoIndInfo(vehicleId) + } + // 更新 + else -> { + //更新周边车辆进行预警颜色变换,车辆实时移动和变色 + mObuRecognizedResultDrawer?.updateCvxRvInfoIndInfo( + level, + vehicleId, + basicInfo + ) + } } }