Merge branch 'dev_sweeper-d_230423_3.1.0' of http://gitlab.zhidaoauto.com/SCA/L4HA/AndroidApp/MoGoEagleEye into dev_sweeper-d_230423_3.1.0

This commit is contained in:
bxb
2023-05-30 14:10:37 +08:00

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.datacenter.v2x
import android.content.Context
import android.os.CountDownTimer
import android.os.Handler
import com.mogo.eagle.core.data.biz.trafficlight.*
import com.mogo.eagle.core.data.enums.DataSourceType
@@ -57,6 +58,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
@Volatile
private var hasObuLightStatus: Boolean = false
private var lightCountDownTimer: CountDownTimer ?= null
private var lastLightTime: Long = System.currentTimeMillis()
fun initServer(context: Context) {
mContext = context
//注册监听AI云.OBU路侧获取红绿灯状态
@@ -72,6 +76,28 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
override fun onAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) {
if (!hasObuLightStatus) {
if (!hasAiLightStatus) {
lastLightTime = System.currentTimeMillis()
if(lightCountDownTimer==null){
lightCountDownTimer = object: CountDownTimer(300000,1000){
override fun onTick(millisUntilFinished: Long) {
if((System.currentTimeMillis() - lastLightTime)>1000){
//隐藏红绿灯显示
CallerTrafficLightListenerManager.disableTrafficLight()
lightCountDownTimer?.cancel()
lightCountDownTimer = null
}
}
override fun onFinish() {
lightCountDownTimer?.cancel()
lightCountDownTimer = null
}
}
lightCountDownTimer?.start()
}
trafficLights?.let { it ->
var light: TrafficLight? = null
if (it.hasStraight()) {
@@ -165,7 +191,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
CallerTrafficLightListenerManager.changeCountdownYellow(remain)
}
TrafficLightEnum.BLACK -> {
CallerTrafficLightListenerManager.disableTrafficLightCountDown()
CallerTrafficLightListenerManager.disableTrafficLight()
}
}