add pnc actions func
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import androidx.annotation.Nullable
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningActionsListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* PNC 决策行为相关监听
|
||||
*/
|
||||
object CallerAutopilotPlanningActionsListenerManager : CallerBase() {
|
||||
|
||||
private val M_AUTOPILOT_PLANNING_ACTIONS_LISTENER: ConcurrentHashMap<String, IMoGoAutopilotPlanningActionsListener> =
|
||||
ConcurrentHashMap()
|
||||
|
||||
/**
|
||||
* 添加监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
* @param listener 监听回调
|
||||
*/
|
||||
fun addListener(
|
||||
@Nullable tag: String,
|
||||
@Nullable listener: IMoGoAutopilotPlanningActionsListener
|
||||
) {
|
||||
if (M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
M_AUTOPILOT_PLANNING_ACTIONS_LISTENER[tag] = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监听
|
||||
* @param tag 标记,用来注销监听使用
|
||||
*/
|
||||
fun removeListener(@Nullable tag: String) {
|
||||
if (!M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.remove(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自动驾驶按钮选中监听
|
||||
* @param listener 要删除的监听对象
|
||||
*/
|
||||
fun removeListener(@Nullable listener: IMoGoAutopilotPlanningActionsListener) {
|
||||
M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.forEach {
|
||||
if (it.value == listener) {
|
||||
M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.remove(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* pnc actions 决策回调
|
||||
* @param planningActionMsg 具体决策
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokePNCActions(planningActionMsg: MessagePad.PlanningActionMsg) {
|
||||
M_AUTOPILOT_PLANNING_ACTIONS_LISTENER.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
listener.pncActions(planningActionMsg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
object CallTrafficLightListenerManager {
|
||||
object CallerTrafficLightListenerManager {
|
||||
|
||||
private val M_TRAFFIC_LIGHT_LISTENER: ConcurrentHashMap<String, IMoGoTrafficLightListener> =
|
||||
ConcurrentHashMap()
|
||||
@@ -4,7 +4,7 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.trafficlight.ITrafficLightProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
object CallTrafficLightManager : CallerBase() {
|
||||
object CallerTrafficLightManager : CallerBase() {
|
||||
|
||||
fun getTrafficLightProvider(): ITrafficLightProvider {
|
||||
return getApiInstance(
|
||||
Reference in New Issue
Block a user