[6.3.0][Feat]工控机连接状态加入预警扩展栏中

This commit is contained in:
chenfufeng
2024-02-29 15:39:32 +08:00
parent 2702cbc173
commit 799c2c1da7
5 changed files with 83 additions and 6 deletions

View File

@@ -21,6 +21,7 @@ import com.mogo.eagle.core.utilcode.util.AppStateManager
import com.mogo.eagle.core.utilcode.util.IAppStateListener
import com.mogo.eagle.core.utilcode.util.PermissionUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.mogo.adas.data.AdasConstants
import com.zhjt.mogo_core_function_devatools.status.entity.OverViewStatus
import com.zhjt.mogo_core_function_devatools.status.entity.TracingStatus
import com.zhjt.mogo_core_function_devatools.status.entity.toState
@@ -52,6 +53,9 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
@Volatile
private var isTracingException = false
@Volatile
private var isAutopilotException = false
@Volatile
private var isFirst = true
@@ -151,7 +155,6 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
ctx.registerReceiver(CheckLocationReceiver(onClose, onOpen).also { receiver = it }, IntentFilter().also { it.addAction(LocationManager.MODE_CHANGED_ACTION) })
}
// // 工控机连接状态外层状态栏已显示,先隐藏
// CallerAutoPilotStatusListenerManager.addListener(TAG, this)
}
private fun checkIsGpsException(): Boolean {
@@ -247,8 +250,25 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
}
}
override fun onAutopilotIpcConnectStatusChanged(
status: AdasConstants.IpcConnectionStatus,
reason: String?
) {
super.onAutopilotIpcConnectStatusChanged(status, reason)
when (status) {
AdasConstants.IpcConnectionStatus.CONNECTED -> {
isAutopilotException = false
checkIfNotException()
}
else -> {
isAutopilotException = true
send(OverViewStatus(true))
}
}
}
private fun checkIfNotException() {
if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException) {
if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException && !isAutopilotException) {
send(OverViewStatus(false))
}
}
@@ -260,8 +280,6 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
MogoStatusManager.getInstance()
.unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
// CallerAutoPilotStatusListenerManager.removeListener(TAG)
try {
if (registered.compareAndSet(true, false) && receiver != null) {
ctx.unregisterReceiver(receiver)