Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0'
Dev arch opt 3.0 See merge request zhjt/AndroidApp/MoGoEagleEye!581
This commit is contained in:
@@ -47,15 +47,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<!--刹车、转向-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
|
||||
android:layout_width="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:day_light_mode="true"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<!--pnc行为决策-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -50,14 +50,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--刹车、转向-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--Vip车辆标志-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
|
||||
android:layout_width="@dimen/module_vip_width"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -37,14 +37,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--刹车、转向-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--Vip车辆标志-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
|
||||
android:layout_width="@dimen/module_vip_width"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -45,15 +45,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<!--刹车、转向-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
|
||||
android:layout_width="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:day_light_mode="true"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<!--pnc行为决策-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -107,14 +107,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--刹车、转向-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--Vip车辆标志-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
|
||||
android:layout_width="@dimen/module_vip_width"
|
||||
|
||||
@@ -14,7 +14,6 @@ repositories {
|
||||
mogo-och 使用到的依赖
|
||||
implementation "com.mogo.commons:mogo-utils:2.0.63"
|
||||
implementation "com.mogo.commons:mogo-commons:2.0.63"
|
||||
implementation "com.mogo.module:module-common:2.0.63"
|
||||
|
||||
implementation "com.mogo.eagle.core:data:0.0.6"
|
||||
implementation "com.mogo.eagle.core.function:call:0.0.6"
|
||||
|
||||
@@ -325,7 +325,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_map
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_v2x
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_datacenter
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_devatools
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_chat
|
||||
|
||||
@@ -104,7 +104,7 @@ object ConfigStartUp {
|
||||
}
|
||||
|
||||
val mapParams = MapParams.init()
|
||||
mapParams.setDebugMode(false) //todo 1-使用本地地图数据,0-使用在线地图数据
|
||||
mapParams.setDebugMode(false) // 1-使用本地地图数据,0-使用在线地图数据
|
||||
//.setDataFileSource(1)
|
||||
.setDebugMode(false)
|
||||
.setCoordinateType(MapParams.COORDINATETYPE_GCJ02)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -125,10 +125,6 @@ ext {
|
||||
mogocustommap : "com.zhidaoauto.machine:map:${MAP_SDK_VERSION}",
|
||||
mogocustommapoperational : "com.zhidaoauto.map:operational:${MAP_SDK_OPERATION_VERSION}",
|
||||
|
||||
modulemap : "com.mogo.module:module-map:${MOGO_MODULE_MAP_VERSION}",
|
||||
|
||||
// V2X
|
||||
moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}",
|
||||
// 基础服务实现
|
||||
mogowebsocket : "com.mogo.module.carchatting:module-carchatt-socket:${WEBSOCKET_VERSION}",
|
||||
mogologlib : "com.mogo.module:module-loglib:${LOGLIB_VERSION}",
|
||||
@@ -169,8 +165,6 @@ ext {
|
||||
mogo_core_function_devatools : "com.mogo.eagle.core.function.impl:devatools:${MOGO_CORE_FUNCTION_DEVATOOLS_VERSION}",
|
||||
mogo_core_function_hmi : "com.mogo.eagle.core.function.impl:hmi:${MOGO_CORE_FUNCTION_HMI_VERSION}",
|
||||
mogo_core_function_map : "com.mogo.eagle.core.function.impl:map:${MOGO_CORE_FUNCTION_MAP_VERSION}",
|
||||
mogo_core_function_obu_mogo : "com.mogo.eagle.core.function.impl:obu-mogo:${MOGO_CORE_FUNCTION_OBU_MOGO_VERSION}",
|
||||
mogo_core_function_v2x : "com.mogo.eagle.core.function.impl:v2x:${MOGO_CORE_FUNCTION_V2X_VERSION}",
|
||||
mogo_core_function_api : "com.mogo.eagle.core.function:api:${MOGO_CORE_FUNCTION_API_VERSION}",
|
||||
mogo_core_function_call : "com.mogo.eagle.core.function:call:${MOGO_CORE_FUNCTION_CALL_VERSION}",
|
||||
mogo_core_data : "com.mogo.eagle.core:data:${MOGO_CORE_DATA_VERSION}",
|
||||
|
||||
@@ -20,6 +20,6 @@ public class V2XConst {
|
||||
/**
|
||||
* V2X预警日志tag
|
||||
*/
|
||||
public static final String LOG_NAME_WARN = "liyz";
|
||||
public static final String LOG_NAME_WARN = "PersonWarn";
|
||||
|
||||
}
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 :
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,16 +2,13 @@ package com.mogo.eagle.core.function.datacenter.obu
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuProvider
|
||||
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_OBU
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.CommonUtils
|
||||
import com.mogo.support.obu.MogoObuManager
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
|
||||
@@ -6,16 +6,12 @@ import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||
import com.mogo.eagle.core.data.enums.TrafficLightEnum
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningMapListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsmListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningSpatListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.call.obu.*
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
|
||||
@@ -4,18 +4,13 @@ import android.content.Context
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.*
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.api.map.angle.Default
|
||||
import com.mogo.eagle.core.function.api.map.angle.TooClose
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
|
||||
@@ -856,10 +851,6 @@ class MogoPrivateObuNewManager private constructor() {
|
||||
1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
|
||||
if (!isShowRunRedLight) {
|
||||
isShowRunRedLight = true
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
|
||||
"changeTrafficLightStatus 闯红灯 --------> "
|
||||
)
|
||||
ttsContent =
|
||||
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
|
||||
alertContent =
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -7,18 +7,33 @@ import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.view.KeyEvent
|
||||
import com.mogo.commons.context.ContextHolderUtil
|
||||
import com.mogo.eagle.core.data.mofang.MfConstants
|
||||
import com.mogo.eagle.core.function.api.mofang.IMoGoMoFangListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorChangeLaneLeft
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorChangeLaneRight
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorSetAcceleratedSpeed
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorSetHorn
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.startAutoPilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager.invokeMoFangStatus
|
||||
import com.mogo.eagle.core.function.call.mofang.CallerMofangListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_F
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import java.util.*
|
||||
|
||||
|
||||
/**
|
||||
* 魔方连接状态和设备管理
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
class MoFangManager private constructor() {
|
||||
class MoFangManager private constructor() : IMoGoMoFangListener{
|
||||
|
||||
companion object {
|
||||
val moFangManager: MoFangManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
@@ -31,6 +46,29 @@ class MoFangManager private constructor() {
|
||||
private lateinit var mBluetoothAdapter: BluetoothAdapter
|
||||
private var isMfConnect: Boolean = false //添加状态判断
|
||||
|
||||
private val isShowToast = false //toast 控制,自测使用
|
||||
private var startPressTime: Long = 0 //开始按键时间
|
||||
private var isPressEnd = false //按键是否结束
|
||||
@Volatile
|
||||
private var isCombinationKey = 0 //是否是组合按键 1单击,2长按,3组合
|
||||
private var pressADownTime: Long = 0
|
||||
private var pressAUpTime: Long = 0
|
||||
private var pressBDownTime: Long = 0
|
||||
private var pressBUpTime: Long = 0
|
||||
private var pressCDownTime: Long = 0
|
||||
private var pressCUpTime: Long = 0
|
||||
private var pressDDownTime: Long = 0
|
||||
private var pressDUpTime: Long = 0
|
||||
private var pressEDownTime: Long = 0
|
||||
private var pressEUpTime: Long = 0
|
||||
|
||||
private val clickTime = 300 //单击
|
||||
private val clickTimeInterval = 330
|
||||
private val longPressTime = 670
|
||||
private val longPressTimeInterval = 700
|
||||
private var timerHorn: Timer? = null
|
||||
private var timerAcc: Timer? = null
|
||||
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context
|
||||
@@ -41,6 +79,12 @@ class MoFangManager private constructor() {
|
||||
}
|
||||
mBluetoothAdapter.startDiscovery()
|
||||
showBondedDevice(mBluetoothAdapter)
|
||||
|
||||
CallerMofangListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
fun release() {
|
||||
CallerMofangListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +133,7 @@ class MoFangManager private constructor() {
|
||||
private val bluetoothMonitorReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
when (intent.action) {
|
||||
BluetoothAdapter.ACTION_STATE_CHANGED -> { //中间状态 TODO
|
||||
BluetoothAdapter.ACTION_STATE_CHANGED -> { //中间状态
|
||||
CallerLogger.d("$M_F${TAG}","bluetoothMonitorReceiver ACTION_STATE_CHANGED action = ${intent.action}")
|
||||
}
|
||||
|
||||
@@ -115,5 +159,190 @@ class MoFangManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 魔方按键处理
|
||||
*/
|
||||
override fun onMofangHandle(keyCode: Int, action: Int): Boolean {
|
||||
val bluetoothName = SharedPrefsMgr.getInstance(ContextHolderUtil.getContext()).getString(MfConstants.BLUETOOTH_NAME)
|
||||
if (bluetoothName == "MINI_KEYBOARD") {
|
||||
if (!isPressEnd) {
|
||||
isPressEnd = true
|
||||
startPressTime = System.currentTimeMillis()
|
||||
}
|
||||
e(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent ------ bluetoothName = $bluetoothName ---code = $keyCode -----action = $action ")
|
||||
if (keyCode == KeyEvent.KEYCODE_A) { //单击 -1,长按无操作,AB组合-2
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
pressADownTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime)
|
||||
if (pressADownTime - startPressTime in (clickTimeInterval + 1) until longPressTime && pressBDownTime > 0) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 A 按AB组合 +1 ")
|
||||
}
|
||||
sendAcc(true, +1.0)
|
||||
isCombinationKey = 3
|
||||
}
|
||||
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
||||
if (pressADownTime - startPressTime > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按A -2 ")
|
||||
}
|
||||
sendAcc(true, -2.0)
|
||||
isCombinationKey = 2
|
||||
}
|
||||
}
|
||||
} else if (action == KeyEvent.ACTION_UP) {
|
||||
pressAUpTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime + "---isCombinationKey = $isCombinationKey")
|
||||
if (pressAUpTime - startPressTime < clickTime && isCombinationKey != 3) {
|
||||
isCombinationKey = 1
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击A -1 ")
|
||||
}
|
||||
sendAcc(true, -1.0)
|
||||
}
|
||||
pressADownTime = 0
|
||||
isPressEnd = false
|
||||
UiThreadHandler.postDelayed({ isCombinationKey = 0 }, 300)
|
||||
}
|
||||
} else if (keyCode == KeyEvent.KEYCODE_B) { //单击复原,长按+1,AB组合-2
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
pressBDownTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime
|
||||
)
|
||||
if (pressBDownTime - startPressTime > clickTimeInterval && pressBDownTime - startPressTime < longPressTime && pressADownTime > 0) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 B 按AB组合 +1 ")
|
||||
}
|
||||
sendAcc(true, +1.0)
|
||||
isCombinationKey = 3
|
||||
}
|
||||
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
||||
if (pressBDownTime - startPressTime > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按B 无操作 ")
|
||||
}
|
||||
isCombinationKey = 2
|
||||
}
|
||||
}
|
||||
} else if (action == KeyEvent.ACTION_UP) {
|
||||
pressBUpTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime + "----isCombinationKey = $isCombinationKey")
|
||||
if (pressBUpTime - startPressTime < clickTime && isCombinationKey != 3) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击B 0 ")
|
||||
}
|
||||
sendAcc(false, 0.0)
|
||||
isCombinationKey = 1
|
||||
}
|
||||
pressBDownTime = 0
|
||||
isPressEnd = false
|
||||
UiThreadHandler.postDelayed({ isCombinationKey = 0 }, 300)
|
||||
}
|
||||
} else if (keyCode == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
pressCDownTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime))
|
||||
if (pressCDownTime - startPressTime > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按C 无操作 ")
|
||||
}
|
||||
}
|
||||
} else if (action == KeyEvent.ACTION_UP) {
|
||||
pressCUpTime = System.currentTimeMillis()
|
||||
isPressEnd = false
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime))
|
||||
if (pressCUpTime - startPressTime < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击C ← 向左变道 ")
|
||||
}
|
||||
sendOperatorChangeLaneLeft()
|
||||
}
|
||||
}
|
||||
} else if (keyCode == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
pressDDownTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime))
|
||||
if (pressDDownTime - startPressTime > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按D 无操作 ")
|
||||
}
|
||||
}
|
||||
} else if (action == KeyEvent.ACTION_UP) {
|
||||
pressDUpTime = System.currentTimeMillis()
|
||||
isPressEnd = false
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime))
|
||||
if (pressDUpTime - startPressTime < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击D → 向右变道 ")
|
||||
}
|
||||
sendOperatorChangeLaneRight()
|
||||
}
|
||||
}
|
||||
} else if (keyCode == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
pressEDownTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime))
|
||||
if (pressEDownTime - startPressTime > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按E 鸣笛 ")
|
||||
}
|
||||
sendOperatorSetHorn(1.0)
|
||||
if (timerHorn == null) {
|
||||
timerHorn = Timer()
|
||||
}
|
||||
timerHorn!!.schedule(object : TimerTask() {
|
||||
override fun run() {
|
||||
sendOperatorSetHorn(2.0)
|
||||
timerHorn = null
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
} else if (action == KeyEvent.ACTION_UP) {
|
||||
pressEUpTime = System.currentTimeMillis()
|
||||
isPressEnd = false
|
||||
d(M_F + "MoFangManager",
|
||||
"方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime))
|
||||
if (pressEUpTime - startPressTime < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击E 开启自动驾驶 ")
|
||||
}
|
||||
startAutoPilot(getAutoPilotStatusInfo().autopilotControlParameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private fun sendAcc(isSend: Boolean, acc: Double) {
|
||||
if (isSend) {
|
||||
if (timerAcc == null) {
|
||||
timerAcc = Timer()
|
||||
timerAcc!!.schedule(object : TimerTask() {
|
||||
override fun run() {
|
||||
sendOperatorSetAcceleratedSpeed(acc)
|
||||
}
|
||||
}, 0, 500)
|
||||
}
|
||||
} else {
|
||||
if (timerAcc != null) {
|
||||
timerAcc!!.cancel()
|
||||
timerAcc = null
|
||||
}
|
||||
sendOperatorSetAcceleratedSpeed(acc)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -672,11 +672,6 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = isChecked
|
||||
}
|
||||
|
||||
//TODO
|
||||
tbIsDrawPath.setOnCheckedChangeListener { _, isChecked ->
|
||||
|
||||
}
|
||||
|
||||
// 初始化 GSP数据源 数据
|
||||
rgGpsProvider.check(
|
||||
when (FunctionBuildConfig.gpsProvider) {
|
||||
|
||||
@@ -117,7 +117,6 @@ internal class SOPSettingView @JvmOverloads constructor(
|
||||
tbObuToDcView.setOnCheckedChangeListener { _, isChecked ->
|
||||
// 默认开启
|
||||
HmiBuildConfig.isShowObuToDcV2iView = !isChecked
|
||||
// Log.d("liyz", "HmiBuildConfig.isShowObuToDcV2iView = " + HmiBuildConfig.isShowObuToDcV2iView)
|
||||
}
|
||||
|
||||
//红绿灯标识
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.main;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_START_UP;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_INIT;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_F;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
@@ -21,20 +20,15 @@ import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener;
|
||||
import com.mogo.commons.module.intent.IntentManager;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.mofang.MfConstants;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.mofang.CallerMofangListenerManager;
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.rousetime.android_startup.model.CostTimesModel;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
import com.zhjt.service.chain.TracingConstants;
|
||||
@@ -43,8 +37,6 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* 针对作为Launcher的情况,做个性化操作
|
||||
@@ -57,31 +49,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
private final static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
|
||||
private volatile double accelerated;//加速度
|
||||
private Timer timerHorn;
|
||||
private Timer timerAcc;
|
||||
|
||||
private boolean isShowToast = false; //toast 控制
|
||||
private long startPressTime = 0; //开始按减时间
|
||||
private boolean isPressEnd = false; //按键是否结束
|
||||
private volatile int isCombinationKey = 0; //是否是组合按键 1单击,2长按,3组合
|
||||
private long pressADownTime = 0;
|
||||
private long pressAUpTime = 0;
|
||||
private long pressBDownTime = 0;
|
||||
private long pressBUpTime = 0;
|
||||
private long pressCDownTime = 0;
|
||||
private long pressCUpTime = 0;
|
||||
private long pressDDownTime = 0;
|
||||
private long pressDUpTime = 0;
|
||||
private long pressEDownTime = 0;
|
||||
private long pressEUpTime = 0;
|
||||
|
||||
private int clickTime = 300; //单击
|
||||
private int clickTimeInterval = 330;
|
||||
private int longPressTime = 670;
|
||||
private int longPressTimeInterval = 700;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -240,200 +207,15 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
*/
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent code = " + event.getKeyCode() + "--action = " + event.getAction() + "----" + event);
|
||||
String bluetoothName = SharedPrefsMgr.getInstance(getContext()).getString(MfConstants.BLUETOOTH_NAME);
|
||||
if (!isPressEnd) {
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---1--- bluetoothName = " + bluetoothName);
|
||||
if(CallerMofangListenerManager.INSTANCE.invokeMofangHandle(event.getKeyCode(), event.getAction())) {
|
||||
return true;
|
||||
} else {
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
if (bluetoothName.equals("MINI_KEYBOARD")) {
|
||||
if (!isPressEnd) {
|
||||
isPressEnd = true;
|
||||
startPressTime = System.currentTimeMillis();
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager","dispatchKeyEvent ---2--- bluetoothName = " + bluetoothName + "--- code = " + event.getKeyCode() + "--action = " + event.getAction());
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_A) { //单击 -1,长按无操作,AB组合-2
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressADownTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime);
|
||||
if ((pressADownTime - startPressTime) > clickTimeInterval && (pressADownTime - startPressTime) < longPressTime && pressBDownTime > 0) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 A 按AB组合 +1 ");
|
||||
}
|
||||
sendAcc(true, +1);
|
||||
isCombinationKey = 3;
|
||||
}
|
||||
|
||||
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
||||
if ((pressADownTime - startPressTime) > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按A -2 ");
|
||||
}
|
||||
sendAcc(true, -2);
|
||||
isCombinationKey = 2;
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressAUpTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime);
|
||||
if ((pressAUpTime - startPressTime) < clickTime && isCombinationKey != 3) {
|
||||
isCombinationKey = 1;
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击A -1 ");
|
||||
}
|
||||
sendAcc(true, -1);
|
||||
}
|
||||
pressADownTime = 0;
|
||||
isPressEnd = false;
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
isCombinationKey = 0;
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_B) { //单击复原,长按+1,AB组合-2
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressBDownTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime);
|
||||
if ((pressBDownTime - startPressTime) > clickTimeInterval && (pressBDownTime - startPressTime) < longPressTime && pressADownTime > 0) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 B 按AB组合 +1 ");
|
||||
}
|
||||
sendAcc(true, +1);
|
||||
isCombinationKey = 3;
|
||||
}
|
||||
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
||||
if ((pressBDownTime - startPressTime) > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按B 无操作 ");
|
||||
}
|
||||
isCombinationKey = 2;
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressBUpTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime);
|
||||
if ((pressBUpTime - startPressTime) < clickTime && isCombinationKey != 3) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击B 0 ");
|
||||
}
|
||||
sendAcc(false, 0.0);
|
||||
isCombinationKey = 1;
|
||||
}
|
||||
pressBDownTime = 0;
|
||||
isPressEnd = false;
|
||||
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
isCombinationKey = 0;
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressCDownTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime));
|
||||
if ((pressCDownTime - startPressTime) > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按C 无操作 ");
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressCUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime));
|
||||
if ((pressCUpTime - startPressTime) < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击C ← 向左变道 ");
|
||||
}
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneLeft();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressDDownTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime));
|
||||
if ((pressDDownTime - startPressTime) > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按D 无操作 ");
|
||||
}
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressDUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime));
|
||||
if ((pressDUpTime - startPressTime) < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击D → 向右变道 ");
|
||||
}
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorChangeLaneRight();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (event.getKeyCode() == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
pressEDownTime = System.currentTimeMillis();
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime));
|
||||
if ((pressEDownTime - startPressTime) > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按E 鸣笛 ");
|
||||
}
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(1);
|
||||
if (timerHorn == null) {
|
||||
timerHorn = new Timer();
|
||||
}
|
||||
timerHorn.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetHorn(2);
|
||||
timerHorn = null;
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
} else if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
pressEUpTime = System.currentTimeMillis();
|
||||
isPressEnd = false;
|
||||
CallerLogger.INSTANCE.d(M_F + "MoFangManager", "方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime));
|
||||
if ((pressEUpTime - startPressTime) < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击E 开启自动驾驶 ");
|
||||
}
|
||||
CallerAutoPilotControlManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSkinModeChange(int skinMode) {
|
||||
}
|
||||
|
||||
private synchronized void sendAcc(boolean isSend, double acc) {
|
||||
if (isSend) {
|
||||
accelerated = acc;
|
||||
if (timerAcc == null) {
|
||||
timerAcc = new Timer();
|
||||
timerAcc.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(accelerated);
|
||||
}
|
||||
}, 0, 500);
|
||||
}
|
||||
} else {
|
||||
if (timerAcc != null) {
|
||||
timerAcc.cancel();
|
||||
timerAcc = null;
|
||||
}
|
||||
CallerAutoPilotControlManager.INSTANCE.sendOperatorSetAcceleratedSpeed(acc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
-keep class com.mogo.module.small.map.*{*;}
|
||||
-keep class com.android.internal.policy.MyPhoneLayoutInflater{*;}
|
||||
-keep class com.amap.api.col.n3.*{*;}
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.eagle.core.function.smp.view;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/6/24 11:33 上午
|
||||
*/
|
||||
public interface ISmallMapDirectionView {
|
||||
|
||||
/**
|
||||
* 绘制路径线
|
||||
*/
|
||||
void drawablePolyline();
|
||||
|
||||
/**
|
||||
* 清除路径线
|
||||
*/
|
||||
void clearPolyline();
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.mogo.eagle.core.function.smp.SmallMapDirectionView
|
||||
android:id="@+id/smallMapDirectionView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="30dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -141,8 +141,9 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
}
|
||||
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<Boolean>() {
|
||||
}
|
||||
|
||||
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<Boolean>() {
|
||||
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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
/**
|
||||
* 启动自动驾驶状态统计监听
|
||||
|
||||
@@ -14,5 +14,5 @@ interface IGaoDeMapLocationListener {
|
||||
*
|
||||
* @param location 新定位点
|
||||
*/
|
||||
fun onLocationChanged(location: MogoLocation, from: Int, isGps: Boolean)
|
||||
fun onMoGoLocationChanged(location: MogoLocation)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.eagle.core.function.api.mofang
|
||||
|
||||
|
||||
/**
|
||||
* 魔方数据的数据处理
|
||||
* @author lixiaopeng
|
||||
* @date 2023-02-20
|
||||
*/
|
||||
interface IMoGoMoFangListener {
|
||||
/**
|
||||
* 魔方数据的数据处理
|
||||
* @param keyCode 按键类型
|
||||
* @param action 按键状态
|
||||
*/
|
||||
fun onMofangHandle(keyCode: Int, action: Int): Boolean
|
||||
|
||||
}
|
||||
@@ -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<IMoGoAutopilotStatisticsListener>() {
|
||||
|
||||
|
||||
@@ -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<IGaoDeMapLocationListener>() {
|
||||
|
||||
/**
|
||||
* 高德位置改变监听
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeMoGoLocationChanged(location: MogoLocation) {
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onMoGoLocationChanged(location)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.mogo.eagle.core.function.call.mofang
|
||||
|
||||
import com.mogo.eagle.core.function.api.mofang.IMoGoMoFangListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* 魔方按键的处理
|
||||
*/
|
||||
object CallerMofangListenerManager : CallerBase<IMoGoMoFangListener>() {
|
||||
fun invokeMofangHandle(keyCode: Int, action: Int): Boolean {
|
||||
var isConsume = false
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
if (listener.onMofangHandle(keyCode, action))
|
||||
isConsume = true
|
||||
}
|
||||
return isConsume
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,26 +66,26 @@ SERVICE_BIZ_VERSION=1.2.4
|
||||
LOGLIB_VERSION=1.5.10
|
||||
######## MogoAiCloudSDK Version ########
|
||||
# 网络请求LOGLIB_VERSION
|
||||
MOGO_NETWORK_VERSION=1.4.4.7
|
||||
MOGO_NETWORK_VERSION=1.4.4.8
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.4.4.7
|
||||
MOGO_PASSPORT_VERSION=1.4.4.8
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.4.4.7
|
||||
MOGO_SOCKET_VERSION=1.4.4.8
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.4.4.7
|
||||
MOGO_REALTIME_VERSION=1.4.4.8
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.4.4.7
|
||||
MOGO_TANLU_VERSION=1.4.4.8
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.4.4.7
|
||||
MOGO_LIVE_VERSION=1.4.4.8
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.4.4.7
|
||||
MOGO_TRAFFICLIVE_VERSION=1.4.4.8
|
||||
# 定位服务
|
||||
MOGO_LOCATION_VERSION=1.4.4.7
|
||||
MOGO_LOCATION_VERSION=1.4.4.8
|
||||
# 远程通讯模块
|
||||
MOGO_TELEMATIC_VERSION=1.4.4.7
|
||||
MOGO_TELEMATIC_VERSION=1.4.4.8
|
||||
######## 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
|
||||
@@ -99,8 +99,6 @@ versionName=1.0.2
|
||||
################# 新架构模块Maven版本管理 #################
|
||||
MOGO_CORE_FUNCTION_HMI_VERSION=0.0.58.10
|
||||
MOGO_CORE_FUNCTION_MAP_VERSION=0.0.58.10
|
||||
MOGO_CORE_FUNCTION_OBU_MOGO_VERSION=0.0.58.10
|
||||
MOGO_CORE_FUNCTION_V2X_VERSION=0.0.58.10
|
||||
MOGO_CORE_DATA_VERSION=0.0.58.10
|
||||
MOGO_CORE_FUNCTION_API_VERSION=0.0.58.10
|
||||
MOGO_CORE_FUNCTION_CALL_VERSION=0.0.58.10
|
||||
@@ -113,8 +111,6 @@ MOGO_CORE_NETWORK_VERSION=0.0.58.10
|
||||
MOGO_COMMONS_VERSION=2.1.16.10
|
||||
MOGO_MAP_VERSION=2.1.16.10
|
||||
MOGO_MAP_API_VERSION=2.1.16.10
|
||||
MOGO_MODULE_MAP_VERSION=2.1.16.10
|
||||
MOGO_MODULE_V2X_VERSION=2.1.16.10
|
||||
# obu
|
||||
MOGO_MODULE_OBU_MOGO_VERSION=2.1.16.10
|
||||
# bugly
|
||||
@@ -138,11 +134,6 @@ MOGO_OCH_TAXI_VERSION=2.0.66
|
||||
# mogoAiCloud sdk services
|
||||
MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.16.10
|
||||
|
||||
################# 旧版本架构模块版本 #################
|
||||
|
||||
|
||||
|
||||
|
||||
# ADAS LIB Maven配置(用于地图部门测试使用,鹰眼项目中使用本地依赖) #
|
||||
ADAS_LIB_GROUP=com.zhidao.support.adas
|
||||
ADAS_LIB_POM_ARTIFACT_ID=high
|
||||
@@ -152,6 +143,5 @@ ADAS_DATA_LIB_GROUP=com.zhjt.mogo.adas.data
|
||||
ADAS_DATA_LIB_POM_ARTIFACT_ID=adas-data
|
||||
ADAS_DATA_LIB_CHILD_VERSION=.0
|
||||
|
||||
|
||||
# 线程优化版本
|
||||
THREAD_OPT_VERSION=4.0.0
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,23 +110,6 @@ public class Constants {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动自动驾驶后的状态
|
||||
*/
|
||||
public interface AUTOPILOT_START_STATUS {
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
int SUCCESSFUL = 0;
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
int FAILED = 1;
|
||||
/**
|
||||
* 取消
|
||||
*/
|
||||
int CANCEL = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用底盘数据类型
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
@@ -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成功
|
||||
}
|
||||
@@ -358,4 +358,6 @@ public interface IMogoMapUIController {
|
||||
* @return
|
||||
*/
|
||||
boolean isCityDataCached();
|
||||
|
||||
void cancelDownloadCacheData();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user