[6.3.0] add func of security down load and add caller

This commit is contained in:
EmArrow
2024-03-06 18:21:31 +08:00
parent fd32c452ed
commit 40cc7b72f0
13 changed files with 174 additions and 196 deletions

View File

@@ -1,17 +0,0 @@
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)
}
}
}
}

View File

@@ -0,0 +1,26 @@
package com.mogo.eagle.core.function.call.cloud
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.cloud.IMoGoCertProvider
import com.mogo.eagle.core.function.call.base.CallerBase
object CallerCloudCertManager {
private val certProviderApi: IMoGoCertProvider
get() = CallerBase.getApiInstance(
IMoGoCertProvider::class.java,
MogoServicePaths.PATH_CERT_DOWN_LOAD_PROVIDER
)
fun certFileDownLoad(onError: ((String) -> Unit)? = null) {
certProviderApi.certificateDownLoad(onError)
}
fun getDeviceCrtF(): String? {
return certProviderApi.getDeviceCrtF()
}
fun getRootCrtF(): String? {
return certProviderApi.getRootCrtF()
}
}

View File

@@ -12,12 +12,6 @@ object CallerCloudListenerManager : CallerBase<IMoGoCloudListener>() {
@Volatile
private var sn: String? = null
@Volatile
private var deviceCrtFile: String? = null
@Volatile
private var rootCrtFile: String? = null
override fun doSomeAfterAddListener(tag: String, listener: IMoGoCloudListener) {
super.doSomeAfterAddListener(tag, listener)
if (!token.isNullOrEmpty() && !sn.isNullOrEmpty()) {
@@ -25,17 +19,7 @@ object CallerCloudListenerManager : CallerBase<IMoGoCloudListener>() {
}
}
fun getRootCrtF(): String? {
return rootCrtFile
}
fun getDeviceCrtF(): String? {
return deviceCrtFile
}
fun invokeCloudCrtFile(deviceCrtFile: String, rootCrtFile: String) {
this.deviceCrtFile = deviceCrtFile
this.rootCrtFile = rootCrtFile
M_LISTENERS.forEach {
val listener = it.value
listener.authCrtFile(deviceCrtFile, rootCrtFile)