[dev_arch_opt_3.0]

[Change]
[
1、增加已出监听的时候将Hz相关的记录移除
]

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2023-02-21 12:15:32 +08:00
parent eb56953282
commit 719220cb6a
2 changed files with 20 additions and 2 deletions

View File

@@ -35,8 +35,6 @@ object CallerChassisLocationGCJ02ListenerManager : CallerBase<IMoGoChassisLocati
setListenerHz(tag, callBackHz)
}
//todo 宏宇 添加HZ的移除操作
fun getChassisLocationGCJ02(): MogoLocation? {
return mGnssInfo
}

View File

@@ -70,6 +70,16 @@ open class CallerBase<T : Any> {
return
}
M_LISTENERS.remove(tag)
if (!M_LISTENERS_HZ.containsKey(tag)) {
return
}
M_LISTENERS_HZ.remove(tag)
if (!M_LISTENERS_HZ_LAST_SEND_TIME.containsKey(tag)) {
return
}
M_LISTENERS_HZ_LAST_SEND_TIME.remove(tag)
}
/**
@@ -83,6 +93,16 @@ open class CallerBase<T : Any> {
M_LISTENERS.forEach {
if (it.value == listener) {
M_LISTENERS.remove(it.key)
if (!M_LISTENERS_HZ.containsKey(it.key)) {
return
}
M_LISTENERS_HZ.remove(it.key)
if (!M_LISTENERS_HZ_LAST_SEND_TIME.containsKey(it.key)) {
return
}
M_LISTENERS_HZ_LAST_SEND_TIME.remove(it.key)
}
}
}