[3.2.0][Opt]乘客屏自动下载高精地图缓存
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package com.mogo.eagle.core.function.business.cachemap
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.map.hdcache.IHdCacheListener
|
||||
|
||||
object CacheHDMapManager: IMoGoChassisLocationWGS84Listener {
|
||||
|
||||
private const val TAG = "CacheHDMapManager"
|
||||
|
||||
@Volatile
|
||||
private var location: MogoLocation? = null
|
||||
|
||||
fun scheduleGetLocation() {
|
||||
if (!AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
ThreadUtils.getIoPool().execute {
|
||||
if (!CallerMapUIServiceManager.isCityDataCached()) {
|
||||
while (true) {
|
||||
if (location != null) {
|
||||
Log.d(TAG, "开始下载")
|
||||
CallerMapUIServiceManager.cacheHDDataByCityByLonLat(object : IHdCacheListener {
|
||||
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
|
||||
Log.d(TAG, "下载进度:${progress.toInt()}")
|
||||
}
|
||||
|
||||
override fun onMapHdCacheResult(cityId: Int, state: Int) {
|
||||
if (state == 0) {
|
||||
Log.d(TAG, "下载失败")
|
||||
}
|
||||
}
|
||||
}, location!!)
|
||||
Log.d(TAG, "移除监听并关闭循环")
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
|
||||
return@execute
|
||||
}
|
||||
try {
|
||||
Log.d(TAG, "开始休眠...")
|
||||
Thread.sleep(1500)
|
||||
} catch (e: Exception) {}
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "高精地图缓存已下载!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
location = gnssInfo
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
|
||||
import com.mogo.eagle.core.function.business.cachemap.CacheHDMapManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
@@ -73,6 +74,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(this)
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- init --------")
|
||||
CallerLogger.d("$M_MAP$TAG", "executor: ${executor.get()?.hashCode() ?: 0}")
|
||||
CacheHDMapManager.scheduleGetLocation()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
Reference in New Issue
Block a user