diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt index 84dd5fd0ef..36103cc248 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/StatusManager.kt @@ -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 -> "其它" } } diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt index db44dd75e7..a64e0b0495 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/entity/Status.kt @@ -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)" + } +} + /** * 挡位 */ diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/OtherErrorImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/OtherErrorImpl.kt new file mode 100644 index 0000000000..44092970dd --- /dev/null +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/OtherErrorImpl.kt @@ -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(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?) { + 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)) + } + } +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt index f53e53fc51..b7ceb9a117 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/model/StatusModel.kt @@ -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) }) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt index 28e7280bca..1277beb885 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt @@ -124,12 +124,16 @@ object CallerAutoPilotControlManager { if ((exceptionValue and (1 shl 5)) != 0) { sb.append("档位$") } - if ((exceptionValue and (1 shl 6)) != 0 || ((exceptionValue and (1 shl 7)) != 0)) { + if ((exceptionValue and (1 shl 6)) != 0) { + sb.append("未知$") + } + if ((exceptionValue and (1 shl 7)) != 0 || ((exceptionValue and (1 shl 8)) != 0)) { if (!sb.contains("$")) { sb.setLength(0) sb.append("轨迹未就绪,请稍后重试") } } + val voiceText = sb.toString().let { str -> val count = str.count { it == '$' } if (count == 1) {