From 62bf194ec060008ee753c2eeacd61d1448908439 Mon Sep 17 00:00:00 2001 From: renwj Date: Mon, 21 Oct 2024 19:58:50 +0800 Subject: [PATCH] =?UTF-8?q?[6.7.0][=E5=90=AF=E8=87=AA=E9=A9=BE=E6=8C=87?= =?UTF-8?q?=E5=BC=95]=20=E6=B7=BB=E5=8A=A0=E7=94=B1=E4=BA=8E=E5=85=B6?= =?UTF-8?q?=E5=AE=83=E5=8E=9F=E5=9B=A0=E5=AF=BC=E8=87=B4=E5=90=AF=E4=B8=8D?= =?UTF-8?q?=E4=BA=86=E8=87=AA=E9=A9=BE=E7=9A=84=E9=80=BB=E8=BE=91=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../status/StatusManager.kt | 4 +- .../status/entity/Status.kt | 16 ++++++++ .../status/flow/autopilot/OtherErrorImpl.kt | 41 +++++++++++++++++++ .../status/model/StatusModel.kt | 1 + .../CallerAutoPilotControlManager.kt | 6 ++- 5 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/autopilot/OtherErrorImpl.kt 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) {