Merge branch 'release_robotaxi-d-app-module_2130_221116_2.13.0.1_temp' into dev_robotaxi-d-app-module_2132_221223_2.13.2

This commit is contained in:
lixiaopeng
2023-01-06 11:34:15 +08:00
20 changed files with 2008 additions and 15 deletions

View File

@@ -0,0 +1,65 @@
package com.mogo.eagle.core.function.call.obucombine
import androidx.annotation.Nullable
import com.mogo.eagle.core.function.api.obucombine.IMoGoObuDcCombineListener
import com.mogo.eagle.core.function.call.base.CallerBase
import mogo.v2x.ObuWarningEvent
import java.util.concurrent.ConcurrentHashMap
/**
* obu和dc数据通道 回调监听
*/
object CallerObuDcCombineListenerManager : CallerBase() {
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val M_DC_COMBINE_LISTENERS: ConcurrentHashMap<String, IMoGoObuDcCombineListener> =
ConcurrentHashMap()
/**
* 添加 obu和dc数据通道 监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addListener(
@Nullable tag: String,
@Nullable listener: IMoGoObuDcCombineListener
) {
if (M_DC_COMBINE_LISTENERS.containsKey(tag)) {
return
}
M_DC_COMBINE_LISTENERS[tag] = listener
}
/**
* 删除监听
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
if (!M_DC_COMBINE_LISTENERS.containsKey(tag)) {
return
}
M_DC_COMBINE_LISTENERS.remove(tag)
}
/**
* 删除自动驾驶按钮选中监听
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoObuDcCombineListener) {
M_DC_COMBINE_LISTENERS.forEach {
if (it.value == listener) {
M_DC_COMBINE_LISTENERS.remove(it.key)
}
}
}
/**
* v2i数据
*/
fun invokeObuDcData(obuWarningData: ObuWarningEvent.ObuWarningData?){
M_DC_COMBINE_LISTENERS.forEach{
val listener = it.value
listener.onMoGoObuDcCombineData(obuWarningData)
}
}
}