优化弱势交通 开关
This commit is contained in:
@@ -9,6 +9,7 @@ import android.os.Build.VERSION_CODES
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.transition.*
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@@ -1487,10 +1488,12 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
}
|
||||
|
||||
override fun setObuWeaknessTraffic(isOpen: Boolean) {
|
||||
Log.d("liyz", "setObuWeaknessTraffic isOpen $isOpen");
|
||||
HmiBuildConfig.isShowObuWeaknessTrafficView = isOpen
|
||||
}
|
||||
|
||||
override fun setCloudWeaknessTraffic(isOpen: Boolean) {
|
||||
Log.d("liyz", "setCloudWeaknessTraffic isOpen $isOpen");
|
||||
HmiBuildConfig.isShowCloudWeaknessTrafficView = isOpen
|
||||
}
|
||||
|
||||
|
||||
@@ -1113,6 +1113,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
* obu弱势交通控制
|
||||
*/
|
||||
tbObuWeaknessTraffic.setOnCheckedChangeListener { _, isChecked ->
|
||||
Log.d("liyz", "obu弱势交通控制 isChecked = $isChecked")
|
||||
if (!isChecked) { //默认开启
|
||||
CallerHmiManager.setObuWeaknessTraffic(true)
|
||||
} else {
|
||||
@@ -1124,7 +1125,8 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
* 云端弱势交通控制
|
||||
*/
|
||||
tbCloudWeaknessTraffic.setOnCheckedChangeListener { _, isChecked ->
|
||||
if (!isChecked) { //默认开启
|
||||
Log.d("liyz", "云端弱势交通控制 isChecked = $isChecked")
|
||||
if (isChecked) { //默认关闭
|
||||
CallerHmiManager.setCloudWeaknessTraffic(true)
|
||||
} else {
|
||||
CallerHmiManager.setCloudWeaknessTraffic(false)
|
||||
|
||||
@@ -1364,8 +1364,8 @@
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:textOff="关闭「OBU弱势交通」"
|
||||
android:textOn="打开「OBU弱势交通」"
|
||||
android:textOff="关闭路侧弱势群体预警"
|
||||
android:textOn="打开路侧弱势群体预警"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
@@ -1375,8 +1375,8 @@
|
||||
android:layout_columnWeight="1"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center"
|
||||
android:textOff="关闭「云端弱势交通」"
|
||||
android:textOn="打开「云端弱势交通」"
|
||||
android:textOff="开启云端弱势群体预警"
|
||||
android:textOn="关闭云端弱势群体预警"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.obu.mogo
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
@@ -273,7 +274,8 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
appId = V2iEventTypeEnum.TYPE_USECASE_ID_SLW.poiType
|
||||
}
|
||||
MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
|
||||
appId = V2iEventTypeEnum.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType
|
||||
appId =
|
||||
V2iEventTypeEnum.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +336,8 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
appId = V2iEventTypeEnum.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
|
||||
}
|
||||
MogoObuConstants.RTS.RTI_TYPE_GO_STRAIGHT_TURN_RIGHT -> { //直行或右转
|
||||
appId = V2iEventTypeEnum.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType
|
||||
appId =
|
||||
V2iEventTypeEnum.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType
|
||||
}
|
||||
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
|
||||
appId = V2iEventTypeEnum.TYPE_USECASE_ID_BUS_WARNING.poiType
|
||||
@@ -346,7 +349,8 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
appId = V2iEventTypeEnum.TYPE_USECASE_ID_GAS_STATION.poiType
|
||||
}
|
||||
MogoObuConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
|
||||
appId = V2iEventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
|
||||
appId =
|
||||
V2iEventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
|
||||
}
|
||||
|
||||
MogoObuConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故
|
||||
@@ -361,8 +365,16 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
alertContent = V2iEventTypeEnum.getWarningContent(appId)
|
||||
ttsContent = V2iEventTypeEnum.getWarningTts(appId)
|
||||
|
||||
alertContent = String.format(alertContent, data.warningMsg[0].distance.toString(), data.warningMsg[0].eventRadius.toString())
|
||||
ttsContent = String.format(ttsContent, data.warningMsg[0].distance.toString(), data.warningMsg[0].eventRadius.toString())
|
||||
alertContent = String.format(
|
||||
alertContent,
|
||||
data.warningMsg[0].distance.toString(),
|
||||
data.warningMsg[0].eventRadius.toString()
|
||||
)
|
||||
ttsContent = String.format(
|
||||
ttsContent,
|
||||
data.warningMsg[0].distance.toString(),
|
||||
data.warningMsg[0].eventRadius.toString()
|
||||
)
|
||||
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
@@ -393,7 +405,8 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
)
|
||||
// 更新数据
|
||||
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let {
|
||||
CallerMapUIServiceManager.getMarkerService()?.updateITrafficThreatLevelInfo(it)
|
||||
CallerMapUIServiceManager.getMarkerService()
|
||||
?.updateITrafficThreatLevelInfo(it)
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
@@ -418,72 +431,76 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
*/
|
||||
override fun onMogoObuRsmWarning(data: MogoObuRsmWarningData?) {
|
||||
super.onMogoObuRsmWarning(data)
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
"onMogoObuRsmWarning ------> $data"
|
||||
)
|
||||
Log.d(TAG, "data = ${data.toString()}")
|
||||
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
|
||||
if (data != null && data.participant != null && (data.participant.ptcType == 1 || data.participant.ptcType == 3)) {
|
||||
|
||||
if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
"onMogoObuRsmWarning ---status---> ${data.status}"
|
||||
"onMogoObuRsmWarning ------> $data"
|
||||
)
|
||||
var v2xType = ""
|
||||
if (data.participant.ptcType == 1) { //摩托车
|
||||
v2xType = EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType
|
||||
} else if (data.participant.ptcType == 2) { //行人
|
||||
v2xType = EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.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
|
||||
}
|
||||
|
||||
when (data.status) {
|
||||
// 添加
|
||||
MogoObuConstants.STATUS.ADD,
|
||||
MogoObuConstants.STATUS.UPDATE// 更新
|
||||
-> {
|
||||
// if (level == 2 || level == 3) { //不考虑level
|
||||
//显示警告红边
|
||||
CallerHmiManager.showWarning(direction)
|
||||
CallerHmiManager.showWarningV2X(
|
||||
v2xType,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(v2xType + direction.direction),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
},
|
||||
true,
|
||||
3000L
|
||||
)
|
||||
// }
|
||||
// 更新数据
|
||||
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let {
|
||||
CallerMapUIServiceManager.getMarkerService()?.updateITrafficInfo(it)
|
||||
}
|
||||
Log.d(TAG, "data = ${data.toString()}")
|
||||
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
|
||||
if (data != null && data.participant != null && (data.participant.ptcType == 1 || data.participant.ptcType == 3)) {
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
"onMogoObuRsmWarning ---status---> ${data.status}"
|
||||
)
|
||||
var v2xType = ""
|
||||
if (data.participant.ptcType == 1) { //摩托车
|
||||
v2xType = EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType
|
||||
} else if (data.participant.ptcType == 2) { //行人
|
||||
v2xType = EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.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
|
||||
}
|
||||
|
||||
// 删除
|
||||
MogoObuConstants.STATUS.DELETE -> {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
// 更新数据
|
||||
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let {
|
||||
// 事件结束,还原交通参与者颜色
|
||||
it.threatLevel = 0x01
|
||||
CallerMapUIServiceManager.getMarkerService()?.updateITrafficThreatLevelInfo(it)
|
||||
when (data.status) {
|
||||
// 添加
|
||||
MogoObuConstants.STATUS.ADD,
|
||||
MogoObuConstants.STATUS.UPDATE// 更新
|
||||
-> {
|
||||
// if (level == 2 || level == 3) { //不考虑level
|
||||
//显示警告红边
|
||||
CallerHmiManager.showWarning(direction)
|
||||
CallerHmiManager.showWarningV2X(
|
||||
v2xType,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(v2xType + direction.direction),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
},
|
||||
true,
|
||||
3000L
|
||||
)
|
||||
// }
|
||||
// 更新数据
|
||||
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let {
|
||||
CallerMapUIServiceManager.getMarkerService()?.updateITrafficInfo(it)
|
||||
}
|
||||
}
|
||||
//TODO
|
||||
|
||||
// 删除
|
||||
MogoObuConstants.STATUS.DELETE -> {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
// 更新数据
|
||||
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let {
|
||||
// 事件结束,还原交通参与者颜色
|
||||
it.threatLevel = 0x01
|
||||
CallerMapUIServiceManager.getMarkerService()
|
||||
?.updateITrafficThreatLevelInfo(it)
|
||||
}
|
||||
//TODO
|
||||
// CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.content.Intent;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.IV2XScenarioManager;
|
||||
@@ -70,13 +71,17 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
mV2XScenario = new V2XOptimalRouteVREventScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS:
|
||||
sceneChange();
|
||||
if (MogoStatusManager.getInstance().isVrMode()) {
|
||||
mV2XScenario = new V2XFrontWarningScenario();
|
||||
} else {
|
||||
mV2XScenario = null;
|
||||
if (HmiBuildConfig.isShowCloudWeaknessTrafficView) { //默认关闭云端弱势交通
|
||||
sceneChange();
|
||||
if (MogoStatusManager.getInstance().isVrMode()) {
|
||||
mV2XScenario = new V2XFrontWarningScenario();
|
||||
} else {
|
||||
mV2XScenario = null;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
mV2XScenario = null;
|
||||
CallerLogger.INSTANCE.e(M_V2X + TAG, "当前V2X消息类型未定义:" + v2XMessageEntity);
|
||||
|
||||
Reference in New Issue
Block a user