Merge branch 'dev_minibus-d_230425_3.2.0' into merge320tomaster

This commit is contained in:
yangyakun
2023-06-12 16:45:02 +08:00
1091 changed files with 23936 additions and 15523 deletions

View File

@@ -13,7 +13,6 @@ class AiCloudSocketBizProvider : IMoGoFunctionServerProvider {
override fun init(context: Context?) {
context?.let {
SocketManager.getInstance().init(it, 0.0, 0.0)
SocketManager.getInstance().registerOnMessageListener(401012, V2XMessageListener401012())
SocketManager.getInstance().registerOnMessageListener(401018, V2XMessageListener401018())
SocketManager.getInstance().registerOnMessageListener(402000, V2XMessageListener402000())

View File

@@ -24,6 +24,7 @@ import com.mogo.eagle.core.data.biz.trafficlight.toTrafficLightDetail
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotControlProvider
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.datacenter.autopilot.adapter.MoGoAdasListenerImpl
import com.mogo.eagle.core.function.datacenter.autopilot.adapter.MoGoAdasMsgConnectStatusListenerImpl
import com.mogo.eagle.core.function.datacenter.autopilot.server.AsyncDataToAutopilotServer
@@ -37,6 +38,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.ParseVersionUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
@@ -221,8 +223,6 @@ class MoGoAutopilotControlProvider :
CallerLogger.i("$M_ADAS_IMPL$TAG", "initServer……")
// 同步数据给工控机的服务
AsyncDataToAutopilotServer.INSTANCE.initServer()
// 同步是否开启雨天模式
setRainMode(FunctionBuildConfig.isRainMode)
}
private fun directConnect() {
@@ -287,6 +287,7 @@ class MoGoAutopilotControlProvider :
SharedPrefsMgr.getInstance(it).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp)
}
// 设置IP地址
AdasManager.getInstance().adasOptions.isClient = false
AdasManager.getInstance().adasOptions.ipcConnectionMode =
AdasOptions.IPC_CONNECTION_MODE.ASSIGN
AdasManager.getInstance().adasOptions.ipcAssignIP = autoPilotIp
@@ -542,6 +543,41 @@ class MoGoAutopilotControlProvider :
return AdasManager.getInstance().sendDetouringSpeed(speed)
}
/**
* 弱网减速停车策略开关
* isEnable = true 使用弱网减速停车策略
* isEnable = false 关闭弱网减速停车策略
* @return boolean
*/
override fun sendWeakNetSlowDown(isEnable: Boolean): Boolean {
return if(isEnable){
AdasManager.getInstance().sendWeakNetSlowDown(1)
}else{
AdasManager.getInstance().sendWeakNetSlowDown(0)
}
}
/**
* 获取全部参数
* 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq)}
*
* @return boolean
*/
override fun sendGetAllParamReq(): Boolean {
return AdasManager.getInstance().sendGetAllParamReq()
}
/**
* 参数获取请求
* 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq)}
*
* @param paramType 参数类型{@link com.zhidao.support.adas.high.common.Constants.PARAM_TYPE}
* @return boolean
*/
override fun sendGetParamReq(paramType: Int): Boolean {
return AdasManager.getInstance().sendGetParamReq(paramType)
}
/**
* 获取数据采集录制模式配置列表
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
@@ -655,6 +691,14 @@ class MoGoAutopilotControlProvider :
return AdasManager.getInstance().sendBagManagerCmd(bagManager.build())
}
/**
* 控制V2N数据给车端PnC
* @param switchCmd true为发给PnCfalse为不发给PnC
*/
override fun sendV2nToPncCmd(switchCmd: Boolean) {
AdasManager.getInstance().sendV2nToPncCmd(switchCmd)
}
/**
* 向左变道
*/
@@ -808,6 +852,18 @@ class MoGoAutopilotControlProvider :
CallerDevaToolsManager.getBindingCarInfo( carConfigResp.macAddress, MoGoAiCloudClientConfig.getInstance().sn)
invokeNettyConnResult("乘客屏车牌号:${carConfigResp.plateNumber},Mac地址为${carConfigResp.macAddress}")
}
if(carConfigResp.dockVersion.isNotEmpty()){
if(carConfigResp.dockVersion.contains("taxi")){
//修改雨天模式开关默认状态为开启仅针对taxi320及以上的版本-sop 215
val num = ParseVersionUtils.parseVersion(true,carConfigResp.dockVersion)
if(num >= 30200){
FunctionBuildConfig.isRainMode = true
}
}
//每次工控机连接成功后,需同步当前设置的雨天模式状态
setRainMode(FunctionBuildConfig.isRainMode)
}
}
@ChainLog(

View File

@@ -6,6 +6,7 @@ import chassis.VehicleStateOuterClass
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD
@@ -53,11 +54,13 @@ import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager
import com.mogo.eagle.core.function.call.v2x.*
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.support.obu.ObuScene
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.OnAdasListener
import com.zhidao.support.adas.high.bean.AdasParam
import com.zhidao.support.adas.high.common.ProtocolStatus
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask
@@ -69,10 +72,13 @@ import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm
import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
import function_state_management.FunctionStates
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.TrackedObject
import mogo.v2x.MogoV2X
import mogo.v2x.RoadOverviewEvents
import mogo_msg.MogoReportMsg
import perception.TrafficLightOuterClass
import planning.RoboSweeperTaskIndexOuterClass
@@ -110,15 +116,15 @@ class MoGoAdasListenerImpl : OnAdasListener {
}
}
//感知物体
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED,
linkCode = CHAIN_LINK_ADAS,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
paramIndexes = [0, 1],
clientPkFileName = "sn"
)
//感知物体 注解暂时关闭通过调试面板查看数量此注解暂时用于aiCloud显示感知物
// @ChainLog(
// linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED,
// linkCode = CHAIN_LINK_ADAS,
// endpoint = PAD,
// nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
// paramIndexes = [0, 1],
// clientPkFileName = "sn"
// )
override fun onTrackedObjects(
header: MessagePad.Header,
trackedObjects: MessagePad.TrackedObjects
@@ -304,9 +310,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
autopilotStatusInfo.state = autopilotState.state
autopilotStatusInfo.pilotmode = autopilotState.autopilotMode
autopilotStatusInfo.reason = autopilotState.reason
autopilotStatusInfo.camera = autopilotState.camera
autopilotStatusInfo.rtk = autopilotState.rtk
autopilotStatusInfo.radar = autopilotState.radar
autopilotStatusInfo.version = AdasManager.getInstance().adasVersion
if (autopilotStatusInfo.connectIP == null) {
autopilotStatusInfo.connectIP = AdasManager.getInstance().ipcConnectedIp
@@ -742,6 +745,59 @@ class MoGoAdasListenerImpl : OnAdasListener {
}
}
/**
* 主车附近事件推送
*
* @param header 头
* @param rsi 数据
*/
@ChainLog(
linkChainLog = ChainConstant.CHAIN_LINK_LOG_CLOUD_V2N,
linkCode = ChainConstant.CHAIN_LINK_CLOUD,
endpoint = PAD,
nodeAliasCode = ChainConstant.CHAIN_ALIAS_CODE_CLOUD_V2N,
paramIndexes = [0],
clientPkFileName = "sn"
)
override fun onV2nCongestionEvent(header: MessagePad.Header, rsi: MogoV2X.RSI_PB) {
CallerAutopilotIdentifyListenerManager.invokeAutopilotV2nCongestionEvent(header, rsi)
}
/**
* 主车路径全局事件推送
*
* @param header 头
* @param roadOverview 主车路径全局事件推送
* @param construct 施工
* @param triangle 三角牌
* @param congestion 拥堵
* @param parkingViolation 违停 ---包含 静态障碍车
*/
@ChainLog(
linkChainLog = ChainConstant.CHAIN_LINK_LOG_CLOUD_V2N,
linkCode = ChainConstant.CHAIN_LINK_CLOUD,
endpoint = PAD,
nodeAliasCode = ChainConstant.CHAIN_ALIAS_CODE_CLOUD_V2N,
paramIndexes = [0],
clientPkFileName = "sn"
)
override fun onV2nGlobalPathEvents(header: MessagePad.Header, roadOverview: RoadOverviewEvents.RoadOverviewData, construct: MogoV2X.RSI_PB?, triangle: MogoV2X.RSI_PB?, congestion: MogoV2X.RSI_PB?, parkingViolation: MogoV2X.RSM_PB?) {
CallerV2XListenerManager.dispatchV2nGlobalPathEvents(roadOverview.eventCount, construct, triangle, congestion, parkingViolation)
}
/**
* 参数获取应答
* <p>
* 调用{@link AdasManager#sendGetAllParamReq()}或{@link AdasManager#sendGetParamReq(int)}
* 如果对应的value是空串说明没有这个param或者get失败了。重启后值还是在redis里
*
* @param header 头
* @param getParamResp 配置参数
* @param adasParam 解析后的配置参数
*/
override fun onGetParamResp(header: MessagePad.Header, getParamResp: MessagePad.SetParamReq, adasParam: AdasParam) {
}
/**
* M1拼接视频 10Hz
* 此接口需要订阅,默认不发送数据

View File

@@ -1,10 +1,24 @@
package com.mogo.eagle.core.function.datacenter.autopilot.server
import android.annotation.SuppressLint
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.zhidao.support.adas.high.AdasManager
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger
/**
* @author xiaoyuzhou
@@ -14,7 +28,8 @@ import com.zhidao.support.adas.high.AdasManager
* 异步同步数据给 Autopilot 控制器
* 数据源不限于OBU、网络等
*/
class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListener {
class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListener,
IMoGoAutopilotStatusListener {
companion object {
const val TAG = "AsyncDataToAutopilotServer"
val INSTANCE: AsyncDataToAutopilotServer by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
@@ -22,10 +37,41 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
}
}
private var mPreAutoStatus = AtomicInteger(-1)
private var createSubscribe: Disposable? = null
fun initServer() {
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerTrafficLightListenerManager.addListener(TAG, this)
}
@SuppressLint("CheckResult")
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
super.onAutopilotStatusResponse(autoPilotStatusInfo)
val state = autoPilotStatusInfo.state
if (mPreAutoStatus.get() != state) {
mPreAutoStatus.set(state)
createSubscribe?.let {
if (!it.isDisposed) {
bizLog(SceneConstant.M_ADAS_IMPL + TAG, "自动驾驶状态变化取消前置轨迹请求间隔2s重新请求底盘轨迹")
createSubscribe?.dispose()
}
}
when (state) {
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
createSubscribe = Observable.timer(2000L, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
bizLog(SceneConstant.M_ADAS_IMPL + TAG, "请求底盘轨迹")
CallerAutoPilotControlManager.getGlobalPath()
}
}
else -> {}
}
}
}
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
var version = -1
if (AdasManager.getInstance().carConfig != null) {
@@ -34,4 +80,16 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
if (version > -1 && version < 290)
CallerAutoPilotControlManager.sendTrafficLightData(trafficLightResult)
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT,
linkCode = ChainConstant.CHAIN_LINK_ADAS,
endpoint = PAD,
nodeAliasCode = ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_BIZ,
paramIndexes = [0, 1],
clientPkFileName = "sn"
)
private fun bizLog(tag: String, msg: String) {
CallerLogger.d(tag, msg)
}
}

View File

@@ -5,16 +5,22 @@ import androidx.lifecycle.lifecycleScope
import com.google.protobuf.TextFormat
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setDemoMode
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.telematic.MogoProtocolMsg
import com.mogo.telematic.NSDNettyManager
@@ -31,7 +37,6 @@ import mogo.telematics.pad.MessagePad
class TeleMsgHandler : IMsgHandler {
companion object{
private const val BUSINESS_STRING = 100
private const val TAG = "TeleMsgHandler"
}
@@ -92,18 +97,20 @@ class TeleMsgHandler : IMsgHandler {
AppConfigInfo.iPCMacAddress = carConfig.macAddress
AppConfigInfo.dockerVersion = carConfig.dockVersion
listener?.connectDevice(!carConfig.dockVersion.contains("2.3.0"))
CallerDevaToolsManager.getBindingCarInfo(carConfig.macAddress, MoGoAiCloudClientConfig.getInstance().sn)
invokeNettyConnResult(
"司机屏发送给乘客屏配置信息为:${
TextFormat.printer().escapingNonAscii(false).printToString(carConfig)
}"
)
CallerDevaToolsManager.getBindingCarInfo(carConfig.macAddress, MoGoAiCloudClientConfig.getInstance().sn)
}
// SN
10 -> {
val sn = String(it.body)
isReceiveSN = true
NettyTcpClient.sSERVER_SN = sn
invokeNettyConnResult("乘客屏收到司机屏发过来的SN为$sn")
CallerTelematicListenerManager.dispatchServerSn(sn)
}
// 美化模式是否忽略条件直接绘制
11 -> {
@@ -126,9 +133,50 @@ class TeleMsgHandler : IMsgHandler {
}
}
}
BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(BUSINESS_STRING, it.body)
TelematicConstant.BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
}
TelematicConstant.SHOW_TRAFFIC_LIGHT -> {
val trafficLightJson = String(it.body)
CallerTrafficLightListenerManager.invokeTrafficLightStatus(GsonUtils.fromJson(trafficLightJson, TrafficLightResult::class.java))
}
TelematicConstant.HIDE_TRAFFIC_LIGHT -> {
ThreadUtils.runOnUiThread {
CallerTrafficLightListenerManager.invokeEnterCrossRoad(false)
}
}
TelematicConstant.OPEN_ROMA_STATUS -> {
ThreadUtils.runOnUiThread {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.OPEN_ROMA_STATUS,it.body)
}
}
TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR -> {
ThreadUtils.runOnUiThread {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR,it.body)
}
}
TelematicConstant.OBU_RUNREDLIGHT_WARNING -> {
when (String(it.body)) {
"0" -> {
HmiBuildConfig.isShowRunRedLightView = false
}
"1" -> {
HmiBuildConfig.isShowRunRedLightView = true
}
}
}
TelematicConstant.OBU_GREENWAVE_WARNING -> {
when (String(it.body)) {
"0" -> {
HmiBuildConfig.isShowGreenWaveView = false
}
"1" -> {
HmiBuildConfig.isShowGreenWaveView = true
}
}
}
else -> {
}
}
@@ -173,8 +221,13 @@ class TeleMsgHandler : IMsgHandler {
invokeNettyConnResult("司机屏SN未获取到不发送给乘客屏")
}
}
BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(BUSINESS_STRING, it.body)
TelematicConstant.BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
}
TelematicConstant.OPEN_ROMA_STATUS -> {
ThreadUtils.runOnUiThread {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.OPEN_ROMA_STATUS,it.body)
}
}
else -> {
}

View File

@@ -82,4 +82,8 @@ class MoGoObuProvider : IMoGoObuProvider {
override fun deleteObuFile() {
MogoPrivateObuNewManager.INSTANCE.deleteObuFile()
}
override fun setHvInfoSendCycle(time: Int) {
MogoPrivateObuNewManager.INSTANCE.setHvInfoSendCycle(time)
}
}

View File

@@ -6,20 +6,24 @@ import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuWarningMapListener
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuWarningRsiListener
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuWarningRsmListener
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuWarningSpatListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
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.obu.*
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.datacenter.obu.drawer.*
import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew
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.eagle.core.utilcode.util.ConvertUtils
import com.mogo.support.obu.ObuScene
import com.mogo.support.obu.constants.MogoObuConstants
import com.zhidao.support.obu.constants.MogoObuShowConstants
import kotlin.math.roundToInt
/**
@@ -38,7 +42,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
private var mContext: Context? = null
private val TAG = "MogoObuDcCombineManager"
private var mLimitSpeed: Int = 0
fun init(context: Context) {
mContext = context
@@ -101,24 +105,24 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
when (appId) {
// 道路危险情况预警
MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> {
MogoObuShowConstants.RSI_SCENE_TYPE.HLW.toString() -> {
when (rsiWarningData.warningMsgList[0].eventSerialNum) {
MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障
MogoObuShowConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障
appId = EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水
MogoObuShowConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水
appId = EventTypeEnumNew.FOURS_PONDING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车
MogoObuShowConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PARKING.poiType
}
// MogoObuConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道,和标牌重复
// MogoObuShowConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道,和标牌重复
// appId = EventTypeEnumNew.FOURS_ROAD_WORK.poiType
// }
MogoObuConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶
MogoObuShowConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶
appId = EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType
}
MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
MogoObuShowConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType
}
@@ -132,78 +136,87 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
ttsContent = String.format(
ttsContent,
Math.round(rsiWarningData.warningMsgList[0].distance).toString(),
Math.round(rsiWarningData.warningMsgList[0].eventRadius).toString()
ConvertUtils.intToChinese(
rsiWarningData.warningMsgList[0].distance.roundToInt()),
ConvertUtils.intToChinese(
rsiWarningData.warningMsgList[0].eventRadius.roundToInt())
)
}
//车内标牌
MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> {
MogoObuShowConstants.RSI_SCENE_TYPE.IVS.toString() -> {
when (rsiWarningData.warningMsgList[0].signSerialNum) {
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
MogoObuShowConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
}
MogoObuConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁
MogoObuShowConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁
appId = EventTypeEnumNew.TYPE_ID_BRIDGE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人
MogoObuShowConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人
appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑
MogoObuShowConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑
appId = EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_TUNNEL -> { //隧道
MogoObuShowConstants.RTS.RTI_TYPE_TUNNEL -> { //隧道
appId = EventTypeEnumNew.TYPE_ID_TUNNEL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_FERRY -> { //渡轮
MogoObuShowConstants.RTS.RTI_TYPE_FERRY -> { //渡轮
appId = EventTypeEnumNew.TYPE_ID_FERRY.poiType
}
MogoObuConstants.RTS.RTI_TYPE_UNEVEN_ROAD -> { //路面不平
MogoObuShowConstants.RTS.RTI_TYPE_UNEVEN_ROAD -> { //路面不平
appId = EventTypeEnumNew.TYPE_ID_UNEVEN_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NON_MOTOR_VEHICLE -> { //非机动车
MogoObuShowConstants.RTS.RTI_TYPE_NON_MOTOR_VEHICLE -> { //非机动车
appId = EventTypeEnumNew.TYPE_ID_NON_MOTOR_VEHICLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_OBSTACLE -> { //障碍
MogoObuShowConstants.RTS.RTI_TYPE_OBSTACLE -> { //障碍
appId = EventTypeEnumNew.TYPE_ID_OBSTACLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_CONSTRUCTION -> { //施工
MogoObuShowConstants.RTS.RTI_TYPE_CONSTRUCTION -> { //施工
appId = EventTypeEnumNew.TYPE_FOURS_ROAD_WORK.poiType
}
MogoObuConstants.RTS.RTI_TYPE_VEHICLE_QUEUE -> { //车队
MogoObuShowConstants.RTS.RTI_TYPE_VEHICLE_QUEUE -> { //车队
appId = EventTypeEnumNew.TYPE_VEHICLE_QUEUE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_PASSING -> { //不通
MogoObuShowConstants.RTS.RTI_TYPE_NO_PASSING -> { //不通
appId = EventTypeEnumNew.TYPE_NO_PASSING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TURNING_AROUND -> { //禁止掉头
MogoObuShowConstants.RTS.RTI_TYPE_NO_TURNING_AROUND -> { //禁止掉头
appId = EventTypeEnumNew.TYPE_NO_TURNING_AROUND.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_STOPPING -> { //禁止停车
MogoObuShowConstants.RTS.RTI_TYPE_NO_STOPPING -> { //禁止停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TOOTING -> { //禁止鸣笛
MogoObuShowConstants.RTS.RTI_TYPE_NO_TOOTING -> { //禁止鸣笛
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
MogoObuShowConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
}
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
MogoObuShowConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NARROW_RIGHT -> { //右侧变窄/车道数减少
MogoObuShowConstants.RTS.RTI_TYPE_NARROW_RIGHT -> { //右侧变窄/车道数减少
appId = EventTypeEnumNew.TYPE_USECASE_ID_NARROW_RIGHT.poiType
}
MogoObuConstants.RTS.RTI_TYPE_GAS_STATION -> { //加油站
MogoObuShowConstants.RTS.RTI_TYPE_GAS_STATION -> { //加油站
appId = EventTypeEnumNew.TYPE_USECASE_ID_GAS_STATION.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
MogoObuShowConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故
MogoObuShowConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故
appId = EventTypeEnumNew.TYPE_USECASE_ID_ACCIDENT.poiType
}
MogoObuShowConstants.RTS.RTI_TYPE_ATTENTION_CONFLUENCE -> { //注意合流
appId = EventTypeEnumNew.TYPE_ATTENTION_CONFLUENCE.poiType
}
MogoObuShowConstants.RTS.RTI_TYPE_PEDESTRIAN_CROSSING -> { //人行横道
appId = EventTypeEnumNew.TYPE_PEDESTRIAN_CROSSING.poiType
}
}
alertContent = EventTypeEnumNew.getWarningContent(appId)
@@ -214,12 +227,13 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
ttsContent = String.format(
ttsContent,
Math.round(rsiWarningData.warningMsgList[0].distance).toString()
ConvertUtils.intToChinese(
rsiWarningData.warningMsgList[0].distance.roundToInt())
)
}
// 拥堵
MogoObuConstants.RSI_SCENE_TYPE.TJW.toString() -> {
MogoObuShowConstants.RSI_SCENE_TYPE.TJW.toString() -> {
appId = EventTypeEnumNew.TYPE_USECASE_ID_TJW.poiType
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
@@ -230,40 +244,56 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
ttsContent = String.format(
ttsContent,
Math.round(rsiWarningData.warningMsgList[0].distance).toString(),
Math.round(rsiWarningData.warningMsgList[0].eventRadius).toString()
ConvertUtils.intToChinese(
rsiWarningData.warningMsgList[0].distance.roundToInt()),
ConvertUtils.intToChinese(
rsiWarningData.warningMsgList[0].eventRadius.roundToInt())
)
}
//限速预警, ADD处理一次
MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> {
MogoObuShowConstants.RSI_SCENE_TYPE.SLW.toString() -> {
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
if (mLimitSpeed > 0) {
alertContent = String.format(
EventTypeEnumNew.getWarningContent(appId),
mLimitSpeed
)
ttsContent = String.format(
EventTypeEnumNew.getWarningTts(appId),
ConvertUtils.intToChinese(mLimitSpeed)
)
}
}
}
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}")
"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} -----mLimitSpeed = $mLimitSpeed"
)
when (status) {
// 添加
MogoObuConstants.STATUS.ADD -> {
MogoObuShowConstants.STATUS.ADD -> {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
//大于10m才提示rsi
if (Math.round(rsiWarningData.warningMsgList[0].distance) > 10) {
//大于10m才提示rsi,超速不限制
if (appId == "6666") {
saveObuToDcData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
} else {
if (Math.round(rsiWarningData.warningMsgList[0].distance) > 10) {
saveObuToDcData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
}
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
MogoObuShowConstants.STATUS.UPDATE -> { // 更新
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
MogoObuShowConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
@@ -303,31 +333,28 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
val direction = getMessageDirection(rsmWarningData.participant.targetPosition)
//模型的显示
when (rsmWarningData.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
MogoObuShowConstants.STATUS.ADD -> { // 添加
// 更新数据模型变色的时候是不是update,如果不是更新可能导致模型不变色add的时候是否有level高的 TODO
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
MogoObuShowConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
MogoObuShowConstants.STATUS.DELETE -> { // 删除
// 更新数据 TODO 删除原来的改变颜色删除marker。不影响别的模型添加
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
}
}
@@ -340,12 +367,13 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
} --v2xType--- $v2xType ---alertContent = $alertContent ---ttsContent= $ttsContent"
)
when (rsmWarningData.warningMsg.warningDataList[0].status) {
MogoObuConstants.STATUS.ADD -> { // 添加
MogoObuShowConstants.STATUS.ADD -> { // 添加
//更新模型的颜色
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(
rsmWarningData
)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
@@ -355,15 +383,14 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
showWarning(v2xType, alertContent, ttsContent, direction)
}
MogoObuConstants.STATUS.UPDATE -> {// 更新
MogoObuShowConstants.STATUS.UPDATE -> {// 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
MogoObuShowConstants.STATUS.DELETE -> { // 删除
// 关闭警告红边
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
}
}
}
@@ -400,17 +427,18 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
} --- data.speedMaxLimit = ${data.speedMaxLimit}"
)
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
MogoObuShowConstants.STATUS.ADD -> { // 添加
mLimitSpeed = (data.speedMaxLimit * 3.6).roundToInt()
CallerLimitingVelocityListenerManager.invokeUnion(
(data.speedMaxLimit * 3.6).roundToInt(),
DataSourceType.OBU
)
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
MogoObuShowConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
MogoObuShowConstants.STATUS.DELETE -> { // 删除
CallerLimitingVelocityListenerManager.invokeUnion(
-1,
DataSourceType.OBU
@@ -425,22 +453,22 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
*/
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
MogoObuShowConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE,
MogoObuShowConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方
MogoObuShowConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
MogoObuShowConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方
MogoObuShowConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuShowConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT,
MogoObuShowConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuShowConstants.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
MogoObuShowConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuShowConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT,
MogoObuShowConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuShowConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT
-> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方
MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
MogoObuShowConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
else -> WarningDirectionEnum.ALERT_WARNING_ALL
}
}
@@ -459,17 +487,16 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
when (status) {
// 添加
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE
MogoObuShowConstants.STATUS.ADD,
MogoObuShowConstants.STATUS.UPDATE
-> {
if (lights != null && lights.isNotEmpty()) {
changeTrafficLightStatus(appId, lights)
}
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
MogoObuShowConstants.STATUS.DELETE -> {
// 移除顶部弹窗,当收不到信号的时候触发一次
CallerTrafficLightListenerManager.disableTrafficLight()
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
isShowGreenWave = false
isShowRunRedLight = false
@@ -490,6 +517,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
) {
var ttsContent = ""
var alertContent = ""
var ttsContentNew = ""
var alertContentNew = ""
//这里需要根据真实数据确定 index 取值方式
val currentLight = lights[0]
CallerLogger.e(
@@ -503,61 +532,74 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
}
1 -> { //闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if (!isShowRunRedLight) {
isShowRunRedLight = true
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 "
)
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
if (HmiBuildConfig.isShowRunRedLightView) {
if (!isShowRunRedLight) {
isShowRunRedLight = true
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 "
)
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent
)
showWarning(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent,
WarningDirectionEnum.ALERT_WARNING_NON
)
}
saveObuToDcData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
}
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次
if (!isShowGreenWave) {
isShowGreenWave = true
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager 绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}"
)
val adviceSpeed =
"${Math.round(currentLight.suggestMinSpeed * 3.6)} - ${
Math.round(
currentLight.suggestMaxSpeed * 3.6
)
}"
val adviceSpeedTts =
"${Math.round(currentLight.suggestMinSpeed * 3.6)} - ${
Math.round(
currentLight.suggestMaxSpeed * 3.6
)
}"
ttsContent =
String.format(
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeedTts
if (HmiBuildConfig.isShowGreenWaveView) {
if (!isShowGreenWave) {
isShowGreenWave = true
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager 绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}"
)
alertContent =
String.format(
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
val maxSpeed = currentLight.suggestMaxSpeed * 3.6
if (maxSpeed > 0) {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6)
var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6)
if (minSpeedTemp == maxSpeedTemp) {
minSpeedTemp -= 5
}
val maxSpeed = currentLight.suggestMaxSpeed
if (maxSpeed > 0) {
var currentSpeed =
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().gnssSpeed.toDouble()
if (currentSpeed > 0) {
ttsContentNew =
if ((currentSpeed * 3.6).roundToInt() in (minSpeedTemp + 1) until maxSpeedTemp) {
"蘑菇路侧提醒您,推荐保持当前车速通过路口"
} else {
"蘑菇路侧提醒您,推荐保持车速$minSpeedTemp - $maxSpeedTemp KM/H通过路口"
}
alertContentNew = "推荐车速$minSpeedTemp - $maxSpeedTemp KM/H"
}
saveObuToDcData(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContentNew,
ttsContentNew
)
showWarning(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContentNew,
ttsContentNew,
WarningDirectionEnum.ALERT_WARNING_NON
)
}
saveObuToDcData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
}
}
@@ -606,20 +648,24 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
* 保存obu通过工控机传输的数据到消息盒子
*/
private fun saveObuToDcData(type: String, content: String, tts: String) {
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.TELEMATIC)
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(
type,
content,
tts,
DataSourceType.TELEMATIC
)
}
/**
* 消息盒子对应消息的语音播报
*/
private fun showWarning(type: String, content: String, tts: String, direction: WarningDirectionEnum) {
CallerHmiManager.warningV2X(
type,
content,
tts,
null,
direction
)
private fun showWarning(
type: String,
content: String,
tts: String,
direction: WarningDirectionEnum
) {
CallerHmiManager.warningV2X(type, content, tts, null, direction, isFromObu = true)
}
}

View File

@@ -1,6 +1,8 @@
package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import android.util.Log
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.*
@@ -9,26 +11,29 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.map.angle.Default
import com.mogo.eagle.core.function.api.map.angle.TooClose
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
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.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.obu.*
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.datacenter.obu.drawer.*
import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew
import com.mogo.eagle.core.utilcode.breakpoint.Config
import com.mogo.eagle.core.utilcode.download.Config
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.eagle.core.utilcode.util.ConvertUtils
import com.mogo.eagle.core.utilcode.util.FileUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.support.obu.ObuBase
import com.mogo.support.obu.ObuScene
import com.mogo.support.obu.constants.MogoObuComType
import com.mogo.support.obu.constants.MogoObuConstants
import com.mogo.support.obu.constants.MogoObuLogLevel
import com.mogo.support.obu.constants.MogoObuTopicId
import com.mogo.support.obu.constants.*
import com.mogo.support.obu.model.*
import com.mogo.support.obu.model.result.BaseResult
import com.mogo.support.obu.model.result.MogoObuCallConfigResult
import com.mogo.support.obu.model.result.MogoObuCallRegisterResult
import com.mogo.support.obu.model.result.MogoObuCallResult
import com.mogo.support.obu.option.MogoObuCom
import com.mogo.support.obu.option.MogoObuLog
import com.mogo.support.obu.option.MogoObuOptions
@@ -36,9 +41,11 @@ import com.mogo.support.obu.upgrade.ObuSoftwareUpgradeStatus
import com.mogo.support.obu.upgrade.OnUpgradeListener
import com.zhidao.support.obu.ObuManager
import com.zhidao.support.obu.OnObuListener
import com.zhidao.support.obu.constants.MogoObuShowConstants
import mogo.telematics.pad.MessagePad
import kotlin.math.roundToInt
/**
*
* @author lixiaopeng
@@ -54,6 +61,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
private var mObuStatusInfo = CallerObuConnectListenerManager.getObuStatusInfo()
private var mContext: Context? = null
private var mLimitSpeed: Int = 0
fun connectObu(context: Context, obuIpAddress: String, padIpAddress: String) {
ObuManager.getInstance().registerObuListener(mogoObuListener)
@@ -74,6 +82,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
.registerTopic(MogoObuTopicId.RSI_WARNING)
.registerTopic(MogoObuTopicId.RSM_WARNING)
.registerTopic(MogoObuTopicId.MAP_MATCH)
.registerTopic(MogoObuTopicId.OBU_SYSTEM_STATUS)
.build()
//每次连接的时候如果连接连接了先断开防止ip改变等导致的连接失败
@@ -91,23 +100,33 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
* 上传obu文件的状态, 升级成功需要删除obu的文件和解压文件夹
*/
override fun onUpgradeStatus(status: ObuSoftwareUpgradeStatus?, t: Throwable?) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "onUpgradeStatus status = $status ")
if (t != null) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "onUpgradeStatus status = $status --- t = ${t.cause.toString()}")
}
//上传完成就相当于成功了,立即升级,比上电升级,只是多了一个重启
if (status == ObuSoftwareUpgradeStatus.UPLOAD_FINISH|| status == ObuSoftwareUpgradeStatus.EXEC_UPGRADE_PROGRAM_FINISH
|| status == ObuSoftwareUpgradeStatus.CONNECTION_FAILED|| status == ObuSoftwareUpgradeStatus.AUTHENTICATION_FAILED
|| status == ObuSoftwareUpgradeStatus.CHANNEL_ABNORMITY|| status == ObuSoftwareUpgradeStatus.UPGRADE_PACKAGE_ERROR
if (status == ObuSoftwareUpgradeStatus.UPLOAD_FINISH || status == ObuSoftwareUpgradeStatus.EXEC_UPGRADE_PROGRAM_FINISH
|| status == ObuSoftwareUpgradeStatus.CONNECTION_FAILED || status == ObuSoftwareUpgradeStatus.AUTHENTICATION_FAILED
|| status == ObuSoftwareUpgradeStatus.CHANNEL_ABNORMITY || status == ObuSoftwareUpgradeStatus.UPGRADE_PACKAGE_ERROR
|| status == ObuSoftwareUpgradeStatus.UPGRADE_PACKAGE_CHECK_FAILED || status == ObuSoftwareUpgradeStatus.PACKAGE_UPLOAD_FAILED
|| status == ObuSoftwareUpgradeStatus.EXEC_UPGRADE_PROGRAM_FAILED || status == ObuSoftwareUpgradeStatus.UNKNOWN) {
|| status == ObuSoftwareUpgradeStatus.EXEC_UPGRADE_PROGRAM_FAILED || status == ObuSoftwareUpgradeStatus.UNKNOWN
) {
deleteObuFile()
}
}
fun setHvInfoSendCycle(time: Int) {
ObuManager.getInstance().setHvInfoPushCycle(time);
}
/**
* 当前的obu版本
*/
override fun onCurrentVersion(version: MogoObuSystemBConfigData) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "onCurrentVersion version = ${version.version}")
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}",
"onCurrentVersion version = ${version.version}"
)
if (!version.version.isNullOrEmpty()) {
CallerDevaToolsManager.queryObuUpgrade(version.version)
}
@@ -116,11 +135,14 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
/**
* 删除obu相关的文件夹
*/
fun deleteObuFile(){
fun deleteObuFile() {
UiThreadHandler.post {
var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath)
var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath)
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "deleteObuFile isDeleteSuccess = $isDeleteSuccess ----isDeleteUnzipSuccess = $isDeleteUnzipSuccess")
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}",
"deleteObuFile isDeleteSuccess = $isDeleteSuccess ----isDeleteUnzipSuccess = $isDeleteUnzipSuccess"
)
}
}
@@ -141,8 +163,12 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
* @return 是否调用成功
*/
fun uploadObuPack(filePathArray: Array<String>) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", " uploadObuPack filePathArray = $filePathArray")
ObuManager.getInstance().uploadUpgradePackage(MogoObuConst.OBU_DEFAULT_IP, filePathArray,true,this)
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}",
" uploadObuPack filePathArray = $filePathArray"
)
ObuManager.getInstance()
.uploadUpgradePackage(MogoObuConst.OBU_DEFAULT_IP, filePathArray, true, this)
}
/**
@@ -199,9 +225,56 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
* @param data 系统状态
*/
override fun onObuSystemStatus(data: MogoObuSystemStatusData?) {
data?.let {
AppConfigInfo.obuInfo = it.toString()
}
CallerObuInfoListenerManager.invokeGetObuInfo(data.toString())
}
override fun onObuCallResult(result: BaseResult?) {
val builder = StringBuilder("调用结果:\n")
when (result!!.function) {
MogoObuConstants.CALL_FUNCTION.CONFIG -> {
val configResult = result as MogoObuCallConfigResult
builder.append(configResult.type.desc).append("配置调用= ")
.append(configResult.result.desc)
}
MogoObuConstants.CALL_FUNCTION.INIT -> {
val initResult = result as MogoObuCallResult
builder.append("初始化调用= ").append(initResult.result.desc)
}
MogoObuConstants.CALL_FUNCTION.DEINIT -> {
val deinitResult = result as MogoObuCallResult
builder.append("用户注销调用= ").append(deinitResult.result.desc)
}
MogoObuConstants.CALL_FUNCTION.TOPIC_REGIST, MogoObuConstants.CALL_FUNCTION.TOPIC_CANCEL -> {
val str =
if (result.function === MogoObuConstants.CALL_FUNCTION.TOPIC_REGIST) "注册" else "取消注册"
val callRegisterResult = result as MogoObuCallRegisterResult
if (callRegisterResult.results != null && callRegisterResult.results.isNotEmpty()) {
val size = callRegisterResult.results.size
var i = 0
while (i < size) {
val register = callRegisterResult.results[i]
builder.append(str).append("Topic ID= ").append(register.topicId.desc)
.append(" 调用= ").append(register.result.desc)
if (i < size - 1) {
builder.append("\n")
}
i++
}
}
}
MogoObuConstants.CALL_FUNCTION.SET_DATA -> {
val setDataResult = result as MogoObuCallResult
builder.append("OBU应用配置= ").append(setDataResult.result.desc)
}
}
val str = builder.toString()
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "onObuCallResult str = $str")
}
/**
* HV车辆基础信息 gnssInfo
*/
@@ -235,10 +308,13 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
data.vehBasicsMsg?.let {
TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(it)
?.let { data ->
CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(data)
TrafficMarkerDrawer.updateITrafficLocationInfo(data)
}
}.also {
CallerLogger.e("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
CallerLogger.e(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全"
)
}
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", data.toString())
@@ -302,26 +378,26 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
if (appId != "0") {
when (appId) {
// 道路危险情况预警
MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> {
MogoObuShowConstants.RSI_SCENE_TYPE.HLW.toString() -> {
when (data.warningMsgList[0].eventSerialNum) {
MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障
MogoObuShowConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障
appId =
EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水
MogoObuShowConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水
appId = EventTypeEnumNew.FOURS_PONDING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车
MogoObuShowConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PARKING.poiType
}
// MogoObuConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道,和标牌重复
// MogoObuShowConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道,和标牌重复
// appId = EventTypeEnumNew.FOURS_ROAD_WORK.poiType
// }
MogoObuConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶
MogoObuShowConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶
appId = EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType
}
MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
MogoObuShowConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType
}
@@ -335,82 +411,93 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
)
ttsContent = String.format(
ttsContent,
Math.round(data.warningMsgList[0].distance).toString(),
Math.round(data.warningMsgList[0].eventRadius).toString()
ConvertUtils.intToChinese(
data.warningMsgList[0].distance.roundToInt()),
ConvertUtils.intToChinese(
data.warningMsgList[0].eventRadius.roundToInt())
)
}
//车内标牌
MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> {
MogoObuShowConstants.RSI_SCENE_TYPE.IVS.toString() -> {
when (data.warningMsgList[0].signSerialNum) {
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
MogoObuShowConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
}
MogoObuConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁
MogoObuShowConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁
appId = EventTypeEnumNew.TYPE_ID_BRIDGE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人
MogoObuShowConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人
appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑
MogoObuShowConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑
appId = EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_TUNNEL -> { //隧道
MogoObuShowConstants.RTS.RTI_TYPE_TUNNEL -> { //隧道
appId = EventTypeEnumNew.TYPE_ID_TUNNEL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_FERRY -> { //渡轮
MogoObuShowConstants.RTS.RTI_TYPE_FERRY -> { //渡轮
appId = EventTypeEnumNew.TYPE_ID_FERRY.poiType
}
MogoObuConstants.RTS.RTI_TYPE_UNEVEN_ROAD -> { //路面不平
MogoObuShowConstants.RTS.RTI_TYPE_UNEVEN_ROAD -> { //路面不平
appId = EventTypeEnumNew.TYPE_ID_UNEVEN_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NON_MOTOR_VEHICLE -> { //非机动车
MogoObuShowConstants.RTS.RTI_TYPE_NON_MOTOR_VEHICLE -> { //非机动车
appId = EventTypeEnumNew.TYPE_ID_NON_MOTOR_VEHICLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_OBSTACLE -> { //障碍
MogoObuShowConstants.RTS.RTI_TYPE_OBSTACLE -> { //障碍
appId = EventTypeEnumNew.TYPE_ID_OBSTACLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_CONSTRUCTION -> { //施工
MogoObuShowConstants.RTS.RTI_TYPE_CONSTRUCTION -> { //施工
appId = EventTypeEnumNew.TYPE_FOURS_ROAD_WORK.poiType
}
MogoObuConstants.RTS.RTI_TYPE_VEHICLE_QUEUE -> { //车队
MogoObuShowConstants.RTS.RTI_TYPE_VEHICLE_QUEUE -> { //车队
appId = EventTypeEnumNew.TYPE_VEHICLE_QUEUE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_PASSING -> { //不通
MogoObuShowConstants.RTS.RTI_TYPE_NO_PASSING -> { //不通
appId = EventTypeEnumNew.TYPE_NO_PASSING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TURNING_AROUND -> { //禁止掉头
MogoObuShowConstants.RTS.RTI_TYPE_NO_TURNING_AROUND -> { //禁止掉头
appId = EventTypeEnumNew.TYPE_NO_TURNING_AROUND.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_STOPPING -> { //禁止停车
MogoObuShowConstants.RTS.RTI_TYPE_NO_STOPPING -> { //禁止停车
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TOOTING -> { //禁止鸣笛
MogoObuShowConstants.RTS.RTI_TYPE_NO_TOOTING -> { //禁止鸣笛
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType
}
// MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
// MogoObuShowConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
// appId =
// EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
MogoObuShowConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NARROW_RIGHT -> { //右侧变窄/车道数减少
MogoObuShowConstants.RTS.RTI_TYPE_NARROW_RIGHT -> { //右侧变窄/车道数减少
appId =
EventTypeEnumNew.TYPE_USECASE_ID_NARROW_RIGHT.poiType
}
MogoObuConstants.RTS.RTI_TYPE_GAS_STATION -> { //加油站
MogoObuShowConstants.RTS.RTI_TYPE_GAS_STATION -> { //加油站
appId = EventTypeEnumNew.TYPE_USECASE_ID_GAS_STATION.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
MogoObuShowConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故
MogoObuShowConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故
appId = EventTypeEnumNew.TYPE_USECASE_ID_ACCIDENT.poiType
}
MogoObuShowConstants.RTS.RTI_TYPE_ATTENTION_CONFLUENCE -> { //注意合流
appId = EventTypeEnumNew.TYPE_ATTENTION_CONFLUENCE.poiType
}
MogoObuShowConstants.RTS.RTI_TYPE_PEDESTRIAN_CROSSING -> { //人行横道
appId = EventTypeEnumNew.TYPE_PEDESTRIAN_CROSSING.poiType
}
}
alertContent = EventTypeEnumNew.getWarningContent(appId)
@@ -422,12 +509,13 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
)
ttsContent = String.format(
ttsContent,
Math.round(data.warningMsgList[0].distance).toString()
ConvertUtils.intToChinese(
data.warningMsgList[0].distance.roundToInt())
)
}
// 拥堵
MogoObuConstants.RSI_SCENE_TYPE.TJW.toString() -> {
MogoObuShowConstants.RSI_SCENE_TYPE.TJW.toString() -> {
appId = EventTypeEnumNew.TYPE_USECASE_ID_TJW.poiType
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
@@ -438,16 +526,28 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
)
ttsContent = String.format(
ttsContent,
Math.round(data.warningMsgList[0].distance).toString(),
Math.round(data.warningMsgList[0].eventRadius).toString()
ConvertUtils.intToChinese(
data.warningMsgList[0].distance.roundToInt()),
ConvertUtils.intToChinese(
data.warningMsgList[0].eventRadius.roundToInt())
)
}
//限速预警, ADD处理一次
MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> {
MogoObuShowConstants.RSI_SCENE_TYPE.SLW.toString() -> {
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
// alertContent = EventTypeEnumNew.getWarningContent(appId)
// ttsContent = EventTypeEnumNew.getWarningTts(appId)
if (mLimitSpeed > 0) {
alertContent = String.format(
EventTypeEnumNew.getWarningContent(appId),
mLimitSpeed
)
ttsContent = String.format(
EventTypeEnumNew.getWarningTts(appId),
ConvertUtils.intToChinese(mLimitSpeed)
)
}
}
}
@@ -455,40 +555,44 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"new onMogoObuRsiWarning appId = $appId ---status = $status --- ttsContent = $ttsContent --alertContent = $alertContent -- eventSerialNum = ${data.warningMsgList[0].eventSerialNum} ---signSerialNum = ${data.warningMsgList[0].signSerialNum} ---direction = ${direction.direction} --distance = ${
Math.round(data.warningMsgList[0].distance)
} ---eventRadius = ${Math.round(data.warningMsgList[0].eventRadius)} --speedMaxLimit = ${data.warningMsgList[0].speedMaxLimit.toInt()}"
} ---eventRadius = ${Math.round(data.warningMsgList[0].eventRadius)} --speedMaxLimit = ${data.warningMsgList[0].speedMaxLimit.toInt()} ---mLimitSpeed = $mLimitSpeed"
)
when (status) {
MogoObuConstants.STATUS.ADD -> { // 添加
MogoObuShowConstants.STATUS.ADD -> { // 添加
//不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
//大于10m才提示rsi
if (Math.round(data.warningMsgList[0].distance) > 10) {
//大于10m才提示rsi。超速不限制
if (appId == "6666") {
saveObuData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
} else {
if (Math.round(data.warningMsgList[0].distance) > 10) {
saveObuData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
}
}
// 更新数据
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
MogoObuShowConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
MogoObuShowConstants.STATUS.DELETE -> { // 删除
// 更新数据
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)
?.let {
// 事件结束,还原车辆颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficInfo(it)
TrafficMarkerDrawer.updateITrafficInfo(it)
}
}
}
@@ -540,31 +644,29 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
"onMogoObuRsmWarning ---- data.status = ${data.status} ---data.participant.ptcId = ${data.participant.ptcId} ---data.participant.ptcType = ${data.participant.ptcType} ---data.warningMsg = ${data.warningMsg} -----data = ${data.toString()}"
)
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
MogoObuShowConstants.STATUS.ADD -> { // 添加
// 更新数据模型变色的时候是不是update,如果不是更新可能导致模型不变色add的时候是否有level高的 TODO
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
MogoObuShowConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
MogoObuShowConstants.STATUS.DELETE -> { // 删除
// 更新数据 TODO 删除原来的改变颜色删除marker。不影响别的模型添加
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)
?.let {
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString())
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(data.participant.ptcId.toString())
}
}
@@ -576,12 +678,11 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
"onMogoObuRsmWarning ---status---> ${data.status} ---data.warningMsg.warningData[0].status = ${data.warningMsg.warningDataList[0].status} ---v2xType = $v2xType ---alertContent = $alertContent ---ttsContent = $ttsContent ---level = $level"
)
when (data.warningMsg.warningDataList[0].status) {
MogoObuConstants.STATUS.ADD -> { // 添加
MogoObuShowConstants.STATUS.ADD -> { // 添加
//更新模型的颜色
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
@@ -591,15 +692,14 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
showWarning(v2xType, alertContent, ttsContent, direction)
}
MogoObuConstants.STATUS.UPDATE -> {// 更新
MogoObuShowConstants.STATUS.UPDATE -> {// 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
MogoObuShowConstants.STATUS.DELETE -> { // 删除
// 关闭警告红边
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString())
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(data.participant.ptcId.toString())
}
}
}
@@ -619,9 +719,10 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
"onMogoObuMapMath = ${data.status} --speedMaxLimit = ${(data.speedMaxLimit * 3.6).roundToInt()}"
)
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
MogoObuShowConstants.STATUS.ADD -> { // 添加
UiThreadHandler.post {
if (data.speedMaxLimit > 0) {
mLimitSpeed = (data.speedMaxLimit * 3.6).roundToInt()
CallerLimitingVelocityListenerManager.invokeUnion(
(data.speedMaxLimit * 3.6).roundToInt(), DataSourceType.OBU
)
@@ -629,10 +730,10 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
MogoObuShowConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
MogoObuShowConstants.STATUS.DELETE -> { // 删除
UiThreadHandler.post {
CallerLimitingVelocityListenerManager.invokeUnion(
-1,
@@ -651,22 +752,22 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
*/
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
MogoObuShowConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE,
MogoObuShowConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方
MogoObuShowConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
MogoObuShowConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方
MogoObuShowConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuShowConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT,
MogoObuShowConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuShowConstants.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
MogoObuShowConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuShowConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT,
MogoObuShowConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuShowConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT
-> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuShowConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方
MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
MogoObuShowConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
else -> WarningDirectionEnum.ALERT_WARNING_ALL
}
}
@@ -691,7 +792,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
var changeVisualAngle = false
when (appId) {
//前向碰撞预警
MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> {
MogoObuShowConstants.V2X_WARNING_TYPE.FCW.toString() -> {
if (FunctionBuildConfig.isObuWarningFusionUnion && level == 3) {
alertContent = "前车距离过近"
ttsContent = "前车距离过近"
@@ -705,7 +806,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
//交叉路口碰撞预警
MogoObuConstants.V2X_WARNING_TYPE.ICW.toString() -> {
MogoObuShowConstants.V2X_WARNING_TYPE.ICW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType)
ttsContent =
@@ -714,7 +815,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
//左转辅助预警
MogoObuConstants.V2X_WARNING_TYPE.LTA.toString() -> {
MogoObuShowConstants.V2X_WARNING_TYPE.LTA.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType)
ttsContent =
@@ -723,7 +824,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
//盲区预警
MogoObuConstants.V2X_WARNING_TYPE.BSW.toString() -> {
MogoObuShowConstants.V2X_WARNING_TYPE.BSW.toString() -> {
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType)
alertContent =
@@ -749,7 +850,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
// 变道预警,注意左后车辆/注意右后车辆
MogoObuConstants.V2X_WARNING_TYPE.LCW.toString() -> {
MogoObuShowConstants.V2X_WARNING_TYPE.LCW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType)
ttsContent =
@@ -773,7 +874,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
//逆向超车预警
MogoObuConstants.V2X_WARNING_TYPE.DNPW.toString() -> {
MogoObuShowConstants.V2X_WARNING_TYPE.DNPW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType)
ttsContent =
@@ -782,7 +883,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
//紧急制动预警
MogoObuConstants.V2X_WARNING_TYPE.EBW.toString() -> {
MogoObuShowConstants.V2X_WARNING_TYPE.EBW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType)
ttsContent =
@@ -791,7 +892,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
//异常车辆提醒
MogoObuConstants.V2X_WARNING_TYPE.AVW.toString() -> {
MogoObuShowConstants.V2X_WARNING_TYPE.AVW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType)
ttsContent =
@@ -801,7 +902,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
//车辆失控预警
MogoObuConstants.V2X_WARNING_TYPE.CLW.toString() -> {
MogoObuShowConstants.V2X_WARNING_TYPE.CLW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType)
ttsContent =
@@ -811,7 +912,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
ttsContent = String.format(ttsContent, direction.desc)
}
//车辆失控预警
MogoObuConstants.V2X_WARNING_TYPE.EVW.toString() -> {
MogoObuShowConstants.V2X_WARNING_TYPE.EVW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType)
ttsContent =
@@ -822,8 +923,8 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
when (status) {
// 添加,更新 add的时候可能级别是2
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE -> {
MogoObuShowConstants.STATUS.ADD,
MogoObuShowConstants.STATUS.UPDATE -> {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"new handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
@@ -831,8 +932,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
if (level == 2 || level == 3) {
//不显示弹框,其它保留
saveObuData(v2xType, alertContent, ttsContent)
CallerHmiManager.warningV2X(
v2xType,
CallerHmiManager.warningV2X(v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
object : IMoGoWarningStatusListener {
@@ -848,26 +948,26 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
CallerVisualAngleManager.changeAngle(Default())
}
}
}, direction
},
direction,
isFromObu = true
)
}
//更新周边车辆进行预警颜色变换,车辆实时移动和变色 UUID不需要匹配了
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
CallerObuWarningListenerManager.invokeTrackerWarningInfo(it)
}
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
MogoObuShowConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
CallerObuWarningListenerManager.removeTrackerWarningInfo(it)
}
}
@@ -888,16 +988,15 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
)
when (status) {
// 添加
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE -> {
MogoObuShowConstants.STATUS.ADD,
MogoObuShowConstants.STATUS.UPDATE -> {
if (lights != null && lights.isNotEmpty()) {
changeTrafficLightStatus(appId, lights)
}
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
MogoObuShowConstants.STATUS.DELETE -> {
// 移除顶部弹窗
CallerTrafficLightListenerManager.disableTrafficLight()
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
isShowGreenWave = false
isShowRunRedLight = false
@@ -918,6 +1017,8 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
) {
var ttsContent = ""
var alertContent = ""
var ttsContentNew = ""
var alertContentNew = ""
//这里需要根据真实数据确定 index 取值方式
val currentLight = lights[0]
CallerLogger.d(
@@ -930,57 +1031,20 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if (!isShowRunRedLight) {
isShowRunRedLight = true
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
saveObuData(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent
)
showWarning(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent,
WarningDirectionEnum.ALERT_WARNING_NON
)
}
}
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候
if (!isShowGreenWave) {
isShowGreenWave = true
var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6)
var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6)
if (minSpeedTemp == maxSpeedTemp) {
minSpeedTemp -= 5
}
val adviceSpeed = "$minSpeedTemp - $maxSpeedTemp"
val adviceSpeedTts = "$minSpeedTemp$maxSpeedTemp"
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
if (maxSpeed > 0) {
if (HmiBuildConfig.isShowRunRedLightView) {
if (!isShowRunRedLight) {
isShowRunRedLight = true
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
saveObuData(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent
)
showWarning(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent,
WarningDirectionEnum.ALERT_WARNING_NON
@@ -988,6 +1052,58 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
}
}
}
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候
if (HmiBuildConfig.isShowGreenWaveView) {
if (!isShowGreenWave) {
isShowGreenWave = true
var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6)
var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6)
if (minSpeedTemp == maxSpeedTemp) {
minSpeedTemp -= 5
}
// val adviceSpeed = "$minSpeedTemp - $maxSpeedTemp"
// val adviceSpeedTts = "$minSpeedTemp 到 $maxSpeedTemp"
// 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
if (maxSpeed > 0) {
var currentSpeed =
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().gnssSpeed.toDouble()
if (currentSpeed > 0) {
ttsContentNew =
if ((currentSpeed * 3.6).roundToInt() in (minSpeedTemp + 1) until maxSpeedTemp) {
"蘑菇路侧提醒您,推荐保持当前车速通过路口"
} else {
"蘑菇路侧提醒您,推荐保持车速$minSpeedTemp - $maxSpeedTemp KM/H通过路口"
}
alertContentNew = "推荐车速$minSpeedTemp - $maxSpeedTemp KM/H"
}
saveObuData(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContentNew,
ttsContentNew
)
showWarning(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContentNew,
ttsContentNew,
WarningDirectionEnum.ALERT_WARNING_NON
)
}
}
}
}
}
when (currentLight.light) {
@@ -1050,13 +1166,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
tts: String,
direction: WarningDirectionEnum
) {
CallerHmiManager.warningV2X(
type,
content,
tts,
null,
direction
)
CallerHmiManager.warningV2X(type, content, tts, null, direction, isFromObu = true)
}
}

View File

@@ -4,6 +4,7 @@ import com.mogo.eagle.core.function.call.obu.*
import com.mogo.support.obu.ObuScene
import com.mogo.support.obu.constants.Define.ConnectStatus
import com.mogo.support.obu.model.*
import com.mogo.support.obu.model.result.BaseResult
import com.zhidao.support.obu.OnObuListener
import mogo.telematics.pad.MessagePad
@@ -99,4 +100,7 @@ object MoGoObuListenerImpl : OnObuListener {
}
override fun onObuCallResult(result: BaseResult?) {
}
}

View File

@@ -0,0 +1,10 @@
package com.mogo.eagle.core.function.datacenter.obu.const
class ObuConst {
companion object {
@JvmStatic
val OBU_MARKER_OWNER = "obu_new_marker_owner"
}
}

View File

@@ -0,0 +1,239 @@
package com.mogo.eagle.core.function.datacenter.obu.drawer
import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler
import android.os.Message
import android.text.TextUtils
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.DataTypes
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.data.traffic.threatLevelColor
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.function.datacenter.obu.const.*
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
import com.mogo.map.overlay.core.Level.MAP_MARKER
import com.mogo.map.overlay.point.*
import java.util.concurrent.ConcurrentHashMap
/**
* 此类用于obu/v2x预警绘制交通元素 2D\3D绘制
* obu:与其进行调试单独展示与debugview上感知开关相关联
* v2x:绘制云端预警marker不会做感知控制管理后续根据注解的方式来控制v2x业务
*/
@SuppressLint("StaticFieldLeak")
object TrafficMarkerDrawer {
private const val TAG = "TrafficMarkerDrawer"
private var mContext: Context? = null
// 动画持续时间
private const val stepTime = 150L
// 维护Obu识别的他车集合
private val mTrafficMap = ConcurrentHashMap<String, TrafficData>()
// 地图内部资源md5缓存便于资源复用
private val mMarkerCachesResMd5Values = ConcurrentHashMap<String, String>()
// 上一帧数据的缓存,用来做移动动画
private val mMarkersCaches = ConcurrentHashMap<String, Point?>()
// 维护一个线程定时轮询数据进行地图绘制
private val mDrawerHandler: Handler =
object : Handler(WorkThreadHandler.newInstance("other_traffic_drawer").looper) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
if (FunctionBuildConfig.debugTrackerProvider == 1) {
drawerTrafficInfo()
}
// 延时50毫秒重复发送自己定时轮询进行车辆绘制可以及时将已经不存在车辆删除
sendEmptyMessageDelayed(0, 50L)
}
}
init {
mContext = AbsMogoApplication.getApp()
mDrawerHandler.sendEmptyMessageDelayed(1, 0L)
}
/**
* 更新识别数据,V2V预警的时候需要修改车辆颜色
*/
fun updateITrafficInfo(trafficData: TrafficData) {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
}
}
/**
* 更新识别数据位置
*/
fun updateITrafficLocationInfo(trafficData: TrafficData) {
CallerLogger.d(TAG, "updateITrafficLocationInfo trafficData = $trafficData")
CallerLogger.d(TAG,
"trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel + "----FunctionBuildConfig.debugTrackerProvider = " + FunctionBuildConfig.debugTrackerProvider)
if (FunctionBuildConfig.debugTrackerProvider != 1) {
return
}
val tempTraffic = mTrafficMap[trafficData.uuid]
if (tempTraffic != null) {
tempTraffic.lat = trafficData.lat
tempTraffic.lon = trafficData.lon
tempTraffic.heading = trafficData.heading
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = tempTraffic
}
} else {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
}
}
}
/**
* 更新识别数据颜色
*/
fun updateITrafficThreatLevelInfo(trafficData: TrafficData) {
CallerLogger.d(TAG,
"trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel + "----FunctionBuildConfig.debugTrackerProvider = " + FunctionBuildConfig.debugTrackerProvider)
if (FunctionBuildConfig.debugTrackerProvider != 1) {
return
}
if (!TextUtils.isEmpty(trafficData.uuid)) {
val tempTraffic = mTrafficMap[trafficData.uuid]
if (tempTraffic != null) {
tempTraffic.lat = trafficData.lat
tempTraffic.lon = trafficData.lon
tempTraffic.heading = trafficData.heading
tempTraffic.threatLevel = trafficData.threatLevel
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = tempTraffic
}
} else {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
}
}
}
}
/**
* 移除识别的数据
*/
fun removeCvxRvInfoIndInfo(key: String) {
if (mTrafficMap.containsKey(key)) {
mTrafficMap.remove(key)
mMarkersCaches[key]?.let {
it.delegate?.remove()
}
}
}
/**
* 绘制
*/
private fun drawerTrafficInfo() {
// 数据为空的时候清除所有数据
if (mTrafficMap.isEmpty()) {
mMarkersCaches.forEach { it ->
it.value?.also { CallerMapUIServiceManager.getOverlayManager()?.removePoint(it) }
}
mMarkersCaches.clear()
} else {
// 循环绘制识别的数据
mTrafficMap.forEach {
// 如果数据已经存在 Marker取出做动画
if (mMarkersCaches[it.key] != null) {
mMarkersCaches[it.key]?.let { marker ->
changeDynamicMarker(marker, it.value)
}
}
// 不存在的添加Marker绘制
else {
drawObuRecognizedDataMarker(it.value)
}
}
}
}
/**
* 绘制单条
*/
private fun drawObuRecognizedDataMarker(trafficData: TrafficData) {
CallerLogger.d(
TAG,
"drawObuRecognizedDataMarker trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
)
val resId: Int = trafficData.type.traffic3DIconId
val resIdVal = resId.toString() + ""
val builder = Point.Options.Builder(DataTypes.TYPE_MARKER_ADAS, MAP_MARKER)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.isUseGps(true)
.controlAngle(true)
.resName(mMarkerCachesResMd5Values[resIdVal])
.icon3DRes(resId)
.rotate(trafficData.heading.toFloat())
.longitude(trafficData.lon)
.latitude(trafficData.lat)
if (trafficData.type != TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE) {
// 修改颜色
mMarkersCaches[trafficData.uuid]?.also {
CallerMapUIServiceManager.getOverlayManager()?.showOrUpdatePoint(it.option.builder().anchorColor(trafficData.threatLevelColor()).build())
}
}
val options = builder.build()
val point = CallerMapUIServiceManager.getOverlayManager()?.showOrUpdatePoint(options) // val marker = MogoMarkerManager.getInstance(mContext)
// .addMarker(DataTypes.TYPE_MARKER_OBU_DATA, options)
// 缓存3D资源
mMarkerCachesResMd5Values[resIdVal] = options.resName ?: "" // 缓存数据
if (trafficData.uuid != null) {
mMarkersCaches[trafficData.uuid!!] = point
}
}
/**
* 带动画的修改Marker
*/
private fun changeDynamicMarker(
marker: Point,
trafficData: TrafficData
) {
CallerLogger.d(
TAG,
"changeDynamicMarker trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
)
if (trafficData.type != TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE) {
mMarkersCaches[trafficData.uuid]?.also {
CallerMapUIServiceManager.getOverlayManager()?.showOrUpdatePoint(it.option.builder().anchorColor(trafficData.threatLevelColor()).build())
}
}
try {
marker.delegate?.addDynamicAnchorPosition(
com.mogo.eagle.core.data.map.MogoLatLng(
trafficData.lat,
trafficData.lon
),
trafficData.heading.toFloat(),
stepTime
)
} catch (e: Exception) {
e.printStackTrace()
try {
drawObuRecognizedDataMarker(trafficData)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
}

View File

@@ -4,12 +4,19 @@ import android.content.Context
import android.os.CountDownTimer
import android.os.Handler
import com.mogo.eagle.core.data.biz.trafficlight.*
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.GsonUtils
import perception.TrafficLightOuterClass
import perception.TrafficLightOuterClass.TrafficLight
@@ -45,7 +52,6 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
val INSTANCE: TrafficLightDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
TrafficLightDispatcher()
}
}
private var mContext: Context? = null
@@ -58,7 +64,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
@Volatile
private var hasObuLightStatus: Boolean = false
private var lightCountDownTimer: CountDownTimer ?= null
private var lightCountDownTimer: CountDownTimer?= null
private var lastLightTime: Long = System.currentTimeMillis()
fun initServer(context: Context) {
@@ -111,7 +117,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
}
if (light == null) {
//隐藏红绿灯显示
CallerTrafficLightListenerManager.disableTrafficLight()
hide()
} else {
onTrafficLightPlusSource(light.convert(), 0, DataSourceType.TELEMATIC)
}
@@ -124,6 +130,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
* AI云获取红绿灯状态
*/
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.SHOW_TRAFFIC_LIGHT, GsonUtils.toJson(trafficLightResult).toByteArray())
}
if (!hasObuLightStatus) {
hasAiLightStatus = true
updateTrafficLight(trafficLightResult)
@@ -140,8 +149,14 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
hasAiLightStatus = false
hasObuLightStatus = false
}, 5000)
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.HIDE_TRAFFIC_LIGHT, "0".toByteArray())
}
//如果没有OBU灯态则进行隐藏如果有OBU灯态则交由OBU管理
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
if(!hasObuLightStatus){
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
hide()
}
}
}
@@ -151,6 +166,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
override fun onTrafficRequestError() {
hasAiLightStatus = false
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
if(!hasObuLightStatus){
hide()
}
}
/**
@@ -158,6 +176,24 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
*/
override fun onObuTrafficLightDisapper() {
hasObuLightStatus = false
hide()
}
/**
* 是否重置红绿灯数据,需要确保在obu的红绿灯显示的时候不执行。否则会闪屏
*/
override fun resetTrafficLight(isReset: Boolean) {
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "resetTrafficLight ------> isReset = $isReset ---hasObuLightStatus = $hasObuLightStatus")
if (!hasObuLightStatus) {
if(isReset){
hide()
}
}
}
private fun hide(){
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "hide() ---------> ")
CallerTrafficLightListenerManager.disableTrafficLight()
}
/**
@@ -169,7 +205,6 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
lightSource: DataSourceType
) {
super.onTrafficLightPlusSource(light, remain, lightSource)
if (lightSource == DataSourceType.OBU) {
hasObuLightStatus = true
}
@@ -193,6 +228,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
TrafficLightEnum.BLACK -> {
CallerTrafficLightListenerManager.disableTrafficLight()
}
else -> {
hide()
}
}
}

View File

@@ -92,6 +92,22 @@ object DataManager {
}
}
fun delMsgTable(context: Context) {
if (Thread.currentThread() == Looper.getMainLooper().thread) {
scope.launch {
withContext(Dispatchers.Default) {
MsgBoxDb.getDb(context)
.monitorDao()
.deleteMsgTable()
}
}
} else {
MsgBoxDb.getDb(context)
.monitorDao()
.deleteMsgTable()
}
}
private fun realSaveMsg(msg: MsgBoxBean) {
val type = msg.type
msg.timestamp = System.currentTimeMillis()

View File

@@ -34,6 +34,10 @@ class MsgBoxProvider : IMsgBoxProvider {
DataManager.saveMsg(bean)
}
override fun delMsgTable(context: Context) {
DataManager.delMsgTable(context)
}
override fun getCachedNotifyData(): List<MsgBoxBean> {
return DataManager.getNotifyData()
}

View File

@@ -15,4 +15,7 @@ interface MsgBoxDao {
@Query("SELECT * FROM t_msg_box")
fun getAllCachedMessages(): List<MsgBoxInfo>
@Query("DELETE FROM t_msg_box")
fun deleteMsgTable()
}