fix bug of add listener data updatw

This commit is contained in:
zhongchao
2022-09-28 18:35:35 +08:00
parent 748a648249
commit f60830ff01

View File

@@ -11,6 +11,8 @@ import java.util.concurrent.ConcurrentHashMap
*/
object CallerAutopilotCarConfigListenerManager : CallerBase() {
private var mCarConfigResp: MessagePad.CarConfigResp?= null
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val M_AUTOPILOT_CAR_CONFIG_LISTENERS: ConcurrentHashMap<String, IMoGoAutopilotCarConfigListener> =
ConcurrentHashMap()
@@ -28,6 +30,10 @@ object CallerAutopilotCarConfigListenerManager : CallerBase() {
return
}
M_AUTOPILOT_CAR_CONFIG_LISTENERS[tag] = listener
mCarConfigResp?.let {
listener.onAutopilotCarConfig(it)
}
}
/**
@@ -59,6 +65,7 @@ object CallerAutopilotCarConfigListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotCarConfigData(carConfigResp: MessagePad.CarConfigResp) {
mCarConfigResp = carConfigResp
M_AUTOPILOT_CAR_CONFIG_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotCarConfig(carConfigResp)