From fa04ed406eadcdb38157f040b5486c04e87059e7 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 30 Jan 2023 17:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=80=81obu=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=90=88=E5=B9=B6EventTypeEnumNew?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 4 +- .../redlightwarning/RedLightWarningManager.kt | 26 +- .../function/biz/v2x/vip/VipCarManager.kt | 34 +- .../build.gradle | 1 - .../mogo-core-function-hmi/build.gradle | 2 - .../receiver/V2XWarningBroadcastReceiver.kt | 4 +- .../core/function/hmi/ui/MoGoHmiFragment.kt | 23 +- .../adapter/DriverMsgBoxBubbleAdapter.kt | 3 +- .../msgbox/adapter/DriverMsgBoxListAdapter.kt | 3 +- .../adapter/PassengerMsgBoxBubbleAdapter.kt | 6 +- .../adapter/PassengerMsgBoxListAdapter.kt | 4 +- .../hmi/ui/setting/DebugSettingView.kt | 4 +- .../function/hmi/ui/takeover/TakeOverView.kt | 10 +- .../function/main/MainMoGoApplication.java | 3 +- .../impl/marker/drawer/MarkerDrawer.java | 4 +- .../mogo-core-function-obu-mogo/build.gradle | 1 - .../core/function/obu/mogo/MoGoObuProvider.kt | 13 +- .../obu/mogo/MogoPrivateObuManager.kt | 1001 ----------------- .../obu/mogo/MogoPrivateObuNewManager.kt | 12 +- .../obu/mogo/utils/TrafficDataConvertUtils.kt | 133 --- .../v2x/events/alarm/V2XAlarmServer.java | 8 +- .../manager/impl/MoGoV2XMarkerManager.java | 12 +- .../v2x/events/marker/V2XMarkerAdapter.java | 18 +- .../v2x/events/view/V2XMarkerRoadEventView.kt | 10 +- .../core/data/config/CloudPoiManager.java | 31 +- .../eagle/core/data/enums/EventTypeEnumNew.kt | 16 + .../eagle/core/data/enums/EventTypeHelper.kt | 68 +- .../data/map/entity/V2XRoadEventEntity.java | 13 +- 28 files changed, 156 insertions(+), 1311 deletions(-) delete mode 100644 core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt delete mode 100644 core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt diff --git a/config.gradle b/config.gradle index 9c6fdcf353..f93598a206 100644 --- a/config.gradle +++ b/config.gradle @@ -91,9 +91,7 @@ ext { // obu sdk obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3", - mogoobuold : 'com.zhidao.support.obu:mogoobu:1.0.0.33', - mogoobu : 'com.mogo.support.obu:mogo-obu:1.0.6', - mogoami : 'com.zhidao.support.obu.ami:mogoami:1.0.0.24', + mogoobu : 'com.mogo.support.obu:mogo-obu:1.1.0_beta0', // google googlezxing : "com.google.zxing:core:3.3.3", diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/redlightwarning/RedLightWarningManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/redlightwarning/RedLightWarningManager.kt index 6b07d8fc61..283bd2d5fd 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/redlightwarning/RedLightWarningManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/redlightwarning/RedLightWarningManager.kt @@ -4,7 +4,7 @@ import android.util.Log import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP_GREEN import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I -import com.mogo.eagle.core.data.enums.EventTypeEnum +import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.map.MogoLatLng import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType @@ -209,17 +209,17 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, MsgBoxBean( MsgBoxType.V2X, V2XMsg( - EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, - EventTypeEnum.TYPE_USECASE_ID_IVP.content, - EventTypeEnum.TYPE_USECASE_ID_IVP.tts + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.content, + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.tts ) ) ) CallerHmiManager.warningV2X( - EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, - EventTypeEnum.TYPE_USECASE_ID_IVP.content, - EventTypeEnum.TYPE_USECASE_ID_IVP.tts, - EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.content, + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.tts, + EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, null, true, 5000L @@ -235,11 +235,11 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, CallerLogger.d("$M_V2X$TAG", "=====绿灯通行预警=====") ThreadUtils.runOnUiThread { val content = String.format( - EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), speed ) val tts = String.format( - EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), speed ) if (content.isNullOrEmpty() || tts.isNullOrEmpty()) { @@ -249,17 +249,17 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, MsgBoxBean( MsgBoxType.V2X, V2XMsg( - EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, content, tts ) ) ) CallerHmiManager.warningV2X( - EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, content, tts, - EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, null, true, 5000L diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/vip/VipCarManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/vip/VipCarManager.kt index eef302a909..b3701db467 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/vip/VipCarManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/vip/VipCarManager.kt @@ -10,7 +10,7 @@ import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_VIP import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2N -import com.mogo.eagle.core.data.enums.EventTypeEnum +import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.V2XMsg @@ -209,17 +209,17 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe val light = this.result?.currentRoadTrafficLight() if (light != null && light.isGreen()) { showWarning( - EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.poiType, - EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.content, - EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.tts, - EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.poiType + EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.poiType, + EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.content, + EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.tts, + EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.poiType ) } else { showWarning( - EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.poiType, - EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.content, - EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.tts, - EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.poiType + EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.poiType, + EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.content, + EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.tts, + EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.poiType ) } return@turnLightToGreen @@ -228,10 +228,10 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe // 请求变灯失败,根据灯态来提示。 此处灯态未获取到 if (this.result == null || this.result?.currentRoadTrafficLight() == null) { showWarning( - EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType, - EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.content + ", 稍后重试", - EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.tts, - EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType + EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType, + EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.content + ", 稍后重试", + EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.tts, + EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType ) return@turnLightToGreen } @@ -249,10 +249,10 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe "${temp}秒后重试" } showWarning( - EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType, - EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.content + time, - EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.tts, - EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType + EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType, + EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.content + time, + EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.tts, + EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType ) } else { CallerLogger.d( diff --git a/core/function-impl/mogo-core-function-datacenter/build.gradle b/core/function-impl/mogo-core-function-datacenter/build.gradle index b6e5f51262..a4c999e435 100644 --- a/core/function-impl/mogo-core-function-datacenter/build.gradle +++ b/core/function-impl/mogo-core-function-datacenter/build.gradle @@ -54,7 +54,6 @@ dependencies { kapt rootProject.ext.dependencies.androidxroomcompiler implementation rootProject.ext.dependencies.androidxroomktx - implementation rootProject.ext.dependencies.mogoami implementation rootProject.ext.dependencies.mogoaicloudtelematic if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle index df17cbf358..26c469da4b 100644 --- a/core/function-impl/mogo-core-function-hmi/build.gradle +++ b/core/function-impl/mogo-core-function-hmi/build.gradle @@ -72,8 +72,6 @@ dependencies { implementation rootProject.ext.dependencies.arouter kapt rootProject.ext.dependencies.aroutercompiler - implementation rootProject.ext.dependencies.mogoami - implementation rootProject.ext.dependencies.android_start_up implementation rootProject.ext.dependencies.cicle_indicator implementation rootProject.ext.dependencies.koomnative 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 3a60406e12..30f289c218 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 @@ -4,11 +4,11 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.util.Log +import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.hmi.WaringConst import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI -import com.mogo.eagle.core.data.enums.EventTypeEnum import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.V2XMsg @@ -75,7 +75,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() { ttsContent: String?, tag: String? ) { - if (EventTypeEnum.TYPE_USECASE_ID_IVP.poiType == v2xType.toString()) { + if (EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType == v2xType.toString()) { CallerHmiManager.showLimitingVelocity(1, 1) } if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { 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 a0ac521b3a..9f482ca275 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 @@ -3,7 +3,7 @@ package com.mogo.eagle.core.function.hmi.ui import android.content.Context import android.os.Bundle import android.text.TextUtils -import android.util.* +import android.util.Log import android.view.View import android.view.ViewGroup import android.view.animation.AlphaAnimation @@ -24,16 +24,12 @@ import com.mogo.eagle.core.data.constants.MoGoFragmentPaths import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RTS import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean -import com.mogo.eagle.core.data.enums.EventTypeEnum +import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.enums.WarningDirectionEnum import com.mogo.eagle.core.data.map.Infrastructure -import com.mogo.eagle.core.data.msgbox.MsgBoxBean -import com.mogo.eagle.core.data.msgbox.MsgBoxType -import com.mogo.eagle.core.data.msgbox.RecordBagMsg import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData import com.mogo.eagle.core.data.report.ReportEntity -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.AutoPilotStatusView_TAG import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.CameraView_TAG @@ -46,16 +42,12 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight import com.mogo.eagle.core.function.api.hmi.warning.IMoGoHmiProvider import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager -import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager -import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager -import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Turning -import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.notification.WarningFloat import com.mogo.eagle.core.function.hmi.ui.bindingcar.ModifyBindingCarDialog @@ -67,10 +59,10 @@ import com.mogo.eagle.core.function.hmi.ui.notice.NoticeCheckDialog import com.mogo.eagle.core.function.hmi.ui.notice.traffic.NoticeTrafficDialog import com.mogo.eagle.core.function.hmi.ui.setting.CameraLiveView.Companion.cameraLiveView import com.mogo.eagle.core.function.hmi.ui.setting.IPCReportWindow -import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView.Companion.toggleDebugView import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog -import com.mogo.eagle.core.function.hmi.ui.widget.* +import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView +import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView import com.mogo.eagle.core.function.main.DisplayEffectsHelper import com.mogo.eagle.core.utilcode.kotlin.safeCancel import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils @@ -78,17 +70,12 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.mogo.eagle.core.utilcode.mogo.toast.TipToast import com.mogo.eagle.core.utilcode.reminder.api.IReminder import com.mogo.eagle.core.utilcode.util.ThreadUtils -import com.mogo.eagle.core.utilcode.util.TimeUtils -import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String import com.mogo.eagle.core.utilcode.util.ToastUtils -import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig import com.zhjt.service_biz.BizConfig import kotlinx.android.synthetic.main.fragment_hmi.* import kotlinx.coroutines.* -import record_cache.RecordPanelOuterClass import java.util.concurrent.atomic.AtomicReference /** @@ -326,7 +313,7 @@ class MoGoHmiFragment : MvpFragment(), playTts && !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) activity?.let { val warningContent = alertContent - ?: EventTypeEnum.getWarningContent(v2xType) + ?: EventTypeEnumNew.getWarningContent(v2xType) //占道施工预警 if (v2xType == "10006" || v2xType == "100061") { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt index ab7bab281e..e6917eee75 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxBubbleAdapter.kt @@ -8,7 +8,6 @@ import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import androidx.recyclerview.widget.RecyclerView -import com.mogo.eagle.core.data.enums.EventTypeEnum import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.msgbox.* import com.mogo.eagle.core.data.report.ReportEntity @@ -129,7 +128,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) }else{ holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable( - EventTypeEnum.getUpdateIconRes(v2XMsg.type))) + EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxListAdapter.kt index 65a914808d..5e02c0c918 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxListAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/DriverMsgBoxListAdapter.kt @@ -9,7 +9,6 @@ import android.widget.ImageView import android.widget.TextView import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView -import com.mogo.eagle.core.data.enums.EventTypeEnum import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.msgbox.* import com.mogo.eagle.core.data.report.ReportEntity @@ -219,7 +218,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) }else{ holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable( - EventTypeEnum.getUpdateIconRes(v2XMsg.type))) + EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt index 6b0c6750a6..858f15e6cd 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxBubbleAdapter.kt @@ -8,17 +8,15 @@ import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import androidx.recyclerview.widget.RecyclerView -import com.mogo.eagle.core.data.enums.EventTypeEnum import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg import com.mogo.eagle.core.data.msgbox.V2XMsg -import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp -import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform import com.mogo.eagle.core.utilcode.util.TimeUtils import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat @@ -101,7 +99,7 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) }else{ holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable( - EventTypeEnum.getUpdateIconRes(v2XMsg.type))) + EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt index 50c635e49c..1dbb6a3be9 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/PassengerMsgBoxListAdapter.kt @@ -7,13 +7,11 @@ import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView import androidx.recyclerview.widget.RecyclerView -import com.mogo.eagle.core.data.enums.EventTypeEnum import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg import com.mogo.eagle.core.data.msgbox.V2XMsg -import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp @@ -93,7 +91,7 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) }else{ holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable( - EventTypeEnum.getUpdateIconRes(v2XMsg.type))) + EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index cb59e84424..6911df61f8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -74,7 +74,7 @@ import com.mogo.eagle.core.utilcode.mogo.toast.TipToast import com.mogo.eagle.core.utilcode.util.* import com.mogo.map.uicontroller.VisualAngleMode import com.mogo.map.uicontroller.VisualAngleMode.* -import com.zhidao.easysocket.utils.L +//import com.zhidao.easysocket.utils.L import com.zhjt.mogo_core_function_devatools.env.* import kotlinx.android.synthetic.main.view_debug_setting.view.* import mogo.telematics.pad.MessagePad @@ -1269,7 +1269,7 @@ internal class DebugSettingView @JvmOverloads constructor( * 设置是否输出OBU日志 true-打印日志,false-不打印日志 */ tbObuLog.setOnCheckedChangeListener { _, isChecked -> - L.setEnableLog(isChecked) +// L.setEnableLog(isChecked) } /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/takeover/TakeOverView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/takeover/TakeOverView.kt index 23dde7c51a..4b447c2eaa 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/takeover/TakeOverView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/takeover/TakeOverView.kt @@ -6,7 +6,7 @@ import android.view.LayoutInflater import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.data.config.FunctionBuildConfig -import com.mogo.eagle.core.data.enums.EventTypeEnum +import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager @@ -56,10 +56,10 @@ class TakeOverView @JvmOverloads constructor( MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_CHASSIS, MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_DISTANCE -> { CallerHmiManager.warningV2X( - EventTypeEnum.TAKE_OVER_EVENT.poiType, - EventTypeEnum.TAKE_OVER_EVENT.content, - EventTypeEnum.TAKE_OVER_EVENT.tts, - EventTypeEnum.TAKE_OVER_EVENT.poiType, + EventTypeEnumNew.TAKE_OVER_EVENT.poiType, + EventTypeEnumNew.TAKE_OVER_EVENT.content, + EventTypeEnumNew.TAKE_OVER_EVENT.tts, + EventTypeEnumNew.TAKE_OVER_EVENT.poiType, object : IMoGoWarningStatusListener { override fun onShow() { takeOver = true diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java index 9be0248578..d67b55b7c7 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java @@ -34,7 +34,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.util.ProcessUtils; import com.mogo.eagle.core.utilcode.util.SPUtils; -import com.zhidao.support.obu.ami.AmiClientManager; import java.io.File; import java.lang.reflect.Field; @@ -203,7 +202,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { */ private void connectAmiIp() { String ipAddress = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().getBaseContext()).getString(MoGoConfig.OBU_IP, "192.168.1.199"); - AmiClientManager.getInstance().setObuIp(ipAddress); +// AmiClientManager.getInstance().setObuIp(ipAddress); } private void initModules() { diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/marker/drawer/MarkerDrawer.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/marker/drawer/MarkerDrawer.java index 63bba6385f..7195182391 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/marker/drawer/MarkerDrawer.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/impl/marker/drawer/MarkerDrawer.java @@ -5,6 +5,7 @@ import android.text.TextUtils; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.module.status.MogoStatusManager; +import com.mogo.eagle.core.data.enums.EventTypeEnumNew; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.entity.MarkerExploreWay; import com.mogo.eagle.core.data.map.entity.MarkerNoveltyInfo; @@ -19,7 +20,6 @@ import com.mogo.map.MogoMarkerManager; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.eagle.core.data.enums.EventTypeEnum; /** * @author congtaowang @@ -81,7 +81,7 @@ public class MarkerDrawer { Object bindObj = markerShowEntity.getBindObj(); if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) { String poiType = ((MarkerExploreWay) bindObj).getPoiType(); - options.icon3DRes(EventTypeEnum.getMarker3DRes(poiType)); + options.icon3DRes(EventTypeEnumNew.getMarker3DRes(poiType)); } } diff --git a/core/function-impl/mogo-core-function-obu-mogo/build.gradle b/core/function-impl/mogo-core-function-obu-mogo/build.gradle index 9bf311e83c..5f05fb457c 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/build.gradle +++ b/core/function-impl/mogo-core-function-obu-mogo/build.gradle @@ -59,7 +59,6 @@ dependencies { implementation project(':core:mogo-core-function-call') } - implementation rootProject.ext.dependencies.mogoobuold implementation rootProject.ext.dependencies.mogoobu } diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt index f9c946d9f7..2f8b946bee 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt @@ -11,6 +11,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.eagle.core.utilcode.util.CommonUtils +import com.mogo.support.obu.MogoObuManager /** * @author xiaoyuzhou @@ -54,9 +55,6 @@ class MoGoObuProvider : IMoGoObuProvider { ipAddress, CommonUtils.getIpAddressString() ) - - //old obu - MogoPrivateObuManager.INSTANCE.init(context, ipAddress) } else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端 val ipAddress = SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp) @@ -66,9 +64,6 @@ class MoGoObuProvider : IMoGoObuProvider { ipAddress, CommonUtils.getIpAddressString() ) - - //old obu - MogoPrivateObuManager.INSTANCE.init(context, ipAddress) } } } @@ -95,18 +90,16 @@ class MoGoObuProvider : IMoGoObuProvider { CommonUtils.getIpAddressString() ) - //连接old obu - MogoPrivateObuManager.INSTANCE.connectObu(it, ipAddress) } } } override fun disConnect() { - MogoPrivateObuManager.INSTANCE.disConnectObu() + MogoPrivateObuNewManager.INSTANCE.disconnect() } override fun isConnected(): Boolean { - return MogoPrivateObuManager.INSTANCE.isConnected() + return MogoObuManager.getInstance().connectStatus == 1 } } \ No newline at end of file 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 deleted file mode 100644 index a942a7556e..0000000000 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt +++ /dev/null @@ -1,1001 +0,0 @@ -package com.mogo.eagle.core.function.obu.mogo - -import android.content.Context -import android.util.Log -import com.mogo.cloud.passport.MoGoAiCloudClientConfig -import com.mogo.eagle.core.data.app.AppConfigInfo -import com.mogo.eagle.core.data.config.FunctionBuildConfig -import com.mogo.eagle.core.data.enums.EventTypeEnum -import com.mogo.eagle.core.data.enums.EventTypeHelper -import com.mogo.eagle.core.data.enums.WarningDirectionEnum -import com.mogo.eagle.core.data.msgbox.MsgBoxBean -import com.mogo.eagle.core.data.msgbox.MsgBoxType -import com.mogo.eagle.core.data.msgbox.V2XMsg -import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager -import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager -import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager -import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default -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.obu.mogo.utils.TrafficDataConvertUtils -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.zhidao.support.obu.MogoObuManager -import com.zhidao.support.obu.OnMogoObuListener -import com.zhidao.support.obu.constants.ObuConstants -import com.zhidao.support.obu.model.* -import com.zhidao.support.obu.model.advance.Light -import org.json.JSONObject - -/** - * - * @author lixiaopeng - * @since 2021/8/8 - * @description OBU 管理 - */ -class MogoPrivateObuManager private constructor() { - companion object { - val INSTANCE: MogoPrivateObuManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { - MogoPrivateObuManager() - } - } - - private var mContext: Context? = null - private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo() - - fun init(context: Context, ipAddress: String) { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "obuManager初始化--") - mContext = context - //连接obu设备 - connectObu(context, ipAddress) - //控制日志输出 - MogoObuManager.getInstance() - .init(MoGoAiCloudClientConfig.getInstance().getSn(), AppConfigInfo.toString()) - MogoObuManager.getInstance().registerListener(mogoObuListener) - } - - fun connectObu(context: Context, ipAddress: String) { - //自研obu初始化 - mObuStatusInfo.connectIP = ipAddress - mObuStatusInfo.obuSdkVersion = MogoObuManager.getInstance().versionName - if (!MogoObuManager.getInstance().isConnected) { - MogoObuManager.getInstance().connect(context, mObuStatusInfo.connectIP) - } else { - try { - MogoObuManager.getInstance().disConnect() - Thread.sleep(500) - } catch (e: Exception) { - e.printStackTrace() - } - MogoObuManager.getInstance().connect(context, mObuStatusInfo.connectIP) - } - } - - fun disConnectObu() { - try { - MogoObuManager.getInstance().disConnect() - } catch (e: Exception) { - e.printStackTrace() - } - - } - - fun isConnected(): Boolean { - return MogoObuManager.getInstance().isConnected - } - - private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() { - // OBU连接成功 - override fun onConnected() { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onConnected ------> ") - mObuStatusInfo.obuStatus = true - CallerObuListenerManager.invokeListener(mObuStatusInfo) - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) } - - //断开mogo obu - com.mogo.support.obu.MogoObuManager.getInstance().disconnect() - } - - // OBU连接失败 - override fun onConnectFail(isNeedReconnect: Boolean) { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onConnectFail ------> ") - mObuStatusInfo.obuStatus = false - mObuStatusInfo.obuHvStatus = false - mObuStatusInfo.obuRvStatus = false - CallerObuListenerManager.invokeListener(mObuStatusInfo) - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", false) } - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", false) } - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", false) } - } - - // OBU断开连接 - override fun onDisconnect() { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onDisconnect ------> ") - mObuStatusInfo.obuStatus = false - mObuStatusInfo.obuHvStatus = false - mObuStatusInfo.obuRvStatus = false - CallerObuListenerManager.invokeListener(mObuStatusInfo) - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", false) } - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", false) } - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", false) } - } - - // 接收到的原始数据 - override fun onReceiveOriginData(data: String) { - super.onReceiveOriginData(data) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onReceiveOriginData ------> data = $data" - ) - - } - - // 发送的数据 - override fun onSendData(bytes: ByteArray) { - super.onSendData(bytes) - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onSendData ------> ") - } - - // CV2X系统信息 - override fun onCvxAppInitIndInfo(info: CvxAppInitIndInfo) { - super.onCvxAppInitIndInfo(info) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxAppInitIndInfo ------> $info" - ) - if (info != null) { - if (!info.stack_info.isNullOrEmpty()) { - mObuStatusInfo.stackInfo = info.stack_info - } - - if (!info.app_info.isNullOrEmpty()) { - mObuStatusInfo.appInfo = info.app_info - } - - if (!info.hli_info.isNullOrEmpty()) { - mObuStatusInfo.hliInfo = info.hli_info - } - CallerObuListenerManager.invokeListener(mObuStatusInfo) - } - } - - // (2) 车辆信息:CVX_HV_INFO_IND - override fun onCvxHvInfoIndInfo(info: CvxHvInfoIndInfo?) { - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", true) } - mObuStatusInfo.obuHvStatus = true - CallerObuListenerManager.invokeListener(mObuStatusInfo) - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxHvInfoIndInfo ------> $info") - if (info != null && info.basic_info != null && info.basic_info.position != null) { - val movingObjectInfo = info.basic_info - val position = movingObjectInfo.position - val data = JSONObject() - try { - data.putOpt("lon", position.longitude) - data.putOpt("lat", position.latitude) - data.putOpt("speed", movingObjectInfo.speed) - data.putOpt("heading", movingObjectInfo.heading) - if (info.acceleration_set != null) { - data.putOpt("acceleration", info.acceleration_set.lateral) - data.putOpt("yawRate", info.acceleration_set.yaw_rate) - } - try { - data.putOpt("systemTime", System.currentTimeMillis()) - } catch (e: Exception) { - e.printStackTrace() - } - try { - data.putOpt("satelliteTime", System.currentTimeMillis()) - } catch (e: Exception) { - e.printStackTrace() - } - - // 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统,1-工控机,2-OBU - if (2 == FunctionBuildConfig.gpsProvider) { - // 同步给MAP地图 - CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(data) - // 同步更新经纬度和系统时间至 AutoPilotStatusListener - CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon( - System.currentTimeMillis() / 1000.0, - position.longitude, - position.latitude - ) - } - - } catch (e: Exception) { - e.printStackTrace() - } - } - } - - // (3) 远车信息:CVX_RV_INFO_IND - override fun onCvxRvInfoIndInfo(info: CvxRvInfoIndInfo) { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxRvInfoIndInfo ------> $info") - mObuStatusInfo.obuRvStatus = true - CallerObuListenerManager.invokeListener(mObuStatusInfo) - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", true) } - // 更新数据 - TrafficDataConvertUtils.cvxRvInfoIndInfo2TrafficData(info)?.let { - CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it) - } - } - - // (3) 道路事件预警信息:CVX_RTI_THREAT_IND - override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) { -// if (HmiBuildConfig.isShowObuV2iView) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxRtiThreatIndInfo ------> $info" - ) - - if (info != null && info.threat_info != null && info.ext_info != null) { - var alertContent = "" - var ttsContent = "" - var appId = info.threat_info.app_id.toString() - val status = info.status - val level = info.threat_info.threat_level - val direction = - getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}" - ) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type} --direction = $direction -- pos_classification = ${info.ext_info.pos_classification} " - ) - when (appId) { - // 道路危险情况预警 - EventTypeEnum.TYPE_USECASE_ID_HLW.poiType, - EventTypeEnum.TYPE_USECASE_ID_IVS.poiType - -> { - when (info.ext_info.rti_type) { - //急转弯 - 0x2 -> { - // 特殊处理左、右方向的 - when (direction) { - WarningDirectionEnum.ALERT_WARNING_LEFT, - WarningDirectionEnum.ALERT_WARNING_TOP_LEFT, - WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType - } - WarningDirectionEnum.ALERT_WARNING_RIGHT, - WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT, - WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType - } - } - } - //施工 - 0x7 -> { - appId = EventTypeEnum.FOURS_ROAD_WORK.poiType - } - //限速 - 0xA -> { - appId = EventTypeEnum.TYPE_USECASE_ID_SLW.poiType - } - //事故 - 0xC -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType - } - //拥堵 - 0xD -> { - appId = EventTypeEnum.TYPE_USECASE_ID_TJW.poiType - } - //行人 - 0xF -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType - } - //禁止停车 - 0x13 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType - } - //学校 - 0x14 -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType - } - //桥梁 - 0x17 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType - } - //轻轨电车 - 0x18 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_TRAMCAR.poiType - } - //人行横道 - 0x19 -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType - } - //减速慢行 - 0x1A -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType - } - //事故易发路段 - 0x1B -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType - } - //环岛行驶 - 0x1C -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType - } - //环岛行驶 - 0x1D -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType - } - //驼峰桥 - 0x1E -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType - } - } - alertContent = EventTypeEnum.getWarningContent(appId) - ttsContent = EventTypeEnum.getWarningTts(appId) - } - // 前方拥堵提醒 - EventTypeEnum.TYPE_USECASE_ID_TJW.poiType -> { - ttsContent = EventTypeEnum.getWarningTts(appId) - if (info.threat_info != null) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "ttsContent = $ttsContent --alertContent = $alertContent ---info.threat_info.distance = ${info.threat_info.distance} " - ) - if (info.threat_info.distance.toInt() != 0) { - alertContent = String.format( - EventTypeEnum.getWarningContent(appId), - info.threat_info.distance.toInt() - ) - } else { - alertContent = "前方拥堵,减速慢行" - } - } - - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "ttsContent = $ttsContent --alertContent = $alertContent" - ) - } - } - - when (status) { - // 添加 - ObuConstants.STATUS.ADD -> { - //不显示弹框,其它保留 - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxRtiThreatIndInfo ------> appId = $appId --- alertContent = $alertContent --- ttsContent = $ttsContent ") - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuManager4", "alertContent或ttsContent为空!") - } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(appId, - alertContent, - ttsContent) - ) - ) - CallerHmiManager.warningV2X( - appId, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - (appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 - object : IMoGoWarningStatusListener { - override fun onDismiss() { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - } - }, - true, - 5000L - ) - } - - ObuConstants.STATUS.UPDATE -> { - //显示警告红边 TODO 需要确定是什么值 -// CallerHmiManager.showWarning(direction) - - // 更新数据 - TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.invokeTrackerWarningInfo(it) - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } - } - - // 删除 - ObuConstants.STATUS.DELETE -> { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 移除顶部弹窗 -// CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) - // 更新数据 - TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.removeTrackerWarningInfo(it) - // 事件结束,还原车辆颜色 - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } - } - } - } -// } - } - - // (4) V2I预警信息:CVX_IVP_THREAT_IND,红绿灯 - override fun onCvxIvpThreatIndInfo(info: CvxIvpThreatIndInfo?) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "CvxIvpThreatIndInfo ------> $info" - ) - if (info != null && info.ext_info != null - && info.threat_info != null - && info.ext_info.lights != null - && info.ext_info.lights.isNotEmpty() - ) { -// if (HmiBuildConfig.isShowObuV2iView) { - handlerTrafficLight( - info.threat_info.app_id, - info.status, - info.ext_info.lights, - info.ext_info.index - ) -// } - } - } - - // (2) 弱势交通参与者预警信息:CVX_PTC_THREAT_IND - override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) { -// if (HmiBuildConfig.isShowObuV2iView) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxPtcInfoIndInfo ------> $info" - ) - // 交通参与者类型 0x0:未知 UNKNOWN | 0x1:非机动车 NON_MOTOR | 0x2:行人 PEDESTRIAN 0x3:RSU - if (info != null && (info.ptc_type == 1 || info.ptc_type == 2)) { - //v2i数据传输延迟 -// val hvMillTime = info.threat_info.hv_time.millisecond -// val hvSecondMillTime = (info.threat_info.hv_time.second) * 1000 -// val hvTime = hvMillTime + hvSecondMillTime -// val currentTime = TimeUtils.getNowMills() % 60000 -// val delayTime = currentTime - hvTime - -// CallerObuListenerManager.invokeDelayTime(delayTime) -// CallerLogger.d( -// "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", -// "onCvxPtcInfoIndInfo ---delayTime---> $delayTime" -// ) - - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxPtcInfoIndInfo ---status---> ${info.status}" - ) - var v2xType = "" - if (info.ptc_type == 1) { //摩托车 - v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType - } else if (info.ptc_type == 2) { //行人 - v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType - } - val ttsContent = EventTypeEnum.getWarningTts(v2xType) - val alertContent = EventTypeEnum.getWarningContent(v2xType) - val direction = - getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1) - val level = if (info.threat_info != null) info.threat_info.threat_level else -1 - - when (info.status) { - // 添加 - ObuConstants.STATUS.ADD -> { - // if (level == 2 || level == 3) { //不考虑level - //显示警告红边 - CallerHmiManager.showWarning(direction) - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxPtcThreatIndInfo ------> v2xType = $v2xType --- alertContent = $alertContent --- ttsContent = $ttsContent ") - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuManager5", "alertContent或ttsContent为空!") - } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(v2xType, - alertContent, - ttsContent) - ) - ) - CallerHmiManager.warningV2X( - v2xType, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - (v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 - object : IMoGoWarningStatusListener { - override fun onDismiss() { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - } - }, - true, - 5000L - ) -// } - - // 更新数据 - TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.invokeTrackerWarningInfo(it) - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } - } - - ObuConstants.STATUS.UPDATE -> { - } - - // 删除 - ObuConstants.STATUS.DELETE -> { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 更新数据 - TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.removeTrackerWarningInfo(it) - // 事件结束,还原交通参与者颜色 - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } -// CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString()) - } - } - - } -// } - } - - // (5) 限速预警信息:CVX_SLW_THREAT_IND - override fun onCvxSlwThreatIndInfo(info: CvxSlwThreatIndInfo?) { - //todo 限速走高精地图 屏蔽OBU限速\ -// CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxSlwThreatIndInfo ------> $info") -// if (info != null) { -// when (info.status) { -// // 添加 -// ObuConstants.STATUS.ADD, -// ObuConstants.STATUS.UPDATE -// -> { -// if (info.ext_info != null) { -// // 计算为千米每小时 TODO 这里需要做一下向上取整数,40,60,80,120等 -// CallerLogger.d( -// "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", -// "info.ext_info.speed_limit_max ------> ${info.ext_info.speed_limit_max}" -// ) -// CallerHmiManager.showLimitingVelocity((Math.round(((info.ext_info.speed_limit_max * 60 * 60) / 1000) / 10) * 10).toInt()) -// } -// } -// // 删除 -// ObuConstants.STATUS.DELETE -> { -// CallerHmiManager.disableLimitingVelocity() -// } -// } -// } - } - - - // (1) V2V预警信息:CVX_V2V_THREAT_IND - override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) { -// if (HmiBuildConfig.isShowObuV2vView) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxV2vThreatIndInfo ------> $info" - ) - info?.let { - //预警信息,预警类型 threat_level 2、3 - info.threat_info?.let { - //预警方位 - val direction = - getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1) - //处理预警类型 - val appId = info.threat_info.app_id - val level = info.threat_info.threat_level - val status = info.status - if (info.ext_info != null) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxV2vThreatIndInfo target_classification = ${ - getMessageDirection(info.ext_info.target_classification) - } --- direction = $direction --- appId = $appId ---level = $level -- status = $status" - ) - } - - handleSdkObu(appId, direction, status, level, info) - } - } - } -// } - } - - /** - * 返回OBU监听 - */ - fun getMogoObuListener(): OnMogoObuListener { - return mogoObuListener - } - - /** - * 获取消息的方位 车辆相关 - */ - private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "预警红边:预警方向->$targetClassification") - return when (targetClassification) { - ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_IN_LANE, - ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_IN_LANE, - 0x04 -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方 - - 0x03 -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方 - - ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_IN_LANE, - 0x05 -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方 - - 0x02 -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方 - - ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_LEFT, - ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_FAR_LEFT, - ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_LEFT, - ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_FAR_LEFT, - ObuConstants.TARGET_CLASSIFICATION.TC_INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方 - - ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_FAR_RIGHT, - ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_FAR_RIGHT, - ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_RIGHT, - ObuConstants.TARGET_CLASSIFICATION.TC_INTERSECTION_RIGHT, - ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_RIGHT -> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方 - - ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_LEFT, - ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_FAR_LEFT -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方 - - ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_RIGHT, - ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_FAR_RIGHT -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方 - - ObuConstants.TARGET_CLASSIFICATION.TC_UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知 - else -> WarningDirectionEnum.ALERT_WARNING_ALL - } - } - - fun release() { - MogoObuManager.getInstance().unregisterListener() - } - - /** - * 处理红绿灯 - */ - private fun handlerTrafficLight(appId: Int, status: Int, lights: List, index: Int) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "handlerTrafficLight appId = $appId --- status = $status ---index = $index ---lights.size = ${lights.size} ---lights = $lights " - ) - when (status) { - // 添加 - ObuConstants.STATUS.ADD, - ObuConstants.STATUS.UPDATE - -> { - changeTrafficLightStatus(appId, lights, index) - } - // 删除 - ObuConstants.STATUS.DELETE -> { - // 移除顶部弹窗 - CallerHmiManager.disableWarningTrafficLight() -// CallerHmiManager.disableWarningV2X(appId.toString()) - } - } - } - - private var isRedLight = false - private var isGreenLight = false - - /** - * 修改红绿灯 - */ - @Synchronized - private fun changeTrafficLightStatus( - appId: Int, - lights: List, - index: Int - ) { - var ttsContent = "" - var alertContent = "" - //这里需要根据真实数据确定 index 取值方式 - if (index != -1 && lights.size >= index) { - val currentLight = lights[index] - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} ---rlvw_violation_type = ${currentLight.rlvw_violation_type} --- index = $index ---appId = $appId ---appId = $appId" - ) - // 闯红灯预警 - when (currentLight.rlvw_violation_type) { - 0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE - } - 0x1 -> {//无违规 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION -// CallerHmiManager.disableWarningV2X(appId.toString()) - } - 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT - ttsContent = EventTypeEnum.getWarningTts(appId.toString()) - alertContent = EventTypeEnum.getWarningContent(appId.toString()) - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old changeTrafficLightStatus ------> appId.toString() = ${appId.toString()} --- alertContent = $alertContent --- ttsContent = $ttsContent ") - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuManager1", "alertContent或ttsContent为空!") - } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(appId.toString(), alertContent, ttsContent) - ) - ) - CallerHmiManager.warningV2X( - appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 5000L - ) - } - 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT - } - } - - when (currentLight.phase) { - // 灯光不可用 - 0x0 -> { - CallerHmiManager.showWarningTrafficLight(0, 3) - } - // 红灯 - 0x1 -> { - if (!isRedLight) { -// CallerHmiManager.disableWarningV2X(appId.toString()) - isRedLight = true - } - isGreenLight = false - CallerHmiManager.showWarningTrafficLight(1, 3) - - val red = currentLight.count_down.toInt() - CallerHmiManager.changeCountdownRed(red) - CallerHmiManager.changeCountdownGreen(0) - CallerHmiManager.changeCountdownYellow(0) - - } - // 绿灯 - 0x2 -> { - if (!isGreenLight) { -// CallerHmiManager.disableWarningV2X(appId.toString()) - isGreenLight = true - } - isRedLight = false - CallerHmiManager.showWarningTrafficLight(3, 3) - val green = currentLight.count_down.toInt() - CallerHmiManager.changeCountdownGreen(green) - //防止数据出现问题的容错 - CallerHmiManager.changeCountdownRed(0) - CallerHmiManager.changeCountdownYellow(0) - // 拼接建议速度 - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "speed_min = ${currentLight.glosa_suggested_speed_min} --speed_max = ${currentLight.glosa_suggested_speed_max.toInt()}" - ) - val adviceSpeed = - "${currentLight.glosa_suggested_speed_min.toInt()} - ${currentLight.glosa_suggested_speed_max.toInt()}" - - val adviceSpeedTts = - "${currentLight.glosa_suggested_speed_min.toInt()}到${currentLight.glosa_suggested_speed_max.toInt()}" - - ttsContent = - String.format( - EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), - adviceSpeedTts - ) - - alertContent = - String.format( - EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), - adviceSpeed - ) - - val maxSpeed = currentLight.glosa_suggested_speed_max.toInt() - if (maxSpeed > 0) { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old changeTrafficLightStatus ------> TYPE_USECASE_ID_IVP_GREEN --- alertContent = $alertContent --- ttsContent = $ttsContent ") - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuManager2", "alertContent或ttsContent为空!") - } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, - alertContent, - ttsContent) - ) - ) - CallerHmiManager.warningV2X( - EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), - null, - true, - 5000L - ) - } - } - // 黄灯 - 0x3 -> { -// CallerHmiManager.disableWarningV2X(appId.toString()) - CallerHmiManager.showWarningTrafficLight(2, 2) - val yellow = currentLight.count_down.toInt() - CallerHmiManager.changeCountdownYellow(yellow) - CallerHmiManager.changeCountdownGreen(0) - CallerHmiManager.changeCountdownRed(0) - } - } - } - - } - - - //todo 二期优化此处内容,注解参数 - /** - * 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示 - * - * @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 - * - */ - private fun handleSdkObu( - appId: Int, - direction: WarningDirectionEnum, - status: Int, - level: Int, - info: CvxV2vThreatIndInfo - ) { - // 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnum 提供的 - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status" - ) - var alertContent: String? = null - var ttsContent: String? = null - var changeVisualAngle = false - when (appId.toString()) { - // 变道预警,注意左后车辆/注意右后车辆 - EventTypeEnum.TYPE_USECASE_ID_LCW.poiType -> { - EventTypeHelper.getLCW(appId, direction) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //车辆失控预警 - EventTypeEnum.TYPE_USECASE_ID_CLW.poiType -> { - EventTypeHelper.getCLW(appId, direction) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //左转辅助 - EventTypeEnum.TYPE_USECASE_ID_LTA.poiType -> { - EventTypeHelper.getLTA(appId) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //异常车辆提醒 - EventTypeEnum.TYPE_USECASE_ID_AVW.poiType -> { - EventTypeHelper.getAVW(appId, direction) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //盲区预警 - EventTypeEnum.TYPE_USECASE_ID_BSW.poiType -> { - EventTypeHelper.getBSW(appId, direction) { alert, tts, visualAngle -> - alertContent = alert - ttsContent = tts - changeVisualAngle = visualAngle - } - } - //前车急刹预警 - EventTypeEnum.TYPE_USECASE_ID_EBW.poiType -> { - EventTypeHelper.getEBW(appId) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //前向碰撞预警 - EventTypeEnum.TYPE_USECASE_ID_FCW.poiType -> { - EventTypeHelper.getFCW(appId) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //逆向超车预警 - EventTypeEnum.TYPE_USECASE_ID_DNPW.poiType -> { - EventTypeHelper.getDNPW(appId) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - - // 这里处理固定的提示信息,包括了<紧急车辆提醒> - else -> { - ttsContent = EventTypeEnum.getWarningTts(appId.toString()) - alertContent = EventTypeEnum.getWarningContent(appId.toString()) - } - } - - when (status) { - // 添加,更新 add的时候,可能级别是2, - ObuConstants.STATUS.ADD, - ObuConstants.STATUS.UPDATE -> { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" - ) - if (level == 2 || level == 3) { - //不显示顶部弹框,其它保留 - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "old handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" - ) - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuManager3", "alertContent或ttsContent为空!") - } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(appId.toString(), - alertContent, - ttsContent) - ) - ) - CallerHmiManager.warningV2X( - appId.toString(), - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - (appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 - object : IMoGoWarningStatusListener { - - override fun onShow() { - super.onShow() - if (changeVisualAngle) { - CallerVisualAngleManager.changeVisualAngle(TooClose) - } - } - - override fun onDismiss() { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - if (changeVisualAngle) { - CallerVisualAngleManager.changeVisualAngle(Default()) - } - } - }, - true, - 5000L - ) - //显示警告红边 - CallerHmiManager.showWarning(direction) - } - //更新周边车辆进行预警颜色变换,车辆实时移动和变色 - TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.invokeTrackerWarningInfo(it) - CallerMapUIServiceManager.getMarkerService()?.updateITrafficThreatLevelInfo(it) - } - } - // 删除 - ObuConstants.STATUS.DELETE -> { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 移除顶部弹窗 -// CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) - //更新周边车辆进行预警颜色变换,车辆实时移动和变色 - TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.removeTrackerWarningInfo(it) - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService()?.updateITrafficThreatLevelInfo(it) - } - } - } - } - - -} \ No newline at end of file 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 93706d2adc..b6fcf64afc 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 @@ -88,6 +88,11 @@ class MogoPrivateObuNewManager private constructor() { return mogoObuListener } + fun disconnect() { + MogoObuManager.getInstance().disconnect() + } + + private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() { /** * 连接状态的改变 @@ -105,13 +110,6 @@ class MogoPrivateObuNewManager private constructor() { mObuStatusInfo.obuStatus = true CallerObuListenerManager.invokeListener(mObuStatusInfo) mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) } - - //断开老obu - try { - com.zhidao.support.obu.MogoObuManager.getInstance().disConnect() - } catch (e: Exception) { - e.printStackTrace() - } } } diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt deleted file mode 100644 index 8e94bc8bc6..0000000000 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt +++ /dev/null @@ -1,133 +0,0 @@ -package com.mogo.eagle.core.function.obu.mogo.utils - -import com.mogo.eagle.core.data.traffic.TrafficData -import com.mogo.eagle.core.data.enums.TrafficTypeEnum -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU -import com.zhidao.support.obu.constants.ObuConstants -import com.zhidao.support.obu.model.CvxPtcThreatIndInfo -import com.zhidao.support.obu.model.CvxRtiThreatIndInfo -import com.zhidao.support.obu.model.CvxRvInfoIndInfo -import com.zhidao.support.obu.model.CvxV2vThreatIndInfo - -/** - * @author xiaoyuzhou - * @date 2021/8/18 2:30 下午 - */ -object TrafficDataConvertUtils { - val TAG = "TrafficDataConvertUtils" - - /** - * OBU 远车 转换交通元素数据 - */ - fun cvxRvInfoIndInfo2TrafficData(info: CvxRvInfoIndInfo): TrafficData? { - if (info.basic_info == null || info.basic_info.position == null) { - CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全") - return null - } - val trafficData = TrafficData() - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE - trafficData.uuid = info.vehicle_id - trafficData.lat = info.basic_info.position.latitude - trafficData.lon = info.basic_info.position.longitude - trafficData.heading = info.basic_info.heading - trafficData.speed = info.basic_info.speed - - return trafficData - } - - /** - * OBU RSU道路事件预警信息 转换交通元素数据 - */ - fun cvxRtiThreatIndInfo2TrafficData(info: CvxRtiThreatIndInfo): TrafficData? { - // 这里只处理道路施工 - if(info.ext_info.rti_type != 0x7){ - return null - } - if (info.rti_id == null || info.ext_info == null - || info.zones_info == null || info.zones_info.first() == null - || info.zones_info.first().path_points.first() == null - || info.threat_info == null - ) { - CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") - return null - } - val trafficData = TrafficData() - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG - trafficData.uuid = info.rti_id - - trafficData.lat = info.zones_info.first().path_points.first().latitude - trafficData.lon = info.zones_info.first().path_points.first().longitude - - trafficData.threatLevel = info.threat_info.threat_level - - return trafficData - } - - /** - * OBU 预警事件 转换交通元素数据 - */ - fun cvxV2vThreatIndInfo2TrafficData(info: CvxV2vThreatIndInfo): TrafficData? { - if (info.basic_info == null || info.basic_info.position == null || info.threat_info == null) { - CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") - return null - } - val trafficData = TrafficData() - trafficData.uuid = info.vehicle_id - trafficData.lat = info.basic_info.position.latitude - trafficData.lon = info.basic_info.position.longitude - trafficData.heading = info.basic_info.heading - trafficData.speed = info.basic_info.speed - // 判断车辆V2X预警级别,调整车辆颜色 - trafficData.threatLevel = info.threat_info.threat_level - - if (info.threat_info.app_id == ObuConstants.USE_CASE_ID.EVW) { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE - } else { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE - } - - return trafficData - } - - /** - * OBU 弱势交通参与者信息 转换交通元素数据 TODO - */ - fun cvxPtcThreatIndInfo2TrafficData(info: CvxPtcThreatIndInfo): TrafficData? { - if (info.ptc_pos == null || info.threat_info == null) { - CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") - return null - } - val trafficData = TrafficData() - - trafficData.uuid = info.ptc_id - trafficData.lat = info.ptc_pos.latitude - trafficData.lon = info.ptc_pos.longitude -// trafficData.heading = info.ptc_pos.heading -// trafficData.speed = info.ptc_pos.speed - - when (info.ptc_type) { - // 未知 - 0x0 -> { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI - } - // 非机动车 - 0x1 -> { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO - } - // 行人 - 0x2 -> { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE - } - } - - // 判断车辆V2X预警级别,调整车辆颜色 - if (info.threat_info != null) { - trafficData.threatLevel = info.threat_info.threat_level - } - - return trafficData - } - - -} \ No newline at end of file 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 0c09db8c20..c4f2ca6de0 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 @@ -1,15 +1,17 @@ package com.mogo.eagle.core.function.v2x.events.alarm; +import android.util.Log; + +import com.mogo.eagle.core.data.enums.EventTypeEnumNew; import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.data.map.entity.MarkerLocation; import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity; -import com.mogo.eagle.core.data.enums.EventTypeEnum; import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils; import java.util.Iterator; import java.util.concurrent.CopyOnWriteArrayList; + import io.netty.util.internal.ConcurrentSet; -import android.util.Log; /** * @author donghongyu @@ -64,7 +66,7 @@ public class V2XAlarmServer { double distance = v2XRoadEventEntity.getDistance(); Log.d("RWJ", "distance:" + distance); if (distance <= 500) { - if (EventTypeEnum.GHOST_PROBE.getPoiType().equals(v2XRoadEventEntity.getPoiType())) { + if (EventTypeEnumNew.GHOST_PROBE.getPoiType().equals(v2XRoadEventEntity.getPoiType())) { if (distance > 25) { continue; } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XMarkerManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XMarkerManager.java index 13432dbf4f..ffa58677e6 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XMarkerManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/manager/impl/MoGoV2XMarkerManager.java @@ -10,6 +10,7 @@ import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.module.status.MogoStatusManager; +import com.mogo.eagle.core.data.enums.EventTypeEnumNew; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.data.map.entity.MarkerExploreWay; @@ -26,16 +27,15 @@ import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; import com.mogo.eagle.core.function.v2x.events.marker.V2XMarkerAdapter; import com.mogo.eagle.core.function.v2x.events.utils.EntityUtilsKt; import com.mogo.eagle.core.function.v2x.events.utils.MapUtils; +import com.mogo.eagle.core.function.v2x.internal.V2XManager; +import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult; +import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerExploreWay; +import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerLocation; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.marker.IMogoMarkerManager; import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.eagle.core.data.enums.EventTypeEnum; -import com.mogo.eagle.core.function.v2x.internal.V2XManager; -import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult; -import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerExploreWay; -import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerLocation; import java.util.List; import java.util.Objects; @@ -110,7 +110,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager { List exploreWayList = markerCardResult.getExploreWay(); if (exploreWayList != null) { for (V2XMarkerExploreWay markerExploreWay : exploreWayList) { - if (EventTypeEnum.isRoadEvent(markerExploreWay.getPoiType())) { + if (EventTypeEnumNew.isRoadEvent(markerExploreWay.getPoiType())) { V2XMarkerLocation markerLocation = markerExploreWay.getLocation(); // 记录道路事件 V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java index f612b4e6b5..eb6107c2db 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/marker/V2XMarkerAdapter.java @@ -3,9 +3,9 @@ package com.mogo.eagle.core.function.v2x.events.marker; import android.content.Context; import android.graphics.Bitmap; +import com.mogo.eagle.core.data.enums.EventTypeEnumNew; import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity; import com.mogo.eagle.core.function.v2x.R; -import com.mogo.eagle.core.data.enums.EventTypeEnum; import com.mogo.eagle.core.function.v2x.events.view.V2XMarkerRoadEventView; import java.util.ArrayList; @@ -31,10 +31,10 @@ public class V2XMarkerAdapter { */ public static Bitmap getV2XRoadEventViewPng(Context context, V2XRoadEventEntity alarmInfo) { Bitmap bitmap; - if (EventTypeEnum.ALERT_TRAFFIC_LIGHT_SUGGEST.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.ALERT_TRAFFIC_LIGHT_WARNING.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.FOURS_BLOCK_UP.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(alarmInfo.getPoiType())) { + if (EventTypeEnumNew.ALERT_TRAFFIC_LIGHT_SUGGEST.getPoiType().equals(alarmInfo.getPoiType()) + || EventTypeEnumNew.ALERT_TRAFFIC_LIGHT_WARNING.getPoiType().equals(alarmInfo.getPoiType()) + || EventTypeEnumNew.FOURS_BLOCK_UP.getPoiType().equals(alarmInfo.getPoiType()) + || EventTypeEnumNew.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(alarmInfo.getPoiType())) { bitmap = getV2XRoadEventMarkerView( context, alarmInfo, @@ -53,10 +53,10 @@ public class V2XMarkerAdapter { */ public static ArrayList getV2XRoadEventViewGif(Context context, V2XRoadEventEntity alarmInfo) { ArrayList bitmapArrayList; - if (EventTypeEnum.ALERT_TRAFFIC_LIGHT_SUGGEST.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.ALERT_TRAFFIC_LIGHT_WARNING.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.FOURS_BLOCK_UP.getPoiType().equals(alarmInfo.getPoiType()) - || EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(alarmInfo.getPoiType())) { + if (EventTypeEnumNew.ALERT_TRAFFIC_LIGHT_SUGGEST.getPoiType().equals(alarmInfo.getPoiType()) + || EventTypeEnumNew.ALERT_TRAFFIC_LIGHT_WARNING.getPoiType().equals(alarmInfo.getPoiType()) + || EventTypeEnumNew.FOURS_BLOCK_UP.getPoiType().equals(alarmInfo.getPoiType()) + || EventTypeEnumNew.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(alarmInfo.getPoiType())) { bitmapArrayList = getV2XRoadEventOrangeMarkerView(context, alarmInfo); } else { bitmapArrayList = getV2XRoadEventRedMarkerView(context, alarmInfo); diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XMarkerRoadEventView.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XMarkerRoadEventView.kt index 1b3e41053c..c9d1589194 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XMarkerRoadEventView.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/view/V2XMarkerRoadEventView.kt @@ -5,10 +5,10 @@ import android.content.Context import android.graphics.Bitmap import android.view.LayoutInflater import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity import com.mogo.eagle.core.function.v2x.R import com.mogo.eagle.core.utilcode.util.ViewUtils -import com.mogo.eagle.core.data.enums.EventTypeEnum import kotlinx.android.synthetic.main.view_marker_event_car.view.* /** @@ -33,8 +33,8 @@ class V2XMarkerRoadEventView(context: Context, alarmInfo: V2XRoadEventEntity) : } fun initView(context: Context, alarmInfo: V2XRoadEventEntity) { - if (alarmInfo.poiType == EventTypeEnum.ALERT_FRONT_CAR.poiType || - alarmInfo.poiType == EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.poiType + if (alarmInfo.poiType == EventTypeEnumNew.ALERT_FRONT_CAR.poiType || + alarmInfo.poiType == EventTypeEnumNew.ALERT_CAR_TROUBLE_WARNING.poiType ) { LayoutInflater.from(context) .inflate(R.layout.view_marker_event_car, this) @@ -46,11 +46,11 @@ class V2XMarkerRoadEventView(context: Context, alarmInfo: V2XRoadEventEntity) : } /** - * @see EventTypeEnum + * @see EventTypeEnumNew */ private fun updateIcon(alarmInfo: V2XRoadEventEntity) { // 道路施工、积水、路面结冰、浓雾、事故、拥堵 - val iconResId = EventTypeEnum.getUpdateIconRes(alarmInfo.poiType) + val iconResId = EventTypeEnumNew.getUpdateIconRes(alarmInfo.poiType) if (iconResId != 0) { ivCar.setImageResource(iconResId) } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/CloudPoiManager.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/CloudPoiManager.java index 7bb1b06c72..1359dd3e6b 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/CloudPoiManager.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/CloudPoiManager.java @@ -6,7 +6,6 @@ import android.util.ArrayMap; import com.elegant.network.utils.GsonUtil; import com.mogo.eagle.core.data.R; -import com.mogo.eagle.core.data.enums.EventTypeEnum; import com.mogo.eagle.core.data.enums.EventTypeEnumNew; import com.mogo.eagle.core.data.map.PoiWrapper; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; @@ -39,37 +38,37 @@ public class CloudPoiManager { public void generateDefault() { if (poiWrapper.isEmpty()) { - poiWrapper.put(EventTypeEnum.TRAFFIC_CHECK.getPoiType(), new PoiWrapper(EventTypeEnum.TRAFFIC_CHECK.getPoiType(), + poiWrapper.put(EventTypeEnumNew.TRAFFIC_CHECK.getPoiType(), new PoiWrapper(EventTypeEnumNew.TRAFFIC_CHECK.getPoiType(), R.drawable.module_common_icon_map_marker_road_check2, R.drawable.module_common_icon_map_marker_road_check2_white, "交通检查")); - poiWrapper.put(EventTypeEnum.ROAD_CLOSED.getPoiType(), new PoiWrapper(EventTypeEnum.ROAD_CLOSED.getPoiType(), + poiWrapper.put(EventTypeEnumNew.ROAD_CLOSED.getPoiType(), new PoiWrapper(EventTypeEnumNew.ROAD_CLOSED.getPoiType(), R.drawable.module_common_icon_map_marker_road_block_off2, R.drawable.module_common_icon_map_marker_road_block_off2_white, "封路")); - poiWrapper.put(EventTypeEnum.FOURS_ROAD_WORK.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ROAD_WORK.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_ROAD_WORK.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_ROAD_WORK.getPoiType(), R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工")); poiWrapper.put(EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType(), new PoiWrapper(EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType(), R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工")); - poiWrapper.put(EventTypeEnum.FOURS_BLOCK_UP.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_BLOCK_UP.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_BLOCK_UP.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_BLOCK_UP.getPoiType(), R.drawable.module_common_icon_map_marker_road_block_up2, R.drawable.module_common_icon_map_marker_road_block_up2_white, "拥堵")); - poiWrapper.put(EventTypeEnum.FOURS_PONDING.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_PONDING.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_PONDING.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_PONDING.getPoiType(), R.drawable.module_common_icon_map_marker_pondingl2, R.drawable.module_common_icon_map_marker_pondingl2_white, "积水")); - poiWrapper.put(EventTypeEnum.FOURS_FOG.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_FOG.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_FOG.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_FOG.getPoiType(), R.drawable.module_common_ic_rc_dark_frog2, R.drawable.module_common_ic_rc_dark_frog2_white, "浓雾")); - poiWrapper.put(EventTypeEnum.FOURS_ICE.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ICE.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_ICE.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_ICE.getPoiType(), R.drawable.module_common_ic_rc_freeze2, R.drawable.module_common_ic_rc_freeze2_white, "结冰")); - poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_ACCIDENT.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_ACCIDENT.getPoiType(), R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "事故")); - poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_01.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_01.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_ACCIDENT_01.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_ACCIDENT_01.getPoiType(), R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "重大事故")); - poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_02.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_02.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_ACCIDENT_02.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_ACCIDENT_02.getPoiType(), R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "特大事故")); - poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_03.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_03.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_ACCIDENT_03.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_ACCIDENT_03.getPoiType(), R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "较大事故")); - poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_04.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_04.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_ACCIDENT_04.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_ACCIDENT_04.getPoiType(), R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "一般事故")); - poiWrapper.put(EventTypeEnum.FOURS_ACCIDENT_05.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_ACCIDENT_05.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_ACCIDENT_05.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_ACCIDENT_05.getPoiType(), R.drawable.module_common_ic_rc_accident3, R.drawable.module_common_ic_rc_accident3_white, "轻微事故")); - poiWrapper.put(EventTypeEnum.FOURS_LIVING.getPoiType(), new PoiWrapper(EventTypeEnum.FOURS_LIVING.getPoiType(), + poiWrapper.put(EventTypeEnumNew.FOURS_LIVING.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_LIVING.getPoiType(), R.drawable.module_common_icon_map_marker_living, R.drawable.module_common_icon_map_marker_living_white, "实时路况")); - poiWrapper.put(EventTypeEnum.ILLEGAL_PARK_LIVING.getPoiType(), new PoiWrapper(EventTypeEnum.ILLEGAL_PARK_LIVING.getPoiType(), + poiWrapper.put(EventTypeEnumNew.ILLEGAL_PARK_LIVING.getPoiType(), new PoiWrapper(EventTypeEnumNew.ILLEGAL_PARK_LIVING.getPoiType(), R.drawable.module_common_ic_rc_illegal_park, R.drawable.module_common_ic_rc_illegal_park_white, "违章停车")); // 分享里用到的故障求助 poiWrapper.put("9999", new PoiWrapper("9999", 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 977ff69174..3579d55ea4 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 @@ -554,6 +554,22 @@ enum class EventTypeEnumNew( } } + @JvmStatic + fun getTtsWithFeedback(poiType: String?): String { + return when (poiType) { + TRAFFIC_CHECK.poiType -> "交通检查" + ROAD_CLOSED.poiType -> "封路" + FOURS_ROAD_WORK.poiType -> "施工" + FOURS_BLOCK_UP.poiType -> "道路拥堵" + FOURS_PONDING.poiType -> "道路积水" + FOURS_FOG.poiType -> "出现浓雾" + FOURS_ICE.poiType -> "路面结冰" + FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, + FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故" + else -> "道路事件" + } + } + @JvmStatic fun getPoiTypeSrcVr(poiType: String): Int { return when (poiType) { diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeHelper.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeHelper.kt index 8f8cd1ff35..b1da3cc519 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeHelper.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeHelper.kt @@ -29,20 +29,20 @@ class EventTypeHelper { when { direction.isLeft() -> { data.invoke( - EventTypeEnum.getWarningContent(appId.toString() + "左"), - EventTypeEnum.getWarningTts(appId.toString() + "左") + EventTypeEnumNew.getWarningContent(appId.toString() + "左"), + EventTypeEnumNew.getWarningTts(appId.toString() + "左") ) } direction.isRight() -> { data.invoke( - EventTypeEnum.getWarningContent(appId.toString() + "右"), - EventTypeEnum.getWarningTts(appId.toString() + "右") + EventTypeEnumNew.getWarningContent(appId.toString() + "右"), + EventTypeEnumNew.getWarningTts(appId.toString() + "右") ) } else -> { data.invoke( - EventTypeEnum.getWarningContent(appId.toString()), - EventTypeEnum.getWarningTts(appId.toString()) + EventTypeEnumNew.getWarningContent(appId.toString()), + EventTypeEnumNew.getWarningTts(appId.toString()) ) } } @@ -56,8 +56,8 @@ class EventTypeHelper { data: ((alert: String, tts: String) -> Unit) ) { data.invoke( - EventTypeEnum.getWarningContent(appId.toString() + direction.desc), - EventTypeEnum.getWarningContent(appId.toString() + direction.desc) + EventTypeEnumNew.getWarningContent(appId.toString() + direction.desc), + EventTypeEnumNew.getWarningContent(appId.toString() + direction.desc) ) } @@ -65,8 +65,8 @@ class EventTypeHelper { @BizConfig(V2V, "", BIZ_LTA) fun getLTA(appId: Int, data: ((alert: String, tts: String) -> Unit)) { data.invoke( - EventTypeEnum.getWarningContent(appId.toString()), - EventTypeEnum.getWarningTts(appId.toString()) + EventTypeEnumNew.getWarningContent(appId.toString()), + EventTypeEnumNew.getWarningTts(appId.toString()) ) } @@ -78,8 +78,8 @@ class EventTypeHelper { data: ((alert: String, tts: String) -> Unit) ) { data.invoke( - EventTypeEnum.getWarningContent(appId.toString() + direction.desc), - EventTypeEnum.getWarningTts(appId.toString() + direction.desc) + EventTypeEnumNew.getWarningContent(appId.toString() + direction.desc), + EventTypeEnumNew.getWarningTts(appId.toString() + direction.desc) ) } @@ -93,22 +93,22 @@ class EventTypeHelper { when { direction.isLeft() -> { data.invoke( - EventTypeEnum.getWarningContent(appId.toString() + "左"), - EventTypeEnum.getWarningTts(appId.toString() + "左"), + EventTypeEnumNew.getWarningContent(appId.toString() + "左"), + EventTypeEnumNew.getWarningTts(appId.toString() + "左"), true ) } direction.isRight() -> { data.invoke( - EventTypeEnum.getWarningContent(appId.toString() + "右"), - EventTypeEnum.getWarningTts(appId.toString() + "右"), + EventTypeEnumNew.getWarningContent(appId.toString() + "右"), + EventTypeEnumNew.getWarningTts(appId.toString() + "右"), true ) } else -> { data.invoke( - EventTypeEnum.getWarningContent(appId.toString()), - EventTypeEnum.getWarningTts(appId.toString()), + EventTypeEnumNew.getWarningContent(appId.toString()), + EventTypeEnumNew.getWarningTts(appId.toString()), false ) } @@ -119,9 +119,9 @@ class EventTypeHelper { @BizConfig(V2N, "", BIZ_VRU) fun getVRU(data: ((appId: Int, tts: String, content: String) -> Unit)) { data.invoke( - EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt(), - EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.tts, - EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.content + EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt(), + EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.tts, + EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.content ) } @@ -129,7 +129,7 @@ class EventTypeHelper { @BizConfig(V2N, "", BIZ_VRU_RI) fun getVRURI(data: ((appId: Int, tts: String, content: String) -> Unit)) { data.invoke( - EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt(), + EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt(), "行人逆行预警", "行人逆行预警" ) @@ -139,18 +139,18 @@ class EventTypeHelper { @BizConfig(V2N, "", BIZ_OPT_LINE) fun getOptLine(data: ((appId: Int, tts: String, content: String) -> Unit)) { data.invoke( - EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.poiType.toInt(), - EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.tts, - EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.content + EventTypeEnumNew.TYPE_USECASE_OPTIMAL_LANE.poiType.toInt(), + EventTypeEnumNew.TYPE_USECASE_OPTIMAL_LANE.tts, + EventTypeEnumNew.TYPE_USECASE_OPTIMAL_LANE.content ) } //前方道路拥堵预警 fun getTJW(data: ((appId: Int, tts: String, content: String) -> Unit)) { data.invoke( - EventTypeEnum.FOURS_BLOCK_UP.poiType.toInt(), - EventTypeEnum.FOURS_BLOCK_UP.tts, - EventTypeEnum.FOURS_BLOCK_UP.content + EventTypeEnumNew.FOURS_BLOCK_UP.poiType.toInt(), + EventTypeEnumNew.FOURS_BLOCK_UP.tts, + EventTypeEnumNew.FOURS_BLOCK_UP.content ) } @@ -158,8 +158,8 @@ class EventTypeHelper { @BizConfig(V2V, "", BIZ_EBW) fun getEBW(appId: Int, data: ((tts: String, content: String) -> Unit)) { data.invoke( - EventTypeEnum.getWarningContent(appId.toString()), - EventTypeEnum.getWarningTts(appId.toString()) + EventTypeEnumNew.getWarningContent(appId.toString()), + EventTypeEnumNew.getWarningTts(appId.toString()) ) } @@ -167,8 +167,8 @@ class EventTypeHelper { @BizConfig(V2V, "", BIZ_FCW) fun getFCW(appId: Int, data: ((tts: String, content: String) -> Unit)) { data.invoke( - EventTypeEnum.getWarningContent(appId.toString()), - EventTypeEnum.getWarningTts(appId.toString()) + EventTypeEnumNew.getWarningContent(appId.toString()), + EventTypeEnumNew.getWarningTts(appId.toString()) ) } @@ -176,8 +176,8 @@ class EventTypeHelper { @BizConfig(V2V, "", BIZ_DNPW) fun getDNPW(appId: Int, data: ((tts: String, content: String) -> Unit)) { data.invoke( - EventTypeEnum.getWarningContent(appId.toString()), - EventTypeEnum.getWarningTts(appId.toString()) + EventTypeEnumNew.getWarningContent(appId.toString()), + EventTypeEnumNew.getWarningTts(appId.toString()) ) } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java index 0bd2dab8fd..2c2b3a4e5a 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java @@ -1,9 +1,6 @@ package com.mogo.eagle.core.data.map.entity; import android.text.TextUtils; - - -import com.mogo.eagle.core.data.enums.EventTypeEnum; import com.mogo.eagle.core.data.enums.EventTypeEnumNew; import java.io.Serializable; @@ -59,12 +56,12 @@ public class V2XRoadEventEntity implements Serializable { } public String getTts(boolean haveLiveCar) { - if (EventTypeEnum.GHOST_PROBE.getPoiType().equals(poiType)) { - tts = EventTypeEnum.GHOST_PROBE.getTts(); + if (EventTypeEnumNew.GHOST_PROBE.getPoiType().equals(poiType)) { + tts = EventTypeEnumNew.GHOST_PROBE.getTts(); return tts; } tts = "前方#" + (int) getDistance() + "米#"; - tts += EventTypeEnum.getTts(getPoiType()); + tts += EventTypeEnumNew.getTts(getPoiType()); if (haveLiveCar) { tts += ",查看实况请说确定。"; setShowEventButton(true); @@ -80,7 +77,7 @@ public class V2XRoadEventEntity implements Serializable { */ public String getTtsWithFeedback() { tts = "检测到附近"; - tts += EventTypeEnum.getTtsWithFeedback(getPoiType()); + tts += EventTypeEnumNew.getTtsWithFeedback(getPoiType()); tts += ",确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。"; return tts; } @@ -102,7 +99,7 @@ public class V2XRoadEventEntity implements Serializable { } public String getAlarmContent() { - alarmContent = EventTypeEnum.getAlarmContent(getPoiType()); + alarmContent = EventTypeEnumNew.getAlarmContent(getPoiType()); return alarmContent; }