From 3a9d7d6631602ad35f376bf8d50bf5fe039de5e1 Mon Sep 17 00:00:00 2001 From: renwj Date: Fri, 6 May 2022 17:09:34 +0800 Subject: [PATCH 1/5] =?UTF-8?q?[V2X]=E5=A2=9E=E5=8A=A0=E9=AC=BC=E6=8E=A2?= =?UTF-8?q?=E5=A4=B4=E9=81=93=E8=B7=AF=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/module/common/enums/EventTypeEnum.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt index 89c00acf2e..b6e25fe44f 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt @@ -101,6 +101,10 @@ enum class EventTypeEnum( //路面湿滑 ROAD_SLIPPERY("10021"), + //鬼探头类型 + GHOST_PROBE("10024", "前方盲区行人预警", "前方盲区行人预警", R.drawable.icon_warning_v2x_pedestrian_crossing, + "前方盲区行人通行,请注意", "前方盲区即将有行人通过,请减速慢行"), + // 前方静止or慢速车辆报警 ALERT_FRONT_CAR("99999"), @@ -374,7 +378,7 @@ enum class EventTypeEnum( FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeStr FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStr - + GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeStr else -> "其它道路事件" } } @@ -395,6 +399,7 @@ enum class EventTypeEnum( FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeStrVr FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStrVr + GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeStrVr else -> "其它道路事件" } } @@ -464,7 +469,7 @@ enum class EventTypeEnum( FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, - FOURS_ACCIDENT_05.poiType -> true + FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType -> true else -> false } } @@ -479,7 +484,7 @@ enum class EventTypeEnum( FOURS_BLOCK_UP.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, - FOURS_ACCIDENT_05.poiType -> true + FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType -> true else -> false } } @@ -596,6 +601,7 @@ enum class EventTypeEnum( FOURS_ROAD_WORK.poiType -> R.raw.v2x_daolushigong FOURS_ICE.poiType -> R.raw.v2x_daolujiebing FOURS_PONDING.poiType -> R.raw.v2x_daolujishui + GHOST_PROBE.poiType -> R.raw.v2x_guzhangqiuzhu else -> 0 } } @@ -713,6 +719,7 @@ enum class EventTypeEnum( TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.poiTypeSrcVr TYPE_ERROR.poiType -> TYPE_ERROR.poiTypeSrcVr TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.poiTypeSrcVr + GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeSrcVr else -> TYPE_ERROR.poiTypeSrcVr } } @@ -754,6 +761,7 @@ enum class EventTypeEnum( FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content TYPE_ERROR.poiType -> TYPE_ERROR.content TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.content + GHOST_PROBE.poiType -> GHOST_PROBE.content else -> TYPE_ERROR.content } } @@ -795,6 +803,7 @@ enum class EventTypeEnum( FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts TYPE_ERROR.poiType -> TYPE_ERROR.tts TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.tts + GHOST_PROBE.poiType -> GHOST_PROBE.tts else -> TYPE_ERROR.tts } } From 4e003df8750f8e2738b4a982b3bb819f96c4cf48 Mon Sep 17 00:00:00 2001 From: renwj Date: Fri, 6 May 2022 17:50:07 +0800 Subject: [PATCH 2/5] =?UTF-8?q?[V2X]AI=E4=BA=91=E5=BC=B1=E5=8A=BF=E4=BA=A4?= =?UTF-8?q?=E9=80=9A=E9=A2=84=E8=AD=A6=E6=9C=AA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/v2x/events/V2XEventManager.kt | 24 ++++++++++++++----- .../warning/V2XFrontWarningScenario.java | 18 +++++++------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index 7564821f33..839b49bbe2 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -11,7 +11,6 @@ import com.mogo.cloud.passport.IMoGoTokenCallback import com.mogo.cloud.passport.MoGoAiCloudClient import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.commons.network.ParamsUtil -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X import com.mogo.eagle.core.data.enums.TrafficTypeEnum import com.mogo.eagle.core.data.map.MogoLatLng import com.mogo.eagle.core.data.map.MogoLocation @@ -19,7 +18,6 @@ import com.mogo.eagle.core.data.traffic.TrafficData import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener import com.mogo.eagle.core.function.call.hmi.CallerHmiManager -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager @@ -44,6 +42,9 @@ import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager import com.mogo.eagle.core.function.v2x.events.utils.* import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceManager import com.mogo.eagle.core.network.utils.GsonUtil +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X +import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.TimeUtils import com.mogo.eagle.core.utilcode.util.Utils @@ -60,13 +61,13 @@ import com.mogo.service.statusmanager.IMogoStatusChangedListener import com.mogo.service.statusmanager.StatusDescriptor import com.mogo.service.statusmanager.StatusDescriptor.ACC_STATUS import com.mogo.service.statusmanager.StatusDescriptor.SEEK_HELPING -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.v2x.V2XManager import com.mogo.v2x.callback.IV2XCallback import com.mogo.v2x.config.V2XConfig import com.mogo.v2x.data.V2XAdvanceWarning import com.mogo.v2x.data.V2XMarkerCardResult import com.mogo.v2x.data.V2XOptimalRoute +import com.mogo.v2x.data.V2XWarningTarget import com.mogo.v2x.event.V2XEvent import com.shuyu.gsyvideoplayer.GSYVideoManager import com.shuyu.gsyvideoplayer.cache.CacheFactory @@ -78,11 +79,10 @@ import com.shuyu.gsyvideoplayer.utils.GSYVideoType import kotlinx.coroutines.* import kotlinx.coroutines.android.asCoroutineDispatcher import tv.danmaku.ijk.media.player.IjkMediaPlayer -import java.lang.Exception -import java.lang.IllegalStateException import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicBoolean + object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallback, IMogoMapListener, IMogoStatusChangedListener { @@ -449,10 +449,22 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb is V2XEvent.Road -> { handleRoadMarkerEvent(event.data) } - else -> throw IllegalStateException("invalid event type for $event") + is V2XEvent.Warning -> { + handleWarningTargetEvent(event.data) + } } } + private fun handleWarningTargetEvent(data: V2XWarningTarget) { + val v2xMessageEntity = V2XMessageEntity() + v2xMessageEntity.type = V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS + // 设置数据 + v2xMessageEntity.content = data + val intent = Intent(BROADCAST_SCENE_HANDLER_ACTION) + intent.putExtra(BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity) + LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent) + } + private fun handleRoadMarkerEvent(data: V2XMarkerCardResult) { try { BridgeApi.v2xStatus()?.let { diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java index 585e5ee0bc..35a84fcc38 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java @@ -6,9 +6,7 @@ import android.graphics.Color; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; - import androidx.annotation.Nullable; - import com.mogo.eagle.core.data.enums.WarningDirectionEnum; import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener; @@ -18,8 +16,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.common.entity.V2XWarningEntity; - +import com.mogo.v2x.data.V2XWarningTarget; import java.math.BigDecimal; import java.util.Locale; import java.util.concurrent.TimeUnit; @@ -32,7 +29,7 @@ import java.util.concurrent.TimeUnit; public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapLocationListener, IMoGoWarningStatusListener { private static final String TAG = "V2XWarningMarker"; private static final V2XWarningMarker sV2XWarningMarker = new V2XWarningMarker(); - private V2XWarningEntity mMarkerEntity; + private V2XWarningTarget mMarkerEntity; private WarningDirectionEnum mDirection; @@ -45,8 +42,8 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL CallerLogger.INSTANCE.d(M_V2X + TAG, "----- init -----:\n" + (v2XMessageEntity == null ? "null" : v2XMessageEntity.toString())); try { setV2XMessageEntity(v2XMessageEntity); - if (v2XMessageEntity != null && v2XMessageEntity.getContent() instanceof V2XWarningEntity) { - mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent(); + if (v2XMessageEntity != null && v2XMessageEntity.getContent() instanceof V2XWarningTarget) { + mMarkerEntity = (V2XWarningTarget) v2XMessageEntity.getContent(); show(); } } catch (Exception e) { @@ -67,19 +64,22 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL } } - private int getV2XTypeForFrontWarning(V2XWarningEntity entity) { + private int getV2XTypeForFrontWarning(V2XWarningTarget entity) { switch (entity.getType()) { case 1: case 11: + entity.setTts("注意行人"); return 0X2B0201; case 2: + entity.setTts("注意自行车"); case 4: + entity.setTts("注意摩托车"); return 0X2B0202; } return 0; } - private CharSequence getAlertContentForFrontWarning(V2XWarningEntity entity) { + private CharSequence getAlertContentForFrontWarning(V2XWarningTarget entity) { double dis = entity.getDistance(); //距离四舍五入保留整数 BigDecimal bg = new BigDecimal(dis); From e4121da473240f855595b173df44a1d9a1ee5ba7 Mon Sep 17 00:00:00 2001 From: renwj Date: Fri, 6 May 2022 20:05:34 +0800 Subject: [PATCH 3/5] =?UTF-8?q?[V2X]=E9=AC=BC=E6=8E=A2=E5=A4=B4=E9=81=93?= =?UTF-8?q?=E8=B7=AF=E9=A2=84=E8=AD=A6=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hmi/receiver/V2XWarningBroadcastReceiver.kt | 2 +- .../eagle/core/function/hmi/ui/MoGoHmiFragment.kt | 8 ++++---- .../core/function/obu/mogo/MogoPrivateObuManager.kt | 12 +++++------- .../core/function/v2x/events/V2XEventManager.kt | 2 +- .../function/v2x/events/alarm/V2XAlarmServer.java | 10 +++++++++- .../scenario/scene/road/V2XRoadEventScenario.java | 2 +- .../scene/route/V2XOptimalRouteVREventScenario.java | 2 +- .../scene/warning/V2XFrontWarningScenario.java | 2 +- .../v2x/redlightwarning/RedLightWarningManager.kt | 4 ++-- .../eagle/core/function/v2x/vip/VipCarManager.kt | 2 +- .../src/main/res/raw/scenario_road_event_data.json | 4 ++-- .../function/api/hmi/warning/IMoGoWaringProvider.kt | 5 ++--- .../eagle/core/function/call/hmi/CallerHmiManager.kt | 5 ++--- .../module/common/entity/V2XRoadEventEntity.java | 4 ++++ .../com/mogo/module/common/enums/EventTypeEnum.kt | 1 + 15 files changed, 37 insertions(+), 28 deletions(-) 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 3b3b72ea32..2ca0a948ed 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 @@ -73,6 +73,6 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() { if (EventTypeEnum.TYPE_USECASE_ID_IVP.poiType == v2xType.toString()) { CallerHmiManager.showLimitingVelocity(1) } - CallerHmiManager.showWarningV2X(v2xType, alertContent, ttsContent, tag, null, true, 5000L) + CallerHmiManager.showWarningV2X(v2xType.toString(), alertContent, ttsContent, tag, null, true, 5000L) } } \ No newline at end of file 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 d5510445ae..cb0591ecf2 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 @@ -464,14 +464,14 @@ class MoGoHmiFragment : MvpFragment(), /** * 展示VR下V2X预警 * - * @param v2xType V2X类型 + * @param poiType V2X类型 * @param alertContent 提醒文本 * @param ttsContent tts语音播报消息 * @param tag tag绑定弹窗的标志 */ @Synchronized override fun showWarningV2X( - v2xType: Int, + v2xType: String, alertContent: CharSequence?, ttsContent: String?, tag: String?, @@ -487,9 +487,9 @@ class MoGoHmiFragment : MvpFragment(), if (floatWindow == null || TextUtils.isEmpty(showTag) || !floatWindow.isShow() || floatWindow.config.floatTag != tag) { // 代理View初始化了才可以弹窗 mViewNotification?.let { notificationView -> - notificationView.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType.toString())) + notificationView.setWarningIcon(EventTypeEnum.getWarningIcon(v2xType)) val warningContent = alertContent - ?: EventTypeEnum.getWarningContent(v2xType.toString()) + ?: EventTypeEnum.getWarningContent(v2xType) if (warningContent.isEmpty()) { CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!") return@launchWhenResumed diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt index cd081f308f..eb73dc2276 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt @@ -1,8 +1,6 @@ package com.mogo.eagle.core.function.obu.mogo import android.content.Context -import android.telecom.Call -import android.util.Log import com.alibaba.android.arouter.launcher.ARouter import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.eagle.core.data.app.AppConfigInfo @@ -346,7 +344,7 @@ class MogoPrivateObuManager private constructor() { // CallerHmiManager.showWarning(direction) //显示弹框,语音提示 - CallerHmiManager.showWarningV2X(appId.toInt(), + CallerHmiManager.showWarningV2X(appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 (appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 @@ -456,7 +454,7 @@ class MogoPrivateObuManager private constructor() { // if (level == 2 || level == 3) { //不考虑level //显示警告红边 CallerHmiManager.showWarning(direction) - CallerHmiManager.showWarningV2X(v2xType.toInt(), + CallerHmiManager.showWarningV2X(v2xType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 (v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 @@ -655,7 +653,7 @@ class MogoPrivateObuManager private constructor() { ttsContent = EventTypeEnum.getWarningTts(appId.toString()) alertContent = EventTypeEnum.getWarningContent(appId.toString()) CallerHmiManager.showWarningV2X( - appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 appId.toString(), null, true, 5000L ) } @@ -722,7 +720,7 @@ class MogoPrivateObuManager private constructor() { val maxSpeed = currentLight.glosa_suggested_speed_max.toInt() if (maxSpeed > 0) { CallerHmiManager.showWarningV2X( - EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(), + EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 appId.toString(), @@ -855,7 +853,7 @@ class MogoPrivateObuManager private constructor() { ) if (level == 2 || level == 3) { //显示弹框,语音提示 - CallerHmiManager.showWarningV2X(appId, + CallerHmiManager.showWarningV2X(appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 (appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index 839b49bbe2..ee3f40bc4c 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -558,7 +558,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } // 显示弹框,语音提示 CallerHmiManager.showWarningV2X( - appId, + appId.toString(), content, tts, "$appId", diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java index 5a44566453..87a4fea503 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java @@ -8,6 +8,8 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils; import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.module.common.enums.EventTypeEnum; + import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; @@ -50,7 +52,13 @@ public class V2XAlarmServer { // 计算车辆距离指定气泡的距离 MarkerLocation eventLocation = v2XRoadEventEntity.getLocation(); // 1、判断是否到达了触发距离,20 ~ 500, - if (v2XRoadEventEntity.getDistance() <= 500) { + double distance = v2XRoadEventEntity.getDistance(); + if (distance <= 500) { + if (EventTypeEnum.GHOST_PROBE.getPoiType().equals(v2XRoadEventEntity.getPoiType())) { + if (distance > 15) { + continue; + } + } // 2、道路事件方向与当前行驶方向角度偏差《20度以内 double carBearing = currentLocation.getBearing(); double eventBearing = eventLocation.getAngle(); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java index 72dbae0235..52ef34afcf 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java @@ -98,7 +98,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp V2XRoadEventEntity content = entity != null ? entity.getContent() : null; if (content != null) { //显示警告红边 - CallerHmiManager.INSTANCE.showWarningV2X(entity.getType(), content.getAlarmContent(), content.getTts(), TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(5)); + CallerHmiManager.INSTANCE.showWarningV2X(content.getPoiType(), content.getAlarmContent(), content.getTts(), TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(5)); } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java index 8a5a80f54e..642da8f42a 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java @@ -53,7 +53,7 @@ public class V2XOptimalRouteVREventScenario if (entity != null) { V2XOptimalRouteDataRes content = entity.getContent(); if (content != null) { - CallerHmiManager.INSTANCE.showWarningV2X(entity.getType(), "为您推荐最优路线", "已为您选择最优路线", TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(30)); + CallerHmiManager.INSTANCE.showWarningV2X(entity.getType() + "", "为您推荐最优路线", "已为您选择最优路线", TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(30)); } } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java index 35a84fcc38..4ac08a22a9 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java @@ -59,7 +59,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL int v2xType = getV2XTypeForFrontWarning(mMarkerEntity); V2XMessageEntity entity = getV2XMessageEntity(); if (v2xType != 0) { - CallerHmiManager.INSTANCE.showWarningV2X(v2xType, getAlertContentForFrontWarning(mMarkerEntity), mMarkerEntity.getTts(), TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(3)); + CallerHmiManager.INSTANCE.showWarningV2X(v2xType + "", getAlertContentForFrontWarning(mMarkerEntity), mMarkerEntity.getTts(), TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(3)); } } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt index c1d06a7529..749617a443 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt @@ -169,7 +169,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, private fun redLightWarning() { CallerLogger.d("$M_V2X$TAG", "=====闯红灯预警=====") ThreadUtils.runOnUiThread { - CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP.poiType.toInt(), EventTypeEnum.TYPE_USECASE_ID_IVP.content, EventTypeEnum.TYPE_USECASE_ID_IVP.tts, EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, null, true, 5000L) + CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, EventTypeEnum.TYPE_USECASE_ID_IVP.content, EventTypeEnum.TYPE_USECASE_ID_IVP.tts, EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, null, true, 5000L) } } @@ -187,7 +187,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), speed ) - CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(), content, tts, EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, null, true, 5000L) + CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, content, tts, EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, null, true, 5000L) } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt index af693e18aa..9e47b7fcb4 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt @@ -131,7 +131,7 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe if (abs(currentResult!!.remain - it.remain) > 5 && currentResult.isGreen()) { CallerLogger.d("$M_V2X$TAG", "调用showWarningV2X to show") CallerHmiManager.showWarningV2X( - EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(), + EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType, EventTypeEnum.TYPE_VIP_IDENTIFICATION.content, EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts, EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType, diff --git a/core/function-impl/mogo-core-function-v2x/src/main/res/raw/scenario_road_event_data.json b/core/function-impl/mogo-core-function-v2x/src/main/res/raw/scenario_road_event_data.json index f3ffce87f9..93e2047777 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/res/raw/scenario_road_event_data.json +++ b/core/function-impl/mogo-core-function-v2x/src/main/res/raw/scenario_road_event_data.json @@ -30,7 +30,7 @@ "lat":39.969055, "lon":116.410811 }, - "poiType":"10011", + "poiType":"10024", "type":"CARD_TYPE_ROAD_CONDITION", "uploadType":"2", "userInfo":{ @@ -41,5 +41,5 @@ "userName":"零下的雨" } }, - "poiType":"10011" + "poiType":"10024" } \ 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/IMoGoWaringProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt index fdcb08c908..f25f2667e6 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt @@ -1,7 +1,6 @@ package com.mogo.eagle.core.function.api.hmi.warning import android.view.View -import android.view.WindowManager.LayoutParams import com.mogo.eagle.core.data.enums.WarningDirectionEnum import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData @@ -68,12 +67,12 @@ interface IMoGoWaringProvider : IMoGoHmiViewProxy { /** * 展示VR下V2X预警 * - * @param v2xType V2X类型 + * @param poiType V2X类型 * @param alertContent 提醒文本 * @param ttsContent tts语音播报消息 * @param tag tag绑定弹窗的标志 */ - fun showWarningV2X(v2xType: Int, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) + fun showWarningV2X(v2xType: String, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) /** * 关闭指定floatTag 的 VR下V2X预警弹窗 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 bc14009905..49ab0d6a51 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 @@ -1,7 +1,6 @@ package com.mogo.eagle.core.function.call.hmi import android.view.View -import android.view.WindowManager.LayoutParams import com.alibaba.android.arouter.launcher.ARouter import com.mogo.eagle.core.data.constants.MoGoFragmentPaths import com.mogo.eagle.core.data.enums.WarningDirectionEnum @@ -92,12 +91,12 @@ object CallerHmiManager : CallerBase() { /** * 展示VR下V2X预警 * - * @param v2xType V2X类型 + * @param poiType V2X类型 * @param alertContent 提醒文本 * @param ttsContent tts语音播报消息 * @param tag tag绑定弹窗的标志 */ - fun showWarningV2X(v2xType: Int, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long = 5000L) { + fun showWarningV2X(v2xType: String, alertContent: CharSequence?, ttsContent: String?, tag: String?, listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long = 5000L) { waringProviderApi?.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo, playTts, expireTime) } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XRoadEventEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XRoadEventEntity.java index d78cc335d4..9e0de3ca6c 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XRoadEventEntity.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XRoadEventEntity.java @@ -58,6 +58,10 @@ public class V2XRoadEventEntity implements Serializable { } public String getTts(boolean haveLiveCar) { + if (EventTypeEnum.GHOST_PROBE.getPoiType().equals(poiType)) { + tts = EventTypeEnum.GHOST_PROBE.getTts(); + return tts; + } tts = "前方#" + (int) getDistance() + "米#"; tts += EventTypeEnum.getTts(getPoiType()); if (haveLiveCar) { diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt index b6e25fe44f..49f2fa1eaa 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/enums/EventTypeEnum.kt @@ -535,6 +535,7 @@ enum class EventTypeEnum( FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.content + GHOST_PROBE.poiType -> GHOST_PROBE.content else -> "道路事件" } } From ec88cb6b86bf8b785f0dac318f659d48ab58b230 Mon Sep 17 00:00:00 2001 From: renwj Date: Sat, 7 May 2022 12:01:14 +0800 Subject: [PATCH 4/5] =?UTF-8?q?[V2X]=E9=AC=BC=E6=8E=A2=E5=A4=B4=E9=81=93?= =?UTF-8?q?=E8=B7=AF=E9=A2=84=E8=AD=A6=E8=A7=A6=E5=8F=91=E8=B7=9D=E7=A6=BB?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=BA<=3D25=E7=B1=B3,=E4=B8=8D=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E8=A7=86=E8=A7=92=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/v2x/events/V2XEventManager.kt | 2 +- .../v2x/events/alarm/V2XAlarmServer.java | 2 +- .../scene/road/V2XRoadEventScenario.java | 17 +++++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index ee3f40bc4c..db691bed52 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -433,7 +433,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb * V2XEvent事件回调 */ override fun onAck(event: V2XEvent) { - CallerLogger.d("$M_V2X$TAG", "OK->: ${event.javaClass.name}") + CallerLogger.d("$M_V2X$TAG", "OK->: $event") when (event) { is V2XEvent.ForwardsWarning -> { handleAdvanceWarningEvent(event) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java index 87a4fea503..bd90c559af 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java @@ -55,7 +55,7 @@ public class V2XAlarmServer { double distance = v2XRoadEventEntity.getDistance(); if (distance <= 500) { if (EventTypeEnum.GHOST_PROBE.getPoiType().equals(v2XRoadEventEntity.getPoiType())) { - if (distance > 15) { + if (distance > 25) { continue; } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java index 52ef34afcf..1c5966cb80 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java @@ -122,7 +122,9 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp @Override public void onShow() { - CallerVisualAngleManager.INSTANCE.changeVisualAngle(CallerVisualAngleManager.Scene.RoadEvent.INSTANCE); + if (isNeedChangeAngle()) { + CallerVisualAngleManager.INSTANCE.changeVisualAngle(CallerVisualAngleManager.Scene.RoadEvent.INSTANCE); + } CallerHmiManager.INSTANCE.showWarning(WarningDirectionEnum.ALERT_WARNING_TOP, TimeUnit.HOURS.toMillis(1)); V2XMessageEntity entity = getV2XMessageEntity(); if (entity != null) { @@ -140,10 +142,21 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp } } + private boolean isNeedChangeAngle() { + V2XMessageEntity entity = getV2XMessageEntity(); + V2XRoadEventEntity content = entity != null ? entity.getContent() : null; + if (content == null) { + return true; + } + return !EventTypeEnum.GHOST_PROBE.getPoiType().equals(content.getPoiType()); + } + @Override public void onDismiss() { CallerHmiManager.INSTANCE.dismissWarning(WarningDirectionEnum.ALERT_WARNING_TOP); - CallerVisualAngleManager.INSTANCE.changeVisualAngle(new CallerVisualAngleManager.Scene.Default(3, TimeUnit.SECONDS)); + if (isNeedChangeAngle()) { + CallerVisualAngleManager.INSTANCE.changeVisualAngle(new CallerVisualAngleManager.Scene.Default(3, TimeUnit.SECONDS)); + } clearPOI(); release(); } From 6ab6caccc78aec8075358916865eb13cac4debe3 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Sat, 7 May 2022 17:17:29 +0800 Subject: [PATCH 5/5] fixed bug --- .../mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java index 0526d3a9ec..cad4b55bc9 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java @@ -968,7 +968,9 @@ public class AMapViewWrapper implements IMogoMapView, mCurrentUI = EnumMapUI.MAP_STYLE_NIGHT_VR; mapStyle = MapAutoApi.MAP_STYLE_NIGHT_VR; } - mMapView.getMapAutoViewHelper().setMapStyle(mapStyle); + if (mMapView != null && mMapView.getMapAutoViewHelper() != null) { + mMapView.getMapAutoViewHelper().setMapStyle(mapStyle); + } } catch (Exception e) { e.printStackTrace(); }