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 a9883ddcb3..25788e076c 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 @@ -31,7 +31,10 @@ internal class CanImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotVehic timeOutCheck() } - private fun isCanEnabled() = CallerAutoPilotManager.isConnected() && CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode() != "EHW_CAN" + private fun isCanEnabled(): Boolean { + val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode() + return CallerAutoPilotManager.isConnected() && code != "EHW_CAN" + } override fun onAutopilotBrakeLightData(brakeLight: Boolean) { diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt index 1e99a5fcec..5dde572dbd 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/rtk/RTKImpl.kt @@ -24,8 +24,16 @@ internal class RTKImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotCarSt CallerAutoPilotStatusListenerManager.addListener(TAG, this) } - private fun isRTKEnabled() = - CallerAutoPilotManager.isConnected() && (CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode() != "EHW_RTK" && CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode() != "EHW_GNSS") && CallerAutopilotCarStatusListenerManager.getCurrentGnssInfo() != null + private fun isRTKEnabled(): Boolean { + val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode() + val gnssInfo = CallerAutopilotCarStatusListenerManager.getCurrentGnssInfo() + return CallerAutoPilotManager.isConnected() && ( + code != "EHW_RTK" && + code != "EHW_GNSS" && + code != "ESYS_RTK_STATUS_FAULT" && + code != "ELCT_RTK_STATUS_FAULT" && + code != "ELCT_RTK_STATUS_UNKNOWN") && gnssInfo != null + } override fun onAutopilotCarStateData(gnssInfo: GnssInfo?) { send(RTKStatus(isRTKEnabled())) @@ -34,9 +42,7 @@ internal class RTKImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotCarSt override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) { super.onAutopilotIpcConnectStatusChanged(status, reason) - if (!CallerAutoPilotManager.isConnected()) { - send(RTKStatus(false)) - } + send(RTKStatus(isRTKEnabled())) } private fun timeOutCheck() { diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt index 34f7ad0caa..090160f922 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt @@ -167,11 +167,11 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ @Synchronized fun invokeAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) { -// M_AUTOPILOT_STATUS_LISTENERS.forEach { -// val listener = it.value -// autoPilotMessageCode = guardianInfo?.code ?: "" -// listener.onAutopilotGuardian(guardianInfo) -// } + M_AUTOPILOT_STATUS_LISTENERS.forEach { + val listener = it.value + autoPilotMessageCode = guardianInfo?.code ?: "" + listener.onAutopilotGuardian(guardianInfo) + } } /**