[6.2.11] traffic light demo

This commit is contained in:
EmArrow
2024-03-08 12:33:36 +08:00
parent 1f9a644230
commit 3b25da0096
8 changed files with 72 additions and 9 deletions

View File

@@ -5,6 +5,7 @@ import android.os.CountDownTimer
import android.os.Handler
import com.mogo.eagle.core.data.biz.trafficlight.*
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
@@ -118,7 +119,16 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
if(!hasAutopilotPerception){
hasAutopilotPerception = true
}
onTrafficLightPlusSource(light.convert(), 0, DataSourceType.TELEMATIC)
if(HmiBuildConfig.isShowCarSourceTrafficLightView){
val source = when(trafficLights.source){
1 -> DataSourceType.TELEMATIC_UNION_V2I
2 -> DataSourceType.TELEMATIC_UNION_V2N
else -> DataSourceType.TELEMATIC
}
onTrafficLightPlusSource(light.convert(), light.duration.toInt(), source)
}else{
onTrafficLightPlusSource(light.convert(), 0, DataSourceType.TELEMATIC)
}
}
}
}
@@ -150,6 +160,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
*/
override fun onEnterCrossRoad(enter: Boolean) {
CallerLogger.d("${SceneConstant.M_D_C}${TAG}", "onEnterCrossRoad enter = $enter ")
if(HmiBuildConfig.isShowCarSourceTrafficLightView){
return
}
if (!enter) {
Handler().postDelayed({
hasAiLightStatus = false
@@ -177,6 +190,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
"${SceneConstant.M_D_C}${TAG}",
"onTrafficRequestError hasObuLightStatus = $hasObuLightStatus ------> "
)
if(HmiBuildConfig.isShowCarSourceTrafficLightView){
return
}
CallerTrafficLightListenerManager.resetTrafficLightStatus(hasAiLightStatus)
hasAiLightStatus = false
// if (!hasObuLightStatus) {
@@ -216,6 +232,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
)
private fun hide(msg: String, sourceType: DataSourceType) {
CallerLogger.d("${SceneConstant.M_D_C}${TAG}", "hide() :$msg type :$sourceType")
if(filterTelematicUnion(sourceType)){
return
}
CallerTrafficLightListenerManager.disableTrafficLight()
}
@@ -234,6 +253,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
lightSource: DataSourceType
) {
super.onTrafficLightPlusSource(light, remain, lightSource)
if(filterTelematicUnion(lightSource)){
return
}
if (lightSource == DataSourceType.OBU) {
hasObuLightStatus = true
hasAutopilotPerception = false
@@ -313,6 +335,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
}
}
private fun filterTelematicUnion(source:DataSourceType):Boolean{
return HmiBuildConfig.isShowCarSourceTrafficLightView && source != DataSourceType.TELEMATIC_UNION_V2N && source != DataSourceType.TELEMATIC_UNION_V2I
}
fun destroy() {
//取消注册监听AI云.OBU,路侧获取红绿灯状态