[3.2.0]自车感知红绿灯域控不发送数据,隐藏红绿灯
This commit is contained in:
@@ -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.config.FunctionBuildConfig
|
||||
@@ -63,6 +64,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,路侧获取红绿灯状态
|
||||
@@ -79,6 +83,28 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onAutopilotPerceptionTrafficLight ---- hasObuLightStatus = $hasObuLightStatus ----hasAiLightStatus = $hasAiLightStatus ")
|
||||
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()) {
|
||||
@@ -205,7 +231,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
CallerTrafficLightListenerManager.changeCountdownYellow(remain)
|
||||
}
|
||||
TrafficLightEnum.BLACK -> {
|
||||
CallerTrafficLightListenerManager.disableTrafficLightCountDown()
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
}
|
||||
else -> {
|
||||
hide()
|
||||
|
||||
Reference in New Issue
Block a user