左侧辅助
闯红灯预警

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-09-27 14:52:00 +08:00
parent 85127667c2
commit d3c680feff
3 changed files with 33 additions and 26 deletions

View File

@@ -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<Light>,
@@ -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, "")
}
}
//异常车辆提醒