From 0d8ecec8823950f3f76fb692f1ba39fcaac73b79 Mon Sep 17 00:00:00 2001 From: xuxinchao <13522809046@163.com> Date: Fri, 1 Apr 2022 17:29:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 控制中心增加车辆状态模块,目前会展示方向盘转向角和档位信息 --- .../autopilot/adapter/MoGoAdasListenerImpl.kt | 4 ++ .../adapter/MoGoHandAdasMsgManager.java | 21 ++++++- .../hmi/ui/setting/DebugSettingView.kt | 58 ++++++++++++++++++- .../main/res/layout/view_debug_setting.xml | 47 +++++++++++++++ .../IMoGoAutopilotVehicleStateListener.kt | 12 ++++ ...lerAutopilotVehicleStateListenerManager.kt | 24 ++++++++ 6 files changed, 162 insertions(+), 4 deletions(-) diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt index 713e611e82..3e49dc602d 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -152,6 +152,10 @@ class MoGoAdasListenerImpl : OnAdasListener { CallerAutopilotVehicleStateListenerManager.invokeAutopilotLightSwitchData(vehicleState.light) //刹车灯数据 CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus) + //方向盘转向角数据 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering) + //挂挡档位数据 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotGearData(vehicleState.gear) } } diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java index ae74990e6d..80566a0a9c 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java @@ -1,7 +1,5 @@ package com.mogo.eagle.core.function.autopilot.adapter; -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DEVA; - import android.content.Context; import android.text.TextUtils; import android.util.Log; @@ -20,7 +18,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListen import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager; import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.util.ThreadUtils; import com.mogo.module.common.drawer.IdentifyDataDrawer; @@ -159,4 +156,22 @@ public class MoGoHandAdasMsgManager implements } } + /** + * 车辆方向盘转向角回调 + * @param steering 方向盘转向角 + */ + @Override + public void onAutopilotSteeringData(float steering) { + + } + + /** + * 车辆挂挡档位 + * @param gear 档位 + */ + @Override + public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) { + + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/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 dd851b7762..a0ec0841fa 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 @@ -12,6 +12,7 @@ import androidx.annotation.RequiresApi import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat import androidx.recyclerview.widget.LinearLayoutManager +import chassis.Chassis import com.mogo.cloud.passport.MoGoAiCloudClient import com.mogo.commons.AbsMogoApplication import com.mogo.commons.debug.DebugConfig @@ -77,7 +78,8 @@ class DebugSettingView @JvmOverloads constructor( ) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener, IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener, - IMoGoAutopilotPlanningListener, IMoGoAutopilotCarConfigListener { + IMoGoAutopilotPlanningListener, IMoGoAutopilotCarConfigListener + ,IMoGoAutopilotVehicleStateListener{ private val TAG = "DebugSettingView" @@ -170,6 +172,8 @@ class DebugSettingView @JvmOverloads constructor( CallerAutopilotPlanningListenerManager.addListener(TAG, this) // 添加 工控机基础信息回调 监听 CallerAutopilotCarConfigListenerManager.addListener(TAG, this) + //添加 车辆底盘数据回调 监听 + CallerAutopilotVehicleStateListenerManager.addListener(TAG,this) if (logInfoView != null) { logInfoView!!.onEnterForeground() } @@ -191,6 +195,11 @@ class DebugSettingView @JvmOverloads constructor( CallerAutopilotIdentifyListenerManager.removeListener(TAG) // 移除 规划路径相关回调 监听 CallerAutopilotPlanningListenerManager.removeListener(TAG) + // 移除 工控机基础信息回调 监听 + CallerAutopilotCarConfigListenerManager.removeListener(TAG) + //移除 车辆底盘数据回调 监听 + CallerAutopilotVehicleStateListenerManager.removeListener(TAG) + if (logInfoView != null) { logInfoView!!.onEnterBackground() } @@ -318,6 +327,21 @@ class DebugSettingView @JvmOverloads constructor( } } + /** + * 车辆状态控制中心 + */ + tbVehicleStateController.setOnCheckedChangeListener { buttonView, isChecked -> + if(isChecked){ + buttonView.setCompoundDrawables(null, null, iconDown, null) + //展示车辆状态中心 + vehicleStateLayout.visibility = View.VISIBLE + } else { + buttonView.setCompoundDrawables(null, null, iconRight, null) + //隐藏车辆状态中心 + vehicleStateLayout.visibility = View.GONE + } + } + /** * HMI控制中心 */ @@ -1615,6 +1639,38 @@ class DebugSettingView @JvmOverloads constructor( tvObuDelay.text = "obu时延:" + delayTime.toString() } + /** + * 车辆转向灯 数据 + * @param lightSwitch + */ + override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) { + + } + + /** + * 车辆刹车灯 数据 + * @param brakeLight + */ + override fun onAutopilotBrakeLightData(brakeLight: Boolean) { + + } + + /** + * 车辆方向盘转向角回调 + * @param steering 方向盘转向角 + */ + override fun onAutopilotSteeringData(steering: Float) { + tvSteeringInfo.text = "方向盘转向角:${steering}" + } + + /** + * 车辆挂挡档位 + * @param gear 档位 + */ + override fun onAutopilotGearData(gear: Chassis.GearPosition) { + tvGearInfo.text = "挂挡档位:${gear}" + } + /** * 吐司提示 */ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index 5807b35fb9..e29a385e74 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -843,6 +843,53 @@ app:layout_constraintTop_toBottomOf="@id/obuDivider2" /> + + + + + + + + + + + + + +