[6.7.0][FSM] feat:完善 FSM 相关状态逻辑;

This commit is contained in:
aibingbing
2024-09-12 19:12:54 +08:00
parent b40b74dbf4
commit 9c3ebad6cc

View File

@@ -1,57 +0,0 @@
package com.mogo.eagle.core.function.hmi.ui.bone.status
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.zhjt.mogo_core_function_devatools.status.StatusManager
import com.zhjt.mogo_core_function_devatools.status.entity.IAutopilotPreLaunchStatus
import com.zhjt.mogo_core_function_devatools.status.entity.Status
import com.zhjt.mogo_core_function_devatools.status.ui.AutoPilotLaunchBeforeView
class StartAutoPilotStatusView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) , StatusManager.IStatusListener {
companion object {
private const val TAG = "StartAutoPilotStatusView"
}
init {
LayoutInflater.from(context).inflate(R.layout.view_start_autopilot_status, this, true)
initView()
}
private fun initView() {
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
StatusManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
StatusManager.removeListener(TAG)
}
/**
* @param changed: 变化的数据
* @param all: 所有状态数据
*/
override fun onStatusChanged(changed: List<Status>, all: List<Status>) {
changed.filter { it is IAutopilotPreLaunchStatus }.forEach { status ->
val isError = status.isException() && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
CallerLogger.d(TAG, "--- onChanged ---:$isError")
}
}
}