Merge branch 'dev_robotaxi-d-app-module_270_220510_2.7.0_point' into dev_robotaxi-d-app-module_270_220510_2.7.0
# Conflicts: # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import androidx.annotation.Nullable
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPointCloudListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import perception.TrafficLightOuterClass
|
||||
import rule_segement.PointCloud
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/30 5:48 下午
|
||||
* 点云数据管理
|
||||
*/
|
||||
object CallerAutopilotPointCloudListenerManager : CallerBase() {
|
||||
|
||||
// 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步
|
||||
private val M_AUTOPILOT_IDENTIFY_LISTENERS: ConcurrentHashMap<String, IMoGoAutopilotPointCloudListener> =
|
||||
ConcurrentHashMap()
|
||||
|
||||
/**
|
||||
* 添加 域控制器感知数据 监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
fun addListener(
|
||||
@Nullable tag: String,
|
||||
@Nullable listener: IMoGoAutopilotPointCloudListener
|
||||
) {
|
||||
if (M_AUTOPILOT_IDENTIFY_LISTENERS.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
M_AUTOPILOT_IDENTIFY_LISTENERS[tag] = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
*/
|
||||
fun removeListener(@Nullable tag: String) {
|
||||
if (!M_AUTOPILOT_IDENTIFY_LISTENERS.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
M_AUTOPILOT_IDENTIFY_LISTENERS.remove(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自动驾驶按钮选中监听
|
||||
* @param listener 要删除的监听对象
|
||||
*/
|
||||
fun removeListener(@Nullable listener: IMoGoAutopilotPointCloudListener) {
|
||||
M_AUTOPILOT_IDENTIFY_LISTENERS.forEach {
|
||||
if (it.value == listener) {
|
||||
M_AUTOPILOT_IDENTIFY_LISTENERS.remove(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 识别交通元素数据发生更新 回调
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeAutopilotPointCloudDataUpdate(header: MessagePad.Header?, pointCloud: PointCloud.LidarPointCloud?) {
|
||||
M_AUTOPILOT_IDENTIFY_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.onAutopilotPointCloudDataUpdate(header,pointCloud)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user