From d3c680feff7a755ea8a1506b6e89322a4417b7d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Mon, 27 Sep 2021 14:52:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E8=BE=85=E5=8A=A9=20=E9=97=AF=E7=BA=A2=E7=81=AF=E9=A2=84?= =?UTF-8?q?=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 董宏宇 --- .../core/function/hmi/ui/MoGoHmiFragment.kt | 1 + .../obu/mogo/MogoPrivateObuManager.kt | 56 ++++++++++--------- .../mogo/module/common/enums/EventTypeEnum.kt | 2 +- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 098ff1099c..a142edc84e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -49,6 +49,7 @@ class MoGoHmiFragment : MvpFragment * @param ttsContent tts语音播报消息 * @param tag tag绑定弹窗的标志 */ + @Synchronized override fun showWarningV2X( v2xType: Int, alertContent: String?, 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 a7e7b5d483..94cc956107 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 @@ -282,10 +282,14 @@ class MogoPrivateObuManager private constructor() { } - // (4) V2I预警信息:CVX_IVP_THREAT_IND + // (4) V2I预警信息:CVX_IVP_THREAT_IND,红绿灯 override fun onCvxIvpThreatIndInfo(info: CvxIvpThreatIndInfo?) { Logger.d(MogoObuConst.TAG_MOGO_OBU, "CvxIvpThreatIndInfo ------> $info") - if (info != null && info.ext_info != null && info.threat_info != null && info.ext_info.lights != null && info.ext_info.lights.isNotEmpty()) { + if (info != null && info.ext_info != null + && info.threat_info != null + && info.ext_info.lights != null + && info.ext_info.lights.isNotEmpty() + ) { handlerTrafficLight( info.threat_info.app_id, info.status, @@ -487,6 +491,7 @@ class MogoPrivateObuManager private constructor() { /** * 修改红绿灯 */ + @Synchronized private fun changeTrafficLightStatus( appId: Int, lights: List, @@ -499,8 +504,30 @@ class MogoPrivateObuManager private constructor() { val currentLight = lights[index] Logger.d( MogoObuConst.TAG_MOGO_OBU, - "currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} --- index = $index ---appId = $appId" + "currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} ---rlvw_violation_type = ${currentLight.rlvw_violation_type} --- index = $index ---appId = $appId ---appId = $appId" ) + // 闯红灯预警 + when (currentLight.rlvw_violation_type) { + 0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE + } + 0x1 -> {//无违规 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION + CallerHmiManager.disableWarningV2X(appId.toString()) + } + 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT + ttsContent = EventTypeEnum.getWarningTts(appId.toString()) + alertContent = EventTypeEnum.getWarningContent(appId.toString()) + CallerHmiManager.showWarningV2X( + appId, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + appId.toString(), + null + ) + } + 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT + } + } + when (currentLight.phase) { // 灯光不可用 0x0 -> { @@ -514,20 +541,12 @@ class MogoPrivateObuManager private constructor() { } isGreenLight = false CallerHmiManager.showWarningTrafficLight(1) + val red = currentLight.count_down.toInt() CallerHmiManager.changeCountdownRed(red) - ttsContent = EventTypeEnum.getWarningTts(appId.toString()) - alertContent = EventTypeEnum.getWarningContent(appId.toString()) CallerHmiManager.changeCountdownGreen(0) CallerHmiManager.changeCountdownYellow(0) - CallerHmiManager.showWarningV2X( - appId, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), - null - ) } // 绿灯 0x2 -> { @@ -647,19 +666,6 @@ class MogoPrivateObuManager private constructor() { EventTypeEnum.TYPE_USECASE_ID_LTA.poiType -> { alertContent = EventTypeEnum.getWarningContent(appId.toString()) ttsContent = EventTypeEnum.getWarningTts(appId.toString()) - if ( - direction == WarningDirectionEnum.ALERT_WARNING_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT - ) { - ttsContent = String.format(ttsContent, "左") - } else if ( - direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT - ) { - ttsContent = String.format(ttsContent, "右") - } } //异常车辆提醒 diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt index 1a89110efa..8fe7e747ca 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt @@ -209,7 +209,7 @@ enum class EventTypeEnum( "左转辅助", poiTypeSrcVr=R.drawable.icon_warning_v2x_collision_warning, content="左转碰撞预警", - tts="注意%s后车辆" + tts="注意路口对向来车" ), TYPE_USECASE_ID_HLW( ObuConstants.USE_CASE_ID.HLW.toString(),