diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHAdasAbilityManager.java b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHAdasAbilityManager.java index 83332d1bb8..e97c0b6b34 100644 --- a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHAdasAbilityManager.java +++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/manager/OCHAdasAbilityManager.java @@ -10,7 +10,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListene import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager; import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.och.common.module.callback.OchAdasStartFailureCallback; -import com.zhidao.support.adas.high.bean.AutopilotStatistics; +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics; /** * Created on 2022/10/9 diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerGeocodeSearchModel.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerGeocodeSearchModel.java index 213ab2d358..c43702af78 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerGeocodeSearchModel.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerGeocodeSearchModel.java @@ -55,10 +55,10 @@ public class TaxiPassengerGeocodeSearchModel implements GeocodeSearch.OnGeocodeS //通过经纬度逆地理编码得到位置 try { mGeocodeSearch = new GeocodeSearch(mContext); + mGeocodeSearch.setOnGeocodeSearchListener(this); } catch (AMapException e) { e.printStackTrace(); } - mGeocodeSearch.setOnGeocodeSearchListener(this); timer = new Timer(); timerTask = new TimerTask() { @Override diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java index 50ddaa22bc..08ae38336b 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java @@ -100,7 +100,7 @@ import com.zhidao.support.adas.high.AdasOptions; import com.zhidao.support.adas.high.OnAdasConnectStatusListener; import com.zhidao.support.adas.high.OnAdasListener; import com.zhidao.support.adas.high.OnMultiDeviceListener; -import com.zhidao.support.adas.high.bean.AutopilotStatistics; +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics; import com.zhidao.support.adas.high.bean.VersionCompatibility; import com.zhidao.support.adas.high.common.ByteUtil; import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS; diff --git a/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java b/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java index 685f84610c..3c1ea13ce0 100644 --- a/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java +++ b/app_mogo_magic_ring/src/main/java/com/zhidao/adas/magic/ui/MainActivity.java @@ -45,7 +45,7 @@ import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.AdasOptions; import com.zhidao.support.adas.high.OnAdasConnectStatusListener; import com.zhidao.support.adas.high.OnAdasListener; -import com.zhidao.support.adas.high.bean.AutopilotStatistics; +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics; import com.zhidao.support.adas.high.bean.VersionCompatibility; import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS; import com.zhidao.support.adas.high.common.CupidLogUtils; diff --git a/core/function-impl/mogo-core-function-datacenter/build.gradle b/core/function-impl/mogo-core-function-datacenter/build.gradle index 70e7c4ac08..fab4051ccf 100644 --- a/core/function-impl/mogo-core-function-datacenter/build.gradle +++ b/core/function-impl/mogo-core-function-datacenter/build.gradle @@ -55,7 +55,6 @@ dependencies { implementation rootProject.ext.dependencies.androidxroomktx implementation rootProject.ext.dependencies.mogoaicloudtelematic - implementation rootProject.ext.dependencies.amapnavi3dmap implementation project(':libraries:mogo-obu') implementation project(':libraries:mogo-adas') diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index 6374bb350c..8247a0ea90 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -59,7 +59,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger import com.mogo.support.obu.ObuScene import com.zhidao.support.adas.high.AdasManager import com.zhidao.support.adas.high.OnAdasListener -import com.zhidao.support.adas.high.bean.AutopilotStatistics +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics import com.zhidao.support.adas.high.common.ProtocolStatus import com.zhjt.service.chain.ChainLog import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/MoGoLocationDispatcher.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/MoGoLocationDispatcher.kt index dc052cf491..945490bfd2 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/MoGoLocationDispatcher.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/location/MoGoLocationDispatcher.kt @@ -1,26 +1,21 @@ package com.mogo.eagle.core.function.datacenter.location -import com.amap.api.location.AMapLocation -import com.amap.api.location.AMapLocationClient -import com.amap.api.location.AMapLocationClientOption -import com.amap.api.location.AMapLocationListener import com.mogo.commons.AbsMogoApplication import com.mogo.commons.constants.SharedPrefsConstants import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssListener +import com.mogo.eagle.core.function.api.map.listener.IGaoDeMapLocationListener import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager +import com.mogo.eagle.core.function.call.map.CallerGaoDeMapLocationListenerManager import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr -import com.mogo.eagle.core.utilcode.util.CoordinateTransform import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils import com.mogo.eagle.core.utilcode.util.TimeUtils -import com.mogo.eagle.core.utilcode.util.Utils -import com.mogo.support.obu.model.MogoObuHvBasicsData import mogo.telematics.pad.MessagePad /** @@ -31,12 +26,11 @@ import mogo.telematics.pad.MessagePad object MoGoLocationDispatcher : IMoGoChassisGnssListener, IMoGoObuLocationWGS84Listener, - AMapLocationListener { + IGaoDeMapLocationListener { private const val TAG = "MoGoLocationManager" private var mCityCode: String? = null - private var mapLocation: AMapLocation? = null /** * 最后一次工控机GNSS返回更新的位置 @@ -54,33 +48,10 @@ object MoGoLocationDispatcher : private var lastGaoDeLocation: MogoLocation = MogoLocation() fun initListener() { - // 高德SDK隐私政策 - AMapLocationClient.updatePrivacyShow(Utils.getApp(), true, true) - AMapLocationClient.updatePrivacyAgree(Utils.getApp(), true) - - try { - val mLocationClient = AMapLocationClient(Utils.getApp()) - - //初始化定位参数 - //声明mLocationOption对象 - val mLocationOption = AMapLocationClientOption() - //设置定位监听 - mLocationClient.setLocationListener(this) - //设置定位模式为高精度模式,Battery_Saving为低功耗模式,Device_Sensors是仅设备模式 - mLocationOption.locationMode = AMapLocationClientOption.AMapLocationMode.Hight_Accuracy - //设置定位间隔,单位毫秒,默认为2000ms - mLocationOption.interval = 1000 - //设置定位参数 - mLocationClient.setLocationOption(mLocationOption) - // 启动定位监听 - mLocationClient.startLocation() - } catch (e: Exception) { - e.printStackTrace() - } - // 初始化监听订阅工控机位置信息 CallerChassisGnssListenerManager.addListener(TAG, this) CallerObuLocationWGS84ListenerManager.addListener(TAG, this) + CallerGaoDeMapLocationListenerManager.addListener(TAG, this) } override fun onChassisGnss(gnssInfo: MessagePad.GnssInfo) { @@ -88,13 +59,13 @@ object MoGoLocationDispatcher : lastGnssLocation.gnssInfo = gnssInfo lastGnssLocation.lastReceiveTime = TimeUtils.getNowMills() // 将高德中的一些用于业务的数据进行融合,例如:CityCode、address等 - mapLocation?.let { + lastGaoDeLocation.let { //agps 高德 //agps_rtk 高德-高精 lastGnssLocation.locType = 1000 // 定位类型为WGS84进行转译的坐标 lastGnssLocation.satellite = 4 - lastGnssLocation.cityName = it.city + lastGnssLocation.cityName = it.cityName lastGnssLocation.cityCode = it.cityCode lastGnssLocation.provider = it.provider lastGnssLocation.address = it.address @@ -128,79 +99,42 @@ object MoGoLocationDispatcher : MultiDisplayUtils.getOtherDisplay() } + /** * 高德地图位置改变回调 - * @param aMapLocation 位置信息 + * @param mogoLocation 位置信息 */ - override fun onLocationChanged(aMapLocation: AMapLocation) { - mapLocation = aMapLocation - // 更新GNSS 信息 - lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills() - - // 将高德中的一些用于业务的数据进行融合,例如:CityCode、address等 - mapLocation?.let { - // 转换 GCJ02-->WGS84 坐标 - val wgs84Location = - CoordinateTransform.GCJ02ToWGS84(it.longitude, it.latitude) - - lastGaoDeLocation.longitude = wgs84Location[0] - lastGaoDeLocation.latitude = wgs84Location[1] - lastGaoDeLocation.heading = it.bearing.toDouble() - lastGaoDeLocation.gnssSpeed = it.speed - lastGaoDeLocation.altitude = it.altitude - lastGaoDeLocation.satelliteTime = it.time - lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills() - - lastGaoDeLocation.locType = 1 // 定位类型为高德坐标(网路或者硬件定位) - lastGaoDeLocation.satellite = 4 - - lastGaoDeLocation.cityName = it.city - lastGaoDeLocation.cityCode = it.cityCode - lastGaoDeLocation.provider = it.provider - lastGaoDeLocation.address = it.address - lastGaoDeLocation.district = it.district - lastGaoDeLocation.province = it.province - lastGaoDeLocation.adCode = it.adCode - lastGaoDeLocation.locationDetail = it.locationDetail - lastGaoDeLocation.poiName = it.poiName - lastGaoDeLocation.aoiName = it.aoiName - lastGaoDeLocation.street = it.street - lastGaoDeLocation.streetNum = it.streetNum - lastGaoDeLocation.description = it.description - lastGaoDeLocation.buildingId = it.buildingId - lastGaoDeLocation.floor = it.floor - lastGaoDeLocation.errorCode = it.errorCode - lastGaoDeLocation.errorInfo = it.errorInfo - } + override fun onMoGoLocationChanged(mogoLocation: MogoLocation) { + // 更新GaoDe 信息 + lastGaoDeLocation = mogoLocation // 计算最后一次工控机同步的定位是否超时,如果超时则切换为高德地图定位,暂定超过30秒需要切换 if (1 == FunctionBuildConfig.gpsProvider) { - if (TimeUtils.getNowMills() - lastGnssLocation.lastReceiveTime > 30000) { + if (TimeUtils.getNowMills() - lastGnssLocation.lastReceiveTime > 10000) { syncGaoDeLocation() } } else if (2 == FunctionBuildConfig.gpsProvider) { - if (TimeUtils.getNowMills() - lastOBULocation.lastReceiveTime > 30000) { + if (TimeUtils.getNowMills() - lastOBULocation.lastReceiveTime > 10000) { syncGaoDeLocation() } } - // 本地SP缓存城市Code - val cityCode = aMapLocation.cityCode + val cityCode = mogoLocation.cityCode if (cityCode != null && cityCode.isNotEmpty()) { - mCityCode = aMapLocation.cityCode + mCityCode = mogoLocation.cityCode SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()) .putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode) SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()) .putString( SharedPrefsConstants.LOCATION_LATITUDE, - aMapLocation.latitude.toString() + mogoLocation.latitude.toString() ) SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()) .putString( SharedPrefsConstants.LOCATION_LONGITUDE, - aMapLocation.longitude.toString() + mogoLocation.longitude.toString() ) } @@ -236,13 +170,13 @@ object MoGoLocationDispatcher : lastOBULocation.lastReceiveTime = TimeUtils.getNowMills() // 将高德中的一些用于业务的数据进行融合,例如:CityCode、address等 - mapLocation?.let { + lastGaoDeLocation.let { //agps 高德 //agps_rtk 高德-高精 lastOBULocation.locType = 1000 // 定位类型为WGS84进行转译的坐标 lastOBULocation.satellite = 4 - lastOBULocation.cityName = it.city + lastOBULocation.cityName = it.cityName lastOBULocation.cityCode = it.cityCode lastOBULocation.provider = it.provider lastOBULocation.address = it.address @@ -274,4 +208,5 @@ object MoGoLocationDispatcher : ) } } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt index 4e0cb392df..9dc9637ff1 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/msgbox/DataManager.kt @@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.msgbox import android.content.Context import android.os.Looper +import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.msgbox.* import com.mogo.eagle.core.data.report.ReportEntity import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager @@ -87,7 +88,16 @@ object DataManager { msg.timestamp = System.currentTimeMillis() msg.bean2Json = GsonUtils.toJson(msg.bean) when (type) { - MsgBoxType.V2X, MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION -> { + MsgBoxType.V2X -> { + // 汇总消息不存数据库 + if (msg.sourceType != DataSourceType.SUMMARY) { + synchronized(this) { + notifyList.add(msg) + } + } + CallerMsgBoxListenerManager.invokeListener(MsgCategory.NOTICE, msg) + } + MsgBoxType.OBU, MsgBoxType.NOTICE, MsgBoxType.OPERATION -> { synchronized(this) { notifyList.add(msg) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt index 0adbe08c49..e7c083b27e 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/map/OfflineMapDialog.kt @@ -60,8 +60,8 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) { leftView?.setOnClickListener { when { isConfirm -> { - cacheHDOfflineData() showNewContent(isLoading = true, false) + cacheHDOfflineData() } else -> { dismiss() @@ -72,6 +72,7 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) { rightView?.setOnClickListener { when { isRetry -> { + showNewContent(isLoading = true, false) cacheHDOfflineData() } else -> { @@ -81,6 +82,9 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) { } okView?.setOnClickListener { + if (isLoading) { + CallerMapUIServiceManager.cancelDownloadCacheData() + } dismiss() } } @@ -90,6 +94,12 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) { override fun onMapHdCacheProgress(cityId: Int, progress: Double) { updateProgress(progress.toInt()) } + + override fun onMapHdCacheResult(cityId: Int, state: Int) { + if (state == 0) {// 失败 + showNewContent(isLoading = false, false) + } + } }) } @@ -131,6 +141,7 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) { @SuppressLint("UseCompatLoadingForDrawables") private fun showNewContent(isLoading: Boolean, isSuccess: Boolean) { + this.isLoading = isLoading change2NewStyle() when { isLoading -> { @@ -150,11 +161,14 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) { 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) okView?.visibility = View.GONE progressBar?.visibility = View.GONE downloadPercentView?.visibility = View.GONE leftView?.visibility = View.VISIBLE + leftView?.text = context.resources.getString(R.string.ok_tip) rightView?.visibility = View.VISIBLE vertLineView?.visibility = View.VISIBLE rightView?.text = context.resources.getString(R.string.retry) diff --git a/core/function-impl/mogo-core-function-map/build.gradle b/core/function-impl/mogo-core-function-map/build.gradle index 0cf7bfaf30..87b0a3c14a 100644 --- a/core/function-impl/mogo-core-function-map/build.gradle +++ b/core/function-impl/mogo-core-function-map/build.gradle @@ -60,7 +60,6 @@ dependencies { implementation rootProject.ext.dependencies.mogocustommap implementation rootProject.ext.dependencies.amapnavi3dmap -// implementation rootProject.ext.dependencies.amaplocation implementation rootProject.ext.dependencies.androidxroomruntime kapt rootProject.ext.dependencies.androidxroomcompiler diff --git a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt index a5ad0ae66e..34b96faae4 100644 --- a/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt +++ b/core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt @@ -141,8 +141,9 @@ class HttpDnsStartUp : AndroidStartup() { } if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0) { // 更新 - httpDnsSimpleLocation = if (mogoLocation.cityCode.isNullOrEmpty() - && !CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty() + httpDnsSimpleLocation = if ( + mogoLocation.cityCode.isNullOrEmpty() && + !CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty() ) { HttpDnsSimpleLocation( CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode @@ -233,7 +234,7 @@ class HttpDnsStartUp : AndroidStartup() { } private fun startSocketService() { - CallerLogger.d("$M_MAIN$TAG","startSocketService") + CallerLogger.d("$M_MAIN$TAG", "startSocketService") val location = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02() MogoAiCloudSocketManager.getInstance(context) .registerLifecycleListener(10020, object : IMogoLifecycleListener { @@ -306,7 +307,10 @@ class HttpDnsStartUp : AndroidStartup() { clientPkFileName = "sn" ) private fun reConnectSocket(oldCityCode: String, newCityCode: String) { - CallerLogger.d("$M_MAIN$TAG", "reConnectSocket oldCityCode : $oldCityCode , newCityCode : $newCityCode") + CallerLogger.d( + "$M_MAIN$TAG", + "reConnectSocket oldCityCode : $oldCityCode , newCityCode : $newCityCode" + ) MogoAiCloudSocketManager.getInstance(context).reConnect() } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatisticsListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatisticsListener.kt index 8bb5d83d75..f084eeeb5c 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatisticsListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatisticsListener.kt @@ -1,6 +1,6 @@ package com.mogo.eagle.core.function.api.autopilot -import com.zhidao.support.adas.high.bean.AutopilotStatistics +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics /** * 启动自动驾驶状态统计监听 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IGaoDeMapLocationListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IGaoDeMapLocationListener.kt index 872df234ce..e45c2b085d 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IGaoDeMapLocationListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/listener/IGaoDeMapLocationListener.kt @@ -14,5 +14,5 @@ interface IGaoDeMapLocationListener { * * @param location 新定位点 */ - fun onLocationChanged(location: MogoLocation, from: Int, isGps: Boolean) + fun onMoGoLocationChanged(location: MogoLocation) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotStatisticsListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotStatisticsListenerManager.kt index ef6b958436..f4940f5b4f 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotStatisticsListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotStatisticsListenerManager.kt @@ -2,7 +2,7 @@ package com.mogo.eagle.core.function.call.autopilot import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatisticsListener import com.mogo.eagle.core.function.call.base.CallerBase -import com.zhidao.support.adas.high.bean.AutopilotStatistics +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics object CallerAutopilotStatisticsListenerManager : CallerBase() { diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerGaoDeMapLocationListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerGaoDeMapLocationListenerManager.kt new file mode 100644 index 0000000000..5c0f09e2dd --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerGaoDeMapLocationListenerManager.kt @@ -0,0 +1,24 @@ +package com.mogo.eagle.core.function.call.map + +import com.mogo.eagle.core.data.map.MogoLocation +import com.mogo.eagle.core.function.api.map.listener.IGaoDeMapLocationListener +import com.mogo.eagle.core.function.call.base.CallerBase + +/** + * 高德地图定位监听 + */ +object CallerGaoDeMapLocationListenerManager : CallerBase() { + + /** + * 高德位置改变监听 + */ + @Synchronized + fun invokeMoGoLocationChanged(location: MogoLocation) { + M_LISTENERS.forEach { + val tag = it.key + val listener = it.value + listener.onMoGoLocationChanged(location) + } + } + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt index 1c5104a623..6db8e65512 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapUIServiceManager.kt @@ -36,7 +36,7 @@ object CallerMapUIServiceManager { } fun isCityDataCached(): Boolean { - return serviceProvider?.mapUIController?.isCityDataCached ?: true + return serviceProvider?.mapUIController?.isCityDataCached ?: false } fun getOverlayManager(): IMogoOverlayManager?{ @@ -46,4 +46,8 @@ object CallerMapUIServiceManager { fun getGDLocationServer(context: Context): IMogoGDLocationClient?{ return serviceProvider?.getGDLocationServer(context) } + + fun cancelDownloadCacheData() { + serviceProvider?.mapUIController?.cancelDownloadCacheData() + } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 84fbc00de8..0af01e8d99 100644 --- a/gradle.properties +++ b/gradle.properties @@ -85,7 +85,7 @@ MOGO_LOCATION_VERSION=1.4.4.7 MOGO_TELEMATIC_VERSION=1.4.4.7 ######## MogoAiCloudSDK Version ######## # 自研地图 -MAP_SDK_VERSION=2.10.0.2_test_01 +MAP_SDK_VERSION=2.10.0.9 MAP_SDK_OPERATION_VERSION=1.1.4.1 # websocket WEBSOCKET_VERSION=1.1.7 diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/bean/AutopilotStatistics.java b/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/AutopilotStatistics.java similarity index 55% rename from libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/bean/AutopilotStatistics.java rename to libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/AutopilotStatistics.java index c7aff7feee..487e386140 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/bean/AutopilotStatistics.java +++ b/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/data/bean/AutopilotStatistics.java @@ -1,23 +1,38 @@ -package com.zhidao.support.adas.high.bean; +package com.zhjt.mogo.adas.data.bean; -import com.zhidao.support.adas.high.common.Define; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; /** - * 自动驾驶启动统计 todo 凤坤,后续封装成pb,或者放入adas-data + * 自动驾驶启动统计 */ public class AutopilotStatistics { + /** + * 启动自动驾驶后的状态 + */ + public interface AUTOPILOT_START_STATUS { + /** + * 成功 + */ + int SUCCESSFUL = 0; + /** + * 失败 + */ + int FAILED = 1; + /** + * 取消 + */ + int CANCEL = 2; + } /** * 启动自动驾驶后状态 * 0 成功 * 1 失败 * 2 取消 - * {@link com.zhidao.support.adas.high.common.Constants.AUTOPILOT_START_STATUS} + * {@link AUTOPILOT_START_STATUS} */ - @Define.AutopilotStartStatus public final int status; /** @@ -36,7 +51,7 @@ public class AutopilotStatistics { */ public final MogoReportMsg.MogoReportMessage failedMessage; - public AutopilotStatistics(@Define.AutopilotStartStatus int status, long usedTime, MessagePad.SetAutopilotModeReq req, MogoReportMsg.MogoReportMessage failedMessage) { + public AutopilotStatistics(int status, long usedTime, MessagePad.SetAutopilotModeReq req, MogoReportMsg.MogoReportMessage failedMessage) { this.status = status; this.usedTime = usedTime; this.req = req; diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java index 298d893a2c..b174d75da2 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java @@ -21,7 +21,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.protobuf.InvalidProtocolBufferException; -import com.zhidao.support.adas.high.bean.AutopilotStatistics; +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics; import com.zhidao.support.adas.high.bean.VersionCompatibility; import com.zhidao.support.adas.high.common.AutopilotReview; import com.zhidao.support.adas.high.common.ByteUtil; diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java index ff3d6b8b67..8a5318bf1e 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java @@ -1,7 +1,7 @@ package com.zhidao.support.adas.high; import com.mogo.support.obu.ObuScene; -import com.zhidao.support.adas.high.bean.AutopilotStatistics; +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics; import com.zhidao.support.adas.high.common.ProtocolStatus; import bag_manager.BagManagerOuterClass; diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/AutopilotReview.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/AutopilotReview.java index 16f62686fd..3ad3ca761b 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/AutopilotReview.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/AutopilotReview.java @@ -4,7 +4,8 @@ import android.os.SystemClock; import androidx.annotation.NonNull; -import com.zhidao.support.adas.high.bean.AutopilotStatistics; + +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics; import java.util.Timer; import java.util.TimerTask; @@ -60,7 +61,7 @@ public class AutopilotReview { startReq = req; startTime = SystemClock.elapsedRealtime(); } else { - onCallback(Constants.AUTOPILOT_START_STATUS.CANCEL); + onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL); } } @@ -72,7 +73,7 @@ public class AutopilotReview { public void onReportResult(MogoReportMsg.MogoReportMessage message) { if (startReq != null && message != null) { failedMessage = message; - onCallback(Constants.AUTOPILOT_START_STATUS.FAILED); + onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED); } } @@ -83,7 +84,7 @@ public class AutopilotReview { */ public void onAutopilotResult(MessagePad.AutopilotState state) { if (startReq != null && state != null && state.getState() == 2) { - onCallback(Constants.AUTOPILOT_START_STATUS.SUCCESSFUL); + onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCESSFUL); } } } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/Constants.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/Constants.java index 2591484ac9..503d7f8eb2 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/Constants.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/Constants.java @@ -110,23 +110,6 @@ public class Constants { } - /** - * 启动自动驾驶后的状态 - */ - public interface AUTOPILOT_START_STATUS { - /** - * 成功 - */ - int SUCCESSFUL = 0; - /** - * 失败 - */ - int FAILED = 1; - /** - * 取消 - */ - int CANCEL = 2; - } /** * 使用底盘数据类型 diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/Define.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/Define.java index 4ef4b6830c..598ccc3f8c 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/Define.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/Define.java @@ -3,6 +3,7 @@ package com.zhidao.support.adas.high.common; import androidx.annotation.IntDef; import com.zhidao.support.adas.high.bean.VersionCompatibility; +import com.zhjt.mogo.adas.data.bean.AutopilotStatistics; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -47,9 +48,9 @@ public final class Define { public @interface SubscribeType { } - @IntDef(flag = true, value = {Constants.AUTOPILOT_START_STATUS.SUCCESSFUL, - Constants.AUTOPILOT_START_STATUS.FAILED, - Constants.AUTOPILOT_START_STATUS.CANCEL}) + @IntDef(flag = true, value = {AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCESSFUL, + AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED, + AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL}) @Retention(RetentionPolicy.SOURCE) public @interface AutopilotStartStatus { } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt b/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt index 4761e40fff..9492c60ba7 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/hdcache/IHdCacheListener.kt @@ -2,4 +2,6 @@ package com.mogo.map.hdcache interface IHdCacheListener { fun onMapHdCacheProgress(cityId: Int, progress: Double) + + fun onMapHdCacheResult(cityId: Int, state: Int)// 0失败,1成功 } \ No newline at end of file diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index 8235fe8a36..93093c74f7 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -358,4 +358,6 @@ public interface IMogoMapUIController { * @return */ boolean isCityDataCached(); + + void cancelDownloadCacheData(); } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java index 68c15404f3..09aea37182 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java @@ -58,6 +58,7 @@ import com.mogo.map.utils.ResIdCache; import com.zhidaoauto.map.sdk.open.MapAutoApi; import com.zhidaoauto.map.sdk.open.abs.MapStatusListener; import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener; +import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener; import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener; import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener; import com.zhidaoauto.map.sdk.open.abs.OnMapStyleListener; @@ -1051,17 +1052,35 @@ public class AMapViewWrapper implements IMogoMapView, Integer id = HDMapUtils.getHDCityCode(gdCityCode); if (id != null) { hdCacheListener = listener; - mMapView.getMapAutoViewHelper().cacheHDDataByCity(id, (cityId, progress) -> { - if (Thread.currentThread() == Looper.getMainLooper().getThread()) { - if (hdCacheListener != null) { - hdCacheListener.onMapHdCacheProgress(cityId, progress * 100); - } - } else { - UiThreadHandler.post(() -> { + mMapView.getMapAutoViewHelper().cacheHDDataByCity(id, new OnHdDataDownByCityListener() { + @Override + public void onMapHDDataCacheProgressByCity(int cityId, double progress) { + if (Thread.currentThread() == Looper.getMainLooper().getThread()) { if (hdCacheListener != null) { hdCacheListener.onMapHdCacheProgress(cityId, progress * 100); } - }); + } else { + UiThreadHandler.post(() -> { + if (hdCacheListener != null) { + hdCacheListener.onMapHdCacheProgress(cityId, progress * 100); + } + }); + } + } + + @Override + public void onMapHDDataCacheStateByCity(int i, int state) {// 0失败,1成功 + if (Thread.currentThread() == Looper.getMainLooper().getThread()) { + if (hdCacheListener != null) { + hdCacheListener.onMapHdCacheResult(i, state); + } + } else { + UiThreadHandler.post(() -> { + if (hdCacheListener != null) { + hdCacheListener.onMapHdCacheResult(i, state); + } + }); + } } }); } @@ -1084,6 +1103,13 @@ public class AMapViewWrapper implements IMogoMapView, } } } - return true; + return false; + } + + @Override + public void cancelDownloadCacheData() { + if (mMapView.getMapAutoViewHelper() != null) { + mMapView.getMapAutoViewHelper().cancelCacheHDData(); + } } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index fbbb4ab578..9554442fea 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -464,6 +464,13 @@ public class MogoMapUIController implements IMogoMapUIController { if (mDelegate != null) { return mDelegate.isCityDataCached(); } - return true; + return false; + } + + @Override + public void cancelDownloadCacheData() { + if (mDelegate != null) { + mDelegate.cancelDownloadCacheData(); + } } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java deleted file mode 100644 index 2dfa892d3d..0000000000 --- a/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.mogo.map.location; - -import android.content.Context; - -import com.amap.api.location.AMapLocation; -import com.amap.api.location.AMapLocationClient; -import com.amap.api.location.AMapLocationClientOption; -import com.amap.api.location.AMapLocationListener; -import com.mogo.commons.AbsMogoApplication; -import com.mogo.commons.constants.SharedPrefsConstants; -import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; - -/** - * 封装高德地图通过设备GPS获取到的位置信息,频率1s一次,坐标系为CJC20 - * 这里的数据仅用于非高精度业务 - */ -public class GDLocationClient implements AMapLocationListener, IMogoGDLocationClient { - - private volatile static GDLocationClient gdLocationClient; - private static final byte[] obj = new byte[0]; - - public static GDLocationClient getInstance(Context context) { - if (gdLocationClient == null) { - synchronized (obj) { - if (gdLocationClient == null) { - gdLocationClient = new GDLocationClient(context); - } - } - } - return gdLocationClient; - } - - //声明LocationClient对象 - private AMapLocationClient mLocationClient; - private String mCityCode; - private AMapLocation mapLocation; - - private GDLocationClient(Context context) { - AMapLocationClient.updatePrivacyShow(context, true, true); - AMapLocationClient.updatePrivacyAgree(context, true); - try { - mLocationClient = new AMapLocationClient(context); - - //初始化定位参数 - //声明mLocationOption对象 - AMapLocationClientOption mLocationOption = new AMapLocationClientOption(); - //设置定位监听 - mLocationClient.setLocationListener(this); - //设置定位模式为高精度模式,Battery_Saving为低功耗模式,Device_Sensors是仅设备模式 - mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy); - //设置定位间隔,单位毫秒,默认为2000ms - mLocationOption.setInterval(1000); - //设置定位参数 - mLocationClient.setLocationOption(mLocationOption); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void start() { - if (mLocationClient != null) { - mLocationClient.startLocation(); - } - } - - @Override - public void stop() { - if (mLocationClient != null) { - mLocationClient.stopLocation(); - } - } - - @Override - public void onLocationChanged(AMapLocation aMapLocation) { - if (aMapLocation != null) { - mapLocation = aMapLocation; - String cityCode = aMapLocation.getCityCode(); - if (cityCode != null && !cityCode.isEmpty()) { - mCityCode = aMapLocation.getCityCode(); - SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()) - .putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode); - } - } - } - - @Override - public String getLastCityCode() { - return mCityCode; - } - - @Override - public double getLastLat() { - return mapLocation != null ? mapLocation.getLatitude() : 0.0; - } - - @Override - public double getLastLon() { - return mapLocation != null ? mapLocation.getLongitude() : 0.0; - } -} diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.kt b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.kt new file mode 100644 index 0000000000..8945ded1cf --- /dev/null +++ b/libraries/mogo-map/src/main/java/com/mogo/map/location/GDLocationClient.kt @@ -0,0 +1,147 @@ +package com.mogo.map.location + +import android.content.Context +import com.amap.api.location.AMapLocation +import com.amap.api.location.AMapLocationClient +import com.amap.api.location.AMapLocationClientOption +import com.amap.api.location.AMapLocationListener +import com.mogo.commons.AbsMogoApplication +import com.mogo.commons.constants.SharedPrefsConstants +import com.mogo.eagle.core.data.map.MogoLocation +import com.mogo.eagle.core.function.call.map.CallerGaoDeMapLocationListenerManager +import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr +import com.mogo.eagle.core.utilcode.util.CoordinateTransform +import com.mogo.eagle.core.utilcode.util.TimeUtils + +/** + * 封装高德地图通过设备GPS获取到的位置信息,频率1s一次,坐标系为CJC20 + * 这里的数据仅用于非高精度业务 + */ +class GDLocationClient private constructor(context: Context) : AMapLocationListener, + IMogoGDLocationClient { + //声明LocationClient对象 + private lateinit var mLocationClient: AMapLocationClient + private var mCityCode: String = "" + private var mapLocation: AMapLocation? = null + + /** + * 最后一次高德定位返回的位置信息 + */ + private var lastGaoDeLocation: MogoLocation = MogoLocation() + + init { + AMapLocationClient.updatePrivacyShow(context, true, true) + AMapLocationClient.updatePrivacyAgree(context, true) + try { + mLocationClient = AMapLocationClient(context) + + //初始化定位参数 + //声明mLocationOption对象 + val mLocationOption = AMapLocationClientOption() + //设置定位监听 + mLocationClient.setLocationListener(this) + //设置定位模式为高精度模式,Battery_Saving为低功耗模式,Device_Sensors是仅设备模式 + mLocationOption.locationMode = AMapLocationClientOption.AMapLocationMode.Hight_Accuracy + //设置定位间隔,单位毫秒,默认为2000ms + mLocationOption.interval = 1000 + //设置定位参数 + mLocationClient.setLocationOption(mLocationOption) + } catch (e: Exception) { + e.printStackTrace() + } + } + + override fun start() { + if (mLocationClient != null) { + mLocationClient.startLocation() + } + } + + override fun stop() { + if (mLocationClient != null) { + mLocationClient.stopLocation() + } + } + + override fun onLocationChanged(aMapLocation: AMapLocation) { + // 更新GNSS 信息 + lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills() + + // 将高德中的一些用于业务的数据进行融合,例如:CityCode、address等 + mapLocation?.let { + // 转换 GCJ02-->WGS84 坐标 + val wgs84Location = + CoordinateTransform.GCJ02ToWGS84(it.longitude, it.latitude) + + lastGaoDeLocation.longitude = wgs84Location[0] + lastGaoDeLocation.latitude = wgs84Location[1] + lastGaoDeLocation.heading = it.bearing.toDouble() + lastGaoDeLocation.gnssSpeed = it.speed + lastGaoDeLocation.altitude = it.altitude + lastGaoDeLocation.satelliteTime = it.time + lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills() + + lastGaoDeLocation.locType = 1 // 定位类型为高德坐标(网路或者硬件定位) + lastGaoDeLocation.satellite = 4 + + lastGaoDeLocation.cityName = it.city + lastGaoDeLocation.cityCode = it.cityCode + lastGaoDeLocation.provider = it.provider + lastGaoDeLocation.address = it.address + lastGaoDeLocation.district = it.district + lastGaoDeLocation.province = it.province + lastGaoDeLocation.adCode = it.adCode + lastGaoDeLocation.locationDetail = it.locationDetail + lastGaoDeLocation.poiName = it.poiName + lastGaoDeLocation.aoiName = it.aoiName + lastGaoDeLocation.street = it.street + lastGaoDeLocation.streetNum = it.streetNum + lastGaoDeLocation.description = it.description + lastGaoDeLocation.buildingId = it.buildingId + lastGaoDeLocation.floor = it.floor + lastGaoDeLocation.errorCode = it.errorCode + lastGaoDeLocation.errorInfo = it.errorInfo + } + + // 回掉给监听者 + CallerGaoDeMapLocationListenerManager.invokeMoGoLocationChanged(lastGaoDeLocation) + + mapLocation = aMapLocation + val cityCode = aMapLocation.cityCode + if (cityCode != null && !cityCode.isEmpty()) { + mCityCode = aMapLocation.cityCode + SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()) + .putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode) + } + } + + override fun getLastCityCode(): String { + return mCityCode + } + + override fun getLastLat(): Double { + return if (mapLocation != null) mapLocation!!.latitude else 0.0 + } + + override fun getLastLon(): Double { + return if (mapLocation != null) mapLocation!!.longitude else 0.0 + } + + companion object { + @Volatile + private var gdLocationClient: GDLocationClient? = null + private val obj = ByteArray(0) + + @JvmStatic + fun getInstance(context: Context): GDLocationClient? { + if (gdLocationClient == null) { + synchronized(obj) { + if (gdLocationClient == null) { + gdLocationClient = GDLocationClient(context) + } + } + } + return gdLocationClient + } + } +} \ No newline at end of file diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java index f48f36cc66..090f1ccbd4 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/uicontroller/AMapUIController.java @@ -403,6 +403,13 @@ public class AMapUIController implements IMogoMapUIController { if (mClient != null) { return mClient.isCityDataCached(); } - return true; + return false; + } + + @Override + public void cancelDownloadCacheData() { + if (mClient != null) { + mClient.cancelDownloadCacheData(); + } } }