[6.5.0] fix bug of road count and add trace

This commit is contained in:
EmArrow
2024-07-22 13:56:44 +08:00
parent 81185b9ee9
commit 21457b52df
2 changed files with 10 additions and 5 deletions

View File

@@ -21,7 +21,8 @@ class RoadLineEventManager : IMoGoMapRoadListener, IMoGoAutopilotStatusListener
}
}
private var record = false
@Volatile
private var record = false
fun init() {
CallerMapRoadListenerManager.addListener(TAG, this)

View File

@@ -26,6 +26,8 @@ import kotlin.properties.Delegates
*/
object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusListener>() {
private var atomicCountRoad = AtomicInteger(0)
// 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态
@Volatile
private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo()
@@ -36,6 +38,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
}
if(newValue == 0L){
mAutopilotStatusInfo.isArriveAtStation = false
atomicCountRoad.set(0)
}
M_LISTENERS.forEach {
val listener = it.value
@@ -70,8 +73,6 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
private var status: AdasConstants.IpcConnectionStatus? = null
private var atomicCountRoad = AtomicInteger(0)
override fun doSomeAfterAddListener(tag: String, listener: IMoGoAutopilotStatusListener) {
listener.onAutopilotStatusResponse(autopilotState)
if(dockerV.isNotEmpty()){
@@ -294,11 +295,14 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
}
fun updateRoadCount(){
atomicCountRoad.addAndGet(1)
val roadCount = atomicCountRoad.addAndGet(1)
CallerTrace.write("updateRoadCount", mapOf("roadCount" to roadCount))
}
fun getRoadCount(): Int {
return atomicCountRoad.get()
val count = atomicCountRoad.get()
CallerTrace.write("getRoadCount", mapOf("roadCount" to count))
return count
}
}