From 253a62b54410772adcbcd8c716848d6a081f852c Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 17 Feb 2023 14:51:35 +0800 Subject: [PATCH 01/10] =?UTF-8?q?[dev=5Frobotaxi-d-app-module=5F2132=5F221?= =?UTF-8?q?223=5F2.13.2=5Fsop]=20=E5=88=A0=E9=99=A4=E8=80=81obu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 2 - .../mogo-core-function-autopilot/build.gradle | 1 - .../mogo-core-function-hmi/build.gradle | 2 - .../hmi/ui/setting/DebugSettingView.kt | 3 +- .../function/main/MainMoGoApplication.java | 10 - .../mogo-core-function-obu-mogo/build.gradle | 1 - .../core/function/obu/mogo/MoGoObuProvider.kt | 10 +- .../obu/mogo/MogoPrivateObuManager.kt | 1009 ----------------- .../obu/mogo/MogoPrivateObuNewManager.kt | 34 +- .../obu/mogo/utils/TrafficDataConvertUtils.kt | 133 --- .../core/function/api/obu/IMoGoObuProvider.kt | 2 + .../function/call/obu/CallerOBUManager.kt | 7 + 12 files changed, 47 insertions(+), 1167 deletions(-) delete mode 100644 core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt delete mode 100644 core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt diff --git a/config.gradle b/config.gradle index c8a88d256e..444370d4a8 100644 --- a/config.gradle +++ b/config.gradle @@ -97,9 +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.6', - mogoami : 'com.zhidao.support.obu.ami:mogoami:1.0.0.24', // google googlezxing : "com.google.zxing:core:3.3.3", diff --git a/core/function-impl/mogo-core-function-autopilot/build.gradle b/core/function-impl/mogo-core-function-autopilot/build.gradle index ba162e7500..c7d18e5e1f 100644 --- a/core/function-impl/mogo-core-function-autopilot/build.gradle +++ b/core/function-impl/mogo-core-function-autopilot/build.gradle @@ -51,7 +51,6 @@ dependencies { kapt rootProject.ext.dependencies.aroutercompiler - implementation rootProject.ext.dependencies.mogoami implementation rootProject.ext.dependencies.mogoaicloudtelematic if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { diff --git a/core/function-impl/mogo-core-function-hmi/build.gradle b/core/function-impl/mogo-core-function-hmi/build.gradle index 9f27ec4bdf..71c7d2d29a 100644 --- a/core/function-impl/mogo-core-function-hmi/build.gradle +++ b/core/function-impl/mogo-core-function-hmi/build.gradle @@ -71,8 +71,6 @@ dependencies { implementation rootProject.ext.dependencies.arouter kapt rootProject.ext.dependencies.aroutercompiler - implementation rootProject.ext.dependencies.mogoami - implementation rootProject.ext.dependencies.android_start_up implementation rootProject.ext.dependencies.cicle_indicator implementation rootProject.ext.dependencies.koomnative diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/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 ccbd434483..be21f4d7f0 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 @@ -80,7 +80,6 @@ import com.mogo.map.uicontroller.VisualAngleMode.* import com.mogo.eagle.core.function.business.routeoverlay.* import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner -import com.zhidao.easysocket.utils.L import com.zhidao.support.adas.high.other.permission.BackgrounderPermission import com.zhjt.mogo_core_function_devatools.env.* import kotlinx.android.synthetic.main.view_debug_setting.view.* @@ -1317,7 +1316,7 @@ class DebugSettingView @JvmOverloads constructor( * 设置是否输出OBU日志 true-打印日志,false-不打印日志 */ tbObuLog.setOnCheckedChangeListener { _, isChecked -> - L.setEnableLog(isChecked) + CallerOBUManager.setObuLog(isChecked) } /** 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 d05a210dca..825cae187a 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 @@ -37,7 +37,6 @@ 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 java.io.File; import java.lang.reflect.Field; @@ -60,7 +59,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { return; } start = System.currentTimeMillis(); - connectAmiIp(); // Crash 日志收集 initCrashConfig(); initLogConfig(); @@ -202,14 +200,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication { OverviewDb.Companion.getDb(this); } - /** - * 连接ami - */ - private void connectAmiIp() { - String ipAddress = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().getBaseContext()).getString(MoGoConfig.OBU_IP, "192.168.1.199"); - AmiClientManager.getInstance().setObuIp(ipAddress); - } - private void initModules() { CallerLogger.INSTANCE.d(M_HMI + TAG, "initModules"); //och模块 diff --git a/core/function-impl/mogo-core-function-obu-mogo/build.gradle b/core/function-impl/mogo-core-function-obu-mogo/build.gradle index 4c4e538ab2..7b8a0e75df 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/build.gradle +++ b/core/function-impl/mogo-core-function-obu-mogo/build.gradle @@ -66,7 +66,6 @@ dependencies { implementation project(':core:mogo-core-function-call') } - implementation rootProject.ext.dependencies.mogoobuold implementation rootProject.ext.dependencies.mogoobu } diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MoGoObuProvider.kt index a4ab0a31ea..ebf56c32b4 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 @@ -75,19 +75,19 @@ class MoGoObuProvider : IMoGoObuProvider { ipAddress, CommonUtils.getIpAddressString() ) - - //连接old obu - MogoPrivateObuManager.INSTANCE.connectObu(it, ipAddress) } } } override fun disConnect() { - MogoPrivateObuManager.INSTANCE.disConnectObu() + MogoPrivateObuNewManager.INSTANCE.disConnectObu() } override fun isConnected(): Boolean { - return MogoPrivateObuManager.INSTANCE.isConnected() + return MogoPrivateObuNewManager.INSTANCE.isConnected() } + override fun setObuLibLog(isSet: Boolean) { + MogoPrivateObuNewManager.INSTANCE.setObuLog(isSet) + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt deleted file mode 100644 index ea71e56e3f..0000000000 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt +++ /dev/null @@ -1,1009 +0,0 @@ -package com.mogo.eagle.core.function.obu.mogo - -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.config.HmiBuildConfig -import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.eagle.core.data.enums.WarningDirectionEnum -import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager -import com.mogo.eagle.core.function.call.hmi.CallerHmiManager -import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager -import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager -import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default -import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose -import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager -import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.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 -import com.zhidao.support.obu.constants.ObuConstants -import com.zhidao.support.obu.model.* -import com.zhidao.support.obu.model.advance.Light -import org.json.JSONObject - -/** - * - * @author lixiaopeng - * @since 2021/8/8 - * @description OBU 管理 - */ -class MogoPrivateObuManager private constructor() { - companion object { - val INSTANCE: MogoPrivateObuManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { - MogoPrivateObuManager() - } - } - - private var mMogoServiceApis: IMogoServiceApis? = null - private var mContext: Context? = null - private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo() - - fun init(context: Context, ipAddress: String) { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "obuManager初始化--") - mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS) - .navigation(context) as IMogoServiceApis - mContext = context - //连接obu设备 - connectObu(context, ipAddress) - //控制日志输出 - MogoObuManager.getInstance() - .init(MoGoAiCloudClientConfig.getInstance().getSn(), AppConfigInfo.toString()) - MogoObuManager.getInstance().registerListener(mogoObuListener) - } - - fun connectObu(context: Context, ipAddress: String) { - //自研obu初始化 - mObuStatusInfo.connectIP = ipAddress - mObuStatusInfo.obuSdkVersion = MogoObuManager.getInstance().versionName - if (!MogoObuManager.getInstance().isConnected) { - MogoObuManager.getInstance().connect(context, mObuStatusInfo.connectIP) - } else { - try { - MogoObuManager.getInstance().disConnect() - Thread.sleep(500) - } catch (e: Exception) { - e.printStackTrace() - } - MogoObuManager.getInstance().connect(context, mObuStatusInfo.connectIP) - } - } - - fun disConnectObu() { - try { - MogoObuManager.getInstance().disConnect() - } catch (e: Exception) { - e.printStackTrace() - } - - } - - fun isConnected(): Boolean { - return MogoObuManager.getInstance().isConnected - } - - private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() { - // OBU连接成功 - override fun onConnected() { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onConnected ------> ") - mObuStatusInfo.obuStatus = true - CallerObuListenerManager.invokeListener(mObuStatusInfo) - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) } - - //断开mogo obu - com.mogo.support.obu.MogoObuManager.getInstance().disconnect() - } - - // OBU连接失败 - override fun onConnectFail(isNeedReconnect: Boolean) { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onConnectFail ------> ") - mObuStatusInfo.obuStatus = false - mObuStatusInfo.obuHvStatus = false - mObuStatusInfo.obuRvStatus = false - CallerObuListenerManager.invokeListener(mObuStatusInfo) - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", false) } - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", false) } - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", false) } - } - - // OBU断开连接 - override fun onDisconnect() { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onDisconnect ------> ") - mObuStatusInfo.obuStatus = false - mObuStatusInfo.obuHvStatus = false - mObuStatusInfo.obuRvStatus = false - CallerObuListenerManager.invokeListener(mObuStatusInfo) - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", false) } - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", false) } - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", false) } - } - - // 接收到的原始数据 - override fun onReceiveOriginData(data: String) { - super.onReceiveOriginData(data) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onReceiveOriginData ------> data = $data" - ) - - } - - // 发送的数据 - override fun onSendData(bytes: ByteArray) { - super.onSendData(bytes) - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onSendData ------> ") - } - - // CV2X系统信息 - override fun onCvxAppInitIndInfo(info: CvxAppInitIndInfo) { - super.onCvxAppInitIndInfo(info) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxAppInitIndInfo ------> $info" - ) - if (info != null) { - if (!info.stack_info.isNullOrEmpty()) { - mObuStatusInfo.stackInfo = info.stack_info - } - - if (!info.app_info.isNullOrEmpty()) { - mObuStatusInfo.appInfo = info.app_info - } - - if (!info.hli_info.isNullOrEmpty()) { - mObuStatusInfo.hliInfo = info.hli_info - } - CallerObuListenerManager.invokeListener(mObuStatusInfo) - } - } - - // (2) 车辆信息:CVX_HV_INFO_IND - override fun onCvxHvInfoIndInfo(info: CvxHvInfoIndInfo?) { - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", true) } - mObuStatusInfo.obuHvStatus = true - CallerObuListenerManager.invokeListener(mObuStatusInfo) - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxHvInfoIndInfo ------> $info") - if (info != null && info.basic_info != null && info.basic_info.position != null) { - val movingObjectInfo = info.basic_info - val position = movingObjectInfo.position - val data = JSONObject() - try { - data.putOpt("lon", position.longitude) - data.putOpt("lat", position.latitude) - data.putOpt("speed", movingObjectInfo.speed) - data.putOpt("heading", movingObjectInfo.heading) - if (info.acceleration_set != null) { - data.putOpt("acceleration", info.acceleration_set.lateral) - data.putOpt("yawRate", info.acceleration_set.yaw_rate) - } - try { - data.putOpt("systemTime", System.currentTimeMillis()) - } catch (e: Exception) { - e.printStackTrace() - } - try { - data.putOpt("satelliteTime", System.currentTimeMillis()) - } catch (e: Exception) { - e.printStackTrace() - } - - // 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统,1-工控机,2-OBU - if (2 == FunctionBuildConfig.gpsProvider) { - // 同步给MAP地图 - CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(data) - // 同步更新经纬度和系统时间至 AutoPilotStatusListener - CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon( - System.currentTimeMillis() / 1000.0, - position.longitude, - position.latitude - ) - } - - } catch (e: Exception) { - e.printStackTrace() - } - } - } - - // (3) 远车信息:CVX_RV_INFO_IND - override fun onCvxRvInfoIndInfo(info: CvxRvInfoIndInfo) { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxRvInfoIndInfo ------> $info") - mObuStatusInfo.obuRvStatus = true - CallerObuListenerManager.invokeListener(mObuStatusInfo) - mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", true) } - // 更新数据 - TrafficDataConvertUtils.cvxRvInfoIndInfo2TrafficData(info)?.let { - CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it) - } - } - - // (3) 道路事件预警信息:CVX_RTI_THREAT_IND - override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) { -// if (HmiBuildConfig.isShowObuV2iView) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxRtiThreatIndInfo ------> $info" - ) - - if (info != null && info.threat_info != null && info.ext_info != null) { - var alertContent = "" - var ttsContent = "" - var appId = info.threat_info.app_id.toString() - val status = info.status - val level = info.threat_info.threat_level - val direction = - getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}" - ) - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type} --direction = $direction -- pos_classification = ${info.ext_info.pos_classification} " - ) - when (appId) { - // 道路危险情况预警 - EventTypeEnum.TYPE_USECASE_ID_HLW.poiType, - EventTypeEnum.TYPE_USECASE_ID_IVS.poiType - -> { - when (info.ext_info.rti_type) { - //急转弯 - 0x2 -> { - // 特殊处理左、右方向的 - when (direction) { - WarningDirectionEnum.ALERT_WARNING_LEFT, - WarningDirectionEnum.ALERT_WARNING_TOP_LEFT, - WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType - } - WarningDirectionEnum.ALERT_WARNING_RIGHT, - WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT, - WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType - } - } - } - //施工 - 0x7 -> { - appId = EventTypeEnum.FOURS_ROAD_WORK.poiType - } - //限速 - 0xA -> { - appId = EventTypeEnum.TYPE_USECASE_ID_SLW.poiType - } - //事故 - 0xC -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType - } - //拥堵 - 0xD -> { - appId = EventTypeEnum.TYPE_USECASE_ID_TJW.poiType - } - //行人 - 0xF -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType - } - //禁止停车 - 0x13 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType - } - //学校 - 0x14 -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType - } - //桥梁 - 0x17 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType - } - //轻轨电车 - 0x18 -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_TRAMCAR.poiType - } - //人行横道 - 0x19 -> { - appId = - EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType - } - //减速慢行 - 0x1A -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType - } - //事故易发路段 - 0x1B -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType - } - //环岛行驶 - 0x1C -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType - } - //环岛行驶 - 0x1D -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType - } - //驼峰桥 - 0x1E -> { - appId = EventTypeEnum.TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType - } - } - alertContent = EventTypeEnum.getWarningContent(appId) - ttsContent = EventTypeEnum.getWarningTts(appId) - } - // 前方拥堵提醒 - EventTypeEnum.TYPE_USECASE_ID_TJW.poiType -> { - ttsContent = EventTypeEnum.getWarningTts(appId) - if (info.threat_info != null) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "ttsContent = $ttsContent --alertContent = $alertContent ---info.threat_info.distance = ${info.threat_info.distance} " - ) - if (info.threat_info.distance.toInt() != 0) { - alertContent = String.format( - EventTypeEnum.getWarningContent(appId), - info.threat_info.distance.toInt() - ) - } else { - alertContent = "前方拥堵,减速慢行" - } - } - - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "ttsContent = $ttsContent --alertContent = $alertContent" - ) - } - } - - when (status) { - // 添加 - ObuConstants.STATUS.ADD -> { - //不显示弹框,其它保留 - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxRtiThreatIndInfo ------> appId = $appId --- alertContent = $alertContent --- ttsContent = $ttsContent ") - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuManager4", "alertContent或ttsContent为空!") - } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(appId, - alertContent, - ttsContent) - ) - ) - CallerHmiManager.warningV2X( - appId, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - (appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 - object : IMoGoWarningStatusListener { - override fun onDismiss() { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - } - }, - true, - 5000L - ) - } - - ObuConstants.STATUS.UPDATE -> { - //显示警告红边 TODO 需要确定是什么值 -// CallerHmiManager.showWarning(direction) - - // 更新数据 - TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.invokeTrackerWarningInfo(it) - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } - } - - // 删除 - ObuConstants.STATUS.DELETE -> { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 移除顶部弹窗 -// CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) - // 更新数据 - TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.removeTrackerWarningInfo(it) - // 事件结束,还原车辆颜色 - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } - } - } - } -// } - } - - // (4) V2I预警信息:CVX_IVP_THREAT_IND,红绿灯 - override fun onCvxIvpThreatIndInfo(info: CvxIvpThreatIndInfo?) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "CvxIvpThreatIndInfo ------> $info" - ) - if (info != null && info.ext_info != null - && info.threat_info != null - && info.ext_info.lights != null - && info.ext_info.lights.isNotEmpty() - ) { -// if (HmiBuildConfig.isShowObuV2iView) { - handlerTrafficLight( - info.threat_info.app_id, - info.status, - info.ext_info.lights, - info.ext_info.index - ) -// } - } - } - - // (2) 弱势交通参与者预警信息:CVX_PTC_THREAT_IND - override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) { -// if (HmiBuildConfig.isShowObuV2iView) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxPtcInfoIndInfo ------> $info" - ) - // 交通参与者类型 0x0:未知 UNKNOWN | 0x1:非机动车 NON_MOTOR | 0x2:行人 PEDESTRIAN 0x3:RSU - if (info != null && (info.ptc_type == 1 || info.ptc_type == 2)) { - //v2i数据传输延迟 -// val hvMillTime = info.threat_info.hv_time.millisecond -// val hvSecondMillTime = (info.threat_info.hv_time.second) * 1000 -// val hvTime = hvMillTime + hvSecondMillTime -// val currentTime = TimeUtils.getNowMills() % 60000 -// val delayTime = currentTime - hvTime - -// CallerObuListenerManager.invokeDelayTime(delayTime) -// CallerLogger.d( -// "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", -// "onCvxPtcInfoIndInfo ---delayTime---> $delayTime" -// ) - - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxPtcInfoIndInfo ---status---> ${info.status}" - ) - var v2xType = "" - if (info.ptc_type == 1) { //摩托车 - v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType - } else if (info.ptc_type == 2) { //行人 - v2xType = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType - } - val ttsContent = EventTypeEnum.getWarningTts(v2xType) - val alertContent = EventTypeEnum.getWarningContent(v2xType) - val direction = - getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1) - val level = if (info.threat_info != null) info.threat_info.threat_level else -1 - - when (info.status) { - // 添加 - ObuConstants.STATUS.ADD -> { - // if (level == 2 || level == 3) { //不考虑level - //显示警告红边 - CallerHmiManager.showWarning(direction) - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old onCvxPtcThreatIndInfo ------> v2xType = $v2xType --- alertContent = $alertContent --- ttsContent = $ttsContent ") - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuManager5", "alertContent或ttsContent为空!") - } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(v2xType, - alertContent, - ttsContent) - ) - ) - CallerHmiManager.warningV2X( - v2xType, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - (v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 - object : IMoGoWarningStatusListener { - override fun onDismiss() { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - } - }, - true, - 5000L - ) -// } - - // 更新数据 - TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.invokeTrackerWarningInfo(it) - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } - } - - ObuConstants.STATUS.UPDATE -> { - } - - // 删除 - ObuConstants.STATUS.DELETE -> { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 更新数据 - TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.removeTrackerWarningInfo(it) - // 事件结束,还原交通参与者颜色 - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService() - ?.updateITrafficThreatLevelInfo(it) - } -// CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString()) - } - } - - } -// } - } - - // (5) 限速预警信息:CVX_SLW_THREAT_IND - override fun onCvxSlwThreatIndInfo(info: CvxSlwThreatIndInfo?) { - //todo 限速走高精地图 屏蔽OBU限速\ -// CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxSlwThreatIndInfo ------> $info") -// if (info != null) { -// when (info.status) { -// // 添加 -// ObuConstants.STATUS.ADD, -// ObuConstants.STATUS.UPDATE -// -> { -// if (info.ext_info != null) { -// // 计算为千米每小时 TODO 这里需要做一下向上取整数,40,60,80,120等 -// CallerLogger.d( -// "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", -// "info.ext_info.speed_limit_max ------> ${info.ext_info.speed_limit_max}" -// ) -// CallerHmiManager.showLimitingVelocity((Math.round(((info.ext_info.speed_limit_max * 60 * 60) / 1000) / 10) * 10).toInt()) -// } -// } -// // 删除 -// ObuConstants.STATUS.DELETE -> { -// CallerHmiManager.disableLimitingVelocity() -// } -// } -// } - } - - - // (1) V2V预警信息:CVX_V2V_THREAT_IND - override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) { -// if (HmiBuildConfig.isShowObuV2vView) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxV2vThreatIndInfo ------> $info" - ) - info?.let { - //预警信息,预警类型 threat_level 2、3 - info.threat_info?.let { - //预警方位 - val direction = - getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1) - //处理预警类型 - val appId = info.threat_info.app_id - val level = info.threat_info.threat_level - val status = info.status - if (info.ext_info != null) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "onCvxV2vThreatIndInfo target_classification = ${ - getMessageDirection(info.ext_info.target_classification) - } --- direction = $direction --- appId = $appId ---level = $level -- status = $status" - ) - } - - handleSdkObu(appId, direction, status, level, info) - } - } - } -// } - } - - /** - * 返回OBU监听 - */ - fun getMogoObuListener(): OnMogoObuListener { - return mogoObuListener - } - - /** - * 获取消息的方位 车辆相关 - */ - private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "预警红边:预警方向->$targetClassification") - return when (targetClassification) { - ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_IN_LANE, - ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_IN_LANE, - 0x04 -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方 - - 0x03 -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方 - - ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_IN_LANE, - 0x05 -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方 - - 0x02 -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方 - - ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_LEFT, - ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_FAR_LEFT, - ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_LEFT, - ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_FAR_LEFT, - ObuConstants.TARGET_CLASSIFICATION.TC_INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方 - - ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_FAR_RIGHT, - ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_FAR_RIGHT, - ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_RIGHT, - ObuConstants.TARGET_CLASSIFICATION.TC_INTERSECTION_RIGHT, - ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_RIGHT -> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方 - - ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_LEFT, - ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_FAR_LEFT -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方 - - ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_RIGHT, - ObuConstants.TARGET_CLASSIFICATION.TC_BEHIND_FAR_RIGHT -> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方 - - ObuConstants.TARGET_CLASSIFICATION.TC_UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知 - else -> WarningDirectionEnum.ALERT_WARNING_ALL - } - } - - fun release() { - MogoObuManager.getInstance().unregisterListener() - } - - /** - * 处理红绿灯 - */ - private fun handlerTrafficLight(appId: Int, status: Int, lights: List, index: Int) { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "handlerTrafficLight appId = $appId --- status = $status ---index = $index ---lights.size = ${lights.size} ---lights = $lights " - ) - when (status) { - // 添加 - ObuConstants.STATUS.ADD, - ObuConstants.STATUS.UPDATE - -> { - changeTrafficLightStatus(appId, lights, index) - } - // 删除 - ObuConstants.STATUS.DELETE -> { - // 移除顶部弹窗 - CallerHmiManager.disableWarningTrafficLight() -// CallerHmiManager.disableWarningV2X(appId.toString()) - } - } - } - - private var isRedLight = false - private var isGreenLight = false - - /** - * 修改红绿灯 - */ - @Synchronized - private fun changeTrafficLightStatus( - appId: Int, - lights: List, - index: Int - ) { - var ttsContent = "" - var alertContent = "" - //这里需要根据真实数据确定 index 取值方式 - if (index != -1 && lights.size >= index) { - val currentLight = lights[index] - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} ---rlvw_violation_type = ${currentLight.rlvw_violation_type} --- index = $index ---appId = $appId ---appId = $appId" - ) - // 闯红灯预警 - when (currentLight.rlvw_violation_type) { - 0x0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE - } - 0x1 -> {//无违规 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION -// CallerHmiManager.disableWarningV2X(appId.toString()) - } - 0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT - ttsContent = EventTypeEnum.getWarningTts(appId.toString()) - alertContent = EventTypeEnum.getWarningContent(appId.toString()) - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old changeTrafficLightStatus ------> appId.toString() = ${appId.toString()} --- alertContent = $alertContent --- ttsContent = $ttsContent ") - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuManager1", "alertContent或ttsContent为空!") - } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(appId.toString(), alertContent, ttsContent) - ) - ) - CallerHmiManager.warningV2X( - appId.toString(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), null, true, 5000L - ) - } - 0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT - } - } - - when (currentLight.phase) { - // 灯光不可用 - 0x0 -> { - CallerHmiManager.showWarningTrafficLight(0, 3) - } - // 红灯 - 0x1 -> { - if (!isRedLight) { -// CallerHmiManager.disableWarningV2X(appId.toString()) - isRedLight = true - } - isGreenLight = false - CallerHmiManager.showWarningTrafficLight(1, 3) - - val red = currentLight.count_down.toInt() - CallerHmiManager.changeCountdownRed(red) - CallerHmiManager.changeCountdownGreen(0) - CallerHmiManager.changeCountdownYellow(0) - - } - // 绿灯 - 0x2 -> { - if (!isGreenLight) { -// CallerHmiManager.disableWarningV2X(appId.toString()) - isGreenLight = true - } - isRedLight = false - CallerHmiManager.showWarningTrafficLight(3, 3) - val green = currentLight.count_down.toInt() - CallerHmiManager.changeCountdownGreen(green) - //防止数据出现问题的容错 - CallerHmiManager.changeCountdownRed(0) - CallerHmiManager.changeCountdownYellow(0) - // 拼接建议速度 - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "speed_min = ${currentLight.glosa_suggested_speed_min} --speed_max = ${currentLight.glosa_suggested_speed_max.toInt()}" - ) - val adviceSpeed = - "${currentLight.glosa_suggested_speed_min.toInt()} - ${currentLight.glosa_suggested_speed_max.toInt()}" - - val adviceSpeedTts = - "${currentLight.glosa_suggested_speed_min.toInt()}到${currentLight.glosa_suggested_speed_max.toInt()}" - - ttsContent = - String.format( - EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), - adviceSpeedTts - ) - - alertContent = - String.format( - EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType), - adviceSpeed - ) - - val maxSpeed = currentLight.glosa_suggested_speed_max.toInt() - if (maxSpeed > 0) { - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "old changeTrafficLightStatus ------> TYPE_USECASE_ID_IVP_GREEN --- alertContent = $alertContent --- ttsContent = $ttsContent ") - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuManager2", "alertContent或ttsContent为空!") - } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, - alertContent, - ttsContent) - ) - ) - CallerHmiManager.warningV2X( - EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType, - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - appId.toString(), - null, - true, - 5000L - ) - } - } - // 黄灯 - 0x3 -> { -// CallerHmiManager.disableWarningV2X(appId.toString()) - CallerHmiManager.showWarningTrafficLight(2, 2) - val yellow = currentLight.count_down.toInt() - CallerHmiManager.changeCountdownYellow(yellow) - CallerHmiManager.changeCountdownGreen(0) - CallerHmiManager.changeCountdownRed(0) - } - } - } - - } - - - //todo 二期优化此处内容,注解参数 - /** - * 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示 - * - * @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 - * - */ - private fun handleSdkObu( - appId: Int, - direction: WarningDirectionEnum, - status: Int, - level: Int, - info: CvxV2vThreatIndInfo - ) { - // 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnum 提供的 - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status" - ) - var alertContent: String? = null - var ttsContent: String? = null - var changeVisualAngle = false - when (appId.toString()) { - // 变道预警,注意左后车辆/注意右后车辆 - EventTypeEnum.TYPE_USECASE_ID_LCW.poiType -> { - EventTypeHelper.getLCW(appId, direction) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //车辆失控预警 - EventTypeEnum.TYPE_USECASE_ID_CLW.poiType -> { - EventTypeHelper.getCLW(appId, direction) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //左转辅助 - EventTypeEnum.TYPE_USECASE_ID_LTA.poiType -> { - EventTypeHelper.getLTA(appId) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //异常车辆提醒 - EventTypeEnum.TYPE_USECASE_ID_AVW.poiType -> { - EventTypeHelper.getAVW(appId, direction) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //盲区预警 - EventTypeEnum.TYPE_USECASE_ID_BSW.poiType -> { - EventTypeHelper.getBSW(appId, direction) { alert, tts, visualAngle -> - alertContent = alert - ttsContent = tts - changeVisualAngle = visualAngle - } - } - //前车急刹预警 - EventTypeEnum.TYPE_USECASE_ID_EBW.poiType -> { - EventTypeHelper.getEBW(appId) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //前向碰撞预警 - EventTypeEnum.TYPE_USECASE_ID_FCW.poiType -> { - EventTypeHelper.getFCW(appId) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - //逆向超车预警 - EventTypeEnum.TYPE_USECASE_ID_DNPW.poiType -> { - EventTypeHelper.getDNPW(appId) { alert, tts -> - alertContent = alert - ttsContent = tts - } - } - - // 这里处理固定的提示信息,包括了<紧急车辆提醒> - else -> { - ttsContent = EventTypeEnum.getWarningTts(appId.toString()) - alertContent = EventTypeEnum.getWarningContent(appId.toString()) - } - } - - when (status) { - // 添加,更新 add的时候,可能级别是2, - ObuConstants.STATUS.ADD, - ObuConstants.STATUS.UPDATE -> { - CallerLogger.d( - "$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" - ) - if (level == 2 || level == 3) { - //不显示顶部弹框,其它保留 - CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", - "old handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction" - ) - if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) { - Log.d("MsgBox-PriObuManager3", "alertContent或ttsContent为空!") - } - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.OBU, - V2XMsg(appId.toString(), - alertContent, - ttsContent) - ) - ) - CallerHmiManager.warningV2X( - appId.toString(), - alertContent, - ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒 - (appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的 - object : IMoGoWarningStatusListener { - - override fun onShow() { - super.onShow() - if (changeVisualAngle) { - CallerVisualAngleManager.changeVisualAngle(TooClose) - } - } - - override fun onDismiss() { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - if (changeVisualAngle) { - CallerVisualAngleManager.changeVisualAngle(Default()) - } - } - }, - true, - 5000L - ) - //显示警告红边 - CallerHmiManager.showWarning(direction) - } - //更新周边车辆进行预警颜色变换,车辆实时移动和变色 - TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.invokeTrackerWarningInfo(it) - CallerMapUIServiceManager.getMarkerService()?.updateITrafficThreatLevelInfo(it) - } - } - // 删除 - ObuConstants.STATUS.DELETE -> { - // 关闭警告红边 - CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 移除顶部弹窗 -// CallerHmiManager.disableWarningV2X((appId + direction.direction).toString()) - //更新周边车辆进行预警颜色变换,车辆实时移动和变色 - TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let { - CallerObuListenerManager.removeTrackerWarningInfo(it) - it.threatLevel = 0x01 - CallerMapUIServiceManager.getMarkerService()?.updateITrafficThreatLevelInfo(it) - } - } - } - } - - -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt index a36ed03ddd..b2d7d2fcb6 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt @@ -1,7 +1,6 @@ package com.mogo.eagle.core.function.obu.mogo import android.content.Context -import android.util.Log import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.enums.* @@ -30,10 +29,12 @@ import com.mogo.support.obu.MogoObuManager import com.mogo.support.obu.OnMogoObuListener import com.mogo.support.obu.constants.MogoObuComType import com.mogo.support.obu.constants.MogoObuConstants +import com.mogo.support.obu.constants.MogoObuLogLevel import com.mogo.support.obu.constants.MogoObuTopicId import com.mogo.support.obu.model.* import com.mogo.support.obu.model.advance.SpatLight import com.mogo.support.obu.option.MogoObuCom +import com.mogo.support.obu.option.MogoObuLog import com.mogo.support.obu.option.MogoObuOptions import org.json.JSONObject @@ -75,7 +76,7 @@ class MogoPrivateObuNewManager private constructor() { .build() //每次连接的时候如果连接连接了,先断开 - if (MogoObuManager.getInstance().connectStatus == 1) { + if (MogoObuManager.getInstance().connectStatus == MogoObuConstants.CONNECT_STATUS.CONNECTED) { try { MogoObuManager.getInstance().disconnect() } catch (e: Exception) { @@ -86,6 +87,35 @@ class MogoPrivateObuNewManager private constructor() { MogoObuManager.getInstance().connect(options) } + /** + * 断开新obu + */ + fun disConnectObu() { + try { + MogoObuManager.getInstance().disconnect() + } catch (e: Exception) { + e.printStackTrace() + } + } + + /** + * 新obu是否连接 + */ + fun isConnected(): Boolean { + return MogoObuManager.getInstance().connectStatus == MogoObuConstants.CONNECT_STATUS.CONNECTED + } + + fun setObuLog(isChecked: Boolean) { + MogoObuManager.getInstance().setEnableLog(isChecked) + + val builder: com.mogo.support.obu.option.MogoObuLog.Builder = + MogoObuLog.newBuilder().setEnableStdio(isChecked) + if (isChecked) { + builder.setStdioLevel(MogoObuLogLevel.DBG) + } + MogoObuManager.getInstance().logConfig(builder.build()) + } + fun getMogoObuListener(): OnMogoObuListener { return mogoObuListener } diff --git a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt deleted file mode 100644 index 8e94bc8bc6..0000000000 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/utils/TrafficDataConvertUtils.kt +++ /dev/null @@ -1,133 +0,0 @@ -package com.mogo.eagle.core.function.obu.mogo.utils - -import com.mogo.eagle.core.data.traffic.TrafficData -import com.mogo.eagle.core.data.enums.TrafficTypeEnum -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU -import com.zhidao.support.obu.constants.ObuConstants -import com.zhidao.support.obu.model.CvxPtcThreatIndInfo -import com.zhidao.support.obu.model.CvxRtiThreatIndInfo -import com.zhidao.support.obu.model.CvxRvInfoIndInfo -import com.zhidao.support.obu.model.CvxV2vThreatIndInfo - -/** - * @author xiaoyuzhou - * @date 2021/8/18 2:30 下午 - */ -object TrafficDataConvertUtils { - val TAG = "TrafficDataConvertUtils" - - /** - * OBU 远车 转换交通元素数据 - */ - fun cvxRvInfoIndInfo2TrafficData(info: CvxRvInfoIndInfo): TrafficData? { - if (info.basic_info == null || info.basic_info.position == null) { - CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全") - return null - } - val trafficData = TrafficData() - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE - trafficData.uuid = info.vehicle_id - trafficData.lat = info.basic_info.position.latitude - trafficData.lon = info.basic_info.position.longitude - trafficData.heading = info.basic_info.heading - trafficData.speed = info.basic_info.speed - - return trafficData - } - - /** - * OBU RSU道路事件预警信息 转换交通元素数据 - */ - fun cvxRtiThreatIndInfo2TrafficData(info: CvxRtiThreatIndInfo): TrafficData? { - // 这里只处理道路施工 - if(info.ext_info.rti_type != 0x7){ - return null - } - if (info.rti_id == null || info.ext_info == null - || info.zones_info == null || info.zones_info.first() == null - || info.zones_info.first().path_points.first() == null - || info.threat_info == null - ) { - CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") - return null - } - val trafficData = TrafficData() - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG - trafficData.uuid = info.rti_id - - trafficData.lat = info.zones_info.first().path_points.first().latitude - trafficData.lon = info.zones_info.first().path_points.first().longitude - - trafficData.threatLevel = info.threat_info.threat_level - - return trafficData - } - - /** - * OBU 预警事件 转换交通元素数据 - */ - fun cvxV2vThreatIndInfo2TrafficData(info: CvxV2vThreatIndInfo): TrafficData? { - if (info.basic_info == null || info.basic_info.position == null || info.threat_info == null) { - CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") - return null - } - val trafficData = TrafficData() - trafficData.uuid = info.vehicle_id - trafficData.lat = info.basic_info.position.latitude - trafficData.lon = info.basic_info.position.longitude - trafficData.heading = info.basic_info.heading - trafficData.speed = info.basic_info.speed - // 判断车辆V2X预警级别,调整车辆颜色 - trafficData.threatLevel = info.threat_info.threat_level - - if (info.threat_info.app_id == ObuConstants.USE_CASE_ID.EVW) { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE - } else { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE - } - - return trafficData - } - - /** - * OBU 弱势交通参与者信息 转换交通元素数据 TODO - */ - fun cvxPtcThreatIndInfo2TrafficData(info: CvxPtcThreatIndInfo): TrafficData? { - if (info.ptc_pos == null || info.threat_info == null) { - CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全") - return null - } - val trafficData = TrafficData() - - trafficData.uuid = info.ptc_id - trafficData.lat = info.ptc_pos.latitude - trafficData.lon = info.ptc_pos.longitude -// trafficData.heading = info.ptc_pos.heading -// trafficData.speed = info.ptc_pos.speed - - when (info.ptc_type) { - // 未知 - 0x0 -> { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI - } - // 非机动车 - 0x1 -> { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO - } - // 行人 - 0x2 -> { - trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE - } - } - - // 判断车辆V2X预警级别,调整车辆颜色 - if (info.threat_info != null) { - trafficData.threatLevel = info.threat_info.threat_level - } - - return trafficData - } - - -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuProvider.kt index 7f07c4f11e..9bafd7eca7 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuProvider.kt @@ -14,4 +14,6 @@ interface IMoGoObuProvider : IMoGoFunctionServerProvider { fun disConnect() fun isConnected(): Boolean + + fun setObuLibLog(isSet: Boolean) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerOBUManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerOBUManager.kt index 3dd265e6c8..a561e5bbe7 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerOBUManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerOBUManager.kt @@ -41,4 +41,11 @@ object CallerOBUManager { return providerApi.isConnected() } + /** + * 设置obu sdk的 日志 + */ + fun setObuLog(isSet: Boolean) { + providerApi.setObuLibLog(isSet) + } + } \ No newline at end of file From 09e88c13f65509b57106252df21908b37af40e9a Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 17 Feb 2023 17:25:11 +0800 Subject: [PATCH 02/10] =?UTF-8?q?[dev=5Frobotaxi-d-app-module=5F2132=5F221?= =?UTF-8?q?223=5F2.13.2=5Fsop]=20=E8=A7=A3=E5=86=B3=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=BE=97=E7=A9=BA=E6=8C=87=E9=92=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/obu/mogo/MoGoObuProvider.kt | 1 + .../obu/mogo/MogoPrivateObuNewManager.kt | 42 +++++++++---------- .../mogo/eagle/core/data/obu/ObuStatusInfo.kt | 2 - 3 files changed, 21 insertions(+), 24 deletions(-) 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 ebf56c32b4..81f35634ed 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 @@ -22,6 +22,7 @@ class MoGoObuProvider : IMoGoObuProvider { private var mContext: Context? = null private val taxiObuIp = "192.168.1.199" //taxi和bus网段统一 +// private val taxiObuIp = "192.168.0.53" //室内测试环境 override val functionName: String get() = TAG 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 b2d7d2fcb6..3e47a0a414 100644 --- a/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuNewManager.kt @@ -1,6 +1,7 @@ package com.mogo.eagle.core.function.obu.mogo import android.content.Context +import android.util.Log import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.config.HmiBuildConfig import com.mogo.eagle.core.data.enums.* @@ -197,7 +198,7 @@ class MogoPrivateObuNewManager private constructor() { if (HmiBuildConfig.isShowObuV2vView) { mObuStatusInfo.obuRvStatus = true CallerObuListenerManager.invokeListener(mObuStatusInfo) - if (!data.warningMsg.warningData.isNullOrEmpty()) { + if (data.warningMsg != null) { // 更新数据,远车数据,之前要匹配uuid TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data)?.let { CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it) @@ -213,29 +214,26 @@ class MogoPrivateObuNewManager private constructor() { var appId = "" var level = -1 var status = -1 - data.warningMsg?.let { - if (data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { - level = data.warningMsg.warningData[0].warningLevel - appId = data.warningMsg.warningData[0].warningType.toString() - status = data.warningMsg.warningData[0].status - - //30秒内同一个事件只出现一次 - if (rvMap.containsKey(appId)) { - var oldTime = rvMap[appId] - var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 - if (timeDiff < 30) { - return - } - rvMap.remove(appId) - rvMap[appId] = System.currentTimeMillis() - } else { - rvMap[appId] = System.currentTimeMillis() + if (data.warningMsg.warningData != null && data.warningMsg.warningData.size > 0) { + level = data.warningMsg.warningData[0].warningLevel + appId = data.warningMsg.warningData[0].warningType.toString() + status = data.warningMsg.warningData[0].status + //30秒内同一个事件只出现一次 + if (rvMap.containsKey(appId)) { + var oldTime = rvMap[appId] + var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 + if (timeDiff < 30) { + return } + rvMap.remove(appId) + rvMap[appId] = System.currentTimeMillis() + } else { + rvMap[appId] = System.currentTimeMillis() + } - //拼凑数据 - if (appId != null) { - handleSdkObu(appId, direction, status, level, data) - } + //拼凑数据 + if (appId != null) { + handleSdkObu(appId, direction, status, level, data) } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt index b0206c4d42..cbf40c1031 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/obu/ObuStatusInfo.kt @@ -6,8 +6,6 @@ package com.mogo.eagle.core.data.obu * OBU 相关的状态信息数据 */ class ObuStatusInfo { - // 当前链接的IP地址, 默认地址 192.168.1.199 - var connectIP: String = "192.168.1.199" var obuSdkVersion = "" From 37c93969ea3aa06b27b4feff8a6b41f1330f651c Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Sun, 19 Feb 2023 22:32:40 +0800 Subject: [PATCH 03/10] =?UTF-8?q?[2.14.0]fix=E5=BD=95=E5=8C=85=E5=B7=A5?= =?UTF-8?q?=E5=85=B7Bag=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../badcase/biz/BadCaseManagerView.kt | 63 +++++++++++++------ .../src/main/res/layout/item_bag_manager.xml | 4 +- .../eagle/core/data/badcase/BagInfoEntity.kt | 2 +- 3 files changed, 48 insertions(+), 21 deletions(-) diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseManagerView.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseManagerView.kt index 8150cf6c1b..60b299948b 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseManagerView.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/BadCaseManagerView.kt @@ -281,30 +281,40 @@ class BadCaseManagerView @JvmOverloads constructor( clBagNoDataLayout.visibility = View.GONE if(bagManager.bagsInfoRespCount>0){ bagManagerEntity.bagsInfoResp.clear() + val originBagInfoList = ArrayList() for(bagInfo in bagManager.bagsInfoRespList){ bagInfo?.let { - it.timestamp?.let { time -> - val descriptionEntity = BagDescriptionEntity(it.description.description,it.description.hasAudio,it.description.audioUrl,it.description.reportBI) - val bagInfoEntity = BagInfoEntity() - bagInfoEntity.key = it.key - bagInfoEntity.totalSize = it.totalSize - bagInfoEntity.timestamp = it.timestamp - bagInfoEntity.bagPath = it.bagPath - bagInfoEntity.mergeStat = it.mergeStat - bagInfoEntity.uploadStat = it.uploadStat - bagInfoEntity.itemType = 0 - bagInfoEntity.description = descriptionEntity - for(subBag in it.subBagsList){ - val subBagEntity = SubBagEntity(subBag.key,subBag.host,subBag.size) - bagInfoEntity.subBags.add(subBagEntity) - } + val descriptionEntity = BagDescriptionEntity(it.description.description,it.description.hasAudio,it.description.audioUrl,it.description.reportBI) + val bagInfoEntity = BagInfoEntity() + bagInfoEntity.key = it.key + bagInfoEntity.totalSize = it.totalSize + bagInfoEntity.timestamp = it.timestamp + bagInfoEntity.bagPath = it.bagPath + bagInfoEntity.mergeStat = it.mergeStat + bagInfoEntity.uploadStat = it.uploadStat + bagInfoEntity.itemType = 0 + bagInfoEntity.description = descriptionEntity + for(subBag in it.subBagsList){ + val subBagEntity = SubBagEntity(subBag.key,subBag.host,subBag.size) + bagInfoEntity.subBags.add(subBagEntity) + } + originBagInfoList.add(bagInfoEntity) + //对数组按照时间顺序进行倒序排序 + originBagInfoList.sortWith(Comparator { o1, o2 -> + o2.timestamp.compareTo(o1.timestamp) + }) + } + } + for(originBagInfo in originBagInfoList){ + originBagInfo.let { + it.timestamp.let { time -> val month = time.substring(4,6) val day = time.substring(6,8) val timeStr = "${month}月${day}日" var containTime = false for(bag in bagManagerEntity.bagsInfoResp){ - if(bag.timeStr == time){ + if(bag.timeStr == timeStr){ containTime = true } } @@ -318,16 +328,17 @@ class BadCaseManagerView @JvmOverloads constructor( } var containKey = false for(bagInfoContain in bagManagerEntity.bagsInfoResp){ - if(bagInfoContain.key == bagInfoEntity.key){ + if(bagInfoContain.key == it.key){ containKey = true } } if(!containKey){ - bagManagerEntity.bagsInfoResp.add(bagInfoEntity) + bagManagerEntity.bagsInfoResp.add(it) } } } } + //更新List bagManagerListAdapter?.setData(bagManagerEntity.bagsInfoResp) } @@ -362,6 +373,22 @@ class BadCaseManagerView @JvmOverloads constructor( bagUploadDialog?.uploadCompleted() tvCancelSelect.performClick() } + + when (bagManager.uploadCosResp.stat) { + 0 -> { + ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶成功") + } + 2 -> { + ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶copy过程失败,原因:${bagManager.uploadCosResp.message}") + } + 3 -> { + ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶合并过程失败,原因:${bagManager.uploadCosResp.message}") + } + 4 -> { + ToastUtils.showShort("${bagManager.uploadCosResp.key} 上传cos桶上传过程失败,原因:${bagManager.uploadCosResp.message}") + } + } + } //删除Bag else if(bagManager.reqType == 4){ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml index eb969081db..43fa322211 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml +++ b/core/function-impl/mogo-core-function-devatools/src/main/res/layout/item_bag_manager.xml @@ -29,11 +29,11 @@ android:layout_marginEnd="30dp" android:background="@null" android:drawableEnd="@drawable/icon_bag_edit" + android:drawablePadding="@dimen/dp_10" android:textColor="#FFFFFFFF" android:textSize="32dp" - android:maxLines="1" + android:singleLine="true" android:ellipsize="end" - android:maxLength="9" /> Date: Sun, 19 Feb 2023 22:51:55 +0800 Subject: [PATCH 04/10] =?UTF-8?q?[2.14.0]=E5=A2=9E=E5=8A=A0=E7=BA=A2?= =?UTF-8?q?=E7=BB=BF=E7=81=AF=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2x/trafficlight/core/TrafficLightDispatcher.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightDispatcher.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightDispatcher.kt index c2874fa8af..be3aca66ad 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightDispatcher.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightDispatcher.kt @@ -61,6 +61,8 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight * @param trafficLights 感知红绿灯 */ override fun onAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) { + Log.i(TAG,"hasObuLightStatus="+hasObuLightStatus + " hasAiLightStatus="+hasAiLightStatus) + Log.i(TAG,"时间:"+com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String(System.currentTimeMillis())) if (!hasObuLightStatus) { if (!hasAiLightStatus) { trafficLights?.let { it -> @@ -75,30 +77,39 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight light = it.uTurn } if (light == null) { + Log.i(TAG,"light为空") //隐藏红绿灯显示 TrafficLightHMIManager.INSTANCE.hideTrafficLight() } else { + Log.i(TAG,"light.state="+light.state) when (light.state) { TrafficLightOuterClass.LightState.STATE_RED -> { + Log.i(TAG,"显示红灯") //红灯 CallerHmiManager.showWarningTrafficLight(1, 2) CallerHmiManager.changeCountdownGreen(0) } TrafficLightOuterClass.LightState.STATE_YELLOW -> { + Log.i(TAG,"显示黄灯") //黄灯 CallerHmiManager.showWarningTrafficLight(2, 2) CallerHmiManager.changeCountdownGreen(0) } TrafficLightOuterClass.LightState.STATE_GREEN -> { + Log.i(TAG,"显示绿灯") //绿灯 CallerHmiManager.showWarningTrafficLight(3, 2) CallerHmiManager.changeCountdownGreen(0) } TrafficLightOuterClass.LightState.STATE_OFF -> { + Log.i(TAG,"隐藏显示") //黑灯,隐藏红绿灯显示 TrafficLightHMIManager.INSTANCE.hideTrafficLight() } - else -> {} + else -> { + Log.i(TAG,"直接其他情况") + TrafficLightHMIManager.INSTANCE.hideTrafficLight() + } } } From 8c5452d9953d12a9096bd18ef2a830126839aecf Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Sun, 19 Feb 2023 23:48:13 +0800 Subject: [PATCH 05/10] =?UTF-8?q?[2.14.0]SOP=E8=BF=90=E8=90=A5=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/hmi/ui/setting/SOPSettingView.kt | 61 ++- .../src/main/res/layout/view_sop_setting.xml | 362 +++++++++--------- 2 files changed, 215 insertions(+), 208 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt index a3a612b656..e85c990676 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt @@ -103,28 +103,24 @@ class SOPSettingView @JvmOverloads constructor( * 限速数据来源开关 */ tbRoadLimitSpeedSop.setOnCheckedChangeListener { _, isChecked -> - //默认开启 + //默认关闭 HmiBuildConfig.isShowObuLimitSpeedView = isChecked } /** * obu V2V开关 */ - tbObuV2vView.isChecked = HmiBuildConfig.isShowObuV2vView tbObuV2vView.setOnCheckedChangeListener { _, isChecked -> - //默认开启 + //默认关闭 HmiBuildConfig.isShowObuV2vView = isChecked -// Log.e("liyz", "---2222-- v2v = ${HmiBuildConfig.isShowObuV2vView}") } /** * obu V2i开关 */ - tbObuV2iView.isChecked = HmiBuildConfig.isShowObuV2iView tbObuV2iView.setOnCheckedChangeListener { _, isChecked -> //默认关闭 HmiBuildConfig.isShowObuV2iView = isChecked -// Log.d("liyz", "---2--- v2i = ${HmiBuildConfig.isShowObuV2iView}") } /** @@ -161,7 +157,10 @@ class SOPSettingView @JvmOverloads constructor( // 演示模式,上一次勾选的数据 tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode // 演示模式 - tbDemoMode.setOnCheckedChangeListener { _, _ -> + tbDemoMode.setOnCheckedChangeListener { compoundButton, _ -> + if(!compoundButton.isPressed){ + return@setOnCheckedChangeListener + } FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode CallerHmiManager.updateStatusBarLeftView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(context)) CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode) @@ -179,7 +178,10 @@ class SOPSettingView @JvmOverloads constructor( // 雨天模式,上一次勾选的数据 tbRainMode.isChecked = FunctionBuildConfig.isRainMode //雨天模式 - tbRainMode.setOnCheckedChangeListener { _, isChecked -> + tbRainMode.setOnCheckedChangeListener { compoundButton, isChecked -> + if(!compoundButton.isPressed){ + return@setOnCheckedChangeListener + } CallerAutoPilotManager.setRainMode(isChecked) FunctionBuildConfig.isRainMode = isChecked } @@ -191,8 +193,12 @@ class SOPSettingView @JvmOverloads constructor( //OBU控制总开关 tbObu.isChecked = CallerOBUManager.isConnected() tbObu.setOnCheckedChangeListener { _, isChecked -> - if (isChecked) { - CallerOBUManager.resetObuIpAddress("192.168.1.199") + if (!isChecked) { + if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { + CallerOBUManager.resetObuIpAddress("192.168.1.199") + } else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { + CallerOBUManager.resetObuIpAddress("192.168.1.199") + } } else { //断开链接 CallerOBUManager.disConnectObu() @@ -268,11 +274,8 @@ class SOPSettingView @JvmOverloads constructor( private val timerTaskRefresh = object : TimerTask(){ override fun run() { UiThreadHandler.post{ - if(FunctionBuildConfig.isDemoMode){ - tbDemoMode.text = "关闭美化模式" - }else{ - tbDemoMode.text = "开启美化模式" - } + tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode + tbRainMode.isChecked = FunctionBuildConfig.isRainMode } } @@ -282,39 +285,27 @@ class SOPSettingView @JvmOverloads constructor( when (type) { FuncBizConfig.BIZ_BEAUTY_MODE -> { tbDemoMode.isClickable = !lock - val (left,top,right,bottom) = tbDemoMode.currentPadding() - if (lock) { - tbDemoMode.background = - resources.getDrawable(R.drawable.radio_button_lock_background) - } else { - tbDemoMode.background = - resources.getDrawable(R.drawable.radio_button_normal_background_right) + if(lock){ + tbDemoMode.visibility = View.INVISIBLE + }else{ + tbDemoMode.visibility = View.VISIBLE } - tbDemoMode.setPadding(left,top,right,bottom) } FuncBizConfig.BIZ_RAIN_MODE -> { tbRainMode.isClickable = !lock - val (left,top,right,bottom) = tbRainMode.currentPadding() if (lock) { - tbRainMode.background = - resources.getDrawable(R.drawable.radio_button_lock_background) + tbRainMode.visibility = View.INVISIBLE } else { - tbRainMode.background = - resources.getDrawable(R.drawable.radio_button_normal_background_right) + tbRainMode.visibility = View.VISIBLE } - tbRainMode.setPadding(left,top,right,bottom) } FuncBizConfig.BIZ_PNC_WARNING -> { tbMarkingObstacles.isClickable = !lock - val (left,top,right,bottom) = tbMarkingObstacles.currentPadding() if (lock) { - tbMarkingObstacles.background = - resources.getDrawable(R.drawable.radio_button_lock_background) + tbMarkingObstacles.visibility = View.INVISIBLE } else { - tbMarkingObstacles.background = - resources.getDrawable(R.drawable.radio_button_normal_background_right) + tbMarkingObstacles.visibility = View.VISIBLE } - tbMarkingObstacles.setPadding(left,top,right,bottom) } } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml index d6720d62b6..53f1efd8ba 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml @@ -16,205 +16,231 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + + - + - + - + - + - - + - + - + - - - - - - - - - - - - + android:text="V2I事件" + android:paddingTop="25dp" + android:paddingBottom="25dp" + android:scaleY="1.2" + android:scaleX="1.2" + app:layout_constraintTop_toBottomOf="@id/tbRainMode" + app:layout_constraintLeft_toRightOf="@id/verticalGuideLine" + app:layout_constraintRight_toRightOf="parent" + /> + + + + + + + + + + @@ -278,16 +304,6 @@ android:layout_marginStart="10dp" /> - - From dde4e503a2b58339455fc6465eefe59f353505d5 Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Mon, 20 Feb 2023 10:22:21 +0800 Subject: [PATCH 06/10] =?UTF-8?q?[2.14.0]=20=E5=9C=B0=E5=9B=BE=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8D=87=E7=BA=A72.10.0.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 3e288c6fbd..b12cf5bed0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -85,7 +85,7 @@ MOGO_LOCATION_VERSION=1.4.3.32 MOGO_TELEMATIC_VERSION=1.4.3.32 ######## MogoAiCloudSDK Version ######## # 自研地图 -MAP_SDK_VERSION=2.10.0.2 +MAP_SDK_VERSION=2.10.0.7 MAP_SDK_OPERATION_VERSION=1.1.4.1 # websocket WEBSOCKET_VERSION=1.1.7 From d2742934aca7f45e6dc15488f995c4265f25bcac Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Mon, 20 Feb 2023 12:02:44 +0800 Subject: [PATCH 07/10] =?UTF-8?q?[2.14.0][Opt]=E5=8D=87=E7=BA=A7=E9=AB=98?= =?UTF-8?q?=E5=BE=B7=E5=9C=B0=E5=9B=BE=E7=89=88=E6=9C=AC=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 6 +-- .../function/hmi/ui/map/OfflineMapDialog.kt | 10 +++++ .../mogo-core-function-map/build.gradle | 1 - .../call/map/CallerMapUIServiceManager.kt | 4 ++ .../com/mogo/map/hdcache/IHdCacheListener.kt | 2 + .../uicontroller/IMogoMapUIController.java | 2 + libraries/mogo-map/build.gradle | 3 +- .../java/com/mogo/map/AMapViewWrapper.java | 42 +++++++++++++++---- .../com/mogo/map/MogoMapUIController.java | 7 ++++ .../mogo/map/location/GDLocationClient.java | 36 +++++++++------- .../map/uicontroller/AMapUIController.java | 7 ++++ 11 files changed, 93 insertions(+), 27 deletions(-) diff --git a/config.gradle b/config.gradle index 444370d4a8..e2d70bfd02 100644 --- a/config.gradle +++ b/config.gradle @@ -23,9 +23,9 @@ ext { // amapnavi3dmap : "com.amap.api:navi-3dmap:8.0.1_3dmap8.0.1", // amapsearch : "com.amap.api:search:7.9.0", // amaplocation : "com.amap.api:location:5.5.0", - amapnavi3dmap : "com.amap.api:navi-3dmap:8.0.1_3dmap8.0.1", - amapsearch : "com.amap.api:search:7.1.0", - amaplocation : "com.amap.api:location:5.3.1", + amapnavi3dmap : "com.amap.api:navi-3dmap:9.5.1_3dmap9.5.0", + amapsearch : "com.amap.api:search:9.5.0", + amaplocation : "com.amap.api:location:6.2.0", // json 转换 gson : "com.google.code.gson:gson:2.8.4", // 内存泄漏检测 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt index aa62c470b2..3383ace8cc 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt @@ -84,6 +84,9 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) { } okView?.setOnClickListener { + if (isLoading) { + CallerMapUIServiceManager.cancelDownloadCacheData() + } dismiss() } } @@ -93,6 +96,12 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) { override fun onMapHdCacheProgress(cityId: Int, progress: Double) { updateProgress(progress.toInt()) } + + override fun onMapHdCacheResult(cityId: Int, state: Int) { + if (state == 0) {// 失败 + showNewContent(isLoading = false, false) + } + } }) } @@ -134,6 +143,7 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) { @SuppressLint("UseCompatLoadingForDrawables") private fun showNewContent(isLoading: Boolean, isSuccess: Boolean) { + this.isLoading = isLoading change2NewStyle() when { isLoading -> { diff --git a/core/function-impl/mogo-core-function-map/build.gradle b/core/function-impl/mogo-core-function-map/build.gradle index 01e097ded7..70b7ff0853 100644 --- a/core/function-impl/mogo-core-function-map/build.gradle +++ b/core/function-impl/mogo-core-function-map/build.gradle @@ -60,7 +60,6 @@ dependencies { implementation rootProject.ext.dependencies.mogocustommap implementation rootProject.ext.dependencies.amapnavi3dmap - implementation rootProject.ext.dependencies.amaplocation implementation rootProject.ext.dependencies.androidxroomruntime kapt rootProject.ext.dependencies.androidxroomcompiler diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt index 571b02d4b9..3543a6f5aa 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt @@ -51,4 +51,8 @@ object CallerMapUIServiceManager { fun isCityDataCached(): Boolean { return serviceProvider?.mapUIController?.isCityDataCached ?: true } + + fun cancelDownloadCacheData() { + serviceProvider?.mapUIController?.cancelDownloadCacheData() + } } \ No newline at end of file diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt index 4761e40fff..9492c60ba7 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt @@ -2,4 +2,6 @@ package com.mogo.map.hdcache interface IHdCacheListener { fun onMapHdCacheProgress(cityId: Int, progress: Double) + + fun onMapHdCacheResult(cityId: Int, state: Int)// 0失败,1成功 } \ No newline at end of file diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index eaa04ac0c6..920e4b64cb 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -348,4 +348,6 @@ public interface IMogoMapUIController { * @return */ boolean isCityDataCached(); + + void cancelDownloadCacheData(); } diff --git a/libraries/mogo-map/build.gradle b/libraries/mogo-map/build.gradle index f4e1bf9862..de2755fc0f 100644 --- a/libraries/mogo-map/build.gradle +++ b/libraries/mogo-map/build.gradle @@ -49,7 +49,8 @@ dependencies { // 高精地图 implementation rootProject.ext.dependencies.mogocustommap // 高德地图 - api rootProject.ext.dependencies.amaplocation +// api rootProject.ext.dependencies.amaplocation + api rootProject.ext.dependencies.amapnavi3dmap if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { implementation rootProject.ext.dependencies.mogo_core_utils diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java index 6e65bd6ca2..4b92226e7b 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java @@ -64,6 +64,7 @@ import com.mogo.map.utils.ResIdCache; import com.zhidaoauto.map.sdk.open.MapAutoApi; import com.zhidaoauto.map.sdk.open.abs.MapStatusListener; import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener; +import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener; import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener; import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener; import com.zhidaoauto.map.sdk.open.abs.OnMapStyleListener; @@ -1183,17 +1184,35 @@ public class AMapViewWrapper implements IMogoMapView, Integer id = HDMapUtils.getHDCityCode(gdCityCode); if (id != null) { hdCacheListener = listener; - mMapView.getMapAutoViewHelper().cacheHDDataByCity(id, (cityId, progress) -> { - if (Thread.currentThread() == Looper.getMainLooper().getThread()) { - if (hdCacheListener != null) { - hdCacheListener.onMapHdCacheProgress(cityId, progress * 100); - } - } else { - UiThreadHandler.post(() -> { + mMapView.getMapAutoViewHelper().cacheHDDataByCity(id, new OnHdDataDownByCityListener() { + @Override + public void onMapHDDataCacheProgressByCity(int cityId, double progress) { + if (Thread.currentThread() == Looper.getMainLooper().getThread()) { if (hdCacheListener != null) { hdCacheListener.onMapHdCacheProgress(cityId, progress * 100); } - }); + } else { + UiThreadHandler.post(() -> { + if (hdCacheListener != null) { + hdCacheListener.onMapHdCacheProgress(cityId, progress * 100); + } + }); + } + } + + @Override + public void onMapHDDataCacheStateByCity(int i, int state) {// 0失败,1成功 + if (Thread.currentThread() == Looper.getMainLooper().getThread()) { + if (hdCacheListener != null) { + hdCacheListener.onMapHdCacheResult(i, state); + } + } else { + UiThreadHandler.post(() -> { + if (hdCacheListener != null) { + hdCacheListener.onMapHdCacheResult(i, state); + } + }); + } } }); } @@ -1218,4 +1237,11 @@ public class AMapViewWrapper implements IMogoMapView, } return true; } + + @Override + public void cancelDownloadCacheData() { + if (mMapView.getMapAutoViewHelper() != null) { + mMapView.getMapAutoViewHelper().cancelCacheHDData(); + } + } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index edda8cd20b..ab7e482bb4 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -458,4 +458,11 @@ public class MogoMapUIController implements IMogoMapUIController { } return true; } + + @Override + public void cancelDownloadCacheData() { + if (mDelegate != null) { + mDelegate.cancelDownloadCacheData(); + } + } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java index cc23b9af97..9e251665b4 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java @@ -27,26 +27,34 @@ public class GDLocationClient implements AMapLocationListener { } //声明LocationClient对象 - private final AMapLocationClient mLocationClient; + private AMapLocationClient mLocationClient; private String mCityCode; private GDLocationClient(Context context) { - mLocationClient = new AMapLocationClient(context); - //初始化定位参数 - //声明mLocationOption对象 - AMapLocationClientOption mLocationOption = new AMapLocationClientOption(); - //设置定位监听 - mLocationClient.setLocationListener(this); - //设置定位模式为高精度模式,Battery_Saving为低功耗模式,Device_Sensors是仅设备模式 - mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy); - //设置定位间隔,单位毫秒,默认为2000ms - mLocationOption.setInterval(1000); - //设置定位参数 - mLocationClient.setLocationOption(mLocationOption); + AMapLocationClient.updatePrivacyShow(context, true, true); + AMapLocationClient.updatePrivacyAgree(context, true); + try { + mLocationClient = new AMapLocationClient(context); + //初始化定位参数 + //声明mLocationOption对象 + AMapLocationClientOption mLocationOption = new AMapLocationClientOption(); + //设置定位监听 + mLocationClient.setLocationListener(this); + //设置定位模式为高精度模式,Battery_Saving为低功耗模式,Device_Sensors是仅设备模式 + mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy); + //设置定位间隔,单位毫秒,默认为2000ms + mLocationOption.setInterval(1000); + //设置定位参数 + mLocationClient.setLocationOption(mLocationOption); + } catch (Exception e) { + e.printStackTrace(); + } } public void start() { - mLocationClient.startLocation(); + if(mLocationClient != null){ + mLocationClient.startLocation(); + } } @Override diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java index 7a4d26ad38..21fde51ca5 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java @@ -391,4 +391,11 @@ public class AMapUIController implements IMogoMapUIController { } return true; } + + @Override + public void cancelDownloadCacheData() { + if (mClient != null) { + mClient.cancelDownloadCacheData(); + } + } } From b4717185110d21ab07c98b85bba6e01fc056cd48 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Mon, 20 Feb 2023 13:31:49 +0800 Subject: [PATCH 08/10] =?UTF-8?q?[2.14.0][Fix]=E8=A7=A3=E5=86=B3Taxi?= =?UTF-8?q?=E4=B9=98=E5=AE=A2=E5=B1=8F=E6=89=93=E5=8C=85=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../passenger/model/TaxiPassengerGeocodeSearchModel.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerGeocodeSearchModel.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerGeocodeSearchModel.java index 1543ad8da0..0ee57c0c2c 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerGeocodeSearchModel.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerGeocodeSearchModel.java @@ -2,6 +2,7 @@ package com.mogo.och.taxi.passenger.model; import android.content.Context; +import com.amap.api.services.core.AMapException; import com.amap.api.services.core.LatLonPoint; import com.amap.api.services.geocoder.GeocodeResult; import com.amap.api.services.geocoder.GeocodeSearch; @@ -52,8 +53,12 @@ public class TaxiPassengerGeocodeSearchModel implements GeocodeSearch.OnGeocodeS public void initGeocodeSearch(){ //通过经纬度逆地理编码得到位置 - mGeocodeSearch = new GeocodeSearch(mContext); - mGeocodeSearch.setOnGeocodeSearchListener(this); + try { + mGeocodeSearch = new GeocodeSearch(mContext); + mGeocodeSearch.setOnGeocodeSearchListener(this); + } catch (AMapException e) { + e.printStackTrace(); + } timer = new Timer(); timerTask = new TimerTask() { @Override From 9863924ebb8478dfdb59c7675f37a6e1c4fd960e Mon Sep 17 00:00:00 2001 From: zhongchao Date: Mon, 20 Feb 2023 14:54:52 +0800 Subject: [PATCH 09/10] [2.14.0] pnc add try catch --- .../function/hmi/ui/pnc/PncActionsView.kt | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt index 29fd379f52..6a15160b33 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/pnc/PncActionsView.kt @@ -72,37 +72,40 @@ class PncActionsView @JvmOverloads constructor( @BizConfig(FOUNDATION, "", BIZ_PNC_ACTIONS) override fun pncActions(planningActionMsg: MessagePad.PlanningActionMsg) { - mAutoPilotStatusInfo?.let { it -> - if (it.state == STATUS_AUTOPILOT_RUNNING) { - UiThreadHandler.post { - var actions: String? = null - planningActionMsg.actionMsg?.let { - actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number) + try { + mAutoPilotStatusInfo?.let { it -> + if (it.state == STATUS_AUTOPILOT_RUNNING) { + UiThreadHandler.post { + var actions: String? = null + planningActionMsg.actionMsg?.let { + actions = PncActionsHelper.getAction(it.drivingState.number, it.drivingAction.number) - //如果是存在云端红绿灯数据条件下,设置云端数据 - if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number) - && mTrafficLightResult != null - && getWaitTrafficlightTime().isNotBlank()) { - actions += ",预计${getWaitTrafficlightTime()}秒后通过" + //如果是存在云端红绿灯数据条件下,设置云端数据 + if (PncActionsHelper.isWaitingTrafficlight(it.drivingState.number, it.drivingAction.number) + && mTrafficLightResult != null + && getWaitTrafficlightTime().isNotBlank()) { + actions += ",预计${getWaitTrafficlightTime()}秒后通过" + } else { + mTrafficLightResult = null + } + } + // update view + if (actions.isNullOrEmpty()) { + this.background = null + tvHmiPncActions.text = "" } else { - mTrafficLightResult = null + this.background = AppCompatResources.getDrawable(context, R.drawable.pnc_actions_bg) + tvHmiPncActions.text = actions } } - // update view - if (actions.isNullOrEmpty()) { - this.background = null - tvHmiPncActions.text = "" - } else { - this.background = AppCompatResources.getDrawable(context, R.drawable.pnc_actions_bg) - tvHmiPncActions.text = actions - } + }else{ + this.background = null + tvHmiPncActions.text = "" } - }else{ - this.background = null - tvHmiPncActions.text = "" } + }catch (e:Exception){ + e.printStackTrace() } - } override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) { From dac3d92a1198327db68f8bdbef4b8aeb589cdeb1 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 20 Feb 2023 15:23:53 +0800 Subject: [PATCH 10/10] =?UTF-8?q?[dev=5Frobotaxi-d-app-module=5F2132=5F221?= =?UTF-8?q?223=5F2.13.2=5Fsop]=20=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 f7b4c5d0ba..41f3af84b2 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 @@ -1193,9 +1193,9 @@ class MoGoHmiFragment : MvpFragment(), mViewLimitingVelocity?.updateLimitingSpeed(limitingSpeed, limitSpeedSource) tvLimitingSource?.visibility = View.VISIBLE if (limitSpeedSource == 1) { - tvLimitingSource.text = "MAP" + tvLimitingSource?.text = "MAP" } else if (limitSpeedSource == 2) { - tvLimitingSource.text = "RSU" + tvLimitingSource?.text = "RSU" } } else { mViewLimitingVelocity?.visibility = View.INVISIBLE