[dev_arch_opt_3.0]

[Change]
[
1、MoGoObuListenerImpl实现数据回调
]

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2023-02-01 14:31:40 +08:00
parent 3211ef5956
commit ab2a89a623
7 changed files with 40 additions and 29 deletions

View File

@@ -13,7 +13,7 @@ import java.util.concurrent.ConcurrentHashMap
open class CallerBase<T : Any> {
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
val M_LISTENERS: ConcurrentHashMap<String, T> = ConcurrentHashMap()
protected val M_LISTENERS: ConcurrentHashMap<String, T> = ConcurrentHashMap()
/**
* 添加 监听
@@ -21,8 +21,8 @@ open class CallerBase<T : Any> {
* @param listener 监听回调
*/
fun addListener(
tag: String,
listener: T
tag: String,
listener: T
) {
if (M_LISTENERS.containsKey(tag)) {
return

View File

@@ -0,0 +1,20 @@
package com.mogo.eagle.core.function.call.obu
import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.support.obu.model.MogoObuHvBasicsData
/**
* OBU HV 自车车辆基础信息数据,自车定位数据 WGS84 坐标系
*/
object CallerObuLocationWGS84ListenerManager : CallerBase<IMoGoObuLocationWGS84Listener>() {
fun invokeObuLocationWGS84(data: MogoObuHvBasicsData) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onObuLocationWGS84(data)
}
}
}

View File

@@ -7,7 +7,7 @@ import com.mogo.support.obu.model.MogoObuMapMathData
/**
* OBU 地图匹配结果,车道线红绿灯建议最大车速建议最小车速
*/
object CallerObuWarningMapListenerManager : CallerBase<IMoGoObuWarningMapListener>() {
object CallerObuMapMathListenerManager : CallerBase<IMoGoObuWarningMapListener>() {
fun invokeObuMapMath(data: MogoObuMapMathData) {
M_LISTENERS.forEach {