[base_3.4.0-map-sdk]

This commit is contained in:
zhongchao
2023-08-18 18:42:12 +08:00
parent 10b5933c03
commit fc25630dc4
43 changed files with 644 additions and 790 deletions

View File

@@ -18,9 +18,10 @@ import com.mogo.eagle.function.biz.v2x.v2n.consts.V2XConst
import com.mogo.eagle.function.biz.v2x.v2n.remove.MarkerRemoveManager
import com.mogo.eagle.function.biz.v2x.v2n.remove.MarkerWrapper
import com.mogo.eagle.function.biz.v2x.v2n.scenario.scene.road.V2XAiRoadEventMarker
import com.mogo.map.MogoMap
import com.mogo.map.MogoData.Companion.mogoMapData
import com.mogo.map.overlay.core.Level.ROAD_CENTER_LINE
import com.mogo.map.overlay.line.*
import com.zhidaoauto.map.data.road.CenterLine
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicReference
@@ -55,14 +56,19 @@ class AiRoadMarker {
}
private val v2nDrawHandler by lazy {
HandlerThread("v2n_draw_thread").let { it.start(); Handler(it.looper)}
HandlerThread("v2n_draw_thread").let { it.start(); Handler(it.looper) }
}
private val checkExpiredTask = Runnable {
val poi = this.marker.get()
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
if (poi != null) {
val distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, poi.poi_lon, poi.poi_lat)
val distance = CoordinateUtils.calculateLineDistance(
car.longitude,
car.latitude,
poi.poi_lon,
poi.poi_lat
)
if (distance < 500) {
unMarker(poi)
}
@@ -70,7 +76,8 @@ class AiRoadMarker {
}
private val builder by lazy {
Polyline.Options.Builder(V2XConst.V2X_MARKER_OWNER, ROAD_CENTER_LINE).setIsGradient(true).setWidth(50f).setUseGps(true)
Polyline.Options.Builder(V2XConst.V2X_MARKER_OWNER, ROAD_CENTER_LINE).setIsGradient(true)
.setWidth(50f).setUseGps(true)
}
fun marker(marker: Marker, drawMarker: Boolean, drawRoadLine: Boolean = false) {
@@ -83,21 +90,33 @@ class AiRoadMarker {
}
if (drawRoadLine) {
//施工中心点前方的自车行驶方向上300米距离
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(
var l1: CenterLine? = null
mogoMapData.get().getCenterLineRangeInfo(
marker.poi_lon,
marker.poi_lat,
location.heading.toFloat(),
300f
)
//施工中心点后方的自车行驶方向上300米距离
V2XBizTrace.onAck("$TAG --- marker --- 3 --- l1:", l1)
val l2 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(
300f, call = { result ->
//施工中心点后方的自车行驶方向上300米距离
result?.let {
V2XBizTrace.onAck("$TAG --- marker --- 3 --- l1:", it)
l1 = result
}
})
var l2: CenterLine? = null
mogoMapData.get().getCenterLineRangeInfo(
marker.poi_lon,
marker.poi_lat,
location.heading.toFloat(),
-300f
)
if (l1.points.isEmpty() || l2.points.isEmpty()) {
-300f, call = { result ->
result?.let {
l2 = result
}
})
if (l1 == null || l2 == null) {
V2XBizTrace.onAck("$TAG --- marker --- 3 --- return ----", "")
return@post
}
if(l1.points.isEmpty() || l2.points.isEmpty()){
V2XBizTrace.onAck("$TAG --- marker --- 3 --- return ----", "")
return@post
}
@@ -202,7 +221,12 @@ class AiRoadMarker {
val poi = this.marker.get()
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
if (poi != null) {
val distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, poi.poi_lon, poi.poi_lat)
val distance = CoordinateUtils.calculateLineDistance(
car.longitude,
car.latitude,
poi.poi_lon,
poi.poi_lat
)
V2XBizTrace.onAck(
"$TAG --- receive --- 2 ---",
"car:[${car.longitude}, ${car.latitude}] -> poi:[${poi.poi_lon}, ${poi.poi_lat}] --> distance:$distance"

View File

@@ -48,7 +48,7 @@ class SceneManager {
init {
//过滤所需条件
sceneModuleTAG.map[ADAS] = SceneModule(true, M_D_C)
sceneModuleTAG.map[DEVA] = SceneModule(false, M_DEVA)
sceneModuleTAG.map[DEVA] = SceneModule(true, M_DEVA)
sceneModuleTAG.map[HMI] = SceneModule(false, M_HMI)
sceneModuleTAG.map[OBU] = SceneModule(true, M_OBU)
sceneModuleTAG.map[V2X] = SceneModule(true, M_V2X)

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui.map
import android.annotation.SuppressLint
import android.content.Context
import android.os.Looper
import android.view.View
import android.widget.ImageView
import android.widget.ProgressBar
@@ -10,16 +11,16 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
import com.mogo.map.hdcache.IHdCacheListener
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.map.MogoData.Companion.mogoMapData
import me.jessyan.autosize.utils.AutoSizeUtils
/**
* 离线地图缓存
*/
class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
class OfflineMapDialog(context: Context) : BaseFloatDialog(context) {
private var roundRootLayout: ConstraintLayout? = null
private var offlineTitleView: TextView? = null
@@ -86,34 +87,54 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
okView?.setOnClickListener {
if (isLoading) {
CallerMapUIServiceManager.cancelDownloadCacheData()
mogoMapData.get().cancelDownloadCacheData()
}
dismiss()
}
}
private fun cacheHDDataByCityByLonLat() {
CallerMapUIServiceManager.cacheHDDataByCityByLonLat(object : IHdCacheListener {
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
mogoMapData.get().cacheHDDataByCityByLonLat(location!!, { _, progress ->
if (Thread.currentThread() != Looper.getMainLooper().thread) {
ThreadUtils.runOnUiThread({
updateProgress(progress.toInt())
}, ThreadUtils.MODE.QUEUE)
} else {
updateProgress(progress.toInt())
}
override fun onMapHdCacheResult(cityId: Int, state: Int) {
}, { _, state ->
if (Thread.currentThread() != Looper.getMainLooper().thread) {
ThreadUtils.runOnUiThread({
if (state == 0) {// 失败
showNewContent(isLoading = false, false)
}
}, ThreadUtils.MODE.QUEUE)
} else {
if (state == 0) {// 失败
showNewContent(isLoading = false, false)
}
}
}, location!!)
})
}
private fun cacheHDOfflineData() {
if (location == null) {// 拿到了高德地图的cityCode
CallerMapUIServiceManager.cacheHDDataByCity(object : IHdCacheListener {
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
mogoMapData.get().cacheHDDataByCity({ _, progress ->
if (Thread.currentThread() != Looper.getMainLooper().thread) {
ThreadUtils.runOnUiThread({
updateProgress(progress.toInt())
}, ThreadUtils.MODE.QUEUE)
} else {
updateProgress(progress.toInt())
}
override fun onMapHdCacheResult(cityId: Int, state: Int) {
}, { _, state ->
if (Thread.currentThread() != Looper.getMainLooper().thread) {
ThreadUtils.runOnUiThread({
if (state == 0) {// 失败
showNewContent(isLoading = false, false)
}
}, ThreadUtils.MODE.QUEUE)
} else {
if (state == 0) {// 失败
showNewContent(isLoading = false, false)
}
@@ -176,15 +197,18 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
isSuccess -> {
okView?.visibility = View.VISIBLE
okView?.text = context.resources.getString(R.string.ok_tip)
offlineTitleView?.text = context.resources.getString(R.string.offline_download_success)
offlineTitleView?.text =
context.resources.getString(R.string.offline_download_success)
progressBar?.visibility = View.GONE
downloadPercentView?.visibility = View.GONE
downloadResultImg?.background = ContextCompat.getDrawable(context, R.drawable.download_success_icon)
downloadResultImg?.background =
ContextCompat.getDrawable(context, R.drawable.download_success_icon)
}
else -> {
isRetry = true
isConfirm = false
offlineTitleView?.text = context.resources.getString(R.string.offline_download_failure)
offlineTitleView?.text =
context.resources.getString(R.string.offline_download_failure)
okView?.visibility = View.GONE
progressBar?.visibility = View.GONE
downloadPercentView?.visibility = View.GONE
@@ -193,7 +217,8 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
rightView?.visibility = View.VISIBLE
vertLineView?.visibility = View.VISIBLE
rightView?.text = context.resources.getString(R.string.retry)
downloadResultImg?.background = ContextCompat.getDrawable(context, R.drawable.download_fail_icon)
downloadResultImg?.background =
ContextCompat.getDrawable(context, R.drawable.download_fail_icon)
}
}
}

View File

@@ -7,8 +7,8 @@ import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.net.*
import android.os.Build
import android.os.Looper
import android.os.Process
import android.text.Html
import android.util.AttributeSet
@@ -19,7 +19,8 @@ import androidx.appcompat.widget.PopupMenu
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.content.FileProvider
import androidx.core.view.*
import androidx.core.view.MenuCompat
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import chassis.Chassis
import com.mogo.cloud.passport.MoGoAiCloudClient
@@ -38,19 +39,19 @@ import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_FULL_
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RAIN_MODE
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_WARNING_UPLOAD
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.report.ReportEntity
import com.mogo.eagle.core.data.deva.scene.SceneModule
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.gnss.AccelerationEntity
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.data.obu.ObuStatusInfo
import com.mogo.eagle.core.data.deva.report.ReportEntity
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuConnectListener
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuInfoListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
@@ -64,7 +65,10 @@ import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.kotlin.currentPadding
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.LogLevel
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
@@ -73,11 +77,10 @@ import com.mogo.eagle.core.utilcode.mogo.permissions.BackgrounderPermission
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.map.hdcache.IHdCacheListener
import com.mogo.map.MogoData.Companion.mogoMapData
import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.map.uicontroller.VisualAngleMode.*
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import kotlinx.android.synthetic.main.view_debug_setting.view.tbRouteDynamicEffect
import kotlinx.coroutines.*
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
@@ -190,10 +193,10 @@ internal class DebugSettingView @JvmOverloads constructor(
*/
private val timerTaskRefresh = object : TimerTask() {
override fun run() {
if(this@DebugSettingView == null){
if (this@DebugSettingView == null) {
return
}
if(!isRunCheck){
if (!isRunCheck) {
return
}
UiThreadHandler.post {
@@ -293,9 +296,9 @@ internal class DebugSettingView @JvmOverloads constructor(
private fun initView() {
post {
val maxHeight = ScreenUtils.getScreenHeight()-BarUtils.getStatusBarHeight()
val maxHeight = ScreenUtils.getScreenHeight() - BarUtils.getStatusBarHeight()
val height = clDebugContain.height
if(height>maxHeight){
if (height > maxHeight) {
val layoutParamsOther = clDebugContain.layoutParams
layoutParamsOther.height = maxHeight
clDebugContain.layoutParams = layoutParamsOther
@@ -586,10 +589,11 @@ internal class DebugSettingView @JvmOverloads constructor(
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
ThreadUtils.getIoPool().execute {
val isCached = CallerMapUIServiceManager.isCityDataCached()
isHDCached = isCached
UiThreadHandler.post {
btn_cache_hd_map.text = "缓存高精离线地图(${if (isCached) "已是最新版" else "待更新"}!)"
mogoMapData.get().isCityDataCached {
isHDCached = it
UiThreadHandler.post {
btn_cache_hd_map.text = "缓存高精离线地图(${if (it) "已是最新版" else "待更新"}!)"
}
}
}
btn_cache_hd_map.visibility = View.VISIBLE
@@ -625,9 +629,15 @@ internal class DebugSettingView @JvmOverloads constructor(
*/
tbControlPassengerDriverMonitor.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR, "1".toByteArray())
CallerTelematicManager.sendMsgToAllClients(
TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR,
"1".toByteArray()
)
} else {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR, "0".toByteArray())
CallerTelematicManager.sendMsgToAllClients(
TelematicConstant.CONTROL_PASSENGER_DRIVER_MONITOR,
"0".toByteArray()
)
}
}
@@ -653,7 +663,8 @@ internal class DebugSettingView @JvmOverloads constructor(
// 初始化OBU IP信息
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, MogoObuConst.OBU_DEFAULT_IP)
SharedPrefsMgr.getInstance(context)
.getString(MoGoConfig.OBU_IP, MogoObuConst.OBU_DEFAULT_IP)
etObuIP.setText(ipAddress)
etObuIP.text?.let { etObuIP.setSelection(it.length) }
@@ -705,9 +716,11 @@ internal class DebugSettingView @JvmOverloads constructor(
}
tbIsStrictMode?.also {
it.isChecked = SharedPrefs.getInstance(Utils.getApp()).getBoolean("MOGO_STRICT_MODE_ENABLED", false)
it.isChecked = SharedPrefs.getInstance(Utils.getApp())
.getBoolean("MOGO_STRICT_MODE_ENABLED", false)
it.setOnCheckedChangeListener { _, isChecked ->
SharedPrefs.getInstance(Utils.getApp()).putBoolean("MOGO_STRICT_MODE_ENABLED", isChecked)
SharedPrefs.getInstance(Utils.getApp())
.putBoolean("MOGO_STRICT_MODE_ENABLED", isChecked)
scope.launch {
ToastUtils.showShort("配置生效, 2秒后重启应用...")
delay(2000)
@@ -850,7 +863,8 @@ internal class DebugSettingView @JvmOverloads constructor(
} else {
try {
val cloudSizeFloat = cloudSize.toFloat()
CallerMapUIServiceManager.getMapUIController()?.setPointCloudSize(cloudSizeFloat)
CallerMapUIServiceManager.getMapUIController()
?.setPointCloudSize(cloudSizeFloat)
} catch (e: Exception) {
ToastUtils.showShort("点云大小格式输入不正确")
}
@@ -896,7 +910,7 @@ internal class DebugSettingView @JvmOverloads constructor(
tbADASLog.isChecked = CallerAutoPilotControlManager.isEnableLog()
//如果工控机异常上报列表窗口为展示状态,则显示上报异常布局
if(CallerDevaToolsManager.getReportWindowStatus()){
if (CallerDevaToolsManager.getReportWindowStatus()) {
reportMsgLayout.visibility = View.VISIBLE
tbReportMore.isChecked = true
}
@@ -929,7 +943,7 @@ internal class DebugSettingView @JvmOverloads constructor(
clipboardManager?.setPrimaryClip(
ClipData.newPlainText(
"DockVersion",
CallerAutoPilotStatusListenerManager.getDockerVersion()?:""
CallerAutoPilotStatusListenerManager.getDockerVersion() ?: ""
)
)
ToastUtils.showLong("docker版本复制成功")
@@ -1042,13 +1056,15 @@ internal class DebugSettingView @JvmOverloads constructor(
}
if (!AppIdentityModeUtils.isTaxiDriver(FunctionBuildConfig.appIdentityMode)
&& !AppIdentityModeUtils.isBusDriver(FunctionBuildConfig.appIdentityMode)){
&& !AppIdentityModeUtils.isBusDriver(FunctionBuildConfig.appIdentityMode)
) {
tbStartAutopilotCommand.visibility = GONE
}
//切换环境
tvCurEnv.text = "当前环境:${CallerDevaToolsManager.getEnvCityName()}${CallerDevaToolsManager.getEnvNetMode()}"
tvCurEnv.text =
"当前环境:${CallerDevaToolsManager.getEnvCityName()}${CallerDevaToolsManager.getEnvNetMode()}"
btChangeEnv.onClick {
PopupMenu(context, btChangeEnv).also { p ->
p.menuInflater.inflate(R.menu.menu_env_pop, p.menu)
@@ -1064,13 +1080,22 @@ internal class DebugSettingView @JvmOverloads constructor(
R.id.env_reset ->
CallerDevaToolsManager.envConfigReset()
R.id.hy_product ->
CallerDevaToolsManager.envConfigChange("0734", DebugConfig.NET_MODE_RELEASE)
CallerDevaToolsManager.envConfigChange(
"0734",
DebugConfig.NET_MODE_RELEASE
)
R.id.hy_qa ->
CallerDevaToolsManager.envConfigChange("0734", DebugConfig.NET_MODE_QA)
R.id.hy_demo ->
CallerDevaToolsManager.envConfigChange("0734", DebugConfig.NET_MODE_DEMO)
CallerDevaToolsManager.envConfigChange(
"0734",
DebugConfig.NET_MODE_DEMO
)
R.id.bj_product ->
CallerDevaToolsManager.envConfigChange("010", DebugConfig.NET_MODE_RELEASE)
CallerDevaToolsManager.envConfigChange(
"010",
DebugConfig.NET_MODE_RELEASE
)
R.id.bj_qa ->
CallerDevaToolsManager.envConfigChange("010", DebugConfig.NET_MODE_QA)
R.id.bj_demo ->
@@ -1271,7 +1296,7 @@ internal class DebugSettingView @JvmOverloads constructor(
* 设置是否输出高精地图日志 true-打印日志false-不打印日志
*/
tbHdMapLog.setOnCheckedChangeListener { _, isChecked ->
CallerMapUIServiceManager.getMapUIController()?.setDebugMode(isChecked)
mogoMapData.get().setDebugMode(isChecked)
}
cbTraceLog.isChecked = CallerDevaToolsManager.getTraceLogStatus()
@@ -1391,7 +1416,14 @@ internal class DebugSettingView @JvmOverloads constructor(
activity?.startActivity(Intent.createChooser(Intent().also {
it.action = Intent.ACTION_SEND
it.type = "application/zip"
it.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(activity, "${activity.packageName}.fileProvider", file))
it.putExtra(
Intent.EXTRA_STREAM,
FileProvider.getUriForFile(
activity,
"${activity.packageName}.fileProvider",
file
)
)
}, "分享全量日志压缩包到"))
}
} else {
@@ -1561,8 +1593,10 @@ internal class DebugSettingView @JvmOverloads constructor(
/**
* 版本信息
*/
tvAppVersionName.text = "鹰眼版本:${AppUtils.getAppVersionName()} Git Hash${AppConfigInfo.workingBranchHash} \n渠道信息:${AppConfigInfo.flavor}"
tvAppVersionNameKey.text = "鹰眼版本:${AppUtils.getAppVersionName()} Git Hash${AppConfigInfo.workingBranchHash}\n渠道信息:${AppConfigInfo.flavor}"
tvAppVersionName.text =
"鹰眼版本:${AppUtils.getAppVersionName()} Git Hash${AppConfigInfo.workingBranchHash} \n渠道信息:${AppConfigInfo.flavor}"
tvAppVersionNameKey.text =
"鹰眼版本:${AppUtils.getAppVersionName()} Git Hash${AppConfigInfo.workingBranchHash}\n渠道信息:${AppConfigInfo.flavor}"
tvAutopilotProtocolVersionInfo.text =
"Autopilot协议版本${CallerAutoPilotControlManager.getProtocolVersion()}"
@@ -1579,9 +1613,12 @@ internal class DebugSettingView @JvmOverloads constructor(
tvGitBranchInfo.text = "Git分支${AppConfigInfo.workingBranchName}"
tvAppBuildTimeInfo.text = "版本构建时间:${AppConfigInfo.appBuildTime}"
if(tbBeautyMode.isVisible){
val version = ParseVersionUtils.parseVersion(true, CallerAutoPilotStatusListenerManager.getDockerVersion())
if(version >= 30100 && AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
if (tbBeautyMode.isVisible) {
val version = ParseVersionUtils.parseVersion(
true,
CallerAutoPilotStatusListenerManager.getDockerVersion()
)
if (version >= 30100 && AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
tbBeautyMode.visibility = View.GONE
}
}
@@ -1614,7 +1651,7 @@ internal class DebugSettingView @JvmOverloads constructor(
"移动数据"
} else {
//WiFi
CommonUtils.getWifiName(context)?:""
CommonUtils.getWifiName(context) ?: ""
}
} else {
@@ -1689,11 +1726,14 @@ internal class DebugSettingView @JvmOverloads constructor(
tvIpcInfo.text = it
tvIpcInfoKey.text = it
}
tvCmdbCarInfoContent.text = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO)?:""
tvCmdbCarInfoContent.text =
SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO) ?: ""
//APP升级功能
tvAppHost.text = "HOST地址" + SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.HOST_ADDRESS)?:""
tvAppContent.text = "APP升级数据" + SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.APP_UPGRADE_CONTENT)?:""
tvAppHost.text = "HOST地址" + SharedPrefsMgr.getInstance(context)
.getString(SharedPrefsConstants.HOST_ADDRESS) ?: ""
tvAppContent.text = "APP升级数据" + SharedPrefsMgr.getInstance(context)
.getString(SharedPrefsConstants.APP_UPGRADE_CONTENT) ?: ""
tvCarInfo.text =
"GPS时间${(mGnssInfo?.satelliteTime?.times(1000))?.toLong()}\n" +
@@ -1731,7 +1771,7 @@ internal class DebugSettingView @JvmOverloads constructor(
tbIsDemoMode?.text = "开启美化模式"
}
if(FunctionBuildConfig.isRainMode){
if (FunctionBuildConfig.isRainMode) {
tbIsRainMode?.text = "关闭雨天模式"
} else {
tbIsRainMode?.text = "开启雨天模式"
@@ -2107,56 +2147,71 @@ internal class DebugSettingView @JvmOverloads constructor(
}
private fun restartApp() {
Utils.getApp().startActivity(Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName))
Utils.getApp()
.startActivity(Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName))
Process.killProcess(Process.myPid())
}
private fun cacheHDOfflineData(isGaoDe: Boolean) {
var progss = 0
if (isGaoDe) {// 拿到了高德地图的cityCode
CallerMapUIServiceManager.cacheHDDataByCity(object : IHdCacheListener {
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
// 更新进度
progss = progress.toInt()
if (progss == 100) {
isHDCached = true
btn_cache_hd_map.text = "缓存高精离线地图(已是最新版!)"
} else {
btn_cache_hd_map.text = "缓存高精离线地图(进度:${progss}%)"
}
mogoMapData.get().cacheHDDataByCity({ _, progress ->
if (Thread.currentThread() != Looper.getMainLooper().thread) {
ThreadUtils.runOnUiThread(Runnable {
cacheHDCityProgressUpdate(progress)
}, ThreadUtils.MODE.QUEUE)
} else {
cacheHDCityProgressUpdate(progress)
}
override fun onMapHdCacheResult(cityId: Int, state: Int) {
if (state == 0) {// 失败
btn_cache_hd_map.text = "缓存高精离线地图(下载失败!)"
ToastUtils.showShort("下载失败,请重试!")
}
}, { _, state ->
if (Thread.currentThread() != Looper.getMainLooper().thread) {
ThreadUtils.runOnUiThread(Runnable {
cacheHDCityResult(state)
}, ThreadUtils.MODE.QUEUE)
} else {
cacheHDCityResult(state)
}
})
} else {// 只拿到了高精的经纬度
mGnssInfo?.let { loc ->
CallerMapUIServiceManager.cacheHDDataByCityByLonLat(object : IHdCacheListener {
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
progss = progress.toInt()
if (progss == 100) {
isHDCached = true
btn_cache_hd_map.text = "缓存高精离线地图(已是最新版!)"
} else {
btn_cache_hd_map.text = "缓存高精离线地图(进度:${progss}%)"
}
mogoMapData.get().cacheHDDataByCityByLonLat(loc, { _, progress ->
if (Thread.currentThread() != Looper.getMainLooper().thread) {
ThreadUtils.runOnUiThread(Runnable {
cacheHDCityProgressUpdate(progress)
}, ThreadUtils.MODE.QUEUE)
} else {
cacheHDCityProgressUpdate(progress)
}
override fun onMapHdCacheResult(cityId: Int, state: Int) {
if (state == 0) {// 失败
btn_cache_hd_map.text = "缓存高精离线地图(下载失败!)"
ToastUtils.showShort("下载失败,请重试!")
}
}, { _, state ->
if (Thread.currentThread() != Looper.getMainLooper().thread) {
ThreadUtils.runOnUiThread(Runnable {
cacheHDCityResult(state)
}, ThreadUtils.MODE.QUEUE)
} else {
cacheHDCityResult(state)
}
}, loc)
})
}
}
}
private fun cacheHDCityProgressUpdate(progress: Double) {
// 更新进度
val progss = progress.toInt()
if (progss == 100) {
isHDCached = true
btn_cache_hd_map.text = "缓存高精离线地图(已是最新版!)"
} else {
btn_cache_hd_map.text = "缓存高精离线地图(进度:${progss}%)"
}
}
private fun cacheHDCityResult(state: Int) {
if (state == 0) {// 失败
btn_cache_hd_map.text = "缓存高精离线地图(下载失败!)"
ToastUtils.showShort("下载失败,请重试!")
}
}
override fun fwThreadClose() {
refreshTraceInfo()
}

View File

@@ -47,7 +47,7 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
if (gnssInfo != null) {
//设置刹车信息,小于默认认为是刹车
//设置刹车信息,小于默认认为是刹车 //todo 优化sp获取不要每次回调都去调用sp
brakeLight =
if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(
MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f

View File

@@ -24,6 +24,7 @@ import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog.Companion.hmiActio
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.map.MogoData.Companion.mogoMapData
import kotlinx.android.synthetic.main.view_system_version.view.*
@@ -155,9 +156,10 @@ class SystemVersionView @JvmOverloads constructor(
}
ThreadUtils.getIoPool().execute {
val isCached = CallerMapUIServiceManager.isCityDataCached()
UiThreadHandler.post {
updateHDDataCacheStatus(isCached)
mogoMapData.get().isCityDataCached {
UiThreadHandler.post {
updateHDDataCacheStatus(it)
}
}
}

View File

@@ -13,6 +13,7 @@ import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.utilcode.util.DeviceUtils
import com.mogo.map.MapDataWrapper
@Route(path = MogoServicePaths.PATH_MAP_BIZ)
class MapBizProvider :IMoGoFunctionServerProvider, IMogoRoma {
@@ -21,6 +22,7 @@ class MapBizProvider :IMoGoFunctionServerProvider, IMogoRoma {
get() = "MapBizProvider"
override fun init(context: Context?) {
MapDataWrapper.init()
MapIdentifySubscriber.instance
MogoRouteOverlayManager.getInstance().init()
MapPointCloudSubscriber.instance

View File

@@ -1,58 +1,52 @@
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.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.map.hdcache.IHdCacheListener
import com.mogo.map.MogoData.Companion.mogoMapData
object CacheHDMapManager: IMoGoChassisLocationWGS84Listener {
//todo emaArrow 多实例影响到的业务,进行测试
object CacheHDMapManager {
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
ThreadUtils.getIoPool().execute {
mogoMapData.get().isCityDataCached {
if(!it){
while (true) {
val loc =
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
if (loc.latitude != 0.0 || loc.longitude != 0.0) {
CallerLogger.d(TAG, "开始下载")
mogoMapData.get().cacheHDDataByCityByLonLat(loc,
{ _, progress ->
CallerLogger.i(M_MAP + TAG, "下载进度:${progress.toInt()}")
},
{ _, state ->
if (state == 0) {
CallerLogger.i(M_MAP + TAG, "下载失败")
}
})
CallerLogger.i(M_MAP + TAG, "移除监听并关闭循环")
break
}
try {
CallerLogger.i(M_MAP + TAG, "开始休眠...")
Thread.sleep(1500)
} catch (e: Exception) {
}
}
try {
Log.d(TAG, "开始休眠...")
Thread.sleep(1500)
} catch (e: Exception) {}
}else{
CallerLogger.i(M_MAP + TAG, "高精地图缓存已下载!")
}
} else {
Log.d(TAG, "高精地图缓存已下载!")
}
}
}
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
location = gnssInfo
}
}

View File

@@ -55,14 +55,14 @@ class IdentifyAiCloudDataDrawer : Identify {
val key = it.next() as String
it.remove()
mMarkersCaches.remove(key)
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(key.hashCode().toString())
}
val filterList = filterTrafficData(resultList)
if (filterList.size > 0) {
// 绘制新数据
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.updateBatchAiMarkerPosition(filterList)
}
}
@@ -90,7 +90,7 @@ class IdentifyAiCloudDataDrawer : Identify {
trafficDataUuidList.clear()
mMarkersCaches.forEach { (uuid, _) ->
mMarkersCaches.remove(uuid)
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(uuid.hashCode().toString())
}
mFilterTrafficData.clear()

View File

@@ -46,7 +46,7 @@ class IdentifyBeautifyDataDrawer : Identify {
val filterList = TrackManager.getInstance().filterTrafficData(resultList)
if (filterList.size > 0) {
// 绘制新数据
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.updateBatchMarkerPosition(filterList)
}
}

View File

@@ -79,14 +79,14 @@ class IdentifyOriginDataDrawer : Identify {
val key = it.next() as String
it.remove()
mMarkersCaches.remove(key)
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(key)
}
val filterList = filterTrafficData(resultList)
if (filterList.size > 0) {
// 绘制新数据
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.updateBatchMarkerPosition(filterList)
}
}
@@ -124,7 +124,7 @@ class IdentifyOriginDataDrawer : Identify {
@SuppressLint("NewApi")
override fun clearOldMarker() {
for (uuid in trafficDataUuidList) {
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(uuid)
}
trafficDataUuidList.clear()

View File

@@ -150,7 +150,7 @@ public class TrackManager {
cellIdCaches.remove(key);
mMarkersCaches.remove(key);
WarningHelper.INSTANCE.remove(key);
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(key);
}
@@ -160,7 +160,7 @@ public class TrackManager {
WarningHelper.INSTANCE.clear();
mMarkersCaches.forEach((uuid, trackObj) -> {
trackObj.clear();
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
MogoIdentifyManager.getInstance()
.removeMarker(uuid);
});
mMarkersCaches.clear();

View File

@@ -21,6 +21,7 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
@Route(path = MogoServicePaths.PATH_SERVICES_MAP)
public class MogoMapService implements IMogoMapService {
//todo 多实例主动设置IMap对象下面接口返回对应IMap实例的接口数据
@Override
public IMogoMapUIController getMapUIController() {
@@ -33,8 +34,8 @@ public class MogoMapService implements IMogoMapService {
}
@Override
public IMogoGDLocationClient getGDLocationServer(Context context) {
return GDLocationClient.getInstance(context);
public IMogoGDLocationClient getGDLocationServer() {
return GDLocationClient.Companion.getGdLocationClient();
}
@Override

View File

@@ -101,7 +101,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
}
private fun initGDLoc() {
CallerMapUIServiceManager.getGDLocationServer(context!!)?.start()
CallerMapUIServiceManager.getGDLocationServer()?.start(context!!)
}
private fun preparePassportEnvironment() {
@@ -170,10 +170,10 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
// 更新
httpDnsSimpleLocation = if (
mogoLocation.cityCode.isNullOrEmpty() &&
!CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty()
!CallerMapUIServiceManager.getGDLocationServer()?.lastCityCode.isNullOrEmpty()
) {
SimpleLocation(
CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode
CallerMapUIServiceManager.getGDLocationServer()?.lastCityCode
?: "010",
mogoLocation.latitude,
mogoLocation.longitude
@@ -354,13 +354,9 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
})
// 开启Socket长链服务
val lat =
if (location.latitude != 0.0) location.latitude else CallerMapUIServiceManager.getGDLocationServer(
context!!
)!!.lastLat
if (location.latitude != 0.0) location.latitude else CallerMapUIServiceManager.getGDLocationServer()!!.lastLat
val lon =
if (location.longitude != 0.0) location.longitude else CallerMapUIServiceManager.getGDLocationServer(
context!!
)!!.lastLon
if (location.longitude != 0.0) location.longitude else CallerMapUIServiceManager.getGDLocationServer()!!.lastLon
MogoAiCloudSocketManager.getInstance(context)
.init(context, sn, DebugConfig.getSocketAppId(), lat, lon)
}
@@ -381,11 +377,11 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
map["lat"] =
if (CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().latitude != 0.0)
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().latitude else
CallerMapUIServiceManager.getGDLocationServer(context!!)!!.lastLat
CallerMapUIServiceManager.getGDLocationServer()!!.lastLat
map["lon"] =
if (CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().longitude != 0.0)
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().longitude else
CallerMapUIServiceManager.getGDLocationServer(context!!)!!.lastLon
CallerMapUIServiceManager.getGDLocationServer()!!.lastLon
map["reason"] = msg
return GsonUtils.toJson(map)
}