Merge branch 'dev_arch_opt_3.0' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_arch_opt_3.0
This commit is contained in:
@@ -130,7 +130,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo?) {
|
||||
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo) {
|
||||
// WGS84坐标系高精度位置信息
|
||||
invokeChassisLocationWGS84(gnssInfo)
|
||||
// GCJ02高德坐标系位置信息
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.eagle.core.function.datacenter.location
|
||||
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* 位置回调监听
|
||||
*/
|
||||
interface IMoGoLocationListener {
|
||||
/**
|
||||
* 位置改变回调用
|
||||
* @param gnssInfo 位置信息
|
||||
* @param sourceType 数据来源
|
||||
*/
|
||||
fun onLocationChanged(gnssInfo: MessagePad.GnssInfo, sourceType: DataSourceType)
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.mogo.eagle.core.function.datacenter.location
|
||||
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.support.obu.model.MogoObuHvBasicsData
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* 融合定位服务,这里同时监听多来源的位置信息,并支持修改频率
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
object MoGoLocationManager :
|
||||
CallerBase<IMoGoLocationListener>(),
|
||||
IMoGoChassisLocationWGS84Listener,
|
||||
IMoGoObuLocationWGS84Listener {
|
||||
private val TAG = "MoGoLocationManager"
|
||||
|
||||
init {
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
// 获取数据监听需要的HZ
|
||||
val hz = M_LISTENERS_HZ[tag]
|
||||
if (hz != null && hz > 0) {
|
||||
val hzTime = (1.0 / hz.toDouble()) * 1000
|
||||
// 获取最后一次回调的时间
|
||||
val hzLastSendTime = M_LISTENERS_HZ_LAST_SEND_TIME[tag]
|
||||
if (hzLastSendTime != null && hzLastSendTime > 0) {
|
||||
// 计算是否进入下一次回调周期
|
||||
val nowTime = TimeUtils.getNowMills()
|
||||
if (nowTime - hzLastSendTime > hzTime) {
|
||||
syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC)
|
||||
}
|
||||
} else {
|
||||
syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC)
|
||||
}
|
||||
} else {
|
||||
syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向订阅位置信息的发出定位信息
|
||||
*/
|
||||
private fun syncLocationCallback(
|
||||
tag: String,
|
||||
it: Map.Entry<String, IMoGoLocationListener>,
|
||||
gnssInfo: MessagePad.GnssInfo,
|
||||
sourceType: DataSourceType
|
||||
) {
|
||||
// 记录最后一次回调时间
|
||||
M_LISTENERS_HZ_LAST_SEND_TIME[tag] = TimeUtils.getNowMills()
|
||||
val listener = it.value
|
||||
listener.onLocationChanged(gnssInfo, sourceType)
|
||||
}
|
||||
|
||||
override fun onObuLocationWGS84(data: MogoObuHvBasicsData) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#### 说明
|
||||
|
||||
##### 位置回调:融合工控机、OBU、高德地图
|
||||
|
||||
```kotlin
|
||||
// 注册监听位置变换
|
||||
MoGoLocationManager.addListener(Companion.functionName, object : IMoGoLocationListener {
|
||||
override fun onLocationChanged(
|
||||
gnssInfo: MessagePad.GnssInfo,
|
||||
sourceType: DataSourceType
|
||||
) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
})
|
||||
// 设置数据回调频率,单位HZ,1HZ的周期是1秒;50HZ的周期是1/50=0.02秒;10HZ的周期是1/10=0.1秒。
|
||||
MoGoLocationManager.setListenerHz(Companion.functionName, 20)
|
||||
```
|
||||
@@ -353,9 +353,9 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
|
||||
fun closeWindow()
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
latitude = gnssInfo?.latitude
|
||||
longitude = gnssInfo?.longitude
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
|
||||
latitude = gnssInfo.latitude
|
||||
longitude = gnssInfo.longitude
|
||||
}
|
||||
|
||||
}
|
||||
@@ -394,9 +394,9 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
|
||||
fun closeWindow()
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
latitude = gnssInfo?.latitude
|
||||
longitude = gnssInfo?.longitude
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
|
||||
latitude = gnssInfo.latitude
|
||||
longitude = gnssInfo.longitude
|
||||
}
|
||||
|
||||
}
|
||||
@@ -380,7 +380,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
|
||||
fun closeWindow()
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
|
||||
latitude = gnssInfo?.latitude
|
||||
longitude = gnssInfo?.longitude
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
|
||||
}
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: GnssInfo?) {
|
||||
override fun onChassisLocationWGS84(gnssInfo: GnssInfo) {
|
||||
if (isOldVersion.get()) {
|
||||
if (isRTKEnabled()) {
|
||||
send(RTKStatus("RTK", 0))
|
||||
|
||||
@@ -520,7 +520,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
|
||||
}
|
||||
}
|
||||
brakeView.setBrakeLight(light)
|
||||
//brakeView.setBrakeLight(light)
|
||||
}
|
||||
}
|
||||
/** todo----------------------------------------------- **/
|
||||
|
||||
@@ -1825,7 +1825,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
|
||||
mGnssInfo = gnssInfo
|
||||
//实时加速度列表
|
||||
ThreadUtils.runOnUiThread {
|
||||
|
||||
@@ -81,6 +81,7 @@ dependencies {
|
||||
implementation project(':core:mogo-core-res')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:function-impl:mogo-core-function-datacenter')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
implementation project(":libraries:mogo-map")
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.map.CenterLine
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider
|
||||
@@ -18,15 +18,14 @@ import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
|
||||
import com.mogo.eagle.core.function.business.SpeedLimitDataManager
|
||||
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBrakeLight
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showTurnLight
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.datacenter.location.IMoGoLocationListener
|
||||
import com.mogo.eagle.core.function.datacenter.location.MoGoLocationManager
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager.savePlanningData
|
||||
import com.mogo.eagle.core.function.overview.obtainViewModel
|
||||
@@ -55,7 +54,7 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
MapView,
|
||||
IMoGoMapFragmentProvider,
|
||||
IMoGoSkinModeChangeListener,
|
||||
IMoGoChassisLocationWGS84Listener,
|
||||
IMoGoLocationListener,
|
||||
IMoGoPlanningRottingListener,
|
||||
IMoGoChassisLamplightListener {
|
||||
|
||||
@@ -115,7 +114,7 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(Companion.functionName, this)
|
||||
CallerPlanningRottingListenerManager.addListener(Companion.functionName, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(Companion.functionName, this)
|
||||
MoGoLocationManager.addListener(Companion.functionName, this)
|
||||
CallerChassisLamplightListenerManager.addListener(Companion.functionName, this)
|
||||
}
|
||||
|
||||
@@ -219,7 +218,7 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
override fun onDestroyView() {
|
||||
CallerSkinModeListenerManager.removeListener(Companion.functionName)
|
||||
CallerPlanningRottingListenerManager.removeListener(Companion.functionName)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(Companion.functionName)
|
||||
MoGoLocationManager.removeListener(Companion.functionName)
|
||||
CallerChassisLamplightListenerManager.removeListener(Companion.functionName)
|
||||
|
||||
if (mMogoMapView != null) {
|
||||
@@ -347,7 +346,7 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
private var isShowTurnLight = false
|
||||
private var brakeLight = -1
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
override fun onLocationChanged(gnssInfo: MessagePad.GnssInfo,sourceType: DataSourceType) {
|
||||
// 跟新地图控件
|
||||
mMogoMapView?.setExtraGPSData(gnssInfo)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user