完成道路事件预警信息:CVX_RTI_THREAT_IND
This commit is contained in:
@@ -30,8 +30,10 @@ adb shell am broadcast -a com.obu.test_trigger --ei obuStates 1 --ei obuLevel 3
|
||||
adb shell am broadcast -a com.obu.test_trigger_recognized
|
||||
|
||||
//与Rsu相关
|
||||
//红绿灯 0不可用,1红灯,2绿灯,3黄灯,
|
||||
adb shell am broadcast -a com.obu.test_light_recognized --ei obuStates 1 --ei lightLevel 1 --ei obuLevel 3 --ei obuType 0x2B09
|
||||
// 红绿灯 0不可用,1红灯,2绿灯,3黄灯,
|
||||
adb shell am broadcast -a com.obu.test_light_recognized --ei obuStates 1 --ei lightLevel 1 --ei obuLevel 3 --ei obuType 0x2B09 --ei rtiType 0x2
|
||||
// 道路危险情况预警
|
||||
adb shell am broadcast -a com.obu.test_light_recognized --ei obuStates 1 --ei lightLevel 1 --ei obuLevel 3 --ei obuType 0x2B06 --ei rtiType 0x2
|
||||
|
||||
|
||||
// (旧版本)使用命令行触发各种测试场景演示
|
||||
|
||||
@@ -23,5 +23,7 @@ public class MogoObuConst {
|
||||
public static String BROADCAST_LIGHT_LEVEL_EXTRA_KEY = "lightLevel";
|
||||
//弱势交通 0:未知,1:非机动车,2:行人
|
||||
public static String BROADCAST_PTC_INFO_EXTRA_KEY = "ptcInfo";
|
||||
//道路交通信息类型 0x0--0x17
|
||||
public static String BROADCAST_RTI_TYPE_EXTRA_KEY = "rtiType";
|
||||
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxHvInfoIndInfo ------> $info")
|
||||
}
|
||||
|
||||
// CVX_RV_INFO_IND 远车信息
|
||||
// (3) 远车信息: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,158 +113,120 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
// CVX_RTI_THREAT_IND 道路事件预警信息 车与其他,obu与rsu
|
||||
override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo) {
|
||||
// (3) 道路事件预警信息:CVX_RTI_THREAT_IND
|
||||
override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRtiThreatIndInfo ------> $info")
|
||||
|
||||
var alertContent = ""
|
||||
var ttsContent = ""
|
||||
val appId = info.threat_info.app_id
|
||||
val status = info.status
|
||||
val level = info.threat_info.threat_level
|
||||
when (appId) {
|
||||
// 道路危险情况预警
|
||||
WarningTypeEnum.TYPE_USECASE_ID_HLW.useCaseId,
|
||||
// 车内标牌
|
||||
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 = String.format(
|
||||
WarningTypeEnum.getWarningTts(appId),
|
||||
info.threat_info.distance.toInt()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
when (status) {
|
||||
// 添加
|
||||
ObuConstants.STATUS.ADD -> {
|
||||
//显示警告红边
|
||||
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
|
||||
getOtherObjDirection(if (info.ext_info != null) info.ext_info.pos_classification else 7),
|
||||
"ACTION_V2X_FRONT_WARNING"
|
||||
)
|
||||
//显示弹框,语音提示
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
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 -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CVX_ROAD_TRAFFIC_INFO_IND 道路交通事件信息:十字路口、限速、人行道
|
||||
override fun onCvxRoadTrafficInfoIndInfo(info: CvxRoadTrafficInfoIndInfo?) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRoadTrafficInfoIndInfo ------> $info")
|
||||
info?.let {
|
||||
var appId = 0
|
||||
if (info != null && info.threat_info != null && info.ext_info != null) {
|
||||
var alertContent = ""
|
||||
var ttsContent = ""
|
||||
var appId = info.threat_info.app_id
|
||||
val status = info.status
|
||||
val level = info.threat_info.threat_level
|
||||
val direction =
|
||||
getOtherObjDirection(if (!info.threat_exts.isNullOrEmpty()) info.threat_exts[0].pos_classification else 7)
|
||||
|
||||
when (info.rti_type) {
|
||||
//急转弯
|
||||
0x2 -> {
|
||||
// 特殊处理左、右方向的
|
||||
when (direction) {
|
||||
3 -> {
|
||||
appId = 0x2C02
|
||||
getOtherObjDirection(if (info.ext_info != null) info.ext_info.pos_classification else 7)
|
||||
when (appId) {
|
||||
// 道路危险情况预警
|
||||
WarningTypeEnum.TYPE_USECASE_ID_HLW.useCaseId -> {
|
||||
when (info.ext_info.rti_type) {
|
||||
//急转弯
|
||||
0x2 -> {
|
||||
// 特殊处理左、右方向的
|
||||
when (direction) {
|
||||
3 -> {
|
||||
appId = 0x2C02
|
||||
}
|
||||
4 -> {
|
||||
appId = 0x2C03
|
||||
}
|
||||
}
|
||||
}
|
||||
4 -> {
|
||||
appId = 0x2C03
|
||||
//施工
|
||||
0x7 -> {
|
||||
appId = ObuConstants.USE_CASE_ID.IVS
|
||||
}
|
||||
//限速
|
||||
0xA -> {
|
||||
appId = ObuConstants.USE_CASE_ID.SLW
|
||||
}
|
||||
//事故
|
||||
0xC -> {
|
||||
appId = 0x2C06
|
||||
}
|
||||
//拥堵
|
||||
0xD -> {
|
||||
appId = ObuConstants.USE_CASE_ID.TJW
|
||||
}
|
||||
//行人
|
||||
0xF -> {
|
||||
appId = 0x2C04
|
||||
}
|
||||
//禁止停车
|
||||
0x13 -> {
|
||||
appId = 0x2C10
|
||||
}
|
||||
//学校
|
||||
0x14 -> {
|
||||
appId = 0x2C05
|
||||
}
|
||||
//桥梁
|
||||
0x17 -> {
|
||||
appId = 0x2C09
|
||||
}
|
||||
}
|
||||
alertContent = WarningTypeEnum.getWarningContent(appId)
|
||||
ttsContent = WarningTypeEnum.getWarningTts(appId)
|
||||
}
|
||||
//施工
|
||||
0x7 -> {
|
||||
appId = ObuConstants.USE_CASE_ID.IVS
|
||||
// 车内标牌
|
||||
WarningTypeEnum.TYPE_USECASE_ID_IVS.useCaseId -> {
|
||||
alertContent = WarningTypeEnum.getWarningContent(appId)
|
||||
ttsContent = WarningTypeEnum.getWarningTts(appId)
|
||||
}
|
||||
//限速
|
||||
0xA -> {
|
||||
appId = ObuConstants.USE_CASE_ID.SLW
|
||||
}
|
||||
//事故
|
||||
0xC -> {
|
||||
appId = 0x2C06
|
||||
}
|
||||
//拥堵
|
||||
0xD -> {
|
||||
appId = ObuConstants.USE_CASE_ID.TJW
|
||||
}
|
||||
//行人
|
||||
0xF -> {
|
||||
appId = 0x2C04
|
||||
}
|
||||
//禁止停车
|
||||
0x13 -> {
|
||||
appId = 0x2C10
|
||||
}
|
||||
//学校
|
||||
0x14 -> {
|
||||
appId = 0x2C05
|
||||
}
|
||||
//桥梁
|
||||
0x17 -> {
|
||||
appId = 0x2C09
|
||||
// 前方拥堵提醒
|
||||
WarningTypeEnum.TYPE_USECASE_ID_TJW.useCaseId -> {
|
||||
alertContent = WarningTypeEnum.getWarningContent(appId)
|
||||
ttsContent = String.format(
|
||||
WarningTypeEnum.getWarningTts(appId),
|
||||
info.threat_info.distance.toInt()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// 只处理需要的场景
|
||||
if (appId > 0) {
|
||||
when (info.status) {
|
||||
// 添加
|
||||
ObuConstants.STATUS.ADD -> {
|
||||
//显示警告红边
|
||||
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
|
||||
direction,
|
||||
"ACTION_V2X_FRONT_WARNING"
|
||||
)
|
||||
|
||||
val ttsContent = WarningTypeEnum.getWarningTts(appId)
|
||||
val alertContent = WarningTypeEnum.getWarningContent(appId)
|
||||
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,
|
||||
appId.toString()
|
||||
)
|
||||
when (status) {
|
||||
// 添加
|
||||
ObuConstants.STATUS.ADD -> {
|
||||
//显示警告红边
|
||||
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
|
||||
direction, "ACTION_V2X_FRONT_WARNING"
|
||||
)
|
||||
//显示弹框,语音提示
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
if (level == 3) ttsContent else "",
|
||||
appId.toString()
|
||||
)
|
||||
// 更新数据
|
||||
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
|
||||
TrafficMarkerDrawer.updateITrafficInfo(it)
|
||||
}
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
// 移除顶部弹窗
|
||||
mIMoGoWaringProvider?.disableWarningV2X(appId.toString())
|
||||
}
|
||||
// 更新
|
||||
else -> {
|
||||
}
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
// 移除顶部弹窗
|
||||
mIMoGoWaringProvider?.disableWarningV2X(appId.toString())
|
||||
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(info.rti_id)
|
||||
}
|
||||
// 更新
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 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.ext_info.lights.isNotEmpty()) {
|
||||
@@ -277,7 +239,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
// CVX_MAP_SPAT_INFO_IND 地图红绿灯信息
|
||||
// (6) 地图红绿灯信息:CVX_MAP_SPAT_INFO_IND
|
||||
override fun onCvxMapSpatInfoIndInfo(info: CvxMapSpatInfoIndInfo?) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxMapSpatInfoIndInfo ------> $info")
|
||||
if (info != null && info.ivp_threat_ext != null && info.ivp_threat_ext.lights.isNotEmpty()) {
|
||||
@@ -290,7 +252,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
// 弱势交通参与者信息:CVX_PTC_INFO_IND
|
||||
// (5) 弱势交通参与者信息:CVX_PTC_INFO_IND
|
||||
override fun onCvxPtcInfoIndInfo(info: CvxPtcInfoIndInfo?) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxPtcInfoIndInfo ------> $info")
|
||||
info?.let {
|
||||
@@ -338,7 +300,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
// 限速预警信息
|
||||
// (5) 限速预警信息:CVX_SLW_THREAT_IND
|
||||
override fun onCvxSlwThreatIndInfo(info: CvxSlwThreatIndInfo?) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxSlwThreatIndInfo ------> $info")
|
||||
info?.let {
|
||||
|
||||
@@ -36,6 +36,7 @@ class ObuRsuTestTriggerReceiver : BroadcastReceiver() {
|
||||
val obuLevel = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_LEVEL_EXTRA_KEY, 3)
|
||||
val indicator = intent.getIntExtra(MogoObuConst.BROADCAST_LIGHT_LEVEL_EXTRA_KEY, 0)
|
||||
val pctType = intent.getIntExtra(MogoObuConst.BROADCAST_PTC_INFO_EXTRA_KEY, 0)
|
||||
val rtiType = intent.getIntExtra(MogoObuConst.BROADCAST_RTI_TYPE_EXTRA_KEY, 0)
|
||||
|
||||
Logger.d(
|
||||
TAG, "obuStatus:$obuStatus phase:$indicator obuType:$obuType obuLevel:$obuLevel"
|
||||
@@ -43,7 +44,7 @@ class ObuRsuTestTriggerReceiver : BroadcastReceiver() {
|
||||
|
||||
when (obuType) {
|
||||
ObuConstants.USE_CASE_ID.IVP -> { //构建红绿灯数据
|
||||
var cvxIvpThreatIndInfo = CvxIvpThreatIndInfo(1, 1, 1L)
|
||||
val cvxIvpThreatIndInfo = CvxIvpThreatIndInfo(1, 1, 1L)
|
||||
|
||||
val ivpThreat = IvpThreat(1, obuType, null, 1000, obuLevel, 100)
|
||||
|
||||
@@ -94,8 +95,17 @@ class ObuRsuTestTriggerReceiver : BroadcastReceiver() {
|
||||
val cvxRtiThreatIndInfo = CvxRtiThreatIndInfo(1, 1, 1L)
|
||||
val dateTime = DateTime(1, 1, 1, 1, 1, 1, 1, 1)
|
||||
val rtiThread = RtiThreat(1, obuType, dateTime, 100000, obuLevel, 100)
|
||||
val extInfo = RtiThreatExt(1, rtiType, 0x02, 100000, 100000)
|
||||
val position = Position(1, 399739429, 1164115207, 20)
|
||||
|
||||
// 位置围栏
|
||||
val zonesInfo = listOf(
|
||||
ZoneInfo(1, 2000, 2000, listOf(position))
|
||||
)
|
||||
|
||||
cvxRtiThreatIndInfo.zones_info = zonesInfo
|
||||
cvxRtiThreatIndInfo.threat_info = rtiThread
|
||||
cvxRtiThreatIndInfo.ext_info = extInfo
|
||||
cvxRtiThreatIndInfo.status = obuStatus
|
||||
|
||||
MogoPrivateObuManager.INSTANCE.getMogoObuListener()
|
||||
|
||||
@@ -39,7 +39,7 @@ object TrafficDataConvertUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* OBU 道路事件预警信息 转换交通元素数据
|
||||
* OBU RSU道路事件预警信息 转换交通元素数据
|
||||
*/
|
||||
fun cvxRtiThreatIndInfo2TrafficData(info: CvxRtiThreatIndInfo): TrafficData? {
|
||||
// 这里只处理道路施工
|
||||
|
||||
Reference in New Issue
Block a user