From 99ca48eab9720640883d48bdb42c61d7a6f55b57 Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Wed, 31 May 2023 15:25:39 +0800 Subject: [PATCH] =?UTF-8?q?[3.2.0]=E8=87=AA=E8=BD=A6=E6=84=9F=E7=9F=A5?= =?UTF-8?q?=E7=BA=A2=E7=BB=BF=E7=81=AF=E5=9F=9F=E6=8E=A7=E4=B8=8D=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=95=B0=E6=8D=AE=EF=BC=8C=E9=9A=90=E8=97=8F=E7=BA=A2?= =?UTF-8?q?=E7=BB=BF=E7=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datacenter/v2x/TrafficLightDispatcher.kt | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt index ad5e57f222..dbb469898b 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/v2x/TrafficLightDispatcher.kt @@ -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()