[6.3.0] wait to finish
This commit is contained in:
@@ -65,6 +65,8 @@ dependencies {
|
||||
compileOnly project(':core:function-impl:mogo-core-function-map')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
implementation project(":foudations:mogo-commons")
|
||||
|
||||
implementation rootProject.ext.dependencies.passport_secret
|
||||
}
|
||||
|
||||
//apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.datacenter.location.MoGoLocationDispatcher
|
||||
import com.mogo.eagle.core.function.datacenter.v2x.SpeedLimitDispatcher
|
||||
import com.mogo.eagle.core.function.datacenter.v2x.TrafficLightDispatcher
|
||||
import com.mogo.eagle.core.function.secure.CertFileManager
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_DATA_CENTER_MODULE)
|
||||
class DataCenterProvider: IDataCenterProvider {
|
||||
@@ -15,16 +16,23 @@ class DataCenterProvider: IDataCenterProvider {
|
||||
override val functionName: String
|
||||
get() = "DataCenterProvider"
|
||||
|
||||
private var mContext:Context? = null
|
||||
|
||||
override fun init(context: Context?) {
|
||||
MoGoLocationDispatcher.initListener()
|
||||
|
||||
context?.let {
|
||||
mContext = context
|
||||
mContext?.let {
|
||||
CertFileManager.INSTANCE.init(it)
|
||||
CallerMsgBoxManager.queryAllMessages(it)
|
||||
TrafficLightDispatcher.INSTANCE.initServer(it)
|
||||
SpeedLimitDispatcher.INSTANCE.initLimit(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun certificateDownLoad(callback: (String, String) -> Unit) {
|
||||
CertFileManager.INSTANCE.downloadCert()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
TrafficLightDispatcher.INSTANCE.destroy()
|
||||
SpeedLimitDispatcher.INSTANCE.destroy()
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.mogo.eagle.core.function.secure
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
|
||||
class CertFileManager {
|
||||
|
||||
private var context: Context? = null
|
||||
|
||||
companion object{
|
||||
val INSTANCE by lazy(LazyThreadSafetyMode.SYNCHRONIZED){
|
||||
CertFileManager()
|
||||
}
|
||||
}
|
||||
|
||||
fun init(context: Context?) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
fun downloadCert() {
|
||||
if (FunctionBuildConfig.isSecure) {
|
||||
context?.let {
|
||||
val authStatus =
|
||||
SharedPrefsMgr.getInstance()
|
||||
.getBoolean("securityKeyStatus-${DebugConfig.getNetMode()}", false)
|
||||
if (authStatus) {
|
||||
// clientConfig设置auth值,并带入header //todo 作为使用方,invoke出去设置
|
||||
clientConfig.authPubKey = SharedPrefsMgr.getInstance()
|
||||
.getString("securityKey-${DebugConfig.getNetMode()}", "")
|
||||
return@let
|
||||
}
|
||||
// 安全校验
|
||||
try {
|
||||
PassPortSecret.getInstance().init(sn, it.filesDir.path, object :
|
||||
IPassportSecret {
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_CLOUD_PASSPORT_AUTH_OK,
|
||||
paramIndexes = [0,1]
|
||||
)
|
||||
override fun onSuccess(securityKey: String, rootKey: String) {
|
||||
CallerLogger.d(
|
||||
"${SceneConstant.M_MAIN}$TAG",
|
||||
"onSuccess securityKey:$securityKey , thread:${Thread.currentThread().name}"
|
||||
)
|
||||
clientConfig.securityKey = securityKey
|
||||
SharedPrefsMgr.getInstance()
|
||||
.putString(
|
||||
"securityKey-${DebugConfig.getNetMode()}",
|
||||
securityKey
|
||||
)
|
||||
SharedPrefsMgr.getInstance()
|
||||
.putBoolean("securityKeyStatus-${DebugConfig.getNetMode()}", true)
|
||||
CallerCloudListenerManager.invokeCloudCrtFile(securityKey, rootKey)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
|
||||
linkCode = ChainConstant.CHAIN_SOURCE_CLOUD,
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_CLOUD_PASSPORT_AUTH_FAILED,
|
||||
paramIndexes = [0, 1]
|
||||
)
|
||||
override fun onFailed(errorCode: Int, errorMsg: String) {
|
||||
// logError(
|
||||
// getPrReason(
|
||||
// "PassPortSecret-onFailed , errorCode:$errorCode,errorMsg:$errorMsg"
|
||||
// )
|
||||
// )
|
||||
}
|
||||
})
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ dependencies {
|
||||
implementation project(":test:crashreport")
|
||||
implementation project(':foudations:mogo-commons')
|
||||
|
||||
implementation rootProject.ext.dependencies.passport_secret
|
||||
// implementation rootProject.ext.dependencies.passport_secret
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -3,5 +3,5 @@ package com.mogo.eagle.core.function.api.datacenter
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
|
||||
|
||||
interface IDataCenterProvider: IMoGoFunctionServerProvider {
|
||||
|
||||
fun certificateDownLoad(callback: (String,String) -> Unit)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.datacenter.IDataCenterProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
object CallerDataCenter : CallerBase<IDataCenterProvider>() {
|
||||
|
||||
fun certificate(callback: (String, String) -> Unit) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.certificateDownLoad { s1, s2 ->
|
||||
callback.invoke(s1, s2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user