[6.4.0] add func of auth cert show

This commit is contained in:
EmArrow
2024-04-08 16:30:05 +08:00
parent afd44e9da7
commit 4e35d90a57
16 changed files with 217 additions and 71 deletions

View File

@@ -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)

View File

@@ -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()
}

View File

@@ -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<OverViewStatus>(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<OverViewStatus>(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<OverViewStatus>(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<OverViewStatus>(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<OverViewStatus>(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)

View File

@@ -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() {
}
}

View File

@@ -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)
}
}

View File

@@ -48,6 +48,9 @@ class StatusSummaryAdapter(private val ctx: Context, var data: ArrayList<StatusS
4 -> {
ivFuncView.setImageResource(R.drawable.controller)
}
5 -> {
ivFuncView.setImageResource(R.drawable.ssl_check)
}
}
if (entity.isException) {
tvStatusDesc.setTextColor(Color.parseColor("#FF4444"))

View File

@@ -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)
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

View File

@@ -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
}
}

View File

@@ -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<Passport> r = initLow(passportService, deviceId, path);

View File

@@ -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){}
}

View File

@@ -8,4 +8,6 @@ interface IMoGoCertProvider:IProvider {
fun getDeviceCrtF():String?
fun getRootCrtF(): String?
fun getCrtFileErrorMsg(): String?
}

View File

@@ -6,6 +6,11 @@ interface IMoGoCloudListener{
//单独线程
fun authCrtFile(device:String, root:String){}
/**
* 下载证书文件异常
*/
fun authCrtError(errorMsg: String){}
fun tokenGot(token: String, sn: String){}
/**

View File

@@ -11,11 +11,16 @@ object CallerAutopilotCarConfigListenerManager : CallerBase<IMoGoAutopilotCarCon
private var mCarConfigResp: MessagePad.CarConfigResp? = null
@Volatile
private var certFileMsg = "未开启认证"
override fun doSomeAfterAddListener(tag: String, listener: IMoGoAutopilotCarConfigListener) {
mCarConfigResp?.let {
listener.onAutopilotCarConfig(it)
}
listener.onCertificationResult(certFileMsg)
}
/**
* 工控机基础信息回调
* @param carConfigResp
@@ -33,5 +38,17 @@ object CallerAutopilotCarConfigListenerManager : CallerBase<IMoGoAutopilotCarCon
}
}
@Synchronized
fun invokeAutopilotCertFileResult(msg: String) {
certFileMsg = msg
M_LISTENERS.forEach {
val listener = it.value
listener.onCertificationResult(msg)
}
}
fun getCertFileResult(): String {
return certFileMsg
}
}

View File

@@ -41,4 +41,8 @@ object CallerCloudCertManager {
}
return crt
}
fun getCrtFileErrorMsg(): String? {
return certProviderApi.getCrtFileErrorMsg()
}
}

View File

@@ -17,6 +17,12 @@ object CallerCloudListenerManager : CallerBase<IMoGoCloudListener>() {
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<IMoGoCloudListener>() {
}
}
fun invokeCloudCrtError(errorMsg: String){
M_LISTENERS.forEach {
val listener = it.value
listener.authCrtError(errorMsg)
}
}
/**
* 分发获取到的设备sn
*/