This commit is contained in:
zhongchao
2023-04-04 15:09:31 +08:00
parent 8d41c335d6
commit c52c3828f8
63 changed files with 875 additions and 426 deletions

View File

@@ -5,16 +5,21 @@ import androidx.lifecycle.lifecycleScope
import com.google.protobuf.TextFormat
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setDemoMode
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.telematic.MogoProtocolMsg
import com.mogo.telematic.NSDNettyManager
@@ -31,7 +36,6 @@ import mogo.telematics.pad.MessagePad
class TeleMsgHandler : IMsgHandler {
companion object{
private const val BUSINESS_STRING = 100
private const val TAG = "TeleMsgHandler"
}
@@ -126,8 +130,22 @@ class TeleMsgHandler : IMsgHandler {
}
}
}
BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(BUSINESS_STRING, it.body)
TelematicConstant.BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
}
TelematicConstant.SHOW_TRAFFIC_LIGHT -> {
val trafficLightJson = String(it.body)
CallerTrafficLightListenerManager.invokeTrafficLightStatus(GsonUtils.fromJson(trafficLightJson, TrafficLightResult::class.java))
}
TelematicConstant.HIDE_TRAFFIC_LIGHT -> {
ThreadUtils.runOnUiThread {
CallerTrafficLightListenerManager.invokeEnterCrossRoad(false)
}
}
TelematicConstant.OPEN_ROMA_STATUS -> {
ThreadUtils.runOnUiThread {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.OPEN_ROMA_STATUS,it.body)
}
}
else -> {
}
@@ -173,8 +191,13 @@ class TeleMsgHandler : IMsgHandler {
invokeNettyConnResult("司机屏SN未获取到不发送给乘客屏")
}
}
BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(BUSINESS_STRING, it.body)
TelematicConstant.BUSINESS_STRING -> {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.BUSINESS_STRING, it.body)
}
TelematicConstant.OPEN_ROMA_STATUS -> {
ThreadUtils.runOnUiThread {
CallerTelematicListenerManager.invokeReceivedMsg(TelematicConstant.OPEN_ROMA_STATUS,it.body)
}
}
else -> {
}

View File

@@ -3,12 +3,17 @@ package com.mogo.eagle.core.function.datacenter.v2x
import android.content.Context
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.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import perception.TrafficLightOuterClass
import perception.TrafficLightOuterClass.TrafficLight
@@ -85,7 +90,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
}
if (light == null) {
//隐藏红绿灯显示
CallerTrafficLightListenerManager.disableTrafficLight()
hide()
} else {
onTrafficLightPlusSource(light.convert(), 0, DataSourceType.TELEMATIC)
}
@@ -101,6 +106,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
if (!hasObuLightStatus) {
hasAiLightStatus = true
updateTrafficLight(trafficLightResult)
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.SHOW_TRAFFIC_LIGHT, GsonUtils.toJson(trafficLightResult).toByteArray())
}
}
}
@@ -116,6 +124,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
}, 5000)
//如果没有OBU灯态则进行隐藏如果有OBU灯态则交由OBU管理
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
if(!hasObuLightStatus){
hide()
}
}
}
@@ -125,6 +136,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
override fun onTrafficRequestError() {
hasAiLightStatus = false
CallerTrafficLightListenerManager.resetTrafficLightStatus(!hasObuLightStatus)
if(!hasObuLightStatus){
hide()
}
}
/**
@@ -132,6 +146,14 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
*/
override fun onObuTrafficLightDisapper() {
hasObuLightStatus = false
hide()
}
private fun hide(){
CallerTrafficLightListenerManager.disableTrafficLight()
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.HIDE_TRAFFIC_LIGHT, "0".toByteArray())
}
}
/**
@@ -167,6 +189,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
TrafficLightEnum.BLACK -> {
CallerTrafficLightListenerManager.disableTrafficLightCountDown()
}
else -> {
hide()
}
}
}