[6.3.0][Feat]工控机连接状态加入预警扩展栏中
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -45,6 +45,9 @@ class StatusSummaryAdapter(private val ctx: Context, var data: ArrayList<StatusS
|
||||
3 -> {
|
||||
ivFuncView.setImageResource(R.drawable.tracing)
|
||||
}
|
||||
4 -> {
|
||||
ivFuncView.setImageResource(R.drawable.controller)
|
||||
}
|
||||
}
|
||||
if (entity.isException) {
|
||||
tvStatusDesc.setTextColor(Color.parseColor("#FF4444"))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.setting
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@@ -11,6 +11,7 @@ import com.mogo.commons.module.status.IMogoStatusChangedListener
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.commons.module.status.StatusDescriptor
|
||||
import com.mogo.eagle.core.data.status.StatusSummaryEntity
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
|
||||
import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
@@ -20,6 +21,7 @@ import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.kotlin.PX
|
||||
import com.mogo.eagle.core.utilcode.rv.divider.CommonDividerItemDecoration
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
|
||||
/**
|
||||
* 状态汇总View控件
|
||||
@@ -33,7 +35,7 @@ class StatusSummaryView@JvmOverloads constructor(
|
||||
attrs,
|
||||
defStyleAttr
|
||||
), IConnectStatusListener, IMogoStatusChangedListener,
|
||||
IMoGoDevaToolsListener {
|
||||
IMoGoDevaToolsListener, IMoGoAutopilotStatusListener {
|
||||
companion object{
|
||||
private const val TAG = "SummaryStatusView"
|
||||
}
|
||||
@@ -47,6 +49,7 @@ class StatusSummaryView@JvmOverloads constructor(
|
||||
it.add(StatusSummaryEntity(1))
|
||||
it.add(StatusSummaryEntity(2))
|
||||
it.add(StatusSummaryEntity(3))
|
||||
it.add(StatusSummaryEntity(4, "域控未连接", true))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +66,7 @@ class StatusSummaryView@JvmOverloads constructor(
|
||||
// 云socket连接状态
|
||||
MogoStatusManager.getInstance()
|
||||
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
@@ -153,4 +157,50 @@ class StatusSummaryView@JvmOverloads constructor(
|
||||
adapter?.notifyItemChanged(3)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun onAutopilotIpcConnectStatusChanged(
|
||||
status: AdasConstants.IpcConnectionStatus,
|
||||
reason: String?
|
||||
) {
|
||||
super.onAutopilotIpcConnectStatusChanged(status, reason)
|
||||
var pair: Pair<String, Boolean>? = null
|
||||
when (status) {
|
||||
AdasConstants.IpcConnectionStatus.DISCONNECTED -> {
|
||||
pair = Pair("域控未连接", true)
|
||||
}
|
||||
AdasConstants.IpcConnectionStatus.CONNECTED -> {
|
||||
pair = Pair("域控已连接", false)
|
||||
}
|
||||
AdasConstants.IpcConnectionStatus.CONNECTING -> {
|
||||
pair = Pair("域控连接中", true)
|
||||
}
|
||||
AdasConstants.IpcConnectionStatus.RECONNECTING_TIMER, AdasConstants.IpcConnectionStatus.RECONNECTING_NETWORK -> {
|
||||
pair = Pair("域控重连中", true)
|
||||
}
|
||||
AdasConstants.IpcConnectionStatus.CONNECT_EXCEPTION -> {
|
||||
pair = Pair("域控连接异常", true)
|
||||
}
|
||||
AdasConstants.IpcConnectionStatus.ILLEGAL_ADDRESS -> {
|
||||
pair = Pair("非法域控地址", true)
|
||||
}
|
||||
AdasConstants.IpcConnectionStatus.SEARCH_ADDRESS -> {
|
||||
pair = Pair("正在搜索域控地址", true)
|
||||
}
|
||||
AdasConstants.IpcConnectionStatus.NOT_FOUND_ADDRESS -> {
|
||||
pair = Pair("找不到可用的域控地址", true)
|
||||
}
|
||||
AdasConstants.IpcConnectionStatus.HEARTBEAT_TIMEOUT -> {
|
||||
pair = Pair("域控心跳超时", true)
|
||||
}
|
||||
AdasConstants.IpcConnectionStatus.SERVER_DISCONNECTED -> {
|
||||
pair = Pair("域控主动断开连接", true)
|
||||
}
|
||||
}
|
||||
UiThreadHandler.post {
|
||||
if (data.size < 5 || pair == null) return@post
|
||||
data[4].desc = pair.first
|
||||
data[4].isException = pair.second
|
||||
adapter?.notifyItemChanged(4)
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 349 B |
Reference in New Issue
Block a user