[2.13.0] 添加obu v2i和v2n的开关

This commit is contained in:
lixiaopeng
2022-12-12 15:25:34 +08:00
parent 990cff2390
commit 5011ffa22b
5 changed files with 679 additions and 616 deletions

View File

@@ -95,11 +95,32 @@ class SOPSettingView @JvmOverloads constructor(
} }
} }
/**
* 限速数据来源开关
*/
tbRoadLimitSpeedSop.setOnCheckedChangeListener { _, isChecked -> tbRoadLimitSpeedSop.setOnCheckedChangeListener { _, isChecked ->
//默认关闭 //默认关闭
HmiBuildConfig.isShowObuLimitSpeedView = isChecked HmiBuildConfig.isShowObuLimitSpeedView = isChecked
} }
/**
* obu V2V开关
*/
tbObuV2vView.setOnCheckedChangeListener { _, isChecked ->
//默认关闭
HmiBuildConfig.isShowObuV2vView = isChecked
Log.d("liyz", "v2v isChecked = $isChecked")
}
/**
* obu V2i开关
*/
tbObuV2iView.setOnCheckedChangeListener { _, isChecked ->
//默认关闭
HmiBuildConfig.isShowObuV2iView = isChecked
Log.d("liyz", "viv isChecked = $isChecked")
}
//红绿灯标识 //红绿灯标识
tbTrafficLight.isChecked = HmiBuildConfig.isShowTrafficLightView tbTrafficLight.isChecked = HmiBuildConfig.isShowTrafficLightView
tbTrafficLight.setOnCheckedChangeListener { _, isChecked -> tbTrafficLight.setOnCheckedChangeListener { _, isChecked ->

View File

@@ -129,6 +129,30 @@
app:layout_constraintTop_toBottomOf="@id/tbRainMode" app:layout_constraintTop_toBottomOf="@id/tbRainMode"
/> />
<ToggleButton
android:id="@+id/tbObuV2vView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_20"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="展示v2v事件"
android:textOn="不展示v2v事件"
app:layout_constraintTop_toBottomOf="@id/tbObu"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbObuV2iView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_20"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="展示v2i事件"
android:textOn="不展示v2i事件"
app:layout_constraintTop_toBottomOf="@id/tbObuV2vView"
android:textSize="@dimen/dp_24" />
<ToggleButton <ToggleButton
android:id="@+id/tbObuWeaknessTrafficSop" android:id="@+id/tbObuWeaknessTrafficSop"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -136,7 +160,7 @@
android:layout_margin="@dimen/dp_10" android:layout_margin="@dimen/dp_10"
android:padding="@dimen/dp_20" android:padding="@dimen/dp_20"
android:background="@drawable/radio_button_normal_background_right" android:background="@drawable/radio_button_normal_background_right"
app:layout_constraintTop_toBottomOf="@id/tbObu" app:layout_constraintTop_toBottomOf="@id/tbObuV2iView"
android:textOff="关闭路侧弱势群体预警" android:textOff="关闭路侧弱势群体预警"
android:textOn="打开路侧弱势群体预警" android:textOn="打开路侧弱势群体预警"
android:textSize="@dimen/dp_24" /> android:textSize="@dimen/dp_24" />

View File

@@ -7,6 +7,7 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.voice.AIAssist import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.enums.WarningDirectionEnum import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
@@ -232,201 +233,203 @@ class MogoPrivateObuManager private constructor() {
// (3) 道路事件预警信息CVX_RTI_THREAT_IND // (3) 道路事件预警信息CVX_RTI_THREAT_IND
override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) { override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) {
CallerLogger.d( if (HmiBuildConfig.isShowObuV2iView) {
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}", CallerLogger.d(
"onCvxRtiThreatIndInfo ------> $info" "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
) "onCvxRtiThreatIndInfo ------> $info"
)
if (info != null && info.threat_info != null && info.ext_info != null) { if (info != null && info.threat_info != null && info.ext_info != null) {
var alertContent = "" var alertContent = ""
var ttsContent = "" var ttsContent = ""
var appId = info.threat_info.app_id.toString() var appId = info.threat_info.app_id.toString()
val status = info.status val status = info.status
val level = info.threat_info.threat_level val level = info.threat_info.threat_level
val direction = val direction =
getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1) getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1)
CallerLogger.d( CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}" "onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}"
) )
CallerLogger.d( CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type} --direction = $direction -- pos_classification = ${info.ext_info.pos_classification} " "onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type} --direction = $direction -- pos_classification = ${info.ext_info.pos_classification} "
) )
when (appId) { when (appId) {
// 道路危险情况预警 // 道路危险情况预警
EventTypeEnum.TYPE_USECASE_ID_HLW.poiType, EventTypeEnum.TYPE_USECASE_ID_HLW.poiType,
EventTypeEnum.TYPE_USECASE_ID_IVS.poiType EventTypeEnum.TYPE_USECASE_ID_IVS.poiType
-> { -> {
when (info.ext_info.rti_type) { when (info.ext_info.rti_type) {
//急转弯 //急转弯
0x2 -> { 0x2 -> {
// 特殊处理左、右方向的 // 特殊处理左、右方向的
when (direction) { when (direction) {
WarningDirectionEnum.ALERT_WARNING_LEFT, WarningDirectionEnum.ALERT_WARNING_LEFT,
WarningDirectionEnum.ALERT_WARNING_TOP_LEFT, WarningDirectionEnum.ALERT_WARNING_TOP_LEFT,
WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> { WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> {
appId = appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType
} }
WarningDirectionEnum.ALERT_WARNING_RIGHT, WarningDirectionEnum.ALERT_WARNING_RIGHT,
WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT, WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT,
WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> { WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> {
appId = appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType
}
} }
} }
//施工
0x7 -> {
appId = EventTypeEnum.FOURS_ROAD_WORK.poiType
}
//限速
0xA -> {
appId = EventTypeEnum.TYPE_USECASE_ID_SLW.poiType
}
//事故
0xC -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType
}
//拥堵
0xD -> {
appId = EventTypeEnum.TYPE_USECASE_ID_TJW.poiType
}
//行人
0xF -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
}
//禁止停车
0x13 -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType
}
//学校
0x14 -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
}
//桥梁
0x17 -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType
}
//轻轨电车
0x18 -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_TRAMCAR.poiType
}
//人行横道
0x19 -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
}
//减速慢行
0x1A -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType
}
//事故易发路段
0x1B -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType
}
//环岛行驶
0x1C -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType
}
//环岛行驶
0x1D -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType
}
//驼峰桥
0x1E -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType
}
} }
//施工 alertContent = EventTypeEnum.getWarningContent(appId)
0x7 -> { ttsContent = EventTypeEnum.getWarningTts(appId)
appId = EventTypeEnum.FOURS_ROAD_WORK.poiType
}
//限速
0xA -> {
appId = EventTypeEnum.TYPE_USECASE_ID_SLW.poiType
}
//事故
0xC -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType
}
//拥堵
0xD -> {
appId = EventTypeEnum.TYPE_USECASE_ID_TJW.poiType
}
//行人
0xF -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
}
//禁止停车
0x13 -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType
}
//学校
0x14 -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
}
//桥梁
0x17 -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType
}
//轻轨电车
0x18 -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_TRAMCAR.poiType
}
//人行横道
0x19 -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
}
//减速慢行
0x1A -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType
}
//事故易发路段
0x1B -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType
}
//环岛行驶
0x1C -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType
}
//环岛行驶
0x1D -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType
}
//驼峰桥
0x1E -> {
appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType
}
} }
alertContent = EventTypeEnum.getWarningContent(appId) // 前方拥堵提醒
ttsContent = EventTypeEnum.getWarningTts(appId) EventTypeEnum.TYPE_USECASE_ID_TJW.poiType -> {
} ttsContent = EventTypeEnum.getWarningTts(appId)
// 前方拥堵提醒 if (info.threat_info != null) {
EventTypeEnum.TYPE_USECASE_ID_TJW.poiType -> { CallerLogger.d(
ttsContent = EventTypeEnum.getWarningTts(appId) "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
if (info.threat_info != null) { "ttsContent = $ttsContent --alertContent = $alertContent ---info.threat_info.distance = ${info.threat_info.distance} "
)
if (info.threat_info.distance.toInt() != 0) {
alertContent = String.format(
EventTypeEnum.getWarningContent(appId),
info.threat_info.distance.toInt()
)
} else {
alertContent = "前方拥堵,减速慢行"
}
}
CallerLogger.d( CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"ttsContent = $ttsContent --alertContent = $alertContent ---info.threat_info.distance = ${info.threat_info.distance} " "ttsContent = $ttsContent --alertContent = $alertContent"
) )
if (info.threat_info.distance.toInt() != 0) { }
alertContent = String.format( }
EventTypeEnum.getWarningContent(appId),
info.threat_info.distance.toInt() when (status) {
// 添加
ObuConstants.STATUS.ADD -> {
//不显示弹框,其它保留
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxRtiThreatIndInfo ------> appId = $appId --- alertContent = $alertContent --- ttsContent = $ttsContent ")
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-PriObuManager4", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OBU,
V2XMsg(appId,
alertContent,
ttsContent)
) )
} else { )
alertContent = "前方拥堵,减速慢行" CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
)
}
ObuConstants.STATUS.UPDATE -> {
//显示警告红边 TODO 需要确定是什么值
// CallerHmiManager.showWarning(direction)
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.invokeTrackerWarningInfo(it)
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
} }
} }
CallerLogger.d( // 删除
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}", ObuConstants.STATUS.DELETE -> {
"ttsContent = $ttsContent --alertContent = $alertContent" // 关闭警告红边
) CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
} // 移除顶部弹窗
}
when (status) {
// 添加
ObuConstants.STATUS.ADD -> {
//不显示弹框,其它保留
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxRtiThreatIndInfo ------> appId = $appId --- alertContent = $alertContent --- ttsContent = $ttsContent ")
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-PriObuManager4", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OBU,
V2XMsg(appId,
alertContent,
ttsContent)
)
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
)
}
ObuConstants.STATUS.UPDATE -> {
//显示警告红边 TODO 需要确定是什么值
// CallerHmiManager.showWarning(direction)
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.invokeTrackerWarningInfo(it)
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
// 删除
ObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
// CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) // CallerHmiManager.disableWarningV2X((appId + direction.direction).toString())
// 更新数据 // 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.removeTrackerWarningInfo(it) CallerObuListenerManager.removeTrackerWarningInfo(it)
// 事件结束,还原车辆颜色 // 事件结束,还原车辆颜色
it.threatLevel = 0x01 it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService() CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it) ?.updateITrafficThreatLevelInfo(it)
}
} }
} }
} }
@@ -445,37 +448,27 @@ class MogoPrivateObuManager private constructor() {
&& info.ext_info.lights != null && info.ext_info.lights != null
&& info.ext_info.lights.isNotEmpty() && info.ext_info.lights.isNotEmpty()
) { ) {
//v2i数据传输延迟 if (HmiBuildConfig.isShowObuV2iView) {
// val hvMillTime = info.threat_info.hv_time.millisecond handlerTrafficLight(
// val hvSecondMillTime = (info.threat_info.hv_time.second) * 1000 info.threat_info.app_id,
// val hvTime = hvMillTime + hvSecondMillTime info.status,
// val currentTime = TimeUtils.getNowMills() % 60000 info.ext_info.lights,
// val delayTime = currentTime - hvTime info.ext_info.index
)
// CallerObuListenerManager.invokeDelayTime(delayTime) }
// CallerLogger.e(
// "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
// "onCvxIvpThreatIndInfo red ---delayTime---> $delayTime"
// )
handlerTrafficLight(
info.threat_info.app_id,
info.status,
info.ext_info.lights,
info.ext_info.index
)
} }
} }
// (2) 弱势交通参与者预警信息CVX_PTC_THREAT_IND // (2) 弱势交通参与者预警信息CVX_PTC_THREAT_IND
override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) { override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) {
CallerLogger.d( if (HmiBuildConfig.isShowObuV2iView) {
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}", CallerLogger.d(
"onCvxPtcInfoIndInfo ------> $info" "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
) "onCvxPtcInfoIndInfo ------> $info"
// 交通参与者类型 0x0:未知 UNKNOWN | 0x1:非机动车 NON_MOTOR | 0x2:行人 PEDESTRIAN 0x3:RSU )
if (info != null && (info.ptc_type == 1 || info.ptc_type == 2)) { // 交通参与者类型 0x0:未知 UNKNOWN | 0x1:非机动车 NON_MOTOR | 0x2:行人 PEDESTRIAN 0x3:RSU
//v2i数据传输延迟 if (info != null && (info.ptc_type == 1 || info.ptc_type == 2)) {
//v2i数据传输延迟
// val hvMillTime = info.threat_info.hv_time.millisecond // val hvMillTime = info.threat_info.hv_time.millisecond
// val hvSecondMillTime = (info.threat_info.hv_time.second) * 1000 // val hvSecondMillTime = (info.threat_info.hv_time.second) * 1000
// val hvTime = hvMillTime + hvSecondMillTime // val hvTime = hvMillTime + hvSecondMillTime
@@ -488,85 +481,85 @@ class MogoPrivateObuManager private constructor() {
// "onCvxPtcInfoIndInfo ---delayTime---> $delayTime" // "onCvxPtcInfoIndInfo ---delayTime---> $delayTime"
// ) // )
CallerLogger.d( CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxPtcInfoIndInfo ---status---> ${info.status}" "onCvxPtcInfoIndInfo ---status---> ${info.status}"
) )
var v2xType = "" var v2xType = ""
if (info.ptc_type == 1) { //摩托车 if (info.ptc_type == 1) { //摩托车
v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType
} else if (info.ptc_type == 2) { //行人 } else if (info.ptc_type == 2) { //行人
v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} }
val ttsContent = EventTypeEnum.getWarningTts(v2xType) val ttsContent = EventTypeEnum.getWarningTts(v2xType)
val alertContent = EventTypeEnum.getWarningContent(v2xType) val alertContent = EventTypeEnum.getWarningContent(v2xType)
val direction = val direction =
getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1) getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1)
val level = if (info.threat_info != null) info.threat_info.threat_level else -1 val level = if (info.threat_info != null) info.threat_info.threat_level else -1
when (info.status) { when (info.status) {
// 添加 // 添加
ObuConstants.STATUS.ADD -> { ObuConstants.STATUS.ADD -> {
// if (level == 2 || level == 3) { //不考虑level // if (level == 2 || level == 3) { //不考虑level
//显示警告红边 //显示警告红边
CallerHmiManager.showWarning(direction) CallerHmiManager.showWarning(direction)
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxPtcThreatIndInfo ------> v2xType = $v2xType --- alertContent = $alertContent --- ttsContent = $ttsContent ") CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxPtcThreatIndInfo ------> v2xType = $v2xType --- alertContent = $alertContent --- ttsContent = $ttsContent ")
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-PriObuManager5", "alertContent或ttsContent为空!") Log.d("MsgBox-PriObuManager5", "alertContent或ttsContent为空!")
} }
CallerMsgBoxManager.saveMsgBox( CallerMsgBoxManager.saveMsgBox(
MsgBoxBean( MsgBoxBean(
MsgBoxType.OBU, MsgBoxType.OBU,
V2XMsg(v2xType, V2XMsg(v2xType,
alertContent, alertContent,
ttsContent) ttsContent)
)
)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
) )
)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
)
// } // }
// 更新数据 // 更新数据
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let { TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.invokeTrackerWarningInfo(it) CallerObuListenerManager.invokeTrackerWarningInfo(it)
CallerMapUIServiceManager.getMarkerService() CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it) ?.updateITrafficThreatLevelInfo(it)
}
} }
}
ObuConstants.STATUS.UPDATE -> { ObuConstants.STATUS.UPDATE -> {
}
// 删除
ObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.removeTrackerWarningInfo(it)
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
} }
// 删除
ObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.removeTrackerWarningInfo(it)
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
// CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString()) // CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString())
}
} }
} }
} }
} }
// (5) 限速预警信息CVX_SLW_THREAT_IND // (5) 限速预警信息CVX_SLW_THREAT_IND
@@ -599,30 +592,32 @@ class MogoPrivateObuManager private constructor() {
// (1) V2V预警信息CVX_V2V_THREAT_IND // (1) V2V预警信息CVX_V2V_THREAT_IND
override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) { override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) {
CallerLogger.d( if (HmiBuildConfig.isShowObuV2vView) {
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}", CallerLogger.d(
"onCvxV2vThreatIndInfo ------> $info" "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
) "onCvxV2vThreatIndInfo ------> $info"
info?.let { )
//预警信息,预警类型 threat_level 2、3 info?.let {
info.threat_info?.let { //预警信息,预警类型 threat_level 2、3
//预警方位 info.threat_info?.let {
val direction = //预警方位
getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1) val direction =
//处理预警类型 getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1)
val appId = info.threat_info.app_id //处理预警类型
val level = info.threat_info.threat_level val appId = info.threat_info.app_id
val status = info.status val level = info.threat_info.threat_level
if (info.ext_info != null) { val status = info.status
CallerLogger.d( if (info.ext_info != null) {
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}", CallerLogger.d(
"onCvxV2vThreatIndInfo target_classification = ${ "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
getMessageDirection(info.ext_info.target_classification) "onCvxV2vThreatIndInfo target_classification = ${
} --- direction = $direction --- appId = $appId ---level = $level -- status = $status" getMessageDirection(info.ext_info.target_classification)
) } --- direction = $direction --- appId = $appId ---level = $level -- status = $status"
} )
}
handleSdkObu(appId, direction, status, level, info) handleSdkObu(appId, direction, status, level, info)
}
} }
} }
} }

View File

@@ -170,46 +170,47 @@ class MogoPrivateObuNewManager private constructor() {
*/ */
override fun onMogoObuRvWarning(data: MogoObuRvWarningData) { override fun onMogoObuRvWarning(data: MogoObuRvWarningData) {
super.onMogoObuRvWarning(data) super.onMogoObuRvWarning(data)
mObuStatusInfo.obuRvStatus = true if (HmiBuildConfig.isShowObuV2vView) {
CallerObuListenerManager.invokeListener(mObuStatusInfo) mObuStatusInfo.obuRvStatus = true
CallerObuListenerManager.invokeListener(mObuStatusInfo)
if (!data.warningMsg.warningData.isNullOrEmpty()) {
// 更新数据远车数据之前要匹配uuid
TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data)?.let {
CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it)
}
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", data.toString()) if (!data.warningMsg.warningData.isNullOrEmpty()) {
data.let { // 更新数据远车数据之前要匹配uuid
//预警信息,预警类型 threat_level 2、3 TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data)?.let {
var status = data.status CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it)
data.vehBasicsMsg?.let { }
//预警方位
val direction = getMessageDirection(data.vehBasicsMsg.targetPosition) CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", data.toString())
//处理预警类型 data.let {
var appId = "" //预警信息,预警类型 threat_level 2、3
var level = -1 var status = data.status
data.warningMsg?.let { data.vehBasicsMsg?.let {
if (data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { //预警方位
level = data.warningMsg.warningData[0].warningLevel val direction = getMessageDirection(data.vehBasicsMsg.targetPosition)
appId = data.warningMsg.warningData[0].warningType.toString() //处理预警类型
var appId = ""
var level = -1
data.warningMsg?.let {
if (data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) {
level = data.warningMsg.warningData[0].warningLevel
appId = data.warningMsg.warningData[0].warningType.toString()
}
} }
}
CallerLogger.d( CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuRvWarning target_classification = ${ "onMogoObuRvWarning target_classification = ${
getMessageDirection(data.vehBasicsMsg.targetPosition) getMessageDirection(data.vehBasicsMsg.targetPosition)
} --- direction = $direction --- appId = $appId ---level = $level -- status = $status" } --- direction = $direction --- appId = $appId ---level = $level -- status = $status"
) )
//拼凑数据 //拼凑数据
if (appId != null) { if (appId != null) {
handleSdkObu(appId, direction, status, level, data) handleSdkObu(appId, direction, status, level, data)
}
} }
} }
} }
} }
} }
/** /**
@@ -219,11 +220,13 @@ class MogoPrivateObuNewManager private constructor() {
super.onMogoObuSpatWarning(data) super.onMogoObuSpatWarning(data)
if (data?.lights != null && data.lights.isNotEmpty() if (data?.lights != null && data.lights.isNotEmpty()
) { ) {
handlerTrafficLight( if (HmiBuildConfig.isShowObuV2iView) {
data.warningType, handlerTrafficLight(
data.status, data.warningType,
data.lights data.status,
) data.lights
)
}
} }
} }
@@ -232,236 +235,239 @@ class MogoPrivateObuNewManager private constructor() {
*/ */
override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) { override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) {
super.onMogoObuRsiWarning(data) super.onMogoObuRsiWarning(data)
CallerLogger.d( if (HmiBuildConfig.isShowObuV2iView) {
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuRsiWarning ------> $data"
)
if (data != null && data.warningMsg != null && data.warningMsg.size > 0) {
var alertContent = ""
var ttsContent = ""
var appId = data.warningMsg[0].sceneType.toString()
val status = data.status
val level = data.warningMsg[0].warningLevel
val direction = getMessageDirection(data.warningMsg[0].targetPosition)
CallerLogger.d( CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- eventSerialNum = ${data.warningMsg[0].eventSerialNum} ---signSerialNum = ${data.warningMsg[0].signSerialNum} --- direction = $direction -- targetPosition = ${data.warningMsg[0].targetPosition}" "onMogoObuRsiWarning ------> $data"
) )
if (data != null && data.warningMsg != null && data.warningMsg.size > 0) {
var alertContent = ""
var ttsContent = ""
var appId = data.warningMsg[0].sceneType.toString()
val status = data.status
val level = data.warningMsg[0].warningLevel
val direction = getMessageDirection(data.warningMsg[0].targetPosition)
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- eventSerialNum = ${data.warningMsg[0].eventSerialNum} ---signSerialNum = ${data.warningMsg[0].signSerialNum} --- direction = $direction -- targetPosition = ${data.warningMsg[0].targetPosition}"
)
when (appId) { when (appId) {
// 道路危险情况预警 // 道路危险情况预警
MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> { MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> {
when (data.warningMsg[0].eventSerialNum) { when (data.warningMsg[0].eventSerialNum) {
MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障 MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障
appId = EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType appId = EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType
} }
MogoObuConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水 MogoObuConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水
appId = EventTypeEnumNew.FOURS_PONDING.poiType appId = EventTypeEnumNew.FOURS_PONDING.poiType
} }
MogoObuConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车 MogoObuConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PARKING.poiType appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PARKING.poiType
} }
// MogoObuConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道,和标牌重复 // MogoObuConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道,和标牌重复
// appId = EventTypeEnumNew.FOURS_ROAD_WORK.poiType // appId = EventTypeEnumNew.FOURS_ROAD_WORK.poiType
// } // }
MogoObuConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶 MogoObuConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶
appId = EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType appId = EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType
} }
MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行 MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
appId = appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType EventTypeEnumNew.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType
}
} }
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //事件才有影响范围
alertContent,
Math.round(data.warningMsg[0].distance).toString(),
Math.round(data.warningMsg[0].eventRadius).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(data.warningMsg[0].distance).toString(),
Math.round(data.warningMsg[0].eventRadius).toString()
)
} }
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //事件才有影响范围
alertContent,
Math.round(data.warningMsg[0].distance).toString(),
Math.round(data.warningMsg[0].eventRadius).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(data.warningMsg[0].distance).toString(),
Math.round(data.warningMsg[0].eventRadius).toString()
)
}
//车内标牌 //车内标牌
MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> { MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> {
when (data.warningMsg[0].signSerialNum) { when (data.warningMsg[0].signSerialNum) {
// MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口 // MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口
// appId = EventTypeEnumNew.TYPE_ID_NTERSECTION.poiType // appId = EventTypeEnumNew.TYPE_ID_NTERSECTION.poiType
// } // }
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯 MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁 MogoObuConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁
appId = EventTypeEnumNew.TYPE_ID_BRIDGE.poiType appId = EventTypeEnumNew.TYPE_ID_BRIDGE.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人 MogoObuConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人
appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑 MogoObuConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑
appId = EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD.poiType appId = EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_TUNNEL -> { //隧道 MogoObuConstants.RTS.RTI_TYPE_TUNNEL -> { //隧道
appId = EventTypeEnumNew.TYPE_ID_TUNNEL.poiType appId = EventTypeEnumNew.TYPE_ID_TUNNEL.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_FERRY -> { //渡轮 MogoObuConstants.RTS.RTI_TYPE_FERRY -> { //渡轮
appId = EventTypeEnumNew.TYPE_ID_FERRY.poiType appId = EventTypeEnumNew.TYPE_ID_FERRY.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_UNEVEN_ROAD -> { //路面不平 MogoObuConstants.RTS.RTI_TYPE_UNEVEN_ROAD -> { //路面不平
appId = EventTypeEnumNew.TYPE_ID_UNEVEN_ROAD.poiType appId = EventTypeEnumNew.TYPE_ID_UNEVEN_ROAD.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_NON_MOTOR_VEHICLE -> { //非机动车 MogoObuConstants.RTS.RTI_TYPE_NON_MOTOR_VEHICLE -> { //非机动车
appId = EventTypeEnumNew.TYPE_ID_NON_MOTOR_VEHICLE.poiType appId = EventTypeEnumNew.TYPE_ID_NON_MOTOR_VEHICLE.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_OBSTACLE -> { //障碍 MogoObuConstants.RTS.RTI_TYPE_OBSTACLE -> { //障碍
appId = EventTypeEnumNew.TYPE_ID_OBSTACLE.poiType appId = EventTypeEnumNew.TYPE_ID_OBSTACLE.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_CONSTRUCTION -> { //施工 MogoObuConstants.RTS.RTI_TYPE_CONSTRUCTION -> { //施工
appId = EventTypeEnumNew.TYPE_FOURS_ROAD_WORK.poiType appId = EventTypeEnumNew.TYPE_FOURS_ROAD_WORK.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_VEHICLE_QUEUE -> { //车队 MogoObuConstants.RTS.RTI_TYPE_VEHICLE_QUEUE -> { //车队
appId = EventTypeEnumNew.TYPE_VEHICLE_QUEUE.poiType appId = EventTypeEnumNew.TYPE_VEHICLE_QUEUE.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_NO_PASSING -> { //不通 MogoObuConstants.RTS.RTI_TYPE_NO_PASSING -> { //不通
appId = EventTypeEnumNew.TYPE_NO_PASSING.poiType appId = EventTypeEnumNew.TYPE_NO_PASSING.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_NO_TURNING_AROUND -> { //禁止掉头 MogoObuConstants.RTS.RTI_TYPE_NO_TURNING_AROUND -> { //禁止掉头
appId = EventTypeEnumNew.TYPE_NO_TURNING_AROUND.poiType appId = EventTypeEnumNew.TYPE_NO_TURNING_AROUND.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_NO_STOPPING -> { //禁止停车 MogoObuConstants.RTS.RTI_TYPE_NO_STOPPING -> { //禁止停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_NO_TOOTING -> { //禁止鸣笛 MogoObuConstants.RTS.RTI_TYPE_NO_TOOTING -> { //禁止鸣笛
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速 MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
} }
// MogoObuConstants.RTS.RTI_TYPE_GO_STRAIGHT_TURN_RIGHT -> { //直行或右转 // MogoObuConstants.RTS.RTI_TYPE_GO_STRAIGHT_TURN_RIGHT -> { //直行或右转
// appId = // appId =
// EventTypeEnumNew.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType // EventTypeEnumNew.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType
// } // }
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒 MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_NARROW_RIGHT -> { //右侧变窄/车道数减少 MogoObuConstants.RTS.RTI_TYPE_NARROW_RIGHT -> { //右侧变窄/车道数减少
appId = EventTypeEnumNew.TYPE_USECASE_ID_NARROW_RIGHT.poiType appId = EventTypeEnumNew.TYPE_USECASE_ID_NARROW_RIGHT.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_GAS_STATION -> { //加油站 MogoObuConstants.RTS.RTI_TYPE_GAS_STATION -> { //加油站
appId = EventTypeEnumNew.TYPE_USECASE_ID_GAS_STATION.poiType appId = EventTypeEnumNew.TYPE_USECASE_ID_GAS_STATION.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_SCHOOL -> { //学校 MogoObuConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
appId = appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
} }
MogoObuConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故 MogoObuConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故
appId = EventTypeEnumNew.TYPE_USECASE_ID_ACCIDENT.poiType appId = EventTypeEnumNew.TYPE_USECASE_ID_ACCIDENT.poiType
}
} }
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //标牌是没有影响范围的
alertContent,
Math.round(data.warningMsg[0].distance).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(data.warningMsg[0].distance).toString()
)
} }
alertContent = EventTypeEnumNew.getWarningContent(appId) // 拥堵
ttsContent = EventTypeEnumNew.getWarningTts(appId) MogoObuConstants.RSI_SCENE_TYPE.TJW.toString() -> {
alertContent = String.format( //标牌是没有影响范围的 appId = EventTypeEnumNew.TYPE_USECASE_ID_TJW.poiType
alertContent,
Math.round(data.warningMsg[0].distance).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(data.warningMsg[0].distance).toString()
)
}
// 拥堵 alertContent = EventTypeEnumNew.getWarningContent(appId)
MogoObuConstants.RSI_SCENE_TYPE.TJW.toString() -> { ttsContent = EventTypeEnumNew.getWarningTts(appId)
appId = EventTypeEnumNew.TYPE_USECASE_ID_TJW.poiType alertContent = String.format( //事件才有影响范围
alertContent,
alertContent = EventTypeEnumNew.getWarningContent(appId) Math.round(data.warningMsg[0].distance).toString(),
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //事件才有影响范围
alertContent,
Math.round(data.warningMsg[0].distance).toString(),
Math.round(data.warningMsg[0].eventRadius).toString() Math.round(data.warningMsg[0].eventRadius).toString()
) )
ttsContent = String.format( ttsContent = String.format(
ttsContent, ttsContent,
Math.round(data.warningMsg[0].distance).toString(), Math.round(data.warningMsg[0].distance).toString(),
Math.round(data.warningMsg[0].eventRadius).toString() Math.round(data.warningMsg[0].eventRadius).toString()
) )
}
//限速预警, ADD处理一次
MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
}
}
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"new onMogoObuRsiWarning ttsContent = $ttsContent --alertContent = $alertContent --appId = $appId ---direction = ${direction.direction} --distance = ${Math.round(data.warningMsg[0].distance)} ---eventRadius = ${Math.round(data.warningMsg[0].eventRadius)} --speedMaxLimit = ${data.warningMsg[0].speedMaxLimit.toInt()}"
)
when (status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//显示警告红边
// CallerHmiManager.showWarning(direction)
//不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-PriObuNewMana1", "alertContent或ttsContent为空!")
} }
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean( //限速预警, ADD处理一次
MsgBoxType.OBU, MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> {
V2XMsg( alertContent = EventTypeEnumNew.getWarningContent(appId)
appId, ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent, }
ttsContent }
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"new onMogoObuRsiWarning ttsContent = $ttsContent --alertContent = $alertContent --appId = $appId ---direction = ${direction.direction} --distance = ${Math.round(data.warningMsg[0].distance)} ---eventRadius = ${Math.round(data.warningMsg[0].eventRadius)} --speedMaxLimit = ${data.warningMsg[0].speedMaxLimit.toInt()}"
)
when (status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//显示警告红边
// CallerHmiManager.showWarning(direction)
//不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-PriObuNewMana1", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OBU,
V2XMsg(
appId,
alertContent,
ttsContent
)
) )
) )
) CallerHmiManager.warningV2X(
CallerHmiManager.warningV2X( appId,
appId, alertContent,
alertContent, ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒 (appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
(appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的 object : IMoGoWarningStatusListener {
object : IMoGoWarningStatusListener { override fun onDismiss() {
override fun onDismiss() { // 关闭警告红边
// 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) }
} },
}, true,
true, 3000L
3000L )
)
// 更新数据 // 更新数据
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let { TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let {
CallerMapUIServiceManager.getMarkerService() CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it) ?.updateITrafficThreatLevelInfo(it)
} }
} }
MogoObuConstants.STATUS.UPDATE -> { // 更新 MogoObuConstants.STATUS.UPDATE -> { // 更新
} }
MogoObuConstants.STATUS.DELETE -> { // 删除 MogoObuConstants.STATUS.DELETE -> { // 删除
// 关闭警告红边 // 关闭警告红边
// CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) // CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗 // 移除顶部弹窗
// CallerHmiManager.disableWarningV2X((appId + direction.direction)) // CallerHmiManager.disableWarningV2X((appId + direction.direction))
// 更新数据 // 更新数据
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data) TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)
?.let { ?.let {
// 事件结束,还原车辆颜色 // 事件结束,还原车辆颜色
it.threatLevel = 0x01 it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService() CallerMapUIServiceManager.getMarkerService()
?.updateITrafficInfo(it) ?.updateITrafficInfo(it)
} }
}
} }
} }
} }
} }
/** /**
@@ -477,99 +483,101 @@ class MogoPrivateObuNewManager private constructor() {
data: MogoObuRsmWarningData? data: MogoObuRsmWarningData?
) { ) {
super.onMogoObuRsmWarning(data) super.onMogoObuRsmWarning(data)
if (HmiBuildConfig.isShowObuWeaknessTrafficView) { if (HmiBuildConfig.isShowObuV2iView) {
CallerLogger.d( if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", CallerLogger.d(
"onMogoObuRsmWarning ------> ${data.toString()}" "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
) "onMogoObuRsmWarning ------> ${data.toString()}"
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu )
if (data != null && data.participant != null) { // 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
var v2xType = "" if (data != null && data.participant != null) {
if (data.participant.ptcType == 1) { //机动车 var v2xType = ""
v2xType = if (data.participant.ptcType == 1) { //机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType v2xType =
} else if (data.participant.ptcType == 2) { //非机动车 EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
v2xType = } else if (data.participant.ptcType == 2) { //非机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType v2xType =
} else if (data.participant.ptcType == 3) { //行人 EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
v2xType = } else if (data.participant.ptcType == 3) { //行人
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType v2xType =
} else { //未知 EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType } else { //未知
} v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType) }
val alertContent = val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
EventTypeEnumNew.getWarningContent(v2xType) val alertContent =
var level = -1 EventTypeEnumNew.getWarningContent(v2xType)
val direction = getMessageDirection(data.participant.targetPosition) var level = -1
if (data.warningMsg != null && data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { val direction = getMessageDirection(data.participant.targetPosition)
level = data.warningMsg.warningData[0].warningLevel //默认是1个 if (data.warningMsg != null && data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", level = data.warningMsg.warningData[0].warningLevel //默认是1个
"new onMogoObuRsmWarning ---status---> ${data.status} ---data.warningMsg.warningData[0].status = ${data.warningMsg.warningData[0].status} ---v2xType = $v2xType ---alertContent = $alertContent ---ttsContent = $ttsContent " CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
) "new onMogoObuRsmWarning ---status---> ${data.status} ---data.warningMsg.warningData[0].status = ${data.warningMsg.warningData[0].status} ---v2xType = $v2xType ---alertContent = $alertContent ---ttsContent = $ttsContent "
)
when (data.warningMsg.warningData[0].status) { when (data.warningMsg.warningData[0].status) {
MogoObuConstants.STATUS.ADD -> { // 添加 MogoObuConstants.STATUS.ADD -> { // 添加
// if (level == 2 || level == 3) { //不考虑level // if (level == 2 || level == 3) { //不考虑level
//显示警告红边 //显示警告红边
CallerHmiManager.showWarning(direction) CallerHmiManager.showWarning(direction)
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-PriObuNewMana2", "alertContent或ttsContent为空!") Log.d("MsgBox-PriObuNewMana2", "alertContent或ttsContent为空!")
} }
CallerMsgBoxManager.saveMsgBox( CallerMsgBoxManager.saveMsgBox(
MsgBoxBean( MsgBoxBean(
MsgBoxType.OBU, MsgBoxType.OBU,
V2XMsg( V2XMsg(
v2xType, v2xType,
alertContent, alertContent,
ttsContent ttsContent
)
) )
) )
) CallerHmiManager.warningV2X(
CallerHmiManager.warningV2X( v2xType,
v2xType, alertContent,
alertContent, ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒 (v2xType + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
(v2xType + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的 object : IMoGoWarningStatusListener {
object : IMoGoWarningStatusListener { override fun onDismiss() {
override fun onDismiss() { // 关闭警告红边
// 关闭警告红边 CallerHmiManager.showWarning(
CallerHmiManager.showWarning( WarningDirectionEnum.ALERT_WARNING_NON
WarningDirectionEnum.ALERT_WARNING_NON )
) }
} },
}, true,
true, 5000L
5000L )
)
// } // }
// 更新数据 // 更新数据
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let { TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "add cvxPtcThreatIndInfo2TrafficData ---it---> $it") CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "add cvxPtcThreatIndInfo2TrafficData ---it---> $it")
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
MogoObuConstants.STATUS.UPDATE -> {// 更新
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据 TODO 删除原来的改变颜色删除marker。不影响别的模型添加
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)
?.let {
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService() CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it) ?.updateITrafficThreatLevelInfo(it)
} }
}
//删除弱势交通元素 MogoObuConstants.STATUS.UPDATE -> {// 更新
CallerMapUIServiceManager.getMarkerService()?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString()) }
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据 TODO 删除原来的改变颜色删除marker。不影响别的模型添加
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)
?.let {
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString())
}
} }
} }
} }
@@ -582,7 +590,7 @@ class MogoPrivateObuNewManager private constructor() {
*/ */
override fun onMogoObuMapMath(data: MogoObuMapMathData?) { override fun onMogoObuMapMath(data: MogoObuMapMathData?) {
super.onMogoObuMapMath(data) super.onMogoObuMapMath(data)
if(isShowObuLimitSpeedView) { //默认显示obu的限速 if(isShowObuLimitSpeedView) {
if (data != null) { if (data != null) {
CallerLogger.d( CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",

View File

@@ -100,4 +100,19 @@ object HmiBuildConfig {
@Volatile @Volatile
var isShowObuLimitSpeedView = false var isShowObuLimitSpeedView = false
/**
* 是否展示obu的v2v
*/
@JvmField
@Volatile
var isShowObuV2vView = false
/**
* 是否展示obu的v2i
*/
@JvmField
@Volatile
var isShowObuV2iView = false
} }