[MapDataUpdate]升级sdk版本

This commit is contained in:
renwj
2022-02-22 19:17:49 +08:00
parent 9f730b2e6e
commit d1245f13c8
6 changed files with 43 additions and 10 deletions

View File

@@ -29,6 +29,7 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.check.CallerCheckManager
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.WaringConst
@@ -279,6 +280,9 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
}
}
}
if (record.type == 2 && (record.stat == 101 || record.stat == 100)) {
CallerMapDataCollectorManager.finish(record.id, record.stat, "", record.fileName ?: "", record.note ?: "")
}
}
override fun onDestroyView() {

View File

@@ -6,14 +6,17 @@ import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.cloud.passport.IMoGoTokenCallback
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.zhidaoauto.map.operational.MapCollectionTaskRecive
import com.zhidaoauto.map.operational.abs.OnTaskListener
import com.zhidaoauto.map.operational.open.GatherApi
import com.zhidaoauto.map.operational.open.GatherParams
import com.zhidaoauto.map.operational.open.GatherParams.Companion
import com.zhidaoauto.map.operational.open.abs.OnTaskListener
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.atomic.AtomicReference
@@ -26,7 +29,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
}
private val executor by lazy {
AtomicReference<MapCollectionTaskRecive?>(null)
AtomicReference<GatherApi>(null)
}
private val listeners by lazy {
@@ -39,9 +42,18 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
override val functionName: String = TAG
@Volatile
private var hasInit = false
override fun init(context: Context?) {
CallerMapLocationListenerManager.addListener(functionName, this)
executor.set(context?.let { MapCollectionTaskRecive(it) })
executor.set(context?.let {
GatherApi.also { itx ->
itx.init(it,
GatherParams.init()
.setDebugMode(DebugConfig.isDebug())
.setCoordinateType(GatherParams.COORDINATETYPE_GCJ02))
} })
executor.get()?.setOnTaskListener(this)
val carSn = MoGoAiCloudClientConfig.getInstance().sn
if (!TextUtils.isEmpty(carSn)) {
@@ -55,10 +67,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
override fun onDestroy() {
CallerMapLocationListenerManager.removeListener(TAG)
Logger.d(TAG, "--------- onDestroy --------")
executor.get()?.let {
it.setOnTaskListener(null)
it.destory()
}
executor.get()?.setOnTaskListener(null)
listeners.clear()
map.clear()
}
@@ -129,10 +138,19 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
map[id] = Status.START
}
override fun setIsInit() {
if (!hasInit) {
executor.get()?.also {
hasInit = true
Logger.d(TAG, "告之地图sdk定义数据可以用了")
it.setIsInit()
}
}
}
override fun onLocationChanged(location: MogoLocation?) {
location ?: return
executor.get()?.onMapChange(
executor.get()?.updateLocation(
location.longitude,
location.latitude,
location.bearing,