From 799c2c1da74238aed84f45a4e2d121ff11764617 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Thu, 29 Feb 2024 15:39:32 +0800 Subject: [PATCH] =?UTF-8?q?[6.3.0][Feat]=E5=B7=A5=E6=8E=A7=E6=9C=BA?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=8A=B6=E6=80=81=E5=8A=A0=E5=85=A5=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E6=89=A9=E5=B1=95=E6=A0=8F=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../status/flow/OverViewImpl.kt | 26 +++++++-- .../hmi/ui/setting/StatusSummaryAdapter.kt | 3 + .../hmi/ui/setting/StatusSummaryView.kt | 54 +++++++++++++++++- .../main/res/drawable-xhdpi/controller.png | Bin 0 -> 349 bytes .../CallerAutoPilotStatusListenerManager.kt | 6 ++ 5 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/controller.png diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/OverViewImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/OverViewImpl.kt index 2d2326d988..3508e7fc2f 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/OverViewImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/OverViewImpl.kt @@ -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(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(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(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(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) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/StatusSummaryAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/StatusSummaryAdapter.kt index f610f0dddb..e1109c28b6 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/StatusSummaryAdapter.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/StatusSummaryAdapter.kt @@ -45,6 +45,9 @@ class StatusSummaryAdapter(private val ctx: Context, var data: ArrayList { ivFuncView.setImageResource(R.drawable.tracing) } + 4 -> { + ivFuncView.setImageResource(R.drawable.controller) + } } if (entity.isException) { tvStatusDesc.setTextColor(Color.parseColor("#FF4444")) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/StatusSummaryView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/StatusSummaryView.kt index 8b349668fe..165f28ed20 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/StatusSummaryView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/StatusSummaryView.kt @@ -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? = 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) + } + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/controller.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/controller.png new file mode 100644 index 0000000000000000000000000000000000000000..b65015decdcd92bf955736cc5a20faca00057a0f GIT binary patch literal 349 zcmV-j0iyniP)s03hr?Q`1Nd#YPwPud42S#mSR`{1SNa4|#8l!h}sTA`=P#_6Z#rE?|CB z=M>U9704Y}tXQUkX$SjbD9>L}eHH>J>XX@&6c~Zekx`jIE~JP1CIzQ}V@$v24RCHT zrFgPmTPAqN*qAV$3AJni`Sznlv(rtYK2T8UX^Z{(q6JpUQdlp}FpgTZNN&VGc#C0^ zO>FYI1%4GgiOJdDeh+L`lNOd#KhL~H7q(@->L6RpYhs~t^>0pEDCp2#w1{^-!donj v@c|r9>$&%AK;oA!lmHUbdY@L|#oyx-D5XODLGS#j00000NkvXXu0mjfa4nDf literal 0 HcmV?d00001 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 2177c60424..aa8ecc24aa 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 @@ -62,11 +62,16 @@ object CallerAutoPilotStatusListenerManager : CallerBase