[6.6.0] union the chassis state in one caller
This commit is contained in:
@@ -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<AcceleratorStatus>(ctx), IMoGoChassisThrottleStateListener, IMoGoAutopilotActionsListener {
|
||||
internal class AcceleratorImpl(ctx: Context): IFlow<AcceleratorStatus>(ctx),
|
||||
IMoGoChassisStatesListener, IMoGoAutopilotActionsListener {
|
||||
|
||||
|
||||
companion object {
|
||||
@@ -28,13 +29,13 @@ internal class AcceleratorImpl(ctx: Context): IFlow<AcceleratorStatus>(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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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<BrakeStatus>(ctx), IMoGoChassisBrakeStateListener, IMoGoAutopilotActionsListener {
|
||||
internal class BrakeImpl(ctx: Context): IFlow<BrakeStatus>(ctx), IMoGoChassisStatesListener, IMoGoAutopilotActionsListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "BrakeImpl"
|
||||
@@ -27,13 +27,13 @@ internal class BrakeImpl(ctx: Context): IFlow<BrakeStatus>(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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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<DoubleFlashStatus>(ctx), IMoGoChassisLamplightListener, IMoGoAutopilotActionsListener {
|
||||
internal class DoubleFlashImpl(ctx: Context): IFlow<DoubleFlashStatus>(ctx),
|
||||
IMoGoChassisStatesListener, IMoGoAutopilotActionsListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "DoubleFlashImpl"
|
||||
@@ -30,19 +32,19 @@ internal class DoubleFlashImpl(ctx: Context): IFlow<DoubleFlashStatus>(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) {
|
||||
|
||||
@@ -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<GearStatus>(ctx), IMoGoChassisGearStateListener, IMoGoAutopilotActionsListener {
|
||||
internal class GearImpl(ctx: Context): IFlow<GearStatus>(ctx), IMoGoAutopilotActionsListener,
|
||||
IMoGoChassisStatesListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "GeerImpl"
|
||||
@@ -29,13 +30,13 @@ internal class GearImpl(ctx: Context): IFlow<GearStatus>(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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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<SteerStatus>(ctx), IMoGoChassisSteeringStateListener, IMoGoAutopilotActionsListener {
|
||||
internal class SteerImpl(ctx: Context): IFlow<SteerStatus>(ctx), IMoGoChassisStatesListener, IMoGoAutopilotActionsListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SteerImpl"
|
||||
@@ -28,13 +28,13 @@ internal class SteerImpl(ctx: Context): IFlow<SteerStatus>(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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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<CanStatus>(ctx),
|
||||
|
||||
IMoGoAutopilotVehicleStateListener,
|
||||
|
||||
IMoGoChassisAccStateListener,
|
||||
IMoGoChassisSteeringStateListener,
|
||||
IMoGoChassisGearStateListener,
|
||||
IMoGoChassisBrakeStateListener,
|
||||
IMoGoChassisThrottleStateListener,
|
||||
|
||||
IMoGoAutopilotStatusListener,
|
||||
IMoGoChassisLamplightListener,
|
||||
IMoGoSweeperFutianCleanSystemListener {
|
||||
IFlow<CanStatus>(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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user