[dev_robotaxi-d-app-module_2132_221223_2.13.2_sop] 修改obu红绿灯消失的状态回调
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package com.mogo.eagle.core.function.call.obu
|
||||
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightDisapperListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightListener
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
object CallerObuTrafficLightDisappearManager {
|
||||
|
||||
private val M_OBU_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap<String, IMoGoObuTrafficLightDisapperListener> =
|
||||
ConcurrentHashMap()
|
||||
|
||||
/**
|
||||
* 添加监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
fun registerObuTrafficLightListener(
|
||||
tag: String,
|
||||
listener: IMoGoObuTrafficLightDisapperListener
|
||||
) {
|
||||
if (M_OBU_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
M_OBU_TRAFFIC_LIGHT_LISTENER[tag] = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
*/
|
||||
fun unRegisterObuTrafficLightListener(tag: String) {
|
||||
if (!M_OBU_TRAFFIC_LIGHT_LISTENER.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
M_OBU_TRAFFIC_LIGHT_LISTENER.remove(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监听
|
||||
* @param listener 要删除的监听对象
|
||||
*/
|
||||
fun unRegisterObuTrafficLightListener(listener: IMoGoObuTrafficLightListener) {
|
||||
if (!M_OBU_TRAFFIC_LIGHT_LISTENER.containsValue(listener)) {
|
||||
return
|
||||
}
|
||||
M_OBU_TRAFFIC_LIGHT_LISTENER.forEach {
|
||||
if (it.value == listener) {
|
||||
M_OBU_TRAFFIC_LIGHT_LISTENER.remove(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeObuTrafficLightDisappear() {
|
||||
M_OBU_TRAFFIC_LIGHT_LISTENER.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onObuLightDisapper()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user