[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 ->
//默认关闭
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.setOnCheckedChangeListener { _, isChecked ->

View File

@@ -129,6 +129,30 @@
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
android:id="@+id/tbObuWeaknessTrafficSop"
android:layout_width="match_parent"
@@ -136,7 +160,7 @@
android:layout_margin="@dimen/dp_10"
android:padding="@dimen/dp_20"
android:background="@drawable/radio_button_normal_background_right"
app:layout_constraintTop_toBottomOf="@id/tbObu"
app:layout_constraintTop_toBottomOf="@id/tbObuV2iView"
android:textOff="关闭路侧弱势群体预警"
android:textOn="打开路侧弱势群体预警"
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.eagle.core.data.app.AppConfigInfo
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.enums.WarningDirectionEnum
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
@@ -232,201 +233,203 @@ class MogoPrivateObuManager private constructor() {
// (3) 道路事件预警信息CVX_RTI_THREAT_IND
override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo ------> $info"
)
if (HmiBuildConfig.isShowObuV2iView) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo ------> $info"
)
if (info != null && info.threat_info != null && info.ext_info != null) {
var alertContent = ""
var ttsContent = ""
var appId = info.threat_info.app_id.toString()
val status = info.status
val level = info.threat_info.threat_level
val direction =
getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1)
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}"
)
CallerLogger.d(
"$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} "
)
when (appId) {
// 道路危险情况预警
EventTypeEnum.TYPE_USECASE_ID_HLW.poiType,
EventTypeEnum.TYPE_USECASE_ID_IVS.poiType
-> {
when (info.ext_info.rti_type) {
//急转弯
0x2 -> {
// 特殊处理左、右方向的
when (direction) {
WarningDirectionEnum.ALERT_WARNING_LEFT,
WarningDirectionEnum.ALERT_WARNING_TOP_LEFT,
WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType
}
WarningDirectionEnum.ALERT_WARNING_RIGHT,
WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT,
WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType
if (info != null && info.threat_info != null && info.ext_info != null) {
var alertContent = ""
var ttsContent = ""
var appId = info.threat_info.app_id.toString()
val status = info.status
val level = info.threat_info.threat_level
val direction =
getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1)
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}"
)
CallerLogger.d(
"$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} "
)
when (appId) {
// 道路危险情况预警
EventTypeEnum.TYPE_USECASE_ID_HLW.poiType,
EventTypeEnum.TYPE_USECASE_ID_IVS.poiType
-> {
when (info.ext_info.rti_type) {
//急转弯
0x2 -> {
// 特殊处理左、右方向的
when (direction) {
WarningDirectionEnum.ALERT_WARNING_LEFT,
WarningDirectionEnum.ALERT_WARNING_TOP_LEFT,
WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType
}
WarningDirectionEnum.ALERT_WARNING_RIGHT,
WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT,
WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> {
appId =
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
}
}
//施工
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)
ttsContent = EventTypeEnum.getWarningTts(appId)
}
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 -> {
ttsContent = EventTypeEnum.getWarningTts(appId)
if (info.threat_info != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"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(
"$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}",
"ttsContent = $ttsContent --alertContent = $alertContent"
)
}
}
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)
// 移除顶部弹窗
// 删除
ObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
// CallerHmiManager.disableWarningV2X((appId + direction.direction).toString())
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.removeTrackerWarningInfo(it)
// 事件结束,还原车辆颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.removeTrackerWarningInfo(it)
// 事件结束,还原车辆颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
}
}
@@ -445,37 +448,27 @@ class MogoPrivateObuManager private constructor() {
&& info.ext_info.lights != null
&& info.ext_info.lights.isNotEmpty()
) {
//v2i数据传输延迟
// val hvMillTime = info.threat_info.hv_time.millisecond
// val hvSecondMillTime = (info.threat_info.hv_time.second) * 1000
// val hvTime = hvMillTime + hvSecondMillTime
// val currentTime = TimeUtils.getNowMills() % 60000
// val delayTime = currentTime - hvTime
// 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
)
if (HmiBuildConfig.isShowObuV2iView) {
handlerTrafficLight(
info.threat_info.app_id,
info.status,
info.ext_info.lights,
info.ext_info.index
)
}
}
}
// (2) 弱势交通参与者预警信息CVX_PTC_THREAT_IND
override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) {
CallerLogger.d(
"$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)) {
//v2i数据传输延迟
if (HmiBuildConfig.isShowObuV2iView) {
CallerLogger.d(
"$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)) {
//v2i数据传输延迟
// val hvMillTime = info.threat_info.hv_time.millisecond
// val hvSecondMillTime = (info.threat_info.hv_time.second) * 1000
// val hvTime = hvMillTime + hvSecondMillTime
@@ -488,85 +481,85 @@ class MogoPrivateObuManager private constructor() {
// "onCvxPtcInfoIndInfo ---delayTime---> $delayTime"
// )
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
)
var v2xType = ""
if (info.ptc_type == 1) { //摩托车
v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType
} else if (info.ptc_type == 2) { //行人
v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType
}
val ttsContent = EventTypeEnum.getWarningTts(v2xType)
val alertContent = EventTypeEnum.getWarningContent(v2xType)
val direction =
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
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
)
var v2xType = ""
if (info.ptc_type == 1) { //摩托车
v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType
} else if (info.ptc_type == 2) { //行人
v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType
}
val ttsContent = EventTypeEnum.getWarningTts(v2xType)
val alertContent = EventTypeEnum.getWarningContent(v2xType)
val direction =
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
when (info.status) {
// 添加
ObuConstants.STATUS.ADD -> {
// if (level == 2 || level == 3) { //不考虑level
//显示警告红边
CallerHmiManager.showWarning(direction)
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxPtcThreatIndInfo ------> v2xType = $v2xType --- alertContent = $alertContent --- ttsContent = $ttsContent ")
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-PriObuManager5", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OBU,
V2XMsg(v2xType,
alertContent,
ttsContent)
when (info.status) {
// 添加
ObuConstants.STATUS.ADD -> {
// if (level == 2 || level == 3) { //不考虑level
//显示警告红边
CallerHmiManager.showWarning(direction)
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxPtcThreatIndInfo ------> v2xType = $v2xType --- alertContent = $alertContent --- ttsContent = $ttsContent ")
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-PriObuManager5", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OBU,
V2XMsg(v2xType,
alertContent,
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 {
CallerObuListenerManager.invokeTrackerWarningInfo(it)
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
// 更新数据
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.invokeTrackerWarningInfo(it)
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
}
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.UPDATE -> {
}
// 删除
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())
}
}
}
}
}
// (5) 限速预警信息CVX_SLW_THREAT_IND
@@ -599,30 +592,32 @@ class MogoPrivateObuManager private constructor() {
// (1) V2V预警信息CVX_V2V_THREAT_IND
override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxV2vThreatIndInfo ------> $info"
)
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 appId = info.threat_info.app_id
val level = info.threat_info.threat_level
val status = info.status
if (info.ext_info != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxV2vThreatIndInfo target_classification = ${
getMessageDirection(info.ext_info.target_classification)
} --- direction = $direction --- appId = $appId ---level = $level -- status = $status"
)
}
if (HmiBuildConfig.isShowObuV2vView) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxV2vThreatIndInfo ------> $info"
)
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 appId = info.threat_info.app_id
val level = info.threat_info.threat_level
val status = info.status
if (info.ext_info != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxV2vThreatIndInfo target_classification = ${
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) {
super.onMogoObuRvWarning(data)
mObuStatusInfo.obuRvStatus = true
CallerObuListenerManager.invokeListener(mObuStatusInfo)
if (!data.warningMsg.warningData.isNullOrEmpty()) {
// 更新数据远车数据之前要匹配uuid
TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data)?.let {
CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it)
}
if (HmiBuildConfig.isShowObuV2vView) {
mObuStatusInfo.obuRvStatus = true
CallerObuListenerManager.invokeListener(mObuStatusInfo)
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", data.toString())
data.let {
//预警信息,预警类型 threat_level 2、3
var status = data.status
data.vehBasicsMsg?.let {
//预警方位
val direction = getMessageDirection(data.vehBasicsMsg.targetPosition)
//处理预警类型
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()
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())
data.let {
//预警信息,预警类型 threat_level 2、3
var status = data.status
data.vehBasicsMsg?.let {
//预警方位
val direction = getMessageDirection(data.vehBasicsMsg.targetPosition)
//处理预警类型
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(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuRvWarning target_classification = ${
getMessageDirection(data.vehBasicsMsg.targetPosition)
} --- direction = $direction --- appId = $appId ---level = $level -- status = $status"
)
//拼凑数据
if (appId != null) {
handleSdkObu(appId, direction, status, level, data)
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuRvWarning target_classification = ${
getMessageDirection(data.vehBasicsMsg.targetPosition)
} --- direction = $direction --- appId = $appId ---level = $level -- status = $status"
)
//拼凑数据
if (appId != null) {
handleSdkObu(appId, direction, status, level, data)
}
}
}
}
}
}
/**
@@ -219,11 +220,13 @@ class MogoPrivateObuNewManager private constructor() {
super.onMogoObuSpatWarning(data)
if (data?.lights != null && data.lights.isNotEmpty()
) {
handlerTrafficLight(
data.warningType,
data.status,
data.lights
)
if (HmiBuildConfig.isShowObuV2iView) {
handlerTrafficLight(
data.warningType,
data.status,
data.lights
)
}
}
}
@@ -232,236 +235,239 @@ class MogoPrivateObuNewManager private constructor() {
*/
override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) {
super.onMogoObuRsiWarning(data)
CallerLogger.d(
"$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)
if (HmiBuildConfig.isShowObuV2iView) {
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}"
"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) {
// 道路危险情况预警
MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> {
when (data.warningMsg[0].eventSerialNum) {
MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障
appId = EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水
appId = EventTypeEnumNew.FOURS_PONDING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PARKING.poiType
}
when (appId) {
// 道路危险情况预警
MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> {
when (data.warningMsg[0].eventSerialNum) {
MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障
appId = EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水
appId = EventTypeEnumNew.FOURS_PONDING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PARKING.poiType
}
// MogoObuConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道,和标牌重复
// appId = EventTypeEnumNew.FOURS_ROAD_WORK.poiType
// }
MogoObuConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶
appId = EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType
}
MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType
MogoObuConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶
appId = EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType
}
MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
appId =
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() -> {
when (data.warningMsg[0].signSerialNum) {
//车内标牌
MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> {
when (data.warningMsg[0].signSerialNum) {
// MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口
// appId = EventTypeEnumNew.TYPE_ID_NTERSECTION.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
}
MogoObuConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁
appId = EventTypeEnumNew.TYPE_ID_BRIDGE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人
appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑
appId = EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_TUNNEL -> { //隧道
appId = EventTypeEnumNew.TYPE_ID_TUNNEL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_FERRY -> { //渡轮
appId = EventTypeEnumNew.TYPE_ID_FERRY.poiType
}
MogoObuConstants.RTS.RTI_TYPE_UNEVEN_ROAD -> { //路面不平
appId = EventTypeEnumNew.TYPE_ID_UNEVEN_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NON_MOTOR_VEHICLE -> { //非机动车
appId = EventTypeEnumNew.TYPE_ID_NON_MOTOR_VEHICLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_OBSTACLE -> { //障碍
appId = EventTypeEnumNew.TYPE_ID_OBSTACLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_CONSTRUCTION -> { //施工
appId = EventTypeEnumNew.TYPE_FOURS_ROAD_WORK.poiType
}
MogoObuConstants.RTS.RTI_TYPE_VEHICLE_QUEUE -> { //车队
appId = EventTypeEnumNew.TYPE_VEHICLE_QUEUE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_PASSING -> { //不通
appId = EventTypeEnumNew.TYPE_NO_PASSING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TURNING_AROUND -> { //禁止掉头
appId = EventTypeEnumNew.TYPE_NO_TURNING_AROUND.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_STOPPING -> { //禁止停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TOOTING -> { //禁止鸣笛
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
}
MogoObuConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁
appId = EventTypeEnumNew.TYPE_ID_BRIDGE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人
appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑
appId = EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_TUNNEL -> { //隧道
appId = EventTypeEnumNew.TYPE_ID_TUNNEL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_FERRY -> { //渡轮
appId = EventTypeEnumNew.TYPE_ID_FERRY.poiType
}
MogoObuConstants.RTS.RTI_TYPE_UNEVEN_ROAD -> { //路面不平
appId = EventTypeEnumNew.TYPE_ID_UNEVEN_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NON_MOTOR_VEHICLE -> { //非机动车
appId = EventTypeEnumNew.TYPE_ID_NON_MOTOR_VEHICLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_OBSTACLE -> { //障碍
appId = EventTypeEnumNew.TYPE_ID_OBSTACLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_CONSTRUCTION -> { //施工
appId = EventTypeEnumNew.TYPE_FOURS_ROAD_WORK.poiType
}
MogoObuConstants.RTS.RTI_TYPE_VEHICLE_QUEUE -> { //车队
appId = EventTypeEnumNew.TYPE_VEHICLE_QUEUE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_PASSING -> { //不通
appId = EventTypeEnumNew.TYPE_NO_PASSING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TURNING_AROUND -> { //禁止掉头
appId = EventTypeEnumNew.TYPE_NO_TURNING_AROUND.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_STOPPING -> { //禁止停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TOOTING -> { //禁止鸣笛
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
}
// MogoObuConstants.RTS.RTI_TYPE_GO_STRAIGHT_TURN_RIGHT -> { //直行或右转
// appId =
// EventTypeEnumNew.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NARROW_RIGHT -> { //右侧变窄/车道数减少
appId = EventTypeEnumNew.TYPE_USECASE_ID_NARROW_RIGHT.poiType
}
MogoObuConstants.RTS.RTI_TYPE_GAS_STATION -> { //加油站
appId = EventTypeEnumNew.TYPE_USECASE_ID_GAS_STATION.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故
appId = EventTypeEnumNew.TYPE_USECASE_ID_ACCIDENT.poiType
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NARROW_RIGHT -> { //右侧变窄/车道数减少
appId = EventTypeEnumNew.TYPE_USECASE_ID_NARROW_RIGHT.poiType
}
MogoObuConstants.RTS.RTI_TYPE_GAS_STATION -> { //加油站
appId = EventTypeEnumNew.TYPE_USECASE_ID_GAS_STATION.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故
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)
alertContent = String.format( //标牌是没有影响范围的
alertContent,
Math.round(data.warningMsg[0].distance).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(data.warningMsg[0].distance).toString()
)
}
// 拥堵
MogoObuConstants.RSI_SCENE_TYPE.TJW.toString() -> {
appId = EventTypeEnumNew.TYPE_USECASE_ID_TJW.poiType
// 拥堵
MogoObuConstants.RSI_SCENE_TYPE.TJW.toString() -> {
appId = EventTypeEnumNew.TYPE_USECASE_ID_TJW.poiType
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //事件才有影响范围
alertContent,
Math.round(data.warningMsg[0].distance).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()
)
}
//限速预警, 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为空!")
)
ttsContent = String.format(
ttsContent,
Math.round(data.warningMsg[0].distance).toString(),
Math.round(data.warningMsg[0].eventRadius).toString()
)
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OBU,
V2XMsg(
appId,
alertContent,
ttsContent
//限速预警, 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(
MsgBoxType.OBU,
V2XMsg(
appId,
alertContent,
ttsContent
)
)
)
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
3000L
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
3000L
)
// 更新数据
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let {
// 更新数据
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
// 关闭警告红边
MogoObuConstants.STATUS.DELETE -> { // 删除
// 关闭警告红边
// CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
// 移除顶部弹窗
// CallerHmiManager.disableWarningV2X((appId + direction.direction))
// 更新数据
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)
?.let {
// 事件结束,还原车辆颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficInfo(it)
}
// 更新数据
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)
?.let {
// 事件结束,还原车辆颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficInfo(it)
}
}
}
}
}
}
/**
@@ -477,99 +483,101 @@ class MogoPrivateObuNewManager private constructor() {
data: MogoObuRsmWarningData?
) {
super.onMogoObuRsmWarning(data)
if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
CallerLogger.d(
"$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) {
var v2xType = ""
if (data.participant.ptcType == 1) { //机动车
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (data.participant.ptcType == 2) { //非机动车
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (data.participant.ptcType == 3) { //行人
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
}
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
val alertContent =
EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction = getMessageDirection(data.participant.targetPosition)
if (data.warningMsg != null && data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) {
level = data.warningMsg.warningData[0].warningLevel //默认是1个
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 "
)
if (HmiBuildConfig.isShowObuV2iView) {
if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
CallerLogger.d(
"$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) {
var v2xType = ""
if (data.participant.ptcType == 1) { //机动车
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (data.participant.ptcType == 2) { //非机动车
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (data.participant.ptcType == 3) { //行人
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
}
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
val alertContent =
EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction = getMessageDirection(data.participant.targetPosition)
if (data.warningMsg != null && data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) {
level = data.warningMsg.warningData[0].warningLevel //默认是1个
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) {
MogoObuConstants.STATUS.ADD -> { // 添加
when (data.warningMsg.warningData[0].status) {
MogoObuConstants.STATUS.ADD -> { // 添加
// if (level == 2 || level == 3) { //不考虑level
//显示警告红边
CallerHmiManager.showWarning(direction)
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-PriObuNewMana2", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OBU,
V2XMsg(
v2xType,
alertContent,
ttsContent
//显示警告红边
CallerHmiManager.showWarning(direction)
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-PriObuNewMana2", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.OBU,
V2XMsg(
v2xType,
alertContent,
ttsContent
)
)
)
)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(v2xType + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(
WarningDirectionEnum.ALERT_WARNING_NON
)
}
},
true,
5000L
)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(v2xType + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(
WarningDirectionEnum.ALERT_WARNING_NON
)
}
},
true,
5000L
)
// }
// 更新数据
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let {
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
// 更新数据
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "add cvxPtcThreatIndInfo2TrafficData ---it---> $it")
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString())
MogoObuConstants.STATUS.UPDATE -> {// 更新
}
// 删除
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?) {
super.onMogoObuMapMath(data)
if(isShowObuLimitSpeedView) { //默认显示obu的限速
if(isShowObuLimitSpeedView) {
if (data != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",