diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt index 0a3be5cb96..058d3ec7ad 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt @@ -4,24 +4,19 @@ import android.content.Context import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig.isShowObuLimitSpeedView -import com.mogo.eagle.core.data.enums.EventTypeEnumNew -import com.mogo.eagle.core.data.enums.EventTypeEnumWeaknessTraffic -import com.mogo.eagle.core.data.enums.V2iEventTypeEnum -import com.mogo.eagle.core.data.enums.WarningDirectionEnum +import com.mogo.eagle.core.data.enums.* 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 -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showLimitingVelocity 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.call.v2x.CallLimitingVelocityListenerManager.invokeOnLimitingVelocityChange import com.mogo.eagle.core.function.obu.mogo.MogoObuConst.TAG_MOGO_OBU import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtilsNew import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger @@ -577,7 +572,7 @@ class MogoPrivateObuNewManager private constructor() { } /** - * 地图匹配 是OBU算法输出地图匹配结果,主车匹配道路哪条路或者哪条车道 TODO + * 地图匹配 是OBU算法输出地图匹配结果,主车匹配道路哪条路或者哪条车道 */ override fun onMogoObuMapMath(data: MogoObuMapMathData?) { super.onMogoObuMapMath(data) @@ -615,7 +610,7 @@ class MogoPrivateObuNewManager private constructor() { * 获取消息的方位 车辆相关 */ private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum { - // CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "预警红边:预警方向->$targetClassification") +// CallerLogger.d("$M_OBU${TAG_MOGO_OBU}", "预警红边:预警方向->$targetClassification") return when (targetClassification) { MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方 @@ -844,75 +839,68 @@ class MogoPrivateObuNewManager private constructor() { //这里需要根据真实数据确定 index 取值方式 val currentLight = lights[0] CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "$M_OBU${TAG_MOGO_OBU}", "currentLight = $currentLight ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId" ) - // 闯红灯预警 + // 闯红灯预警,绿波通行和闯红灯是互斥的 when (appId) { 0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效 } 0x1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT TODO 需要约束一个红灯周期只显示一次 - // CallerHmiManager.disableWarningV2X(appId.toString()) -// CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}","changeTrafficLightStatus 闯红灯 --------> ") - // ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) - // alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) - // CallerHmiManager.warningV2X( - // appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - // appId.toString(), null, true, 5000L, MsgBoxType.OBU - // ) +// CallerHmiManager.disableWarningV2X(0x2.toString()) +// CallerLogger.d("$M_OBU${TAG_MOGO_OBU}","changeTrafficLightStatus 闯红灯 --------> ") +// ttsContent = EventTypeEnumTrafficLight.getWarningTts(appId.toString()) +// alertContent = EventTypeEnumTrafficLight.getWarningContent(appId.toString()) +// CallerHmiManager.warningV2X( +// appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 +// appId.toString(), null, true, 5000L) } - 0x2 -> {//绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION TODO 需要约束一个绿灯周期只显示一次 - ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) - alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg( - appId.toString(), - alertContent, - ttsContent - ) - ) - ) - CallerHmiManager.warningV2X( - appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 3000L - ) - - // 拼接建议速度 - // CallerLogger.d( - // "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - // "绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}" - // ) - // val adviceSpeed = - // "${currentLight.suggestMinSpeed*3.6} - ${currentLight.suggestMaxSpeed*3.6}" - // val adviceSpeedTts = - // "${currentLight.suggestMinSpeed*3.6}到${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*3.6 - // if (maxSpeed > 0) { - // CallerHmiManager.warningV2X( - // EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, - // alertContent, - // ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - // appId.toString(), - // null, - // true, - // 5000L, - // MsgBoxType.OBU - // ) - // } + 0x2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION TODO 需要约束一个绿灯周期只显示一次 +// CallerHmiManager.disableWarningV2X(0x1.toString()) +// CallerLogger.d( +// "$M_OBU${TAG_MOGO_OBU}", +// "speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}" +// ) +// val adviceSpeed = +// "${currentLight.suggestMinSpeed} - ${currentLight.suggestMaxSpeed}" +// val adviceSpeedTts = +// "${currentLight.suggestMinSpeed}到${currentLight.suggestMaxSpeed}" +// ttsContent = +// String.format( +// EventTypeEnumTrafficLight.getWarningTts(appId.toString()), +// adviceSpeedTts +// ) +// alertContent = +// String.format( +// EventTypeEnumTrafficLight.getWarningContent(appId.toString()), +// adviceSpeed +// ) +// +// val maxSpeed = currentLight.suggestMaxSpeed +// if (maxSpeed > 0) { +// CallerMsgBoxManager.saveMsgBox( +// MsgBoxBean( +// MsgBoxType.OBU, +// V2XMsg( +// EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, +// alertContent, +// ttsContent +// ) +// ) +// ) +// +// CallerHmiManager.warningV2X( +// EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, +// alertContent, +// ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 +// appId.toString(), +// null, +// true, +// 5000L +// ) +// } } } @@ -933,6 +921,7 @@ class MogoPrivateObuNewManager private constructor() { val red = currentLight.countDown.toInt() CallerHmiManager.changeCountdownRed(red) } + // 绿灯 4, 5, 6 -> { if (!isGreenLight) { @@ -943,52 +932,8 @@ class MogoPrivateObuNewManager private constructor() { CallerHmiManager.showWarningTrafficLight(3, 2) val green = currentLight.countDown.toInt() CallerHmiManager.changeCountdownGreen(green) - //防止数据出现问题的容错 - CallerHmiManager.changeCountdownRed(0) - CallerHmiManager.changeCountdownYellow(0) - // 拼接建议速度 - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}" - ) - val adviceSpeed = - "${currentLight.suggestMinSpeed} - ${currentLight.suggestMaxSpeed}" - val adviceSpeedTts = - "${currentLight.suggestMinSpeed}到${currentLight.suggestMaxSpeed}" - 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.OBU, - V2XMsg( - EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, - alertContent, - ttsContent - ) - ) - ) - CallerHmiManager.warningV2X( - EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), - null, - true, - 3000L - ) - } } + // 黄灯 7, 8 -> { CallerHmiManager.disableWarningV2X(appId.toString()) diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumTrafficLight.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumTrafficLight.kt new file mode 100644 index 0000000000..4b3af24b5d --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumTrafficLight.kt @@ -0,0 +1,71 @@ +package com.mogo.eagle.core.data.enums + +import com.mogo.eagle.core.data.R + + +/** + * 交通信号灯 + */ +enum class EventTypeEnumTrafficLight( + val poiType: String, val poiTypeStr: String = "", + val poiTypeStrVr: String = "", + val poiTypeSrcVr: Int = R.drawable.v2x_icon_live_logo, + val content: String = "", val tts: String = "" +) { + + TYPE_USECASE_ID_IVP_RED( + 0x1.toString(), + "闯红灯预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_red, + content = "路口红灯,禁止通行", + tts = "路口红灯,禁止通行" + ), + TYPE_USECASE_ID_IVP_GREEN( + 0x2.toString(), + "绿波通行", + poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_green, + content = "建议车速 %s KM/H", + tts = "建议车速 %s KM/H" + ), + + TYPE_ERROR( + 0.toString(), + "未知/错误/异常", + poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle, + content = "", + tts = "" + ); + + + companion object { + @JvmStatic + fun getWarningIcon(poiType: String?): Int { + return when (poiType) { + TYPE_USECASE_ID_IVP_RED.poiType -> TYPE_USECASE_ID_IVP_RED.poiTypeSrcVr + TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.poiTypeSrcVr + + else -> TYPE_ERROR.poiTypeSrcVr + } + } + + @JvmStatic + fun getWarningContent(poiType: String?): String { + return when (poiType) { + TYPE_USECASE_ID_IVP_RED.poiType -> TYPE_USECASE_ID_IVP_RED.content + TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.content + + else -> TYPE_ERROR.content + } + } + + @JvmStatic + fun getWarningTts(poiType: String?): String { + return when (poiType) { + TYPE_USECASE_ID_IVP_RED.poiType -> TYPE_USECASE_ID_IVP_RED.tts + TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.tts + else -> TYPE_ERROR.tts + } + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumWeaknessTraffic.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumWeaknessTraffic.kt index 177160dbb9..8ca4806dc1 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumWeaknessTraffic.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumWeaknessTraffic.kt @@ -20,10 +20,10 @@ enum class EventTypeEnumWeaknessTraffic( content = "注意机动车", tts = "注意机动车" ), - TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES( //TODO 图标需要换 + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES( 2.toString(), "弱势交通参与者碰撞预警", - poiTypeSrcVr = R.drawable.icon_warning_v2x_motorcycle_collision, + poiTypeSrcVr = R.drawable.icon_warning_v2x_motobike, content = "注意非机动车", tts = "注意非机动车" ), diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable-xhdpi/icon_warning_v2x_motobike.png b/core/mogo-core-res/src/main/function-hmi-res/drawable-xhdpi/icon_warning_v2x_motobike.png new file mode 100644 index 0000000000..1ae7992c08 Binary files /dev/null and b/core/mogo-core-res/src/main/function-hmi-res/drawable-xhdpi/icon_warning_v2x_motobike.png differ