From cbe8c27e4c56b3a3701ec6eb5644dc2979a787b4 Mon Sep 17 00:00:00 2001 From: EmArrow Date: Wed, 21 Aug 2024 17:11:05 +0800 Subject: [PATCH] [6.6.0] union the chassis state in one caller --- .../passenger/ui/widget/M2StatusBarView.kt | 46 ++-- .../passenger/ui/widget/M2TurnLightView.kt | 3 - .../layout/bus_p_m2_driving_info_fragment.xml | 2 +- .../passenger/ui/statusbar/StatusBarView.kt | 20 +- .../common/module/debug/DebugDataDispatch.kt | 4 +- .../module/manager/light/BreakLightManager.kt | 8 +- .../module/manager/light/TurnLightManager.kt | 8 +- .../passenger/ui/widget/BusPTurnLightView.kt | 3 - .../passenger/ui/widget/M2TurnLightView.kt | 3 - .../shuttle_p_m2_driving_info_fragment.xml | 2 +- .../passenger/ui/widget/BusPTurnLightView.kt | 3 - .../passenger/ui/widget/M2StatusBarView.kt | 46 ++-- .../passenger/ui/widget/M2TurnLightView.kt | 3 - .../shuttle_p_m2_driving_info_fragment.xml | 2 +- .../passenger/ui/widget/BusPTurnLightView.kt | 3 - .../passenger/ui/widget/M2StatusBarView.kt | 46 ++-- .../passenger/ui/widget/M2TurnLightView.kt | 3 - .../shuttle_p_m2_driving_info_fragment.xml | 2 +- .../cloud/view/SweeperCloudTrafficDataView.kt | 11 +- .../view/SweeperOperateTrafficDataView.kt | 19 +- .../test/TestAutoPilotBeforeLaunch.kt | 10 +- .../autopilot/adapter/MoGoAdasListenerImpl.kt | 68 +---- .../status/flow/autopilot/AcceleratorImpl.kt | 11 +- .../status/flow/autopilot/BrakeImpl.kt | 10 +- .../status/flow/autopilot/DoubleFlashImpl.kt | 16 +- .../status/flow/autopilot/GearImpl.kt | 11 +- .../status/flow/autopilot/SteerImpl.kt | 10 +- .../status/flow/can/CanImpl.kt | 52 ++-- .../hmi/ui/lookaround/M1LookAroundView.kt | 6 +- .../hmi/ui/setting/DebugSettingView.kt | 254 +++++++++++++++--- .../hmi/ui/vehicle/SteeringBrakeView.kt | 10 +- .../hmi/ui/vehicle/TurnLightViewStatus.kt | 10 +- .../hmi/ui/widget/SteeringWheelView.kt | 12 +- .../hmi/ui/widget/TrafficDataView.java | 169 ------------ .../function/hmi/ui/widget/TrafficDataView.kt | 148 ++++++++++ .../eagle/core/function/view/MapBizView.kt | 12 +- .../IMoGoAutopilotVehicleStateListener.kt | 13 - .../IMoGoBatteryManagementSystemListener.kt | 13 - .../autopilot/IMoGoChassisAccStateListener.kt | 13 - .../IMoGoChassisBrakeStateListener.kt | 12 - .../IMoGoChassisGearStateListener.kt | 16 -- .../IMoGoChassisLamplightListener.kt | 22 -- .../autopilot/IMoGoChassisStatesListener.kt | 59 ++++ .../IMoGoChassisSteeringStateListener.kt | 14 - .../IMoGoChassisThrottleStateListener.kt | 12 - ...lerAutopilotVehicleStateListenerManager.kt | 37 --- ...rBatteryManagementSystemListenerManager.kt | 21 -- .../CallerChassisAccStateListenerManager.kt | 21 -- .../CallerChassisBrakeStateListenerManager.kt | 20 -- .../CallerChassisGearStateListenerManager.kt | 22 -- .../CallerChassisLamplightListenerManager.kt | 34 --- .../CallerChassisStatesListenerManager.kt | 172 ++++++++++++ ...llerChassisSteeringStateListenerManager.kt | 32 --- ...llerChassisThrottleStateListenerManager.kt | 20 -- .../core/function/call/autopilot/REEADME.md | 8 - 55 files changed, 789 insertions(+), 818 deletions(-) delete mode 100644 core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.kt delete mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt delete mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoBatteryManagementSystemListener.kt delete mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisAccStateListener.kt delete mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisBrakeStateListener.kt delete mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisGearStateListener.kt delete mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt create mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisStatesListener.kt delete mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisSteeringStateListener.kt delete mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisThrottleStateListener.kt delete mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt delete mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerBatteryManagementSystemListenerManager.kt delete mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisAccStateListenerManager.kt delete mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisBrakeStateListenerManager.kt delete mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisGearStateListenerManager.kt delete mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLamplightListenerManager.kt create mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisStatesListenerManager.kt delete mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisSteeringStateListenerManager.kt delete mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisThrottleStateListenerManager.kt diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/ui/widget/M2StatusBarView.kt b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/ui/widget/M2StatusBarView.kt index 4455fbd417..2723a07425 100644 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/ui/widget/M2StatusBarView.kt +++ b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/ui/widget/M2StatusBarView.kt @@ -8,15 +8,16 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintLayout import chassis.ChassisStatesOuterClass -import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener -import com.mogo.eagle.core.function.call.autopilot.CallerBatteryManagementSystemListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager import com.mogo.eagle.core.utilcode.kotlin.* import com.mogo.eagle.core.utilcode.util.ClickUtils +import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.och.bus.passenger.R import kotlinx.android.synthetic.main.bus_p_m2_view_status_bar.view.progress import kotlinx.android.synthetic.main.bus_p_m2_view_status_bar.view.tv_power_cos @@ -30,7 +31,7 @@ import me.jessyan.autosize.utils.AutoSizeUtils class M2StatusBarView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null ) : ConstraintLayout(context, attrs), IViewControlListener, IMoGoSkinModeChangeListener, - IMoGoBatteryManagementSystemListener { + IMoGoChassisStatesListener { companion object { const val TAG = "M2StatusBarView" @@ -60,7 +61,7 @@ class M2StatusBarView @JvmOverloads constructor( // 添加换肤监听 CallerSkinModeListenerManager.addListener(TAG, this) //电量 - CallerBatteryManagementSystemListenerManager.addListener(TAG,this) + CallerChassisStatesListenerManager.addListener(TAG,this) progress?.also { it.progress = 50 @@ -81,30 +82,33 @@ class M2StatusBarView @JvmOverloads constructor( super.onDetachedFromWindow() CallerHmiViewControlListenerManager.removeListener(TAG) CallerSkinModeListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) CallerDevaToolsManager.hideStatusBar() } @SuppressLint("SetTextI18n") override fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) { - if (ClickUtils.isClickTooFrequent(this,1000)) { - return - } - val bmsSoc = states.bmsSoc - try { - if (oldBmsSoc != bmsSoc ) { - scope.launch { - if(bmsSoc >1){ - progress?.also { it.progress = bmsSoc.toInt() } - tv_power_cos?.also { it.text = "${bmsSoc.toInt()}%" } - }else{ - val power = (bmsSoc * 100).toInt() - progress?.also { it.progress = power } - tv_power_cos?.also {it.text = "$power%" } + ThreadUtils.runOnUiThread({ + if (ClickUtils.isClickTooFrequent(this,1000)) { + return@runOnUiThread + } + val bmsSoc = states.bmsSoc + try { + if (oldBmsSoc != bmsSoc ) { + scope.launch { + if(bmsSoc >1){ + progress?.also { it.progress = bmsSoc.toInt() } + tv_power_cos?.also { it.text = "${bmsSoc.toInt()}%" } + }else{ + val power = (bmsSoc * 100).toInt() + progress?.also { it.progress = power } + tv_power_cos?.also {it.text = "$power%" } + } } } + } finally { + oldBmsSoc = bmsSoc } - } finally { - oldBmsSoc = bmsSoc - } + },ThreadUtils.MODE.QUEUE) } } \ No newline at end of file diff --git a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/ui/widget/M2TurnLightView.kt b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/ui/widget/M2TurnLightView.kt index 20bc37169f..d9a73a4289 100644 --- a/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/ui/widget/M2TurnLightView.kt +++ b/OCH/bus/passenger/src/main/java/m2/com/mogo/och/bus/passenger/passenger/ui/widget/M2TurnLightView.kt @@ -11,7 +11,6 @@ import android.view.animation.Animation import android.widget.ImageView import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.och.bus.passenger.R @@ -50,13 +49,11 @@ class M2TurnLightView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() CallerTurnLightListenerManager.addListener(TAG,this) - TurnLightManager.addTurnLightStatusChangeListener(TAG,this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - CallerChassisLamplightListenerManager.removeListener(TAG) CallerTurnLightListenerManager.removeListener(TAG) TurnLightManager.removeTurnLightStatusChangeListener(TAG) } diff --git a/OCH/bus/passenger/src/main/res/m2/layout/bus_p_m2_driving_info_fragment.xml b/OCH/bus/passenger/src/main/res/m2/layout/bus_p_m2_driving_info_fragment.xml index 21fb953f7a..05ab9eae6f 100644 --- a/OCH/bus/passenger/src/main/res/m2/layout/bus_p_m2_driving_info_fragment.xml +++ b/OCH/bus/passenger/src/main/res/m2/layout/bus_p_m2_driving_info_fragment.xml @@ -286,7 +286,7 @@ app:layout_constraintLeft_toLeftOf="@+id/speed_tv" app:layout_constraintBottom_toBottomOf="parent" /> - + { val startLon = intent.getFloatExtra("startLon", -1.0f) diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/light/BreakLightManager.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/light/BreakLightManager.kt index 2f0b73e966..b9049b6d2f 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/light/BreakLightManager.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/light/BreakLightManager.kt @@ -1,12 +1,12 @@ package com.mogo.och.common.module.manager.light -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager -object BreakLightManager : IMoGoChassisLamplightListener { +object BreakLightManager : IMoGoChassisStatesListener { private const val TAG = "BreakLightManager" init { - CallerChassisLamplightListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) } // 刹车灯 diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/light/TurnLightManager.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/light/TurnLightManager.kt index e4c69bd8f4..3ed38bfb48 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/light/TurnLightManager.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/light/TurnLightManager.kt @@ -1,12 +1,12 @@ package com.mogo.och.common.module.manager.light import chassis.Chassis -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import java.util.concurrent.ConcurrentHashMap import kotlin.properties.Delegates -object TurnLightManager : IMoGoChassisLamplightListener { +object TurnLightManager : IMoGoChassisStatesListener { private const val TAG = "TurnLightManager" private val lightStatusChange: ConcurrentHashMap = @@ -23,7 +23,7 @@ object TurnLightManager : IMoGoChassisLamplightListener { } init { - CallerChassisLamplightListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) } fun addTurnLightStatusChangeListener(tag: String, listener: TurnLightListener) { diff --git a/OCH/offline/passenger/src/main/java/jinlv/com/mogo/och/shuttle/passenger/ui/widget/BusPTurnLightView.kt b/OCH/offline/passenger/src/main/java/jinlv/com/mogo/och/shuttle/passenger/ui/widget/BusPTurnLightView.kt index 0016086878..14dc19bd74 100644 --- a/OCH/offline/passenger/src/main/java/jinlv/com/mogo/och/shuttle/passenger/ui/widget/BusPTurnLightView.kt +++ b/OCH/offline/passenger/src/main/java/jinlv/com/mogo/och/shuttle/passenger/ui/widget/BusPTurnLightView.kt @@ -11,7 +11,6 @@ import android.view.animation.Animation import android.widget.ImageView import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.och.shuttle.passenger.R @@ -50,13 +49,11 @@ class BusPTurnLightView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() CallerTurnLightListenerManager.addListener(TAG,this) - TurnLightManager.addTurnLightStatusChangeListener(TAG,this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - CallerChassisLamplightListenerManager.removeListener(TAG) CallerTurnLightListenerManager.removeListener(TAG) TurnLightManager.removeTurnLightStatusChangeListener(TAG) } diff --git a/OCH/offline/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt b/OCH/offline/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt index 6b2b1e8e5d..a565d41a0e 100644 --- a/OCH/offline/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt +++ b/OCH/offline/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt @@ -11,7 +11,6 @@ import android.view.animation.Animation import android.widget.ImageView import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.och.shuttle.passenger.R @@ -50,13 +49,11 @@ class M2TurnLightView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() CallerTurnLightListenerManager.addListener(TAG,this) - TurnLightManager.addTurnLightStatusChangeListener(TAG,this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - CallerChassisLamplightListenerManager.removeListener(TAG) CallerTurnLightListenerManager.removeListener(TAG) TurnLightManager.removeTurnLightStatusChangeListener(TAG) } diff --git a/OCH/offline/passenger/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml b/OCH/offline/passenger/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml index 8f5c360ae6..29cc67ae25 100644 --- a/OCH/offline/passenger/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml +++ b/OCH/offline/passenger/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml @@ -285,7 +285,7 @@ app:layout_constraintLeft_toLeftOf="@+id/speed_tv" app:layout_constraintBottom_toBottomOf="parent" /> - + 1){ - progress?.also { it.progress = bmsSoc.toInt() } - tv_power_cos?.also { it.text = "${bmsSoc.toInt()}%" } - }else{ - val power = (bmsSoc * 100).toInt() - progress?.also { it.progress = power } - tv_power_cos?.also {it.text = "$power%" } + ThreadUtils.runOnUiThread({ + if (ClickUtils.isClickTooFrequent(this,1000)) { + return@runOnUiThread + } + val bmsSoc = states.bmsSoc + try { + if (oldBmsSoc != bmsSoc ) { + scope.launch { + if(bmsSoc >1){ + progress?.also { it.progress = bmsSoc.toInt() } + tv_power_cos?.also { it.text = "${bmsSoc.toInt()}%" } + }else{ + val power = (bmsSoc * 100).toInt() + progress?.also { it.progress = power } + tv_power_cos?.also {it.text = "$power%" } + } } } + } finally { + oldBmsSoc = bmsSoc } - } finally { - oldBmsSoc = bmsSoc - } + },ThreadUtils.MODE.QUEUE) } } \ No newline at end of file diff --git a/OCH/shuttle/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt b/OCH/shuttle/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt index 6b2b1e8e5d..a565d41a0e 100644 --- a/OCH/shuttle/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt +++ b/OCH/shuttle/passenger/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt @@ -11,7 +11,6 @@ import android.view.animation.Animation import android.widget.ImageView import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.och.shuttle.passenger.R @@ -50,13 +49,11 @@ class M2TurnLightView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() CallerTurnLightListenerManager.addListener(TAG,this) - TurnLightManager.addTurnLightStatusChangeListener(TAG,this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - CallerChassisLamplightListenerManager.removeListener(TAG) CallerTurnLightListenerManager.removeListener(TAG) TurnLightManager.removeTurnLightStatusChangeListener(TAG) } diff --git a/OCH/shuttle/passenger/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml b/OCH/shuttle/passenger/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml index 8f5c360ae6..29cc67ae25 100644 --- a/OCH/shuttle/passenger/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml +++ b/OCH/shuttle/passenger/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml @@ -285,7 +285,7 @@ app:layout_constraintLeft_toLeftOf="@+id/speed_tv" app:layout_constraintBottom_toBottomOf="parent" /> - + 1){ - progress?.also { it.progress = bmsSoc.toInt() } - tv_power_cos?.also { it.text = "${bmsSoc.toInt()}%" } - }else{ - val power = (bmsSoc * 100).toInt() - progress?.also { it.progress = power } - tv_power_cos?.also {it.text = "$power%" } + ThreadUtils.runOnUiThread({ + if (ClickUtils.isClickTooFrequent(this,1000)) { + return@runOnUiThread + } + val bmsSoc = states.bmsSoc + try { + if (oldBmsSoc != bmsSoc ) { + scope.launch { + if(bmsSoc >1){ + progress?.also { it.progress = bmsSoc.toInt() } + tv_power_cos?.also { it.text = "${bmsSoc.toInt()}%" } + }else{ + val power = (bmsSoc * 100).toInt() + progress?.also { it.progress = power } + tv_power_cos?.also {it.text = "$power%" } + } } } + } finally { + oldBmsSoc = bmsSoc } - } finally { - oldBmsSoc = bmsSoc - } + },ThreadUtils.MODE.QUEUE) } } \ No newline at end of file diff --git a/OCH/shuttle/passenger_weaknet/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt b/OCH/shuttle/passenger_weaknet/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt index 6b2b1e8e5d..a565d41a0e 100644 --- a/OCH/shuttle/passenger_weaknet/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt +++ b/OCH/shuttle/passenger_weaknet/src/main/java/m2/com/mogo/och/shuttle/passenger/ui/widget/M2TurnLightView.kt @@ -11,7 +11,6 @@ import android.view.animation.Animation import android.widget.ImageView import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.och.shuttle.passenger.R @@ -50,13 +49,11 @@ class M2TurnLightView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() CallerTurnLightListenerManager.addListener(TAG,this) - TurnLightManager.addTurnLightStatusChangeListener(TAG,this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - CallerChassisLamplightListenerManager.removeListener(TAG) CallerTurnLightListenerManager.removeListener(TAG) TurnLightManager.removeTurnLightStatusChangeListener(TAG) } diff --git a/OCH/shuttle/passenger_weaknet/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml b/OCH/shuttle/passenger_weaknet/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml index 8f5c360ae6..29cc67ae25 100644 --- a/OCH/shuttle/passenger_weaknet/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml +++ b/OCH/shuttle/passenger_weaknet/src/main/res/m2/layout/shuttle_p_m2_driving_info_fragment.xml @@ -285,7 +285,7 @@ app:layout_constraintLeft_toLeftOf="@+id/speed_tv" app:layout_constraintBottom_toBottomOf="parent" /> - + val bytes: ByteArray = sweeperState.toByteArray() @@ -233,7 +209,7 @@ class MoGoAdasListenerImpl : OnAdasListener { } } } else { - CallerAutopilotVehicleStateListenerManager.invokeAutopilotDataException(header.timestamp.toLong()) + CallerChassisStatesListenerManager.invokeStatesDataException(header.timestamp.toLong()) } } @@ -255,36 +231,7 @@ class MoGoAdasListenerImpl : OnAdasListener { ) { CallerAutopilotActionsListenerManager.setChassisStates(chassisStates) if (chassisStates != null) { - chassisStates.bcmSystemStates?.let { bcmSystemStates -> - //刹车灯数据 - CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(bcmSystemStates.brakeLightState != 0) - } - chassisStates.steerSystemStates?.let { - //方向盘转向角数据 - CallerChassisSteeringStateListenerManager.invokeAutopilotSteeringData(it.steeringWheelAngle) - } - chassisStates.gearSystemStates?.let { gearSystemStates -> - gearSystemStates.gearPosition?.let { - //挂档档位数据 - CallerChassisGearStateListenerManager.invokeAutopilotGearData(it) - } - } - chassisStates.vehicleMotionStates?.let { - //加速度 - CallerChassisAccStateListenerManager.invokeAutopilotAcc(it.acceleration) - } - chassisStates.drivingSystemStates?.let { - //油门 - CallerChassisThrottleStateListenerManager.invokeAutopilotThrottle(it.throttleResponsePosition) - } - chassisStates.brakeSystemStates?.let { - //刹车 - CallerChassisBrakeStateListenerManager.invokeAutopilotBrake(it.brakePedalResponsePosition) - } - chassisStates.bmsSystemStates?.let { - //电量 - CallerBatteryManagementSystemListenerManager.invokeBatteryManagementSystemStates(it) - } + CallerChassisStatesListenerManager.invokeNewStates(chassisStates) chassisStates.taskSystemStates?.let { taskSystemStates -> taskSystemStates.sweeperFutianTaskSystemStates?.let { //清扫车(福田)清扫控制系统状态 @@ -294,7 +241,7 @@ class MoGoAdasListenerImpl : OnAdasListener { } } } else { - CallerAutopilotVehicleStateListenerManager.invokeAutopilotDataException(header.timestamp.toLong()) + CallerChassisStatesListenerManager.invokeStatesDataException(header.timestamp.toLong()) } } @@ -308,7 +255,7 @@ class MoGoAdasListenerImpl : OnAdasListener { */ override fun onLightSwitch(light: Chassis.LightSwitch) { //转向灯数据 - CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(light) + CallerChassisStatesListenerManager.invokeAutopilotLightSwitchData(light) } //自动驾驶状态 @@ -324,7 +271,6 @@ class MoGoAdasListenerImpl : OnAdasListener { ) { if (autopilotState != null) { //工控机模拟时间 - CallerAutopilotVehicleStateListenerManager.invokeAutopilotTime(header.timestamp.toLong()) updateAutoPilotStatus(autopilotState.state, autopilotState.autopilotMode) } } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt index 2fa136ef90..15b201876d 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/AcceleratorImpl.kt @@ -2,16 +2,17 @@ package com.zhjt.mogo_core_function_devatools.status.flow.autopilot import android.content.Context import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus import com.zhjt.mogo_core_function_devatools.status.flow.IFlow -internal class AcceleratorImpl(ctx: Context): IFlow(ctx), IMoGoChassisThrottleStateListener, IMoGoAutopilotActionsListener { +internal class AcceleratorImpl(ctx: Context): IFlow(ctx), + IMoGoChassisStatesListener, IMoGoAutopilotActionsListener { companion object { @@ -28,13 +29,13 @@ internal class AcceleratorImpl(ctx: Context): IFlow(ctx), IMo private var extra: Any? = null override fun onCreate() { - CallerChassisThrottleStateListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) CallerAutopilotActionsListenerManager.addListener(TAG, this) } override fun onDestroy() { super.onDestroy() - CallerChassisThrottleStateListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) CallerAutopilotActionsListenerManager.removeListener(TAG) } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt index 33f90890c9..510842a04f 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/BrakeImpl.kt @@ -2,16 +2,16 @@ package com.zhjt.mogo_core_function_devatools.status.flow.autopilot import android.content.Context import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_BRAKE import com.zhjt.mogo_core_function_devatools.status.entity.BrakeStatus import com.zhjt.mogo_core_function_devatools.status.flow.IFlow -internal class BrakeImpl(ctx: Context): IFlow(ctx), IMoGoChassisBrakeStateListener, IMoGoAutopilotActionsListener { +internal class BrakeImpl(ctx: Context): IFlow(ctx), IMoGoChassisStatesListener, IMoGoAutopilotActionsListener { companion object { private const val TAG = "BrakeImpl" @@ -27,13 +27,13 @@ internal class BrakeImpl(ctx: Context): IFlow(ctx), IMoGoChassisBra private var extra: Any? = null override fun onCreate() { - CallerChassisBrakeStateListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) CallerAutopilotActionsListenerManager.addListener(TAG, this) } override fun onDestroy() { super.onDestroy() - CallerChassisBrakeStateListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) CallerAutopilotActionsListenerManager.removeListener(TAG) } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt index b3ae5fca5d..7e7587547a 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/DoubleFlashImpl.kt @@ -4,17 +4,19 @@ import android.content.Context import chassis.Chassis.LightSwitch import chassis.Chassis.LightSwitch.LIGHT_FLASH import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager -import com.mogo.eagle.core.utilcode.mogo.logger.Logger +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_HAZARD_LIGHTS import com.zhjt.mogo_core_function_devatools.status.entity.DoubleFlashStatus import com.zhjt.mogo_core_function_devatools.status.flow.IFlow -internal class DoubleFlashImpl(ctx: Context): IFlow(ctx), IMoGoChassisLamplightListener, IMoGoAutopilotActionsListener { +internal class DoubleFlashImpl(ctx: Context): IFlow(ctx), + IMoGoChassisStatesListener, IMoGoAutopilotActionsListener { companion object { private const val TAG = "DoubleFlashImpl" @@ -30,19 +32,19 @@ internal class DoubleFlashImpl(ctx: Context): IFlow(ctx), IMo private var extra: Any? = null override fun onCreate() { - CallerChassisLamplightListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) CallerAutopilotActionsListenerManager.addListener(TAG, this) } override fun onDestroy() { super.onDestroy() - CallerChassisLamplightListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) CallerAutopilotActionsListenerManager.removeListener(TAG) } override fun onAutopilotLightSwitchData(lightSwitch: LightSwitch?) { super.onAutopilotLightSwitchData(lightSwitch) - Logger.d(TAG, "-- onAutopilotLightSwitchData --: $lightSwitch") + CallerLogger.d("$M_DEVA$TAG", "-- onAutopilotLightSwitchData --: $lightSwitch") if (last != lightSwitch) { last = lightSwitch if (lightSwitch == LIGHT_FLASH) { diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt index 90d4d632ee..0f36e743c8 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/GearImpl.kt @@ -4,16 +4,17 @@ import android.content.Context import chassis.Chassis.GearPosition import chassis.Chassis.GearPosition.GEAR_NONE import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_GEAR import com.zhjt.mogo_core_function_devatools.status.entity.GearStatus import com.zhjt.mogo_core_function_devatools.status.flow.IFlow -internal class GearImpl(ctx: Context): IFlow(ctx), IMoGoChassisGearStateListener, IMoGoAutopilotActionsListener { +internal class GearImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotActionsListener, + IMoGoChassisStatesListener { companion object { private const val TAG = "GeerImpl" @@ -29,13 +30,13 @@ internal class GearImpl(ctx: Context): IFlow(ctx), IMoGoChassisGearS private var extra: Any? = null override fun onCreate() { - CallerChassisGearStateListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) CallerAutopilotActionsListenerManager.addListener(TAG, this) } override fun onDestroy() { super.onDestroy() - CallerChassisGearStateListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) CallerAutopilotActionsListenerManager.removeListener(TAG) } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt index 7db90a24ba..588892f7b2 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/SteerImpl.kt @@ -2,9 +2,9 @@ package com.zhjt.mogo_core_function_devatools.status.flow.autopilot import android.content.Context import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.zhjt.mogo.adas.data.bean.LaunchConditionData import com.zhjt.mogo.adas.data.bean.UnableLaunchReason @@ -12,7 +12,7 @@ import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_STEERI import com.zhjt.mogo_core_function_devatools.status.entity.SteerStatus import com.zhjt.mogo_core_function_devatools.status.flow.IFlow -internal class SteerImpl(ctx: Context): IFlow(ctx), IMoGoChassisSteeringStateListener, IMoGoAutopilotActionsListener { +internal class SteerImpl(ctx: Context): IFlow(ctx), IMoGoChassisStatesListener, IMoGoAutopilotActionsListener { companion object { private const val TAG = "SteerImpl" @@ -28,13 +28,13 @@ internal class SteerImpl(ctx: Context): IFlow(ctx), IMoGoChassisSte private var extra: Any? = null override fun onCreate() { - CallerChassisSteeringStateListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) CallerAutopilotActionsListenerManager.addListener(TAG, this) } override fun onDestroy() { super.onDestroy() - CallerChassisSteeringStateListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) CallerAutopilotActionsListenerManager.removeListener(TAG) } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt index fa2b09bb08..468a023477 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt @@ -5,8 +5,11 @@ import android.util.Log import chassis.Chassis.GearPosition import chassis.Chassis.LightSwitch import chassis.ChassisStatesOuterClass -import com.mogo.eagle.core.function.api.autopilot.* -import com.mogo.eagle.core.function.call.autopilot.* +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import com.mogo.eagle.core.utilcode.kotlin.safeCancel import com.zhjt.mogo.adas.data.AdasConstants import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus @@ -19,19 +22,10 @@ import system_master.SystemStatusInfo.StatusInfo import java.util.concurrent.atomic.AtomicInteger internal class CanImpl(ctx: Context) : - IFlow(ctx), - - IMoGoAutopilotVehicleStateListener, - - IMoGoChassisAccStateListener, - IMoGoChassisSteeringStateListener, - IMoGoChassisGearStateListener, - IMoGoChassisBrakeStateListener, - IMoGoChassisThrottleStateListener, - - IMoGoAutopilotStatusListener, - IMoGoChassisLamplightListener, - IMoGoSweeperFutianCleanSystemListener { + IFlow(ctx), + IMoGoChassisStatesListener, + IMoGoAutopilotStatusListener, + IMoGoSweeperFutianCleanSystemListener { companion object { const val TAG = "CanImpl" @@ -43,14 +37,8 @@ internal class CanImpl(ctx: Context) : override fun onCreate() { send(CanStatus(CallerAutoPilotStatusListenerManager.isConnect())) - CallerChassisAccStateListenerManager.addListener(TAG, this) - CallerChassisBrakeStateListenerManager.addListener(TAG, this) - CallerChassisGearStateListenerManager.addListener(TAG, this) - CallerChassisSteeringStateListenerManager.addListener(TAG, this) - CallerChassisThrottleStateListenerManager.addListener(TAG, this) - + CallerChassisStatesListenerManager.addListener(TAG, this) CallerAutoPilotStatusListenerManager.addListener(TAG, this) - CallerChassisLamplightListenerManager.addListener(TAG, this) } override fun onAutopilotLightSwitchData(lightSwitch: LightSwitch?) { @@ -75,7 +63,10 @@ internal class CanImpl(ctx: Context) : send(CanStatus(isCanEnabled())) } - override fun onAutopilotIpcConnectStatusChanged(status: AdasConstants.IpcConnectionStatus, reason: String?) { + override fun onAutopilotIpcConnectStatusChanged( + status: AdasConstants.IpcConnectionStatus, + reason: String? + ) { super.onAutopilotIpcConnectStatusChanged(status, reason) send(CanStatus(isCanEnabled())) } @@ -101,16 +92,19 @@ internal class CanImpl(ctx: Context) : override fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) { send(CanStatus(isCanEnabled())) } + override fun onSweeperFutianTaskIndexData(roboSweeperTaskIndex: RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex) { } + override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?) { super.onAutopilotGuardian(guardianInfo) send(CanStatus(isCanEnabled())) } override fun onAutopilotStatusRespByQuery(status: StatusInfo) { - val state = status.healthInfoList?.find { "can_adapter".equals(it.name, true) }?.state?.ordinal + val state = + status.healthInfoList?.find { "can_adapter".equals(it.name, true) }?.state?.ordinal Log.d(TAG, "state: $state") if (state != null) { this.state.set(state) @@ -118,7 +112,8 @@ internal class CanImpl(ctx: Context) : } override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) { - val state = statusInf.healthInfoList?.find { "can_adapter".equals(it.name, true) }?.state?.ordinal + val state = + statusInf.healthInfoList?.find { "can_adapter".equals(it.name, true) }?.state?.ordinal Log.d(TAG, "state: $state") if (state != null) { this.state.set(state) @@ -128,12 +123,7 @@ internal class CanImpl(ctx: Context) : override fun onDestroy() { super.onDestroy() job?.safeCancel() - CallerChassisAccStateListenerManager.removeListener(TAG) - CallerChassisBrakeStateListenerManager.removeListener(TAG) - CallerChassisGearStateListenerManager.removeListener(TAG) - CallerChassisSteeringStateListenerManager.removeListener(TAG) - CallerChassisThrottleStateListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) CallerAutoPilotStatusListenerManager.removeListener(TAG) - CallerChassisLamplightListenerManager.removeListener(TAG) } } \ 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/lookaround/M1LookAroundView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/lookaround/M1LookAroundView.kt index b990722143..3b12b5f67c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/lookaround/M1LookAroundView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/lookaround/M1LookAroundView.kt @@ -24,7 +24,7 @@ import kotlinx.coroutines.flow.* import java.util.concurrent.atomic.AtomicReference import kotlin.math.* -class M1LookAroundView: SurfaceView, SurfaceHolder.Callback, Runnable, IMoGoChassisSteeringStateListener { +class M1LookAroundView: SurfaceView, SurfaceHolder.Callback, Runnable, IMoGoChassisStatesListener { constructor(context: Context?) : super(context) constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) @@ -279,7 +279,7 @@ class M1LookAroundView: SurfaceView, SurfaceHolder.Callback, Runnable, IMoGoChas override fun onAttachedToWindow() { super.onAttachedToWindow() - CallerChassisSteeringStateListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) CallerAutoPilotControlManager.setIsSubscribeM1StitchedVideo(true) scope.launch(ThreadUtils.getCpuPool().asCoroutineDispatcher()) { CallerDevaToolsManager.lookAroundProvider()?.flow()?.also { flow -> @@ -306,7 +306,7 @@ class M1LookAroundView: SurfaceView, SurfaceHolder.Callback, Runnable, IMoGoChas override fun onDetachedFromWindow() { super.onDetachedFromWindow() - CallerChassisSteeringStateListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) CallerAutoPilotControlManager.setIsSubscribeM1StitchedVideo(false) handler.get()?.looper?.quitSafely() } 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 c10b7c8054..968137ce61 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 @@ -27,7 +27,6 @@ import androidx.core.view.MenuCompat import androidx.core.view.isVisible import androidx.lifecycle.lifecycleScope import chassis.Chassis -import com.alibaba.android.arouter.launcher.ARouter import com.mogo.cloud.network.cronet.NetworkQualityListener import com.mogo.cloud.network.cronet.QuicConfig import com.mogo.cloud.passport.MoGoAiCloudClient @@ -41,7 +40,6 @@ 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.config.JunkConfig import com.mogo.eagle.core.data.constants.MoGoConfig import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_BAG_RECORD @@ -58,7 +56,13 @@ import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.data.multidisplay.TelematicConstant import com.mogo.eagle.core.data.obu.MogoObuConst import com.mogo.eagle.core.data.obu.ObuStatusInfo -import com.mogo.eagle.core.function.api.autopilot.* +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningTrajectoryListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuConnectListener import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuInfoListener @@ -68,14 +72,20 @@ 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.* +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerPlanningTrajectoryListenerManager import com.mogo.eagle.core.function.call.cloud.CallerCloudCertManager import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager -import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager 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.obu.CallerObuConnectListenerManager @@ -98,22 +108,213 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant import com.mogo.eagle.core.utilcode.mogo.permissions.BackgrounderPermission import com.mogo.eagle.core.utilcode.mogo.toast.TipToast -import com.mogo.eagle.core.utilcode.util.* +import com.mogo.eagle.core.utilcode.util.ActivityUtils +import com.mogo.eagle.core.utilcode.util.AppUtils +import com.mogo.eagle.core.utilcode.util.BarUtils +import com.mogo.eagle.core.utilcode.util.CommonUtils +import com.mogo.eagle.core.utilcode.util.DeviceUtils +import com.mogo.eagle.core.utilcode.util.KeyboardUtils +import com.mogo.eagle.core.utilcode.util.NetworkUtils +import com.mogo.eagle.core.utilcode.util.ParseVersionUtils +import com.mogo.eagle.core.utilcode.util.ScreenUtils +import com.mogo.eagle.core.utilcode.util.StringUtils +import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.eagle.core.utilcode.util.TimeUtils +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import com.mogo.eagle.core.utilcode.util.Utils import com.mogo.map.MogoData.Companion.mogoMapData import com.mogo.map.uicontroller.VisualAngleMode -import com.mogo.map.uicontroller.VisualAngleMode.* -import com.mogo.test.crashreport.CrashReportConstants -import com.mogo.test.crashreport.ITestCrashReportProvider +import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_300 +import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS +import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_TOP +import com.mogo.map.uicontroller.VisualAngleMode.MODE_LONG_SIGHT import com.mogo.tts.base.IMogoTTSCallback -import com.zhidaoauto.map.data.road.RoadCross import com.zhjt.mogo.adas.data.AdasConstants import com.zhjt.service.chain.ChainLog -import kotlinx.android.synthetic.main.view_debug_setting.view.* -import kotlinx.coroutines.* +import kotlinx.android.synthetic.main.view_debug_setting.view.appVersionInfoLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.brakeThresholdDivider +import kotlinx.android.synthetic.main.view_debug_setting.view.btChangeEnv +import kotlinx.android.synthetic.main.view_debug_setting.view.btnAppReboot +import kotlinx.android.synthetic.main.view_debug_setting.view.btnBrakeThreshold +import kotlinx.android.synthetic.main.view_debug_setting.view.btnConnectServerIp +import kotlinx.android.synthetic.main.view_debug_setting.view.btnDisconnectIpc +import kotlinx.android.synthetic.main.view_debug_setting.view.btnDrawFusion +import kotlinx.android.synthetic.main.view_debug_setting.view.btnIpcReboot +import kotlinx.android.synthetic.main.view_debug_setting.view.btnPointCloudColor +import kotlinx.android.synthetic.main.view_debug_setting.view.btnPointCloudSize +import kotlinx.android.synthetic.main.view_debug_setting.view.btnRecordBag +import kotlinx.android.synthetic.main.view_debug_setting.view.btnRecordPackage +import kotlinx.android.synthetic.main.view_debug_setting.view.btnSetAutopilotIP +import kotlinx.android.synthetic.main.view_debug_setting.view.btnSetFifty +import kotlinx.android.synthetic.main.view_debug_setting.view.btnSetObuIP +import kotlinx.android.synthetic.main.view_debug_setting.view.btnSetOneHundred +import kotlinx.android.synthetic.main.view_debug_setting.view.btnStartTTS +import kotlinx.android.synthetic.main.view_debug_setting.view.btnThresholdDefine +import kotlinx.android.synthetic.main.view_debug_setting.view.btn_cache_hd_map +import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasAutoPilot +import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasDataTrack +import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasTrafficlight +import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasTrajectory +import kotlinx.android.synthetic.main.view_debug_setting.view.cbAdasVehicle +import kotlinx.android.synthetic.main.view_debug_setting.view.cbBusLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbDevaLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbHmiLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbMapLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbNetworkLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbObuLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbSsl +import kotlinx.android.synthetic.main.view_debug_setting.view.cbSweeperPLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbTaxiLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbTaxiPLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbTraceLog +import kotlinx.android.synthetic.main.view_debug_setting.view.cbV2xLog +import kotlinx.android.synthetic.main.view_debug_setting.view.changesight_back_btn +import kotlinx.android.synthetic.main.view_debug_setting.view.changesight_cross_btn +import kotlinx.android.synthetic.main.view_debug_setting.view.changesight_far_btn +import kotlinx.android.synthetic.main.view_debug_setting.view.changesight_top_btn +import kotlinx.android.synthetic.main.view_debug_setting.view.clDebugContain +import kotlinx.android.synthetic.main.view_debug_setting.view.commonLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.controlCenterLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.deviceBindLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.domainControllerLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.eagleEyeControllerLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.etAutopilotIP +import kotlinx.android.synthetic.main.view_debug_setting.view.etConnectServerIp +import kotlinx.android.synthetic.main.view_debug_setting.view.etInputBrakeThreshold +import kotlinx.android.synthetic.main.view_debug_setting.view.etInputRecordBagTime +import kotlinx.android.synthetic.main.view_debug_setting.view.etInputRecordTime +import kotlinx.android.synthetic.main.view_debug_setting.view.etLogCatch +import kotlinx.android.synthetic.main.view_debug_setting.view.etObuIP +import kotlinx.android.synthetic.main.view_debug_setting.view.etPointCloudColor +import kotlinx.android.synthetic.main.view_debug_setting.view.etPointCloudSize +import kotlinx.android.synthetic.main.view_debug_setting.view.etTTSContent +import kotlinx.android.synthetic.main.view_debug_setting.view.etThreshold +import kotlinx.android.synthetic.main.view_debug_setting.view.exportAllLogs +import kotlinx.android.synthetic.main.view_debug_setting.view.hdMapControllerLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.hmiControllerLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.logLoadingView +import kotlinx.android.synthetic.main.view_debug_setting.view.logcatCenterLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.obuConnectStatusTv +import kotlinx.android.synthetic.main.view_debug_setting.view.obuControllerLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.reportMsgLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.reset_changesight +import kotlinx.android.synthetic.main.view_debug_setting.view.rgGpsProvider +import kotlinx.android.synthetic.main.view_debug_setting.view.statusCenterLayout +import kotlinx.android.synthetic.main.view_debug_setting.view.swDevelopMode +import kotlinx.android.synthetic.main.view_debug_setting.view.tbADASLog +import kotlinx.android.synthetic.main.view_debug_setting.view.tbAppUpgrade +import kotlinx.android.synthetic.main.view_debug_setting.view.tbAppVersionInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tbBeautyMode +import kotlinx.android.synthetic.main.view_debug_setting.view.tbBusStationStrategyBorderPoint +import kotlinx.android.synthetic.main.view_debug_setting.view.tbCarAperture +import kotlinx.android.synthetic.main.view_debug_setting.view.tbChangeAutoPilotStatus +import kotlinx.android.synthetic.main.view_debug_setting.view.tbChangeCurrentCarIcon +import kotlinx.android.synthetic.main.view_debug_setting.view.tbChangeCurrentSkinMode +import kotlinx.android.synthetic.main.view_debug_setting.view.tbControlCenter +import kotlinx.android.synthetic.main.view_debug_setting.view.tbControlPassengerDriverMonitor +import kotlinx.android.synthetic.main.view_debug_setting.view.tbCronet +import kotlinx.android.synthetic.main.view_debug_setting.view.tbDeviceBind +import kotlinx.android.synthetic.main.view_debug_setting.view.tbDomainController +import kotlinx.android.synthetic.main.view_debug_setting.view.tbDrawPointCloudData +import kotlinx.android.synthetic.main.view_debug_setting.view.tbEagleEyeController +import kotlinx.android.synthetic.main.view_debug_setting.view.tbHdMapController +import kotlinx.android.synthetic.main.view_debug_setting.view.tbHdMapLog +import kotlinx.android.synthetic.main.view_debug_setting.view.tbHmiController +import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsDemoMode +import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsDrawAutopilotTrajectoryData +import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsDrawIdentifyData +import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsDrawPath +import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsDrawUnknownIdentifyData +import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsRainMode +import kotlinx.android.synthetic.main.view_debug_setting.view.tbIsStrictMode +import kotlinx.android.synthetic.main.view_debug_setting.view.tbLogCatch +import kotlinx.android.synthetic.main.view_debug_setting.view.tbLogDebugView +import kotlinx.android.synthetic.main.view_debug_setting.view.tbLogcatCenter +import kotlinx.android.synthetic.main.view_debug_setting.view.tbNetLog +import kotlinx.android.synthetic.main.view_debug_setting.view.tbObuController +import kotlinx.android.synthetic.main.view_debug_setting.view.tbObuLog +import kotlinx.android.synthetic.main.view_debug_setting.view.tbObuWarningFusionUnion +import kotlinx.android.synthetic.main.view_debug_setting.view.tbOpenAcceleration +import kotlinx.android.synthetic.main.view_debug_setting.view.tbOpenSnBinding +import kotlinx.android.synthetic.main.view_debug_setting.view.tbReportMore +import kotlinx.android.synthetic.main.view_debug_setting.view.tbReportWarning +import kotlinx.android.synthetic.main.view_debug_setting.view.tbRouteDynamicEffect +import kotlinx.android.synthetic.main.view_debug_setting.view.tbSelfLog +import kotlinx.android.synthetic.main.view_debug_setting.view.tbStartAutopilotCommand +import kotlinx.android.synthetic.main.view_debug_setting.view.tbStatusCenter +import kotlinx.android.synthetic.main.view_debug_setting.view.tbTTSCenter +import kotlinx.android.synthetic.main.view_debug_setting.view.tbTraceEnable +import kotlinx.android.synthetic.main.view_debug_setting.view.tbVehicleStateController +import kotlinx.android.synthetic.main.view_debug_setting.view.trackerIPCProvider +import kotlinx.android.synthetic.main.view_debug_setting.view.trackerProvider +import kotlinx.android.synthetic.main.view_debug_setting.view.ttsCenterContainer +import kotlinx.android.synthetic.main.view_debug_setting.view.tvAppBuildTimeInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvAppContent +import kotlinx.android.synthetic.main.view_debug_setting.view.tvAppHost +import kotlinx.android.synthetic.main.view_debug_setting.view.tvAppVersionName +import kotlinx.android.synthetic.main.view_debug_setting.view.tvAppVersionNameKey +import kotlinx.android.synthetic.main.view_debug_setting.view.tvAutopilotConnectStatus +import kotlinx.android.synthetic.main.view_debug_setting.view.tvAutopilotInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvAutopilotProtocolVersionInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvBackgroundOperation +import kotlinx.android.synthetic.main.view_debug_setting.view.tvCarInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvCarInfoCopy +import kotlinx.android.synthetic.main.view_debug_setting.view.tvCarInfoCopyClip +import kotlinx.android.synthetic.main.view_debug_setting.view.tvCertFile +import kotlinx.android.synthetic.main.view_debug_setting.view.tvCmdbCarInfoContent +import kotlinx.android.synthetic.main.view_debug_setting.view.tvCurEnv +import kotlinx.android.synthetic.main.view_debug_setting.view.tvDriverServerStartupStatus +import kotlinx.android.synthetic.main.view_debug_setting.view.tvGearInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvGitBranchInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvIPCMac +import kotlinx.android.synthetic.main.view_debug_setting.view.tvIdentifyInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvIdentifyInfoCopy +import kotlinx.android.synthetic.main.view_debug_setting.view.tvInternetEnvironment +import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcConnectStatus +import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcInfoKey +import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcProtocolVersionInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcVersionInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcVersionInfoClip +import kotlinx.android.synthetic.main.view_debug_setting.view.tvIpcVersionInfoKey +import kotlinx.android.synthetic.main.view_debug_setting.view.tvLocationEnabled +import kotlinx.android.synthetic.main.view_debug_setting.view.tvMoGoMapVersion +import kotlinx.android.synthetic.main.view_debug_setting.view.tvMoGoMapVersionKey +import kotlinx.android.synthetic.main.view_debug_setting.view.tvObuConnectStatus +import kotlinx.android.synthetic.main.view_debug_setting.view.tvObuInfoContent +import kotlinx.android.synthetic.main.view_debug_setting.view.tvPadCopyrightId +import kotlinx.android.synthetic.main.view_debug_setting.view.tvPadSn +import kotlinx.android.synthetic.main.view_debug_setting.view.tvPadSnClip +import kotlinx.android.synthetic.main.view_debug_setting.view.tvPadSnKey +import kotlinx.android.synthetic.main.view_debug_setting.view.tvPlateNumber +import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportActions +import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportCode +import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportLevel +import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportMsg +import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportResult +import kotlinx.android.synthetic.main.view_debug_setting.view.tvReportSrc +import kotlinx.android.synthetic.main.view_debug_setting.view.tvRouteInfoSize +import kotlinx.android.synthetic.main.view_debug_setting.view.tvRouteInfoSizeCopy +import kotlinx.android.synthetic.main.view_debug_setting.view.tvServerEnvironment +import kotlinx.android.synthetic.main.view_debug_setting.view.tvServerSocketStatus +import kotlinx.android.synthetic.main.view_debug_setting.view.tvSteeringInfo +import kotlinx.android.synthetic.main.view_debug_setting.view.tvTelematicTimeStamp +import kotlinx.android.synthetic.main.view_debug_setting.view.tvTrajectoryInfoSize +import kotlinx.android.synthetic.main.view_debug_setting.view.tvTrajectoryInfoSizeCopy +import kotlinx.android.synthetic.main.view_debug_setting.view.tvUniqueDeviceId +import kotlinx.android.synthetic.main.view_debug_setting.view.vehicleStateLayout +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import mogo.telematics.pad.MessagePad import mogo_msg.MogoReportMsg import java.text.SimpleDateFormat -import java.util.* +import java.util.Date +import java.util.Timer +import java.util.TimerTask import java.util.concurrent.TimeUnit import kotlin.collections.component1 import kotlin.collections.component2 @@ -142,13 +343,8 @@ internal class DebugSettingView @JvmOverloads constructor( IMoGoPlanningRottingListener, IMoGoPlanningTrajectoryListener, IMoGoDevaToolsFuncConfigListener, - IMoGoChassisLamplightListener, IMoGoDevaToolsListener, - IMoGoChassisAccStateListener, - IMoGoChassisSteeringStateListener, - IMoGoChassisGearStateListener, - IMoGoChassisBrakeStateListener, - IMoGoChassisThrottleStateListener, + IMoGoChassisStatesListener, IMoGoSweeperFutianCleanSystemListener, IMoGoObuInfoListener, ISopSettingListener, IViewControlListener, IMoGoCloudListener { @@ -255,16 +451,10 @@ internal class DebugSettingView @JvmOverloads constructor( // 添加 规划路径相关回调 监听 CallerPlanningRottingListenerManager.addListener(TAG, this) CallerPlanningTrajectoryListenerManager.addListener(TAG, this) - //添加 车辆底盘数据回调 监听 - CallerChassisAccStateListenerManager.addListener(TAG, this) - CallerChassisBrakeStateListenerManager.addListener(TAG, this) - CallerChassisGearStateListenerManager.addListener(TAG, this) - CallerChassisSteeringStateListenerManager.addListener(TAG, this) - CallerChassisThrottleStateListenerManager.addListener(TAG, this) //添加 开发套件工具接口 监听 CallerDevaToolsListenerManager.addListener(TAG, this) - //添加 底盘灯光数据 监听 - CallerChassisLamplightListenerManager.addListener(TAG, this) + //添加 底盘数据 监听 + CallerChassisStatesListenerManager.addListener(TAG, this) //雨天、美化、点云设置同步 CallerSopSettingManager.addListener(TAG, this) @@ -304,16 +494,10 @@ internal class DebugSettingView @JvmOverloads constructor( // 移除 规划路径相关回调 监听 CallerPlanningRottingListenerManager.removeListener(TAG) CallerPlanningTrajectoryListenerManager.removeListener(TAG) - // 移除 车辆底盘数据回调 监听 - CallerChassisAccStateListenerManager.removeListener(TAG) - CallerChassisBrakeStateListenerManager.removeListener(TAG) - CallerChassisGearStateListenerManager.removeListener(TAG) - CallerChassisSteeringStateListenerManager.removeListener(TAG) - CallerChassisThrottleStateListenerManager.removeListener(TAG) // 移除 开发套件工具接口 监听 CallerDevaToolsListenerManager.removeListener(TAG) - // 移除 底盘灯光数据 监听 - CallerChassisLamplightListenerManager.removeListener(TAG) + // 移除 底盘数据 监听 + CallerChassisStatesListenerManager.removeListener(TAG) // 移除 obu获取信息 监听 CallerObuInfoListenerManager.removeListener(TAG) //雨天、美化、点云设置同步 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt index a0249df86a..c1d6d3fa5e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/SteeringBrakeView.kt @@ -8,14 +8,14 @@ import androidx.constraintlayout.widget.ConstraintLayout import chassis.Chassis import com.mogo.eagle.core.data.constants.MoGoConfig import com.mogo.eagle.core.data.map.MogoLocation -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager import com.mogo.eagle.core.function.hmi.R 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.commons.storage.SharedPrefsMgr +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.Utils import kotlinx.android.synthetic.main.view_steering_brake.view.* @@ -25,7 +25,7 @@ import kotlinx.android.synthetic.main.view_steering_brake.view.* * 刹车,调用模型的逻辑暂时放入view。 转向不受影响 */ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayout(context, attrs), - IMoGoChassisLamplightListener, IMoGoChassisLocationWGS84Listener { + IMoGoChassisStatesListener, IMoGoChassisLocationWGS84Listener { companion object { private const val TAG = "SteeringBrakeView" @@ -41,7 +41,7 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo override fun onAttachedToWindow() { super.onAttachedToWindow() - CallerChassisLamplightListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) CallerChassisLocationWGS84ListenerManager.addListener(TAG, this) } @@ -91,7 +91,7 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo override fun onDetachedFromWindow() { super.onDetachedFromWindow() - CallerChassisLamplightListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) CallerChassisLocationWGS84ListenerManager.removeListener(TAG) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/TurnLightViewStatus.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/TurnLightViewStatus.kt index a0350f9cb7..3e1a76b30e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/TurnLightViewStatus.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/vehicle/TurnLightViewStatus.kt @@ -12,9 +12,9 @@ import android.widget.ImageView import androidx.constraintlayout.widget.ConstraintLayout import chassis.Chassis import com.mogo.eagle.core.data.config.HmiBuildConfig -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTurnLightListener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import com.mogo.eagle.core.function.call.v2x.CallerTurnLightListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.util.ThreadUtils @@ -30,7 +30,7 @@ open class TurnLightViewStatus @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 -) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoChassisLamplightListener, +) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoChassisStatesListener, IMoGoTurnLightListener { companion object { @@ -72,13 +72,13 @@ open class TurnLightViewStatus @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() - CallerChassisLamplightListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) CallerTurnLightListenerManager.addListener(TAG,this) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - CallerChassisLamplightListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) CallerTurnLightListenerManager.removeListener(TAG) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.kt index 4ca02931cc..c3e4e39157 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.kt @@ -13,11 +13,9 @@ import chassis.Chassis.GearPosition import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager -import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isBus @@ -35,8 +33,7 @@ import kotlin.math.abs * 档位随CAN数据做切换和高亮显示 * @since: 4/7/22 */ -class SteeringWheelView : ConstraintLayout, IMoGoChassisSteeringStateListener, - IMoGoChassisGearStateListener { +class SteeringWheelView : ConstraintLayout, IMoGoChassisStatesListener { private var autopilotIV: ImageView? = null private var steeringTVL: TextView? = null private var steeringTVR: TextView? = null @@ -57,8 +54,7 @@ class SteeringWheelView : ConstraintLayout, IMoGoChassisSteeringStateListener, } initView() CallerAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener) - CallerChassisGearStateListenerManager.addListener(TAG, this) - CallerChassisSteeringStateListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) tapPositionView?.updateWithGear(GearPosition.GEAR_R) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java deleted file mode 100644 index 16d9dd686b..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.mogo.eagle.core.function.hmi.ui.widget; - -import static com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.os.Handler; -import android.os.Message; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.constraintlayout.widget.ConstraintLayout; - -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener; -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener; -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener; -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener; -import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; -import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager; -import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager; -import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager; -import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager; -import com.mogo.eagle.core.function.hmi.R; -import com.mogo.eagle.core.utilcode.util.ThreadUtils; - -import org.jetbrains.annotations.NotNull; - -import chassis.Chassis; -import mogo.telematics.pad.MessagePad; - -/** - * @author Jing - * @description 速度 加速度 档位 刹车 油门状态值 - * @since: 6/24/22 - */ -public class TrafficDataView extends ConstraintLayout implements - IMoGoChassisGearStateListener , - IMoGoChassisBrakeStateListener, - IMoGoChassisThrottleStateListener, - IMoGoAutopilotPlanningActionsListener { - private static final String TAG = "TrafficDataView"; - private TapPositionView tapPositionView; - private TextView speedTextView; - private TextView accTextView; - private ImageView speedImage; - private ImageView brakeStatus; - - private static final int MSG_SEND_UPDATE = 1; - private volatile double acceleration; - private volatile float mBrake; - private volatile float mThrottle; - - @SuppressLint("HandlerLeak") - private final Handler handler = new Handler() { - @Override - public void handleMessage(@NonNull Message msg) { - super.handleMessage(msg); - if (msg.what == MSG_SEND_UPDATE) { - java.text.DecimalFormat mFormat = new java.text.DecimalFormat("0.0"); - String accStr = mFormat.format(Math.abs(acceleration)); - if (acceleration > 0f) { - accTextView.setText(accStr); - } else { - accTextView.setText("- " + accStr); - } - int state = CallerAutoPilotStatusListenerManager.INSTANCE.getState(); - if (state < STATUS_AUTOPILOT_RUNNING) { - if (mBrake > 0) { - brakeStatus.setImageResource(R.drawable.traffic_data_brake); - } else if (mThrottle >= 0 && mBrake == 0) { - brakeStatus.setImageResource(R.drawable.traffic_data_accelerator); - } else { - brakeStatus.setImageResource(R.drawable.traffic_data_empty); - } - } - if (state == 2) { - brakeStatus.setImageResource(R.drawable.traffic_data_empty); - } - } - handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L); - } - }; - - public TrafficDataView(@NonNull Context context) { - super(context); - } - - public TrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - initView(context); - } - - public TrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public TrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L); - CallerChassisGearStateListenerManager.INSTANCE.addListener(TAG, this); - CallerChassisBrakeStateListenerManager.INSTANCE.addListener(TAG, this); - CallerChassisThrottleStateListenerManager.INSTANCE.addListener(TAG, this); - CallerPlanningActionsListenerManager.INSTANCE.addListener(TAG, this); - } - - private void initView(@NonNull Context context) { - LayoutInflater.from(context).inflate(R.layout.hmi_traffic_data, this); - tapPositionView = findViewById(R.id.traffic_position); - speedImage = findViewById(R.id.speedImage); - speedTextView = findViewById(R.id.speedTextView); - accTextView = findViewById(R.id.speedAccTextView); - brakeStatus = findViewById(R.id.brakeStatus); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - CallerChassisGearStateListenerManager.INSTANCE.removeListener(TAG); - CallerChassisBrakeStateListenerManager.INSTANCE.removeListener(TAG); - CallerChassisThrottleStateListenerManager.INSTANCE.removeListener(TAG); - CallerPlanningActionsListenerManager.INSTANCE.removeListener(TAG); - } - - @Override - public void pncActions(@NonNull MessagePad.PlanningActionMsg planningActionMsg) { - acceleration = planningActionMsg.getDestinationAcc(); - } - - /** - * 档位 - */ - @Override - public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) { - ThreadUtils.runOnUiThread(() -> { - if (tapPositionView != null) { - tapPositionView.updateWithGear(gear); - } - }); - } - - @Override - public void onAutopilotBrake(float brake) { - mBrake = brake; - } - - @Override - public void onAutopilotThrottle(float throttle) { - mThrottle = throttle; - } - - /** - * value呈现 - */ - public void updateSpeedWithValue(int newSpeed) { - if (speedTextView != null) { - speedTextView.setText(String.valueOf(newSpeed)); - } - } - -} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.kt new file mode 100644 index 0000000000..c750d49167 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.kt @@ -0,0 +1,148 @@ +package com.mogo.eagle.core.function.hmi.ui.widget + +import android.annotation.SuppressLint +import android.content.Context +import android.os.Handler +import android.os.Looper +import android.os.Message +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.ImageView +import android.widget.TextView +import androidx.constraintlayout.widget.ConstraintLayout +import chassis.Chassis.GearPosition +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.util.ThreadUtils +import mogo.telematics.pad.MessagePad.PlanningActionMsg +import java.text.DecimalFormat +import kotlin.math.abs + +/** + * @author Jing + * @description 速度 加速度 档位 刹车 油门状态值 + * @since: 6/24/22 + */ +open class TrafficDataView : ConstraintLayout, IMoGoChassisStatesListener, + IMoGoAutopilotPlanningActionsListener { + private var tapPositionView: TapPositionView? = null + private var speedTextView: TextView? = null + private var accTextView: TextView? = null + private var speedImage: ImageView? = null + private var brakeStatus: ImageView? = null + + @Volatile + private var acceleration = 0.0 + + @Volatile + private var mBrake = 0f + + @Volatile + private var mThrottle = 0f + + @SuppressLint("HandlerLeak") + private val handler: Handler = object : Handler(Looper.getMainLooper()) { + override fun handleMessage(msg: Message) { + super.handleMessage(msg) + if (msg.what == MSG_SEND_UPDATE) { + val mFormat = DecimalFormat("0.0") + val accStr = mFormat.format(abs(acceleration)) + if (acceleration > 0f) { + accTextView?.text = accStr + } else { + accTextView?.text = "- $accStr" + } + val state = getState() + if (state < IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { + if (mBrake > 0) { + brakeStatus?.setImageResource(R.drawable.traffic_data_brake) + } else if (mThrottle >= 0 && mBrake == 0f) { + brakeStatus?.setImageResource(R.drawable.traffic_data_accelerator) + } else { + brakeStatus?.setImageResource(R.drawable.traffic_data_empty) + } + } + if (state == 2) { + brakeStatus?.setImageResource(R.drawable.traffic_data_empty) + } + } + sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L) + } + } + + constructor(context: Context) : super(context) + + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { + initView(context) + } + + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( + context, + attrs, + defStyleAttr + ) + + constructor( + context: Context, + attrs: AttributeSet?, + defStyleAttr: Int, + defStyleRes: Int + ) : super(context, attrs, defStyleAttr, defStyleRes) + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L) + CallerChassisStatesListenerManager.addListener(TAG, this) + CallerPlanningActionsListenerManager.addListener(TAG, this) + } + + private fun initView(context: Context) { + LayoutInflater.from(context).inflate(R.layout.hmi_traffic_data, this) + tapPositionView = findViewById(R.id.traffic_position) + speedImage = findViewById(R.id.speedImage) + speedTextView = findViewById(R.id.speedTextView) + accTextView = findViewById(R.id.speedAccTextView) + brakeStatus = findViewById(R.id.brakeStatus) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerChassisStatesListenerManager.removeListener(TAG) + CallerPlanningActionsListenerManager.removeListener(TAG) + } + + override fun pncActions(planningActionMsg: PlanningActionMsg) { + acceleration = planningActionMsg.destinationAcc + } + + override fun onAutopilotGearData(gear: GearPosition) { + ThreadUtils.runOnUiThread { + tapPositionView?.updateWithGear(gear) + } + } + + override fun onAutopilotBrake(brake: Float) { + mBrake = brake + } + + override fun onAutopilotThrottle(throttle: Float) { + mThrottle = throttle + } + + /** + * value呈现 + */ + fun updateSpeedWithValue(newSpeed: Int) { + speedTextView?.text = newSpeed.toString() + } + + companion object { + private const val TAG = "TrafficDataView" + private const val MSG_SEND_UPDATE = 1 + } +} diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt index 9918680cdb..eb3c275166 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/MapBizView.kt @@ -7,12 +7,10 @@ import androidx.lifecycle.LifecycleObserver import chassis.Chassis import com.mogo.eagle.core.data.config.FunctionBuildConfig.accThreshold import com.mogo.eagle.core.data.map.MogoLocation -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener -import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger -import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP +import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager import com.mogo.map.MogoMap import com.mogo.map.MogoMapView import com.mogo.map.overlay.line.Polyline @@ -24,7 +22,7 @@ import kotlin.properties.Delegates class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs), - IMoGoChassisLocationWGS84Listener, IMoGoChassisLamplightListener, LifecycleObserver { + IMoGoChassisLocationWGS84Listener, IMoGoChassisStatesListener, LifecycleObserver { companion object { private const val TAG = "MapBizView" @@ -35,7 +33,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, map?.uiController?.showMyLocation(true) initMapView() CallerChassisLocationWGS84ListenerManager.addListener(TAG, 20, this) - CallerChassisLamplightListenerManager.addListener(TAG, this) + CallerChassisStatesListenerManager.addListener(TAG, this) } @@ -138,7 +136,7 @@ class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, override fun onDestroy() { // 先取消注册数据,再onDestroy CallerChassisLocationWGS84ListenerManager.removeListener(TAG) - CallerChassisLamplightListenerManager.removeListener(TAG) + CallerChassisStatesListenerManager.removeListener(TAG) super.onDestroy() } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt deleted file mode 100644 index dffc550030..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.mogo.eagle.core.function.api.autopilot - -/** - * 车辆底盘 数据 回调监听 - */ -interface IMoGoAutopilotVehicleStateListener { - - - /** - * 没有自车状态数据 - */ - fun onAutopilotDataException(timestamp: Long) {} -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoBatteryManagementSystemListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoBatteryManagementSystemListener.kt deleted file mode 100644 index bdf0a9c180..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoBatteryManagementSystemListener.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.mogo.eagle.core.function.api.autopilot - -import chassis.ChassisStatesOuterClass - -/** - * 电池管理系统 - */ -interface IMoGoBatteryManagementSystemListener { - /** - * 电池管理系统 - */ - fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisAccStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisAccStateListener.kt deleted file mode 100644 index c26af4825e..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisAccStateListener.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.mogo.eagle.core.function.api.autopilot - -/** - * 车辆加速度 数据 回调监听 - */ -interface IMoGoChassisAccStateListener { - - /** - * 车辆加速度 - */ - fun onAutopilotAcc(carAcc: Float){} - -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisBrakeStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisBrakeStateListener.kt deleted file mode 100644 index 89e837926f..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisBrakeStateListener.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.mogo.eagle.core.function.api.autopilot - -/** - * 刹车 数据 回调监听 - */ -interface IMoGoChassisBrakeStateListener { - - /** - * 刹车 - */ - fun onAutopilotBrake(brake: Float){} -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisGearStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisGearStateListener.kt deleted file mode 100644 index 9e8ab937ae..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisGearStateListener.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.mogo.eagle.core.function.api.autopilot - -import chassis.Chassis - -/** - * 车辆挂档档位 数据 回调监听 - */ -interface IMoGoChassisGearStateListener { - - /** - * 车辆挂档档位 - * @param gear 档位 - */ - fun onAutopilotGearData(gear: Chassis.GearPosition) - -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt deleted file mode 100644 index 8e9ec25a58..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisLamplightListener.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.mogo.eagle.core.function.api.autopilot - -import chassis.Chassis - -/** - * 车辆底盘 灯光数据 回调监听 - */ -interface IMoGoChassisLamplightListener { - - /** - * 车辆转向灯 数据 - * @param lightSwitch - */ - fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?){} - - /** - * 车辆刹车灯 数据 - * @param brakeLight - */ - fun onAutopilotBrakeLightData(brakeLight: Boolean){} - -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisStatesListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisStatesListener.kt new file mode 100644 index 0000000000..178ee32434 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisStatesListener.kt @@ -0,0 +1,59 @@ +package com.mogo.eagle.core.function.api.autopilot + +import chassis.Chassis +import chassis.ChassisStatesOuterClass +import planning.RoboSweeperTaskIndexOuterClass + +interface IMoGoChassisStatesListener { + + /** + * 车辆转向灯 数据 + * @param lightSwitch + */ + fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?){} + + /** + * 车辆刹车灯 数据 + * @param brakeLight + */ + fun onAutopilotBrakeLightData(brakeLight: Boolean){} + + + /** + * 车辆方向盘转向角回调 + * @param steering 方向盘转向角 + */ + fun onAutopilotSteeringData(steering: Float){} + + /** + * 车辆挂档档位 + * @param gear 档位 + */ + fun onAutopilotGearData(gear: Chassis.GearPosition){} + + /** + * 车辆加速度 + */ + fun onAutopilotAcc(carAcc: Float){} + + /** + * 油门 + */ + fun onAutopilotThrottle(throttle: Float){} + + /** + * 刹车 + */ + fun onAutopilotBrake(brake: Float){} + + /** + * 电池管理系统 + */ + fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates){} + + /** + * 没有自车底盘状态数据 + */ + fun onAutopilotDataException(timestamp: Long) {} + +} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisSteeringStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisSteeringStateListener.kt deleted file mode 100644 index fd9c736e58..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisSteeringStateListener.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.mogo.eagle.core.function.api.autopilot - -/** - * 车辆方向盘转向角 数据 回调监听 - */ -interface IMoGoChassisSteeringStateListener { - - /** - * 车辆方向盘转向角回调 - * @param steering 方向盘转向角 - */ - fun onAutopilotSteeringData(steering: Float) - -} \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisThrottleStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisThrottleStateListener.kt deleted file mode 100644 index 71018db6d0..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisThrottleStateListener.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.mogo.eagle.core.function.api.autopilot - -/** - * 油门 数据 回调监听 - */ -interface IMoGoChassisThrottleStateListener { - - /** - * 油门 - */ - fun onAutopilotThrottle(throttle: Float){} -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt deleted file mode 100644 index 0b846cdd23..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.mogo.eagle.core.function.call.autopilot - -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener -import com.mogo.eagle.core.function.call.base.CallerBase -import planning.RoboSweeperTaskIndexOuterClass -import java.util.concurrent.ConcurrentHashMap - -/** - * 车辆底盘数据 回调监听 - */ -object CallerAutopilotVehicleStateListenerManager : CallerBase() { - - @Volatile - private var timeStamp: Long = 0L - - /** - * 工控机时间回调 - */ - fun invokeAutopilotTime(time: Long) { - this.timeStamp = time - } - - /** - * 获取工控机的时间, 单位是秒 - */ - fun getAutopilotTimeStamp(): Long { - return this.timeStamp - } - - fun invokeAutopilotDataException(timestamp: Long) { - M_LISTENERS.forEach{ - val listener = it.value - listener.onAutopilotDataException(timestamp) - } - } - -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerBatteryManagementSystemListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerBatteryManagementSystemListenerManager.kt deleted file mode 100644 index 62c02f4be3..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerBatteryManagementSystemListenerManager.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.mogo.eagle.core.function.call.autopilot - -import chassis.ChassisStatesOuterClass -import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener -import com.mogo.eagle.core.function.call.base.CallerBase - -/** - * 电池管理系统 包含 电量剩余百分比 电压 电流等 - */ -object CallerBatteryManagementSystemListenerManager : CallerBase() { - - /** - * 电池管理系统 - */ - fun invokeBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) { - M_LISTENERS.forEach { - val listener = it.value - listener.onBatteryManagementSystemStates(states) - } - } -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisAccStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisAccStateListenerManager.kt deleted file mode 100644 index 3defb3e721..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisAccStateListenerManager.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.mogo.eagle.core.function.call.autopilot - -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisAccStateListener -import com.mogo.eagle.core.function.call.base.CallerBase - -/** - * 车辆加速度 回调监听 - */ -object CallerChassisAccStateListenerManager : CallerBase() { - - /** - * 车辆加速度 - * acc 加速度 - */ - fun invokeAutopilotAcc(carAcc: Float) { - M_LISTENERS.forEach { - val listener = it.value - listener.onAutopilotAcc(carAcc) - } - } -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisBrakeStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisBrakeStateListenerManager.kt deleted file mode 100644 index a197d8dad7..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisBrakeStateListenerManager.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.mogo.eagle.core.function.call.autopilot - -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener -import com.mogo.eagle.core.function.call.base.CallerBase - -/** - * 车辆刹车 回调监听 - */ -object CallerChassisBrakeStateListenerManager : CallerBase() { - - /** - * brake 刹车 - */ - fun invokeAutopilotBrake(brake: Float){ - M_LISTENERS.forEach{ - val listener = it.value - listener.onAutopilotBrake(brake) - } - } -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisGearStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisGearStateListenerManager.kt deleted file mode 100644 index 30d52e1a72..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisGearStateListenerManager.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.mogo.eagle.core.function.call.autopilot - -import chassis.Chassis -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener -import com.mogo.eagle.core.function.call.base.CallerBase - -/** - * 车辆挂档档位 回调监听 - */ -object CallerChassisGearStateListenerManager : CallerBase() { - - /** - * 车辆挂档档位 - * @param gear 档位 - */ - fun invokeAutopilotGearData(gear: Chassis.GearPosition) { - M_LISTENERS.forEach { - val listener = it.value - listener.onAutopilotGearData(gear) - } - } -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLamplightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLamplightListenerManager.kt deleted file mode 100644 index b68d7a1568..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLamplightListenerManager.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.mogo.eagle.core.function.call.autopilot - -import chassis.Chassis -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener -import com.mogo.eagle.core.function.call.base.CallerBase - -/** - * 车辆底盘灯光数据 回调监听 - */ -object CallerChassisLamplightListenerManager : CallerBase() { - - /** - * 车辆转向灯数据回调 - * @param lightSwitch - */ - fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch) { - M_LISTENERS.forEach { - val listener = it.value - listener.onAutopilotLightSwitchData(lightSwitch) - } - } - - /** - * 车辆刹车灯数据回调 - * @param brakeLight - */ - fun invokeAutopilotBrakeLightData(brakeLight: Boolean) { - M_LISTENERS.forEach { - val listener = it.value - listener.onAutopilotBrakeLightData(brakeLight) - } - } - -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisStatesListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisStatesListenerManager.kt new file mode 100644 index 0000000000..56533e3053 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisStatesListenerManager.kt @@ -0,0 +1,172 @@ +package com.mogo.eagle.core.function.call.autopilot + +import chassis.Chassis +import chassis.ChassisStatesOuterClass +import chassis.VehicleStateOuterClass +import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisStatesListener +import com.mogo.eagle.core.function.call.base.CallerBase +import kotlin.properties.Delegates + +object CallerChassisStatesListenerManager: CallerBase() { + + fun invokeStates(vehicleState: VehicleStateOuterClass.VehicleState){ + //刹车灯数据 + invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus) + //方向盘转向角数据 + invokeAutopilotSteeringData(vehicleState.steering) + //挂档档位数据 + invokeAutopilotGearData(vehicleState.gear) + //加速度 + invokeAutopilotAcc(vehicleState.accel) + //油门 + invokeAutopilotThrottle(vehicleState.throttle) + //刹车 + invokeAutopilotBrake(vehicleState.brake) + //电量 + if (vehicleState.hasBmsSoc()) { + invokeBatteryManagementSystemStates( + ChassisStatesOuterClass.BMSSystemStates.newBuilder() + .setBmsSoc(vehicleState.bmsSoc).build() + ) + } + } + + fun invokeNewStates(chassisStates: ChassisStatesOuterClass.ChassisStates){ + //刹车灯数据 + chassisStates.bcmSystemStates?.let { bcmSystemStates -> + invokeAutopilotBrakeLightData(bcmSystemStates.brakeLightState != 0) + } + //方向盘转向角数据 + chassisStates.steerSystemStates?.let { + invokeAutopilotSteeringData(it.steeringWheelAngle) + } + //挂档档位数据 + chassisStates.gearSystemStates?.let { gearSystemStates -> + gearSystemStates.gearPosition?.let { + //挂档档位数据 + invokeAutopilotGearData(it) + } + } + //加速度 + chassisStates.vehicleMotionStates?.let { + //加速度 + invokeAutopilotAcc(it.acceleration) + } + //油门 + chassisStates.drivingSystemStates?.let { + invokeAutopilotThrottle(it.throttleResponsePosition) + } + //刹车 + chassisStates.brakeSystemStates?.let { + //刹车 + invokeAutopilotBrake(it.brakePedalResponsePosition) + } + //电量 + chassisStates.bmsSystemStates?.let { + //电量 + invokeBatteryManagementSystemStates(it) + } + } + + private var steering: Float? by Delegates.observable(0.0f) { _, oldValue, newValue -> + if (newValue == null) { + return@observable + } + if (oldValue == newValue) { + return@observable + } + M_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotSteeringData(newValue) + } + } + + /** + * 车辆转向灯数据回调 + * @param lightSwitch + */ + fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch) { + M_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotLightSwitchData(lightSwitch) + } + } + + /** + * 车辆刹车灯数据回调 + * @param brakeLight + */ + private fun invokeAutopilotBrakeLightData(brakeLight: Boolean) { + M_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotBrakeLightData(brakeLight) + } + } + + /** + * 车辆方向盘转向角回调 + * @param steering 方向盘转向角 + */ + private fun invokeAutopilotSteeringData(steering: Float) { + this.steering = steering + } + + /** + * 车辆挂档档位 + * @param gear 档位 + */ + fun invokeAutopilotGearData(gear: Chassis.GearPosition) { + M_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotGearData(gear) + } + } + + /** + * 车辆加速度 + * acc 加速度 + */ + private fun invokeAutopilotAcc(carAcc: Float) { + M_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotAcc(carAcc) + } + } + + /** + * throttle 油门 + */ + fun invokeAutopilotThrottle(throttle: Float) { + M_LISTENERS.forEach { + val listener = it.value + listener.onAutopilotThrottle(throttle) + } + } + + /** + * brake 刹车 + */ + fun invokeAutopilotBrake(brake: Float){ + M_LISTENERS.forEach{ + val listener = it.value + listener.onAutopilotBrake(brake) + } + } + + /** + * 电池管理系统 + */ + private fun invokeBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) { + M_LISTENERS.forEach { + val listener = it.value + listener.onBatteryManagementSystemStates(states) + } + } + + fun invokeStatesDataException(timestamp: Long) { + M_LISTENERS.forEach{ + val listener = it.value + listener.onAutopilotDataException(timestamp) + } + } +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisSteeringStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisSteeringStateListenerManager.kt deleted file mode 100644 index 108bd899ce..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisSteeringStateListenerManager.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.mogo.eagle.core.function.call.autopilot - -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener -import com.mogo.eagle.core.function.call.base.CallerBase -import kotlin.properties.Delegates - -/** - * 车辆方向盘转向角 回调监听 - */ -object CallerChassisSteeringStateListenerManager : CallerBase() { - - private var steering: Float? by Delegates.observable(0.0f) { _, oldValue, newValue -> - if (newValue == null) { - return@observable - } - if (oldValue == newValue) { - return@observable - } - M_LISTENERS.forEach { - val listener = it.value - listener.onAutopilotSteeringData(newValue) - } - } - - /** - * 车辆方向盘转向角回调 - * @param steering 方向盘转向角 - */ - fun invokeAutopilotSteeringData(steering: Float) { - this.steering = steering - } -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisThrottleStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisThrottleStateListenerManager.kt deleted file mode 100644 index 95e8db5eba..0000000000 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisThrottleStateListenerManager.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.mogo.eagle.core.function.call.autopilot - -import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener -import com.mogo.eagle.core.function.call.base.CallerBase - -/** - * throttle 油门 回调监听 - */ -object CallerChassisThrottleStateListenerManager : CallerBase() { - - /** - * throttle 油门 - */ - fun invokeAutopilotThrottle(throttle: Float) { - M_LISTENERS.forEach { - val listener = it.value - listener.onAutopilotThrottle(throttle) - } - } -} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/REEADME.md b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/REEADME.md index 313da68621..2216cb6f33 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/REEADME.md +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/REEADME.md @@ -37,16 +37,8 @@ CallerAutopilotPointCloudListenerManager CallerAutopilotRecordListenerManager CallerAutopilotStatisticsListenerManager CallerAutoPilotStatusListenerManager -CallerAutopilotVehicleStateListenerManager -CallerBatteryManagementSystemListenerManager -CallerChassisAccStateListenerManager -CallerChassisBrakeStateListenerManager -CallerChassisGearStateListenerManager -CallerChassisLamplightListenerManager CallerChassisLocationGCJ20ListenerManager CallerChassisLocationWGS84ListenerManager -CallerChassisSteeringStateListenerManager -CallerChassisThrottleStateListenerManager CallerPlanningActionsListenerManager CallerPlanningRottingListenerManager CallerPlanningTrajectoryListenerManager