From 9b63085f98de5fb97b89eacd7f7dce5033efd064 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Thu, 2 Nov 2023 18:01:37 +0800 Subject: [PATCH] [6.2.0] add func of over take limit set --- .../function/hmi/ui/setting/SOPSettingView.kt | 348 +++++++---- .../function/hmi/ui/vehicle/PncActionsView.kt | 14 +- .../src/main/res/layout/view_sop_setting.xml | 547 +++++++++--------- .../core/function/smp/view/SmallMapView.kt | 49 +- .../biz/trafficlight/TrafficLightStatus.kt | 2 +- .../core/data/config/FunctionBuildConfig.kt | 8 + .../main/res/drawable-xhdpi/map_m2_icon.png | Bin 0 -> 4704 bytes .../core/utilcode/mogo/logger/scene/Scene.kt | 2 +- 8 files changed, 560 insertions(+), 410 deletions(-) create mode 100644 core/mogo-core-res/src/main/res/drawable-xhdpi/map_m2_icon.png 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 a789e7e1da..fe2c71d4ff 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 @@ -1,6 +1,8 @@ package com.mogo.eagle.core.function.hmi.ui.setting import android.content.Context +import android.text.Editable +import android.text.TextWatcher import android.util.AttributeSet import android.view.LayoutInflater import android.view.View @@ -13,23 +15,26 @@ import com.mogo.eagle.core.data.multidisplay.TelematicConstant import com.mogo.eagle.core.data.obu.MogoObuConst import com.mogo.eagle.core.function.api.autopilot.IMoGoGetParamResponseListener import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener -import com.mogo.eagle.core.function.api.devatools.mofang.* +import com.mogo.eagle.core.function.api.devatools.mofang.IMoGoMoFangProvider import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_DEMO import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_RAIN import com.mogo.eagle.core.function.api.setting.ISopSettingListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotGetParamResponseDispatcher -import com.mogo.eagle.core.function.call.devatools.* +import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager +import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.hmi.CallerHmiManager -import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.obu.CallerObuApiManager import com.mogo.eagle.core.function.call.setting.CallerSopSettingManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager +import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog.Companion.hmiAction import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils +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.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import com.zhjt.mogo.adas.data.AdasConstants @@ -63,7 +68,7 @@ internal class SOPSettingView @JvmOverloads constructor( } private fun initView() { - sopLayout.setOnClickListener { } + sopLayout.setOnClickListener { } //V2X消息设置 v2xSetting() //地图效果类设置 @@ -77,41 +82,41 @@ internal class SOPSettingView @JvmOverloads constructor( /** * V2X消息设置 */ - private fun v2xSetting(){ + private fun v2xSetting() { //V2X总开关 scV2XSwitch.isChecked = FunctionBuildConfig.v2xMainSwitch scV2XSwitch.setOnCheckedChangeListener { _, isChecked -> FunctionBuildConfig.v2xMainSwitch = isChecked - hmiAction("SOP V2X总开关, ",isChecked) - if(isChecked){ + hmiAction("SOP V2X总开关, ", isChecked) + if (isChecked) { //V2N总开关 scV2NSwitch.isChecked = FunctionBuildConfig.v2nMainSwitch - hmiAction("SOP V2N总开关, ",FunctionBuildConfig.v2nMainSwitch) + hmiAction("SOP V2N总开关, ", FunctionBuildConfig.v2nMainSwitch) //V2I总开关 scV2ISwitch.isChecked = HmiBuildConfig.isShowObuV2iView - hmiAction("SOP V2I总开关, ",HmiBuildConfig.isShowObuV2iView) + hmiAction("SOP V2I总开关, ", HmiBuildConfig.isShowObuV2iView) //V2V总开关 scObuV2vView.isChecked = HmiBuildConfig.isShowObuV2vView - hmiAction("SOP V2V总开关, ",HmiBuildConfig.isShowObuV2vView) + hmiAction("SOP V2V总开关, ", HmiBuildConfig.isShowObuV2vView) //obu总开关 scObu.isChecked = obuConnectStatus - hmiAction("SOP obu总开关, ",obuConnectStatus) - if(obuConnectStatus){ + hmiAction("SOP obu总开关, ", obuConnectStatus) + if (obuConnectStatus) { CallerObuApiManager.resetObuIpAddress(MogoObuConst.OBU_DEFAULT_IP) } - }else{ + } else { //V2N总开关 scV2NSwitch.isChecked = false - hmiAction("SOP V2N总开关, ",false) + hmiAction("SOP V2N总开关, ", false) //V2I总开关 scV2ISwitch.isChecked = false - hmiAction("SOP V2I总开关, ",false) + hmiAction("SOP V2I总开关, ", false) //V2V总开关 scObuV2vView.isChecked = false - hmiAction("SOP V2V总开关, ",false) + hmiAction("SOP V2V总开关, ", false) //obu总开关 scObu.isChecked = false - hmiAction("SOP OBU控制总开关, ",false) + hmiAction("SOP OBU控制总开关, ", false) //断开链接 CallerObuApiManager.disConnectObu() } @@ -131,35 +136,41 @@ internal class SOPSettingView @JvmOverloads constructor( //绿波通行(默认关闭) scGreenWaveSop.isEnabled = FunctionBuildConfig.v2nMainSwitch scV2NSwitch.setOnCheckedChangeListener { compoundButton, isChecked -> - if(isChecked){ + if (isChecked) { //V2N新链路 scNewV2NData.isChecked = FunctionBuildConfig.isNewV2NData - hmiAction("SOP 是否是V2N新链路(云->工控机->App)",FunctionBuildConfig.isNewV2NData) + hmiAction("SOP 是否是V2N新链路(云->工控机->App)", FunctionBuildConfig.isNewV2NData) //V2N场景进PNC scV2nPnc.isChecked = FunctionBuildConfig.isV2NPnc - hmiAction("SOP V2N场景进PNC, ",FunctionBuildConfig.isV2NPnc) + hmiAction("SOP V2N场景进PNC, ", FunctionBuildConfig.isV2NPnc) CallerAutoPilotControlManager.sendV2nToPncCmd(FunctionBuildConfig.isV2NPnc) //绿波通行 scGreenWaveSop.isChecked = HmiBuildConfig.isShowGreenWaveView - hmiAction("SOP obu绿波通行, ",HmiBuildConfig.isShowGreenWaveView) - CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_GREENWAVE_WARNING, "1".toByteArray()) - }else{ + hmiAction("SOP obu绿波通行, ", HmiBuildConfig.isShowGreenWaveView) + CallerTelematicManager.sendMsgToAllClients( + TelematicConstant.OBU_GREENWAVE_WARNING, + "1".toByteArray() + ) + } else { //V2N新链路 scNewV2NData.isChecked = false - hmiAction("SOP 是否是V2N新链路(云->工控机->App)",false) + hmiAction("SOP 是否是V2N新链路(云->工控机->App)", false) //V2N场景进PNC scV2nPnc.isChecked = false - hmiAction("SOP V2N场景进PNC, ",false) + hmiAction("SOP V2N场景进PNC, ", false) CallerAutoPilotControlManager.sendV2nToPncCmd(false) //绿波通行 scGreenWaveSop.isChecked = false - hmiAction("SOP obu绿波通行, ",false) - CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_GREENWAVE_WARNING, "0".toByteArray()) + hmiAction("SOP obu绿波通行, ", false) + CallerTelematicManager.sendMsgToAllClients( + TelematicConstant.OBU_GREENWAVE_WARNING, + "0".toByteArray() + ) } scNewV2NData.isEnabled = isChecked scV2nPnc.isEnabled = isChecked scGreenWaveSop.isEnabled = isChecked - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } FunctionBuildConfig.v2nMainSwitch = isChecked @@ -172,35 +183,41 @@ internal class SOPSettingView @JvmOverloads constructor( scRunRedLightSop.isEnabled = HmiBuildConfig.isShowObuV2iView scObuWeaknessTrafficSop.isEnabled = HmiBuildConfig.isShowObuV2iView scV2ISwitch.setOnCheckedChangeListener { compoundButton, isChecked -> - if(isChecked){ + if (isChecked) { //V2I场景进PNC scV2iPnc.isChecked = FunctionBuildConfig.isV2IPnc - hmiAction("SOP V2I场景进PNC, ",FunctionBuildConfig.isV2IPnc) + hmiAction("SOP V2I场景进PNC, ", FunctionBuildConfig.isV2IPnc) CallerAutoPilotControlManager.sendV2iToPncCmd(FunctionBuildConfig.isV2IPnc) //闯红灯预警 scRunRedLightSop.isChecked = HmiBuildConfig.isShowRunRedLightView - hmiAction("SOP obu闯红灯预警, ",HmiBuildConfig.isShowRunRedLightView) - CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "1".toByteArray()) + hmiAction("SOP obu闯红灯预警, ", HmiBuildConfig.isShowRunRedLightView) + CallerTelematicManager.sendMsgToAllClients( + TelematicConstant.OBU_RUNREDLIGHT_WARNING, + "1".toByteArray() + ) //路侧弱势交通参与者 scObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView - hmiAction("SOP obu弱势交通控制, ",HmiBuildConfig.isShowObuWeaknessTrafficView) - }else{ + hmiAction("SOP obu弱势交通控制, ", HmiBuildConfig.isShowObuWeaknessTrafficView) + } else { //V2I场景进PNC scV2iPnc.isChecked = false CallerAutoPilotControlManager.sendV2iToPncCmd(false) - hmiAction("SOP V2I场景进PNC, ",false) + hmiAction("SOP V2I场景进PNC, ", false) //闯红灯预警 scRunRedLightSop.isChecked = false - hmiAction("SOP obu闯红灯预警, ",false) - CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "0".toByteArray()) + hmiAction("SOP obu闯红灯预警, ", false) + CallerTelematicManager.sendMsgToAllClients( + TelematicConstant.OBU_RUNREDLIGHT_WARNING, + "0".toByteArray() + ) //路侧弱势交通参与者 scObuWeaknessTrafficSop.isChecked = false - hmiAction("SOP obu弱势交通控制, ",false) + hmiAction("SOP obu弱势交通控制, ", false) } scV2iPnc.isEnabled = isChecked scRunRedLightSop.isEnabled = isChecked scObuWeaknessTrafficSop.isEnabled = isChecked - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } HmiBuildConfig.isShowObuV2iView = isChecked @@ -209,20 +226,20 @@ internal class SOPSettingView @JvmOverloads constructor( //V2N新链路 scNewV2NData.isChecked = FunctionBuildConfig.isNewV2NData scNewV2NData.setOnCheckedChangeListener { compoundButton, isChecked -> - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } - hmiAction("SOP 是否是V2N新链路(云->工控机->App)",isChecked) + hmiAction("SOP 是否是V2N新链路(云->工控机->App)", isChecked) FunctionBuildConfig.isNewV2NData = isChecked } //V2N场景进PNC scV2nPnc.isChecked = FunctionBuildConfig.isV2NPnc - scV2nPnc.setOnCheckedChangeListener{ compoundButton, isChecked -> - if(!compoundButton.isPressed){ + scV2nPnc.setOnCheckedChangeListener { compoundButton, isChecked -> + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } - hmiAction("SOP V2N场景进PNC, ",isChecked) + hmiAction("SOP V2N场景进PNC, ", isChecked) CallerAutoPilotControlManager.sendV2nToPncCmd(isChecked) FunctionBuildConfig.isV2NPnc = isChecked } @@ -230,25 +247,31 @@ internal class SOPSettingView @JvmOverloads constructor( //绿波通行(默认关闭) scGreenWaveSop.isChecked = HmiBuildConfig.isShowGreenWaveView scGreenWaveSop.setOnCheckedChangeListener { compoundButton, isChecked -> - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } - hmiAction("SOP obu绿波通行, ",isChecked) + hmiAction("SOP obu绿波通行, ", isChecked) HmiBuildConfig.isShowGreenWaveView = isChecked if (HmiBuildConfig.isShowGreenWaveView) { - CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_GREENWAVE_WARNING, "1".toByteArray()) + CallerTelematicManager.sendMsgToAllClients( + TelematicConstant.OBU_GREENWAVE_WARNING, + "1".toByteArray() + ) } else { - CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_GREENWAVE_WARNING, "0".toByteArray()) + CallerTelematicManager.sendMsgToAllClients( + TelematicConstant.OBU_GREENWAVE_WARNING, + "0".toByteArray() + ) } } //V2I场景进PNC scV2iPnc.isChecked = FunctionBuildConfig.isV2IPnc - scV2iPnc.setOnCheckedChangeListener{ compoundButton, isChecked -> - if(!compoundButton.isPressed){ + scV2iPnc.setOnCheckedChangeListener { compoundButton, isChecked -> + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } - hmiAction("SOP V2I场景进PNC, ",isChecked) + hmiAction("SOP V2I场景进PNC, ", isChecked) CallerAutoPilotControlManager.sendV2iToPncCmd(isChecked) FunctionBuildConfig.isV2IPnc = isChecked } @@ -256,35 +279,41 @@ internal class SOPSettingView @JvmOverloads constructor( //闯红灯预警(默认关闭) scRunRedLightSop.isChecked = HmiBuildConfig.isShowRunRedLightView scRunRedLightSop.setOnCheckedChangeListener { compoundButton, isChecked -> - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } - hmiAction("SOP obu闯红灯预警, ",isChecked) + hmiAction("SOP obu闯红灯预警, ", isChecked) HmiBuildConfig.isShowRunRedLightView = isChecked if (HmiBuildConfig.isShowRunRedLightView) { - CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "1".toByteArray()) + CallerTelematicManager.sendMsgToAllClients( + TelematicConstant.OBU_RUNREDLIGHT_WARNING, + "1".toByteArray() + ) } else { - CallerTelematicManager.sendMsgToAllClients(TelematicConstant.OBU_RUNREDLIGHT_WARNING, "0".toByteArray()) + CallerTelematicManager.sendMsgToAllClients( + TelematicConstant.OBU_RUNREDLIGHT_WARNING, + "0".toByteArray() + ) } } //路侧弱势交通参与者(默认开启) scObuWeaknessTrafficSop.isChecked = HmiBuildConfig.isShowObuWeaknessTrafficView scObuWeaknessTrafficSop.setOnCheckedChangeListener { compoundButton, isChecked -> - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } - hmiAction("SOP obu弱势交通控制, ",isChecked) + hmiAction("SOP obu弱势交通控制, ", isChecked) HmiBuildConfig.isShowObuWeaknessTrafficView = isChecked } //V2V总开关(默认关闭) scObuV2vView.isChecked = HmiBuildConfig.isShowObuV2vView scObuV2vView.setOnCheckedChangeListener { compoundButton, isChecked -> - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } - hmiAction("SOP obuV2V开关, ",isChecked) + hmiAction("SOP obuV2V开关, ", isChecked) HmiBuildConfig.isShowObuV2vView = isChecked } @@ -292,10 +321,10 @@ internal class SOPSettingView @JvmOverloads constructor( obuConnectStatus = CallerObuApiManager.isConnected() scObu.isChecked = obuConnectStatus scObu.setOnCheckedChangeListener { compoundButton, isChecked -> - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } - hmiAction("SOP OBU控制总开关, ",isChecked) + hmiAction("SOP OBU控制总开关, ", isChecked) if (isChecked) { CallerObuApiManager.resetObuIpAddress(MogoObuConst.OBU_DEFAULT_IP) } else { @@ -309,11 +338,11 @@ internal class SOPSettingView @JvmOverloads constructor( /** * 地图效果类设置 */ - private fun mapSetting(){ + private fun mapSetting() { //危险障碍物颜色标记开关 scMarkingObstacles.isChecked = FunctionBuildConfig.isPNCWarning scMarkingObstacles.setOnCheckedChangeListener { _, isChecked -> - hmiAction("SOP 危险障碍物颜色标记开关, ",isChecked) + hmiAction("SOP 危险障碍物颜色标记开关, ", isChecked) FunctionBuildConfig.isPNCWarning = isChecked } if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { @@ -323,7 +352,7 @@ internal class SOPSettingView @JvmOverloads constructor( //引导线动态效果 scRouteDynamicEffect.isChecked = HmiBuildConfig.isShowRouteStrategy scRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked -> - hmiAction("SOP 引导线动态效果, ",isChecked) + hmiAction("SOP 引导线动态效果, ", isChecked) HmiBuildConfig.isShowRouteStrategy = isChecked } @@ -332,37 +361,37 @@ internal class SOPSettingView @JvmOverloads constructor( scDrawPointCloudData.isChecked = FunctionBuildConfig.isDrawPointCloudData //是否渲染点云数据 scDrawPointCloudData.setOnCheckedChangeListener { compoundButton, isChecked -> - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } //打开点云效果时,如果自车光圈是关闭状态,则自动打开自车光圈(点云是跟随光圈的 默认没有光圈就不显示点云的) - if(isChecked && !FunctionBuildConfig.isDisplayAnimEnable){ + if (isChecked && !FunctionBuildConfig.isDisplayAnimEnable) { scCarAperture.isChecked = true - }else{ + } else { scCarAperture.isChecked = FunctionBuildConfig.isDisplayAnimEnable } CallerAutoPilotControlManager.setIsDrawPointCloud(isChecked) FunctionBuildConfig.isDrawPointCloudData = isChecked CallerMapUIServiceManager.getMapUIController()?.setIsDrawPointCloud(isChecked) CallerSopSettingManager.invokePointCloudListener(isChecked) - hmiAction("SOP 是否渲染点云数据, ",isChecked) + hmiAction("SOP 是否渲染点云数据, ", isChecked) } //自车光圈 - if(FunctionBuildConfig.isDrawPointCloudData){ + if (FunctionBuildConfig.isDrawPointCloudData) { //如果点云效果是打开的,则自车光圈也跟随打开 FunctionBuildConfig.isDisplayAnimEnable = true scCarAperture.isChecked = true CallerMapUIServiceManager.getMapUIController()?.setDisplayAnimEnable(true) - hmiAction("SOP 是否展示自车光圈,",FunctionBuildConfig.isDisplayAnimEnable) - }else{ + hmiAction("SOP 是否展示自车光圈,", FunctionBuildConfig.isDisplayAnimEnable) + } else { scCarAperture.isChecked = FunctionBuildConfig.isDisplayAnimEnable } scCarAperture.setOnCheckedChangeListener { compoundButton, isChecked -> CallerMapUIServiceManager.getMapUIController()?.setDisplayAnimEnable(isChecked) CallerSopSettingManager.invokeCarApertureListener(isChecked) - hmiAction("SOP 是否展示自车光圈,",isChecked) - if(!compoundButton.isPressed){ + hmiAction("SOP 是否展示自车光圈,", isChecked) + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } FunctionBuildConfig.isDisplayAnimEnable = isChecked @@ -372,11 +401,11 @@ internal class SOPSettingView @JvmOverloads constructor( /** * 与车相关类设置 */ - private fun vehicleSetting(){ + private fun vehicleSetting() { //绕障类功能 scObstacleAvoidance.isChecked = FunctionBuildConfig.isDetouring scObstacleAvoidance.setOnCheckedChangeListener { _, isChecked -> - hmiAction("SOP 绕障类功能开关, ",isChecked) + hmiAction("SOP 绕障类功能开关, ", isChecked) CallerAutoPilotControlManager.sendDetouring(isChecked) FunctionBuildConfig.isDetouring = isChecked } @@ -384,13 +413,16 @@ internal class SOPSettingView @JvmOverloads constructor( // 演示模式,上一次勾选的数据 scDemoMode.isChecked = FunctionBuildConfig.isDemoMode scDemoMode.setOnCheckedChangeListener { compoundButton, isChecked -> - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } - hmiAction("SOP 演示模式开关, ",!FunctionBuildConfig.isDemoMode) + hmiAction("SOP 演示模式开关, ", !FunctionBuildConfig.isDemoMode) FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode CallerAutoPilotControlManager.setDemoMode(FunctionBuildConfig.isDemoMode) - CallerHmiViewControlListenerManager.invokeFuncMode(FUNC_MODE_DEMO, FunctionBuildConfig.isDemoMode) + CallerHmiViewControlListenerManager.invokeFuncMode( + FUNC_MODE_DEMO, + FunctionBuildConfig.isDemoMode + ) CallerSopSettingManager.invokeDemoModeListener(isChecked) if (!FunctionBuildConfig.isDemoMode) { //关闭美化模式时,通知工控机 @@ -405,10 +437,10 @@ internal class SOPSettingView @JvmOverloads constructor( // 雨天模式,上一次勾选的数据 scRainMode.isChecked = FunctionBuildConfig.isRainMode scRainMode.setOnCheckedChangeListener { compoundButton, isChecked -> - if(!compoundButton.isPressed){ + if (!compoundButton.isPressed) { return@setOnCheckedChangeListener } - hmiAction("SOP 雨天模式开关, ",isChecked) + hmiAction("SOP 雨天模式开关, ", isChecked) FunctionBuildConfig.isRainMode = isChecked CallerAutoPilotControlManager.setRainMode(isChecked) CallerHmiViewControlListenerManager.invokeFuncMode(FUNC_MODE_RAIN, isChecked) @@ -421,56 +453,59 @@ internal class SOPSettingView @JvmOverloads constructor( //弱网减速停车 scWeakNetSlowDown.isChecked = FunctionBuildConfig.isWeakNetSlowDown - scWeakNetSlowDown.setOnCheckedChangeListener{_, isChecked -> + scWeakNetSlowDown.setOnCheckedChangeListener { _, isChecked -> FunctionBuildConfig.isWeakNetSlowDown = isChecked CallerAutoPilotControlManager.sendWeakNetSlowDown(isChecked) - hmiAction("SOP 弱网减速停车, ",isChecked) + hmiAction("SOP 弱网减速停车, ", isChecked) } //故障减速停车 scFaultSlowDown.isChecked = FunctionBuildConfig.isFaultSlowDown - scFaultSlowDown.setOnCheckedChangeListener{_, isChecked -> + scFaultSlowDown.setOnCheckedChangeListener { _, isChecked -> FunctionBuildConfig.isFaultSlowDown = isChecked CallerAutoPilotControlManager.sendBreakdownSlowDown(isChecked) - hmiAction("SOP 故障减速停车, ",isChecked) + hmiAction("SOP 故障减速停车, ", isChecked) } //融合模式 rgFusionMode.setOnCheckedChangeListener { _, p1 -> - when(p1){ + when (p1) { //全融合模式 - R.id.rbFullIntegration ->{ + R.id.rbFullIntegration -> { FunctionBuildConfig.fusionMode = 1 } //盲区模式 - R.id.rbBlind ->{ + R.id.rbBlind -> { FunctionBuildConfig.fusionMode = 2 } //超视距模式 - R.id.rbBeyondSight ->{ + R.id.rbBeyondSight -> { FunctionBuildConfig.fusionMode = 3 } //透传模式 - R.id.rbTransparent ->{ + R.id.rbTransparent -> { FunctionBuildConfig.fusionMode = 4 } //纯路侧模式 - R.id.rbPureRoad ->{ + R.id.rbPureRoad -> { FunctionBuildConfig.fusionMode = 5 } } - hmiAction("SOP 融合模式, ",FunctionBuildConfig.fusionMode) + hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) } } + private var overTakeEditText:String = "" + private var overTakeEditDel = false + /** * 其他类别开关设置 */ - private fun otherSetting(){ + private fun otherSetting() { //红绿灯标识开关 scTrafficLight.isChecked = !HmiBuildConfig.isShowTrafficLightView scTrafficLight.setOnCheckedChangeListener { _, isChecked -> - hmiAction("SOP 红绿灯标识开关, ",isChecked) + hmiAction("SOP 红绿灯标识开关, ", isChecked) if (isChecked) { CallerHmiManager.showTrafficLightView() } else { @@ -481,20 +516,26 @@ internal class SOPSettingView @JvmOverloads constructor( //限速标识 scSpeedLimit.isChecked = HmiBuildConfig.isShowLimitingVelocityView scSpeedLimit.setOnCheckedChangeListener { _, isChecked -> - hmiAction("SOP 限速标识开关, ",isChecked) + hmiAction("SOP 限速标识开关, ", isChecked) if (isChecked) { HmiBuildConfig.isShowLimitingVelocityView = true - CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG,View.VISIBLE) + CallerHmiViewControlListenerManager.invokeVisible( + IViewControlListener.LimitingVelocityView_TAG, + View.VISIBLE + ) } else { HmiBuildConfig.isShowLimitingVelocityView = false - CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG,View.GONE) + CallerHmiViewControlListenerManager.invokeVisible( + IViewControlListener.LimitingVelocityView_TAG, + View.GONE + ) } } //异常上报提示 scIPCReport.isChecked = FunctionBuildConfig.isReportWarning scIPCReport.setOnCheckedChangeListener { _, isChecked -> - hmiAction("SOP 是否开启异常上报, ",isChecked) + hmiAction("SOP 是否开启异常上报, ", isChecked) FunctionBuildConfig.isReportWarning = isChecked } @@ -517,9 +558,9 @@ internal class SOPSettingView @JvmOverloads constructor( //是否展示被动触发的录包弹窗(自动驾驶下出现问题触发的录包) scShowBagRecordWindow.isChecked = FunctionBuildConfig.isShowBagRecordWindow - scShowBagRecordWindow.setOnCheckedChangeListener{_, isChecked -> + scShowBagRecordWindow.setOnCheckedChangeListener { _, isChecked -> FunctionBuildConfig.isShowBagRecordWindow = isChecked - hmiAction("SOP 是否展示被动触发的录包弹窗, ",isChecked) + hmiAction("SOP 是否展示被动触发的录包弹窗, ", isChecked) } //变道绕障的目标障碍物速度阈值 @@ -531,7 +572,7 @@ internal class SOPSettingView @JvmOverloads constructor( FunctionBuildConfig.detouringSpeed-- tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s" } - hmiAction("SOP 变道绕障的目标障碍物速度阈值",FunctionBuildConfig.detouringSpeed) + hmiAction("SOP 变道绕障的目标障碍物速度阈值", FunctionBuildConfig.detouringSpeed) } ivSpeedAdd.setOnClickListener { if (FunctionBuildConfig.detouringSpeed >= 7) { @@ -540,17 +581,78 @@ internal class SOPSettingView @JvmOverloads constructor( FunctionBuildConfig.detouringSpeed++ tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s" } - hmiAction("SOP 变道绕障的目标障碍物速度阈值",FunctionBuildConfig.detouringSpeed) + hmiAction("SOP 变道绕障的目标障碍物速度阈值", FunctionBuildConfig.detouringSpeed) } btnSpeedSet.setOnClickListener { val isSuccess = CallerAutoPilotControlManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble()) if (isSuccess == true) { ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置成功") - hmiAction("SOP 变道绕障的目标障碍物速度阈值设置","成功") + hmiAction("SOP 变道绕障的目标障碍物速度阈值设置", "成功") } else { ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置失败") - hmiAction("SOP 变道绕障的目标障碍物速度阈值设置","失败") + hmiAction("SOP 变道绕障的目标障碍物速度阈值设置", "失败") + } + } + + etOverTake.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + } + + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + CallerLogger.d(M_HMI + TAG, "onTextChanged before: $before , start: $start ,count: $count") + overTakeEditDel = before > 0 + } + + override fun afterTextChanged(s: Editable?) { + CallerLogger.d(M_HMI + TAG, "afterTextChanged s: $s , et:$overTakeEditText") + if(overTakeEditDel){ + overTakeEditDel = false + return + } + s?.let { + if(it.toString() == overTakeEditText){ + return + } + if(it.toString().isEmpty()){ + return + } + val edit = it.toString().replace("m","").replace("/","").replace("s","").trim().toFloat() + val result = if (edit >= 12.5) 12.5f else if (edit <= 3) 3f else edit + FunctionBuildConfig.overTakeSpeed = result + overTakeEditText = "$result m/s" + etOverTake.setText(overTakeEditText) + CallerLogger.d(M_HMI + TAG, "result: $overTakeEditText") + } + } + }) + ivSpeedOverTakeReduce.setOnClickListener { + if (FunctionBuildConfig.overTakeSpeed <= 3) { + ToastUtils.showShort("阈值最小可为3 m/s") + } else { + FunctionBuildConfig.overTakeSpeed -= 0.5f + etOverTake.setText("${FunctionBuildConfig.overTakeSpeed} m/s") + } + hmiAction("SOP 超车目标障碍物速度阈值", FunctionBuildConfig.overTakeSpeed) + } + ivSpeedOverTakeAdd.setOnClickListener { + if (FunctionBuildConfig.overTakeSpeed >= 12.5) { + ToastUtils.showShort("阈值最大可为12.5 m/s") + } else { + FunctionBuildConfig.overTakeSpeed += 0.5f + etOverTake.setText("${FunctionBuildConfig.overTakeSpeed} m/s") + } + hmiAction("SOP 超车目标障碍物速度阈值", FunctionBuildConfig.overTakeSpeed) + } + btnSpeedOverTakeSet.setOnClickListener { + val isSuccess = + CallerAutoPilotControlManager.sendDetouringSpeed(FunctionBuildConfig.overTakeSpeed.toDouble()) + if (isSuccess == true) { + ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置成功") + hmiAction("SOP 变道绕障的目标障碍物速度阈值设置", "成功") + } else { + ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置失败") + hmiAction("SOP 变道绕障的目标障碍物速度阈值设置", "失败") } } @@ -560,6 +662,12 @@ internal class SOPSettingView @JvmOverloads constructor( tvSpeed.visibility = View.GONE ivSpeedAdd.visibility = View.GONE btnSpeedSet.visibility = View.GONE + + tvSpeedOverTakeLimit.visibility = View.GONE + ivSpeedOverTakeReduce.visibility = View.GONE + etOverTake.visibility = View.GONE + ivSpeedOverTakeAdd.visibility = View.GONE + btnSpeedOverTakeSet.visibility = View.GONE } /** @@ -569,7 +677,10 @@ internal class SOPSettingView @JvmOverloads constructor( val mf = CallerDevaToolsManager.mofang() if (mf != null) { mfStatusLayout.setClickEnabled(true) - mfStatusLayout.setClickedTextAndTag(if (mf.isConnected()) "断开魔方连接" else "开始连接魔方", if (mf.isConnected()) 0 else 1) + mfStatusLayout.setClickedTextAndTag( + if (mf.isConnected()) "断开魔方连接" else "开始连接魔方", + if (mf.isConnected()) 0 else 1 + ) mf.registerMoFangStatusListener(TAG, this) mfStatusLayout.setOnClickCallback { val tag = it.tag as? Int @@ -616,20 +727,20 @@ internal class SOPSettingView @JvmOverloads constructor( CallerDevaToolsFuncConfigListenerManager.registerDevaToolsFuncConfigListener( FuncBizConfig.FOUNDATION, TAG, true, this ) - CallerHmiViewControlListenerManager.addListener(TAG,this) + CallerHmiViewControlListenerManager.addListener(TAG, this) CallerAutopilotGetParamResponseDispatcher.addListener(TAG, this) //查询融合模式 CallerAutoPilotControlManager.sendGetParamReq(AdasConstants.MapSystemParamType.FUSION_MODE) //雨天、美化、点云设置同步 - CallerSopSettingManager.addListener(TAG,this) + CallerSopSettingManager.addListener(TAG, this) } override fun updateFuncMode(tag: String, boolean: Boolean) { super.updateFuncMode(tag, boolean) - if(tag == FUNC_MODE_DEMO){ + if (tag == FUNC_MODE_DEMO) { scDemoMode.isChecked = FunctionBuildConfig.isDemoMode } - if(tag == FUNC_MODE_RAIN){ + if (tag == FUNC_MODE_RAIN) { scRainMode.isChecked = FunctionBuildConfig.isRainMode } } @@ -637,7 +748,10 @@ internal class SOPSettingView @JvmOverloads constructor( override fun onDetachedFromWindow() { super.onDetachedFromWindow() // 移除 业务配置监听 - CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener(FuncBizConfig.FOUNDATION, TAG) + CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener( + FuncBizConfig.FOUNDATION, + TAG + ) CallerHmiViewControlListenerManager.removeListener(TAG) CallerAutopilotGetParamResponseDispatcher.removeListener(TAG) CallerDevaToolsManager.mofang()?.unRegisterMoFangStatusListener(this) @@ -651,9 +765,9 @@ internal class SOPSettingView @JvmOverloads constructor( //美化模式 FuncBizConfig.BIZ_BEAUTY_MODE -> { scDemoMode.isClickable = !lock - if(lock){ + if (lock) { scDemoMode.visibility = View.INVISIBLE - }else{ + } else { scDemoMode.visibility = View.VISIBLE } } @@ -743,24 +857,24 @@ internal class SOPSettingView @JvmOverloads constructor( //融合模式 ThreadUtils.runOnUiThread { FunctionBuildConfig.fusionMode = adasParam.fusionMode - when(FunctionBuildConfig.fusionMode){ - 1->{ + when (FunctionBuildConfig.fusionMode) { + 1 -> { //全融合模式 rgFusionMode.check(R.id.rbFullIntegration) } - 2->{ + 2 -> { //盲区模式 rgFusionMode.check(R.id.rbBlind) } - 3->{ + 3 -> { //超视距模式 rgFusionMode.check(R.id.rbBeyondSight) } - 4->{ + 4 -> { //透传模式 rgFusionMode.check(R.id.rbTransparent) } - 5->{ + 5 -> { //纯路侧模式 rgFusionMode.check(R.id.rbPureRoad) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/PncActionsView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/PncActionsView.kt index 028f485e6a..ff4e37b641 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/PncActionsView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/PncActionsView.kt @@ -103,7 +103,7 @@ class PncActionsView @JvmOverloads constructor( it.drivingAction.number ) && mTrafficLightResult != null - && getWaitTrafficLightTime().isNotBlank() + && hasRedLight() ) { actions += ",预计${getWaitTrafficLightTime()}秒后通过" } else { @@ -133,11 +133,15 @@ class PncActionsView @JvmOverloads constructor( mTrafficLightResult = trafficLightResult } + private fun hasRedLight(): Boolean { + return mTrafficLightResult != null + && mTrafficLightResult!!.currentRoadTrafficLight() != null + && mTrafficLightResult!!.currentRoadTrafficLight()!!.isRed() + && mTrafficLightResult!!.currentRoadTrafficLight()!!.time() > 0 + } + private fun getWaitTrafficLightTime(): String { - return if (mTrafficLightResult != null - && mTrafficLightResult!!.currentRoadTrafficLight() != null - && mTrafficLightResult!!.currentRoadTrafficLight()!!.isRed() - ) { + return if (hasRedLight()) { mTrafficLightResult!!.currentRoadTrafficLight()!!.time().toString() } else { "" 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 5121d303f6..4beca0b11f 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 @@ -1,9 +1,8 @@ - + android:layout_height="@dimen/dp_1100"> + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> + android:scaleX="1.4" + android:scaleY="1.4" + android:text="V2X总开关" + android:textSize="@dimen/sp_28" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + android:scaleX="1.2" + android:scaleY="1.2" + android:text="V2N总开关" + android:textSize="@dimen/sp_28" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/scV2XSwitch" /> + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" /> + app:layout_constraintTop_toBottomOf="@id/scV2NSwitch" /> + app:layout_constraintTop_toBottomOf="@id/scV2NSwitch" /> + app:layout_constraintTop_toBottomOf="@id/scNewV2NData" /> + app:layout_constraintTop_toBottomOf="@id/scGreenWaveSop" /> + app:layout_constraintTop_toBottomOf="@id/scV2ISwitch" /> + app:layout_constraintTop_toBottomOf="@id/scV2ISwitch" /> + app:layout_constraintTop_toBottomOf="@id/scV2iPnc" /> + app:layout_constraintTop_toBottomOf="@id/scObuWeaknessTrafficSop" /> + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toBottomOf="@id/scObuV2vView" /> @@ -203,16 +189,16 @@ + app:contentPadding="@dimen/dp_10" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> + android:text="地图效果类" + android:textColor="@color/black" + android:textSize="@dimen/sp_36" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintLeft_toLeftOf="@id/tvMapTitle" + app:layout_constraintRight_toRightOf="parent" /> + android:text="危险障碍物颜色标记" + android:textSize="@dimen/sp_28" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="@id/mapGuideLine" + app:layout_constraintTop_toBottomOf="@id/tvMapTitle" /> + android:text="引导线动态效果" + android:textSize="@dimen/sp_28" + app:layout_constraintLeft_toLeftOf="@id/mapGuideLine" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@id/tvMapTitle" /> + android:text="点云效果" + android:textSize="@dimen/sp_28" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="@id/mapGuideLine" + app:layout_constraintTop_toBottomOf="@id/scMarkingObstacles" /> + android:text="自车光圈" + android:textSize="@dimen/sp_28" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="@id/mapGuideLine" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@id/scRouteDynamicEffect" /> @@ -309,16 +289,16 @@ + app:contentPadding="@dimen/dp_10" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> + android:text="与车相关类" + android:textColor="@color/black" + android:textSize="@dimen/sp_36" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintLeft_toLeftOf="@id/tvVehicleTitle" + app:layout_constraintRight_toRightOf="parent" /> + android:text="绕障类功能" + android:textSize="@dimen/sp_28" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="@id/vehicleGuideLine" + app:layout_constraintTop_toBottomOf="@id/tvVehicleTitle" /> + android:text="美化模式" + android:textSize="@dimen/sp_28" + app:layout_constraintLeft_toLeftOf="@id/vehicleGuideLine" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@id/tvVehicleTitle" /> + android:text="雨天模式" + android:textSize="@dimen/sp_28" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="@id/vehicleGuideLine" + app:layout_constraintTop_toBottomOf="@id/scObstacleAvoidance" /> + android:text="弱网减速停车" + android:textSize="@dimen/sp_28" + app:layout_constraintLeft_toLeftOf="@id/vehicleGuideLine" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toBottomOf="@id/scDemoMode" /> + android:text="故障减速停车" + android:textSize="@dimen/sp_28" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="@id/vehicleGuideLine" + app:layout_constraintTop_toBottomOf="@id/scRainMode" /> + app:layout_constraintTop_toBottomOf="@id/scFaultSlowDown"> + android:text="全融合模式" + android:textSize="32dp" /> + android:text="盲区模式" + android:textSize="32dp" /> + android:text="超视距模式" + android:textSize="32dp" /> + android:text="透传模式" + android:textSize="32dp" /> + android:text="纯路侧模式" + android:textSize="32dp" /> @@ -483,16 +450,16 @@ + app:contentPadding="@dimen/dp_10" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> + android:text="其他" + android:textColor="@color/black" + android:textSize="@dimen/sp_36" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintLeft_toLeftOf="@id/tvOtherTitle" + app:layout_constraintRight_toRightOf="parent" /> + app:layout_constraintTop_toBottomOf="@id/tvOtherTitle" /> + app:layout_constraintTop_toBottomOf="@id/tvOtherTitle" /> + app:layout_constraintTop_toBottomOf="@id/scTrafficLight" /> + app:layout_constraintTop_toBottomOf="@id/scSpeedLimit" /> + android:scaleX="1.2" + android:scaleY="1.2" + android:text="录包弹窗" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="@id/otherGuideLine" + app:layout_constraintTop_toBottomOf="@id/scIPCReport" /> @@ -596,16 +556,16 @@ + app:contentPadding="@dimen/dp_10" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent"> + android:text="变道速度阈值:" + android:textColor="#1A1A1A" + android:textSize="@dimen/dp_36" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + android:src="@drawable/icon_reduce" + app:layout_constraintBottom_toBottomOf="@id/tvSpeedThresholdTitle" + app:layout_constraintLeft_toRightOf="@id/tvSpeedThresholdTitle" + app:layout_constraintTop_toTopOf="@id/tvSpeedThresholdTitle" /> + android:background="@drawable/debug_setting_edit_bg" + android:gravity="center" + android:paddingStart="15dp" + android:paddingEnd="15dp" + android:textSize="@dimen/dp_36" + app:layout_constraintBottom_toBottomOf="@id/ivSpeedReduce" + app:layout_constraintLeft_toRightOf="@id/ivSpeedReduce" + app:layout_constraintTop_toTopOf="@id/ivSpeedReduce" /> + app:layout_constraintTop_toTopOf="@id/tvSpeed" />