[6.7.0][启自驾指引] 添加由于其它原因导致启不了自驾的逻辑判断
This commit is contained in:
@@ -22,6 +22,7 @@ import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.AcceleratorIm
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.BrakeImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.DoubleFlashImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.GearImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.OtherErrorImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.RouteDownloadImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.SpeedImpl
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.SteerImpl
|
||||
@@ -35,7 +36,6 @@ import com.zhjt.mogo_core_function_devatools.status.model.StatusModel
|
||||
import com.zhjt.mogo_core_function_devatools.status.ui.StatusView
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
import java.lang.ref.*
|
||||
import java.util.concurrent.*
|
||||
import java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy
|
||||
@@ -97,6 +97,7 @@ object StatusManager {
|
||||
is SpeedStatus -> SpeedImpl(ctx)
|
||||
is FSMStatus -> FSMImpl(ctx)
|
||||
is RouteDownloadStatus -> RouteDownloadImpl(ctx)
|
||||
is OtherErrorStatus -> OtherErrorImpl(ctx)
|
||||
}
|
||||
}.also { flows += it }
|
||||
for (f in flows) {
|
||||
@@ -215,6 +216,7 @@ object StatusManager {
|
||||
is GearStatus -> "档位"
|
||||
is RouteDownloadStatus -> if (item.state == RouteStart) "轨迹下载中" else "轨迹下载失败"
|
||||
is FSMStatus -> "FSM"
|
||||
is OtherErrorStatus -> "未知"
|
||||
else -> "其它"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zhjt.mogo_core_function_devatools.status.entity
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RouteState.RouteFailed
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RouteState.RouteNone
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.RouteState.RouteStart
|
||||
@@ -482,6 +484,20 @@ data class DoubleFlashStatus(val type: Int, var isError: Boolean = false): Statu
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 由于其它原因导致的启自驾异常
|
||||
*/
|
||||
data class OtherErrorStatus(val type: UnableType?, val reason: UnableLaunchReason?): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return type != null || reason != null
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "OtherErrorStatus(type: $type, reason: $reason)"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 挡位
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
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.call.autopilot.CallerAutopilotActionsListenerManager
|
||||
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.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_GEAR
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_HAZARD_LIGHTS
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_STEERING
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.OtherErrorStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
|
||||
internal class OtherErrorImpl(ctx: Context): IFlow<OtherErrorStatus>(ctx), IMoGoAutopilotActionsListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "OtherErrorImpl"
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
CallerAutopilotActionsListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
CallerAutopilotActionsListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
|
||||
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
|
||||
if (!isAutopilotAbility) {
|
||||
unableAutopilotReasons?.find { it.unableType !in listOf(CHASSIS_HAZARD_LIGHTS, CHASSIS_GEAR, CHASSIS_THROTTLE, CHASSIS_STEERING, CHASSIS_BRAKE) }?.also { itx ->
|
||||
send(OtherErrorStatus(itx.unableType, itx))
|
||||
}
|
||||
} else {
|
||||
send(OtherErrorStatus(null, null))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ internal class StatusModel : ViewModel() {
|
||||
it += BrakeStatus(0)
|
||||
it += DoubleFlashStatus(0)
|
||||
it += GearStatus(0)
|
||||
it += OtherErrorStatus(null, null)
|
||||
it += RouteDownloadStatus()
|
||||
it += SpeedStatus(0)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user