[2.15.0][opt]缓存上一次V2X事件的数据

This commit is contained in:
chenfufeng
2023-04-06 14:55:49 +08:00
parent eb28b983dd
commit 54298a74ef

View File

@@ -9,10 +9,27 @@ import mogo.v2x.MogoV2X
*/
object CallerV2XListenerManager : CallerBase<IMoGoV2XListener>() {
private var eventCountTmp: Int = -1
private var constructTmp: MogoV2X.RSI_PB? = null
private var triangleTmp: MogoV2X.RSI_PB? = null
private var congestionTmp: MogoV2X.RSI_PB? = null
private var parkingViolationTmp: MogoV2X.RSM_PB? = null
override fun doSomeAfterAddListener(tag: String, listener: IMoGoV2XListener) {
if (eventCountTmp >= 0) {
listener.onV2nGlobalPathEvents(eventCountTmp, constructTmp, triangleTmp, congestionTmp, parkingViolationTmp)
}
}
/**
* 分发主车路径全局事件
*/
fun dispatchV2nGlobalPathEvents(eventCount: Int, construct: MogoV2X.RSI_PB?, triangle: MogoV2X.RSI_PB?, congestion: MogoV2X.RSI_PB?, parkingViolation: MogoV2X.RSM_PB?) {
eventCountTmp = eventCount
constructTmp = construct
triangleTmp = triangle
congestionTmp = congestion
parkingViolationTmp = parkingViolation
M_LISTENERS.forEach {
val listener = it.value
listener.onV2nGlobalPathEvents(eventCount, construct, triangle, congestion, parkingViolation)