diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java index 9421872e3f..fb8fafd35b 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java @@ -11,6 +11,7 @@ import com.zhidao.adas.client.bean.ErrorData; import com.zhidao.adas.client.bean.GlobalPathResp; import com.zhidao.adas.client.bean.GnssInfo; import com.zhidao.adas.client.bean.MogoReportMessage; +import com.zhidao.adas.client.bean.ObuWarningData; import com.zhidao.adas.client.bean.OriginalPointCloudData; import com.zhidao.adas.client.bean.PerceptionTrafficLight; import com.zhidao.adas.client.bean.PlanningDecisionState; @@ -117,6 +118,7 @@ public class DataDistribution { public final List listOriginalPointCloud = new ArrayList<>(); public final List listPlanningObjects = new ArrayList<>(); public final List listPlanningDecisionState = new ArrayList<>(); + public final List listObuWarningData = new ArrayList<>(); public String cutDown(String str) { if (isCutDown && str.length() > 650) { @@ -168,6 +170,14 @@ public class DataDistribution { if (listener != null && Constants.TITLE.RECEIVE_PLANNING_DECISION_STATE.equals(listener.first)) { listener.second.onRefresh(); } + } else if (data instanceof ObuWarningData) { + listObuWarningData.add(0, time + str); + if (listObuWarningData.size() > LIST_SIZE) { + listObuWarningData.remove(listObuWarningData.size() - 1); + } + if (listener != null && Constants.TITLE.RECEIVE_OBU_WARNING_DATA.equals(listener.first)) { + listener.second.onRefresh(); + } } else if (data instanceof GnssInfo) { listGnssInfo.add(0, time + str); if (listGnssInfo.size() > LIST_SIZE) { diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/bean/ObuWarningData.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/bean/ObuWarningData.java new file mode 100644 index 0000000000..7ea1bca9af --- /dev/null +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/bean/ObuWarningData.java @@ -0,0 +1,24 @@ +package com.zhidao.adas.client.bean; + +import com.google.protobuf.TextFormat; + +import java.text.SimpleDateFormat; + +import mogo.telematics.pad.MessagePad; +import mogo.v2x.ObuWarningEvent; + +public class ObuWarningData extends BaseInfo { + public final ObuWarningEvent.ObuWarningData bean; + + public ObuWarningData(MessagePad.Header header, ObuWarningEvent.ObuWarningData bean, SimpleDateFormat sdf) { + super("接收", bean.getSerializedSize(), header, sdf); + this.bean = bean; + } + + + @Override + public String toString() { + return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean); + } + +} diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/InfoFragment.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/InfoFragment.java index 7cf79e26e6..f1cdaed48e 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/InfoFragment.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/InfoFragment.java @@ -117,6 +117,8 @@ public class InfoFragment extends BaseFragment { adapter.setData(DataDistribution.getInstance().listArrivalNotification); } else if (Constants.TITLE.RECEIVE_STATUS_QUERY_RESP.equals(title)) { adapter.setData(DataDistribution.getInstance().listStatusInfo); + } else if (Constants.TITLE.RECEIVE_OBU_WARNING_DATA.equals(title)) { + adapter.setData(DataDistribution.getInstance().listObuWarningData); } else if (Constants.TITLE.RECEIVE_RECORD_DATA_CONFIG_RESP.equals(title)) { adapter.setData(DataDistribution.getInstance().listRecordDataConfig); } else if (Constants.TITLE.RECEIVE_GLOBAL_PATH_RESP.equals(title)) { diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java index 185f094cd6..538eea185c 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java @@ -64,6 +64,7 @@ import com.zhidao.adas.client.bean.GlobalPathResp; import com.zhidao.adas.client.bean.GnssInfo; import com.zhidao.adas.client.bean.IPCConnectState; import com.zhidao.adas.client.bean.MogoReportMessage; +import com.zhidao.adas.client.bean.ObuWarningData; import com.zhidao.adas.client.bean.OriginalPointCloudData; import com.zhidao.adas.client.bean.PerceptionTrafficLight; import com.zhidao.adas.client.bean.PlanningDecisionState; @@ -116,6 +117,7 @@ import chassis.Chassis; import chassis.VehicleStateOuterClass; import io.netty.channel.Channel; import mogo.telematics.pad.MessagePad; +import mogo.v2x.ObuWarningEvent; import mogo_msg.MogoReportMsg; import perception.TrafficLightOuterClass; import prediction.Prediction; @@ -642,6 +644,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas titleFragmentData.add(Constants.TITLE.RECEIVE_GLOBAL_PATH_RESP); titleFragmentData.add(Constants.TITLE.RECEIVE_ARRIVAL_NOTIFICATION); titleFragmentData.add(Constants.TITLE.RECEIVE_STATUS_QUERY_RESP); + titleFragmentData.add(Constants.TITLE.RECEIVE_OBU_WARNING_DATA); titleFragmentData.add(Constants.TITLE.RECEIVE_WARN); titleFragmentData.add(Constants.TITLE.RECEIVE_ERROR); @@ -1016,6 +1019,11 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas DataDistribution.getInstance().addData(base); } + @Override + public void onObuWarningData(MessagePad.Header header, ObuWarningEvent.ObuWarningData obuWarningData) { + ObuWarningData base = new ObuWarningData(header, obuWarningData, sdf); + DataDistribution.getInstance().addData(base); + } private void initAdas() { CupidLogUtils.e(TAG, "--->初始化"); diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java index 77a8b48dff..6214902d6d 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java @@ -168,6 +168,7 @@ public class Constants { String RECEIVE_WARN = MessageType.TYPE_RECEIVE_WARN.desc; String RECEIVE_ARRIVAL_NOTIFICATION = MessageType.TYPE_RECEIVE_ARRIVAL_NOTIFICATION.desc; String RECEIVE_STATUS_QUERY_RESP = MessageType.TYPE_RECEIVE_STATUS_QUERY_RESP.desc; + String RECEIVE_OBU_WARNING_DATA = MessageType.TYPE_RECEIVE_OBU_WARNING_DATA.desc; String RECEIVE_ERROR = "错误数据"; diff --git a/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java b/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java index c995bae83d..7c39af50bb 100644 --- a/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java +++ b/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java @@ -538,6 +538,10 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas } + @Override + public void onObuWarningData(MessagePad.Header header, ObuWarningEvent.ObuWarningData obuWarningData) { + + } private void initAdas() { CupidLogUtils.e(TAG, "--->初始化"); diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt index e2be4c4680..a58f67846a 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -52,6 +52,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsList import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerStartAutopilotFailedListenerManager.invokeStartAutopilotFailed import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager +import com.mogo.eagle.core.function.call.obucombine.CallerObuDcCombineListenerManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.zhidao.support.adas.high.AdasManager import com.zhidao.support.adas.high.OnAdasListener @@ -62,6 +63,7 @@ import com.zhjt.service.chain.ChainLog import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD import mogo.telematics.pad.MessagePad import mogo.telematics.pad.MessagePad.TrackedObject +import mogo.v2x.ObuWarningEvent import mogo_msg.MogoReportMsg import perception.TrafficLightOuterClass import prediction.Prediction @@ -441,7 +443,15 @@ class MoGoAdasListenerImpl : OnAdasListener { } } - + /** + * OBU预警事件 + * + * @param header 头 + * @param obuWarningData 数据 + */ + override fun onObuWarningData(header: MessagePad.Header?, obuWarningData: ObuWarningEvent.ObuWarningData?) { + CallerObuDcCombineListenerManager.invokeObuDcData(obuWarningData) + } /** * 是否可以启动自动驾驶 diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt index 9d8693a859..fea1d2b777 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt @@ -32,7 +32,10 @@ class MoGoObuProvider : IMoGoObuProvider { } override fun init(context: Context) { - CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress() + "--") + //obu融合数据 + MogoObuDcCombineManager.INSTANCE.init(context) + CallerLogger.d("${M_OBU}${MogoObuConst.TAG_MOGO_OBU}","MogoObuDcCombineManager 初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress() ) + CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress()) //bus乘客版本obu功能去掉 if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger( FunctionBuildConfig.appIdentityMode diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoObuDcCombineManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoObuDcCombineManager.kt new file mode 100644 index 0000000000..e410175dd6 --- /dev/null +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoObuDcCombineManager.kt @@ -0,0 +1,610 @@ +package com.mogo.eagle.core.function.obu.mogo + +import android.content.Context +import com.mogo.eagle.core.data.config.HmiBuildConfig +import com.mogo.eagle.core.data.enums.EventTypeEnumNew +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.obucombine.IMoGoObuDcCombineListener +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager +import com.mogo.eagle.core.function.call.obucombine.CallerObuDcCombineListenerManager +import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertDcCombineUtils +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU +import com.mogo.support.obu.constants.MogoObuConstants +import mogo.v2x.ObuWarningEvent +import mogo.v2x.ObuWarningEvent.* + + +/** + * + * @author lixiaopeng + * @since 2021/11/30 + * @description 工控机融合数据 + */ +class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener { + companion object { + val INSTANCE: MogoObuDcCombineManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { + MogoObuDcCombineManager() + } + } + + private var mContext: Context? = null + private val TAG = "MogoObuDcCombineManager" + + + fun init(context: Context) { + mContext = context + CallerObuDcCombineListenerManager.addListener(TAG, this) + } + + fun destoryListener() { + CallerObuDcCombineListenerManager.removeListener(TAG) + } + + /** + * 通过工控机中转的obu数据,包括rsi,rsm,spat + * + */ + override fun onMoGoObuDcCombineData(obuWarningData: ObuWarningEvent.ObuWarningData?) { + CallerLogger.d( + "${M_OBU}${TAG}", + "MogoObuDcCombineManager onMoGoObuDcCombineData obuWarningData = ${obuWarningData.toString()} ---obuWarningData.msgDataType = ${obuWarningData?.msgDataType}" + ) + + obuWarningData?.let { + when (obuWarningData.msgDataType) { + 1 -> { //rsiEvent + onMogoObuDcRsiWarning(obuWarningData.rsiEvent) + } + + 2 -> { //RsmEvent + onMogoObuDcRsmWarning(obuWarningData.rsmEvent) + } + + 3 -> { //SpatEvent + onMogoObuDcSpatWarning(obuWarningData.spatEvent) + } + + 4 -> { //map + onMogoObuMapMath(obuWarningData.mapMatchData) + } + } + } + + } + + /** + * RSI预警信息 CvxRtiThreatIndInfo(交通标志预警(前方限速、前方学校等等),交通事件预警(前方拥堵、前方积水等等)) + */ + fun onMogoObuDcRsiWarning(rsiWarningData: RsiWarningData?) { + CallerLogger.d( + "${M_OBU}${TAG}", + "MogoObuDcCombineManager onMogoObuRsiWarning ------> ${rsiWarningData.toString()}" + ) + if (rsiWarningData != null && rsiWarningData.warningMsgList != null && rsiWarningData.warningMsgList.size > 0) { + var alertContent = "" + var ttsContent = "" //TODO 列表还是只有一项吗? + var appId = rsiWarningData.warningMsgList[0].sceneType.toString() + val status = rsiWarningData.status + val level = rsiWarningData.warningMsgList[0].warningLevel + val direction = getMessageDirection(rsiWarningData.warningMsgList[0].targetPosition) + CallerLogger.d("${M_OBU}${TAG}", + "MogoObuDcCombineManager onMogoObuDcRsiWarning appId = $appId --status = $status --level = $level -- eventSerialNum = ${rsiWarningData.warningMsgList[0].eventSerialNum} ---signSerialNum = ${rsiWarningData.warningMsgList[0].signSerialNum} --- direction = $direction -- targetPosition = ${rsiWarningData.warningMsgList[0].targetPosition}" + ) + + when (appId) { + // 道路危险情况预警 + MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> { + when (rsiWarningData.warningMsgList[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 + } + } + alertContent = EventTypeEnumNew.getWarningContent(appId) + ttsContent = EventTypeEnumNew.getWarningTts(appId) + alertContent = String.format( //事件才有影响范围 + alertContent, + Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(), + Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString() + ) + ttsContent = String.format( + ttsContent, + Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(), + Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString() + ) + } + + //车内标牌 + MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> { + when (rsiWarningData.warningMsgList[0].signSerialNum) { +// MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口 +// appId = V2iEventTypeEnum.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_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 + } + } + + alertContent = EventTypeEnumNew.getWarningContent(appId) + ttsContent = EventTypeEnumNew.getWarningTts(appId) + alertContent = String.format( //标牌是没有影响范围的 + alertContent, + Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString() + ) + ttsContent = String.format( + ttsContent, + Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString() + ) + } + + // 拥堵 + 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(rsiWarningData.warningMsgList[0].distance / 100.0).toString(), + Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString() + ) + ttsContent = String.format( + ttsContent, + Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(), + Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString() + ) + } + + //限速预警, ADD处理一次 + MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> { + alertContent = EventTypeEnumNew.getWarningContent(appId) + ttsContent = EventTypeEnumNew.getWarningTts(appId) + } + } + + CallerLogger.d( + "${M_OBU}${TAG}", + "MogoObuDcCombineManager ttsContent = $ttsContent --alertContent = $alertContent --appId = $appId ---direction = ${direction.direction} --distance = ${rsiWarningData.warningMsgList[0].distance} ---eventRadius = ${rsiWarningData.warningMsgList[0].eventRadius} --speedMaxLimit = ${rsiWarningData.warningMsgList[0].speedMaxLimit}" + ) + when (status) { + // 添加 + MogoObuConstants.STATUS.ADD -> { + //显示警告红边 + CallerHmiManager.showWarning(direction) + CallerHmiManager.showWarningV2X( + appId, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + (appId + direction.direction),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 + object : IMoGoWarningStatusListener { + override fun onDismiss() { + // 关闭警告红边 + CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) + } + }, + true, + 5000L + ) + + // 更新数据,是否需要 +// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)?.let { +// CallerMapUIServiceManager.getMarkerService() +// ?.updateITrafficThreatLevelInfo(it) +// } + } + + MogoObuConstants.STATUS.UPDATE -> { // 更新 + } + + // 删除 + MogoObuConstants.STATUS.DELETE -> { + // 关闭警告红边 +// CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) + // 移除顶部弹窗 + CallerHmiManager.disableWarningV2X((appId + direction.direction)) + // 更新数据,删除标牌? +// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData) +// ?.let { +// // 事件结束,还原车辆颜色 +// it.threatLevel = 0x01 +// CallerMapUIServiceManager.getMarkerService() +// ?.updateITrafficInfo(it) +// } + } + } + } + } + + /** + * RSM预警信息 CvxPtcThreatIndInfo CvxPtcInfoIndInfo(主车与弱势交通参与者之间的预警(如:弱势交通参与者碰撞预警)) + */ + fun onMogoObuDcRsmWarning(rsmWarningData: RsmWarningData?) { + if (HmiBuildConfig.isShowObuWeaknessTrafficView) { + CallerLogger.d( + "${M_OBU}${TAG}", + "MogoObuDcCombineManager onMogoObuRsmWarning ------> ${rsmWarningData.toString()}" + ) + // 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu + if (rsmWarningData != null && rsmWarningData.participantOfOne != null) { + var v2xType = "" + if (rsmWarningData.participantOfOne.ptcType == 1) { //机动车 + v2xType = + EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType + } else if (rsmWarningData.participantOfOne.ptcType == 2) { //非机动车 + v2xType = + EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType + } else if (rsmWarningData.participantOfOne.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(rsmWarningData.participantOfOne.targetPosition) //TODO 只有一个 + if (rsmWarningData.warningMsg != null && rsmWarningData.warningMsg.warningDataList != null && rsmWarningData.warningMsg.warningDataList.size > 0) { + level = rsmWarningData.warningMsg.warningDataList[0].warningLevel + CallerLogger.d( + "${M_OBU}${TAG}", + "MogoObuDcCombineManager onMogoObuRsmWarning ---status---> ${rsmWarningData.status} --list status----> ${rsmWarningData.warningMsg.warningDataList.get(0).status} --v2xType--- $v2xType ---alertContent = $alertContent ---ttsContent= $ttsContent" + ) + + when (rsmWarningData.warningMsg.warningDataList.get(0).status) { + MogoObuConstants.STATUS.ADD -> { // 添加 +// 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, + 5000L + ) +// } + + // 更新数据 TODO + TrafficDataConvertDcCombineUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let { +// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it) + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } + } + + MogoObuConstants.STATUS.UPDATE -> {// 更新 + } + + // 删除 + MogoObuConstants.STATUS.DELETE -> { + // 关闭警告红边 + CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) + // 更新数据 TODO 由于obu通过域控需要转换单位,这里临时转换,后面3.0不需要转换 + TrafficDataConvertDcCombineUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let { + // 事件结束,还原交通参与者颜色 + it.threatLevel = 0x01 +// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it) + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } + //删除弱势交通元素 + CallerMapUIServiceManager.getMarkerService() + ?.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString()) +// TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString()) + } + } + } + } + } + + } + + /** + * 红绿灯预警信息 + */ + fun onMogoObuDcSpatWarning(spatWarningData: SpatWarningData?) { + CallerLogger.d("${M_OBU}${TAG}", "onMogoObuDcSpatWarning warningType = ${spatWarningData!!.warningType} --status = ${spatWarningData?.status} --lightsList = ${spatWarningData.lightsList}") + handlerTrafficLight( + spatWarningData!!.warningType, + spatWarningData?.status, + spatWarningData?.lightsList + ) + } + + /** + * 地图匹配 是OBU算法输出地图匹配结果,主车匹配道路哪条路或者哪条车道 + */ + fun onMogoObuMapMath(data: MapMatchData?) { + CallerLogger.d("${M_OBU}${TAG}", "MogoObuDcCombineManager onMogoObuMapMath HmiBuildConfig.isShowObuLimitSpeedView = " + HmiBuildConfig.isShowObuLimitSpeedView) + if(HmiBuildConfig.isShowObuLimitSpeedView) { + if (data != null) { + CallerLogger.d("${M_OBU}${TAG}", + "MogoObuDcCombineManager onMogoObuMapMath = ${data.status} --speedMaxLimit = ${Math.round((data.speedMaxLimit*0.02*3.6))} --- data.speedMaxLimit = ${data.speedMaxLimit}") + when (data.status) { + MogoObuConstants.STATUS.ADD -> { // 添加 + CallerHmiManager.showLimitingVelocity(Math.round((data.speedMaxLimit*0.02*3.6)).toInt()) + } + + MogoObuConstants.STATUS.UPDATE -> { // 更新 + } + + MogoObuConstants.STATUS.DELETE -> { // 删除 + CallerHmiManager.disableLimitingVelocity() + } + } + } + } + } + + /** + * 获取消息的方位 车辆相关 + */ + private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum { + return when (targetClassification) { + MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE, + MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方 + + MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方 + + MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方 + + MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方 + + MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT, + MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT + -> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方 + + MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT, + MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT + -> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方 + + MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT, + -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方 + + MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT, + -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方 + + MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知 + else -> WarningDirectionEnum.ALERT_WARNING_ALL + } + } + + /** + * 处理红绿灯 + */ + private fun handlerTrafficLight(appId: Int, status: Int, lights: List) { + CallerLogger.d( + "${M_OBU}${TAG}", + "MogoObuDcCombineManager handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId" + ) + when (status) { + // 添加 + MogoObuConstants.STATUS.ADD, + MogoObuConstants.STATUS.UPDATE + -> { + if (lights != null && lights.isNotEmpty()) { + changeTrafficLightStatus(appId, lights) + } + } + // 删除 + MogoObuConstants.STATUS.DELETE -> { + // 移除顶部弹窗,当收不到信号的时候触发一次 + CallerHmiManager.disableWarningTrafficLight() + CallerHmiManager.disableWarningV2X(appId.toString()) + isShowGreenWave = false + isShowRunRedLight = false + } + } + } + + private var isRedLight = false + private var isGreenLight = false + private var isShowGreenWave = false + private var isShowRunRedLight = false + + /** + * 修改红绿灯 + */ + @Synchronized + private fun changeTrafficLightStatus( + appId: Int, + lights: List + ) { + var ttsContent = "" + var alertContent = "" + //这里需要根据真实数据确定 index 取值方式 + val currentLight = lights[0] + CallerLogger.e( + "${M_OBU}${TAG}", + "MogoObuDcCombineManager currentLight = $currentLight ---currentLight.phaseID = ${currentLight.phaseID} ---appId = $appId ---isShowRunRedLight = $isShowRunRedLight ---isShowGreenWave = $isShowGreenWave" + ) + + // 闯红灯预警和绿波通行底层是互斥的 + when (appId) { + 0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效 + + } + 1 -> { //闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次 + if (!isShowRunRedLight) { + isShowRunRedLight = true + CallerHmiManager.disableWarningV2X(2.toString()) + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType) + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType) + CallerLogger.d("${M_OBU}${TAG}","MogoObuDcCombineManager changeTrafficLightStatus 闯红灯 --------> ttsContent = $ttsContent ---alertContent = $alertContent ") + CallerHmiManager.showWarningV2X( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, null, true, 5000L) + } + } + + 2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 + if (!isShowGreenWave) { + isShowGreenWave = true + CallerHmiManager.disableWarningV2X(1.toString()) + CallerLogger.d( + "${M_OBU}${TAG}", + "MogoObuDcCombineManager 绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}") + val adviceSpeed = + "${Math.round(currentLight.suggestMinSpeed*3.6*0.02)} - ${Math.round(currentLight.suggestMaxSpeed*3.6*0.02)}" + val adviceSpeedTts = + "${Math.round(currentLight.suggestMinSpeed*3.6*0.02)} - ${Math.round(currentLight.suggestMaxSpeed*3.6*0.02)}" + + ttsContent = + String.format( + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), + adviceSpeedTts + ) + alertContent = + String.format( + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), + adviceSpeed + ) + val maxSpeed = currentLight.suggestMaxSpeed*3.6 + if (maxSpeed > 0) { + CallerHmiManager.showWarningV2X( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + null, + true, + 5000L + ) + + } + } + } + } + + when (currentLight.light) { + // 灯光不可用 + 0 -> { + CallerHmiManager.showWarningTrafficLight(0, 2) + } + + // 红灯 + 2, 3 -> { + if (!isRedLight) { + CallerHmiManager.disableWarningV2X(appId.toString()) + isRedLight = true + } + isGreenLight = false + CallerHmiManager.showWarningTrafficLight(1, 2) + val red = currentLight.countDown / 10 + CallerHmiManager.changeCountdownRed(red) + } + + // 绿灯 + 4, 5, 6 -> { + if (!isGreenLight) { + CallerHmiManager.disableWarningV2X(appId.toString()) + isGreenLight = true + } + isRedLight = false + CallerHmiManager.showWarningTrafficLight(3, 2) + val green = currentLight.countDown / 10 + CallerHmiManager.changeCountdownGreen(green) + } + + // 黄灯 + 7, 8 -> { + CallerHmiManager.disableWarningV2X(appId.toString()) + CallerHmiManager.showWarningTrafficLight(2, 2) + val yellow = currentLight.countDown / 10 + CallerHmiManager.changeCountdownYellow(yellow) + } + } + } + +} diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertDcCombineUtils.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertDcCombineUtils.kt new file mode 100644 index 0000000000..721454634b --- /dev/null +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertDcCombineUtils.kt @@ -0,0 +1,97 @@ +package com.mogo.eagle.core.function.obu.mogo.utils + +import android.util.Log +import com.mogo.eagle.core.data.enums.TrafficTypeEnum +import com.mogo.eagle.core.data.traffic.TrafficData +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU +import com.mogo.support.obu.model.MogoObuRsiWarningData +import com.mogo.support.obu.model.MogoObuRsmWarningData +import com.mogo.support.obu.model.MogoObuRvWarningData +import mogo.v2x.ObuWarningEvent + +/** + * @description 自研obu数据通过工控机转发 + * + * @author lixiaopeng + * @since 2022/12/2 + */ +object TrafficDataConvertDcCombineUtils { + val TAG = "TrafficDataConvertDcCombineUtils" + + /** + * OBU RSU道路事件预警信息 转换交通元素数据 标牌 为何要显示level + */ + fun cvxRtiThreatIndInfo2TrafficData(info: MogoObuRsiWarningData): TrafficData? { + if (info.warningMsg == null || info.warningMsg.size < 1 || info.warningMsg[0].position == null) { + CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") + return null + } + val trafficData = TrafficData() + trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG + trafficData.uuid = info.warningMsg[0].signSerialNum.toString() + trafficData.lat = info.warningMsg[0].position.latitude + trafficData.lon = info.warningMsg[0].position.longitude + trafficData.threatLevel = info.warningMsg[0].warningLevel + Log.e("liyz", "cvxRtiThreatIndInfo2TrafficData trafficData -- ${trafficData.toString()}") + return trafficData + } + + /** + * OBU 弱势交通参与者信息 转换交通元素数据 + */ + fun cvxPtcThreatIndInfo2TrafficData(info: ObuWarningEvent.RsmWarningData): TrafficData? { + if (info.participantOfOne == null) { + CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") + Log.e("liyz", "cvxPtcThreatIndInfo2TrafficData info.participant ") + return null + } + val trafficData = TrafficData() + trafficData.uuid = info.participantOfOne.ptcID.toString() + trafficData.lat = info.participantOfOne.latitude / 10000000.0 + trafficData.lon = info.participantOfOne.longitude / 10000000.0 + trafficData.heading = info.participantOfOne.heading / 80.0 + trafficData.speed = info.participantOfOne.speed / 50.0 + + CallerLogger.e( + "${M_OBU}${"MogoObuDcCombineManager"}", + " cvxPtcThreatIndInfo2TrafficData ---uuid---> ${trafficData.uuid} --lat-- ${trafficData.lat} --lon-- ${trafficData.lon} --heading-- ${trafficData.heading} --speed-- ${trafficData.speed} --type --${info.participantOfOne.ptcType}" + ) + + when (info.participantOfOne.ptcType) { + // 未知 + 0 -> { + trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI + } + //机动车 + 1 -> { + trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO + } + // 非机动车 + 2 -> { + trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE + } + // 行人 + 3 -> { + trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE + } + } + + /** + * 交通参与者类型 + * 0:未知 + * 1:机动车 + * 2:非机动车 + * 3:行人 + * 4:OBU自身 + */ + // 判断车辆V2X预警级别,调整车辆颜色 + if (info.warningMsg != null && info.warningMsg.warningDataList != null) { + trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel + } else { + trafficData.threatLevel = 1 + } + return trafficData + } + +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/DcEventTypeEnumNew.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/DcEventTypeEnumNew.kt new file mode 100644 index 0000000000..7ede723b3a --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/DcEventTypeEnumNew.kt @@ -0,0 +1,1060 @@ +package com.mogo.eagle.core.data.enums + +import com.mogo.eagle.core.data.R + +/** + * OBU、V2N事件类型枚举类, 自研sdk版本的OBU + * + */ +enum class DcEventTypeEnumNew( + val poiType: String, val poiTypeStr: String = "", + val poiTypeStrVr: String = "", + val poiTypeSrcVr: Int = R.drawable.v2x_icon_live_logo, + val content: String = "", val tts: String = "" +) { + + //交通检查 + TRAFFIC_CHECK( + "10002", "交通检查", "前方交通检查", + R.drawable.v2x_icon_jiaotongjiancha_vr, "前方交通检查", "交通检查" + ), + + //封路 + ROAD_CLOSED( + "10003", "封路", "前方封路", R.drawable.v2x_icon_fenglu_vr, + "前方封路", "道路封路" + ), + + //施工 + FOURS_ROAD_WORK( + "10006", "注意施工占道", "注意施工占道", R.drawable.icon_warning_v2x_road_construction, + "注意施工占道", "注意施工占道" + ), + + //施工-AI云下发 + AI_ROAD_WORK( + "100061", "道路施工", "前方施工", R.drawable.icon_warning_v2x_road_construction, + "前方施工", "道路施工" + ), + + //拥堵 + FOURS_BLOCK_UP( + "10007", "道路拥堵", "前方拥堵", R.drawable.icon_warning_v2x_congestion, + "前方道路拥堵", "道路拥堵" + ), + + //积水 + FOURS_PONDING( + "10008", "道路积水", "前方道路积水", R.drawable.v2x_icon_jishui_vr, + "前方道路积水", "道路积水" + ), + + //浓雾 + FOURS_FOG( + "10010", "出现浓雾", "浓雾预警", R.drawable.v2x_icon_nongwu_vr, + "前方出现浓雾", "出现浓雾" + ), + + //结冰 + FOURS_ICE( + "10011", "路面结冰", "路面结冰", R.drawable.v2x_icon_jiebing_vr, + "前方路面结冰", "路面结冰" + ), + + //事故 + FOURS_ACCIDENT( + "10013", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr, + "前方交通事故", "交通事故" + ), + + //重大事故 + FOURS_ACCIDENT_01( + "1001301", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr, + "前方交通事故", "交通事故" + ), + + //特大事故 + FOURS_ACCIDENT_02( + "1001302", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr, + "前方交通事故", "交通事故" + ), + + //较大事故 + FOURS_ACCIDENT_03( + "1001303", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr, + "前方交通事故", "交通事故" + ), + + //一般事故 + FOURS_ACCIDENT_04( + "1001304", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr, + "前方交通事故", "交通事故" + ), + + //轻微事故 + FOURS_ACCIDENT_05( + "1001305", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr, + "前方交通事故", "交通事故" + ), + + //实时路况 + FOURS_LIVING("10015", "实时路况"), + + //违章停车 + ILLEGAL_PARK_LIVING("10016"), + + //路面湿滑 + ROAD_SLIPPERY("10021"), + + //鬼探头类型 + GHOST_PROBE("10024", "前方盲区行人预警", "前方盲区行人预警", R.drawable.icon_warning_v2x_pedestrian_crossing, + "前方盲区行人通行,请注意", "前方盲区即将有行人通过,请减速慢行"), + + // 前方静止or慢速车辆报警 + ALERT_FRONT_CAR("99999"), + + // 限行管理 + ALERT_TRAFFIC_CONTROL("99998"), + + // 红绿灯事件、是建议以多少速度驶过 + ALERT_TRAFFIC_LIGHT_SUGGEST("99997"), + + // 红绿灯事件、一种是绿灯不足3秒 + ALERT_TRAFFIC_LIGHT_WARNING("99996"), + + // 故障车辆 + ALERT_CAR_TROUBLE_WARNING("20007"), + + // 疲劳驾驶 + ALERT_FATIGUE_DRIVING("99993"), + + // 违章停车 + ALERT_ILLEGAL_PARK("99992"), + + //-------------v2n start ------------> + TYPE_USECASE_ID_FCW( + 2000.toString(), + "前向碰撞预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning, + content = "前车碰撞预警", + tts = "小心前车" + ), + // TYPE_USECASE_ID_ICW( + // 1.toString(), + // "交叉路口碰撞预警", + // poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning, + // content = "交叉路口碰撞预警", + // tts = "注意交叉路口车辆" + // ), + TYPE_USECASE_ID_LTA( + 2001.toString(), + "左转辅助", + poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning, + content = "左转碰撞预警", + tts = "注意路口对向来车" + ), + TYPE_USECASE_ID_BSW( + 2002.toString(), + "盲区预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_blind_area_collision, + content = "%s后盲区预警", + tts = "注意%s后车辆" + ), + TYPE_USECASE_ID_LCW( + 2003.toString(), + "变道预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_reverse_overtaking, + content = "%s向变道预警", + tts = "注意%s后车辆" + ),//注意左后车辆/注意右后车辆 + TYPE_USECASE_ID_DNPW( + 2004.toString(), + "逆向超车预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_reverse_overtaking, + content = "逆向超车预警", + tts = "注意对向来车" + ), + TYPE_USECASE_ID_EBW( + 2005.toString(), + "紧急制动预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_emergency_brake, + content = "前车急刹车", + tts = "前车急刹车" + ), + + TYPE_USECASE_ID_AVW( + 2006.toString(), + "异常车辆提醒", + poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle, + content = "%s车异常", + tts = "小心%s异常车辆" + ), + TYPE_USECASE_ID_CLW( + 2007.toString(), + "车辆失控预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_vehicle_control, + content = "前%s失控预警", + tts = "小心%s失控车辆" + ), + TYPE_USECASE_ID_EVW( + 2008.toString(), + "紧急车辆提醒", + poiTypeSrcVr = R.drawable.icon_warning_v2x_special_vehicle_access, + content = "注意特种车辆通行", + tts = "请避让特种车辆" + ), + //-------------v2n end ------------> + + + //---------弱势交通参与者 start ------> + TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES( + 1001.toString(), + "弱势交通参与者碰撞预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_motorcycle_collision, + content = "注意机动车", + tts = "注意机动车" + ), + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES( + 1002.toString(), + "弱势交通参与者碰撞预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_motobike, + content = "注意非机动车", + tts = "注意非机动车" + ), + TYPE_USECASE_ID_VRUCW_PERSON( + 1003.toString(), + "弱势交通参与者碰撞预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_pedestrian_crossing, + content = "注意行人", + tts = "注意行人" + ), + TYPE_ERROR_WEAKNESS( + 1006.toString(), + "未知/错误/异常", + poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle, + content = "前方有未知障碍物", + tts = "前方有未知障碍物" + ), + //---------弱势交通参与者 end --------> + + + //--------------红绿灯 start -------> + TYPE_USECASE_ID_IVP_RED( //1666,1667 需要同步 TODO + 1666.toString(), + "闯红灯预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_red, + content = "路口红灯,禁止通行", + tts = "路口红灯,禁止通行" + ), + + TYPE_USECASE_ID_IVP_GREEN( + 1667.toString(), + "绿波通行", + poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_green, + content = "建议车速 %s KM/H", + tts = "建议车速 %s KM/H" + ), + //-------------红绿灯 end ----------> + + //-----------道路危险情况预警 start ---------------> + TYPE_USECASE_ID_BREAKDOWN_WARNING( //故障车辆 + 101.toString(), + "车辆故障", + poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning, + content = "前方%s米有故障车辆,影响路段%s米", + tts = "前方%s米有故障车辆,影响路段%s米" + ), + TYPE_FOURS_PONDING( //积水 + 407.toString(), + "道路积水", + poiTypeSrcVr = R.drawable.v2x_icon_jishui_vr, + content = "前方%s米道路积水,影响路段%s米", + tts ="前方%s米道路积水,影响路段%s米" + ), + TYPE_USECASE_ID_ROAD_PARKING( //异常停车 + 412.toString(), + "异常停车", + poiTypeSrcVr = R.drawable.icon_warning_v2x_no_parking, + content = "前方%s米异常停车,影响路段%s米", + tts = "前方%s米异常停车,影响路段%s米" + ), + TYPE_USECASE_ID_TJW( //%d + 707.toString(), + "拥堵", + poiTypeSrcVr = R.drawable.icon_warning_v2x_congestion, + content = "前方%s米拥堵,影响路段%s米", + tts = "前方%s米拥堵,影响路段%s米" + ), + TYPE_USECASE_ID_SLW( //超速行驶 + 901.toString(), + "超速行驶", + poiTypeSrcVr = R.drawable.icon_warning_v2x_over_speed, + content = "前方%s米超速行驶,影响路段%s米", + tts = "前方%s米超速行驶,影响路段%s米" + ), + TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE( //车辆逆行 + 904.toString(), + "逆行车辆", + poiTypeSrcVr = R.drawable.icon_default, + content = "前方%s米逆行车辆,影响路段%s米", + tts = "前方%s米逆行车辆,影响路段%s米" + ), + TYPE_USECASE_ID_ROAD_SPEED_LIMIT( //--> + 6666.toString(), + "超速", + poiTypeSrcVr = R.drawable.icon_warning_v2x_over_speed, + content = "您已超速,请减速行驶", + tts = "您已超速,请减速行驶" + ), + //------------道路危险情况预警 end -----------> + + + //------------车内标牌 start --------------> + TYPE_ID_SHAPR_TURNS( + 2.toString(), + "急转弯", + poiTypeSrcVr = R.drawable.icon_warning_v2x_turn_left_sharp, + content = "前方%s米急转弯", + tts = "前方%s米急转弯" + ), + TYPE_ID_BRIDGE( + 8.toString(), + "桥梁", + poiTypeSrcVr = R.drawable.icon_warning_v2x_hump_bridge, + content = "前方%s米桥梁", + tts = "前方%s米桥梁" + ), + TYPE_ID_PEDESTRIAN( + 10.toString(), + "行人", + poiTypeSrcVr = R.drawable.icon_warning_v2x_pedestrian_crossing, + content = "前方%s米行人", + tts = "前方%s米行人" + ), + TYPE_ID_SLIPPERY_ROAD( + 17.toString(), + "路滑", + poiTypeSrcVr = R.drawable.v2x_icon_jiebing_vr, + content = "前方%s米路滑", + tts = "前方%s米路滑" + ), + TYPE_ID_TUNNEL( + 21.toString(), + "隧道", + poiTypeSrcVr = R.drawable.icon_default, + content = "前方%s米隧道", + tts = "前方%s米隧道" + ), + TYPE_ID_FERRY( + 22.toString(), + "渡轮", + poiTypeSrcVr = R.drawable.icon_default, + content = "前方%s米渡轮", + tts = "前方%s米渡轮" + ), + TYPE_ID_UNEVEN_ROAD( + 24.toString(), + "路面不平", + poiTypeSrcVr = R.drawable.icon_warning_road_hollow, + content = "前方%s米路面不平", + tts = "前方%s米路面不平" + ), + TYPE_ID_NON_MOTOR_VEHICLE( + 32.toString(), + "非机动车", + poiTypeSrcVr = R.drawable.icon_warning_v2x_motobike, + content = "前方%s米有非机动车", + tts = "前方%s米有非机动车" + ), + TYPE_ID_OBSTACLE( + 36.toString(), + "障碍", + poiTypeSrcVr = R.drawable.icon_default, + content = "前方%s米障碍", + tts = "前方%s米障碍" + ), + TYPE_FOURS_ROAD_WORK( + 38.toString(), + "施工", + poiTypeSrcVr = R.drawable.icon_warning_v2x_road_construction, + content = "前方%s米施工", + tts = "前方%s米施工" + ), + TYPE_VEHICLE_QUEUE( + 47.toString(), + "车队", + poiTypeSrcVr = R.drawable.icon_default, + content = "前方%s米车队", + tts = "前方%s米车队" + ), + TYPE_NO_PASSING( + 51.toString(), + "不通", + poiTypeSrcVr = R.drawable.v2x_icon_fenglu_vr, + content = "前方%s米不通", + tts = "前方%s米不通" + ), + TYPE_NO_TURNING_AROUND( + 75.toString(), + "禁止掉头", + poiTypeSrcVr = R.drawable.icon_default, + content = "前方%s米禁止掉头", + tts = "前方%s米禁止掉头" + ), + TYPE_USECASE_ID_ROAD_NO_PARKING( + 78.toString(), + "禁止停车", + poiTypeSrcVr = R.drawable.icon_warning_v2x_no_parking, + content = "前方%s米禁止停车", + tts = "前方%s米禁止停车" + ), + TYPE_USECASE_ID_ROAD_NO_TOOTING( + 80.toString(), + "禁止鸣笛", + poiTypeSrcVr = R.drawable.icon_warning_v2x_no_tooting, + content = "前方%s米禁止鸣笛", + tts = "前方%s米禁止鸣笛" + ), + TYPE_USECASE_ID_BUS_WARNING( + 123.toString(), + "公交提醒", + poiTypeSrcVr = R.drawable.icon_warning_v2x_tramcar, + content = "前方%s米公交提醒", + tts = "前方%s米公交提醒" + ), + TYPE_USECASE_ID_NARROW_RIGHT( + 163.toString(), + "右侧变窄/车道数减少", + poiTypeSrcVr = R.drawable.icon_default, + content = "前方%s米右侧变窄/车道数减少", + tts = "前方%s米右侧变窄/车道数减少" + ), + TYPE_USECASE_ID_GAS_STATION( + 201.toString(), + "加油站", + poiTypeSrcVr = R.drawable.icon_warning_gas_station, + content = "前方%s米加油站", + tts = "前方%s米加油站" + ), + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL( + 242.toString(), + "学校", + poiTypeSrcVr = R.drawable.icon_warning_v2x_school, + content = "前方%s米学校", + tts = "前方%s米学校" + ), + TYPE_USECASE_ID_ACCIDENT( + 244.toString(), + "事故", + poiTypeSrcVr = R.drawable.v2x_icon_jiaotongshigu_vr, + content = "前方%s米事故", + tts = "前方%s米事故" + ), + //------------车内标牌 end --------------> + + + TYPE_ERROR( + 0.toString(), + "未知/错误/异常", + poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle, + content = "", + tts = "" + ), + + TYPE_VIP_IDENTIFICATION("10022", "", "", R.drawable.icon_warning_v2x_vip_turn_light, "VIP车辆优先通行", "已为您变灯,请优先通行"), + + TYPE_OPTIMAL_ROUTE_RECOMMEND("2000", "", "", R.drawable.icon_warning_v2x_optimal_route, "为您推荐最优路线", "已为您选择最优路线"); + + + companion object { + @JvmStatic + fun getPoiTypeStr(poiType: String): String { + // 先获取网络配置的poi对应的名称 TODO +// CloudPoiManager.getInstance().getWrapperByPoiType(poiType)?.let { +// return it.title +// } + // 如果获取不到,那么就用本地默认的 + return when (poiType) { + TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeStr + ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeStr + FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStr + AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeStr + FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStr + FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStr + FOURS_FOG.poiType -> FOURS_FOG.poiTypeStr + FOURS_ICE.poiType -> FOURS_ICE.poiTypeStr + + FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, + FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, + FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeStr + + FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStr + GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeStr + else -> "其它道路事件" + } + } + + @JvmStatic + fun getPoiTypeStrVr(poiType: String): String { + return when (poiType) { + TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeStrVr + ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeStrVr + FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStrVr + AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeStrVr + FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStrVr + FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStrVr + FOURS_FOG.poiType -> FOURS_FOG.poiTypeStrVr + FOURS_ICE.poiType -> FOURS_ICE.poiTypeStrVr + + FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, + FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, + FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeStrVr + + FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStrVr + GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeStrVr + else -> "其它道路事件" + } + } + + @JvmStatic + fun getPoiTypeSrcVr(poiType: String): Int { + return when (poiType) { + TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeSrcVr + ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeSrcVr + FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeSrcVr + AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeSrcVr + FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeSrcVr + FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeSrcVr + FOURS_FOG.poiType -> FOURS_FOG.poiTypeSrcVr + FOURS_ICE.poiType -> FOURS_ICE.poiTypeSrcVr + + FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, + FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, + FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeSrcVr + + FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeSrcVr + else -> R.drawable.v2x_icon_live_logo + } + } + + /** + * 获取道路事件的背景色 + */ + @JvmStatic + fun getPoiTypeBg(poiType: String, isVrMode: Boolean): Int { +// return when (poiType) { //TODO +// FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType-> if (isVrMode) R.drawable.bg_v2x_event_type_orange_vr else R.drawable.bg_v2x_event_type_orange +// TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, +// FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, +// FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, +// FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read +// else -> { +// if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read +// } +// } + return 0 + } + + @JvmStatic + fun getPoiTypeBgForShareItem(poiType: String): Int { +// return when (poiType) { //TODO +// FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType -> +// R.drawable.bg_v2x_event_type_orange +// TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, +// FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, FOURS_PONDING.poiType, +// FOURS_FOG.poiType, FOURS_ICE.poiType, +// FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, +// FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, +// FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> +// R.drawable.bg_v2x_event_type_read +// else -> R.drawable.bg_v2x_event_type_read +// } + return 0 + } + + /** + * 判断是否是道路预警事件 + */ + @JvmStatic + fun isRoadEvent(poiType: String?): Boolean { + return when (poiType) { + TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, + FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, FOURS_BLOCK_UP.poiType, + FOURS_PONDING.poiType, FOURS_FOG.poiType, + FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, + FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, + FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, + FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType, AI_ROAD_WORK.poiType -> true + else -> false + } + } + + /** + * 是否需要UGC预警 + */ + @JvmStatic + fun isNeedRoadEventUgc(poiType: String?): Boolean { + return when (poiType) { + ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, + FOURS_BLOCK_UP.poiType, FOURS_ACCIDENT.poiType, + FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, + FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, + FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType -> true + else -> false + } + } + + + @JvmStatic + fun getTts(poiType: String?): String { + return when (poiType) { + TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.tts + ROAD_CLOSED.poiType -> ROAD_CLOSED.tts + FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts + AI_ROAD_WORK.poiType -> AI_ROAD_WORK.tts + FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.tts + FOURS_PONDING.poiType -> FOURS_PONDING.tts + FOURS_FOG.poiType -> FOURS_FOG.tts + FOURS_ICE.poiType -> FOURS_ICE.tts + FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, + FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.tts + else -> "道路事件" + } + } + + @JvmStatic + fun getTtsWithFeedback(poiType: String?): String { + return when (poiType) { + TRAFFIC_CHECK.poiType -> "交通检查" + ROAD_CLOSED.poiType -> "封路" + FOURS_ROAD_WORK.poiType -> "施工" + AI_ROAD_WORK.poiType -> "施工" + FOURS_BLOCK_UP.poiType -> "道路拥堵" + FOURS_PONDING.poiType -> "道路积水" + FOURS_FOG.poiType -> "出现浓雾" + FOURS_ICE.poiType -> "路面结冰" + FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, + FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故" + else -> "道路事件" + } + } + + @JvmStatic + fun getAlarmContent(poiType: String?): String { + return when (poiType) { + TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.content + ROAD_CLOSED.poiType -> ROAD_CLOSED.content + FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content + AI_ROAD_WORK.poiType -> AI_ROAD_WORK.content + FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.content + FOURS_PONDING.poiType -> FOURS_PONDING.content + FOURS_FOG.poiType -> FOURS_FOG.content + FOURS_ICE.poiType -> FOURS_ICE.content + FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, + FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> + FOURS_ACCIDENT.content + GHOST_PROBE.poiType -> GHOST_PROBE.content + else -> "道路事件" + } + } + + @JvmStatic + fun getTypeSmallRes(type: String): Int { +// return when (type) { //TODO +// TRAFFIC_CHECK.poiType -> +// R.drawable.mogo_image_jiaotongjiancha_small +// ROAD_CLOSED.poiType -> R.drawable.mogo_image_fenglu_small +// FOURS_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_small +// AI_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_small +// FOURS_BLOCK_UP.poiType -> R.drawable.mogo_image_yongdu_small +// FOURS_PONDING.poiType -> R.drawable.mogo_image_jishui_small +// FOURS_ICE.poiType -> R.drawable.mogo_image_jiebing_small +// FOURS_FOG.poiType -> R.drawable.mogo_image_nongwu_small +// FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, +// FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> +// R.drawable.mogo_image_accident_small +// else -> R.drawable.mogo_image_shishilukuang_small +// } + return 0 + } + + @JvmStatic + fun getTypeRes(type: String): Int { +// return when (type) { //TODO +// TRAFFIC_CHECK.poiType -> R.drawable.mogo_image_jiaotongjiancha_nor +// ROAD_CLOSED.poiType -> R.drawable.mogo_image_fenglu_nor +// FOURS_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_nor +// AI_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_nor +// FOURS_BLOCK_UP.poiType -> R.drawable.mogo_image_yongdu_nor +// FOURS_PONDING.poiType -> R.drawable.mogo_image_jishui_nor +// FOURS_ICE.poiType -> R.drawable.mogo_image_jiebing_nor +// FOURS_FOG.poiType -> R.drawable.mogo_image_nongwu_nor +// FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, +// FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> +// R.drawable.mogo_image_jiaotongshigu_nor +// else -> R.drawable.mogo_image_shishlukuang_nor +// } + return 0 + } + + @JvmStatic + fun getTypeName(type: String?): String { + return when (type) { + ROAD_CLOSED.poiType -> "封路" + FOURS_ICE.poiType -> "道路结冰" + FOURS_FOG.poiType -> "浓雾" + TRAFFIC_CHECK.poiType -> "交通检查" + FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, + FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故" + FOURS_BLOCK_UP.poiType -> "拥堵" + FOURS_ROAD_WORK.poiType -> "施工" + AI_ROAD_WORK.poiType -> "施工" + FOURS_PONDING.poiType -> "道路积水" + else -> "实时路况" + } + } + + @JvmStatic + fun getMarker3DRes(poiType: String?): Int { + return when (poiType) { + FOURS_BLOCK_UP.poiType -> R.raw.v2x_yongdu + FOURS_ACCIDENT.poiType -> R.raw.v2x_shigu + FOURS_LIVING.poiType -> R.raw.v2x_shishilukuang + FOURS_FOG.poiType -> R.raw.v2x_nongwu + TRAFFIC_CHECK.poiType -> R.raw.v2x_jiaotongjiancha + FOURS_ROAD_WORK.poiType -> R.raw.v2x_daolushigong + AI_ROAD_WORK.poiType -> R.raw.v2x_daolushigong + FOURS_ICE.poiType -> R.raw.v2x_daolujiebing + FOURS_PONDING.poiType -> R.raw.v2x_daolujishui + GHOST_PROBE.poiType -> R.raw.v2x_guzhangqiuzhu + else -> 0 + } + } + + @JvmStatic + fun getTypeNameTTS(type: String?): String { + return when (type) { + ROAD_CLOSED.poiType -> "封路" + FOURS_ICE.poiType -> "道路结冰" + FOURS_FOG.poiType -> "浓雾" + TRAFFIC_CHECK.poiType -> "交通检查" + FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, + FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故" + FOURS_BLOCK_UP.poiType -> "拥堵" + FOURS_ROAD_WORK.poiType -> "施工" + AI_ROAD_WORK.poiType -> "施工" + FOURS_PONDING.poiType -> "道路积水" + else -> "实时路况" + } + } + + @JvmStatic + fun getUpdateIconRes(poiType: String?): Int { + return when (poiType) { + //交通检查 TODO 先注释 到时候和EventTypeEnumNew合并 再打开 +// TRAFFIC_CHECK.poiType -> { +// R.drawable.v_to_x_marker_2 +// } +// //封路 +// ROAD_CLOSED.poiType -> { +// R.drawable.v_to_x_marker_16 +// } +// //施工 +// FOURS_ROAD_WORK.poiType -> { +// R.drawable.v_to_x_marker_11 +// } +// //AI施工 +// AI_ROAD_WORK.poiType -> { +// R.drawable.v_to_x_marker_11 +// } +// //拥堵 +// FOURS_BLOCK_UP.poiType -> { +// R.drawable.v_to_x_marker_5 +// } +// //积水 +// FOURS_PONDING.poiType -> { +// R.drawable.v_to_x_marker_6 +// } +// //浓雾 +// FOURS_FOG.poiType -> { +// R.drawable.v_to_x_marker_9 +// } +// //结冰 +// FOURS_ICE.poiType -> { +// R.drawable.v_to_x_marker_8 +// } +// //事故 +// FOURS_ACCIDENT.poiType -> { +// R.drawable.v_to_x_marker_7 +// } +// //事故 +// FOURS_LIVING.poiType -> { +// R.drawable.v_to_x_marker_1 +// } +// //红绿灯数据 +// ALERT_TRAFFIC_LIGHT_SUGGEST.poiType -> { +// R.drawable.v_to_x_marker_3 +// } +// //红绿灯数据 +// ALERT_TRAFFIC_LIGHT_WARNING.poiType -> { +// R.drawable.v_to_x_marker_3 +// } +// //前方静止or慢速车辆报警 +// ALERT_FRONT_CAR.poiType -> { +// R.drawable.v_to_x_warning_car_red +// } +// // 故障车辆 +// ALERT_CAR_TROUBLE_WARNING.poiType -> { +// R.drawable.icon_car_red +// } + + //闯红灯预警 + TYPE_USECASE_ID_IVP_RED.poiType -> { + R.drawable.icon_warning_v2x_traffic_lights_red + } + //绿波通行 + TYPE_USECASE_ID_IVP_GREEN.poiType -> { + R.drawable.icon_warning_v2x_traffic_lights_green + } + + //机动车 + TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType -> { + R.drawable.icon_warning_v2x_motorcycle_collision + } + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> { + R.drawable.icon_warning_v2x_motobike + } + TYPE_USECASE_ID_VRUCW_PERSON.poiType -> { + R.drawable.icon_warning_v2x_pedestrian_crossing + } + TYPE_ERROR_WEAKNESS.poiType -> { + R.drawable.icon_warning_v2x_abnormal_vehicle + } + + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeSrcVr + TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.poiTypeSrcVr + TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.poiTypeSrcVr + TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType -> TYPE_USECASE_ID_BREAKDOWN_WARNING.poiTypeSrcVr + FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_PARKING.poiType -> TYPE_USECASE_ID_ROAD_PARKING.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType -> TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiTypeSrcVr + TYPE_ID_SHAPR_TURNS.poiType -> TYPE_ID_SHAPR_TURNS.poiTypeSrcVr + TYPE_ID_BRIDGE.poiType -> TYPE_ID_BRIDGE.poiTypeSrcVr + TYPE_ID_PEDESTRIAN.poiType -> TYPE_ID_PEDESTRIAN.poiTypeSrcVr + TYPE_ID_SLIPPERY_ROAD.poiType -> TYPE_ID_SLIPPERY_ROAD.poiTypeSrcVr + TYPE_ID_TUNNEL.poiType -> TYPE_ID_TUNNEL.poiTypeSrcVr + TYPE_ID_FERRY.poiType -> TYPE_ID_FERRY.poiTypeSrcVr + TYPE_ID_UNEVEN_ROAD.poiType -> TYPE_ID_UNEVEN_ROAD.poiTypeSrcVr + TYPE_ID_NON_MOTOR_VEHICLE.poiType -> TYPE_ID_NON_MOTOR_VEHICLE.poiTypeSrcVr + TYPE_ID_OBSTACLE.poiType -> TYPE_ID_OBSTACLE.poiTypeSrcVr + TYPE_FOURS_ROAD_WORK.poiType -> TYPE_FOURS_ROAD_WORK.poiTypeSrcVr + TYPE_VEHICLE_QUEUE.poiType -> TYPE_VEHICLE_QUEUE.poiTypeSrcVr + TYPE_NO_PASSING.poiType -> TYPE_NO_PASSING.poiTypeSrcVr + TYPE_NO_TURNING_AROUND.poiType -> TYPE_NO_TURNING_AROUND.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType -> TYPE_USECASE_ID_ROAD_NO_TOOTING.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType -> TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiTypeSrcVr + TYPE_USECASE_ID_BUS_WARNING.poiType -> TYPE_USECASE_ID_BUS_WARNING.poiTypeSrcVr + TYPE_USECASE_ID_NARROW_RIGHT.poiType -> TYPE_USECASE_ID_NARROW_RIGHT.poiTypeSrcVr + TYPE_USECASE_ID_GAS_STATION.poiType -> TYPE_USECASE_ID_GAS_STATION.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeSrcVr + TYPE_USECASE_ID_ACCIDENT.poiType -> TYPE_USECASE_ID_ACCIDENT.poiTypeSrcVr + + else -> { + R.drawable.icon_default + } + } + } + + + //===================告警类事件=================== + @JvmStatic + fun getWarningIcon(poiType: String?): Int { + return when (poiType) { + TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.poiTypeSrcVr + TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.poiTypeSrcVr +// TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.poiTypeSrcVr + TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.poiTypeSrcVr + TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.poiTypeSrcVr + TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.poiTypeSrcVr + TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.poiTypeSrcVr + TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.poiTypeSrcVr + TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.poiTypeSrcVr + TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.poiTypeSrcVr + TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.poiTypeSrcVr + TYPE_ERROR.poiType -> TYPE_ERROR.poiTypeSrcVr + TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.poiTypeSrcVr + GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeSrcVr + AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeSrcVr + + TYPE_USECASE_ID_IVP_RED.poiType -> TYPE_USECASE_ID_IVP_RED.poiTypeSrcVr + TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.poiTypeSrcVr + + TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.poiTypeSrcVr + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiTypeSrcVr + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiTypeSrcVr + TYPE_ERROR_WEAKNESS.poiType -> TYPE_ERROR_WEAKNESS.poiTypeSrcVr + + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeSrcVr + TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.poiTypeSrcVr + TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.poiTypeSrcVr + TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType -> TYPE_USECASE_ID_BREAKDOWN_WARNING.poiTypeSrcVr + FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_PARKING.poiType -> TYPE_USECASE_ID_ROAD_PARKING.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType -> TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiTypeSrcVr + TYPE_ID_SHAPR_TURNS.poiType -> TYPE_ID_SHAPR_TURNS.poiTypeSrcVr + TYPE_ID_BRIDGE.poiType -> TYPE_ID_BRIDGE.poiTypeSrcVr + TYPE_ID_PEDESTRIAN.poiType -> TYPE_ID_PEDESTRIAN.poiTypeSrcVr + TYPE_ID_SLIPPERY_ROAD.poiType -> TYPE_ID_SLIPPERY_ROAD.poiTypeSrcVr + TYPE_ID_TUNNEL.poiType -> TYPE_ID_TUNNEL.poiTypeSrcVr + TYPE_ID_FERRY.poiType -> TYPE_ID_FERRY.poiTypeSrcVr + TYPE_ID_UNEVEN_ROAD.poiType -> TYPE_ID_UNEVEN_ROAD.poiTypeSrcVr + TYPE_ID_NON_MOTOR_VEHICLE.poiType -> TYPE_ID_NON_MOTOR_VEHICLE.poiTypeSrcVr + TYPE_ID_OBSTACLE.poiType -> TYPE_ID_OBSTACLE.poiTypeSrcVr + TYPE_FOURS_ROAD_WORK.poiType -> TYPE_FOURS_ROAD_WORK.poiTypeSrcVr + TYPE_VEHICLE_QUEUE.poiType -> TYPE_VEHICLE_QUEUE.poiTypeSrcVr + TYPE_NO_PASSING.poiType -> TYPE_NO_PASSING.poiTypeSrcVr + TYPE_NO_TURNING_AROUND.poiType -> TYPE_NO_TURNING_AROUND.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType -> TYPE_USECASE_ID_ROAD_NO_TOOTING.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType -> TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiTypeSrcVr + TYPE_USECASE_ID_BUS_WARNING.poiType -> TYPE_USECASE_ID_BUS_WARNING.poiTypeSrcVr + TYPE_USECASE_ID_NARROW_RIGHT.poiType -> TYPE_USECASE_ID_NARROW_RIGHT.poiTypeSrcVr + TYPE_USECASE_ID_GAS_STATION.poiType -> TYPE_USECASE_ID_GAS_STATION.poiTypeSrcVr + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeSrcVr + TYPE_USECASE_ID_ACCIDENT.poiType -> TYPE_USECASE_ID_ACCIDENT.poiTypeSrcVr + + else -> TYPE_ERROR.poiTypeSrcVr + } + } + + @JvmStatic + fun getWarningContent(poiType: String?): String { + return when (poiType) { + TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.content + TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.content +// TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.content + TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.content + TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.content + TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.content + TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.content + TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.content + TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.content + TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.content + TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.content + FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content + AI_ROAD_WORK.poiType -> AI_ROAD_WORK.content + TYPE_ERROR.poiType -> TYPE_ERROR.content + TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.content + GHOST_PROBE.poiType -> GHOST_PROBE.content + + TYPE_USECASE_ID_IVP_RED.poiType -> TYPE_USECASE_ID_IVP_RED.content + TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.content + + TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.content + TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.content + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.content + TYPE_ERROR_WEAKNESS.poiType -> TYPE_ERROR_WEAKNESS.content + + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.content + TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.content + TYPE_FOURS_ROAD_WORK.poiType -> TYPE_FOURS_ROAD_WORK.content + TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.content + TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.content + TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType -> TYPE_USECASE_ID_BREAKDOWN_WARNING.content + FOURS_PONDING.poiType -> FOURS_PONDING.content + TYPE_USECASE_ID_ROAD_PARKING.poiType -> TYPE_USECASE_ID_ROAD_PARKING.content + TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType -> TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.content + TYPE_ID_SHAPR_TURNS.poiType -> TYPE_ID_SHAPR_TURNS.content + TYPE_ID_BRIDGE.poiType -> TYPE_ID_BRIDGE.content + TYPE_ID_PEDESTRIAN.poiType -> TYPE_ID_PEDESTRIAN.content + TYPE_ID_SLIPPERY_ROAD.poiType -> TYPE_ID_SLIPPERY_ROAD.content + TYPE_ID_TUNNEL.poiType -> TYPE_ID_TUNNEL.content + TYPE_ID_FERRY.poiType -> TYPE_ID_FERRY.content + TYPE_ID_UNEVEN_ROAD.poiType -> TYPE_ID_UNEVEN_ROAD.content + TYPE_ID_NON_MOTOR_VEHICLE.poiType -> TYPE_ID_NON_MOTOR_VEHICLE.content + TYPE_ID_OBSTACLE.poiType -> TYPE_ID_OBSTACLE.content + TYPE_FOURS_ROAD_WORK.poiType -> TYPE_FOURS_ROAD_WORK.content + TYPE_VEHICLE_QUEUE.poiType -> TYPE_VEHICLE_QUEUE.content + TYPE_NO_PASSING.poiType -> TYPE_NO_PASSING.content + TYPE_NO_TURNING_AROUND.poiType -> TYPE_NO_TURNING_AROUND.content + TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.content + TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType -> TYPE_USECASE_ID_ROAD_NO_TOOTING.content + TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType -> TYPE_USECASE_ID_ROAD_SPEED_LIMIT.content + TYPE_USECASE_ID_BUS_WARNING.poiType -> TYPE_USECASE_ID_BUS_WARNING.content + TYPE_USECASE_ID_NARROW_RIGHT.poiType -> TYPE_USECASE_ID_NARROW_RIGHT.content + TYPE_USECASE_ID_GAS_STATION.poiType -> TYPE_USECASE_ID_GAS_STATION.content + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.content + TYPE_USECASE_ID_ACCIDENT.poiType -> TYPE_USECASE_ID_ACCIDENT.content + + else -> TYPE_ERROR.content + } + } + + @JvmStatic + fun getWarningTts(poiType: String?): String { + return when (poiType) { + TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.tts + TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.tts +// TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.tts + TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.tts + TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.tts + TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.tts + TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.tts + TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.tts + TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.tts + TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.tts + TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.tts + FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts + AI_ROAD_WORK.poiType -> AI_ROAD_WORK.tts + TYPE_ERROR.poiType -> TYPE_ERROR.tts + TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.tts + GHOST_PROBE.poiType -> GHOST_PROBE.tts + + TYPE_USECASE_ID_IVP_RED.poiType -> TYPE_USECASE_ID_IVP_RED.tts + TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.tts + + TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.tts + TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.tts + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.tts + TYPE_ERROR_WEAKNESS.poiType -> TYPE_ERROR_WEAKNESS.tts + + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.tts + TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.tts + TYPE_FOURS_ROAD_WORK.poiType -> TYPE_FOURS_ROAD_WORK.tts + TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.tts + TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.tts + TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType -> TYPE_USECASE_ID_BREAKDOWN_WARNING.tts + FOURS_PONDING.poiType -> FOURS_PONDING.tts + TYPE_USECASE_ID_ROAD_PARKING.poiType -> TYPE_USECASE_ID_ROAD_PARKING.tts + TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType -> TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.tts + TYPE_ID_SHAPR_TURNS.poiType -> TYPE_ID_SHAPR_TURNS.tts + TYPE_ID_BRIDGE.poiType -> TYPE_ID_BRIDGE.tts + TYPE_ID_PEDESTRIAN.poiType -> TYPE_ID_PEDESTRIAN.tts + TYPE_ID_SLIPPERY_ROAD.poiType -> TYPE_ID_SLIPPERY_ROAD.tts + TYPE_ID_TUNNEL.poiType -> TYPE_ID_TUNNEL.tts + TYPE_ID_FERRY.poiType -> TYPE_ID_FERRY.tts + TYPE_ID_UNEVEN_ROAD.poiType -> TYPE_ID_UNEVEN_ROAD.tts + TYPE_ID_NON_MOTOR_VEHICLE.poiType -> TYPE_ID_NON_MOTOR_VEHICLE.tts + TYPE_ID_OBSTACLE.poiType -> TYPE_ID_OBSTACLE.tts + TYPE_FOURS_ROAD_WORK.poiType -> TYPE_FOURS_ROAD_WORK.tts + TYPE_VEHICLE_QUEUE.poiType -> TYPE_VEHICLE_QUEUE.tts + TYPE_NO_PASSING.poiType -> TYPE_NO_PASSING.tts + TYPE_NO_TURNING_AROUND.poiType -> TYPE_NO_TURNING_AROUND.tts + TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.tts + TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType -> TYPE_USECASE_ID_ROAD_NO_TOOTING.tts + TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType -> TYPE_USECASE_ID_ROAD_SPEED_LIMIT.tts + TYPE_USECASE_ID_BUS_WARNING.poiType -> TYPE_USECASE_ID_BUS_WARNING.tts + TYPE_USECASE_ID_NARROW_RIGHT.poiType -> TYPE_USECASE_ID_NARROW_RIGHT.tts + TYPE_USECASE_ID_GAS_STATION.poiType -> TYPE_USECASE_ID_GAS_STATION.tts + TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.tts + TYPE_USECASE_ID_ACCIDENT.poiType -> TYPE_USECASE_ID_ACCIDENT.tts + + else -> TYPE_ERROR.tts + } + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obucombine/IMoGoObuDcCombineListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obucombine/IMoGoObuDcCombineListener.kt new file mode 100644 index 0000000000..942102318c --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obucombine/IMoGoObuDcCombineListener.kt @@ -0,0 +1,17 @@ +package com.mogo.eagle.core.function.api.obucombine + +import mogo.v2x.ObuWarningEvent + +/** + * obu和dc 通道打通融合 + */ +interface IMoGoObuDcCombineListener { + + /** + * obu透传v2i数据,(标牌,弱势交通,红绿灯,限速,道路危险状况) + * @param obuWarningData + */ + fun onMoGoObuDcCombineData(obuWarningData: ObuWarningEvent.ObuWarningData?) + + + } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obucombine/CallerObuDcCombineListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obucombine/CallerObuDcCombineListenerManager.kt new file mode 100644 index 0000000000..8e126441f2 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obucombine/CallerObuDcCombineListenerManager.kt @@ -0,0 +1,65 @@ +package com.mogo.eagle.core.function.call.obucombine + +import androidx.annotation.Nullable +import com.mogo.eagle.core.function.api.obucombine.IMoGoObuDcCombineListener +import com.mogo.eagle.core.function.call.base.CallerBase +import mogo.v2x.ObuWarningEvent +import java.util.concurrent.ConcurrentHashMap + +/** + * obu和dc数据通道 回调监听 + */ +object CallerObuDcCombineListenerManager : CallerBase() { + // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 + private val M_DC_COMBINE_LISTENERS: ConcurrentHashMap = + ConcurrentHashMap() + + /** + * 添加 obu和dc数据通道 监听 + * @param tag 标记,用来注销监听使用 + * @param listener 监听回调 + */ + fun addListener( + @Nullable tag: String, + @Nullable listener: IMoGoObuDcCombineListener + ) { + if (M_DC_COMBINE_LISTENERS.containsKey(tag)) { + return + } + M_DC_COMBINE_LISTENERS[tag] = listener + } + + /** + * 删除监听 + * @param tag 标记,用来注销监听使用 + */ + fun removeListener(@Nullable tag: String) { + if (!M_DC_COMBINE_LISTENERS.containsKey(tag)) { + return + } + M_DC_COMBINE_LISTENERS.remove(tag) + } + + /** + * 删除自动驾驶按钮选中监听 + * @param listener 要删除的监听对象 + */ + fun removeListener(@Nullable listener: IMoGoObuDcCombineListener) { + M_DC_COMBINE_LISTENERS.forEach { + if (it.value == listener) { + M_DC_COMBINE_LISTENERS.remove(it.key) + } + } + } + + /** + * v2i数据 + */ + fun invokeObuDcData(obuWarningData: ObuWarningEvent.ObuWarningData?){ + M_DC_COMBINE_LISTENERS.forEach{ + val listener = it.value + listener.onMoGoObuDcCombineData(obuWarningData) + } + } + +} \ No newline at end of file diff --git a/libraries/mogo-adas-data/src/main/proto/chassis.proto b/libraries/mogo-adas-data/src/main/proto/chassis.proto index c0d10d8dca..015f089efb 100644 --- a/libraries/mogo-adas-data/src/main/proto/chassis.proto +++ b/libraries/mogo-adas-data/src/main/proto/chassis.proto @@ -24,7 +24,8 @@ enum PilotMode { MODE_STEER_ONLY = 2; MODE_SPEED_ONLY = 3; MODE_REMOTE_DRIVE = 6; - CHASSID_TELECONTROL_DRIVE = 7; + MODE_TELECONTROL_DRIVE = 7; + MODE_INVALID = 8; } enum LongitudeDrivingMode { @@ -98,4 +99,4 @@ enum CleanSystemControlMode { Clean_PureWash_Both_Side_Work = 12; Clean_PureWash_Left_Work = 13; Clean_PureWash_Right_Work = 14; -} \ No newline at end of file +} diff --git a/libraries/mogo-adas-data/src/main/proto/obu_warning_event.proto b/libraries/mogo-adas-data/src/main/proto/obu_warning_event.proto index 3d3f89e613..5dd9552082 100644 --- a/libraries/mogo-adas-data/src/main/proto/obu_warning_event.proto +++ b/libraries/mogo-adas-data/src/main/proto/obu_warning_event.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package mogo.v2x.v2i; +package mogo.v2x; import "header.proto"; import "mogo_v2x.proto"; @@ -91,10 +91,27 @@ message SpatWarningData{ repeated SpatLight lights = 3; /* 灯色信息集合 */ } -message ObuWarningData{ - common.Header header = 1; - int32 MsgDataType = 2; /*1:rsiEvent; 2:RsmEvent; 3:SpatEvent*/ - RsiWarningData rsiEvent = 3; - RsmWarningData RsmEvent = 4; - SpatWarningData SpatEvent = 5; +message NodeID{ + int32 region = 1;/* 定义地图中划分区域的ID号 */ + int32 id = 2; /* 定义地图节点ID */ } + +message MapMatchData{ + int32 status = 1;/* 状态信息,0:更新,1:添加,2:删除 */ + int32 unitMask = 2;/* 描述所属字段有效性 */ + NodeID currentNodeID = 3;/* 前方节点信息 */ + NodeID upstreamNodeID = 4;/* 上游节点信息 */ + int32 matchingLaneID = 5;/* 匹配车道ID,0:无效 */ + int32 speedMaxLimit = 6;/* 建议最大车速,单位(0.02m/s) */ + int32 speedMinLimit = 7;/* 建议最小车速,单位(0.02m/s) */ +} + +message ObuWarningData{ + common.Header header = 1; + int32 msgDataType = 2; /*1:rsiEvent; 2:rsmEvent; 3:spatEvent; 4:mapMatchData*/ + RsiWarningData rsiEvent = 3; + RsmWarningData rsmEvent = 4; + SpatWarningData spatEvent = 5; + MapMatchData mapMatchData = 6; +} + diff --git a/libraries/mogo-adas-data/src/main/proto/system_status_info.proto b/libraries/mogo-adas-data/src/main/proto/system_status_info.proto index 58c511d8c8..0a4953f7f8 100644 --- a/libraries/mogo-adas-data/src/main/proto/system_status_info.proto +++ b/libraries/mogo-adas-data/src/main/proto/system_status_info.proto @@ -30,7 +30,6 @@ message HealthInfo{ message TopicInfo{ optional string name = 1; //topic name optional int32 hz = 2; //Topic发送的频率 - // optional int32 max_delay = 3; //unit: msec } message DropTopic{ @@ -38,10 +37,28 @@ message DropTopic{ repeated TopicInfo topic = 2; } +message NodeInfo{ + optional string node_name = 1; //node name + optional string launch_name = 2; //launch name + optional int32 state = 3; //0:未知状态None,1:依赖未就绪Waiting,2:启动中Starting,3:运行running,4:停止stopping,5:无法启动状态,6:人为启动状态,7:人为关闭状态 +} + +message NodeFaultList{ + required int32 sum = 1; //下述node总数 + repeated NodeInfo node = 2; +} message StatusInfo { - required SystemState sys_state=1; // 当前消息状态 + required SystemState sys_state=1; // 当前系统状态 repeated HealthInfo health_info=2; // 健康检查状态信息 optional DropTopic topic_drop_info=3; // topic 掉频信息, 如有掉频添加没有不添加 - optional string reserved = 4; // 预留可选字段,用于接口扩充或者,其他信息补充 + optional string reserved = 4; // 用于表示idle模式,'idle' 表示idle模式 'work' 表示正常工作 + // add by liyl 20220907 + optional int32 pilot_mode = 5; // 0: manaul 1: autopilot 2: RemotePilot + optional string map_version = 6; // MAP 版本信息 + optional string master_version = 7; // system_master 版本信息 + optional bool auto_pilot_ready = 8; // 自动驾驶状态就绪, 20221111增加 + optional bool remote_pilot_ready = 9; // 平行驾驶状态就绪 + optional NodeFaultList auto_pilot_unready_list = 10; //20221128 增加 + optional NodeFaultList remote_pilot_unready_list = 11; //20221128 增加 } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java index 649cbf48d7..5f0b6395e8 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java @@ -6,6 +6,7 @@ import com.zhidao.support.adas.high.common.ProtocolStatus; import chassis.VehicleStateOuterClass; import mogo.telematics.pad.MessagePad; +import mogo.v2x.ObuWarningEvent; import mogo_msg.MogoReportMsg; import perception.TrafficLightOuterClass; import prediction.Prediction; @@ -180,6 +181,13 @@ public interface OnAdasListener { */ void onPlanningActionMsg(MessagePad.Header header, MessagePad.PlanningActionMsg planningActionMsg); + /** + * OBU预警事件 + * + * @param header 头 + * @param obuWarningData 数据 + */ + void onObuWarningData(MessagePad.Header header, ObuWarningEvent.ObuWarningData obuWarningData); /** * 是否有能力启动自动驾驶 diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java index af484038ee..2de37de94f 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java @@ -53,7 +53,8 @@ public enum MessageType { TYPE_SEND_TRIP_INFO_REQ(MessagePad.MessageType.MsgTypeTripInfoEvent, "行程信息"), TYPE_SEND_SPECIAL_VEHICLE_TASK_CMD(MessagePad.MessageType.MsgTypeSpecialVehicleTaskCmd, "特种车辆命令"), //透传 原始pb文件中不存在以下type。由于Java中无法强转所以在mogo-adas-data message_pad.proto中放开注释 - TYPE_RECEIVE_PLANNING_DECISION_STATE(MessagePad.MessageType.MsgTypePlanningDecisionState, "Planning决策状态"); + TYPE_RECEIVE_PLANNING_DECISION_STATE(MessagePad.MessageType.MsgTypePlanningDecisionState, "Planning决策状态"), + TYPE_RECEIVE_OBU_WARNING_DATA(MessagePad.MessageType.MsgTypeObuWarningData, "OBU预警事件"); /** diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java index 5786c0803b..db9df5b63e 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java @@ -31,6 +31,7 @@ public class MyMessageFactory implements IMyMessageFactory { private IMsg statusQueryRespMessage;//状态查询应答 private IMsg recordDataConfigRespMessage;//数据采集配置应答 private IMsg planningDecisionStateMessage;//planning决策状态 + private IMsg obuWarningDataMessage;//工控机透传OBU V2I数据 private final AutopilotReview autopilotReview; @@ -148,6 +149,12 @@ public class MyMessageFactory implements IMyMessageFactory { planningDecisionStateMessage = new PlanningDecisionStateMessage(); } return planningDecisionStateMessage; + } else if (messageType == MessageType.TYPE_RECEIVE_OBU_WARNING_DATA.typeCode) { + //OBU预警事件 + if (obuWarningDataMessage == null) { + obuWarningDataMessage = new ObuWarningDataMessage(); + } + return obuWarningDataMessage; } else { //MessageType.TYPE_DEFAULT.typeCode return null; diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ObuWarningDataMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ObuWarningDataMessage.java new file mode 100644 index 0000000000..98075ce004 --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ObuWarningDataMessage.java @@ -0,0 +1,31 @@ +package com.zhidao.support.adas.high.msg; + +import android.os.SystemClock; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.zhidao.support.adas.high.AdasChannel; +import com.zhidao.support.adas.high.OnAdasListener; +import com.zhidao.support.adas.high.common.CupidLogUtils; +import com.zhidao.support.adas.high.protocol.RawData; + +import mogo.v2x.ObuWarningEvent; + + +/** + * OBU预警事件 + */ +public class ObuWarningDataMessage extends MyAbstractMessageHandler { + + @Override + public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException { + ObuWarningEvent.ObuWarningData obuWarningData = ObuWarningEvent.ObuWarningData.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue()); + AdasChannel.calculateTimeConsumingOnDispatchRaw("OBU预警事件", raw.receiveTime); + long nowTime = 0; + if (CupidLogUtils.isEnableLog()) + nowTime = SystemClock.elapsedRealtime(); + if (adasListener != null) { + adasListener.onObuWarningData(raw.getHeader(), obuWarningData); + } + AdasChannel.calculateTimeConsumingBusiness("OBU预警事件", nowTime); + } +}