From 3f3c7406e6c03d261b02bc13e3ce350e20dd1d8c Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Fri, 25 Nov 2022 12:20:16 +0800 Subject: [PATCH 01/23] =?UTF-8?q?[2.13.0=5Ffeat]=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=9B=92=E5=AD=90=E6=95=B0=E6=8D=AE=E4=B8=AD=E5=BF=83=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=90=84=E7=B1=BB=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/report/IPCReportManager.kt | 11 +- .../mogo-core-function-hmi/build.gradle | 2 + .../receiver/NoticeNormalBroadcastReceiver.kt | 4 +- .../receiver/V2XWarningBroadcastReceiver.kt | 9 +- .../core/function/hmi/ui/MoGoHmiFragment.kt | 71 ++++++ .../function/main/MainMoGoApplication.java | 24 ++ .../eagle/core/function/msgbox/DataManager.kt | 210 +++++++++++++++++- .../core/function/msgbox/MsgBoxProvider.kt | 30 ++- .../core/function/msgbox/db/MsgBoxDao.kt | 11 +- .../core/function/msgbox/db/MsgBoxInfo.kt | 13 +- .../function/notice/NoticeSocketManager.java | 3 + .../obu/mogo/MogoPrivateObuManager.kt | 47 ++-- .../obu/mogo/MogoPrivateObuNewManager.kt | 40 ++-- .../function/v2x/events/V2XEventManager.kt | 9 +- .../scene/road/V2XRoadEventScenario.java | 10 +- .../route/V2XOptimalRouteVREventScenario.java | 9 +- .../warning/V2XFrontWarningScenario.java | 9 +- .../redlightwarning/RedLightWarningManager.kt | 14 +- .../core/function/v2x/vip/VipCarManager.kt | 9 +- .../mogo/eagle/core/data/msgbox/MsgBoxBean.kt | 5 +- .../eagle/core/data/msgbox/RecordBagMsg.kt | 3 + .../com/mogo/eagle/core/data/msgbox/V2XMsg.kt | 3 + .../api/hmi/warning/IMoGoWaringProvider.kt | 5 + .../function/api/msgbox/IMsgBoxProvider.kt | 19 +- .../function/call/hmi/CallerHmiManager.kt | 31 +++ .../call/msgbox/CallerMsgBoxManager.kt | 32 ++- 26 files changed, 545 insertions(+), 88 deletions(-) create mode 100644 core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/RecordBagMsg.kt create mode 100644 core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/V2XMsg.kt diff --git a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt index 899ee755a8..e691962e86 100644 --- a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt +++ b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/report/IPCReportManager.kt @@ -1,10 +1,13 @@ package com.mogo.eagle.core.function.report import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.report.ReportEntity import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener 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.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.util.TimeUtils import mogo_msg.MogoReportMsg @@ -48,7 +51,6 @@ class IPCReportManager : IMoGoAutopilotStatusListener { */ override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) { guardianInfo?.let{ - //Error 弹窗并有提示音 if(it.resultList.contains(RESULT_AUTOPILOT_DISABLE) || it.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED) @@ -56,9 +58,10 @@ class IPCReportManager : IMoGoAutopilotStatusListener { if(ipcErrorReportList.size>19){ ipcErrorReportList.removeLast() } - ipcErrorReportList.add(0, - ReportEntity(TimeUtils.millis2String(System.currentTimeMillis()), - it.src,it.level,it.msg,it.code,it.resultList,it.actionsList)) + val reportEntity = ReportEntity(TimeUtils.millis2String(System.currentTimeMillis()), + it.src,it.level,it.msg,it.code,it.resultList,it.actionsList) + CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.REPORT, reportEntity)) + ipcErrorReportList.add(0, reportEntity) //当前不处于美化模式时,展示监控节点上报 if(!FunctionBuildConfig.isDemoMode){ if(FunctionBuildConfig.isReportWarning){ diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle index a20e15fcd9..6aedc92099 100644 --- a/core/function-impl/mogo-core-function-hmi/build.gradle +++ b/core/function-impl/mogo-core-function-hmi/build.gradle @@ -104,6 +104,7 @@ dependencies { api rootProject.ext.dependencies.mogo_core_function_carcorder api rootProject.ext.dependencies.mogo_core_function_call api rootProject.ext.dependencies.mogo_core_function_api + api rootProject.ext.dependencies.mogo_core_function_msgbox implementation project(':libraries:map-usbcamera') implementation project(':libraries:mogo-adas-other') @@ -134,6 +135,7 @@ dependencies { api project(':core:function-impl:mogo-core-function-dispatch') api project(':core:function-impl:mogo-core-function-chat') api project(':core:function-impl:mogo-core-function-bindingcar') + api project(':core:function-impl:mogo-core-function-msgbox') api project(':core:mogo-core-function-call') api project(':core:mogo-core-function-api') diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt index 9a52b93f15..bec65df4af 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/NoticeNormalBroadcastReceiver.kt @@ -3,8 +3,11 @@ package com.mogo.eagle.core.function.hmi.receiver import android.content.BroadcastReceiver import android.content.Context import android.content.Intent +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType 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.utilcode.util.SharedPrefs /** @@ -47,7 +50,6 @@ class NoticeNormalBroadcastReceiver : BroadcastReceiver() { data.content = contentTv data.videoUrl = videoUrl data.fileType = fileType - CallerHmiManager.showNoticeNormalData(data) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt index 7486583818..654cd73d26 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 @@ -8,6 +8,10 @@ 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 +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager /** * V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式弹出预警提示框 @@ -53,7 +57,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() { * 分发处理关闭场景 */ private fun dispatchCloseWaring(tag: String?) { - CallerHmiManager.disableWarningV2X(tag) +// CallerHmiManager.disableWarningV2X(tag) } /** @@ -73,6 +77,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() { if (EventTypeEnum.TYPE_USECASE_ID_IVP.poiType == v2xType.toString()) { CallerHmiManager.showLimitingVelocity(1) } - CallerHmiManager.showWarningV2X(v2xType.toString(), alertContent, ttsContent, tag, null, true, 5000L) + CallerHmiManager.warningV2X(v2xType.toString(), alertContent, ttsContent, + tag, null, true, 5000L, MsgBoxType.V2X) } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 754de2d65e..6c440aaf32 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 @@ -40,6 +40,9 @@ import com.mogo.eagle.core.data.enums.SidePattern import com.mogo.eagle.core.data.enums.SidePattern.* 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 @@ -63,6 +66,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager 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.monitor.CallerMonitorManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.WaringConst @@ -318,6 +322,8 @@ class MoGoHmiFragment : MvpFragment(), override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) { CallerLogger.d("$M_HMI$TAG", "recordKey=${recordPanel.key},stat=${recordPanel.stat}") + CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.RECORD, RecordBagMsg(recordPanel.key, recordPanel.stat, recordPanel.id, + recordPanel.type, recordPanel.filename, recordPanel.note))) if (BadCaseConfig.recordKeyList.contains(recordPanel.key)) { if (recordPanel.stat == 100 || recordPanel.stat == 101) { //成功结束录制 @@ -898,6 +904,71 @@ class MoGoHmiFragment : MvpFragment(), } } + /** + * 不展示顶部弹窗,其它保留 + */ + @Synchronized + override fun warningV2X( + v2xType: String, + alertContent: CharSequence?, + ttsContent: String?, + tag: String?, + listener: IMoGoWarningStatusListener?, + playTts: Boolean, + expireTime: Long + ) { + val playTTS = + playTts && !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) + activity?.let { + val warningContent = alertContent + ?: EventTypeEnum.getWarningContent(v2xType) + + //占道施工预警 + if (v2xType.equals("10006") || v2xType.equals("100061")) { + val currentTime = System.currentTimeMillis() / 1000 + val oldTime = + context?.let { it -> SharedPrefsMgr.getInstance(it).getLong("roadwork", 0) } + if (currentTime - oldTime!! > 60) { //超过一分钟,才会继续播报重复提醒 + context?.let { it -> + SharedPrefsMgr.getInstance(it) + .putLong("roadwork", System.currentTimeMillis() / 1000) + } + CallerAutoPilotManager.sendTripInfo(5, "", "", "", false); + } + } + + if (warningContent.isEmpty()) { + CallerLogger.e("$M_HMI$TAG", "Show warningContent is null or empty!") + return + } + listener?.onShow() + CallerLogger.d( + "$M_HMI$TAG", + "--- show v2x dialog 1 ---: info -> v2x-type: $v2xType : expireTime: $expireTime" + ) + + lastShowV2XJob?.safeCancel() + lastSpeakJob?.safeCancel() + + lifecycleScope.launch { + delay(expireTime) + }.also { itx -> + lastShowV2XJob = itx + }.invokeOnCompletion { _ -> + listener?.onDismiss() + showWarning(WarningDirectionEnum.ALERT_WARNING_NON) + } + + if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) { + lifecycleScope.launch { + speak(it, ttsContent) + }.also { itx -> + lastSpeakJob = itx + } + } + } + } + private suspend fun speak(ctx: Context, text: String) = suspendCancellableCoroutine { try { val voiceCallback = object : IMogoVoiceCmdCallBack { 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 3fc2839ae2..89a40ae47a 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 @@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.main; import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI; +import android.annotation.SuppressLint; import android.content.Context; import android.os.Process; @@ -19,12 +20,14 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths; import com.mogo.eagle.core.function.api.chat.biz.ChatConsts; import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager; import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager; +import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb; import com.mogo.eagle.core.function.overview.OverviewDb; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils; 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.mogo.map.MapApiPath; import com.zhidao.support.obu.ami.AmiClientManager; import com.zhjt.mogo_core_function_devatools.monitor.db.CpuInfo; @@ -32,6 +35,8 @@ import com.zhjt.mogo_core_function_devatools.monitor.db.MemInfo; import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb; import java.lang.reflect.Field; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; /** @@ -62,6 +67,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { } //查询是否有版本的更新 queryAppUpgrade(); + clearMessageBoxTable(); checkMonitorDb(); } @@ -80,6 +86,24 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { },9000); } + @SuppressLint("SimpleDateFormat") + private void clearMessageBoxTable() { + new Thread(() -> { + String lastLaunchTimeStr = SPUtils.getInstance().getString("last_launch", ""); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + if (lastLaunchTimeStr != null && !lastLaunchTimeStr.isEmpty()) { + Date currDate = new Date(System.currentTimeMillis()); + String currTimeStr = format.format(currDate); + boolean isSameDay = currTimeStr.equals(lastLaunchTimeStr); + // 超过一天需要清除消息盒子中的数据,并把时间戳存入SP + if (!isSameDay) { + this.deleteDatabase(MsgBoxDb.INTERNAL_DB_NAME); + SPUtils.getInstance().put("last_launch", currTimeStr); + } + } + }).start(); + } + private void checkMonitorDb() { new Thread(() -> { long limitId = 50001; diff --git a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt index 385613203b..5822ad2128 100644 --- a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt +++ b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt @@ -1,55 +1,91 @@ package com.mogo.eagle.core.function.msgbox +import android.content.Context import android.os.Looper -import com.mogo.eagle.core.data.msgbox.MsgBoxBean -import com.mogo.eagle.core.data.msgbox.MsgBoxType -import com.mogo.eagle.core.data.msgbox.MsgCategory +import com.mogo.eagle.core.data.msgbox.* +import com.mogo.eagle.core.data.notice.NoticeNormalData +import com.mogo.eagle.core.data.report.ReportEntity import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager +import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb +import com.mogo.eagle.core.function.msgbox.db.MsgBoxInfo import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope +import com.mogo.eagle.core.utilcode.util.GsonUtils import com.mogo.eagle.core.utilcode.util.Utils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext object DataManager { // private val msgBoxMap: EnumMap> = EnumMap(MsgBoxType::class.java) + // 消失时间5000ms + const val DISMISS_TIME = 5000L + private val notifyList by lazy { mutableListOf() } + /** + * 当天缓存的通知消息 + */ + private val cacheNotifyList by lazy { + mutableListOf() + } + private val sysInfoList by lazy { mutableListOf() } + /** + * 当天缓存的系统消息 + */ + private val cacheSysInfoList by lazy { + mutableListOf() + } + private val recordBagList by lazy { mutableListOf() } - @Volatile - private var isUpdate = false + /** + * 当天缓存的录包消息 + */ + private val cacheRecordList by lazy { + mutableListOf() + } private val scope by lazy { Utils.getApp().lifeCycleScope } + /** + * 用户取消给录制的Bag包打标签 + */ + private val removedRecordMap by lazy { + HashMap() + } + /** * 存储时保证按时序排列 */ fun saveMsg(bean: MsgBoxBean) { if (Thread.currentThread() == Looper.getMainLooper().thread) { - scope.launch(Dispatchers.Default) { - realSaveMsg(bean) + scope.launch { + withContext(Dispatchers.Default) { + realSaveMsg(bean) + } } } else { realSaveMsg(bean) } } - fun realSaveMsg(bean: MsgBoxBean) { + private fun realSaveMsg(bean: MsgBoxBean) { val type = bean.type bean.timestamp = System.currentTimeMillis() - when(type) { + bean.bean2Json = GsonUtils.toJson(bean) + when (type) { MsgBoxType.V2X, MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION -> { synchronized(this) { notifyList.add(bean) @@ -76,20 +112,170 @@ object DataManager { * 通知消息:V2X、云公告、运营信息 */ fun getNotifyData(): List { - return notifyList + return cacheNotifyList } /** * 工控机Report信息 */ fun getSysInfoData(): List { - return sysInfoList + return cacheSysInfoList } /** * 录包信息 */ fun getRecordBagData(): List { - return recordBagList + return cacheRecordList + } + + fun removeRecordInfo(key: String, value: Any) { + if (Thread.currentThread() == Looper.getMainLooper().thread) { + scope.launch { + withContext(Dispatchers.Default) { + removedRecordMap[key] = value + } + } + } else { + removedRecordMap[key] = value + } + } + + /** + * 从本地数据库中查询数据 + */ + fun queryAllMessages(context: Context) { + scope.launch { + getCacheMessages(context) + } + } + + private suspend fun getCacheMessages(context: Context): List = withContext(Dispatchers.IO) { + return@withContext MsgBoxDb.getDb(context) + .monitorDao() + .getAllCachedMessages() + .map { msgInfo -> + val json = msgInfo.bean2Json + when (msgInfo.obj2JsonType) { + MsgBoxType.V2X.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.V2X, + GsonUtils.fromJson(json, V2XMsg::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheNotifyList.add(this@apply) + } + } + } + MsgBoxType.OBU.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.OBU, + GsonUtils.fromJson(json, V2XMsg::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheNotifyList.add(this@apply) + } + } + } + MsgBoxType.OPERATION.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.OPERATION, + GsonUtils.fromJson(json, OperationMsg::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheNotifyList.add(this@apply) + } + } + } + MsgBoxType.REPORT.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.REPORT, + GsonUtils.fromJson(json, ReportEntity::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheSysInfoList.add(this@apply) + } + } + } + MsgBoxType.RECORD.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.RECORD, + GsonUtils.fromJson(json, RecordBagMsg::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheRecordList.add(this@apply) + } + } + } + MsgBoxType.NOTICE.ordinal -> { + return@map MsgBoxBean( + MsgBoxType.NOTICE, + GsonUtils.fromJson(json, NoticeNormalData::class.java) + ).apply { + withContext(Dispatchers.Main) { + cacheNotifyList.add(this@apply) + } + } + } + else -> { + return@map MsgBoxBean(MsgBoxType.V2X, V2XMsg()) + } + } + } + } + + /** + * 存储到本地数据库 + */ + fun saveAllMessages2Disk(context: Context) { + synchronized(this) { + val msgInfoList = ArrayList() + if (notifyList.isNotEmpty()) { + notifyList.forEach { + msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp)) + } + notifyList.clear() + } + + if (sysInfoList.isNotEmpty()) { + sysInfoList.forEach { + msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp)) + } + sysInfoList.clear() + } + + if (recordBagList.isNotEmpty()) { + recordBagList.forEach { + var recordKey = "" + if (it.bean is RecordBagMsg) { + recordKey = (it.bean as RecordBagMsg).key.toString() + } + // 用户未处理的Bag包才存本地 + if (!removedRecordMap.contains(recordKey)) { + msgInfoList.add(MsgBoxInfo(it.bean2Json, it.type.ordinal, it.timestamp)) + } else {// 用户已处理的Bag包 + removedRecordMap.remove(recordKey) + } + } + recordBagList.clear() + } + + if (msgInfoList.isNotEmpty()) { + MsgBoxDb.getDb(context) + .monitorDao() + .insertMessages(*msgInfoList.toTypedArray()) + } + } + } + + fun delMsgBoxBean(context: Context, msgBoxBean: MsgBoxBean) { + scope.launch { + withContext(Dispatchers.Default) { + val msgBoxInfo = MsgBoxInfo(msgBoxBean.bean2Json, msgBoxBean.type.ordinal, msgBoxBean.timestamp) + MsgBoxDb.getDb(context) + .monitorDao() + .deleteMsg(msgBoxInfo) + } + } } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/MsgBoxProvider.kt b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/MsgBoxProvider.kt index b58206e909..b7a05e8ac8 100644 --- a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/MsgBoxProvider.kt +++ b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/MsgBoxProvider.kt @@ -5,6 +5,7 @@ import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_MSG_BOX_MODULE import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.function.api.msgbox.IMsgBoxProvider +import com.mogo.eagle.core.function.msgbox.DataManager.saveAllMessages2Disk @Route(path = PATH_MSG_BOX_MODULE) class MsgBoxProvider : IMsgBoxProvider { @@ -13,25 +14,46 @@ class MsgBoxProvider : IMsgBoxProvider { get() = "MsgBoxProvider" override fun init(context: Context) { - context + Thread { + while (true) { + try { + saveAllMessages2Disk(context) + Thread.sleep(3000) + } catch (e: Exception) { + e.printStackTrace() + } + } + }.start() } override fun saveMsg(bean: MsgBoxBean) { DataManager.saveMsg(bean) } - override fun getNotifyData(): List { + override fun getCachedNotifyData(): List { return DataManager.getNotifyData() } - override fun getSysInfoData(): List { + override fun getCachedSysInfoData(): List { return DataManager.getSysInfoData() } - override fun getRecordBagData(): List { + override fun getCachedRecordBagData(): List { return DataManager.getRecordBagData() } + override fun removeRecordInfo(key: String, value: Any) { + return DataManager.removeRecordInfo(key, value) + } + + override fun deleteBoxBean(context: Context, msgBoxBean: MsgBoxBean) { + DataManager.delMsgBoxBean(context, msgBoxBean) + } + + override fun getDismissTime(): Long { + return DataManager.DISMISS_TIME + } + override fun onDestroy() { } diff --git a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxDao.kt b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxDao.kt index 1ffddc4182..af3b02de24 100644 --- a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxDao.kt +++ b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxDao.kt @@ -5,5 +5,14 @@ import androidx.room.* @Dao interface MsgBoxDao { @Insert(onConflict = OnConflictStrategy.REPLACE) - fun saveMsg(info: MsgBoxInfo) + fun insertMessage(info: MsgBoxInfo) + + @Insert(onConflict = OnConflictStrategy.REPLACE) + fun insertMessages(vararg info: MsgBoxInfo) + + @Delete + suspend fun deleteMsg(info: MsgBoxInfo) + + @Query("SELECT * FROM t_msg_box") + fun getAllCachedMessages(): List } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxInfo.kt b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxInfo.kt index 14dd1b667a..c6d5627caa 100644 --- a/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxInfo.kt +++ b/core/function-impl/mogo-core-function-msgbox/src/main/java/com/mogo/eagle/core/function/msgbox/db/MsgBoxInfo.kt @@ -6,10 +6,13 @@ import androidx.room.PrimaryKey @Entity(tableName = "t_msg_box") data class MsgBoxInfo( - @PrimaryKey(autoGenerate = true) - @ColumnInfo(name = "id") - val uuid: Long = 0, + @PrimaryKey + @ColumnInfo(name = "obj_json") + val bean2Json: String, - @ColumnInfo(name = "obj_str") - val objString: String + @ColumnInfo(name = "json_obj_type") + val obj2JsonType: Int = 0, + + @ColumnInfo(name = "time_stamp") + val timeStamp: Long = 0 ) \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java index 9719604d9d..bc750ef0f0 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java @@ -5,9 +5,12 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_NOT import android.content.Context; import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager; +import com.mogo.eagle.core.data.msgbox.MsgBoxBean; +import com.mogo.eagle.core.data.msgbox.MsgBoxType; import com.mogo.eagle.core.data.notice.NoticeNormalData; import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.network.utils.GsonUtil; import com.mogo.aicloud.services.socket.IMogoOnMessageListener; diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt index ac32af7da4..00d0964f8d 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt @@ -4,6 +4,7 @@ import android.content.Context import android.util.Log import com.alibaba.android.arouter.launcher.ARouter import com.mogo.cloud.passport.MoGoAiCloudClientConfig +import com.mogo.commons.voice.AIAssist import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.constants.MogoServicePaths @@ -22,6 +23,10 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.eagle.core.data.enums.EventTypeEnum import com.mogo.eagle.core.data.enums.EventTypeHelper +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.call.msgbox.CallerMsgBoxManager import com.mogo.service.IMogoServiceApis import com.zhidao.support.obu.MogoObuManager import com.zhidao.support.obu.OnMogoObuListener @@ -374,7 +379,7 @@ class MogoPrivateObuManager private constructor() { // CallerHmiManager.showWarning(direction) //显示弹框,语音提示 - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -386,7 +391,8 @@ class MogoPrivateObuManager private constructor() { } }, true, - 5000L + 5000L, + MsgBoxType.OBU ) // 更新数据 TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { @@ -400,7 +406,7 @@ class MogoPrivateObuManager private constructor() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) // 移除顶部弹窗 - CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) +// CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) // 更新数据 TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { CallerObuListenerManager.removeTrackerWarningInfo(it) @@ -493,7 +499,7 @@ class MogoPrivateObuManager private constructor() { // if (level == 2 || level == 3) { //不考虑level //显示警告红边 CallerHmiManager.showWarning(direction) - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( v2xType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -505,7 +511,8 @@ class MogoPrivateObuManager private constructor() { } }, true, - 5000L + 5000L, + MsgBoxType.OBU ) // } // 更新数据 @@ -527,7 +534,7 @@ class MogoPrivateObuManager private constructor() { CallerMapUIServiceManager.getMarkerService() ?.updateITrafficThreatLevelInfo(it) } - CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString()) +// CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString()) } } @@ -664,7 +671,7 @@ class MogoPrivateObuManager private constructor() { ObuConstants.STATUS.DELETE -> { // 移除顶部弹窗 CallerHmiManager.disableWarningTrafficLight() - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) } } } @@ -695,14 +702,15 @@ class MogoPrivateObuManager private constructor() { 0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE } 0x1 -> {//无违规 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) } 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT ttsContent = EventTypeEnum.getWarningTts(appId.toString()) alertContent = EventTypeEnum.getWarningContent(appId.toString()) - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 5000L + appId.toString(), null, true, 5000L, + MsgBoxType.OBU ) } 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT @@ -717,7 +725,7 @@ class MogoPrivateObuManager private constructor() { // 红灯 0x1 -> { if (!isRedLight) { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) isRedLight = true } isGreenLight = false @@ -732,7 +740,7 @@ class MogoPrivateObuManager private constructor() { // 绿灯 0x2 -> { if (!isGreenLight) { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) isGreenLight = true } isRedLight = false @@ -767,20 +775,21 @@ class MogoPrivateObuManager private constructor() { val maxSpeed = currentLight.glosa_suggested_speed_max.toInt() if (maxSpeed > 0) { - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 appId.toString(), null, true, - 5000L + 5000L, + MsgBoxType.OBU ) } } // 黄灯 0x3 -> { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) CallerHmiManager.showWarningTrafficLight(2, 2) val yellow = currentLight.count_down.toInt() CallerHmiManager.changeCountdownYellow(yellow) @@ -890,8 +899,9 @@ class MogoPrivateObuManager private constructor() { "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" ) if (level == 2 || level == 3) { + // TODO:(只是不显示顶部弹窗,其它逻辑保留) //显示弹框,语音提示 - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -914,7 +924,8 @@ class MogoPrivateObuManager private constructor() { } }, true, - 5000L + 5000L, + MsgBoxType.OBU ) //显示警告红边 CallerHmiManager.showWarning(direction) @@ -930,7 +941,7 @@ class MogoPrivateObuManager private constructor() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) // 移除顶部弹窗 - CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) +// CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) //更新周边车辆进行预警颜色变换,车辆实时移动和变色 TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let { CallerObuListenerManager.removeTrackerWarningInfo(it) 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 e56526a8d4..4c737d8af9 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 @@ -19,6 +19,10 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.enums.V2iEventTypeEnum +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.call.msgbox.CallerMsgBoxManager import com.mogo.support.obu.MogoObuManager import com.mogo.support.obu.OnMogoObuListener import com.mogo.support.obu.constants.MogoObuComType @@ -389,7 +393,7 @@ class MogoPrivateObuNewManager private constructor() { //显示警告红边 // CallerHmiManager.showWarning(direction) //显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -401,7 +405,8 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L + 3000L, + MsgBoxType.OBU ) // 更新数据 TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let { @@ -466,7 +471,7 @@ class MogoPrivateObuNewManager private constructor() { // if (level == 2 || level == 3) { //不考虑level //显示警告红边 CallerHmiManager.showWarning(direction) - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( v2xType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -478,7 +483,8 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L + 3000L, + MsgBoxType.OBU ) // } // 更新数据 @@ -663,7 +669,7 @@ class MogoPrivateObuNewManager private constructor() { ) if (level == 2 || level == 3) { //显示弹框,语音提示 - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 @@ -685,7 +691,8 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L + 3000L, + MsgBoxType.OBU ) //显示警告红边 CallerHmiManager.showWarning(direction) @@ -700,7 +707,7 @@ class MogoPrivateObuNewManager private constructor() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) // 移除顶部弹窗 - CallerHmiManager.disableWarningV2X((appId + direction.direction)) +// CallerHmiManager.disableWarningV2X((appId + direction.direction)) //更新周边车辆进行预警颜色变换,车辆实时移动和变色 TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { it.threatLevel = 0x01 @@ -734,7 +741,7 @@ class MogoPrivateObuNewManager private constructor() { MogoObuConstants.STATUS.DELETE -> { // 移除顶部弹窗 CallerHmiManager.disableWarningTrafficLight() - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) } } } @@ -767,14 +774,14 @@ class MogoPrivateObuNewManager private constructor() { 0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE } 0x1 -> {//无违规 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) } 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 3000L + appId.toString(), null, true, 3000L, MsgBoxType.OBU ) } 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT @@ -789,7 +796,7 @@ class MogoPrivateObuNewManager private constructor() { // 红灯 0x1 -> { if (!isRedLight) { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) isRedLight = true } isGreenLight = false @@ -803,7 +810,7 @@ class MogoPrivateObuNewManager private constructor() { // 绿灯 0x2 -> { if (!isGreenLight) { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) isGreenLight = true } isRedLight = false @@ -835,20 +842,21 @@ class MogoPrivateObuNewManager private constructor() { val maxSpeed = currentLight.suggestMaxSpeed if (maxSpeed > 0) { - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 appId.toString(), null, true, - 3000L + 3000L, + MsgBoxType.OBU ) } } // 黄灯 0x3 -> { - CallerHmiManager.disableWarningV2X(appId.toString()) +// CallerHmiManager.disableWarningV2X(appId.toString()) CallerHmiManager.showWarningTrafficLight(2, 2) val yellow = currentLight.countDown.toInt() CallerHmiManager.changeCountdownYellow(yellow) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index cbc9709814..dc3f3c1fe1 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -25,6 +25,9 @@ import com.mogo.eagle.core.data.map.entity.MarkerExploreWay import com.mogo.eagle.core.data.map.entity.MarkerShowEntity import com.mogo.eagle.core.data.map.entity.V2XMessageEntity import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity +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.data.traffic.* import com.mogo.eagle.core.function.api.hmi.warning.* import com.mogo.eagle.core.function.api.map.listener.* @@ -32,6 +35,7 @@ import com.mogo.eagle.core.function.call.hmi.* import com.mogo.eagle.core.function.call.map.* 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.v2x.events.alarm.* import com.mogo.eagle.core.function.v2x.events.bridge.* import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context @@ -572,7 +576,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } } // 显示弹框,语音提示 - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( tempAppId.toString(), tempContent, tempTts, @@ -592,7 +596,8 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } }, true, - 5000L + 5000L, + MsgBoxType.V2X ) CallerMapUIServiceManager.getMarkerService()?.updateITrafficInfo(trafficData) } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java index 8ccb7815ce..9f11092a54 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java @@ -7,9 +7,13 @@ import com.mogo.eagle.core.data.enums.WarningDirectionEnum; import com.mogo.eagle.core.data.map.entity.MarkerExploreWay; import com.mogo.eagle.core.data.map.entity.V2XMessageEntity; import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity; +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.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager; +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; @@ -93,8 +97,10 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp V2XMessageEntity entity = getV2XMessageEntity(); V2XRoadEventEntity content = entity != null ? entity.getContent() : null; if (content != null) { - //显示警告红边 - CallerHmiManager.INSTANCE.showWarningV2X(content.getPoiType(), content.getAlarmContent(), content.getTts(), TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(5)); +// //显示警告红边 + CallerHmiManager.INSTANCE.warningV2X(content.getPoiType(), content.getAlarmContent(), + content.getTts(), TAG, this, !entity.isOnlyShow(), + TimeUnit.SECONDS.toMillis(5), MsgBoxType.V2X); } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java index bc12e44e79..a091955b76 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java @@ -5,8 +5,12 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X import androidx.annotation.Nullable; import com.mogo.eagle.core.data.map.entity.V2XMessageEntity; +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.hmi.CallerHmiManager; +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi; import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes; @@ -53,7 +57,10 @@ public class V2XOptimalRouteVREventScenario if (entity != null) { V2XOptimalRouteDataRes content = entity.getContent(); if (content != null) { - CallerHmiManager.INSTANCE.showWarningV2X(entity.getType() + "", "为您推荐最优路线", "已为您选择最优路线", TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(30)); + CallerHmiManager.INSTANCE.warningV2X(entity.getType() + "", + "为您推荐最优路线", "已为您选择最优路线", TAG, + this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(30), + MsgBoxType.V2X); } } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java index e45788e227..0682923143 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java @@ -10,9 +10,13 @@ import androidx.annotation.Nullable; import com.mogo.eagle.core.data.enums.WarningDirectionEnum; import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.data.map.entity.V2XMessageEntity; +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.api.map.listener.IMoGoMapLocationListener; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; @@ -59,7 +63,10 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL int v2xType = getV2XTypeForFrontWarning(mMarkerEntity); V2XMessageEntity entity = getV2XMessageEntity(); if (v2xType != 0) { - CallerHmiManager.INSTANCE.showWarningV2X(v2xType + "", getAlertContentForFrontWarning(mMarkerEntity), mMarkerEntity.getTts(), TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(3)); + CallerHmiManager.INSTANCE.warningV2X(v2xType + "", + getAlertContentForFrontWarning(mMarkerEntity), mMarkerEntity.getTts(), + TAG, this, !entity.isOnlyShow(), + TimeUnit.SECONDS.toMillis(3), MsgBoxType.V2X); } } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt index dd7f938765..6d72796f41 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt @@ -20,6 +20,10 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X import com.mogo.eagle.core.utilcode.util.ThreadUtils 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 +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.zhjt.service_biz.BizConfig import kotlin.math.abs import kotlin.math.ceil @@ -200,14 +204,15 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, private fun redLightWarning() { CallerLogger.d("$M_V2X$TAG", "=====闯红灯预警=====") ThreadUtils.runOnUiThread { - CallerHmiManager.showWarningV2X( + 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, null, true, - 5000L + 5000L, + MsgBoxType.V2X ) } } @@ -227,14 +232,15 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), speed ) - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, content, tts, EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, null, true, - 5000L + 5000L, + MsgBoxType.V2X ) } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt index 031de57a8d..449357c729 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt @@ -26,6 +26,10 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler 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 +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.zhjt.service_biz.BizConfig class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListener, @@ -241,14 +245,15 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe ttsContent: String, tag: String ) { - CallerHmiManager.showWarningV2X( + CallerHmiManager.warningV2X( v2xType, alertContent, ttsContent, tag, object : IMoGoWarningStatusListener { override fun onShow() {} override fun onDismiss() {} }, true, - 5000L + 5000L, + MsgBoxType.V2X ) } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxBean.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxBean.kt index 171d472e6b..7a08d71212 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxBean.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/MsgBoxBean.kt @@ -1,3 +1,6 @@ package com.mogo.eagle.core.data.msgbox -data class MsgBoxBean(val type: MsgBoxType, val bean: Any, var timestamp: Long = 0) +data class MsgBoxBean(val type: MsgBoxType, val bean: Any) { + var timestamp: Long = 0 + var bean2Json: String = "" +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/RecordBagMsg.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/RecordBagMsg.kt new file mode 100644 index 0000000000..370d46ed4d --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/RecordBagMsg.kt @@ -0,0 +1,3 @@ +package com.mogo.eagle.core.data.msgbox + +data class RecordBagMsg(var key: Long, var stat: Int, var id: Int, var type: Int, var fileName: String, var note: String) \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/V2XMsg.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/V2XMsg.kt new file mode 100644 index 0000000000..cd92ae18cd --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/msgbox/V2XMsg.kt @@ -0,0 +1,3 @@ +package com.mogo.eagle.core.data.msgbox + +data class V2XMsg(var type: String = "", var content: String? = "", var tts: String? = "") \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt index 1a7ff34247..715155ac8e 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt @@ -99,6 +99,11 @@ interface IMoGoWaringProvider : IMoGoHmiViewProxy { */ fun showWarningV2X(v2xType: String, alertContent: CharSequence?, ttsContent: String?, tag: String?, listener: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) + /** + * 不展示顶部弹窗,其它保留 + */ + fun warningV2X(v2xType: String, alertContent: CharSequence?, ttsContent: String?, tag: String?, listener: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long) + /** * 关闭指定floatTag 的 VR下V2X预警弹窗 * @param tag 弹窗标识 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxProvider.kt index 254ca20d6c..b9178c0a1e 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/msgbox/IMsgBoxProvider.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.api.msgbox +import android.content.Context import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider @@ -7,16 +8,22 @@ interface IMsgBoxProvider: IMoGoFunctionServerProvider { fun saveMsg(bean: MsgBoxBean) /** - * 通知消息:V2X、云公告、运营信息 + * 获取本地数据库缓存的通知消息:V2X、云公告、运营信息 */ - fun getNotifyData(): List + fun getCachedNotifyData(): List /** - * 工控机Report信息 + * 获取本地数据库缓存的工控机Report信息 */ - fun getSysInfoData(): List + fun getCachedSysInfoData(): List /** - * 录包信息 + * 获取本地数据库缓存的录包信息 */ - fun getRecordBagData(): List + fun getCachedRecordBagData(): List + + fun removeRecordInfo(key: String, value: Any) + + fun deleteBoxBean(context: Context, msgBoxBean: MsgBoxBean) + + fun getDismissTime(): Long } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index d9b215b235..355c7d50a3 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -9,6 +9,9 @@ import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_SLW import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I 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.V2XMsg import com.mogo.eagle.core.data.notice.NoticeNormalData import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData import com.mogo.eagle.core.data.report.ReportEntity @@ -19,6 +22,8 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.call.base.CallerBase +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox import com.zhjt.service_biz.BizConfig /** @@ -145,6 +150,31 @@ object CallerHmiManager : CallerBase() { ) } + /** + * 不展示顶部弹窗,其它保留 + */ + fun warningV2X( + v2xType: String, + alertContent: CharSequence?, + ttsContent: String?, + tag: String?, + listenerIMoGo: IMoGoWarningStatusListener?, + playTts: Boolean, + expireTime: Long = 5000L, + msgBoxType: MsgBoxType + ) { + saveMsgBox(MsgBoxBean(msgBoxType, V2XMsg(v2xType, alertContent?.toString() ?: "", ttsContent))) + waringProviderApi?.warningV2X( + v2xType, + alertContent, + ttsContent, + tag, + listenerIMoGo, + playTts, + expireTime + ) + } + /** * 关闭指定floatTag 的 VR下V2X预警弹窗 * @param tag 弹窗标识 @@ -271,6 +301,7 @@ object CallerHmiManager : CallerBase() { * */ fun showNoticeNormalData(noticeNormal: NoticeNormalData) { + saveMsgBox(MsgBoxBean(MsgBoxType.NOTICE, noticeNormal)) waringProviderApi?.showNoticeNormalData(noticeNormal) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxManager.kt index e94b38e74f..da9256e613 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/msgbox/CallerMsgBoxManager.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.call.msgbox +import android.content.Context import com.mogo.eagle.core.data.constants.MogoServicePaths import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.function.api.msgbox.IMsgBoxProvider @@ -25,21 +26,40 @@ object CallerMsgBoxManager { /** * 通知消息:V2X、云公告、运营信息 */ - fun getNotifyData(): List? { - return providerApi?.getNotifyData() + fun getCachedNotifyData(): List? { + return providerApi?.getCachedNotifyData() } /** * 工控机Report信息 */ - fun getSysInfoData(): List? { - return providerApi?.getSysInfoData() + fun getCachedSysInfoData(): List? { + return providerApi?.getCachedSysInfoData() } /** * 录包信息 */ - fun getRecordBagData(): List? { - return providerApi?.getRecordBagData() + fun getCachedRecordBagData(): List? { + return providerApi?.getCachedRecordBagData() + } + + /** + * 用户已处理的Bag包需要删除 + * key: Bag包的唯一标识key,value:任意非空的值 + */ + fun removeRecordInfo(key: String, value: Any) { + providerApi?.removeRecordInfo(key, value) + } + + /** + * 删除消息盒子中存入数据库的数据,比如已经处理的录制bag信息 + */ + fun deleteBoxBean(context: Context, msgBoxBean: MsgBoxBean) { + providerApi?.deleteBoxBean(context, msgBoxBean) + } + + fun getDismissTime(): Long { + return providerApi?.getDismissTime() ?: 0L } } \ No newline at end of file From 80b651802a80a34e97e88e28e8e841ffdfc58467 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 25 Nov 2022 16:14:25 +0800 Subject: [PATCH 02/23] fixed conflict --- .../hmi/ui/widget/SystemVersionView.kt | 38 ++++++-------- .../function/main/MainMoGoApplication.java | 52 +++++++++++++++++++ .../call/devatools/CallerDevaToolsManager.kt | 1 - 3 files changed, 67 insertions(+), 24 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt index 141f627fcf..cde0dcdca9 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SystemVersionView.kt @@ -64,17 +64,12 @@ class SystemVersionView @JvmOverloads constructor( showCurrentPadVersion() showCurrentAdVersion() - val builder = NotificationCompat.Builder(context) - builder.setSmallIcon(R.mipmap.icon1001) - builder.setContentTitle("下载") - builder.setContentText("正在下载") - val manager: NotificationManager? = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager? - //鹰眼版本视图点击事件 ivPadVersion.setOnClickListener { CallerLogger.i("$M_HMI$$TAG", "pad version view clicked") CallerBindingcarManager.getBindingcarProvider().queryAppUpgrade() + //弹框和下载回调 // showUpgradeDialog( // "", // "", @@ -82,11 +77,17 @@ class SystemVersionView @JvmOverloads constructor( // "", // "1" // ) + +// val builder = NotificationCompat.Builder(context) +// builder.setSmallIcon(R.mipmap.icon1001) +// builder.setContentTitle("下载") +// builder.setContentText("正在下载") +// val manager: NotificationManager? = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager? // // CallerDevaToolsUpgradeListenerManager.registerDevaToolsUpgradeListener(TAG, // object : IMogoDevaToolsUpgradeListener { // override fun onStart(url: String?) { -// Log.d("Package-DownLoad", " SystemVersionView onStart --------> ") +//// Log.d("Package-DownLoad", " SystemVersionView onStart --------> ") // } // // override fun onPause(url: String?) { @@ -94,36 +95,27 @@ class SystemVersionView @JvmOverloads constructor( // } // // override fun onProgress(url: String?, length: Int) { -// Log.d("Package-DownLoad", " SystemVersionView onProgress length = $length") +//// Log.d("Package-DownLoad", " SystemVersionView onProgress length = $length") // builder.setProgress(100, length,false) // manager?.notify(0x3,builder.build()) // //下载进度提示 -// if (length == 99) { -// UiThreadHandler.postDelayed({ -// length == 100 -// builder.setContentText("已下载" + length + "%") -// -// UiThreadHandler.postDelayed({ -// manager?.cancel(0x3) -// }, 1000L) -// -// }, 1500L) -// } -// // builder.setContentText("已下载" + length + "%") // } // // override fun onFinished(url: String?) { -// Log.d("Package-DownLoad", " SystemVersionView onFinished ------> ") +//// Log.d("Package-DownLoad", " SystemVersionView onFinished ------> ") +// builder.setContentText("已下载" + 100 + "%") +// UiThreadHandler.postDelayed({ +// manager?.cancel(0x3) +// }, 500L) // } // // override fun onError(url: String?, errorMsg: String?) { -// Log.d("Package-DownLoad", " errorMsg = $errorMsg") +//// Log.d("Package-DownLoad", " errorMsg = $errorMsg") // } // }) } - //工控机版本视图点击事件 ivAdVersion.setOnClickListener { CallerLogger.i("$M_HMI$$TAG", "ad version view clicked") 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 89a40ae47a..8e88df6202 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 @@ -2,10 +2,14 @@ package com.mogo.eagle.core.function.main; import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI; +import android.app.NotificationManager; import android.annotation.SuppressLint; import android.content.Context; import android.os.Process; +import androidx.annotation.Nullable; +import androidx.core.app.NotificationCompat; + import com.bytedance.boost_multidex.BoostMultiDex; import com.elegant.utils.UiThreadHandler; import com.mogo.cloud.socket.SocketBuildConfig; @@ -18,8 +22,11 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig; import com.mogo.eagle.core.data.constants.MoGoConfig; import com.mogo.eagle.core.data.constants.MogoServicePaths; import com.mogo.eagle.core.function.api.chat.biz.ChatConsts; +import com.mogo.eagle.core.function.api.devatools.IMogoDevaToolsUpgradeListener; import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager; import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager; +import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager; +import com.mogo.eagle.core.function.hmi.R; import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb; import com.mogo.eagle.core.function.overview.OverviewDb; import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; @@ -69,6 +76,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { queryAppUpgrade(); clearMessageBoxTable(); checkMonitorDb(); + upgradeProgressListener(); } @Override @@ -116,6 +124,50 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { }).start(); } + private void upgradeProgressListener() { + final NotificationCompat.Builder builder = new NotificationCompat.Builder(this); + builder.setSmallIcon(R.mipmap.icon1001); + builder.setContentTitle("下载"); + builder.setContentText("正在下载"); + final NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + CallerDevaToolsUpgradeListenerManager.INSTANCE.registerDevaToolsUpgradeListener(TAG, new IMogoDevaToolsUpgradeListener() { + @Override + public void onStart(@Nullable String url) { + + } + + @Override + public void onPause(@Nullable String url) { + + } + + @Override + public void onProgress(@Nullable String url, int length) { + builder.setProgress(100, length,false); + manager.notify(0x3, builder.build()); + //下载进度提示 + builder.setContentText("已下载" + length + "%"); + } + + @Override + public void onFinished(@Nullable String url) { + builder.setContentText("已下载" + 100 + "%"); + UiThreadHandler.postDelayed(new Runnable() { + @Override + public void run() { + manager.cancel(0x3); + } + }, 1000); + } + + @Override + public void onError(@Nullable String url, @Nullable String errorMsg) { + + } + }); + } + private void initKoom() { KoomInitTask.INSTANCE.init(this); } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt index db4d02aef3..b09062156c 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/devatools/CallerDevaToolsManager.kt @@ -147,7 +147,6 @@ object CallerDevaToolsManager { fun downLoadPackage(downloadKey: String, downloadUrl: String) { devaToolsProviderApi?.downLoadPackage(downloadKey, downloadUrl) // Log.d("Update", "downloadKey = $downloadKey --- downloadUrl = $downloadUrl") -// devaToolsProviderApi?.downLoadPackage("IntelligentPilot_v2.9.0.1002_20220725_[fPadLenovoOchBus-launcher-qa]_debug.apk", "https://scm-1255510688.cos.ap-beijing.myqcloud.com/test/com.mogo.launcher.f/2.9.0.1002/IntelligentPilot_v2.9.0.1002_20220725_[fPadLenovoOchBus-launcher-qa]_debug.apk") // devaToolsProviderApi?.downLoadPackage("IntelligentPilot_v2.9.0.1002_20220725_[fPadLenovoOchBus-launcher-qa]_debug.apk", "https://scm-1255510688.cos.ap-beijing.myqcloud.com/test/com.mogo.launcher.f/2.9.0.1002/IntelligentPilot_v2.9.0.1002_20220725_[fPadLenovoOchBus-launcher-qa]_debug.apk") } From 8f370c7c4aebfae836de7c1ad5ac36b6695b8ca8 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 25 Nov 2022 17:05:55 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=AD=94=E6=96=B9?= =?UTF-8?q?=E7=9A=84=E6=8E=A7=E5=88=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/main/MainLauncherActivity.java | 125 ++++++++---------- 1 file changed, 53 insertions(+), 72 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java index 09593b6a28..e0cba95c86 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java @@ -60,7 +60,7 @@ import me.jessyan.autosize.utils.AutoSizeUtils; * @author tongchenfei */ public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMoGoSkinModeChangeListener { - private static final String TAG = "liyz"; + private static final String TAG = "MainLauncherActivity"; protected boolean mIsHomeKeyDown = false; private final static Handler handlerV2XEvent = new Handler(); private static Runnable runnableV2XEvent; @@ -71,17 +71,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis private BluetoothMonitorReceiver mBluetoothReceiver = null; private BluetoothAdapter mBluetoothAdapter; - // private List mAreadlyConnectedList = new ArrayList<>();//已连接设备集合 - private int numberA = 0; - private boolean isLongPressA = false; - private int numberB = 0; - private boolean isLongPressB = false; - private int numberC = 0; - private boolean isLongPressC = false; - private int numberD = 0; - private boolean isLongPressD = false; - private int numberE = 0; - private boolean isLongPressE = false; @Override @@ -90,7 +79,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis DebugConfig.setNeedRequestUserInfo(true); EventBus.getDefault().register(this); CallerLogger.INSTANCE.i(M_HMI + TAG, "onCreate"); - } @Override @@ -222,8 +210,19 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis private long pressAUpTime = 0; private long pressBDownTime = 0; private long pressBUpTime = 0; + private long pressCDownTime = 0; + private long pressCUpTime = 0; + private long pressDDownTime = 0; + private long pressDUpTime = 0; + private long pressEDownTime = 0; + private long pressEUpTime = 0; + /** + * 魔方按键分发 提测前注释 ToastUtils TODO + * @param event + * @return + */ @Override public boolean dispatchKeyEvent(KeyEvent event) { // Log.d(TAG, "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event); @@ -231,26 +230,24 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (!isPressEnd) { Log.e(TAG, "dispatchKeyEvent bluetoothName = " + bluetoothName); } - if (bluetoothName.equals("MINI_KEYBOARD")) { if (!isPressEnd) { isPressEnd = true; startPressTime = System.currentTimeMillis(); } - if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击向左变道,长按-1 + if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击 -1,长按无操作,AB组合-2 if (event.getAction() == KeyEvent.ACTION_DOWN) { pressADownTime = System.currentTimeMillis(); Log.d(TAG, "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime); - if ((pressADownTime - startPressTime) > 550 && (pressADownTime - startPressTime) < 1900 && pressBDownTime > 0) { + if ((pressADownTime - startPressTime) > 350 && (pressADownTime - startPressTime) < 1800 && pressBDownTime > 0) { ToastUtils.showShort("方块 A 按AB组合 -2 "); sendAcc(true, -2); isCombinationKey = true; } - if (!isCombinationKey) { - if ((pressADownTime - startPressTime) > 2000) { - ToastUtils.showShort("方块 长按A 无操作 "); + if ((pressADownTime - startPressTime) > 1900) { + ToastUtils.showShort("方块 长按A 无 操作 "); } } } else if (event.getAction() == KeyEvent.ACTION_UP) { @@ -258,7 +255,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis isPressEnd = false; isCombinationKey = false; Log.e(TAG, "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime); - if ((pressAUpTime - startPressTime) < 500) { + if ((pressAUpTime - startPressTime) < 300) { ToastUtils.showShort("方块 单击A -1 "); sendAcc(true, -1); } @@ -266,79 +263,77 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis } return true; - } else if (event.getKeyCode() == KeyEvent.KEYCODE_B) { //单击向右变道,长按-2 + } else if (event.getKeyCode() == KeyEvent.KEYCODE_B) {//单击复原,长按+1,AB组合-2 if (event.getAction() == KeyEvent.ACTION_DOWN) { pressBDownTime = System.currentTimeMillis(); Log.d(TAG, "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime); - if ((pressBDownTime - startPressTime) > 550 && (pressBDownTime - startPressTime) < 1900 && pressADownTime > 0) { + if ((pressBDownTime - startPressTime) > 350 && (pressBDownTime - startPressTime) < 1800 && pressADownTime > 0) { ToastUtils.showShort("方块 B 按AB组合 "); sendAcc(true, -2); isCombinationKey = true; } - if (!isCombinationKey) { - if ((pressBDownTime - startPressTime) > 2000) { + if ((pressBDownTime - startPressTime) > 1900) { ToastUtils.showShort("方块 长按B =1 "); sendAcc(true, +1); } } - } else if (event.getAction() == KeyEvent.ACTION_UP) { pressBUpTime = System.currentTimeMillis(); isPressEnd = false; isCombinationKey = false; Log.e(TAG, "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime); - if ((pressBUpTime - startPressTime) < 500) { + if ((pressBUpTime - startPressTime) < 300) { ToastUtils.showShort("方块 单击B 0 "); sendAcc(false, 0.0); } - pressBDownTime = 0; } return true; - } else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击鸣笛, + } else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作 if (event.getAction() == KeyEvent.ACTION_DOWN) { - numberC++; - if (numberC > 2) { - if (!isLongPressC) { -// ToastUtils.showShort("方块 长按C 无操作"); - isLongPressC = true; + pressCDownTime = System.currentTimeMillis(); + if (!isCombinationKey) { + if ((pressCDownTime - startPressTime) > 1900) { + ToastUtils.showShort("方块 长按C 无操作 "); } } } else if (event.getAction() == KeyEvent.ACTION_UP) { - if (numberC == 1) { -// ToastUtils.showShort("方块 单击C ← 向左变道 "); + pressCUpTime = System.currentTimeMillis(); + isPressEnd = false; + isCombinationKey = false; + if ((pressCUpTime - startPressTime) < 300) { + ToastUtils.showShort("方块 单击C ← 向左变道 "); CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneLeft(); } - numberC = 0; - isLongPressC = false; } return true; - } else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击开启自动驾驶, + } else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作 if (event.getAction() == KeyEvent.ACTION_DOWN) { - numberD++; - if (numberD > 2) { - if (!isLongPressD) { -// ToastUtils.showShort("方块 长按D 无操作"); - isLongPressD = true; + pressDDownTime = System.currentTimeMillis(); + if (!isCombinationKey) { + if ((pressDDownTime - startPressTime) > 1900) { + ToastUtils.showShort("方块 长按D 无操作 "); } } } else if (event.getAction() == KeyEvent.ACTION_UP) { - if (numberD == 1) { -// ToastUtils.showShort("方块 单击D → 向右变道 "); + pressDUpTime = System.currentTimeMillis(); + isPressEnd = false; + isCombinationKey = false; + if ((pressDUpTime - startPressTime) < 300) { + ToastUtils.showShort("方块 单击D → 向右变道 "); CallerAutoPilotManager.INSTANCE.sendOperatorChangeLaneRight(); } - numberD = 0; - isLongPressD = false; } + return true; - } else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击复原, + } else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛 if (event.getAction() == KeyEvent.ACTION_DOWN) { - numberE++; - if (numberE > 2) { - if (!isLongPressE) { -// ToastUtils.showShort("方块 长按E 鸣笛 "); + pressEDownTime = System.currentTimeMillis(); + if (!isCombinationKey) { + if ((pressEDownTime - startPressTime) > 1900) { + ToastUtils.showShort("方块 长按E 鸣笛 "); CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1); if (timerHorn == null) { timerHorn = new Timer(); @@ -350,18 +345,18 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis timerHorn = null; } }, 500); - isLongPressE = true; } } } else if (event.getAction() == KeyEvent.ACTION_UP) { - if (numberE == 1) { -// ToastUtils.showShort("方块 单击E 开启自动驾驶 "); -// CallerAutoPilotManager.INSTANCE.setControlAutopilotCarAuto(true); + pressEUpTime = System.currentTimeMillis(); + isPressEnd = false; + isCombinationKey = false; + if ((pressEUpTime - startPressTime) < 300) { + ToastUtils.showShort("方块 单击E 开启自动驾驶 "); CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters()); } - numberE = 0; - isLongPressE = false; } + return true; } } @@ -416,7 +411,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis * 查找蓝牙连接过的蓝牙设备 */ private void showBondedDevice(BluetoothAdapter bluetoothAdapter) { -// mAreadlyConnectedList.clear(); Set deviceList = bluetoothAdapter.getBondedDevices(); for (BluetoothDevice device : deviceList) { try { @@ -424,27 +418,14 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis Method isConnectedMethod = BluetoothDevice.class.getDeclaredMethod("isConnected", (Class[]) null); isConnectedMethod.setAccessible(true); // boolean isConnected = (boolean) isConnectedMethod.invoke(device, (Object[]) null); -// mAreadlyConnectedList.add(device); Log.d(TAG, "-- device.getName() = " + device.getName()); //device.getAddress() if (device.getName().equals("MINI_KEYBOARD")) { SharedPrefsMgr.getInstance(getContext()).putString("BLUETOOTH", device.getName()); } } catch (NoSuchMethodException e) { e.printStackTrace(); -// } catch (IllegalAccessException e) { -// e.printStackTrace(); -// } catch (InvocationTargetException e) { -// e.printStackTrace(); } } } - @Subscribe(threadMode = ThreadMode.MAIN) - public void onAutoConnection(ConnectBluetoothEvent event) { -// connectBluetooth(); - } - - } - - From 36cecbaaba994d398485d5402d35273349c02be2 Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Fri, 25 Nov 2022 17:34:28 +0800 Subject: [PATCH 04/23] =?UTF-8?q?[2.13.0]=20taxi/bus=20=E7=AE=97=E6=B3=95?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../passenger/model/BusPassengerModel.java | 76 +++++--- .../ui/BusPassengerMapDirectionView.java | 15 +- .../utils/CoordinateCalculateRouteUtil.java | 166 ++++++++---------- .../passenger/model/TaxiPassengerModel.java | 41 ++--- .../com/mogo/och/taxi/model/TaxiModel.java | 79 +++++---- 5 files changed, 193 insertions(+), 184 deletions(-) diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java index 9576b73da4..9a25f2e312 100644 --- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/model/BusPassengerModel.java @@ -70,7 +70,7 @@ import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STAT public class BusPassengerModel { private static final String TAG = BusPassengerModel.class.getSimpleName(); - private List mRoutePoints = new ArrayList<>(); + private List mRoutePoints = new ArrayList<>(); private static final class SingletonHolder { private static final BusPassengerModel INSTANCE = new BusPassengerModel(); @@ -88,13 +88,15 @@ public class BusPassengerModel { private IBusPassegerDriverStatusCallback mDriverStatusCallback; //出车收车状态 private IBusPassengerRouteLineInfoCallback mRouteLineInfoCallback; // bus路线信息更新 - private double mLongitude, mLatitude; +// private double mLongitude, mLatitude; + private Location mLocation = null; private BusPassengerRoutesResult routesResult = null; List mStations = new ArrayList<>(); private int mNextStationIndex = 0;// 要到达站的index - private List mTwoStationsRouts = new ArrayList<>(); + private List mTwoStationsRouts = new ArrayList<>(); + private int mPreRouteIndex = 0; private static final int MSG_QUERY_BUS_P_STATION = 1001; private final Handler handler = new Handler(new Handler.Callback() { @@ -307,8 +309,9 @@ public class BusPassengerModel { public void onCarLocationChanged2( Location location ) { //位置变化时,通过围栏判断是否到达x点 // TODO: 2022/3/31 - mLongitude = location.getLongitude(); - mLatitude = location.getLatitude(); +// mLongitude = location.getLongitude(); +// mLatitude = location.getLatitude(); + mLocation = location; for (IBusPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){ callback.onCarLocationChanged(location); } @@ -403,8 +406,8 @@ public class BusPassengerModel { public void updateRoutePoints(List routePoints){ mRoutePoints.clear(); - List latLngModels = CoordinateCalculateRouteUtil - .coordinateConverterWgsToGcjListCommon(mContext,routePoints); + List latLngModels = CoordinateCalculateRouteUtil + .coordinateConverterWgsToGcjLocations(mContext,routePoints); mRoutePoints.addAll(latLngModels); calculateTwoStationsRoute(); } @@ -419,10 +422,12 @@ public class BusPassengerModel { BusPassengerStation stationNext = mStations.get(mNextStationIndex); BusPassengerStation stationCur = mStations.get(mNextStationIndex - 1); //当前站在轨迹中对应的点 - int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints + int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(0 + ,mRoutePoints ,stationCur.getGcjLon(),stationCur.getGcjLat()); //要前往的站在轨迹中对应的点 - int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints + int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(currentRouteIndex + ,mRoutePoints ,stationNext.getGcjLon(),stationNext.getGcjLat()); if (currentRouteIndex < nextRouteIndex){ //如果找到的next在起点的轨迹前面,直接舍弃这个轨迹,不显示 mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex)); @@ -448,22 +453,28 @@ public class BusPassengerModel { if (mTwoStationsRouts.size() == 0){ calculateTwoStationsRoute(); } - if (mTwoStationsRouts.size() > 0){ - List lastPoints = CoordinateCalculateRouteUtil - .getRemainPointListByCompare(mTwoStationsRouts,mLongitude,mLatitude); - - float lastSumLength = 0; - if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离 - lastSumLength = CoordinateUtils.calculateLineDistance( - lastPoints.get(0).longitude, lastPoints.get(0).latitude, - mLongitude, mLatitude); - }else { - lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints); + if (mTwoStationsRouts.size() > 0 && mLocation != null){ + Map> lastPointsMap = CoordinateCalculateRouteUtil + .getRemainPointListByCompareNew(mPreRouteIndex,mTwoStationsRouts,mLocation); + for (int index: lastPointsMap.keySet()) { + mPreRouteIndex = index; + break; } - double lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 ; //秒 - CallerLogger.INSTANCE.d(M_BUS_P + TAG, "lastSumLength = " + lastSumLength); - if (mAutopilotPlanningCallback != null){ - mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime); + + for (List lastPoints: lastPointsMap.values()){ + float lastSumLength = 0; + if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离 + lastSumLength = CoordinateUtils.calculateLineDistance( + lastPoints.get(0).getLongitude(), lastPoints.get(0).getLatitude(), + mLocation.getLongitude(), mLocation.getLatitude()); + }else { + lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints); + } + double lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 ; //秒 + CallerLogger.INSTANCE.d(M_BUS_P + TAG, "lastSumLength = " + lastSumLength); + if (mAutopilotPlanningCallback != null){ + mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime); + } } } } @@ -490,13 +501,18 @@ public class BusPassengerModel { } public void loopRouteAndWipe() { - if (mRoutePoints != null && mRoutePoints.size() > 0){ + if (mRoutePoints != null && mRoutePoints.size() > 0 && mLocation != null){ int haveArrivedIndex = CoordinateCalculateRouteUtil - .getArrivedPointIndex(mRoutePoints,mLongitude,mLatitude); + .getArrivedPointIndexNew(mPreRouteIndex, + mRoutePoints, + mLocation.getLongitude(), + mLocation.getLatitude()); CallerLogger.INSTANCE.d(M_BUS_P + TAG, "thread = "+ Thread.currentThread().getName()+" haveArrivedIndex== " + haveArrivedIndex); if (mAutopilotPlanningCallback != null){ - mAutopilotPlanningCallback.routeResult(mRoutePoints,haveArrivedIndex); + List routePoints = CoordinateCalculateRouteUtil + .coordinateConverterLocationToLatLng(mContext,mRoutePoints); + mAutopilotPlanningCallback.routeResult(routePoints,haveArrivedIndex); } } } @@ -505,8 +521,10 @@ public class BusPassengerModel { * 设置小地图路径的起终点marker */ public void setRouteLineMarker(){ - if (mAutopilotPlanningCallback != null){ - mAutopilotPlanningCallback.setLineMarker(mRoutePoints); + if (mAutopilotPlanningCallback != null && mRoutePoints != null){ + List routePoints = CoordinateCalculateRouteUtil + .coordinateConverterLocationToLatLng(mContext,mRoutePoints); + mAutopilotPlanningCallback.setLineMarker(routePoints); } } diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java index a0fc02d3cf..509f908434 100644 --- a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/ui/BusPassengerMapDirectionView.java @@ -197,10 +197,11 @@ public class BusPassengerMapDirectionView mCarMarker.setToTop(); } + //圈定地图显示范围 + LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder(); + if (mLinePointsLatLng.size() > 0){ - //圈定地图显示范围 //存放经纬度 - LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder(); for (int i = 0; i < mLinePointsLatLng.size(); i++) { boundsBuilder.include(mLinePointsLatLng.get(i)); } @@ -208,13 +209,15 @@ public class BusPassengerMapDirectionView //第二个参数为四周留空宽度 mAMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(),100,100,100,100)); - } -// else { -// //设置希望展示的地图缩放级别 + } else { + boundsBuilder.include(currentLatLng); + //第二个参数为四周留空宽度 + mAMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(),100,100,100,100)); + //设置希望展示的地图缩放级别 // CameraPosition cameraPosition = new CameraPosition.Builder() // .target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build(); // mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); -// } + } } diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/CoordinateCalculateRouteUtil.java b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/CoordinateCalculateRouteUtil.java index 3ab7e47426..879a69086e 100644 --- a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/CoordinateCalculateRouteUtil.java +++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/CoordinateCalculateRouteUtil.java @@ -21,20 +21,36 @@ import mogo.telematics.pad.MessagePad; */ public class CoordinateCalculateRouteUtil { - public static float calculateRouteSumLength(List points){ + public static float calculateRouteSumLength(List points){ if (null == points || points.size() == 0) return 0; float sumLength = 0; - //计算全路径总距离 - for (int i = 0;i + 1< points.size();i++){ - double preLat = points.get(i).latitude; - double preLon = points.get(i).longitude; - double laLat = points.get(i+1).latitude; - double laLon = points.get(i+1).longitude; + if (points.get(1) instanceof Location){ + //计算全路径总距离 + for (int i = 0;i + 1< points.size();i++){ + Location locationPre = (Location) points.get(i); + Location location = (Location) points.get(i+1); + double preLat = locationPre.getLatitude(); + double preLon = locationPre.getLongitude(); + double laLat = location.getLatitude(); + double laLon = location.getLongitude(); - float length = CoordinateUtils.calculateLineDistance(laLon,laLat,preLon,preLat); - sumLength += length; + float length = CoordinateUtils.calculateLineDistance(laLon,laLat,preLon,preLat); + sumLength += length; + } + }else if (points.get(1) instanceof LatLng){ + for (int i = 0;i + 1< points.size();i++){ + LatLng locationPre = (LatLng) points.get(i); + LatLng location = (LatLng) points.get(i+1); + double preLat = locationPre.latitude; + double preLon = locationPre.longitude; + double laLat = location.latitude; + double laLon = location.longitude; + + float length = CoordinateUtils.calculateLineDistance(laLon,laLat,preLon,preLat); + sumLength += length; + } } return sumLength; } @@ -65,75 +81,6 @@ public class CoordinateCalculateRouteUtil { return latLng; } - - /** - * 根据实时定位的坐标确定出已行驶到那个坐标点 todo 有问题 暂不使用 - * @param mRoutePoints - * @param realLon - * @param realLat - * @return 返回剩余路径集合 - */ - @Deprecated - public static List getCurrentPoinByCompare(List mRoutePoints,double realLon,double realLat) { - // 疑似坐标 先以坐标中间1/2为第一个比对点 - int currentIndex = Math.round(mRoutePoints.size()/2); - LatLng currentLatLng = mRoutePoints.get(currentIndex); - - //差值初始化 - float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat - ,currentLatLng.longitude,currentLatLng.latitude);// lon,lat, prelon, prelat - - List latePoints = new ArrayList<>(); - //与选中点左右比较 - if (currentIndex -1 >= 0 && currentIndex+1<= mRoutePoints.size()-1){ - LatLng leftCurrentLatLng = mRoutePoints.get(currentIndex -1); - LatLng rightCurentLatLng = mRoutePoints.get(currentIndex + 1); - float leftDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat - ,leftCurrentLatLng.longitude,leftCurrentLatLng.latitude); - float rightDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat,rightCurentLatLng.longitude,rightCurentLatLng.latitude); - - if (rightDiffDis < leftDiffDis){ //靠近了右半边 - baseDiffDis = rightDiffDis; - for (int i = currentIndex +1; i+1 coordinateConverterLocationToLatLng(Context mContext, List models) { + //转成MogoLatLng集合 + List list = new ArrayList<>(); + for (Location m : models) { + LatLng mogoLatLng = coordinateConverterWgsToGcj(mContext, m.getLongitude(),m.getLatitude()); + list.add(mogoLatLng); + } + return list; + } + + /** + * 根据前一个index,经纬度航向角,确认剩余轨迹 + * @param preIndex + * @param mRoutePoints + * @param realLocation + * @return + */ + public static Map> getRemainPointListByCompareNew(int preIndex, List mRoutePoints, Location realLocation) { - Map> routePonits = new HashMap<>(); - List latePoints = new ArrayList<>(); // 剩余轨迹集合 + Map> routePonits = new HashMap<>(); + List latePoints = new ArrayList<>(); // 剩余轨迹集合 int currentIndex = 0; //记录疑似点 if (mRoutePoints.size() > preIndex){ //基础点 @@ -269,13 +245,13 @@ public class CoordinateCalculateRouteUtil { Logger.d( "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ "); if (currentIndex == mRoutePoints.size()-1){ Location location = mRoutePoints.get(currentIndex); - LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); - latePoints.add(latLng); +// LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); + latePoints.add(location); }else { List locations = mRoutePoints.subList(currentIndex,mRoutePoints.size()-1); for (Location location: locations) { - LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); - latePoints.add(latLng); +// LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); + latePoints.add(location); } } routePonits.put(currentIndex,latePoints); @@ -284,27 +260,27 @@ public class CoordinateCalculateRouteUtil { return routePonits; } - public static int getArrivedPointIndexNew(List mRoutePoints, - Location realLocation) { - int currentIndex = 0; //记录疑似点 //基础点 + public static int getArrivedPointIndexNew(int preIndex, List mRoutePoints, + double realLon,double realLat) { + int currentIndex = preIndex; //记录疑似点 //基础点 Location baseLatLng = mRoutePoints.get(0); - float baseDiffDis = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(), - realLocation.getLatitude() + float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon, + realLat , baseLatLng.getLongitude(), baseLatLng.getLongitude());// lon,lat, prelon, prelat for (int i = 0; i < mRoutePoints.size(); i++) { Location latLng = mRoutePoints.get(i); //todo 先看index对应点的方向和realLocation方向是否一致, 方向角度不能过90度 - if (Math.abs(realLocation.getBearing() - latLng.getBearing()) <= 90) { - float diff = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(), - realLocation.getLatitude(), +// if (Math.abs(realLocation.getBearing() - latLng.getBearing()) <= 90) { + float diff = CoordinateUtils.calculateLineDistance(realLon, + realLat, latLng.getLongitude(), latLng.getLatitude()); - if (baseDiffDis > diff) { + if (baseDiffDis > diff && i>currentIndex) { // Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- "); baseDiffDis = diff; currentIndex = i; } - } +// } } Logger.d("calculateRouteSumLength", "点:" + currentIndex + "-------是最近的点------ "); return currentIndex; diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java index a25cc52a39..c1fddf11d7 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.java @@ -116,12 +116,14 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback private ITaxiPassengerVeloctityCallback mVeloctityCallback;//道路限速返回 + private int mPreRouteIndex = 0; + private Disposable subscribe; private int delayTime = 2; private double mLongitude, mLatitude; - private List mLocationsModels = new ArrayList<>(); + private List mLocationsModels = new ArrayList<>(); private TaxiPassengerModel() { } @@ -425,21 +427,6 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback } } - /** - * 计算订单起终距离 - * @return - */ - public int calculateOrderDistanceSum(){ - double endLon = mCurrentOCHOrder.endSiteGcjPoint.get(0); - double endLat = mCurrentOCHOrder.endSiteGcjPoint.get(1); - double startLon = mCurrentOCHOrder.startSiteGcjPoint.get(0); - double startLat = mCurrentOCHOrder.startSiteGcjPoint.get(1); - double distance = CoordinateUtils.calculateLineDistance( - endLon, endLat, - startLon, startLat); - return new Double(distance).intValue(); - } - //监听网络变化,避免启动机器时无网导致无法更新订单信息 private final IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() { @Override @@ -596,10 +583,10 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback }; public void startToRouteAndWipe(List models) { - List latLngModels = CoordinateCalculateRouteUtil - .coordinateConverterWgsToGcjListCommon(mContext,models); + List locationsModels = CoordinateCalculateRouteUtil + .coordinateConverterWgsToGcjLocations(mContext,models); mLocationsModels.clear(); - mLocationsModels.addAll(latLngModels); + mLocationsModels.addAll(locationsModels); startOrStopRouteAndWipe(true); showRottingMapView(); } @@ -622,7 +609,6 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback NaviLatLng endNaviLatLng = new NaviLatLng(orderEndStationLat,orderEndStationLng); AmapNaviToDestinationModel.getInstance(mContext).initAMapNavi(startNaviLatLng, endNaviLatLng); AmapNaviToDestinationModel.getInstance(mContext).setVoiceIsMute(false); -// AmapNaviToDestinationModel.getInstance(mContext).setOCHTaciNaviChangedCallback(this); } } @@ -641,9 +627,16 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback public void loopRouteAndWipe() { if (mLocationsModels != null && mLocationsModels.size() > 0){ int haveArrivedIndex = CoordinateCalculateRouteUtil - .getArrivedPointIndex(mLocationsModels,mLongitude,mLatitude); + .getArrivedPointIndexNew(mPreRouteIndex, + mLocationsModels, + mLongitude, + mLatitude); + mPreRouteIndex = haveArrivedIndex; if (mAutopilotPlanningCallback != null){ - mAutopilotPlanningCallback.routeResultByServer(mLocationsModels,haveArrivedIndex); + List latLngsModels = CoordinateCalculateRouteUtil + .coordinateConverterLocationToLatLng(mContext, + mLocationsModels); + mAutopilotPlanningCallback.routeResultByServer(latLngsModels,haveArrivedIndex); } } } @@ -731,7 +724,9 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback mAutopilotPlanningCallback.setLineMarker(data.data); } mLocationsModels.clear(); - mLocationsModels.addAll(data.data); + List locationsModels = CoordinateCalculateRouteUtil. + coordinateConverterLatlngToLocation(data.data); + mLocationsModels.addAll(locationsModels); startOrStopRouteAndWipe(true); } }else { diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java index da35077c43..715e9d2d7e 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java @@ -86,6 +86,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; import io.reactivex.exceptions.UndeliverableException; import io.reactivex.functions.Consumer; @@ -127,9 +128,11 @@ public class TaxiModel { private volatile boolean isRestartAutopilot = false; - private List mRoutePoints = new ArrayList<>(); + private List mRoutePoints = new ArrayList<>(); + private int mPreRouteIndex = 0; private double mLongitude, mLatitude; + private Location mLocation = null; private LoginService loginService; @@ -737,8 +740,8 @@ public class TaxiModel { public void confirmAutopilotConditionByDriver() { if (mCurrentOCHOrder == null) return; TaxiOrPassengerReadyReqBean.Result result = new TaxiOrPassengerReadyReqBean.Result(); - result.lat = mLatitude; - result.lon = mLongitude; +// result.lat = mLatitude; +// result.lon = mLongitude; TaxiServiceManager.confirmAutopilotConditionByDriver(mContext, mCurrentOCHOrder.orderNo, result, @@ -1064,6 +1067,7 @@ public class TaxiModel { mLongitude = location.getLongitude(); mLatitude = location.getLatitude(); + mLocation = location; if (mControllerStatusCallback != null) { mControllerStatusCallback.onCarLocationChanged(location); } @@ -1333,7 +1337,8 @@ public class TaxiModel { if (mRoutePoints.size() > 0){ mRoutePoints.clear(); } - mRoutePoints.addAll(CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext, models)); + mRoutePoints.addAll(CoordinateCalculateRouteUtil + .coordinateConverterWgsToGcjLocations(mContext, models)); startDynamicCalculateRouteInfo(); } @@ -1367,47 +1372,57 @@ public class TaxiModel { * 实时计算当前剩余里程和时间 */ public void dynamicCalculateRouteInfo() { - if (mLatitude <= 0.0 || mLongitude <= 0.0){ + if (mLocation == null){ return; } - if (mRoutePoints.size() > 0){ - List lastPoints = CoordinateCalculateRouteUtil - .getRemainPointListByCompare(mRoutePoints, mLongitude, mLatitude); + if (mRoutePoints.size() > 0 && mLocation != null){ + Map> lastPointsMap = CoordinateCalculateRouteUtil + .getRemainPointListByCompareNew(mPreRouteIndex,mRoutePoints, mLocation); - float lastSumLength = 0; - - if (lastPoints.size() == 1) { //只是最后一个点,计算当前位置和最后一个点的距离 - lastSumLength = CoordinateUtils.calculateLineDistance( - lastPoints.get(0).longitude, lastPoints.get(0).latitude, - mLongitude, mLatitude); - } else { - lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints); + for (int index: lastPointsMap.keySet()) { + mPreRouteIndex = index; + break; } + for (List lastPoints: lastPointsMap.values()){ + float lastSumLength = 0; + if (lastPoints.size() == 1) { //只是最后一个点,计算当前位置和最后一个点的距离 + lastSumLength = CoordinateUtils.calculateLineDistance( + lastPoints.get(0).getLongitude(), lastPoints.get(0).getLatitude(), + mLocation.getLongitude(), mLocation.getLatitude()); + } else { + lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints); + } - double lastTime = lastSumLength / TaxiConst.TAXI_AVERAGE_SPEED * 3.6; //秒 - CallerLogger.INSTANCE.d(M_TAXI + "dynamicCalculateRouteInfo" - , "---lastSumLength: " + lastSumLength + "----lastTime : " + lastTime - + " thread = "+ Thread.currentThread().getName()); + double lastTime = lastSumLength / TaxiConst.TAXI_AVERAGE_SPEED * 3.6; //秒 + CallerLogger.INSTANCE.d(M_TAXI + "dynamicCalculateRouteInfo" + , "---lastSumLength: " + lastSumLength + "----lastTime : " + lastTime + + " thread = "+ Thread.currentThread().getName()); - mCurrentOCHOrder.decreaseTravelDistance(lastSumLength); - if (mOrderStatusCallback != null) { - mOrderStatusCallback.onCurrentOrderDistToEndChanged((long) lastSumLength, (long) lastTime); + mCurrentOCHOrder.decreaseTravelDistance(lastSumLength); + if (mOrderStatusCallback != null) { + mOrderStatusCallback.onCurrentOrderDistToEndChanged((long) lastSumLength, (long) lastTime); + } + + reportOrderRemain((long) lastSumLength, (long) lastTime); + break; } - - reportOrderRemain((long) lastSumLength, (long) lastTime); - routeAndWipe(); } } private void routeAndWipe() { - if (mRoutePoints != null && mRoutePoints.size() > 0){ + if (mRoutePoints != null && mRoutePoints.size() > 0 && mLocation != null){ int haveArrivedIndex = CoordinateCalculateRouteUtil - .getArrivedPointIndex(mRoutePoints,mLongitude,mLatitude); + .getArrivedPointIndexNew(mPreRouteIndex, + mRoutePoints, + mLocation.getLongitude(), + mLocation.getLatitude()); + List routePoints = CoordinateCalculateRouteUtil + .coordinateConverterLocationToLatLng(mContext,mRoutePoints); if (mAutopilotPlanningCallback != null){ - mAutopilotPlanningCallback.routeResult(mRoutePoints,haveArrivedIndex); + mAutopilotPlanningCallback.routeResult(routePoints,haveArrivedIndex); } - setRouteLineMarker(mRoutePoints); + setRouteLineMarker(routePoints); } } @@ -1422,7 +1437,9 @@ public class TaxiModel { public void onSuccess(QueryOrderRouteResp data) { if (data != null && data.data != null && mRoutePoints.size() == 0) { mRoutePoints.clear(); - mRoutePoints.addAll(data.data); + List routePoints = CoordinateCalculateRouteUtil + .coordinateConverterLatlngToLocation(data.data); + mRoutePoints.addAll(routePoints); } } From c8c938788d734989391571260ddf9d211e01cf7e Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Mon, 28 Nov 2022 10:50:30 +0800 Subject: [PATCH 05/23] =?UTF-8?q?[2.13.0]=20taxi=20=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E8=A1=8C=E7=A8=8B=EF=BC=8C=E9=9D=9E=E8=87=AA=E9=A9=BE=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8B=E6=89=8D=E5=8F=AF=E7=BB=93=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/och/taxi/ui/BaseTaxiTabFragment.java | 1 - .../och/taxi/ui/TaxiBeingServerdOrdersFragment.java | 11 ++++++++++- .../main/java/com/mogo/och/taxi/ui/TaxiFragment.java | 8 -------- OCH/mogo-och-taxi/src/main/res/values/strings.xml | 3 +++ 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java index 21e62525d1..ac21cdf9f1 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java @@ -157,7 +157,6 @@ public abstract class BaseTaxiTabFragment您好,本次行程共%1$s%2$s,预计需要%3$d分钟,我们即将出发。出于安全考虑,建议您尽量不要与安全员交谈,后排落座,并系好安全带 即将到达目的地,请拿好随身物品,准备下车 您好,我们已到达目的地,本次体验结束。车辆停稳,请带好随身物品,谨防遗漏。感谢您的乘坐 + + 自动驾驶状态中,不可结束路线 + \ No newline at end of file From 0dda0336087b395180820d417827069dcab3b134 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 28 Nov 2022 11:20:56 +0800 Subject: [PATCH 06/23] =?UTF-8?q?2.13.0=20=E4=BC=98=E5=8C=96=E9=AD=94?= =?UTF-8?q?=E6=96=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/main/MainLauncherActivity.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java index e0cba95c86..792050b5f6 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java @@ -240,26 +240,26 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (event.getAction() == KeyEvent.ACTION_DOWN) { pressADownTime = System.currentTimeMillis(); Log.d(TAG, "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime); - if ((pressADownTime - startPressTime) > 350 && (pressADownTime - startPressTime) < 1800 && pressBDownTime > 0) { + if ((pressADownTime - startPressTime) > 320 && (pressADownTime - startPressTime) < 1600 && pressBDownTime > 0) { ToastUtils.showShort("方块 A 按AB组合 -2 "); sendAcc(true, -2); isCombinationKey = true; } if (!isCombinationKey) { - if ((pressADownTime - startPressTime) > 1900) { + if ((pressADownTime - startPressTime) > 1700) { ToastUtils.showShort("方块 长按A 无 操作 "); } } } else if (event.getAction() == KeyEvent.ACTION_UP) { pressAUpTime = System.currentTimeMillis(); - isPressEnd = false; - isCombinationKey = false; Log.e(TAG, "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime); - if ((pressAUpTime - startPressTime) < 300) { + if ((pressAUpTime - startPressTime) < 300 && !isCombinationKey) { ToastUtils.showShort("方块 单击A -1 "); sendAcc(true, -1); } - pressAUpTime = 0; + pressADownTime = 0; + isPressEnd = false; + isCombinationKey = false; } return true; @@ -267,27 +267,27 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (event.getAction() == KeyEvent.ACTION_DOWN) { pressBDownTime = System.currentTimeMillis(); Log.d(TAG, "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime); - if ((pressBDownTime - startPressTime) > 350 && (pressBDownTime - startPressTime) < 1800 && pressADownTime > 0) { + if ((pressBDownTime - startPressTime) > 320 && (pressBDownTime - startPressTime) < 1600 && pressADownTime > 0) { ToastUtils.showShort("方块 B 按AB组合 "); sendAcc(true, -2); isCombinationKey = true; } if (!isCombinationKey) { - if ((pressBDownTime - startPressTime) > 1900) { + if ((pressBDownTime - startPressTime) > 1700) { ToastUtils.showShort("方块 长按B =1 "); sendAcc(true, +1); } } } else if (event.getAction() == KeyEvent.ACTION_UP) { pressBUpTime = System.currentTimeMillis(); - isPressEnd = false; - isCombinationKey = false; Log.e(TAG, "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime); - if ((pressBUpTime - startPressTime) < 300) { + if ((pressBUpTime - startPressTime) < 300 && !isCombinationKey) { ToastUtils.showShort("方块 单击B 0 "); sendAcc(false, 0.0); } pressBDownTime = 0; + isPressEnd = false; + isCombinationKey = false; } return true; @@ -295,7 +295,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (event.getAction() == KeyEvent.ACTION_DOWN) { pressCDownTime = System.currentTimeMillis(); if (!isCombinationKey) { - if ((pressCDownTime - startPressTime) > 1900) { + if ((pressCDownTime - startPressTime) > 1700) { ToastUtils.showShort("方块 长按C 无操作 "); } } @@ -313,7 +313,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (event.getAction() == KeyEvent.ACTION_DOWN) { pressDDownTime = System.currentTimeMillis(); if (!isCombinationKey) { - if ((pressDDownTime - startPressTime) > 1900) { + if ((pressDDownTime - startPressTime) > 1700) { ToastUtils.showShort("方块 长按D 无操作 "); } } @@ -332,7 +332,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis if (event.getAction() == KeyEvent.ACTION_DOWN) { pressEDownTime = System.currentTimeMillis(); if (!isCombinationKey) { - if ((pressEDownTime - startPressTime) > 1900) { + if ((pressEDownTime - startPressTime) > 1700) { ToastUtils.showShort("方块 长按E 鸣笛 "); CallerAutoPilotManager.INSTANCE.sendOperatorSetHorn(1); if (timerHorn == null) { From 5f423d8ec0aa9370b41d1cfb1972b2b05bfe8b55 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Mon, 28 Nov 2022 14:56:05 +0800 Subject: [PATCH 07/23] =?UTF-8?q?[2.13.0=5Fupdate]=E8=B0=83=E6=95=B4V2X?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=AD=98=E5=85=A5=E6=B6=88=E6=81=AF=E7=9B=92?= =?UTF-8?q?=E5=AD=90=E7=9A=84=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../receiver/V2XWarningBroadcastReceiver.kt | 8 ++- .../obu/mogo/MogoPrivateObuManager.kt | 58 ++++++++++++++----- .../obu/mogo/MogoPrivateObuNewManager.kt | 58 +++++++++++++++---- .../function/v2x/events/V2XEventManager.kt | 13 ++++- .../scene/road/V2XRoadEventScenario.java | 10 +++- .../route/V2XOptimalRouteVREventScenario.java | 11 +++- .../warning/V2XFrontWarningScenario.java | 10 +++- .../redlightwarning/RedLightWarningManager.kt | 22 +++++-- .../core/function/v2x/vip/VipCarManager.kt | 11 +++- .../function/call/hmi/CallerHmiManager.kt | 2 - 10 files changed, 163 insertions(+), 40 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XWarningBroadcastReceiver.kt index 654cd73d26..7eb5d55f3d 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 @@ -77,7 +77,13 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() { if (EventTypeEnum.TYPE_USECASE_ID_IVP.poiType == v2xType.toString()) { CallerHmiManager.showLimitingVelocity(1) } + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg(v2xType.toString(), alertContent, ttsContent) + ) + ) CallerHmiManager.warningV2X(v2xType.toString(), alertContent, ttsContent, - tag, null, true, 5000L, MsgBoxType.V2X) + tag, null, true, 5000L) } } \ 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 index 00d0964f8d..4c49f58d58 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt @@ -378,7 +378,15 @@ class MogoPrivateObuManager private constructor() { //显示警告红边 TODO 需要确定是什么值 // CallerHmiManager.showWarning(direction) - //显示弹框,语音提示 + //不显示弹框,其它保留 + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg(appId, + alertContent, + ttsContent) + ) + ) CallerHmiManager.warningV2X( appId, alertContent, @@ -391,8 +399,7 @@ class MogoPrivateObuManager private constructor() { } }, true, - 5000L, - MsgBoxType.OBU + 5000L ) // 更新数据 TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { @@ -499,6 +506,14 @@ class MogoPrivateObuManager private constructor() { // if (level == 2 || level == 3) { //不考虑level //显示警告红边 CallerHmiManager.showWarning(direction) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg(v2xType, + alertContent, + ttsContent) + ) + ) CallerHmiManager.warningV2X( v2xType, alertContent, @@ -511,8 +526,7 @@ class MogoPrivateObuManager private constructor() { } }, true, - 5000L, - MsgBoxType.OBU + 5000L ) // } // 更新数据 @@ -707,10 +721,15 @@ class MogoPrivateObuManager private constructor() { 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT ttsContent = EventTypeEnum.getWarningTts(appId.toString()) alertContent = EventTypeEnum.getWarningContent(appId.toString()) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg(appId.toString(), alertContent, ttsContent) + ) + ) CallerHmiManager.warningV2X( appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 5000L, - MsgBoxType.OBU + appId.toString(), null, true, 5000L ) } 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT @@ -775,6 +794,14 @@ class MogoPrivateObuManager private constructor() { val maxSpeed = currentLight.glosa_suggested_speed_max.toInt() if (maxSpeed > 0) { + 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, @@ -782,8 +809,7 @@ class MogoPrivateObuManager private constructor() { appId.toString(), null, true, - 5000L, - MsgBoxType.OBU + 5000L ) } } @@ -899,8 +925,15 @@ class MogoPrivateObuManager private constructor() { "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" ) if (level == 2 || level == 3) { - // TODO:(只是不显示顶部弹窗,其它逻辑保留) - //显示弹框,语音提示 + //不显示顶部弹框,其它保留 + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg(appId.toString(), + alertContent, + ttsContent) + ) + ) CallerHmiManager.warningV2X( appId.toString(), alertContent, @@ -924,8 +957,7 @@ class MogoPrivateObuManager private constructor() { } }, true, - 5000L, - MsgBoxType.OBU + 5000L ) //显示警告红边 CallerHmiManager.showWarning(direction) 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 4c737d8af9..f9aab04f50 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 @@ -392,7 +392,15 @@ class MogoPrivateObuNewManager private constructor() { -> { //显示警告红边 // CallerHmiManager.showWarning(direction) - //显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 + //不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg(appId, + alertContent, + ttsContent) + ) + ) CallerHmiManager.warningV2X( appId, alertContent, @@ -405,8 +413,7 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L, - MsgBoxType.OBU + 3000L ) // 更新数据 TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let { @@ -471,6 +478,14 @@ class MogoPrivateObuNewManager private constructor() { // if (level == 2 || level == 3) { //不考虑level //显示警告红边 CallerHmiManager.showWarning(direction) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg(v2xType, + alertContent, + ttsContent) + ) + ) CallerHmiManager.warningV2X( v2xType, alertContent, @@ -483,8 +498,7 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L, - MsgBoxType.OBU + 3000L ) // } // 更新数据 @@ -668,7 +682,15 @@ class MogoPrivateObuNewManager private constructor() { "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" ) if (level == 2 || level == 3) { - //显示弹框,语音提示 + //不显示弹框,其它保留 + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg(appId, + alertContent, + ttsContent) + ) + ) CallerHmiManager.warningV2X( appId, alertContent, @@ -691,8 +713,7 @@ class MogoPrivateObuNewManager private constructor() { } }, true, - 3000L, - MsgBoxType.OBU + 3000L ) //显示警告红边 CallerHmiManager.showWarning(direction) @@ -779,9 +800,17 @@ class MogoPrivateObuNewManager private constructor() { 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg(appId.toString(), + alertContent, + ttsContent) + ) + ) CallerHmiManager.warningV2X( appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 3000L, MsgBoxType.OBU + appId.toString(), null, true, 3000L ) } 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT @@ -842,6 +871,14 @@ class MogoPrivateObuNewManager private constructor() { val maxSpeed = currentLight.suggestMaxSpeed if (maxSpeed > 0) { + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + alertContent, + ttsContent) + ) + ) CallerHmiManager.warningV2X( EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, @@ -849,8 +886,7 @@ class MogoPrivateObuNewManager private constructor() { appId.toString(), null, true, - 3000L, - MsgBoxType.OBU + 3000L ) } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index dc3f3c1fe1..38bc5888a1 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -575,7 +575,15 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } } } - // 显示弹框,语音提示 + // 不显示弹框,其它保留 + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg(tempAppId.toString(), + tempContent, + tempTts) + ) + ) CallerHmiManager.warningV2X( tempAppId.toString(), tempContent, @@ -596,8 +604,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } }, true, - 5000L, - MsgBoxType.V2X + 5000L ) CallerMapUIServiceManager.getMarkerService()?.updateITrafficInfo(trafficData) } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java index 9f11092a54..8d1031e440 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java @@ -98,9 +98,17 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp V2XRoadEventEntity content = entity != null ? entity.getContent() : null; if (content != null) { // //显示警告红边 + CallerMsgBoxManager.INSTANCE.saveMsgBox( + new MsgBoxBean( + MsgBoxType.V2X, + new V2XMsg(content.getPoiType(), + content.getAlarmContent(), + content.getTts()) + ) + ); CallerHmiManager.INSTANCE.warningV2X(content.getPoiType(), content.getAlarmContent(), content.getTts(), TAG, this, !entity.isOnlyShow(), - TimeUnit.SECONDS.toMillis(5), MsgBoxType.V2X); + TimeUnit.SECONDS.toMillis(5)); } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java index a091955b76..ec4f9c1864 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/route/V2XOptimalRouteVREventScenario.java @@ -57,10 +57,17 @@ public class V2XOptimalRouteVREventScenario if (entity != null) { V2XOptimalRouteDataRes content = entity.getContent(); if (content != null) { + CallerMsgBoxManager.INSTANCE.saveMsgBox( + new MsgBoxBean( + MsgBoxType.V2X, + new V2XMsg(entity.getType() + "", + "为您推荐最优路线", + "已为您选择最优路线") + ) + ); CallerHmiManager.INSTANCE.warningV2X(entity.getType() + "", "为您推荐最优路线", "已为您选择最优路线", TAG, - this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(30), - MsgBoxType.V2X); + this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(30)); } } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java index 0682923143..b53b27f6ea 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java @@ -63,10 +63,18 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL int v2xType = getV2XTypeForFrontWarning(mMarkerEntity); V2XMessageEntity entity = getV2XMessageEntity(); if (v2xType != 0) { + CallerMsgBoxManager.INSTANCE.saveMsgBox( + new MsgBoxBean( + MsgBoxType.V2X, + new V2XMsg(v2xType + "", + getAlertContentForFrontWarning(mMarkerEntity).toString(), + mMarkerEntity.getTts()) + ) + ); CallerHmiManager.INSTANCE.warningV2X(v2xType + "", getAlertContentForFrontWarning(mMarkerEntity), mMarkerEntity.getTts(), TAG, this, !entity.isOnlyShow(), - TimeUnit.SECONDS.toMillis(3), MsgBoxType.V2X); + TimeUnit.SECONDS.toMillis(3)); } } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt index 6d72796f41..40c412f93e 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt @@ -204,6 +204,14 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, private fun redLightWarning() { CallerLogger.d("$M_V2X$TAG", "=====闯红灯预警=====") ThreadUtils.runOnUiThread { + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg(EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, + EventTypeEnum.TYPE_USECASE_ID_IVP.content, + EventTypeEnum.TYPE_USECASE_ID_IVP.tts) + ) + ) CallerHmiManager.warningV2X( EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, EventTypeEnum.TYPE_USECASE_ID_IVP.content, @@ -211,8 +219,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, EventTypeEnum.TYPE_USECASE_ID_IVP.poiType, null, true, - 5000L, - MsgBoxType.V2X + 5000L ) } } @@ -232,6 +239,14 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), speed ) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, + content, + tts) + ) + ) CallerHmiManager.warningV2X( EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, content, @@ -239,8 +254,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, null, true, - 5000L, - MsgBoxType.V2X + 5000L ) } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt index 449357c729..507a6d9dfd 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt @@ -245,6 +245,14 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe ttsContent: String, tag: String ) { + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.V2X, + V2XMsg(v2xType, + alertContent.toString(), + ttsContent) + ) + ) CallerHmiManager.warningV2X( v2xType, alertContent, ttsContent, tag, object : IMoGoWarningStatusListener { @@ -252,8 +260,7 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe override fun onDismiss() {} }, true, - 5000L, - MsgBoxType.V2X + 5000L ) } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index 355c7d50a3..d382f96463 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -161,9 +161,7 @@ object CallerHmiManager : CallerBase() { listenerIMoGo: IMoGoWarningStatusListener?, playTts: Boolean, expireTime: Long = 5000L, - msgBoxType: MsgBoxType ) { - saveMsgBox(MsgBoxBean(msgBoxType, V2XMsg(v2xType, alertContent?.toString() ?: "", ttsContent))) waringProviderApi?.warningV2X( v2xType, alertContent, From 37f74147444239591503a0fb3216ce907dec7160 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Thu, 24 Nov 2022 18:57:33 +0800 Subject: [PATCH 08/23] [2.13.0]wait to change --- .../identify/TrackerSourceColorHelper.kt | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt index 49a52b6033..6109b19a93 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt @@ -59,7 +59,7 @@ object TrackerSourceColorHelper { } // pnc预警 - WarningHelper.getPncColor(data.uuid.toString()){ + WarningHelper.getPncColor(data.uuid.toString()) { if (it.isNotBlank()) { color = it } @@ -111,26 +111,29 @@ object TrackerSourceColorHelper { */ @SuppressLint("NewApi") fun isV2I(data: TrackedObject): Pair { - val source = data.trackedSourceList.stream().allMatch { - it.source == 4 - } - if (source) { - val first = data.trackedSourceList.stream() - .filter { trackedSource: TrackedSource -> trackedSource.source == 4 }.findFirst() - if (first.isPresent) { - val subV2I = first.get().subSourceList.stream().allMatch { - it.source == 6 - } - if (subV2I) { - val subFirst = first.get().subSourceList.stream() - .filter { subSource: SubSource -> subSource.source == 6 } - .findFirst() - if (subFirst.isPresent) { - return Pair(subFirst.get(), true) + if (data.trackedSourceList.size == 1) { // 如果仅有一个类型 + val source = data.trackedSourceList.stream().allMatch { it.source == 2 } + if (source) { + val first = data.trackedSourceList.stream() + .filter { trackedSource: TrackedSource -> trackedSource.source == 2 } + .findFirst() + if (first.isPresent) { + val subV2I = first.get().subSourceList.stream().allMatch { + it.source == 6 + } + if (subV2I) { + val subFirst = first.get().subSourceList.stream() + .filter { subSource: SubSource -> subSource.source == 6 } + .findFirst() + if (subFirst.isPresent) { + return Pair(subFirst.get(), true) + } } } } } return Pair(null, false) } + + } \ No newline at end of file From ebc451d00dc0f22e7ef85b9feec9617280498ab1 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Mon, 28 Nov 2022 10:21:47 +0800 Subject: [PATCH 09/23] [2.13.0]gradle --- .../mogo-core-function-bindingcar/build.gradle | 6 ------ .../function-impl/mogo-core-function-carcorder/build.gradle | 1 - core/function-impl/mogo-core-function-map/build.gradle | 2 -- .../function/business/identify/TrackerSourceColorHelper.kt | 6 +++--- core/function-impl/mogo-core-function-msgbox/build.gradle | 6 ------ foudations/mogo-commons/build.gradle | 2 -- modules/mogo-module-common/build.gradle | 6 ------ 7 files changed, 3 insertions(+), 26 deletions(-) diff --git a/core/function-impl/mogo-core-function-bindingcar/build.gradle b/core/function-impl/mogo-core-function-bindingcar/build.gradle index 111633d37e..e498d7efa5 100644 --- a/core/function-impl/mogo-core-function-bindingcar/build.gradle +++ b/core/function-impl/mogo-core-function-bindingcar/build.gradle @@ -52,12 +52,8 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation rootProject.ext.dependencies.kotlinstdlibjdk7 - implementation rootProject.ext.dependencies.androidxccorektx - implementation rootProject.ext.dependencies.androidxappcompat - implementation rootProject.ext.dependencies.androidxconstraintlayout implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.rxandroid - implementation rootProject.ext.dependencies.androidxrecyclerview implementation rootProject.ext.dependencies.androidxroomruntime implementation rootProject.ext.dependencies.androidxroomktx implementation rootProject.ext.dependencies.litezxing @@ -71,7 +67,6 @@ dependencies { implementation rootProject.ext.dependencies.mogo_core_data implementation rootProject.ext.dependencies.mogo_core_utils - implementation rootProject.ext.dependencies.mogo_core_res implementation rootProject.ext.dependencies.mogo_core_network implementation rootProject.ext.dependencies.mogo_core_function_call } else { @@ -81,7 +76,6 @@ dependencies { implementation project(':core:mogo-core-data') implementation project(':core:mogo-core-utils') - implementation project(':core:mogo-core-res') implementation project(':core:mogo-core-network') implementation project(':core:mogo-core-function-call') } diff --git a/core/function-impl/mogo-core-function-carcorder/build.gradle b/core/function-impl/mogo-core-function-carcorder/build.gradle index d612fd342f..dbef31ffe6 100644 --- a/core/function-impl/mogo-core-function-carcorder/build.gradle +++ b/core/function-impl/mogo-core-function-carcorder/build.gradle @@ -47,7 +47,6 @@ dependencies { implementation rootProject.ext.dependencies.coroutinescore implementation rootProject.ext.dependencies.arouter kapt rootProject.ext.dependencies.aroutercompiler - implementation rootProject.ext.dependencies.mogologlib if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogoserviceapi diff --git a/core/function-impl/mogo-core-function-map/build.gradle b/core/function-impl/mogo-core-function-map/build.gradle index 87a85a74c5..01e097ded7 100644 --- a/core/function-impl/mogo-core-function-map/build.gradle +++ b/core/function-impl/mogo-core-function-map/build.gradle @@ -80,7 +80,6 @@ dependencies { implementation rootProject.ext.dependencies.mogomap implementation rootProject.ext.dependencies.mogomapapi - implementation rootProject.ext.dependencies.moduleservice } else { implementation project(':modules:mogo-module-common') implementation project(':services:mogo-service-api') @@ -93,7 +92,6 @@ dependencies { implementation project(":libraries:mogo-map") implementation project(":libraries:mogo-map-api") - implementation project(':libraries:mogo-adas') } } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt index 6109b19a93..e4ae0f16f5 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt @@ -73,7 +73,7 @@ object TrackerSourceColorHelper { @SuppressLint("NewApi") fun isIPC(data: TrackedObject): Boolean { val source = data.trackedSourceList.stream().allMatch { - it.source != 4 + it.source != 2 } return source } @@ -84,11 +84,11 @@ object TrackerSourceColorHelper { @SuppressLint("NewApi") fun isObu(data: TrackedObject): Pair { val source = data.trackedSourceList.stream().anyMatch { - it.source == 4 + it.source == 2 } if (source) { val first = data.trackedSourceList.stream() - .filter { trackedSource: TrackedSource -> trackedSource.source == 4 }.findFirst() + .filter { trackedSource: TrackedSource -> trackedSource.source == 2}.findFirst() if (first.isPresent) { val subObu = first.get().subSourceList.stream().anyMatch { it.source == 1 diff --git a/core/function-impl/mogo-core-function-msgbox/build.gradle b/core/function-impl/mogo-core-function-msgbox/build.gradle index ea1bfe7e00..f1726248b0 100644 --- a/core/function-impl/mogo-core-function-msgbox/build.gradle +++ b/core/function-impl/mogo-core-function-msgbox/build.gradle @@ -55,21 +55,15 @@ dependencies { implementation rootProject.ext.dependencies.androidxroomktx if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { -// implementation rootProject.ext.dependencies.modulecommon -// implementation rootProject.ext.dependencies.moduleservice implementation rootProject.ext.dependencies.mogo_core_data implementation rootProject.ext.dependencies.mogo_core_utils implementation rootProject.ext.dependencies.mogo_core_function_api implementation rootProject.ext.dependencies.mogo_core_function_call - implementation rootProject.ext.dependencies.mogo_core_res } else { -// implementation project(':modules:mogo-module-common') -// implementation project(':modules:mogo-module-service') implementation project(':core:mogo-core-data') implementation project(':core:mogo-core-utils') implementation project(':core:mogo-core-function-api') implementation project(':core:mogo-core-function-call') - implementation project(':core:mogo-core-res') } } diff --git a/foudations/mogo-commons/build.gradle b/foudations/mogo-commons/build.gradle index 585c2ce5e7..296811e92f 100644 --- a/foudations/mogo-commons/build.gradle +++ b/foudations/mogo-commons/build.gradle @@ -45,7 +45,6 @@ dependencies { implementation rootProject.ext.dependencies.amapnavi3dmap if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { - implementation rootProject.ext.dependencies.mogo_core_utils api rootProject.ext.dependencies.mogoaicloudservicesdk api rootProject.ext.dependencies.ttsbase @@ -53,7 +52,6 @@ dependencies { implementation rootProject.ext.dependencies.mogo_core_utils api rootProject.ext.dependencies.mogo_core_network } else { - implementation project(':core:mogo-core-utils') api project(":foudations:mogo-aicloud-services-sdk") api project(":tts:tts-base") diff --git a/modules/mogo-module-common/build.gradle b/modules/mogo-module-common/build.gradle index beb04e3c10..9c162e334c 100644 --- a/modules/mogo-module-common/build.gradle +++ b/modules/mogo-module-common/build.gradle @@ -55,12 +55,6 @@ dependencies { api rootProject.ext.dependencies.mogoaicloudrealtime - implementation rootProject.ext.dependencies.coroutinesandroid - implementation rootProject.ext.dependencies.coroutinescore - - implementation rootProject.ext.dependencies.mogoobuold - implementation rootProject.ext.dependencies.mogoobu - annotationProcessor 'com.elegant.spi:compiler:1.0.3' if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { From 12cffa44f7b893d2df075c2dfb38376d5a96c04e Mon Sep 17 00:00:00 2001 From: zhongchao Date: Mon, 28 Nov 2022 11:11:59 +0800 Subject: [PATCH 10/23] [2.13.0]wait to finish --- .../business/identify/TrackerSourceColorHelper.kt | 12 ++++++++---- .../core/function/notice/NoticeSocketManager.java | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt index e4ae0f16f5..052817fffa 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt @@ -72,10 +72,14 @@ object TrackerSourceColorHelper { */ @SuppressLint("NewApi") fun isIPC(data: TrackedObject): Boolean { - val source = data.trackedSourceList.stream().allMatch { - it.source != 2 + return if (data.trackedSourceList.size == 1) { // 如果仅有一个类型 + val source = data.trackedSourceList.stream().allMatch { + it.source == 1 + } + source + } else { + false } - return source } /** @@ -88,7 +92,7 @@ object TrackerSourceColorHelper { } if (source) { val first = data.trackedSourceList.stream() - .filter { trackedSource: TrackedSource -> trackedSource.source == 2}.findFirst() + .filter { trackedSource: TrackedSource -> trackedSource.source == 2 }.findFirst() if (first.isPresent) { val subObu = first.get().subSourceList.stream().anyMatch { it.source == 1 diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java index bc750ef0f0..8607c4527d 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java @@ -81,6 +81,7 @@ class NoticeSocketManager { @Override public void onMsgReceived(NoticeTrafficStylePushData obj) { CallerLogger.INSTANCE.d(M_NOTICE + TAG, "301001-- 交警类型公告数据:" + GsonUtil.jsonFromObject(obj)); + // todo CallerHmiManager.INSTANCE.showTrafficBanner(obj); } }; From 636b29b1275b35feb313d027d619586278960f53 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Mon, 28 Nov 2022 17:31:50 +0800 Subject: [PATCH 11/23] [2.13.0]notice push data to msgbox and provider the call of hmi --- .../eagle/core/function/hmi/WaringConst.java | 4 - .../core/function/hmi/ui/MoGoHmiFragment.kt | 151 ++++++------------ .../hmi/ui/notice/NoticeBannerView.java | 21 +-- .../hmi/ui/notice/NoticeCheckDialog.kt | 2 - .../hmi/ui/notice/NoticeNormalBannerView.java | 3 - .../hmi/ui/setting/DebugSettingView.kt | 2 + .../hmi/ui/widget/SpeedChartView.java | 1 - .../main/res/layout/view_debug_setting.xml | 10 ++ .../identify/TrackerSourceColorHelper.kt | 49 +++++- .../function/notice/NoticeSocketManager.java | 6 +- .../function/call/hmi/CallerHmiManager.kt | 2 - 11 files changed, 112 insertions(+), 139 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java index 65724e8c34..ea279ade8b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java @@ -31,9 +31,5 @@ public class WaringConst { public static String BROADCAST_V2X_LIMITING_VELOCITY_IS_SHOW__EXTRA_KEY = "limitingVelocityIsShow"; // 限速的速度 public static String BROADCAST_V2X_LIMITING_VELOCITY_SPEED__EXTRA_KEY = "limitingVelocitySpeed"; - // 交警任务 - public static String NOTICE_FOR_TRAFFIC_KEY = "noticeForTraffic"; - //普通公告弹框 - public static String NOTICE_FOR_NORMAL_KEY = "noticeForNotice"; } 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 6c440aaf32..5844a486fa 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 @@ -23,7 +23,6 @@ import com.alibaba.android.arouter.launcher.ARouter import com.mogo.cloud.passport.MoGoAiCloudClient import com.mogo.commons.AbsMogoApplication import com.mogo.commons.debug.DebugConfig -import com.mogo.eagle.core.data.enums.EventTypeEnum import com.mogo.commons.mvp.BaseFragment import com.mogo.commons.mvp.MvpFragment import com.mogo.commons.voice.* @@ -36,6 +35,7 @@ import com.mogo.eagle.core.data.config.HmiBuildConfig 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.enums.EventTypeEnum import com.mogo.eagle.core.data.enums.SidePattern import com.mogo.eagle.core.data.enums.SidePattern.* import com.mogo.eagle.core.data.enums.WarningDirectionEnum @@ -69,7 +69,6 @@ import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.function.hmi.WaringConst import com.mogo.eagle.core.function.hmi.notification.WarningFloat import com.mogo.eagle.core.function.hmi.notification.anim.DefaultAnimator import com.mogo.eagle.core.function.hmi.ui.bindingcar.ModifyBindingCarDialog @@ -77,8 +76,8 @@ import com.mogo.eagle.core.function.hmi.ui.bindingcar.ToBindingCarDialog import com.mogo.eagle.core.function.hmi.ui.bindingcar.UpgradeAppDialog import com.mogo.eagle.core.function.hmi.ui.camera.CameraListView import com.mogo.eagle.core.function.hmi.ui.camera.RoadVideoDialog -import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView -import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView +import com.mogo.eagle.core.function.hmi.ui.notice.NoticeCheckDialog +import com.mogo.eagle.core.function.hmi.ui.notice.NoticeTrafficDialog import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView import com.mogo.eagle.core.function.hmi.ui.setting.IPCReportWindow import com.mogo.eagle.core.function.hmi.ui.setting.ReportListFloatWindow @@ -141,8 +140,6 @@ class MoGoHmiFragment : MvpFragment(), //StatusView private var statusBarView: StatusBarView? = null - private var mNoticeFloat: WarningFloat.Builder? = null - // 超视距、路侧、前车直播 private var cameraListView: CameraListView? = null private var cameraViewFloat: WarningFloat.Builder? = null @@ -280,15 +277,19 @@ class MoGoHmiFragment : MvpFragment(), //美化模式隐藏开关 viewDemoModeSwitch.setOnClickListener { //只在司机端设置美化模式开关功能 - if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){ + if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) { //单次查询,是否有行程信息(订单进行中时点击不生效),autopilotControlParameters为null代表不处于自动驾驶状态下 - if(CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().autopilotControlParameters == null){ + if (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().autopilotControlParameters == null) { FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode context?.let { - CallerHmiManager.updateStatusBarRightView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(it)) + CallerHmiManager.updateStatusBarRightView( + FunctionBuildConfig.isDemoMode, + "demoMode", + DemoModeView(it) + ) } CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode) - if(!FunctionBuildConfig.isDemoMode){ + if (!FunctionBuildConfig.isDemoMode) { //关闭美化模式时,通知工控机 CallerAutoPilotManager.setIPCDemoMode(FunctionBuildConfig.isDemoMode) } @@ -322,8 +323,14 @@ class MoGoHmiFragment : MvpFragment(), override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) { CallerLogger.d("$M_HMI$TAG", "recordKey=${recordPanel.key},stat=${recordPanel.stat}") - CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.RECORD, RecordBagMsg(recordPanel.key, recordPanel.stat, recordPanel.id, - recordPanel.type, recordPanel.filename, recordPanel.note))) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.RECORD, RecordBagMsg( + recordPanel.key, recordPanel.stat, recordPanel.id, + recordPanel.type, recordPanel.filename, recordPanel.note + ) + ) + ) if (BadCaseConfig.recordKeyList.contains(recordPanel.key)) { if (recordPanel.stat == 100 || recordPanel.stat == 101) { //成功结束录制 @@ -511,7 +518,7 @@ class MoGoHmiFragment : MvpFragment(), .setGravity(Gravity.LEFT) .setImmersionStatusBar(true) .setWindowHeight(LayoutParams.MATCH_PARENT) - .setWindowWidth(AutoSizeUtils.dp2px(context,960f)) + .setWindowWidth(AutoSizeUtils.dp2px(context, 960f)) .setAnimator(object : DefaultAnimator() { override fun enterAnim( view: View, @@ -694,8 +701,8 @@ class MoGoHmiFragment : MvpFragment(), .setSidePattern(side) .setGravity(gravity, offsetY = 70) .setImmersionStatusBar(true) - .setWindowHeight(AutoSizeUtils.dp2px(context,1100f)) - .setWindowWidth(AutoSizeUtils.dp2px(context,800f)) + .setWindowHeight(AutoSizeUtils.dp2px(context, 1100f)) + .setWindowWidth(AutoSizeUtils.dp2px(context, 800f)) .setAnimator(object : DefaultAnimator() { override fun enterAnim( view: View, @@ -747,8 +754,8 @@ class MoGoHmiFragment : MvpFragment(), .setSidePattern(side) .setGravity(gravity, offsetY = 70) .setImmersionStatusBar(true) - .setWindowWidth(AutoSizeUtils.dp2px(context,800f)) - .setWindowHeight(AutoSizeUtils.dp2px(context,1100f)) + .setWindowWidth(AutoSizeUtils.dp2px(context, 800f)) + .setWindowHeight(AutoSizeUtils.dp2px(context, 1100f)) .setAnimator(object : DefaultAnimator() { override fun enterAnim( view: View, @@ -1126,105 +1133,37 @@ class MoGoHmiFragment : MvpFragment(), clearAnimation(flV2XWarningView) } + private var noticeTrafficDialog: NoticeTrafficDialog? = null + /** - * 展示云公告顶部弹窗 + * 展示云公告交警详情 * @param trafficStylePushData */ override fun showNoticeForTrafficWithData(trafficStylePushData: NoticeTrafficStylePushData?) { + if (trafficStylePushData == null) { + return + } ThreadUtils.runOnUiThread { - activity?.let { - val noticeBannerView = this.context?.let { it1 -> NoticeBannerView(it1) } - noticeBannerView?.refreshWithData(trafficStylePushData) - mNoticeFloat = it?.let { it1 -> - noticeBannerView?.let { it2 -> - WarningFloat.with(it1) - .setTag(WaringConst.NOTICE_FOR_TRAFFIC_KEY) - .setLayout(it2) - .setSidePattern(SidePattern.TOP) - .setCountDownTime(60 * 1000 * 3) - .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) - .setImmersionStatusBar(true) - .addWarningStatusListener(object : IMoGoWarningStatusListener { - override fun onShow() { - // 创建弹窗成功才进行TTS播报 -// AIAssist.getInstance(activity) -// .speakTTSVoice("") - } - - }) - .setAnimator(object : DefaultAnimator() { - override fun enterAnim( - view: View, - params: LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.enterAnim(view, params, windowManager, sidePattern) - ?.apply { - interpolator = OvershootInterpolator() - } - - override fun exitAnim( - view: View, - params: LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.exitAnim(view, params, windowManager, sidePattern) - ?.setDuration(200) - }) - .show() - } - } + context?.let { + noticeTrafficDialog = NoticeTrafficDialog(it, trafficStylePushData) + noticeTrafficDialog?.show() } } } - override fun showNoticeNormalData(normalData: NoticeNormalData?) { - ThreadUtils.runOnUiThread { - activity?.let { - val noticeBannerView = this.context?.let { it1 -> NoticeNormalBannerView(it1) } - noticeBannerView?.setPushData(normalData) - mNoticeFloat = it.let { it1 -> - noticeBannerView?.let { it2 -> - WarningFloat.with(it1) - .setTag(WaringConst.NOTICE_FOR_NORMAL_KEY) - .setLayout(it2) - .setSidePattern(SidePattern.TOP) - .setCountDownTime(10000) - .setGravity(Gravity.CENTER_HORIZONTAL, offsetY = 110) - .setImmersionStatusBar(true) - .addWarningStatusListener(object : IMoGoWarningStatusListener { - override fun onShow() { - // 创建弹窗成功才进行TTS播报 - // AIAssist.getInstance(activity) - // .speakTTSVoice("") - } - }) - .setAnimator(object : DefaultAnimator() { - override fun enterAnim( - view: View, - params: LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.enterAnim(view, params, windowManager, sidePattern) - ?.apply { - interpolator = OvershootInterpolator() - } + private var pushCheckDialog: NoticeCheckDialog? = null - override fun exitAnim( - view: View, - params: LayoutParams, - windowManager: WindowManager, - sidePattern: SidePattern - ): Animator? = - super.exitAnim(view, params, windowManager, sidePattern) - ?.setDuration(200) - }) - .show() - } - } + /** + * 展示云公告详情 + */ + override fun showNoticeNormalData(normalData: NoticeNormalData?) { + if (normalData == null) { + return + } + ThreadUtils.runOnUiThread { + context?.let { + pushCheckDialog = NoticeCheckDialog(it) + pushCheckDialog?.showCheckDialog(normalData) } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java index 7b0271d048..20bcb27dac 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeBannerView.java @@ -12,11 +12,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintLayout; -import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo; import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData; import com.mogo.eagle.core.function.hmi.R; -import com.mogo.eagle.core.function.hmi.WaringConst; -import com.mogo.eagle.core.function.hmi.notification.WarningFloat; 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.BitmapHelper; @@ -67,14 +64,11 @@ public class NoticeBannerView extends ConstraintLayout { (30f, GlideRoundedCornersTransform.CornerType.LEFT)).into(styleImageView); } else { iconImageView.setVisibility(View.VISIBLE); - new Thread(new Runnable() { - @Override - public void run() { - Bitmap firstBitmap = BitmapHelper.getVideoThumbnail(mPushData.getPoiImgUrl());/*获取第一帧图*/ - ThreadUtils.runOnUiThread(()->{ - styleImageView.setImageBitmap(firstBitmap); - }); - } + new Thread(() -> { + Bitmap firstBitmap = BitmapHelper.getVideoThumbnail(mPushData.getPoiImgUrl());/*获取第一帧图*/ + ThreadUtils.runOnUiThread(()->{ + styleImageView.setImageBitmap(firstBitmap); + }); }); }; } @@ -89,12 +83,7 @@ public class NoticeBannerView extends ConstraintLayout { noticeBannerCheck.setOnClickListener(v -> { mNoticeTrafficDialog = new NoticeTrafficDialog(mContext, mPushData); mNoticeTrafficDialog.show(); - WarningFloat.dismiss(WaringConst.NOTICE_FOR_TRAFFIC_KEY); }); } - //数据改变刷新UI - public void pushBeanChanged(NoticeTrafficStyleInfo info) { - - } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt index ae92070f39..d5779981bd 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeCheckDialog.kt @@ -19,7 +19,6 @@ import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTran import com.mogo.eagle.core.utilcode.util.BitmapHelper import com.mogo.eagle.core.widget.media.video.NoticeSimpleVideoPlayer import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog -import com.mogo.service.IMogoServiceApis import com.shuyu.gsyvideoplayer.GSYVideoManager import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack @@ -43,7 +42,6 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO private var mVideoUrl: String = "" private var playErrorImageView: ImageView? = null private var connectTextView: TextView? = null - private var mServiceApis: IMogoServiceApis? = null private val statusChangedListenerForCheckNotice = IMogoStatusChangedListener { descriptor, isTrue -> if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) { dismiss() diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java index a6d3af65ed..2344915d7b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeNormalBannerView.java @@ -13,8 +13,6 @@ import androidx.constraintlayout.widget.ConstraintLayout; import com.mogo.eagle.core.data.notice.NoticeNormalData; import com.mogo.eagle.core.function.hmi.R; -import com.mogo.eagle.core.function.hmi.WaringConst; -import com.mogo.eagle.core.function.hmi.notification.WarningFloat; import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp; import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform; @@ -80,7 +78,6 @@ public class NoticeNormalBannerView extends ConstraintLayout { } pushCheckDialog.showCheckDialog(mPushData); - WarningFloat.dismiss(WaringConst.NOTICE_FOR_NORMAL_KEY); }); } 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 070a9421e2..2f88146da9 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 @@ -685,6 +685,7 @@ class DebugSettingView @JvmOverloads constructor( 1 -> R.id.trackerIPC 2 -> R.id.trackerIPCObu 3 -> R.id.trackerIPCV2I + 4 -> R.id.trackerIPCV2nRsm else -> R.id.trackerIPCUnion } ) @@ -694,6 +695,7 @@ class DebugSettingView @JvmOverloads constructor( R.id.trackerIPC -> FunctionBuildConfig.trackerIPCProvider = 1 R.id.trackerIPCObu -> FunctionBuildConfig.trackerIPCProvider = 2 R.id.trackerIPCV2I -> FunctionBuildConfig.trackerIPCProvider = 3 + R.id.trackerIPCV2nRsm -> FunctionBuildConfig.trackerIPCProvider = 4 } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedChartView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedChartView.java index 6560fadda6..f6d69a53ee 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedChartView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SpeedChartView.java @@ -13,7 +13,6 @@ import android.view.View; import androidx.annotation.Nullable; import com.mogo.eagle.core.function.hmi.R; -import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView; /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index ec80635375..b25b5cb22b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -1886,6 +1886,16 @@ android:textColor="#000" android:textSize="@dimen/dp_24" /> + + diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt index 052817fffa..4a9acd8673 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt @@ -30,6 +30,11 @@ object TrackerSourceColorHelper { trackIPCFilter = false } } + 4 -> { + if(isV2nRSM(data).second){ + trackIPCFilter = false + } + } } return trackIPCFilter } @@ -46,7 +51,7 @@ object TrackerSourceColorHelper { color = "#00AEFFFF" } - //等级最高 + //level : 2 if (isObu(data).second) { color = "#36D3FEFF" // obu预警 @@ -58,6 +63,11 @@ object TrackerSourceColorHelper { } } + //融合结果 level : 1 + if (isFusion(data)) { + color = "#9900ffFF" + } + // pnc预警 WarningHelper.getPncColor(data.uuid.toString()) { if (it.isNotBlank()) { @@ -82,6 +92,13 @@ object TrackerSourceColorHelper { } } + /** + * 是否为融合数据,融合数据来源size >=2 + */ + fun isFusion(data: TrackedObject): Boolean { + return data.trackedSourceList.size > 1 + } + /** * any match 任何一个匹配到OBU,则认为是存在obu数据 */ @@ -140,4 +157,34 @@ object TrackerSourceColorHelper { } + /** + * 过滤所有 v2n 感知数据 all match + */ + @SuppressLint("NewApi") + fun isV2nRSM(data: TrackedObject): Pair { + if (data.trackedSourceList.size == 1) { // 如果仅有一个类型 + val source = data.trackedSourceList.stream().allMatch { it.source == 2 } + if (source) { + val first = data.trackedSourceList.stream() + .filter { trackedSource: TrackedSource -> trackedSource.source == 2 } + .findFirst() + if (first.isPresent) { + val subV2nRSM = first.get().subSourceList.stream().allMatch { + it.source == 4 + } + if (subV2nRSM) { + val subFirst = first.get().subSourceList.stream() + .filter { subSource: SubSource -> subSource.source == 4 } + .findFirst() + if (subFirst.isPresent) { + return Pair(subFirst.get(), true) + } + } + } + } + } + return Pair(null, false) + } + + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java index 8607c4527d..cdbcd1609f 100644 --- a/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java +++ b/core/function-impl/mogo-core-function-notice/src/main/java/com/mogo/eagle/core/function/notice/NoticeSocketManager.java @@ -9,7 +9,6 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxBean; import com.mogo.eagle.core.data.msgbox.MsgBoxType; import com.mogo.eagle.core.data.notice.NoticeNormalData; import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData; -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.network.utils.GsonUtil; @@ -64,7 +63,7 @@ class NoticeSocketManager { if (obj == null) { return; } - CallerHmiManager.INSTANCE.showNoticeNormalData(obj); + CallerMsgBoxManager.INSTANCE.saveMsgBox(new MsgBoxBean(MsgBoxType.NOTICE,obj)); } }; @@ -81,8 +80,7 @@ class NoticeSocketManager { @Override public void onMsgReceived(NoticeTrafficStylePushData obj) { CallerLogger.INSTANCE.d(M_NOTICE + TAG, "301001-- 交警类型公告数据:" + GsonUtil.jsonFromObject(obj)); - // todo - CallerHmiManager.INSTANCE.showTrafficBanner(obj); + CallerMsgBoxManager.INSTANCE.saveMsgBox(new MsgBoxBean(MsgBoxType.NOTICE,obj)); } }; } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index d382f96463..9e277bb883 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -22,7 +22,6 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox import com.zhjt.service_biz.BizConfig @@ -299,7 +298,6 @@ object CallerHmiManager : CallerBase() { * */ fun showNoticeNormalData(noticeNormal: NoticeNormalData) { - saveMsgBox(MsgBoxBean(MsgBoxType.NOTICE, noticeNormal)) waringProviderApi?.showNoticeNormalData(noticeNormal) } From f070106fe0a99e538f69c8625788654187a0efb1 Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Mon, 28 Nov 2022 18:35:13 +0800 Subject: [PATCH 12/23] =?UTF-8?q?[2.13.0]=20bus=20=E5=BC=80=E5=A7=8B?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=BB=BB=E5=8A=A1=E5=89=8D=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/och/bus/model/BusOrderModel.java | 76 ++++++++++++++++++- .../src/main/res/values/strings.xml | 2 + .../och/common/module/utils/DateTimeUtil.java | 10 +++ 3 files changed, 85 insertions(+), 3 deletions(-) diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java index 34192243a7..ed4b9da724 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java @@ -32,8 +32,10 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; +import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; import com.mogo.eagle.core.utilcode.util.NetworkUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils; +import com.mogo.eagle.core.utilcode.util.UiThreadHandler; import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.module.common.MogoApisHandler; import com.mogo.och.bus.R; @@ -117,9 +119,7 @@ public class BusOrderModel { private volatile int firstStartAutopilot = 0; private LoginService loginService; - - private long prePassengerWriteOffTime = 0; //记录最后查询到乘客核销的时间 - + private final Handler handler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(Message msg) { @@ -443,6 +443,7 @@ public class BusOrderModel { clearAutopilotControlParameters(); closeBeautificationMode(); clearStartAutopilotTag(); + removeTipRunnables(); return; } CallerLogger.INSTANCE.d(M_BUS + TAG, "获取到小巴路线数据: " + data); @@ -797,6 +798,11 @@ public class BusOrderModel { BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.START_TRIP , busRoutesResult.getName(), "", "", false); } + + //任务选择后首发前给司机提示任务 + if (busRoutesResult != null){ + beforeTaskTips(); + } // startOrStopQueryPassengerWriteOff(true); } @@ -836,6 +842,70 @@ public class BusOrderModel { BusTrajectoryManager.getInstance().syncTrajectoryInfo(); } + private void beforeTaskTips() { + if (busRoutesResult == null) return; + + removeTipRunnables(); + + long taskTime = busRoutesResult.getTaskTime(); + long tip3Time = taskTime-3000 - DateTimeUtil.getCurrentTimeStamp(); // 首站离开前3分钟提示 + long tip1Time = taskTime-1000 - DateTimeUtil.getCurrentTimeStamp(); // 首站离开前1分钟提示 + + if (tip3Time > 0){ + UiThreadHandler.postDelayed(tip3Runnable,tip3Time); + } + + if (tip1Time > 0){ + UiThreadHandler.postDelayed(tip1Runnable,tip1Time); + } + } + + Runnable tip3Runnable = new Runnable() { + @Override + public void run() { + + if (backgroundCurrentStationIndex == 0 && stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED + && !stationList.get(0).isLeaving()){ + tipStartTask("3"); + }else { + removeTipRunnables(); + } + } + }; + + private void tipStartTask(String s) { + String tips = String.format(mContext + .getString(R.string.bus_before_tips_s), s); + //展示在运营消息 + OCHSocketMessageManager.INSTANCE.pushAppOperationalMsgBox( + DateTimeUtil.getCurrentTimeStamp(), + tips); + //语音提示 + VoiceNotice.showNotice(tips); + } + + Runnable tip1Runnable = new Runnable() { + @Override + public void run() { + if (backgroundCurrentStationIndex == 0 && stationList != null && + stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED + && !stationList.get(0).isLeaving()){ + tipStartTask("1"); + }else { + removeTipRunnables(); + } + } + }; + + public void removeTipRunnables(){ + if (tip3Runnable != null){ + UiThreadHandler.removeCallbacks(tip3Runnable); + } + if (tip1Runnable != null){ + UiThreadHandler.removeCallbacks(tip1Runnable); + } + } + private void clearStartAutopilotTag() { firstStartAutopilot = 0; } diff --git a/OCH/mogo-och-bus/src/main/res/values/strings.xml b/OCH/mogo-och-bus/src/main/res/values/strings.xml index afe287c645..a7829fce0a 100644 --- a/OCH/mogo-och-bus/src/main/res/values/strings.xml +++ b/OCH/mogo-och-bus/src/main/res/values/strings.xml @@ -47,4 +47,6 @@ 感谢您体验\'蘑菇车联\'自动驾驶小巴车,我们下次再见。 + 距离发车时间还有%1$s分钟 + diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java index 96893ef697..310b8cb3bd 100644 --- a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java +++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java @@ -4,6 +4,7 @@ import com.mogo.eagle.core.utilcode.util.DateTimeUtils; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.Date; /** * @author: wangmingjun @@ -89,4 +90,13 @@ public class DateTimeUtil { int minute = (int)(seconds % 3600)/60; return String.valueOf(minute); } + + + /** + * 返回当前时间 + * @return + */ + public static long getCurrentTimeStamp(){ + return new Date().getTime(); + } } From 1a973e1b639a341a9c1561200153a9814f5c034c Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 28 Nov 2022 19:30:28 +0800 Subject: [PATCH 13/23] 2.13.0 fixed conflict --- config.gradle | 2 +- .../core/function/obu/mogo/MoGoObuProvider.kt | 30 +- .../obu/mogo/MogoPrivateObuNewManager.kt | 949 ++++++++++-------- .../mogo/utils/TrafficDataConvertUtilsNew.kt | 22 +- .../eagle/core/data/enums/EventTypeEnumNew.kt | 145 +-- .../enums/EventTypeEnumWeaknessTraffic.kt | 80 ++ .../eagle/core/data/enums/V2iEventTypeEnum.kt | 8 - 7 files changed, 651 insertions(+), 585 deletions(-) create mode 100644 core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumWeaknessTraffic.kt diff --git a/config.gradle b/config.gradle index d4ec3c05d0..79ebbd27c3 100644 --- a/config.gradle +++ b/config.gradle @@ -97,7 +97,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.3', + mogoobu : 'com.mogo.support.obu:mogo-obu:1.0.4', mogoami : 'com.zhidao.support.obu.ami:mogoami:1.0.0.24', // google 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 b07406da29..9d8693a859 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 @@ -21,12 +21,9 @@ class MoGoObuProvider : IMoGoObuProvider { private val TAG = "MoGoObuProvider" private var mContext: Context? = null - private val busObuIp = "192.168.8.199" private val taxiObuIp = "192.168.1.199" -// private val taxiObuIp = "192.168.1.186" - override val functionName: String get() = TAG @@ -35,7 +32,7 @@ class MoGoObuProvider : IMoGoObuProvider { } override fun init(context: Context) { - CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress()) + CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress() + "--") //bus乘客版本obu功能去掉 if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger( FunctionBuildConfig.appIdentityMode @@ -46,30 +43,33 @@ class MoGoObuProvider : IMoGoObuProvider { mContext = context mContext?.let { if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //bus 司机端 - //mogo obu - MogoPrivateObuNewManager.INSTANCE.connectObu( - it, - busObuIp, - CommonUtils.getIpAddressString() - ) - - //old obu val ipAddress = SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, busObuIp) - MogoPrivateObuManager.INSTANCE.init(context, ipAddress) - } else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端 //mogo obu MogoPrivateObuNewManager.INSTANCE.connectObu( it, - taxiObuIp, + ipAddress, CommonUtils.getIpAddressString() ) //old obu + MogoPrivateObuManager.INSTANCE.init(context, ipAddress) + CallerLogger.d("$M_OBU$TAG", "bus 司机 ipAddress = $ipAddress ---localIp = ${CommonUtils.getIpAddressString()}") + + } else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端 val ipAddress = SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp) + //mogo obu + MogoPrivateObuNewManager.INSTANCE.connectObu( + it, + ipAddress, + CommonUtils.getIpAddressString() + ) + + //old obu MogoPrivateObuManager.INSTANCE.init(context, ipAddress) + CallerLogger.d("$M_OBU$TAG", "taxi 司机端和乘客端 ipAddress = $ipAddress ---localIp = ${CommonUtils.getIpAddressString()}") } } } 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 f9aab04f50..826fe5d152 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 @@ -18,11 +18,13 @@ 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.data.enums.EventTypeEnumNew +import com.mogo.eagle.core.data.enums.EventTypeEnumWeaknessTraffic import com.mogo.eagle.core.data.enums.V2iEventTypeEnum 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.call.msgbox.CallerMsgBoxManager +import com.mogo.eagle.core.function.obu.mogo.MogoObuConst.TAG_MOGO_OBU import com.mogo.support.obu.MogoObuManager import com.mogo.support.obu.OnMogoObuListener import com.mogo.support.obu.constants.MogoObuComType @@ -48,7 +50,6 @@ class MogoPrivateObuNewManager private constructor() { } private var mContext: Context? = null - private val TAG = "ObuNewManager" private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo() @@ -122,12 +123,12 @@ class MogoPrivateObuNewManager private constructor() { */ override fun onMogoObuHvBasics(p0: MogoObuHvBasicsData?) { Log.d( - TAG, + TAG_MOGO_OBU, "onMogoObuHvBasics ------ p0 = ${p0.toString()}" + "-----FunctionBuildConfig.gpsProvider = " + FunctionBuildConfig.gpsProvider ) if (p0 != null && p0.vehBasicsMsg != null) { Log.d( - TAG, + TAG_MOGO_OBU, "onMogoObuHvBasics lon = ${p0.vehBasicsMsg.longitude} --- lat = ${p0.vehBasicsMsg.latitude} ---speed = ${p0.vehBasicsMsg.speed} ---heading = ${p0.vehBasicsMsg.heading} --acceleration = ${p0.vehBasicsMsg.accFourAxes.accLat} --yawRate = ${p0.vehBasicsMsg.accFourAxes.accYaw}" ) val data = JSONObject() @@ -178,7 +179,7 @@ class MogoPrivateObuNewManager private constructor() { CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it) } - Log.d(TAG, data.toString()) + Log.d(TAG_MOGO_OBU, data.toString()) data.let { //预警信息,预警类型 threat_level 2、3 var status = data.status @@ -204,7 +205,7 @@ class MogoPrivateObuNewManager private constructor() { ) Log.e( - TAG, + TAG_MOGO_OBU, "onMogoObuRvWarning target_classification = ${ getMessageDirection(data.vehBasicsMsg.targetPosition) } --- direction = $direction --- appId = $appId ---level = $level -- status = $status" @@ -256,8 +257,7 @@ class MogoPrivateObuNewManager private constructor() { when (appId) { // 道路危险情况预警 - V2iEventTypeEnum.TYPE_USECASE_ID_HLW.poiType - -> { + MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> { when (data.warningMsg[0].eventSerialNum) { MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障 appId = V2iEventTypeEnum.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType @@ -271,9 +271,6 @@ class MogoPrivateObuNewManager private constructor() { // MogoObuConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道,和标牌重复 // appId = V2iEventTypeEnum.FOURS_ROAD_WORK.poiType // } - MogoObuConstants.RTE.RTI_TYPE_TJW -> { // 拥堵 - appId = V2iEventTypeEnum.TYPE_USECASE_ID_TJW.poiType - } MogoObuConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶 appId = V2iEventTypeEnum.TYPE_USECASE_ID_SLW.poiType } @@ -282,11 +279,10 @@ class MogoPrivateObuNewManager private constructor() { V2iEventTypeEnum.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType } } - } //车内标牌 - V2iEventTypeEnum.TYPE_USECASE_ID_IVS.poiType -> { + MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> { when (data.warningMsg[0].eventSerialNum) { // MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口 // appId = V2iEventTypeEnum.TYPE_ID_NTERSECTION.poiType @@ -356,19 +352,25 @@ class MogoPrivateObuNewManager private constructor() { appId = V2iEventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType } - MogoObuConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故 appId = V2iEventTypeEnum.TYPE_USECASE_ID_ACCIDENT.poiType } } } - //限速预警 TODO 参考之前的 + // 拥堵 + MogoObuConstants.RSI_SCENE_TYPE.TJW.toString() -> { + appId = V2iEventTypeEnum.TYPE_USECASE_ID_TJW.poiType + } + + //限速预警 TODO + MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> { + + } } alertContent = V2iEventTypeEnum.getWarningContent(appId) ttsContent = V2iEventTypeEnum.getWarningTts(appId) - alertContent = String.format( alertContent, data.warningMsg[0].distance.toString(), @@ -387,83 +389,139 @@ class MogoPrivateObuNewManager private constructor() { when (status) { // 添加 - MogoObuConstants.STATUS.ADD, - MogoObuConstants.STATUS.UPDATE// 更新 - -> { - //显示警告红边 + MogoObuConstants.STATUS.ADD -> { + if (appId == "1") { //限速预警 TODO +// CallerHmiManager.showLimitingVelocity((Math.round(((info.ext_info.speed_limit_max * 60 * 60) / 1000) / 10) * 10).toInt()) + } else { + //显示警告红边 // CallerHmiManager.showWarning(direction) - //不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(appId, - alertContent, - ttsContent) + //不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg( + appId, + alertContent, + ttsContent + ) + ) ) - ) - CallerHmiManager.warningV2X( - appId, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - (appId + direction.direction),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 - object : IMoGoWarningStatusListener { - override fun onDismiss() { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - } - }, - true, - 3000L - ) - // 更新数据 - TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let { - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } + CallerHmiManager.warningV2X( + appId, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + (appId + direction.direction),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 + object : IMoGoWarningStatusListener { + override fun onDismiss() { + // 关闭警告红边 + CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) + } + }, + true, + 3000L + ) + + // 更新数据 +// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let { +// CallerMapUIServiceManager.getMarkerService() +// ?.updateITrafficThreatLevelInfo(it) + //显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框 +// CallerHmiManager.warningV2X( +// appId, +// alertContent, +// ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 +// (appId + direction.direction),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 +// object : IMoGoWarningStatusListener { +// override fun onDismiss() { +// // 关闭警告红边 +// CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) +// } +// }, +// true, +// 5000L +// ) + + // 更新数据 + TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let { + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } + } +// } } + + MogoObuConstants.STATUS.UPDATE -> { // 更新 + + } + // 删除 MogoObuConstants.STATUS.DELETE -> { - // 关闭警告红边 + if (appId == "1") { //限速预警 + CallerHmiManager.disableLimitingVelocity(); + } else { + // 关闭警告红边 // CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 移除顶部弹窗 + // 移除顶部弹窗 // CallerHmiManager.disableWarningV2X((appId + direction.direction)) - // 更新数据 - TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let { - // 事件结束,还原车辆颜色 - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService()?.updateITrafficInfo(it) + // 更新数据 + TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data) + ?.let { + // 事件结束,还原车辆颜色 + it.threatLevel = 0x01 + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficInfo(it) + } } + } } } + } /** * RSM预警信息 CvxPtcThreatIndInfo CvxPtcInfoIndInfo(主车与弱势交通参与者之间的预警(如:弱势交通参与者碰撞预警)) */ - override fun onMogoObuRsmWarning(data: MogoObuRsmWarningData?) { + override fun onMogoObuRsmWarning( + data: MogoObuRsmWarningData? + ) { super.onMogoObuRsmWarning(data) - if (HmiBuildConfig.isShowObuWeaknessTrafficView) { CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onMogoObuRsmWarning ------> $data" ) - Log.d(TAG, "data = ${data.toString()}") + Log.d(TAG_MOGO_OBU, "data = ${data.toString()}") // 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu if (data != null && data.participant != null && (data.participant.ptcType == 1 || data.participant.ptcType == 3)) { CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onMogoObuRsmWarning ---status---> ${data.status}" ) + /** + * 交通参与者类型 + * 0:未知 + * 1:机动车 + * 2:非机动车 + * 3:行人 + * 4:OBU自身 + */ var v2xType = "" - if (data.participant.ptcType == 1) { //摩托车 - v2xType = EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType - } else if (data.participant.ptcType == 2) { //行人 - v2xType = EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType + if (data.participant.ptcType == 1) { //机动车 + v2xType = + EventTypeEnumWeaknessTraffic.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType + } else if (data.participant.ptcType == 2) { //非机动车 + v2xType = + EventTypeEnumWeaknessTraffic.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType + } else if (data.participant.ptcType == 3) { //行人 + v2xType = + EventTypeEnumWeaknessTraffic.TYPE_USECASE_ID_VRUCW_PERSON.poiType + } else { //未知 + v2xType = EventTypeEnumWeaknessTraffic.TYPE_ERROR.poiType } - val ttsContent = EventTypeEnumNew.getWarningTts(v2xType) - val alertContent = EventTypeEnumNew.getWarningContent(v2xType) + val ttsContent = EventTypeEnumWeaknessTraffic.getWarningTts(v2xType) + val alertContent = + EventTypeEnumWeaknessTraffic.getWarningContent(v2xType) var level = -1 val direction = getMessageDirection(data.participant.targetPosition) if (data.warningMsg != null && data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { @@ -471,19 +529,18 @@ class MogoPrivateObuNewManager private constructor() { } when (data.status) { - // 添加 - MogoObuConstants.STATUS.ADD, - MogoObuConstants.STATUS.UPDATE// 更新 - -> { + MogoObuConstants.STATUS.ADD -> { // 添加 // if (level == 2 || level == 3) { //不考虑level //显示警告红边 CallerHmiManager.showWarning(direction) CallerMsgBoxManager.saveMsgBox( MsgBoxBean( MsgBoxType.OBU, - V2XMsg(v2xType, + V2XMsg( + v2xType, alertContent, - ttsContent) + ttsContent + ) ) ) CallerHmiManager.warningV2X( @@ -494,17 +551,29 @@ class MogoPrivateObuNewManager private constructor() { object : IMoGoWarningStatusListener { override fun onDismiss() { // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) + CallerHmiManager.showWarning( + WarningDirectionEnum.ALERT_WARNING_NON + ) } }, true, - 3000L + 5000L ) // } + // 更新数据 - TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let { - CallerMapUIServiceManager.getMarkerService()?.updateITrafficInfo(it) - } + TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData( + data + ) + ?.let { + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficInfo(it) + } + + } + + MogoObuConstants.STATUS.UPDATE -> {// 更新 + } // 删除 @@ -512,14 +581,13 @@ class MogoPrivateObuNewManager private constructor() { // 关闭警告红边 CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) // 更新数据 - TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data)?.let { - // 事件结束,还原交通参与者颜色 - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } - -// CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString()) + TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(data) + ?.let { + // 事件结束,还原交通参与者颜色 + it.threatLevel = 0x01 + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } } } } @@ -529,377 +597,424 @@ class MogoPrivateObuNewManager private constructor() { /** * 地图匹配 是OBU算法输出地图匹配结果,主车匹配道路哪条路或者哪条车道 */ - override fun onMogoObuMapMath(data: MogoObuMapMathData?) { + override fun onMogoObuMapMath( + data: MogoObuMapMathData? + ) { super.onMogoObuMapMath(data) } + } - /** - * 获取消息的方位 车辆相关 - */ - private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "预警红边:预警方向->$targetClassification") - return when (targetClassification) { - MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE, - MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方 +} - MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方 +/** + * 获取消息的方位 车辆相关 + */ +private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum { + CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "预警红边:预警方向->$targetClassification") + return when (targetClassification) { + MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE, + MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方 - MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方 + MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方 - MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方 + MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方 - MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT, - MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT - -> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方 + MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方 - MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT, - MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT - -> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方 + MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT, + MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT + -> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方 - MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT, - -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方 + MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT, + MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT + -> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方 - MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT, - -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方 + MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT, + -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方 - MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知 - else -> WarningDirectionEnum.ALERT_WARNING_ALL - } + MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT, + -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方 + + MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知 + else -> WarningDirectionEnum.ALERT_WARNING_ALL } +} - /** - * 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示 - * - * @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 - * - * @see com.mogo.module.common.enums.EventTypeEnum - */ - private fun handleSdkObu( - appId: String, - direction: WarningDirectionEnum, - status: Int, - level: Int, - info: MogoObuRvWarningData - ) { - // 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnumNew 提供的 - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status" - ) - Log.d( - TAG, - "handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status" - ) - var alertContent: String - var ttsContent: String - var changeVisualAngle = false - when (appId) { - // 变道预警,注意左后车辆/注意右后车辆 - EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType -> { - alertContent = EventTypeEnumNew.getWarningContent(appId) - ttsContent = EventTypeEnumNew.getWarningTts(appId) - if ( - direction == WarningDirectionEnum.ALERT_WARNING_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT - ) { - ttsContent = String.format(ttsContent, "左") - alertContent = String.format(alertContent, "左") - } else if ( - direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT - ) { - ttsContent = String.format(ttsContent, "右") - alertContent = String.format(alertContent, "右") - } - } - - //车辆失控预警 - EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType -> { - alertContent = EventTypeEnumNew.getWarningContent(appId) - ttsContent = EventTypeEnumNew.getWarningTts(appId) - alertContent = String.format(alertContent, direction.desc) - ttsContent = String.format(ttsContent, direction.desc) - } - - //左转辅助 -// EventTypeEnum.TYPE_USECASE_ID_LTA.poiType -> { -// alertContent = EventTypeEnum.getWarningContent(appId) -// ttsContent = EventTypeEnum.getWarningTts(appId) -// } - - //异常车辆提醒 - EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType -> { - alertContent = EventTypeEnumNew.getWarningContent(appId) - ttsContent = EventTypeEnumNew.getWarningTts(appId) - alertContent = String.format(alertContent, direction.desc) - ttsContent = String.format(ttsContent, direction.desc) - } - - //盲区预警 - EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType -> { - ttsContent = EventTypeEnumNew.getWarningTts(appId) - alertContent = EventTypeEnumNew.getWarningContent(appId) - if ( - direction == WarningDirectionEnum.ALERT_WARNING_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT - ) { //左后 - changeVisualAngle = true - ttsContent = String.format(ttsContent, "左") - alertContent = String.format(alertContent, "左") - } else if ( - direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || - direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT - ) { //右后 - changeVisualAngle = true - ttsContent = String.format(ttsContent, "右") - alertContent = String.format(alertContent, "右") - } - } - - // 这里处理固定的提示信息,包括了<紧急车辆提醒> - else -> { - ttsContent = EventTypeEnumNew.getWarningTts(appId) - alertContent = EventTypeEnumNew.getWarningContent(appId) +/** + * 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示 + * + * @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 + * + * @see com.mogo.module.common.enums.EventTypeEnum + */ +private fun handleSdkObu( + appId: String, + direction: WarningDirectionEnum, + status: Int, + level: Int, + info: MogoObuRvWarningData +) { + // 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnumNew 提供的 + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status" + ) + Log.d( + TAG_MOGO_OBU, + "handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status" + ) + var alertContent: String + var ttsContent: String + var changeVisualAngle = false + when (appId) { + // 变道预警,注意左后车辆/注意右后车辆 + EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType -> { + alertContent = EventTypeEnumNew.getWarningContent(appId) + ttsContent = EventTypeEnumNew.getWarningTts(appId) + if ( + direction == WarningDirectionEnum.ALERT_WARNING_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT + ) { + ttsContent = String.format(ttsContent, "左") + alertContent = String.format(alertContent, "左") + } else if ( + direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT + ) { + ttsContent = String.format(ttsContent, "右") + alertContent = String.format(alertContent, "右") } } - when (status) { - // 添加,更新 add的时候,可能级别是2, - MogoObuConstants.STATUS.ADD, - MogoObuConstants.STATUS.UPDATE -> { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" - ) - Log.d( - TAG, - "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" - ) - if (level == 2 || level == 3) { - //不显示弹框,其它保留 - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(appId, - alertContent, - ttsContent) - ) - ) - CallerHmiManager.warningV2X( - appId, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - (appId + direction.direction),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 - object : IMoGoWarningStatusListener { - override fun onShow() { - super.onShow() - if (changeVisualAngle) { - CallerVisualAngleManager.changeVisualAngle(TooClose) - } - } + //车辆失控预警 + EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType -> { + alertContent = EventTypeEnumNew.getWarningContent(appId) + ttsContent = EventTypeEnumNew.getWarningTts(appId) + alertContent = String.format(alertContent, direction.desc) + ttsContent = String.format(ttsContent, direction.desc) + } - override fun onDismiss() { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - if (changeVisualAngle) { - CallerVisualAngleManager.changeVisualAngle(Default()) - } - } - }, - true, - 3000L - ) - //显示警告红边 - CallerHmiManager.showWarning(direction) - } - //更新周边车辆进行预警颜色变换,车辆实时移动和变色 ,UUID不需要匹配了 - TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { - CallerMapUIServiceManager.getMarkerService()?.updateITrafficThreatLevelInfo(it) - } - } - // 删除 - MogoObuConstants.STATUS.DELETE -> { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 移除顶部弹窗 -// CallerHmiManager.disableWarningV2X((appId + direction.direction)) - //更新周边车辆进行预警颜色变换,车辆实时移动和变色 - TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService()?.updateITrafficThreatLevelInfo(it) - } + //异常车辆提醒 + EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType -> { + alertContent = EventTypeEnumNew.getWarningContent(appId) + ttsContent = EventTypeEnumNew.getWarningTts(appId) + alertContent = String.format(alertContent, direction.desc) + ttsContent = String.format(ttsContent, direction.desc) + } + + //盲区预警 + EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType -> { + ttsContent = EventTypeEnumNew.getWarningTts(appId) + alertContent = EventTypeEnumNew.getWarningContent(appId) + if ( + direction == WarningDirectionEnum.ALERT_WARNING_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT + ) { //左后 + changeVisualAngle = true + ttsContent = String.format(ttsContent, "左") + alertContent = String.format(alertContent, "左") + } else if ( + direction == WarningDirectionEnum.ALERT_WARNING_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT || + direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT + ) { //右后 + changeVisualAngle = true + ttsContent = String.format(ttsContent, "右") + alertContent = String.format(alertContent, "右") } } + // 这里处理固定的提示信息,包括了<紧急车辆提醒> + else -> { + ttsContent = EventTypeEnumNew.getWarningTts(appId) + alertContent = EventTypeEnumNew.getWarningContent(appId) + } } - /** - * 处理红绿灯 - */ - private fun handlerTrafficLight(appId: Int, status: Int, lights: List) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights " - ) - Log.d( - TAG, - "handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights " - ) - - when (status) { - // 添加 - MogoObuConstants.STATUS.ADD, - MogoObuConstants.STATUS.UPDATE - -> { - changeTrafficLightStatus(appId, lights) - } - // 删除 - MogoObuConstants.STATUS.DELETE -> { - // 移除顶部弹窗 - CallerHmiManager.disableWarningTrafficLight() -// CallerHmiManager.disableWarningV2X(appId.toString()) - } - } - } - - private var isRedLight = false - private var isGreenLight = false - - /** - * 修改红绿灯 - */ - @Synchronized - private fun changeTrafficLightStatus( - appId: Int, - lights: List - ) { - var ttsContent = "" - var alertContent = "" - //这里需要根据真实数据确定 index 取值方式 - val currentLight = lights[0] - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "currentLight = $currentLight ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId" - ) - Log.d( - TAG, - "currentLight = $currentLight ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId" - ) - // 闯红灯预警 - when (appId) { - 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 = EventTypeEnumNew.getWarningTts(appId.toString()) - alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) + when (status) { + // 添加,更新 add的时候,可能级别是2, + MogoObuConstants.STATUS.ADD, + MogoObuConstants.STATUS.UPDATE -> { + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" + ) + Log.d( + TAG_MOGO_OBU, + "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" + ) + if (level == 2 || level == 3) { + //不显示弹框,其它保留 CallerMsgBoxManager.saveMsgBox( MsgBoxBean( MsgBoxType.OBU, - V2XMsg(appId.toString(), + V2XMsg( + appId, alertContent, - ttsContent) + ttsContent + ) ) ) CallerHmiManager.warningV2X( - appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 3000L + appId, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + (appId + direction.direction),//使用当前事件类型+方向记录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, + 3000L ) + //显示警告红边 + CallerHmiManager.showWarning(direction) } - 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT + //更新周边车辆进行预警颜色变换,车辆实时移动和变色 ,UUID不需要匹配了 + TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) } } - - when (currentLight.light) { - // 灯光不可用 - 0x0 -> { - CallerHmiManager.showWarningTrafficLight(0, 2) - } - // 红灯 - 0x1 -> { - if (!isRedLight) { -// CallerHmiManager.disableWarningV2X(appId.toString()) - isRedLight = true - } - isGreenLight = false - CallerHmiManager.showWarningTrafficLight(1, 2) - - val red = currentLight.countDown.toInt() - CallerHmiManager.changeCountdownRed(red) - CallerHmiManager.changeCountdownGreen(0) - CallerHmiManager.changeCountdownYellow(0) - } - // 绿灯 - 0x2 -> { - if (!isGreenLight) { -// CallerHmiManager.disableWarningV2X(appId.toString()) - isGreenLight = true - } - isRedLight = false - CallerHmiManager.showWarningTrafficLight(3, 2) - val green = currentLight.countDown.toInt() - CallerHmiManager.changeCountdownGreen(green) - //防止数据出现问题的容错 - CallerHmiManager.changeCountdownRed(0) - CallerHmiManager.changeCountdownYellow(0) - // 拼接建议速度 - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}" - ) - val adviceSpeed = - "${currentLight.suggestMinSpeed} - ${currentLight.suggestMaxSpeed}" - val adviceSpeedTts = - "${currentLight.suggestMinSpeed}到${currentLight.suggestMaxSpeed}" - ttsContent = - String.format( - EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), - adviceSpeedTts - ) - alertContent = - String.format( - EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), - adviceSpeed - ) - - val maxSpeed = currentLight.suggestMaxSpeed - if (maxSpeed > 0) { - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, - alertContent, - ttsContent) - ) - ) - CallerHmiManager.warningV2X( - EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), - null, - true, - 3000L - ) - } - } - // 黄灯 - 0x3 -> { -// CallerHmiManager.disableWarningV2X(appId.toString()) - CallerHmiManager.showWarningTrafficLight(2, 2) - val yellow = currentLight.countDown.toInt() - CallerHmiManager.changeCountdownYellow(yellow) - CallerHmiManager.changeCountdownGreen(0) - CallerHmiManager.changeCountdownRed(0) + // 删除 + MogoObuConstants.STATUS.DELETE -> { + // 关闭警告红边 + CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) + // 移除顶部弹窗 +// CallerHmiManager.disableWarningV2X((appId + direction.direction)) + //更新周边车辆进行预警颜色变换,车辆实时移动和变色 + TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let { + it.threatLevel = 0x01 + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) } } } +} -} \ No newline at end of file +/** + * 处理红绿灯 + */ +private fun handlerTrafficLight(appId: Int, status: Int, lights: List) { + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId" + ) + Log.d( + TAG_MOGO_OBU, + "handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId " + ) + + when (status) { + // 添加 + MogoObuConstants.STATUS.ADD, + MogoObuConstants.STATUS.UPDATE + -> { + changeTrafficLightStatus(appId, lights) + } + // 删除 + MogoObuConstants.STATUS.DELETE -> { //TODO 底层在修改,暂时没发送删除 + // 移除顶部弹窗 + CallerHmiManager.disableWarningTrafficLight() + CallerHmiManager.disableWarningV2X(appId.toString()) + } + } +} + +private var isRedLight = false +private var isGreenLight = false + +/** + * 修改红绿灯 + */ +@Synchronized +private fun changeTrafficLightStatus( + appId: Int, + lights: List +) { + var ttsContent = "" + var alertContent = "" + //这里需要根据真实数据确定 index 取值方式 + val currentLight = lights[0] + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "currentLight = $currentLight ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId" + ) + Log.d( + TAG_MOGO_OBU, + "currentLight = $currentLight ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId" + ) + // 闯红灯预警 + when (appId) { + 0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效 + + } + 0x1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT TODO 需要约束一个红灯周期只显示一次 +// CallerHmiManager.disableWarningV2X(appId.toString()) +// Log.e(TAG, "changeTrafficLightStatus 闯红灯 --------> ") +// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) +// alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) +// CallerHmiManager.warningV2X( +// appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 +// appId.toString(), null, true, 5000L, MsgBoxType.OBU +// ) + } + + 0x2 -> {//绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION TODO 需要约束一个绿灯周期只显示一次 + ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) + alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg( + appId.toString(), + alertContent, + ttsContent + ) + ) + ) + CallerHmiManager.warningV2X( + appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + appId.toString(), null, true, 3000L + ) + + // 拼接建议速度 +// Log.e(TAG, "changeTrafficLightStatus 绿波通行引导 --------> ") +// CallerLogger.d( +// "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", +// "speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}" +// ) +// val adviceSpeed = +// "${currentLight.suggestMinSpeed*3.6} - ${currentLight.suggestMaxSpeed*3.6}" +// val adviceSpeedTts = +// "${currentLight.suggestMinSpeed*3.6}到${currentLight.suggestMaxSpeed*3.6}" +// ttsContent = +// String.format( +// EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), +// adviceSpeedTts +// ) +// alertContent = +// String.format( +// EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), +// adviceSpeed +// ) +// val maxSpeed = currentLight.suggestMaxSpeed*3.6 +// if (maxSpeed > 0) { +// CallerHmiManager.warningV2X( +// EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, +// alertContent, +// ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 +// appId.toString(), +// null, +// true, +// 5000L, +// MsgBoxType.OBU +// ) +// } + } + } + + when (currentLight.light) { + // 灯光不可用 + 0 -> { + CallerHmiManager.showWarningTrafficLight(0, 2) + } + // 红灯 + 2, 3 -> { + if (!isRedLight) { + CallerHmiManager.disableWarningV2X(appId.toString()) + isRedLight = true + } + isGreenLight = false + CallerHmiManager.showWarningTrafficLight(1, 2) + + val red = currentLight.countDown.toInt() + CallerHmiManager.changeCountdownRed(red) +// CallerHmiManager.changeCountdownGreen(0) +// CallerHmiManager.changeCountdownYellow(0) + } + // 绿灯 + 4, 5, 6 -> { + if (!isGreenLight) { + CallerHmiManager.disableWarningV2X(appId.toString()) + isGreenLight = true + } + isRedLight = false + CallerHmiManager.showWarningTrafficLight(3, 2) + val green = currentLight.countDown.toInt() + CallerHmiManager.changeCountdownGreen(green) + //防止数据出现问题的容错 + CallerHmiManager.changeCountdownRed(0) + CallerHmiManager.changeCountdownYellow(0) + // 拼接建议速度 + CallerLogger.d( + "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", + "speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}" + ) + val adviceSpeed = + "${currentLight.suggestMinSpeed} - ${currentLight.suggestMaxSpeed}" + val adviceSpeedTts = + "${currentLight.suggestMinSpeed}到${currentLight.suggestMaxSpeed}" + ttsContent = + String.format( + EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), + adviceSpeedTts + ) + alertContent = + String.format( + EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType), + adviceSpeed + ) + + val maxSpeed = currentLight.suggestMaxSpeed + if (maxSpeed > 0) { + CallerMsgBoxManager.saveMsgBox( + MsgBoxBean( + MsgBoxType.OBU, + V2XMsg( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + alertContent, + ttsContent + ) + ) + ) + CallerHmiManager.warningV2X( + EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, + alertContent, + ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 + appId.toString(), + null, + true, + 3000L + ) + } +// CallerHmiManager.changeCountdownRed(0) +// CallerHmiManager.changeCountdownYellow(0) + } + // 黄灯 + 7, 8 -> { + CallerHmiManager.disableWarningV2X(appId.toString()) + CallerHmiManager.showWarningTrafficLight(2, 2) + val yellow = currentLight.countDown.toInt() + CallerHmiManager.changeCountdownYellow(yellow) +// CallerHmiManager.changeCountdownGreen(0) +// CallerHmiManager.changeCountdownRed(0) + } + } +} diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtilsNew.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtilsNew.kt index 32d49b96dc..7a253a920d 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtilsNew.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtilsNew.kt @@ -94,14 +94,22 @@ object TrafficDataConvertUtilsNew { trafficData.heading = info.participant.heading trafficData.speed = info.participant.speed + /** + * 交通参与者类型 + * 0:未知 + * 1:机动车 + * 2:非机动车 + * 3:行人 + * 4:OBU自身 + */ when (info.participant.ptcType) { // 未知 0 -> { trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI } - //机动车 //TODO + //机动车 1 -> { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE + trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO } // 非机动车 2 -> { @@ -113,16 +121,6 @@ object TrafficDataConvertUtilsNew { } } - /** - * 交通参与者类型 - * 0:未知 - * 1:机动车 - * 2:非机动车 - * 3:行人 - * 4:OBU自身 - */ - val ptcType = 0 - // 判断车辆V2X预警级别,调整车辆颜色 if (info.warningMsg != null && info.warningMsg.warningData != null) { trafficData.threatLevel = info.warningMsg.warningData[0].warningLevel 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 634429710f..901bb2aae1 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 @@ -146,13 +146,13 @@ enum class EventTypeEnumNew( content = "前车碰撞预警", tts = "小心前车" ), - TYPE_USECASE_ID_ICW( - 1.toString(), - "交叉路口碰撞预警", - poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning, - content = "交叉路口碰撞预警", - tts = "注意交叉路口车辆" - ), +// TYPE_USECASE_ID_ICW( +// 1.toString(), +// "交叉路口碰撞预警", +// poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning, +// content = "交叉路口碰撞预警", +// tts = "注意交叉路口车辆" +// ), TYPE_USECASE_ID_AVW( 7.toString(), "异常车辆提醒", @@ -218,21 +218,6 @@ enum class EventTypeEnumNew( tts = "前方路口左转急弯,减速慢行", ), - //TODO - TYPE_USECASE_ID_VRUCW_PERSON( - 0X2B0201.toString(), - "弱势交通参与者碰撞预警", - poiTypeSrcVr = R.drawable.icon_warning_v2x_pedestrian_crossing, - content = "注意行人", - tts = "注意行人" - ),//行人/摩托车碰撞预警 - TYPE_USECASE_ID_VRUCW_MOTORBIKE( - 0X2B0202.toString(), - "弱势交通参与者碰撞预警", - poiTypeSrcVr = R.drawable.icon_warning_v2x_motorcycle_collision, - content = "注意摩托车", - tts = "注意摩托车" - ),//摩托车碰撞预警 TYPE_USECASE_ID_LTA( 2.toString(), "左转辅助", @@ -241,13 +226,6 @@ enum class EventTypeEnumNew( tts = "注意路口对向来车" ), - TYPE_USECASE_ID_IVS( - 3.toString(), - "车内标牌", - poiTypeSrcVr = R.drawable.icon_warning_v2x_road_construction, - content = "车内标牌", - tts = "" - ), TYPE_USECASE_ID_TJW( //TODO 4.toString(), "前方拥堵提醒", @@ -256,32 +234,16 @@ enum class EventTypeEnumNew( tts = "前方拥堵,减速慢行" ), - //TODO 不能使用之前obu的定义 ObuConstants.USE_CASE_ID.HLW.toString(), - TYPE_USECASE_OPTIMAL_LANE( - "111", - "最优车道", - poiTypeSrcVr = R.drawable.v2x_icon_live_logo, - content = "最优车道", - tts = "最优车道" - ), - - TYPE_USECASE_ID_HLW( - 1.toString(), - "道路危险情况预警", - poiTypeSrcVr = R.drawable.icon_warning_v2x_road_dangerous, - content = "道路危险情况预警", - tts = "前方路况危险,小心行驶" - ),//(如果能给出具体的类别,则播报具体危险类别) - TYPE_USECASE_ID_IVP( - 0x2.toString(), + 0x1.toString(), "闯红灯预警", poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_red, content = "路口红灯,禁止通行", tts = "路口红灯,禁止通行" ), + TYPE_USECASE_ID_IVP_GREEN( - 0x2B091.toString(), + 0x2.toString(), "绿波通行", poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_green, content = "建议车速 %s KM/H", @@ -305,22 +267,6 @@ enum class EventTypeEnumNew( tts = "注意超速车辆" ), - TYPE_USECASE_ID_BREAKDOWN_WARNING( - 101.toString(), - "注意故障车辆", - poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning, - content = "注意故障车辆", - tts = "注意故障车辆" - ), - - TYPE_USECASE_ID_ROAD_PARKING( - 412.toString(), - "注意异常停车", - poiTypeSrcVr = R.drawable.icon_warning_v2x_no_parking, - content = "注意异常停车", - tts = "注意异常停车" - ), - TYPE_USECASE_ID_ROAD_TRAMCAR( 0x2C01.toString(), "前方有轨电车提醒", @@ -336,41 +282,6 @@ enum class EventTypeEnumNew( content = "注意前方人行横道", tts = "前方人行横道,减速慢行" ), - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL( - 0x2C05.toString(), - "学校", - poiTypeSrcVr = R.drawable.icon_warning_v2x_school, - content = "注意前方学校", - tts = "前方学校,减速慢行" - ), - TYPE_USECASE_ID_ROAD_COLLISION_WARNING( - 0x2C06.toString(), - "事故易发路段", - poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning, - content = "注意当前路段事故多发", - tts = "当前路段事故多发,请小心驾驶" - ), - TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG( - 0x2C07.toString(), - "环岛行驶", - poiTypeSrcVr = R.drawable.icon_warning_v2x_roundaboutpng, - content = "注意前方驶入环岛", - tts = "即将驶入环岛,减速慢行" - ), - TYPE_USECASE_ID_ROAD_TEST_SECTION( - 0x2C08.toString(), - "驾校考试路段", - poiTypeSrcVr = R.drawable.icon_warning_v2x_test_section, - content = "注意前方驾校考试路段", - tts = "驾校考试路段,请小心驾驶" - ), - TYPE_USECASE_ID_ROAD_HUMP_BRIDGE( - 0x2C09.toString(), - "驼峰桥", - poiTypeSrcVr = R.drawable.icon_warning_v2x_hump_bridge, - content = "注意前方驼峰桥", - tts = "注意即将驶入驼峰桥,请小心驾驶" - ), TYPE_USECASE_ID_ROAD_NO_PARKING( 0x2C10.toString(), "禁止停车", @@ -740,32 +651,22 @@ enum class EventTypeEnumNew( return when (poiType) { TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.poiTypeSrcVr TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.poiTypeSrcVr - TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.poiTypeSrcVr +// TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.poiTypeSrcVr TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.poiTypeSrcVr TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.poiTypeSrcVr TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.poiTypeSrcVr TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.poiTypeSrcVr TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.poiTypeSrcVr TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.poiTypeSrcVr - TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.poiTypeSrcVr - TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiTypeSrcVr TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.poiTypeSrcVr TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.poiTypeSrcVr -// TYPE_USECASE_ID_HLW.poiType -> TYPE_USECASE_ID_HLW.poiTypeSrcVr - TYPE_USECASE_ID_IVS.poiType -> TYPE_USECASE_ID_IVS.poiTypeSrcVr TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.poiTypeSrcVr TYPE_USECASE_ID_IVP.poiType -> TYPE_USECASE_ID_IVP.poiTypeSrcVr TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.poiTypeSrcVr -// TYPE_USECASE_ID_COC.poiType -> TYPE_USECASE_ID_COC.poiTypeSrcVr TYPE_USECASE_ID_ROAD_TRAMCAR.poiType -> TYPE_USECASE_ID_ROAD_TRAMCAR.poiTypeSrcVr TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiTypeSrcVr TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiTypeSrcVr TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiTypeSrcVr - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeSrcVr - TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType -> TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiTypeSrcVr - TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType -> TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiTypeSrcVr - TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType -> TYPE_USECASE_ID_ROAD_TEST_SECTION.poiTypeSrcVr - TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiTypeSrcVr TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeSrcVr TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.poiTypeSrcVr TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.poiTypeSrcVr @@ -782,32 +683,22 @@ enum class EventTypeEnumNew( return when (poiType) { TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.content TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.content - TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.content +// TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.content TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.content TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.content TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.content TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.content TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.content TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.content - TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.content - TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.content TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.content TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.content -// TYPE_USECASE_ID_HLW.poiType -> TYPE_USECASE_ID_HLW.content - TYPE_USECASE_ID_IVS.poiType -> TYPE_USECASE_ID_IVS.content TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.content TYPE_USECASE_ID_IVP.poiType -> TYPE_USECASE_ID_IVP.content TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.content -// TYPE_USECASE_ID_COC.poiType -> TYPE_USECASE_ID_COC.content TYPE_USECASE_ID_ROAD_TRAMCAR.poiType -> TYPE_USECASE_ID_ROAD_TRAMCAR.content TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.content TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.content TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.content - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.content - TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType -> TYPE_USECASE_ID_ROAD_COLLISION_WARNING.content - TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType -> TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.content - TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType -> TYPE_USECASE_ID_ROAD_TEST_SECTION.content - TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.content TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.content TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.content TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.content @@ -825,32 +716,22 @@ enum class EventTypeEnumNew( return when (poiType) { TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.tts TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.tts - TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.tts +// TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.tts TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.tts TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.tts TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.tts TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.tts TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.tts TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.tts - TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.tts - TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.tts TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.tts TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.tts -// TYPE_USECASE_ID_HLW.poiType -> TYPE_USECASE_ID_HLW.tts //TODO - TYPE_USECASE_ID_IVS.poiType -> TYPE_USECASE_ID_IVS.tts TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.tts TYPE_USECASE_ID_IVP.poiType -> TYPE_USECASE_ID_IVP.tts TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.tts -// TYPE_USECASE_ID_COC.poiType -> TYPE_USECASE_ID_COC.tts TYPE_USECASE_ID_ROAD_TRAMCAR.poiType -> TYPE_USECASE_ID_ROAD_TRAMCAR.tts TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.tts TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.tts TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.tts - TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.tts - TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType -> TYPE_USECASE_ID_ROAD_COLLISION_WARNING.tts - TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType -> TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.tts - TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType -> TYPE_USECASE_ID_ROAD_TEST_SECTION.tts - TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.tts TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.tts TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.tts TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.tts diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumWeaknessTraffic.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumWeaknessTraffic.kt new file mode 100644 index 0000000000..736a5eff21 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumWeaknessTraffic.kt @@ -0,0 +1,80 @@ +package com.mogo.eagle.core.data.enums + +import com.mogo.eagle.core.data.R + + +/** + * 弱势交通分类 + */ +enum class EventTypeEnumWeaknessTraffic( + val poiType: String, val poiTypeStr: String = "", + val poiTypeStrVr: String = "", + val poiTypeSrcVr: Int = R.drawable.v2x_icon_live_logo, + val content: String = "", val tts: String = "" +) { + + TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES( + 1.toString(), + "弱势交通参与者碰撞预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_motorcycle_collision, + content = "注意机动车", + tts = "注意机动车" + ), + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES( //TODO 图标需要换 + 2.toString(), + "弱势交通参与者碰撞预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_motorcycle_collision, + content = "注意非机动车", + tts = "注意非机动车" + ), + TYPE_USECASE_ID_VRUCW_PERSON( + 3.toString(), + "弱势交通参与者碰撞预警", + poiTypeSrcVr = R.drawable.icon_warning_v2x_pedestrian_crossing, + content = "注意行人", + tts = "注意行人" + ), + + TYPE_ERROR( + 0.toString(), + "未知/错误/异常", + poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle, + content = "", + tts = "" + ); + + + companion object { + @JvmStatic + fun getWarningIcon(poiType: String?): Int { + return when (poiType) { + TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.poiTypeSrcVr + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiTypeSrcVr + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiTypeSrcVr + + else -> TYPE_ERROR.poiTypeSrcVr + } + } + + @JvmStatic + fun getWarningContent(poiType: String?): String { + return when (poiType) { + TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.content + TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.content + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.content + else -> TYPE_ERROR.content + } + } + + @JvmStatic + fun getWarningTts(poiType: String?): String { + return when (poiType) { + TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.tts + TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.tts + TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType -> TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.tts + else -> TYPE_ERROR.tts + } + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/V2iEventTypeEnum.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/V2iEventTypeEnum.kt index 6ce897b245..25dbb1dd41 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/V2iEventTypeEnum.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/V2iEventTypeEnum.kt @@ -231,14 +231,6 @@ enum class V2iEventTypeEnum( tts = "" ), - TYPE_USECASE_ID_HLW( - 0x2B04.toString(), - "道路危险情况预警", - poiTypeSrcVr = R.drawable.icon_warning_v2x_road_dangerous, - content = "道路危险情况预警", - tts = "前方路况危险,小心行驶" - ),//(如果能给出具体的类别,则播报具体危险类别) - TYPE_USECASE_ID_IVP( 0x2.toString(), "闯红灯预警", From 1d29f097ee069f4335059c52fad35eecc4a3e82b Mon Sep 17 00:00:00 2001 From: zhongchao Date: Mon, 28 Nov 2022 19:32:54 +0800 Subject: [PATCH 14/23] [2.13.0] add toggle btn to control fusion color reset --- .../function/hmi/ui/setting/DebugSettingView.kt | 9 +++++---- .../src/main/res/layout/view_debug_setting.xml | 14 ++++++++++++++ .../business/identify/TrackerSourceColorHelper.kt | 2 +- .../eagle/core/data/config/FunctionBuildConfig.kt | 8 ++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) 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 2f88146da9..7d0d1bd056 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 @@ -570,10 +570,11 @@ class DebugSettingView @JvmOverloads constructor( } } - Log.i( - "1026-emArrow", - "debug setting FunctionBuildConfig.isDemoMode : ${FunctionBuildConfig.isDemoMode}" - ) + btnDrawFusion.isChecked = FunctionBuildConfig.isFusionColor + btnDrawFusion.setOnCheckedChangeListener{_, isChecked -> + FunctionBuildConfig.isFusionColor = isChecked + } + // 演示模式,上一次勾选的数据 tbIsDemoMode.isChecked = FunctionBuildConfig.isDemoMode diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index b25b5cb22b..89afb8f2ad 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -1508,6 +1508,20 @@ app:layout_constraintRight_toLeftOf="@id/btnDrawTrolley" app:layout_constraintTop_toBottomOf="@id/reset_changesight" /> + +