diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt index f886339bb0..b08efc0941 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt @@ -129,7 +129,7 @@ class MoGoAutopilotControlProvider : .setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING) .setPingAddressList(AdasManager.getInstance().pingAddressList) .setPassenger(false) - .setEnableCertification(SharedPrefsMgr.getInstance().getBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE)) + .setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE)) .setRootCrt(CallerCloudCertManager.getRootCrtF()) .setDeviceCrt(CallerCloudCertManager.getDeviceCrtF()) .setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear) @@ -260,7 +260,7 @@ class MoGoAutopilotControlProvider : .setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING) .setPingAddressList(AdasManager.getInstance().pingAddressList) .setPassenger(false)// 乘客端直连工控机改为false - .setEnableCertification(SharedPrefsMgr.getInstance().getBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE)) + .setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE)) .setRootCrt(CallerCloudCertManager.getRootCrtF()) .setDeviceCrt(CallerCloudCertManager.getDeviceCrtF()) .setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear) @@ -321,7 +321,7 @@ class MoGoAutopilotControlProvider : // 设置IP地址 val options = AdasOptions.newBuilder() .setPassenger(false) - .setEnableCertification(SharedPrefsMgr.getInstance().getBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE)) + .setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE)) .setRootCrt(CallerCloudCertManager.getRootCrtF()) .setDeviceCrt(CallerCloudCertManager.getDeviceCrtF()) .setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.SPECIFIED) diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt index c1bbbb09c0..9e41f5caa3 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasMsgConnectStatusListenerImpl.kt @@ -17,6 +17,7 @@ import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager @@ -59,13 +60,14 @@ class MoGoAdasMsgConnectStatusListenerImpl : private val isSentBasicInfoReq = AtomicBoolean(false)//是否已回复域控基础信息请求 @Volatile - private var certificationResult = "" + private var certificationResult = "未开启认证" init { CallerCloudListenerManager.addListener(TAG, this) CallerAutoPilotStatusListenerManager.addListener(TAG, this) CallerAutopilotActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) CallerParallelDrivingActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) + CallerAutopilotCarConfigListenerManager.invokeAutopilotCertFileResult(certificationResult) } private fun connectToast(reason: String) { @@ -249,7 +251,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : */ override fun onCertification(status: AdasConstants.CertificationStatus) { if (status == AdasConstants.CertificationStatus.TIMEOUT) { - certificationResult = ":认证超时"; + certificationResult = ":证书认证超时" CallerLogger.d( "$M_D_C$TAG", "域控证书认证超时(表示域控未发送BasicInfoReq接口的数据【这种情况可能是连接出现了问题】)" @@ -257,24 +259,25 @@ class MoGoAdasMsgConnectStatusListenerImpl : } else { if (status != AdasConstants.CertificationStatus.NOT_ENABLED) { if (status == AdasConstants.CertificationStatus.CERTIFICATE_CHAIN_SUCCESS) { + certificationResult = ":成功校验域控证书" CallerLogger.d( "$M_D_C$TAG", - "域控证书链校验成功" + "成功校验域控证书" ) } else if (status == AdasConstants.CertificationStatus.ROOT_CRT_ERROR) { - certificationResult = ":ROOT证书异常"; + certificationResult = ":获取ROOT证书异常" CallerLogger.d( "$M_D_C$TAG", "ROOT证书异常(表示未传递证书,没有拿到ROOT证书)" ) } else if (status == AdasConstants.CertificationStatus.IPC_CRT_ERROR) { - certificationResult = ":域控证书异常"; + certificationResult = ":获取域控证书异常" CallerLogger.d( "$M_D_C$TAG", "域控证书异常(表示域控发送了BasicInfoReq接口的数据但是未传递证书或证书解码失败【失败的可能性很低】)" ) } else if (status == AdasConstants.CertificationStatus.CERTIFICATE_CHAIN_FAILED) { - certificationResult = ":证书链校验失败"; + certificationResult = ":域控证书校验失败" CallerLogger.d( "$M_D_C$TAG", "域控证书链校验失败(表示证书链未验证通过。证书不匹配、证书格式不正确)" @@ -282,6 +285,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : } } } + CallerAutopilotCarConfigListenerManager.invokeAutopilotCertFileResult(certificationResult) } private fun saveIntoMsgBox( @@ -341,7 +345,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : * 工控机获取SN */ override fun onAutopilotSNRequest(basicInfoReq: MessagePad.BasicInfoReq) { - CallerLogger.d("$M_D_C$TAG", "收到域控基础信息请求"); + CallerLogger.d("$M_D_C$TAG", "收到域控基础信息请求") isReceivedBasicInfoReq.set(true) if (!TextUtils.isEmpty(SharedPrefsMgr.getInstance().sn)) { syncBasicInfoToAutopilot() @@ -396,7 +400,7 @@ class MoGoAdasMsgConnectStatusListenerImpl : } override fun tokenGot(token: String, sn: String) { - CallerLogger.d("$M_D_C$TAG", "SN获取成功=$sn"); + CallerLogger.d("$M_D_C$TAG", "SN获取成功=$sn") if (isReceivedBasicInfoReq.get() && !isSentBasicInfoReq.get()) {//已收到域控基础信息请求,但是之前SN没有所以还未回复,现在获取到SN后再进行回复 syncBasicInfoToAutopilot() } 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 3508e7fc2f..2faadac60d 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 @@ -8,13 +8,20 @@ import android.content.IntentFilter import android.location.LocationManager import android.util.Log import androidx.core.location.LocationManagerCompat +import com.mogo.commons.debug.DebugConfig import com.mogo.commons.module.status.IMogoStatusChangedListener import com.mogo.commons.module.status.MogoStatusManager import com.mogo.commons.module.status.StatusDescriptor +import com.mogo.commons.storage.SharedPrefsMgr +import com.mogo.eagle.core.data.constants.MoGoConfig +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener 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 +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager +import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager import com.mogo.eagle.core.utilcode.util.AppStateManager @@ -30,7 +37,8 @@ import java.util.concurrent.atomic.AtomicBoolean internal class OverViewImpl(ctx: Context) : IFlow(ctx), IMoGoDevaToolsListener, IMoGoAutopilotStatusListener, - IConnectStatusListener, IMogoStatusChangedListener { + IConnectStatusListener, IMogoStatusChangedListener, IMoGoAutopilotCarConfigListener, + IMoGoCloudListener { companion object { const val TAG = "OverViewImpl" @@ -56,6 +64,9 @@ internal class OverViewImpl(ctx: Context) : IFlow(ctx), @Volatile private var isAutopilotException = false + @Volatile + private var isAuthCrtException = false + @Volatile private var isFirst = true @@ -125,6 +136,8 @@ internal class OverViewImpl(ctx: Context) : IFlow(ctx), MogoStatusManager.getInstance() .registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this) CallerAutoPilotStatusListenerManager.addListener(TAG, this) + CallerAutopilotCarConfigListenerManager.addListener(TAG, this) + CallerCloudListenerManager.addListener(TAG, this) val isGranted = checkIsGpsException() if (!isGranted) { @@ -268,11 +281,41 @@ internal class OverViewImpl(ctx: Context) : IFlow(ctx), } private fun checkIfNotException() { - if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException && !isAutopilotException) { + if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException && !isAutopilotException && !isAuthCrtException) { send(OverViewStatus(false)) } } + override fun authCrtFile(device: String, root: String) { + super.authCrtFile(device, root) + isAuthCrtException = false + checkIfNotException() + } + + override fun authCrtError(errorMsg: String) { + super.authCrtError(errorMsg) + isAuthCrtException = true + send(OverViewStatus(true)) + } + + override fun onCertificationResult(msg: String) { + super.onCertificationResult(msg) + if (!SharedPrefsMgr.getInstance().getBoolean( + "${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", + MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE + ) + ) { + return + } + if(msg.contains("成功校验")){ + isAuthCrtException = false + checkIfNotException() + }else{ + isAuthCrtException = true + send(OverViewStatus(true)) + } + } + override fun onDestroy() { super.onDestroy() // CallerDevaToolsListenerManager.removeListener(TAG) @@ -280,6 +323,9 @@ internal class OverViewImpl(ctx: Context) : IFlow(ctx), MogoStatusManager.getInstance() .unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this) CallerAutoPilotStatusListenerManager.removeListener(TAG) + CallerAutopilotCarConfigListenerManager.removeListener(TAG) + CallerCloudListenerManager.removeListener(TAG) + try { if (registered.compareAndSet(true, false) && receiver != null) { ctx.unregisterReceiver(receiver) diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusSummaryView.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusSummaryView.kt deleted file mode 100644 index 1845640015..0000000000 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/ui/StatusSummaryView.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.zhjt.mogo_core_function_devatools.status.ui - -import android.content.Context -import android.util.AttributeSet -import android.view.LayoutInflater -import android.widget.FrameLayout -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener -import com.zhjt.mogo_core_function_devatools.R - -/** - * 状态汇总View控件 - */ -class StatusSummaryView@JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : FrameLayout( - context, - attrs, - defStyleAttr -), IMoGoAutopilotStatusListener { - companion object{ - private const val TAG = "SummaryStatusView" - } - - init { - LayoutInflater.from(context).inflate(R.layout.view_initiative_bad_case, this, true) - initView() - } - - private fun initView() { - - } -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 9556510904..aa86877049 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -12,7 +12,6 @@ import android.os.Build import android.os.Process import android.text.Html import android.util.AttributeSet -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -89,6 +88,7 @@ import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.kotlin.scope import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant @@ -204,7 +204,8 @@ internal class DebugSettingView @JvmOverloads constructor( // 高精地图是否已缓存 private var isHDCached = false - private var isClickCheckedCbSsl = false//是否已经点击且选中证书认证按钮 + //是否已经点击且选中证书认证按钮 + private var isCertCheck = false private var isFirstDownLoadCertHint = false init { @@ -1293,14 +1294,13 @@ internal class DebugSettingView @JvmOverloads constructor( } } //是否启用证书认证 - cbSsl.isChecked = - SharedPrefsMgr.getInstance().getBoolean( - MoGoConfig.AUTOPILOT_CERTIFICATION, - MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE - ) + val check = SharedPrefsMgr.getInstance().getBoolean( + "${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", + MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE + ) + isCertCheck = check + cbSsl.isChecked = check cbSsl.setOnCheckedChangeListener { _, isChecked -> - isClickCheckedCbSsl = isChecked -// 下载证书 if (isChecked) { if (CallerCloudCertManager.getRootCrtF().isNullOrEmpty()) { if (!isFirstDownLoadCertHint) { @@ -1308,25 +1308,31 @@ internal class DebugSettingView @JvmOverloads constructor( ToastUtils.showShort("证书文件不存在,正在下载") } cbSsl.isChecked = false + //下载证书 CallerCloudCertManager.certFileDownLoad { errorMsg -> ThreadUtils.runOnUiThread { + isCertCheck = false ToastUtils.showShort(errorMsg) } } + }else{ + isCertCheck = true } + }else{ + isCertCheck = false } SharedPrefsMgr.getInstance() - .putBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, cbSsl.isChecked) + .putBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", cbSsl.isChecked) } } override fun authCrtFile(device: String, root: String) { super.authCrtFile(device, root) ThreadUtils.runOnUiThread { - if (isClickCheckedCbSsl) { + if (isCertCheck) { cbSsl.isChecked = true SharedPrefsMgr.getInstance() - .putBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION, true) + .putBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", true) } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { tvCertFile.text = Html.fromHtml( @@ -2504,6 +2510,6 @@ internal class DebugSettingView @JvmOverloads constructor( paramIndexes = [0] ) private fun invokeCronetResult(json: String) { - Log.d("CronetNetwork", json) + CallerLogger.d(SceneConstant.M_HMI + "CronetNetwork", json) } } \ No newline at end of file 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 e1109c28b6..15f0de63a3 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 @@ -48,6 +48,9 @@ class StatusSummaryAdapter(private val ctx: Context, var data: ArrayList { ivFuncView.setImageResource(R.drawable.controller) } + 5 -> { + ivFuncView.setImageResource(R.drawable.ssl_check) + } } 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 165f28ed20..4faa82f169 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 @@ -2,19 +2,26 @@ package com.mogo.eagle.core.function.hmi.ui.setting 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 import androidx.recyclerview.widget.RecyclerView +import com.mogo.commons.debug.DebugConfig import com.mogo.commons.module.status.IMogoStatusChangedListener import com.mogo.commons.module.status.MogoStatusManager import com.mogo.commons.module.status.StatusDescriptor +import com.mogo.commons.storage.SharedPrefsMgr +import com.mogo.eagle.core.data.constants.MoGoConfig import com.mogo.eagle.core.data.status.StatusSummaryEntity +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener 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 +import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager +import com.mogo.eagle.core.function.call.cloud.CallerCloudCertManager +import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager import com.mogo.eagle.core.function.hmi.R @@ -26,7 +33,7 @@ import com.zhjt.mogo.adas.data.AdasConstants /** * 状态汇总View控件 */ -class StatusSummaryView@JvmOverloads constructor( +class StatusSummaryView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 @@ -35,8 +42,9 @@ class StatusSummaryView@JvmOverloads constructor( attrs, defStyleAttr ), IConnectStatusListener, IMogoStatusChangedListener, - IMoGoDevaToolsListener, IMoGoAutopilotStatusListener { - companion object{ + IMoGoDevaToolsListener, IMoGoAutopilotStatusListener, IMoGoAutopilotCarConfigListener, + IMoGoCloudListener { + companion object { private const val TAG = "SummaryStatusView" } @@ -50,6 +58,13 @@ class StatusSummaryView@JvmOverloads constructor( it.add(StatusSummaryEntity(2)) it.add(StatusSummaryEntity(3)) it.add(StatusSummaryEntity(4, "域控未连接", true)) + it.add( + StatusSummaryEntity( + 5, + CallerAutopilotCarConfigListenerManager.getCertFileResult(), + CallerCloudCertManager.getRootCrtF().isNullOrEmpty() + ) + ) } } @@ -67,6 +82,8 @@ class StatusSummaryView@JvmOverloads constructor( MogoStatusManager.getInstance() .registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this) CallerAutoPilotStatusListenerManager.addListener(TAG, this) + CallerAutopilotCarConfigListenerManager.addListener(TAG, this) + CallerCloudListenerManager.addListener(TAG, this) } private fun initView() { @@ -81,9 +98,10 @@ class StatusSummaryView@JvmOverloads constructor( it.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) it.addItemDecoration( CommonDividerItemDecoration.Builder() - .spanCountTBCare(false) - .horizontalInnerSpace(10.PX) - .build()) + .spanCountTBCare(false) + .horizontalInnerSpace(10.PX) + .build() + ) StatusSummaryAdapter(context, data).apply { adapter = this it.adapter = this @@ -108,6 +126,8 @@ class StatusSummaryView@JvmOverloads constructor( MogoStatusManager.getInstance() .unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this) CallerAutoPilotStatusListenerManager.removeListener(TAG) + CallerAutopilotCarConfigListenerManager.removeListener(TAG) + CallerCloudListenerManager.removeListener(TAG) } /** @@ -168,30 +188,39 @@ class StatusSummaryView@JvmOverloads constructor( 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) } @@ -203,4 +232,41 @@ class StatusSummaryView@JvmOverloads constructor( adapter?.notifyItemChanged(4) } } + + override fun authCrtFile(device: String, root: String) { + super.authCrtFile(device, root) + UiThreadHandler.post { + if (data.size < 6) return@post + data[5].desc = "本机证书已下载" + data[5].isException = false + adapter?.notifyItemChanged(5) + } + } + + override fun authCrtError(errorMsg: String) { + super.authCrtError(errorMsg) + UiThreadHandler.post { + if (data.size < 6) return@post + data[5].desc = "本机证书下载异常:$errorMsg" + data[5].isException = true + adapter?.notifyItemChanged(5) + } + } + + override fun onCertificationResult(msg: String) { + super.onCertificationResult(msg) + if (!SharedPrefsMgr.getInstance().getBoolean( + "${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", + MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE + ) + ) { + return + } + UiThreadHandler.post { + if (data.size < 6) return@post + data[5].desc = msg + data[5].isException = !msg.contains("成功校验") + adapter?.notifyItemChanged(5) + } + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/ssl_check.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/ssl_check.png new file mode 100644 index 0000000000..1fe5c0f1a8 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/ssl_check.png differ diff --git a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/CertFileManager.kt b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/CertFileManager.kt index ba45d0cbb9..80d6ae8b08 100644 --- a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/CertFileManager.kt +++ b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/CertFileManager.kt @@ -30,6 +30,9 @@ class CertFileManager : IMoGoCertProvider { @Volatile private var rootCrtFile: String? = null + @Volatile + private var crtFileErrorMsg: String? = null + companion object { private const val TAG = "CertFileManager" } @@ -72,6 +75,7 @@ class CertFileManager : IMoGoCertProvider { "onSuccess securityKey:$securityKey , thread:${Thread.currentThread().name}" ) certStatus.set(false) + crtFileErrorMsg = null deviceCrtFile = securityKey rootCrtFile = rootKey SharedPrefsMgr.getInstance().putString(securityKeyTAG, securityKey) @@ -92,6 +96,8 @@ class CertFileManager : IMoGoCertProvider { override fun onFailed(errorCode: Int, errorMsg: String) { CallerLogger.d("${SceneConstant.M_D_C}$TAG", "onFailed code:$errorCode, msg:$errorMsg") certStatus.set(false) + crtFileErrorMsg = "$errorCode - $errorMsg" + CallerCloudListenerManager.invokeCloudCrtError(errorMsg) onError?.invoke("证书下载失败, code:$errorCode, msg:$errorMsg") } }) @@ -112,4 +118,8 @@ class CertFileManager : IMoGoCertProvider { override fun getRootCrtF(): String? { return rootCrtFile?:SharedPrefsMgr.getInstance().getString(securityRootTAG, null) } + + override fun getCrtFileErrorMsg(): String? { + return crtFileErrorMsg + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java index 911c040915..0f3a399505 100644 --- a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java +++ b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/secret/PassPortSecret.java @@ -32,10 +32,9 @@ public class PassPortSecret { private IPassportSecret secretCB; public void init(String deviceId, String path, IPassportSecret secretCB) { - if (this.secretCB != null) { - return; + if (this.secretCB == null) { + this.secretCB = secretCB; } - this.secretCB = secretCB; PassportService passportService = new PassportService(); passportService.setEnableLog(DebugConfig.isDebug()); domain.R r = initLow(passportService, deviceId, path); diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarConfigListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarConfigListener.kt index 255cd1c59f..f51ad9a1ea 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarConfigListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotCarConfigListener.kt @@ -12,6 +12,11 @@ interface IMoGoAutopilotCarConfigListener { * * @param carConfigResp 包括docker版本,macAddress等基础信息,详见proto */ - fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) + fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp){} + + /** + * 与工控证书验证结果 + */ + fun onCertificationResult(msg: String){} } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCertProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCertProvider.kt index fbd266d3df..3a00812113 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCertProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCertProvider.kt @@ -8,4 +8,6 @@ interface IMoGoCertProvider:IProvider { fun getDeviceCrtF():String? fun getRootCrtF(): String? + + fun getCrtFileErrorMsg(): String? } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCloudListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCloudListener.kt index d82f858588..41dca782c4 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCloudListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/cloud/IMoGoCloudListener.kt @@ -6,6 +6,11 @@ interface IMoGoCloudListener{ //单独线程 fun authCrtFile(device:String, root:String){} + /** + * 下载证书文件异常 + */ + fun authCrtError(errorMsg: String){} + fun tokenGot(token: String, sn: String){} /** diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt index 950f9bb2fe..dbf75c5c27 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarConfigListenerManager.kt @@ -11,11 +11,16 @@ object CallerAutopilotCarConfigListenerManager : CallerBase() { if (!token.isNullOrEmpty() && !sn.isNullOrEmpty()) { listener.tokenGot(token!!, sn!!) } + if(CallerCloudCertManager.getDeviceCrtF()!= null && CallerCloudCertManager.getRootCrtF()!= null){ + listener.authCrtFile(CallerCloudCertManager.getDeviceCrtF()!!, CallerCloudCertManager.getRootCrtF()!!) + } + if(CallerCloudCertManager.getCrtFileErrorMsg()!= null){ + listener.authCrtError(CallerCloudCertManager.getCrtFileErrorMsg()!!) + } } fun invokeCloudCrtFile(deviceCrtFile: String, rootCrtFile: String) { @@ -26,6 +32,13 @@ object CallerCloudListenerManager : CallerBase() { } } + fun invokeCloudCrtError(errorMsg: String){ + M_LISTENERS.forEach { + val listener = it.value + listener.authCrtError(errorMsg) + } + } + /** * 分发获取到的设备sn */