优化 CVX_RTI_THREAT_IND 道路事件预警信息 逻辑

This commit is contained in:
董宏宇
2021-08-18 17:53:50 +08:00
parent c73b5720de
commit d61988f87c
4 changed files with 54 additions and 18 deletions

View File

@@ -61,7 +61,12 @@ enum class TrafficTypeEnum(
"特殊车辆",
R.raw.special_vehicle,
R.raw.special_vehicle
),
TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG(
12,
"道路施工",
R.raw.v2x_daolushigong,
R.raw.v2x_daolushigong
)
}

View File

@@ -97,13 +97,13 @@ class MogoPrivateObuManager private constructor() {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxHvCarIndInfo ------> $info")
}
// 主车信息
// CVX_HV_INFO_IND 主车信息
override fun onCvxHvInfoIndInfo(info: CvxHvInfoIndInfo) {
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", true) }
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxHvInfoIndInfo ------> $info")
}
// 远车信息
// CVX_RV_INFO_IND 远车信息
override fun onCvxRvInfoIndInfo(info: CvxRvInfoIndInfo) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRvInfoIndInfo ------> $info")
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", true) }
@@ -113,7 +113,7 @@ class MogoPrivateObuManager private constructor() {
}
}
// 道路事件预警信息:CVX_RTI_THREAT_IND 车与其他obu与rsu
// CVX_RTI_THREAT_IND 道路事件预警信息 车与其他obu与rsu
override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRtiThreatIndInfo ------> $info")
@@ -129,12 +129,14 @@ class MogoPrivateObuManager private constructor() {
WarningTypeEnum.TYPE_USECASE_ID_IVS.useCaseId -> {
alertContent = WarningTypeEnum.getWarningContent(appId)
ttsContent = WarningTypeEnum.getWarningTts(appId)
}
// 前方拥堵提醒
WarningTypeEnum.TYPE_USECASE_ID_TJW.useCaseId -> {
alertContent = WarningTypeEnum.getWarningContent(appId)
ttsContent = WarningTypeEnum.getWarningTts(appId)
ttsContent = String.format(
WarningTypeEnum.getWarningTts(appId),
info.threat_info.distance.toInt()
)
}
}
@@ -153,11 +155,16 @@ class MogoPrivateObuManager private constructor() {
if (level == 3) ttsContent else "",
appId.toString()
)
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
TrafficMarkerDrawer.updateITrafficInfo(it)
}
}
// 删除
ObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗
mIMoGoWaringProvider?.disableWarningV2X(appId.toString())
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(info.rti_id)
}
// 更新
else -> {
@@ -166,13 +173,13 @@ class MogoPrivateObuManager private constructor() {
}
}
// 道路交通事件信息:十字路口、限速、
// CVX_ROAD_TRAFFIC_INFO_IND 道路交通事件信息:十字路口、限速、人行道
override fun onCvxRoadTrafficInfoIndInfo(info: CvxRoadTrafficInfoIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRoadTrafficInfoIndInfo ------> $info")
}
// 红绿灯
// CVX_IVP_THREAT_IND 红绿灯
override fun onCvxIvpThreatIndInfo(info: CvxIvpThreatIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "CvxIvpThreatIndInfo ------> $info")
info?.let {
@@ -180,11 +187,15 @@ class MogoPrivateObuManager private constructor() {
}
}
// 地图红绿灯信息
// CVX_MAP_SPAT_INFO_IND 地图红绿灯信息
override fun onCvxMapSpatInfoIndInfo(info: CvxMapSpatInfoIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxMapSpatInfoIndInfo ------> $info")
info?.let {
handlerTrafficLight(info.status, info.ivp_threat_ext.lights, info.ivp_threat_info.app_id)
handlerTrafficLight(
info.status,
info.ivp_threat_ext.lights,
info.ivp_threat_info.app_id
)
}
}
@@ -316,10 +327,10 @@ class MogoPrivateObuManager private constructor() {
ttsContent = WarningTypeEnum.getWarningTts(appId)
alertContent = WarningTypeEnum.getWarningContent(appId)
mIMoGoWaringProvider!!.showWarningV2X(
appId,
alertContent,
ttsContent,
appId.toString()
appId,
alertContent,
ttsContent,
appId.toString()
)
}
// 绿灯
@@ -423,7 +434,7 @@ class MogoPrivateObuManager private constructor() {
// 前方拥堵提醒,前方XXX米道路拥堵请减速慢行 TODO
WarningTypeEnum.TYPE_USECASE_ID_TJW.useCaseId -> {
ttsContent = WarningTypeEnum.getWarningTts(appId)
// ttsContent = String.format(ttsContent, "")
ttsContent = String.format(ttsContent, "")
alertContent = WarningTypeEnum.getWarningContent(appId)
}

View File

@@ -71,9 +71,6 @@ class ObuRsuTestTriggerReceiver : BroadcastReceiver() {
ObuConstants.USE_CASE_ID.VRUCW -> {
}
}
}

View File

@@ -2,8 +2,10 @@ package com.mogo.module.obu.mogo.utils
import com.mogo.module.common.drawer.bean.TrafficData
import com.mogo.module.common.enums.TrafficTypeEnum
import com.mogo.module.common.enums.WarningTypeEnum
import com.zhidao.support.obu.constants.ObuConstants
import com.zhidao.support.obu.model.CvxPtcInfoIndInfo
import com.zhidao.support.obu.model.CvxRtiThreatIndInfo
import com.zhidao.support.obu.model.CvxRvInfoIndInfo
import com.zhidao.support.obu.model.CvxV2vThreatIndInfo
@@ -36,6 +38,27 @@ object TrafficDataConvertUtils {
return trafficData
}
/**
* OBU 道路事件预警信息 转换交通元素数据
*/
fun cvxRtiThreatIndInfo2TrafficData(info: CvxRtiThreatIndInfo): TrafficData? {
// 这里只处理道路施工
if (info.threat_info.app_id != WarningTypeEnum.TYPE_USECASE_ID_IVS.useCaseId ||
info.zones_info == null || info.zones_info.first() == null
|| info.zones_info.first().path_points.first() == null
) {
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG
trafficData.uuid = info.rti_id
trafficData.lat = info.zones_info.first().path_points.first().latitude
trafficData.lon = info.zones_info.first().path_points.first().longitude
return trafficData
}
/**
* OBU 预警事件 转换交通元素数据
*/