diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperLimitingVelocityView.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperLimitingVelocityView.java index a0ac193c03..b8831bae9f 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperLimitingVelocityView.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperLimitingVelocityView.java @@ -22,8 +22,8 @@ public class SweeperLimitingVelocityView extends IViewLimitingVelocity { initView(context); } @Override - public void updateLimitingSpeed(int limitingSpeed) { - super.updateLimitingSpeed(limitingSpeed); + public void updateLimitingSpeed(int limitingSpeed, int limitSource) { + super.updateLimitingSpeed(limitingSpeed, limitSource); limitingVelocity.setText(String.valueOf(limitingSpeed)); } private void initView(@NonNull Context context) { diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficDataView.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficDataView.java index 4164276bcf..7546c63533 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficDataView.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficDataView.java @@ -20,8 +20,8 @@ import org.jetbrains.annotations.NotNull; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintLayout; -import chassis.Chassis; -import chassis.VehicleStateOuterClass; +//import chassis.Chassis; +//import chassis.VehicleStateOuterClass; public class SweeperTrafficDataView extends ConstraintLayout { private static final String TAG = "SweeperTrafficDataView"; @@ -70,84 +70,84 @@ public class SweeperTrafficDataView extends ConstraintLayout { CallLimitingVelocityListenerManager.INSTANCE.removeListener(limitingVelocityListener); } private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() { - @Override - public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { - } - - /** - * 车辆转向灯 - * @param lightSwitch - */ - @Override - public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) { - //转向灯状态 0是正常 1是左转 2是右转 - if (lightSwitch != null) { - CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString()); - if (lightSwitch.getNumber()==1){ - sweeperTurnSignal.showLeftSignal(); - }else if(lightSwitch.getNumber()==2){ - sweeperTurnSignal.showRightSignal(); - }else{ - sweeperTurnSignal.showDirection(); - } - } - } - - /** - * 刹车灯 - * @param brakeLight - */ - @Override - public void onAutopilotBrakeLightData(boolean brakeLight) { - CallerLogger.INSTANCE.d(TAG, "刹车灯:" + brakeLight); - } - - /** - * 方向盘转向角 左+右- - * @param steering - */ - @Override - public void onAutopilotSteeringData(float steering) { - CallerLogger.INSTANCE.d(TAG, "steering原始值====" + steering); - if (Math.abs(steering) < 1) { - steering = 0; - } - CallerLogger.INSTANCE.d(TAG, "steering忽略小数点后====" + (int) steering); - } - - /** - * 档位 - * @param gear - */ - @Override - public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) { - CallerLogger.INSTANCE.d(TAG, "司机屏档位" + gear.toString()); - ThreadUtils.runOnUiThread(() -> { - if (tapPositionView != null) { - tapPositionView.updateWithGear(gear); - } - }); - } +// @Override +// public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { +// } +// +// /** +// * 车辆转向灯 +// * @param lightSwitch +// */ +// @Override +// public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) { +// //转向灯状态 0是正常 1是左转 2是右转 +// if (lightSwitch != null) { +// CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString()); +// if (lightSwitch.getNumber()==1){ +// sweeperTurnSignal.showLeftSignal(); +// }else if(lightSwitch.getNumber()==2){ +// sweeperTurnSignal.showRightSignal(); +// }else{ +// sweeperTurnSignal.showDirection(); +// } +// } +// } +// +// /** +// * 刹车灯 +// * @param brakeLight +// */ +// @Override +// public void onAutopilotBrakeLightData(boolean brakeLight) { +// CallerLogger.INSTANCE.d(TAG, "刹车灯:" + brakeLight); +// } +// +// /** +// * 方向盘转向角 左+右- +// * @param steering +// */ +// @Override +// public void onAutopilotSteeringData(float steering) { +// CallerLogger.INSTANCE.d(TAG, "steering原始值====" + steering); +// if (Math.abs(steering) < 1) { +// steering = 0; +// } +// CallerLogger.INSTANCE.d(TAG, "steering忽略小数点后====" + (int) steering); +// } +// +// /** +// * 档位 +// * @param gear +// */ +// @Override +// public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) { +// CallerLogger.INSTANCE.d(TAG, "司机屏档位" + gear.toString()); +// ThreadUtils.runOnUiThread(() -> { +// if (tapPositionView != null) { +// tapPositionView.updateWithGear(gear); +// } +// }); +// } @Override public void onAutopilotDataException(long timestamp) { } - @Override - public void onAutopilotAcc(float carAcc) { - - } - - @Override - public void onAutopilotBrake(float brake) { - CallerLogger.INSTANCE.d(TAG, "刹车:" + brake); - } - - @Override - public void onAutopilotThrottle(float throttle) { - CallerLogger.INSTANCE.d(TAG, "油门:" + throttle); - } +// @Override +// public void onAutopilotAcc(float carAcc) { +// +// } +// +// @Override +// public void onAutopilotBrake(float brake) { +// CallerLogger.INSTANCE.d(TAG, "刹车:" + brake); +// } +// +// @Override +// public void onAutopilotThrottle(float throttle) { +// CallerLogger.INSTANCE.d(TAG, "油门:" + throttle); +// } }; /** @@ -158,7 +158,7 @@ public class SweeperTrafficDataView extends ConstraintLayout { @Override public void onLimitingVelocityChange(int limitingVelocity) { //设置限速 - sweeperLimitingVelocity.updateLimitingSpeed(limitingVelocity); + sweeperLimitingVelocity.updateLimitingSpeed(limitingVelocity, 0); //此处小兵合并下 } }; /** diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/FuncBizProvider.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/FuncBizProvider.kt index f0ba86b92a..528509bea4 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/FuncBizProvider.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/FuncBizProvider.kt @@ -11,6 +11,7 @@ import com.mogo.eagle.function.biz.monitoring.CronTaskManager.Companion.cronTask import com.mogo.eagle.function.biz.notice.NoticeSocketManager.Companion.noticeSocketManager import com.mogo.eagle.function.biz.notice.network.NoticeNetWorkManager import com.mogo.eagle.function.biz.v2x.speedlimit.SpeedLimitDataManager +import com.mogo.eagle.function.biz.v2x.speedlimit.SpeedLimitDispatcher import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightDispatcher import com.mogo.eagle.function.biz.v2x.vip.VipCarManager @@ -30,6 +31,7 @@ class FuncBizProvider : IMoGoFuncBizProvider { TrafficLightDispatcher.INSTANCE.initServer(context) //todo 红绿灯中心模块放入dataCenter VipCarManager.INSTANCE.initServer(context) SpeedLimitDataManager.getInstance().start() + SpeedLimitDispatcher.INSTANCE.initLimit(context) // RedLightWarningManager.INSTANCE.listenTrafficLight() } diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/speedlimit/SpeedLimitDataManager.java b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/speedlimit/SpeedLimitDataManager.java index 6c00429fd9..c3e3ffedb3 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/speedlimit/SpeedLimitDataManager.java +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/speedlimit/SpeedLimitDataManager.java @@ -61,15 +61,16 @@ public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener @BizConfig(biz = V2I, dependentBizNode = "", bizNode = BIZ_SLW) private void getSpeedLimit() { - if (!isShowObuLimitSpeedView) { +// if (!isShowObuLimitSpeedView) { int speedLimit = CallerMapUIServiceManager.INSTANCE.getMapUIController().getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), (float) mLocation.getHeading()); UiThreadHandler.post(() -> { if (speedLimit > 0) { - CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimit); +// CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimit, 1); CallLimitingVelocityListenerManager.INSTANCE.invokeOnLimitingVelocityChange(speedLimit); + } }); - } +// } } } diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/speedlimit/SpeedLimitDispatcher.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/speedlimit/SpeedLimitDispatcher.kt new file mode 100644 index 0000000000..c236c2ed0e --- /dev/null +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/speedlimit/SpeedLimitDispatcher.kt @@ -0,0 +1,70 @@ +package com.mogo.eagle.function.biz.v2x.speedlimit + +import android.content.Context +import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener +import com.mogo.eagle.core.function.api.v2x.ObuLimitingSpeedListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager +import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager +import com.mogo.eagle.core.function.call.v2x.CallObuLimitingSpeedListenerManager + +/** + * @author lixiaopeng + * @description 对多个限速进行调度(map,rsu ...) + * @since: 2023/1/12 + */ +class SpeedLimitDispatcher : LimitingVelocityListener, ObuLimitingSpeedListener { + companion object { + const val TAG = "SpeedLimitDispatcher" + val INSTANCE: SpeedLimitDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { + SpeedLimitDispatcher() + } + } + + private var mContext: Context? = null + + //是否有AI获取红绿灯灯态 + private var hasObuStatus: Boolean = false + + + fun initLimit(context: Context) { + mContext = context + //注册监听MAP的限速 + CallLimitingVelocityListenerManager.addListener(TAG, this) + //注册监听OBU的限速 + CallObuLimitingSpeedListenerManager.addListener(TAG, this) + } + + /** + * 地图限速数据 + */ + override fun onLimitingVelocityChange(limitingVelocity: Int) { +// CallerHmiManager.disableLimitingVelocity() + if (!hasObuStatus) { + CallerHmiManager.showLimitingVelocity(limitingVelocity, 1) + } + } + + /** + * obu限速 + */ + override fun onObuLimitingSpeedChange(limitingSpeed: Int) { +// CallerHmiManager.disableLimitingVelocity() + if (limitingSpeed > 0) { + hasObuStatus = true + CallerHmiManager.showLimitingVelocity(limitingSpeed, 2) + } else { + hasObuStatus = false + CallerHmiManager.disableLimitingVelocity() + } + } + + fun destroy() { + //取消注册监听AI云获取红绿灯状态 + CallerTrafficLightListenerManager.removeListener(TAG) + //取消注册监听工控机感知红绿灯 + CallerAutopilotIdentifyListenerManager.removeListener(TAG) + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/TrafficLightDispatcher.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/TrafficLightDispatcher.kt index 2b9099ee0f..2e65445525 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/TrafficLightDispatcher.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/TrafficLightDispatcher.kt @@ -4,9 +4,11 @@ import android.content.Context import android.os.Handler import com.mogo.eagle.core.data.trafficlight.TrafficLightResult import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener +import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightListener import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.obu.CallerObuTrafficLightListenerManager import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager import com.mogo.eagle.function.biz.v2x.trafficlight.TrafficLightHMIManager import perception.TrafficLightOuterClass @@ -17,26 +19,36 @@ import perception.TrafficLightOuterClass.TrafficLight * @description 对多个红绿灯信号来源进行统一调度(AI云、工控机) * @since: 2022/4/28 */ -class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLightListener { +class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLightListener, + IMoGoObuTrafficLightListener { - companion object{ + companion object { const val TAG = "TrafficLightDispatcher" - val INSTANCE: TrafficLightDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED){ + val INSTANCE: TrafficLightDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { TrafficLightDispatcher() } } private var mContext: Context? = null + //是否有AI获取红绿灯灯态 private var hasAiLightStatus: Boolean = false + //obu数据 + private var hasObuLightStatus: Boolean = false - fun initServer(context: Context){ + fun initServer(context: Context) { mContext = context - //注册监听AI云获取红绿灯状态,注册监听AI云进入路口,注册监听红绿灯请求失败 + //注册监听AI云获取红绿灯状态 + CallerTrafficLightListenerManager.addListener(TAG, this) + //注册监听AI云进入路口 + CallerTrafficLightListenerManager.addListener(TAG, this) + //注册监听红绿灯请求失败 CallerTrafficLightListenerManager.addListener(TAG, this) //注册监听工控机感知红绿灯 CallerAutopilotIdentifyListenerManager.addListener(TAG, this) + //obu红绿灯数据 + CallerObuTrafficLightListenerManager.addListener(TAG, this) } /** @@ -44,46 +56,48 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh * @param trafficLights 感知红绿灯 */ override fun onAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) { - if(!hasAiLightStatus){ - trafficLights?.let { it -> - var light :TrafficLight?= null - if(it.hasStraight()){ - light = it.straight - }else if(it.hasLeft()){ - light = it.left - }else if(it.hasRight()){ - light = it.right - }else if(it.hasUTurn()){ - light = it.uTurn - } - if(light == null){ - //隐藏红绿灯显示 - TrafficLightHMIManager.INSTANCE.hideTrafficLight() - }else{ - when (light.state) { - TrafficLightOuterClass.LightState.STATE_RED -> { - //红灯 - CallerHmiManager.showWarningTrafficLight(1,2) - CallerHmiManager.changeCountdownGreen(0) - } - TrafficLightOuterClass.LightState.STATE_YELLOW -> { - //黄灯 - CallerHmiManager.showWarningTrafficLight(2,2) - CallerHmiManager.changeCountdownGreen(0) - } - TrafficLightOuterClass.LightState.STATE_GREEN -> { - //绿灯 - CallerHmiManager.showWarningTrafficLight(3,2) - CallerHmiManager.changeCountdownGreen(0) - } - TrafficLightOuterClass.LightState.STATE_OFF -> { - //黑灯,隐藏红绿灯显示 - TrafficLightHMIManager.INSTANCE.hideTrafficLight() - } - else -> {} + if (!hasObuLightStatus) { + if (!hasAiLightStatus) { + trafficLights?.let { it -> + var light: TrafficLight? = null + if (it.hasStraight()) { + light = it.straight + } else if (it.hasLeft()) { + light = it.left + } else if (it.hasRight()) { + light = it.right + } else if (it.hasUTurn()) { + light = it.uTurn + } + if (light == null) { + //隐藏红绿灯显示 + TrafficLightHMIManager.INSTANCE.hideTrafficLight() + } else { + when (light.state) { + TrafficLightOuterClass.LightState.STATE_RED -> { + //红灯 + CallerHmiManager.showWarningTrafficLight(1, 2) + CallerHmiManager.changeCountdownGreen(0) + } + TrafficLightOuterClass.LightState.STATE_YELLOW -> { + //黄灯 + CallerHmiManager.showWarningTrafficLight(2, 2) + CallerHmiManager.changeCountdownGreen(0) + } + TrafficLightOuterClass.LightState.STATE_GREEN -> { + //绿灯 + CallerHmiManager.showWarningTrafficLight(3, 2) + CallerHmiManager.changeCountdownGreen(0) + } + TrafficLightOuterClass.LightState.STATE_OFF -> { + //黑灯,隐藏红绿灯显示 + TrafficLightHMIManager.INSTANCE.hideTrafficLight() + } + else -> {} + } } - } + } } } } @@ -92,21 +106,28 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh * AI云获取红绿灯状态 */ override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) { - TrafficLightHMIManager.INSTANCE.updateTrafficLight(trafficLightResult) - hasAiLightStatus = true + if (!hasObuLightStatus) { + TrafficLightHMIManager.INSTANCE.updateTrafficLight(trafficLightResult) + hasAiLightStatus = true + } } /** - * 车辆进入路口 + * 车辆进入路口回调 + * @param enter true:进入路口;false:离开路口 */ override fun onEnterCrossRoad(enter: Boolean) { - if(!enter){ + if (!enter) { Handler().postDelayed({ hasAiLightStatus = false + hasObuLightStatus = false }, 5000) + CallerTrafficLightListenerManager.resetTrafficLightData() + //如果没有OBU灯态则进行隐藏,如果有OBU灯态,则交由OBU管理 + if(!hasObuLightStatus){ + TrafficLightHMIManager.INSTANCE.hideTrafficLight() + } } - - } /** @@ -114,14 +135,32 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh */ override fun onTrafficRequestError() { hasAiLightStatus = false + CallerTrafficLightListenerManager.resetTrafficLightData() + if(!hasObuLightStatus){ + if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) { + TrafficLightHMIManager.INSTANCE.hideTrafficLight() + } + } } + /** + * obu 红绿灯数据 + */ + override fun onObuTrafficLight(light: Int) { + super.onObuTrafficLight(light) + hasObuLightStatus = true + CallerHmiManager.showWarningTrafficLight(light, 3) + } - fun destroy(){ - //取消注册监听AI云获取红绿灯状态,取消注册监听红绿灯请求失败,取消注册监听AI云进入路口 + fun destroy() { + //取消注册监听AI云获取红绿灯状态 CallerTrafficLightListenerManager.removeListener(TAG) //取消注册监听工控机感知红绿灯 CallerAutopilotIdentifyListenerManager.removeListener(TAG) + //取消注册监听红绿灯请求失败 + CallerTrafficLightListenerManager.removeListener(TAG) + //取消注册监听AI云进入路口 + CallerTrafficLightListenerManager.removeListener(TAG) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index f311626dca..73a16dfd68 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -52,6 +52,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListener import com.mogo.eagle.core.function.call.autopilot.CallerPlanningTrajectoryListenerManager.invokeAutopilotTrajectory 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.mogo.eagle.core.utilcode.mogo.logger.Logger import com.zhidao.support.adas.high.AdasManager @@ -533,8 +534,9 @@ class MoGoAdasListenerImpl : OnAdasListener { * @param obuWarningData 数据 */ override fun onObuWarningData(header: MessagePad.Header?, obuWarningData: ObuWarningEvent.ObuWarningData?) { - + CallerObuDcCombineListenerManager.invokeObuDcData(obuWarningData) } + /** * 重构后的功能状态 * diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt index e8d3961a3e..1395d3578f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XLimitingVelocityBroadcastReceiver.kt @@ -57,7 +57,7 @@ class V2XLimitingVelocityBroadcastReceiver : BroadcastReceiver() { * @param limitingVelocitySpeed 限速速度 */ private fun dispatchShowWaring(limitingVelocitySpeed: Int) { - CallerHmiManager.showLimitingVelocity(limitingVelocitySpeed) + CallerHmiManager.showLimitingVelocity(limitingVelocitySpeed, 1) } /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt index 6207e5eb1b..3a60406e12 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt @@ -76,7 +76,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() { tag: String? ) { if (EventTypeEnum.TYPE_USECASE_ID_IVP.poiType == v2xType.toString()) { - CallerHmiManager.showLimitingVelocity(1) + CallerHmiManager.showLimitingVelocity(1, 1) } if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { Log.d("MsgBox-V2XWarningBR", "alertContent或ttsContent为空!") diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 3524050b7d..1553ac9c9b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -663,18 +663,26 @@ class MoGoHmiFragment : MvpFragment(), /** * 控制展示限速标志及内容 */ - override fun showLimitingVelocity(limitingSpeed: Int) { + override fun showLimitingVelocity(limitingSpeed: Int, limitSpeedSource: Int) { // 控制 限速UI 展示 if (HmiBuildConfig.isShowLimitingVelocityView) { if (limitingSpeed > 0) { mViewLimitingVelocity?.visibility = View.VISIBLE - mViewLimitingVelocity?.updateLimitingSpeed(limitingSpeed) + mViewLimitingVelocity?.updateLimitingSpeed(limitingSpeed, limitSpeedSource) + tvLimitingSource?.visibility = View.VISIBLE + if (limitSpeedSource == 1) { + tvLimitingSource.text = "MAP" + } else if (limitSpeedSource == 2) { + tvLimitingSource.text = "RSU" + } } else { mViewLimitingVelocity?.visibility = View.INVISIBLE - mViewLimitingVelocity?.updateLimitingSpeed(0) + mViewLimitingVelocity?.updateLimitingSpeed(0, limitSpeedSource) + tvLimitingSource?.visibility = View.INVISIBLE } } else { disableLimitingVelocity() + tvLimitingSource?.visibility = View.GONE } } @@ -683,7 +691,7 @@ class MoGoHmiFragment : MvpFragment(), */ override fun disableLimitingVelocity() { mViewLimitingVelocity?.visibility = View.GONE - mViewLimitingVelocity?.updateLimitingSpeed(0) + mViewLimitingVelocity?.updateLimitingSpeed(0, 1) } /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt index 0227d92b75..e6afb2b7b2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt @@ -78,6 +78,7 @@ internal class SOPSettingView @JvmOverloads constructor( /** * obu弱势交通控制 */ + tbObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView tbObuWeaknessTrafficSop.setOnCheckedChangeListener { _, isChecked -> if (!isChecked) { //默认开启 CallerHmiManager.setObuWeaknessTraffic(true) @@ -89,6 +90,7 @@ internal class SOPSettingView @JvmOverloads constructor( /** * 云端弱势交通控制 */ + tbCloudWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowCloudWeaknessTrafficView tbCloudWeaknessTrafficSop.setOnCheckedChangeListener { _, isChecked -> if (isChecked) { //默认关闭 CallerHmiManager.setCloudWeaknessTraffic(true) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/LimitingVelocityView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/LimitingVelocityView.kt index b1c509d6f2..c766f7a029 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/LimitingVelocityView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/LimitingVelocityView.kt @@ -20,8 +20,8 @@ class LimitingVelocityView @JvmOverloads constructor( LayoutInflater.from(context).inflate(R.layout.view_limiting_speed_vr, this, true) } - override fun updateLimitingSpeed(limitingSpeed: Int) { - super.updateLimitingSpeed(limitingSpeed) + override fun updateLimitingSpeed(limitingSpeed: Int, limitSource: Int) { + super.updateLimitingSpeed(limitingSpeed, limitSource) tvLimitingVelocity.text = "$limitingSpeed" } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml index e36325e31c..652f98f0f9 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml @@ -179,6 +179,21 @@ app:layout_goneMarginTop="40dp" tools:visibility="gone" /> + + + { //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) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg( + appId, + alertContent, + ttsContent + ) + ) +// .apply { +// sourceType = DataSourceType.TELEMATIC +// } + ) + CallerHmiManager.warningV2X( + 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 -> { // 添加 + //显示警告红边 + CallerHmiManager.showWarning(direction) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg( + v2xType, + alertContent, + ttsContent + ) + ) +// .apply { //TODO +// sourceType = DataSourceType.TELEMATIC +// } + ) + CallerHmiManager.warningV2X( + v2xType, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + (v2xType + direction.direction),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 + object : IMoGoWarningStatusListener { + override fun onDismiss() { + // 关闭警告红边 + CallerHmiManager.showWarning( + WarningDirectionEnum.ALERT_WARNING_NON + ) + } + }, + true, + 5000L + ) + + // 更新数据 TODO +// TrafficDataConvertUtils.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不需要转换 +// TrafficDataConvertUtils.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 -> { // 添加 TODO + CallerHmiManager.showLimitingVelocity(Math.round((data.speedMaxLimit*0.02*3.6)).toInt(), 2) + } + + 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(1667.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 ") + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, + alertContent, + ttsContent + ) + ) +// .apply { +// sourceType = DataSourceType.TELEMATIC +// } + ) + + CallerHmiManager.warningV2X( + 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(1666.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) { + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + alertContent, + ttsContent + ) + ) +// .apply { //TODO +// sourceType = DataSourceType.TELEMATIC +// } + ) + + CallerHmiManager.warningV2X( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + appId.toString(), + 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/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt index 897a9432fe..961844e834 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt @@ -1,11 +1,10 @@ package com.mogo.eagle.core.function.obu.mogo import android.content.Context -import android.util.Log import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig -import com.mogo.eagle.core.data.config.HmiBuildConfig.isShowObuLimitSpeedView import com.mogo.eagle.core.data.enums.* +//import com.mogo.eagle.core.data.msgbox.DataSourceType import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.V2XMsg @@ -18,6 +17,8 @@ import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Defa import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager +import com.mogo.eagle.core.function.call.obu.CallerObuTrafficLightListenerManager +import com.mogo.eagle.core.function.call.v2x.CallObuLimitingSpeedListenerManager import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtilsNew import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU @@ -93,7 +94,6 @@ class MogoPrivateObuNewManager private constructor() { */ override fun onConnectStatus(connectStatus: Int) { if (connectStatus == 0) { //断开连接 - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "onConnectFail ------> ") mObuStatusInfo.obuStatus = false mObuStatusInfo.obuHvStatus = false mObuStatusInfo.obuRvStatus = false @@ -102,7 +102,6 @@ class MogoPrivateObuNewManager private constructor() { mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", false) } mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", false) } } else if (connectStatus == 1) { //连接成功 - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "onConnected ------> ") mObuStatusInfo.obuStatus = true CallerObuListenerManager.invokeListener(mObuStatusInfo) mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) } @@ -170,47 +169,61 @@ class MogoPrivateObuNewManager private constructor() { */ override fun onMogoObuRvWarning(data: MogoObuRvWarningData) { super.onMogoObuRvWarning(data) - if (HmiBuildConfig.isShowObuV2vView) { - mObuStatusInfo.obuRvStatus = true - CallerObuListenerManager.invokeListener(mObuStatusInfo) +// if (HmiBuildConfig.isShowObuV2vView) { //TODO 临时需要关闭v2v开关 + mObuStatusInfo.obuRvStatus = true + CallerObuListenerManager.invokeListener(mObuStatusInfo) + if (!data.warningMsg.warningData.isNullOrEmpty()) { + // 更新数据,远车数据,之前要匹配uuid + TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data)?.let { + CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it) + } - if (!data.warningMsg.warningData.isNullOrEmpty()) { - // 更新数据,远车数据,之前要匹配uuid - TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data)?.let { - CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it) - } + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", data.toString()) + data.let { + //预警信息,预警类型 threat_level 2、3 + data.vehBasicsMsg?.let { + //预警方位 + val direction = getMessageDirection(data.vehBasicsMsg.targetPosition) + //处理预警类型 + var appId = "" + var level = -1 + var status = -1 + data.warningMsg?.let { + if (data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { + level = data.warningMsg.warningData[0].warningLevel + appId = data.warningMsg.warningData[0].warningType.toString() + status = data.warningMsg.warningData[0].status - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", data.toString()) - data.let { - //预警信息,预警类型 threat_level 2、3 - var status = data.status - data.vehBasicsMsg?.let { - //预警方位 - val direction = getMessageDirection(data.vehBasicsMsg.targetPosition) - //处理预警类型 - var appId = "" - var level = -1 - data.warningMsg?.let { - if (data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { - level = data.warningMsg.warningData[0].warningLevel - appId = data.warningMsg.warningData[0].warningType.toString() + //30秒内同一个事件只出现一次 + if (rvMap.containsKey(appId)) { + var oldTime = rvMap[appId] + var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 + if (timeDiff < 30) { + return + } + rvMap.remove(appId) + rvMap[appId] = System.currentTimeMillis() + } else { + rvMap[appId] = System.currentTimeMillis() + } + + //拼凑数据 + if (appId != null) { + handleSdkObu(appId, direction, status, level, data) } } - - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "onMogoObuRvWarning target_classification = ${ - getMessageDirection(data.vehBasicsMsg.targetPosition) - } --- direction = $direction --- appId = $appId ---level = $level -- status = $status" - ) - //拼凑数据 - if (appId != null) { - handleSdkObu(appId, direction, status, level, data) - } } + + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", + "onMogoObuRvWarning target_classification = ${ + getMessageDirection(data.vehBasicsMsg.targetPosition) + } --- direction = $direction --- appId = $appId ---level = $level -- status = $status" + ) } } } +// } } /** @@ -218,46 +231,48 @@ class MogoPrivateObuNewManager private constructor() { */ override fun onMogoObuSpatWarning(data: MogoObuSpatWarningData) { super.onMogoObuSpatWarning(data) - if (data?.lights != null && data.lights.isNotEmpty() - ) { - if (HmiBuildConfig.isShowObuV2iView) { - handlerTrafficLight( - data.warningType, - data.status, - data.lights - ) - } + if (data != null) { +// if (HmiBuildConfig.isShowObuV2iView) { + handlerTrafficLight( + data.warningType, + data.status, + data.lights + ) +// } } } + val rvMap = mutableMapOf() + val rsiMap = mutableMapOf() + val rsmMap = mutableMapOf() + val rsmPtcIdMap = mutableMapOf() + /** - * RSI预警信息 CvxRtiThreatIndInfo(交通标志预警(前方限速、前方学校等等),交通事件预警(前方拥堵、前方积水等等)) + * RSI预警信息 onMogoObuRsiWarning(交通标志预警(前方限速、前方学校等等),交通事件预警(前方拥堵、前方积水等等)) */ override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) { super.onMogoObuRsiWarning(data) - if (HmiBuildConfig.isShowObuV2iView) { +// if (HmiBuildConfig.isShowObuV2iView) { + if (data != null && data.warningMsg != null && data.warningMsg.size > 0) { + var alertContent = "" + var ttsContent = "" + var appId = data.warningMsg[0].sceneType.toString() + val status = data.status + val level = data.warningMsg[0].warningLevel + val direction = getMessageDirection(data.warningMsg[0].targetPosition) CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "onMogoObuRsiWarning ------> $data" + "onMogoObuRsiWarning appId = $appId --status = $status --level = $level -- eventSerialNum = ${data.warningMsg[0].eventSerialNum} ---signSerialNum = ${data.warningMsg[0].signSerialNum} --- direction = $direction -- targetPosition = ${data.warningMsg[0].targetPosition}" ) - if (data != null && data.warningMsg != null && data.warningMsg.size > 0) { - var alertContent = "" - var ttsContent = "" - var appId = data.warningMsg[0].sceneType.toString() - val status = data.status - val level = data.warningMsg[0].warningLevel - val direction = getMessageDirection(data.warningMsg[0].targetPosition) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- eventSerialNum = ${data.warningMsg[0].eventSerialNum} ---signSerialNum = ${data.warningMsg[0].signSerialNum} --- direction = $direction -- targetPosition = ${data.warningMsg[0].targetPosition}" - ) + if (appId != "0") { when (appId) { // 道路危险情况预警 MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> { when (data.warningMsg[0].eventSerialNum) { MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障 - appId = EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType + appId = + EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType } MogoObuConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水 appId = EventTypeEnumNew.FOURS_PONDING.poiType @@ -302,9 +317,9 @@ class MogoPrivateObuNewManager private constructor() { 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_PEDESTRIAN -> { //行人 TODO 暂时去掉 +// appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType +// } MogoObuConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑 appId = EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD.poiType } @@ -341,9 +356,11 @@ class MogoPrivateObuNewManager private constructor() { 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_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 @@ -381,7 +398,6 @@ class MogoPrivateObuNewManager private constructor() { // 拥堵 MogoObuConstants.RSI_SCENE_TYPE.TJW.toString() -> { appId = EventTypeEnumNew.TYPE_USECASE_ID_TJW.poiType - alertContent = EventTypeEnumNew.getWarningContent(appId) ttsContent = EventTypeEnumNew.getWarningTts(appId) alertContent = String.format( //事件才有影响范围 @@ -398,32 +414,52 @@ class MogoPrivateObuNewManager private constructor() { //限速预警, ADD处理一次 MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> { + appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType alertContent = EventTypeEnumNew.getWarningContent(appId) ttsContent = EventTypeEnumNew.getWarningTts(appId) } } + //30秒内同一个事件只出现一次 + if (rsiMap.containsKey(appId)) { + var oldTime = rsiMap[appId] + var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 + if (timeDiff < 30) { + return + } + rsiMap.remove(appId) + rsiMap[appId] = System.currentTimeMillis() + } else { + rsiMap[appId] = System.currentTimeMillis() + } + CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "new onMogoObuRsiWarning ttsContent = $ttsContent --alertContent = $alertContent --appId = $appId ---direction = ${direction.direction} --distance = ${Math.round(data.warningMsg[0].distance)} ---eventRadius = ${Math.round(data.warningMsg[0].eventRadius)} --speedMaxLimit = ${data.warningMsg[0].speedMaxLimit.toInt()}" + "new onMogoObuRsiWarning appId = $appId ---status = $status --- ttsContent = $ttsContent --alertContent = $alertContent -- eventSerialNum = ${data.warningMsg[0].eventSerialNum} ---signSerialNum = ${data.warningMsg[0].signSerialNum} ---direction = ${direction.direction} --distance = ${ + Math.round(data.warningMsg[0].distance) + } ---eventRadius = ${Math.round(data.warningMsg[0].eventRadius)} --speedMaxLimit = ${data.warningMsg[0].speedMaxLimit.toInt()}" ) + when (status) { MogoObuConstants.STATUS.ADD -> { // 添加 //显示警告红边 // CallerHmiManager.showWarning(direction) //不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuNewMana1", "alertContent或ttsContent为空!") + return } CallerMsgBoxManager.saveMsgBox( MsgBoxBean( - MsgBoxType.OBU, + MsgBoxType.V2X, V2XMsg( appId, alertContent, ttsContent ) ) +// .apply { +// sourceType = DataSourceType.OBU +// } ) CallerHmiManager.warningV2X( appId, @@ -437,7 +473,7 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L + 5000L ) // 更新数据 @@ -451,10 +487,6 @@ class MogoPrivateObuNewManager private constructor() { } MogoObuConstants.STATUS.DELETE -> { // 删除 - // 关闭警告红边 -// CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 移除顶部弹窗 -// CallerHmiManager.disableWarningV2X((appId + direction.direction)) // 更新数据 TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data) ?.let { @@ -467,7 +499,7 @@ class MogoPrivateObuNewManager private constructor() { } } } - +// } } /** @@ -483,106 +515,160 @@ class MogoPrivateObuNewManager private constructor() { data: MogoObuRsmWarningData? ) { super.onMogoObuRsmWarning(data) - if (HmiBuildConfig.isShowObuV2iView) { - if (HmiBuildConfig.isShowObuWeaknessTrafficView) { + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", + "onMogoObuRsmWarning ------> ${data.toString()}" + ) +// if (HmiBuildConfig.isShowObuV2iView) { + if (HmiBuildConfig.isShowObuWeaknessTrafficView) { + // 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu + if (data != null && data.participant != null) { + var v2xType = "" + if (data.participant.ptcType == 1) { //机动车 + v2xType = + EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType + } else if (data.participant.ptcType == 2) { //非机动车 + v2xType = + EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType + } else if (data.participant.ptcType == 3) { //行人 + v2xType = + EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType + } else { //未知 + v2xType = EventTypeEnumNew.TYPE_ERROR.poiType + } + + val ttsContent = EventTypeEnumNew.getWarningTts(v2xType) + val alertContent = + EventTypeEnumNew.getWarningContent(v2xType) + var level = -1 + val direction = getMessageDirection(data.participant.targetPosition) + + //物体数据绘制 TODO 这里与dc通过工控机有区别 CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "onMogoObuRsmWarning ------> ${data.toString()}" - ) - // 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu - if (data != null && data.participant != null) { - var v2xType = "" - if (data.participant.ptcType == 1) { //机动车 - v2xType = - EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType - } else if (data.participant.ptcType == 2) { //非机动车 - v2xType = - EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType - } else if (data.participant.ptcType == 3) { //行人 - v2xType = - EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType - } else { //未知 - v2xType = EventTypeEnumNew.TYPE_ERROR.poiType + "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "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 -> { // 添加 + // 更新数据,模型变色的时候是不是update,如果不是更新,可能导致模型不变色,(add的时候,是否有level高的) TODO + TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data) + ?.let { + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } } - val ttsContent = EventTypeEnumNew.getWarningTts(v2xType) - val alertContent = - EventTypeEnumNew.getWarningContent(v2xType) - var level = -1 - val direction = getMessageDirection(data.participant.targetPosition) - if (data.warningMsg != null && data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { - level = data.warningMsg.warningData[0].warningLevel //默认是1个 - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "new onMogoObuRsmWarning ---status---> ${data.status} ---data.warningMsg.warningData[0].status = ${data.warningMsg.warningData[0].status} ---v2xType = $v2xType ---alertContent = $alertContent ---ttsContent = $ttsContent " - ) - when (data.warningMsg.warningData[0].status) { - MogoObuConstants.STATUS.ADD -> { // 添加 -// if (level == 2 || level == 3) { //不考虑level - //显示警告红边 - CallerHmiManager.showWarning(direction) - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuNewMana2", "alertContent或ttsContent为空!") + MogoObuConstants.STATUS.UPDATE -> { // 更新 + //处理删除逻辑, +// if (rsmPtcIdMap.containsKey(data.participant.ptcId.toString())) { +// var oldTime = rsmPtcIdMap[data.participant.ptcId.toString()] +// var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 +// if (timeDiff > 3) { //超过3秒,删除对应弱势交通元素 +// CallerMapUIServiceManager.getMarkerService() +// ?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString()) +// } +// rsmPtcIdMap.remove(data.participant.ptcId.toString()) +// rsmPtcIdMap[data.participant.ptcId.toString()] = System.currentTimeMillis() +// } else { +// rsmPtcIdMap[data.participant.ptcId.toString()] = System.currentTimeMillis() +// } + } + + MogoObuConstants.STATUS.DELETE -> { // 删除 + // 更新数据 TODO 删除原来的,改变颜色,删除marker。不影响别的模型添加 + TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data) + ?.let { + // 事件结束,还原交通参与者颜色 + it.threatLevel = 0x01 + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } + + //删除弱势交通元素 + CallerMapUIServiceManager.getMarkerService() + ?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString()) + } + } + + //预警status + if (data.warningMsg != null && data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { + level = data.warningMsg.warningData[0].warningLevel //默认是1个 + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", + "onMogoObuRsmWarning ---status---> ${data.status} ---data.warningMsg.warningData[0].status = ${data.warningMsg.warningData[0].status} ---v2xType = $v2xType ---alertContent = $alertContent ---ttsContent = $ttsContent ---level = $level" + ) + when (data.warningMsg.warningData[0].status) { + MogoObuConstants.STATUS.ADD -> { // 添加 + //更新模型的颜色 + //30秒内同一个事件只出现一次 + if (rsmMap.containsKey(v2xType)) { + var oldTime = rsmMap[v2xType] + var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 + if (timeDiff < 30) { + return } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg( - v2xType, - alertContent, - ttsContent - ) - ) - ) - CallerHmiManager.warningV2X( - v2xType, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - (v2xType + direction.direction),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 - object : IMoGoWarningStatusListener { - override fun onDismiss() { - // 关闭警告红边 - CallerHmiManager.showWarning( - WarningDirectionEnum.ALERT_WARNING_NON - ) - } - }, - true, - 5000L - ) -// } + rsmMap.remove(v2xType) + rsmMap[v2xType] = System.currentTimeMillis() + } else { + rsmMap[v2xType] = System.currentTimeMillis() + } - // 更新数据 - TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "add cvxPtcThreatIndInfo2TrafficData ---it---> $it") + TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data) + ?.let { CallerMapUIServiceManager.getMarkerService() ?.updateITrafficThreatLevelInfo(it) } - } - MogoObuConstants.STATUS.UPDATE -> {// 更新 + if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { + return } + //显示警告红边 + CallerHmiManager.showWarning(direction) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg( + v2xType, + alertContent, + ttsContent + ) + ) +// .apply { //TODO +// sourceType = DataSourceType.OBU +// } + ) - // 删除 - MogoObuConstants.STATUS.DELETE -> { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 更新数据 TODO 删除原来的,改变颜色,删除marker。不影响别的模型添加 - TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data) - ?.let { - // 事件结束,还原交通参与者颜色 - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) + CallerHmiManager.warningV2X( + v2xType, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + (v2xType + direction.direction),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 + object : IMoGoWarningStatusListener { + override fun onDismiss() { + // 关闭警告红边 + CallerHmiManager.showWarning( + WarningDirectionEnum.ALERT_WARNING_NON + ) } + }, + true, + 5000L + ) + } - //删除弱势交通元素 - CallerMapUIServiceManager.getMarkerService()?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString()) - } + MogoObuConstants.STATUS.UPDATE -> {// 更新 + } + + MogoObuConstants.STATUS.DELETE -> { // 删除 + // 关闭警告红边 + CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) + //删除弱势交通元素 + CallerMapUIServiceManager.getMarkerService() + ?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString()) } } } } } +// } } /** @@ -590,16 +676,19 @@ class MogoPrivateObuNewManager private constructor() { */ override fun onMogoObuMapMath(data: MogoObuMapMathData?) { super.onMogoObuMapMath(data) - if(isShowObuLimitSpeedView) { +// if (isShowObuLimitSpeedView) { if (data != null) { CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "onMogoObuMapMathstatus = ${data.status} --speedMaxLimit = ${Math.round((data.speedMaxLimit*3.6))}") + "onMogoObuMapMath = ${data.status} --speedMaxLimit = ${Math.round((data.speedMaxLimit * 3.6))}" + ) when (data.status) { MogoObuConstants.STATUS.ADD -> { // 添加 UiThreadHandler.post { - if(data.speedMaxLimit > 0) { - CallerHmiManager.showLimitingVelocity(Math.round((data.speedMaxLimit*3.6)).toInt()) + if (data.speedMaxLimit > 0) { +// CallerHmiManager.showLimitingVelocity( +// Math.round((data.speedMaxLimit * 3.6)).toInt(), 2) + CallObuLimitingSpeedListenerManager.invokeOnObuLimitingSpeedChange(Math.round((data.speedMaxLimit * 3.6)).toInt()) } } } @@ -609,22 +698,23 @@ class MogoPrivateObuNewManager private constructor() { MogoObuConstants.STATUS.DELETE -> { // 删除 UiThreadHandler.post { - CallerHmiManager.disableLimitingVelocity() +// CallerHmiManager.disableLimitingVelocity() + CallObuLimitingSpeedListenerManager.invokeOnObuLimitingSpeedChange(-1) } } } } - } +// } } } - } +} /** * 获取消息的方位 车辆相关 */ private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum { -// CallerLogger.d("$M_OBU${TAG_MOGO_NEW_OBU}", "预警红边:预警方向->$targetClassification") + // CallerLogger.d("$M_OBU${TAG_MOGO_NEW_OBU}", "预警红边:预警方向->$targetClassification") return when (targetClassification) { MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方 @@ -657,7 +747,7 @@ class MogoPrivateObuNewManager private constructor() { /** * 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示 * - * @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 + * @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 TODO 添加事件频繁播报拦截 * * @see com.mogo.module.common.enums.EventTypeEnum */ @@ -669,56 +759,32 @@ class MogoPrivateObuNewManager private constructor() { info: MogoObuRvWarningData ) { // 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnumNew 提供的 - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status" - ) - - var alertContent: String - var ttsContent: String + var alertContent: String = "" + var ttsContent: String = "" var changeVisualAngle = false when (appId) { - // 变道预警,注意左后车辆/注意右后车辆 - EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType -> { - alertContent = EventTypeEnumNew.getWarningContent(appId) - ttsContent = EventTypeEnumNew.getWarningTts(appId) - if ( - direction == WarningDirectionEnum.ALERT_WARNING_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT - ) { - ttsContent = String.format(ttsContent, "左") - alertContent = String.format(alertContent, "左") - } else if ( - direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT - ) { - ttsContent = String.format(ttsContent, "右") - alertContent = String.format(alertContent, "右") - } + //交叉路口碰撞预警 + MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> { + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType) + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType) } - //车辆失控预警 - EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType -> { - alertContent = EventTypeEnumNew.getWarningContent(appId) - ttsContent = EventTypeEnumNew.getWarningTts(appId) - alertContent = String.format(alertContent, direction.desc) - ttsContent = String.format(ttsContent, direction.desc) + //交叉路口碰撞预警 + MogoObuConstants.V2X_WARNING_TYPE.ICW.toString() -> { + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType) + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType) } - //异常车辆提醒 - EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType -> { - alertContent = EventTypeEnumNew.getWarningContent(appId) - ttsContent = EventTypeEnumNew.getWarningTts(appId) - alertContent = String.format(alertContent, direction.desc) - ttsContent = String.format(ttsContent, direction.desc) + //左转辅助预警 + MogoObuConstants.V2X_WARNING_TYPE.LTA.toString() -> { + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType) + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType) } //盲区预警 - EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType -> { - ttsContent = EventTypeEnumNew.getWarningTts(appId) - alertContent = EventTypeEnumNew.getWarningContent(appId) + MogoObuConstants.V2X_WARNING_TYPE.BSW.toString() -> { + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType) + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType) if ( direction == WarningDirectionEnum.ALERT_WARNING_LEFT || direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || @@ -737,10 +803,65 @@ class MogoPrivateObuNewManager private constructor() { alertContent = String.format(alertContent, "右") } } + + // 变道预警,注意左后车辆/注意右后车辆 + MogoObuConstants.V2X_WARNING_TYPE.LCW.toString() -> { + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType) + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType) + if ( + direction == WarningDirectionEnum.ALERT_WARNING_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT + ) { + ttsContent = String.format(ttsContent, "左") + alertContent = String.format(alertContent, "左") + } else if ( + direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT + ) { + ttsContent = String.format(ttsContent, "右") + alertContent = String.format(alertContent, "右") + } + } + + //逆向超车预警 + MogoObuConstants.V2X_WARNING_TYPE.DNPW.toString() -> { + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType) + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType) + } + + //紧急制动预警 + MogoObuConstants.V2X_WARNING_TYPE.EBW.toString() -> { + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType) + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType) + } + + //异常车辆提醒 + MogoObuConstants.V2X_WARNING_TYPE.AVW.toString() -> { + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType) + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType) + alertContent = String.format(alertContent, direction.desc) + ttsContent = String.format(ttsContent, direction.desc) + } + + //车辆失控预警 + MogoObuConstants.V2X_WARNING_TYPE.CLW.toString() -> { + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType) + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType) + alertContent = String.format(alertContent, direction.desc) + ttsContent = String.format(ttsContent, direction.desc) + } + //车辆失控预警 + MogoObuConstants.V2X_WARNING_TYPE.EVW.toString() -> { + alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType) + ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType) + } + // 这里处理固定的提示信息,包括了<紧急车辆提醒> - else -> { - ttsContent = EventTypeEnumNew.getWarningTts(appId) - alertContent = EventTypeEnumNew.getWarningContent(appId) + else -> { //TODO +// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) +// alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) } } @@ -753,19 +874,19 @@ class MogoPrivateObuNewManager private constructor() { "new handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" ) if (level == 2 || level == 3) { - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuNewManager2", "alertContent或ttsContent为空!") - } //不显示弹框,其它保留 CallerMsgBoxManager.saveMsgBox( MsgBoxBean( - MsgBoxType.OBU, + MsgBoxType.V2X, V2XMsg( appId, alertContent, ttsContent ) ) +// .apply { +// sourceType = DataSourceType.OBU +// } ) CallerHmiManager.warningV2X( appId, @@ -789,7 +910,7 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L + 5000L ) //显示警告红边 CallerHmiManager.showWarning(direction) @@ -805,7 +926,7 @@ class MogoPrivateObuNewManager private constructor() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) // 移除顶部弹窗 - // CallerHmiManager.disableWarningV2X((appId + direction.direction)) + // CallerHmiManager.disableWarningV2X((appId + direction.direction)) //更新周边车辆进行预警颜色变换,车辆实时移动和变色 TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { it.threatLevel = 0x01 @@ -829,7 +950,9 @@ class MogoPrivateObuNewManager private constructor() { MogoObuConstants.STATUS.ADD, MogoObuConstants.STATUS.UPDATE -> { - changeTrafficLightStatus(appId, lights) + if (lights != null && lights.isNotEmpty()) { + changeTrafficLightStatus(appId, lights) + } } // 删除 MogoObuConstants.STATUS.DELETE -> { @@ -838,15 +961,25 @@ class MogoPrivateObuNewManager private constructor() { CallerHmiManager.disableWarningV2X(appId.toString()) isShowGreenWave = false isShowRunRedLight = false + isYellowLight = false +// lightCountDownRed = 1 +// lightCountDownGreen = 1 +// lightCountDownYellow = 1 } } } private var isRedLight = false private var isGreenLight = false + private var isYellowLight = false private var isShowGreenWave = false private var isShowRunRedLight = false +// private var lightCountDownRed : Int = 1 +// private var lightCountDownGreen : Int = 1 +// private var lightCountDownYellow : Int = 1 + + /** * 修改红绿灯 */ @@ -861,63 +994,95 @@ class MogoPrivateObuNewManager private constructor() { val currentLight = lights[0] CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "currentLight = $currentLight ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId" + "changeTrafficLightStatus currentLight = $currentLight ----currentLight.light = ${currentLight.light} ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId --countDown = ${currentLight.countDown.toInt()}" ) // 闯红灯预警,绿波通行和闯红灯是互斥的 when (appId) { - 0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效 + 0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效 } - 0x1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次 + 1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次 if (!isShowRunRedLight) { isShowRunRedLight = true - CallerHmiManager.disableWarningV2X(0x2.toString()) - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}","changeTrafficLightStatus 闯红灯 --------> ") - ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) - alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) + CallerHmiManager.disableWarningV2X(1667.toString()) + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", + "changeTrafficLightStatus 闯红灯 --------> " + ) + ttsContent = + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType) + alertContent = + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, + alertContent, + ttsContent + ) + ) +// .apply { +// sourceType = DataSourceType.OBU +// } + ) + CallerHmiManager.warningV2X( - appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 5000L) + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, + null, + true, + 5000L + ) } } - 0x2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候 + 2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候 if (!isShowGreenWave) { isShowGreenWave = true - CallerHmiManager.disableWarningV2X(0x1.toString()) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", - "new changeTrafficLightStatus speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed} --TYPE_USECASE_ID_IVP_GREEN ---alertContent = $alertContent ---ttsContent = $ttsContent" - ) - val adviceSpeed = - "${currentLight.suggestMinSpeed} - ${currentLight.suggestMaxSpeed}" - val adviceSpeedTts = - "${currentLight.suggestMinSpeed}到${currentLight.suggestMaxSpeed}" + CallerHmiManager.disableWarningV2X(1666.toString()) + + 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" + +// 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(appId.toString()), + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), adviceSpeedTts ) alertContent = String.format( - EventTypeEnumNew.getWarningContent(appId.toString()), + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), adviceSpeed ) val maxSpeed = currentLight.suggestMaxSpeed if (maxSpeed > 0) { - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuNewManager1", "alertContent或ttsContent为空!") - } CallerMsgBoxManager.saveMsgBox( MsgBoxBean( - MsgBoxType.OBU, + MsgBoxType.V2X, V2XMsg( EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent ) ) +// .apply { //TODO +// sourceType = DataSourceType.OBU +// } ) CallerHmiManager.warningV2X( @@ -937,7 +1102,7 @@ class MogoPrivateObuNewManager private constructor() { when (currentLight.light) { // 灯光不可用 0 -> { - CallerHmiManager.showWarningTrafficLight(0, 2) + CallerObuTrafficLightListenerManager.invokeObuTrafficLight(0) } // 红灯 2, 3 -> { @@ -946,8 +1111,8 @@ class MogoPrivateObuNewManager private constructor() { isRedLight = true } isGreenLight = false - CallerHmiManager.showWarningTrafficLight(1, 2) - + isYellowLight = false + CallerObuTrafficLightListenerManager.invokeObuTrafficLight(1) val red = currentLight.countDown.toInt() CallerHmiManager.changeCountdownRed(red) } @@ -959,17 +1124,23 @@ class MogoPrivateObuNewManager private constructor() { isGreenLight = true } isRedLight = false - CallerHmiManager.showWarningTrafficLight(3, 2) + isYellowLight = false + CallerObuTrafficLightListenerManager.invokeObuTrafficLight(3) val green = currentLight.countDown.toInt() CallerHmiManager.changeCountdownGreen(green) } // 黄灯 7, 8 -> { + if (!isYellowLight) { + isYellowLight = true + } + isRedLight = false + isGreenLight = false CallerHmiManager.disableWarningV2X(appId.toString()) - CallerHmiManager.showWarningTrafficLight(2, 2) + CallerObuTrafficLightListenerManager.invokeObuTrafficLight(2) val yellow = currentLight.countDown.toInt() CallerHmiManager.changeCountdownYellow(yellow) } } - } + } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt index 748b847aef..cf1d029c1f 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt @@ -133,21 +133,30 @@ enum class EventTypeEnumNew( // 违章停车 ALERT_ILLEGAL_PARK("99992"), - //-------------v2n start ------------> + //TODO 这个确认值 + TYPE_USECASE_OPTIMAL_LANE( + 0x2B06.toString(), + "最优车道", + poiTypeSrcVr = R.drawable.v2x_icon_live_logo, + content = "最优车道", + tts = "最优车道" + ), + + //-------------obu v2v start ------------> TYPE_USECASE_ID_FCW( - 2000.toString(), + 2010.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_ICW( + 2009.toString(), + "交叉路口碰撞预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning, + content = "交叉路口碰撞预警", + tts = "注意交叉路口车辆" + ), TYPE_USECASE_ID_LTA( 2001.toString(), "左转辅助", @@ -205,16 +214,15 @@ enum class EventTypeEnumNew( content = "注意特种车辆通行", tts = "请避让特种车辆" ), - //-------------v2n end ------------> + //-------------obu v2v end ------------> - - //---------弱势交通参与者 start ------> + //---------弱势交通参与者 obu and cloud start ------> TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES( 1001.toString(), "弱势交通参与者碰撞预警", poiTypeSrcVr = R.drawable.icon_warning_v2x_motorcycle_collision, - content = "注意机动车", - tts = "注意机动车" + content = "注意摩托车", + tts = "注意摩托车" ), TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES( 1002.toString(), @@ -237,10 +245,9 @@ enum class EventTypeEnumNew( content = "前方有未知障碍物", tts = "前方有未知障碍物" ), - //---------弱势交通参与者 end --------> + //---------弱势交通参与者 obu and cloud end --------> - - //--------------红绿灯 start -------> TODO 修改重复 + //--------------红绿灯 start -------> TYPE_USECASE_ID_IVP_RED( 1666.toString(), "闯红灯预警", @@ -258,7 +265,7 @@ enum class EventTypeEnumNew( ), //-------------红绿灯 end ----------> - //-----------道路危险情况预警 start ---------------> + //-----------道路危险情况预警 obu start ---------------> TYPE_USECASE_ID_BREAKDOWN_WARNING( //故障车辆 101.toString(), "车辆故障", @@ -308,10 +315,9 @@ enum class EventTypeEnumNew( content = "您已超速,请减速行驶", tts = "您已超速,请减速行驶" ), - //------------道路危险情况预警 end -----------> + //------------道路危险情况预警 obu end -----------> - - //------------车内标牌 start --------------> + //------------车内标牌 obu start --------------> TYPE_ID_SHAPR_TURNS( 2.toString(), "急转弯", @@ -447,10 +453,27 @@ enum class EventTypeEnumNew( ), TYPE_USECASE_ID_ACCIDENT( 244.toString(), - "事故", + "交通事故", poiTypeSrcVr = R.drawable.v2x_icon_jiaotongshigu_vr, - content = "前方%s米事故", - tts = "前方%s米事故" + content = "前方%s米交通事故", + tts = "前方%s米交通事故" + ), + //------------车内标牌 obu end --------------> + + TYPE_SOCKET_ROAD_CONGESTION( + "100071", + "交通拥堵", + poiTypeSrcVr = R.drawable.v2x_icon_yongdu_vr, + content = "前方%s米交通拥堵", + tts = "前方%s米交通拥堵" + ), + + TYPE_SOCKET_ROAD_JINGZHI( + "100251", + "前方%s米静止障碍物占道", + poiTypeSrcVr = R.drawable.v2x_icon_jingzhi_zhangai, + content = "前方%s米静止障碍物占道", + tts = "前方%s米静止障碍物占道" ), //------------车内标牌 end --------------> diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewLimitingVelocity.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewLimitingVelocity.kt index aef782d2d6..3d566205ef 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewLimitingVelocity.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewLimitingVelocity.kt @@ -14,5 +14,5 @@ abstract class IViewLimitingVelocity(context: Context?, attrs: AttributeSet?, de * 更新限速数据 * @param limitingSpeed 限速值,单位:km/h */ - open fun updateLimitingSpeed(limitingSpeed: Int) {} + open fun updateLimitingSpeed(limitingSpeed: Int, limitSource: Int) {} } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt index ac85e3c66c..e8617252a3 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoHmiProvider.kt @@ -140,7 +140,7 @@ interface IMoGoHmiProvider : IMoGoHmiViewProxy { * * @param limitingSpeed 限速速度 */ - fun showLimitingVelocity(limitingSpeed: Int) + fun showLimitingVelocity(limitingSpeed: Int, limitSpeedSource: Int) /** * 关闭限速预警 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuTrafficLightListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuTrafficLightListener.kt new file mode 100644 index 0000000000..1b4be4e95c --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuTrafficLightListener.kt @@ -0,0 +1,15 @@ +package com.mogo.eagle.core.function.api.obu + + +/** + * @author lixiaopeng + * @date 2022/1/30 10:28 下午 + * OBU 灯态信息 + */ +interface IMoGoObuTrafficLightListener { + /** + * @param light 灯的信息 + */ + fun onObuTrafficLight(light: Int){} + +} \ 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-api/src/main/java/com/mogo/eagle/core/function/api/v2x/ObuLimitingSpeedListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/v2x/ObuLimitingSpeedListener.kt new file mode 100644 index 0000000000..1fb84cdeaa --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/v2x/ObuLimitingSpeedListener.kt @@ -0,0 +1,8 @@ +package com.mogo.eagle.core.function.api.v2x + +/** + * 限速信息 + */ +interface ObuLimitingSpeedListener { + fun onObuLimitingSpeedChange(limitingSpeed: Int) +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index e65f5542fb..9fc14f5158 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -144,7 +144,7 @@ object CallerHmiManager { * 展示红绿灯预警 * * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 - * @param lightSource 1:云端下发;2:自车感知 + * @param lightSource 1:云端下发;2:自车感知;3:OBU */ fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) { waringProviderApi?.showWarningTrafficLight(checkLightId, lightSource) @@ -205,10 +205,11 @@ object CallerHmiManager { * 展示限速预警 * * @param limitingSpeed 限速速度 + * @param limitSpeedSource 限速来源 1:MAP, 2:RSU */ @BizConfig(V2I, "", BIZ_SLW) - fun showLimitingVelocity(limitingSpeed: Int) { - waringProviderApi?.showLimitingVelocity(limitingSpeed) + fun showLimitingVelocity(limitingSpeed: Int, limitSpeedSource: Int) { + waringProviderApi?.showLimitingVelocity(limitingSpeed, limitSpeedSource) } /** diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuTrafficLightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuTrafficLightListenerManager.kt new file mode 100644 index 0000000000..e881947ad9 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuTrafficLightListenerManager.kt @@ -0,0 +1,25 @@ +package com.mogo.eagle.core.function.call.obu + +import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightListener +import com.mogo.eagle.core.function.call.base.CallerBase +import java.util.concurrent.ConcurrentHashMap + + +object CallerObuTrafficLightListenerManager : CallerBase() { + + private val M_OBU_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap = + ConcurrentHashMap() + + var mLight: Int = 0 + + + fun invokeObuTrafficLight(light: Int) { + this.mLight = light + M_OBU_TRAFFIC_LIGHT_LISTENER.forEach { + val tag = it.key + val listener = it.value + listener.onObuTrafficLight(light) + } + } + +} \ 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..2ecbf31c29 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obucombine/CallerObuDcCombineListenerManager.kt @@ -0,0 +1,66 @@ +package com.mogo.eagle.core.function.call.obucombine + +import androidx.annotation.Nullable +import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener +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/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallObuLimitingSpeedListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallObuLimitingSpeedListenerManager.kt new file mode 100644 index 0000000000..1a33b7af68 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/v2x/CallObuLimitingSpeedListenerManager.kt @@ -0,0 +1,26 @@ +package com.mogo.eagle.core.function.call.v2x + +import com.mogo.eagle.core.function.api.v2x.ObuLimitingSpeedListener +import com.mogo.eagle.core.function.call.base.CallerBase +import java.util.concurrent.ConcurrentHashMap + +/** + * 限速信息监听 + */ +object CallObuLimitingSpeedListenerManager : CallerBase(){ + + private const val TAG = "CallObuLimitingSpeedListenerManager" + private val M_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap = + ConcurrentHashMap() + private var mObuLimitSpeed = 0 + + fun invokeOnObuLimitingSpeedChange(limitingSpeed: Int) { + this.mObuLimitSpeed = limitingSpeed + M_TRAFFIC_LIGHT_LISTENER.forEach { + val tag = it.key + val listener = it.value + listener.onObuLimitingSpeedChange(limitingSpeed) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_jingzhi_zhangai.png b/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_jingzhi_zhangai.png new file mode 100644 index 0000000000..c5e2711db3 Binary files /dev/null and b/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_jingzhi_zhangai.png differ