[Fix]解决视频流功能问题

This commit is contained in:
chenfufeng
2021-11-24 10:30:29 +08:00
parent 5113a0a893
commit 4480001fba
9 changed files with 147 additions and 73 deletions

View File

@@ -3,9 +3,11 @@ package com.mogo.eagle.core.function.v2x.redlightwarning
import com.mogo.eagle.core.data.trafficlight.*
import com.mogo.eagle.core.data.trafficlight.TrafficLightStatusHelper.getCurrentRoadTrafficLight
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.api.vip.IMoGoVipSetListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
import com.mogo.eagle.core.utilcode.util.SPUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.module.common.enums.EventTypeEnum
@@ -15,7 +17,9 @@ import kotlin.math.ceil
import kotlin.math.floor
class RedLightWarningManager : IMoGoTrafficLightListener {
class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener {
private var vip: Boolean = false
companion object {
@@ -32,14 +36,19 @@ class RedLightWarningManager : IMoGoTrafficLightListener {
}
}
override fun onVipSet(status: Boolean) {
vip = status
}
fun listenTrafficLight() {
CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
CallVipSetListenerManager.registerVipSetListener(TAG, this)
}
private fun handleRedLightWarning(trafficLightStatus: TrafficLightStatus, yellowLightTime: Int = 0) {
// 如果是Vip则不处理
if (SPUtils.getInstance().getLong("vip") > 0) {
Logger.w(TAG, "Vip用户不处理闯红灯预警逻辑")
if (vip) {
Logger.w(TAG, "Vip用户不处理闯红灯、绿灯通行预警逻辑!")
return
}
// 路口100m闯红灯预警
@@ -147,5 +156,6 @@ class RedLightWarningManager : IMoGoTrafficLightListener {
fun onDestroy() {
CallTrafficLightListenerManager.unRegisterTrafficLightListener(TAG)
CallVipSetListenerManager.unRegisterVipSetListener(TAG)
}
}