Merge branch 'dev_arch_opt_3.0' into dev_robosweeper-d_app-module_221230_1.1.0

# Conflicts:
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficLightView.kt
This commit is contained in:
donghongyu
2023-02-01 19:41:41 +08:00
206 changed files with 3587 additions and 2293 deletions

View File

@@ -51,10 +51,14 @@ import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListener
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager.invokeAutopilotRotting
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningTrajectoryListenerManager.invokeAutopilotTrajectory
import com.mogo.eagle.core.function.call.autopilot.CallerStartAutopilotFailedListenerManager.invokeStartAutopilotFailed
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager
import com.mogo.eagle.core.function.call.obucombine.CallerObuDcCombineListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.support.obu.ObuScene
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.OnAdasListener
import com.zhidao.support.adas.high.bean.AutopilotAbility
@@ -130,7 +134,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
paramIndexes = [0, 1],
clientPkFileName = "sn"
)
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo?) {
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo) {
// WGS84坐标系高精度位置信息
invokeChassisLocationWGS84(gnssInfo)
// GCJ02高德坐标系位置信息
@@ -537,6 +541,44 @@ class MoGoAdasListenerImpl : OnAdasListener {
CallerObuDcCombineListenerManager.invokeObuDcData(obuWarningData)
}
/**
* OBU 红绿灯预警信息
*
* @param header 头
* @param spatWarningData 数据
*/
override fun onoObuSpatWarning(header: MessagePad.Header?, spatWarningData: ObuScene.SpatWarningData?) {
CallerObuWarningSpatListenerManager.invokeObuSpatWarning(spatWarningData!!)
}
/**
* OBU RSI预警信息
*
* @param header 头
* @param rsiWarningData 数据
*/
override fun onoObuRsiWarning(header: MessagePad.Header?, rsiWarningData: ObuScene.RsiWarningData?) {
CallerObuWarningRsiListenerManager.invokeObuRsiWarning(rsiWarningData!!)
}
/**
* OBU RSM预警信息
*
* @param header 头
* @param rsmWarningData 数据
*/
override fun onoObuRsmWarning(header: MessagePad.Header?, rsmWarningData: ObuScene.RsmWarningData?) {
CallerObuWarningRsmListenerManager.invokeObuRsmWarning(rsmWarningData!!)
}
/**
* OBU 地图匹配结果
*
* @param header 头
* @param mapMatchData 数据
*/
override fun onoObuObuMapMath(header: MessagePad.Header?, mapMatchData: ObuScene.MapMatchData?) {
CallerObuMapMathListenerManager.invokeObuMapMath(mapMatchData!!)
}
/**
* 重构后的功能状态
*

View File

@@ -0,0 +1,16 @@
package com.mogo.eagle.core.function.datacenter.location
import com.mogo.eagle.core.data.enums.DataSourceType
import mogo.telematics.pad.MessagePad
/**
* 位置回调监听
*/
interface IMoGoLocationListener {
/**
* 位置改变回调用
* @param gnssInfo 位置信息
* @param sourceType 数据来源
*/
fun onLocationChanged(gnssInfo: MessagePad.GnssInfo, sourceType: DataSourceType)
}

View File

@@ -0,0 +1,71 @@
package com.mogo.eagle.core.function.datacenter.location
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.support.obu.model.MogoObuHvBasicsData
import mogo.telematics.pad.MessagePad
/**
* 融合定位服务,这里同时监听多来源的位置信息,并支持修改频率
*
* @author donghongyu
*/
object MoGoLocationManager :
CallerBase<IMoGoLocationListener>(),
IMoGoChassisLocationWGS84Listener,
IMoGoObuLocationWGS84Listener {
private val TAG = "MoGoLocationManager"
init {
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
}
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo) {
M_LISTENERS.forEach {
val tag = it.key
// 获取数据监听需要的HZ
val hz = M_LISTENERS_HZ[tag]
if (hz != null && hz > 0) {
val hzTime = (1.0 / hz.toDouble()) * 1000
// 获取最后一次回调的时间
val hzLastSendTime = M_LISTENERS_HZ_LAST_SEND_TIME[tag]
if (hzLastSendTime != null && hzLastSendTime > 0) {
// 计算是否进入下一次回调周期
val nowTime = TimeUtils.getNowMills()
if (nowTime - hzLastSendTime > hzTime) {
syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC)
}
} else {
syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC)
}
} else {
syncLocationCallback(tag, it, gnssInfo, DataSourceType.TELEMATIC)
}
}
}
/**
* 向订阅位置信息的发出定位信息
*/
private fun syncLocationCallback(
tag: String,
it: Map.Entry<String, IMoGoLocationListener>,
gnssInfo: MessagePad.GnssInfo,
sourceType: DataSourceType
) {
// 记录最后一次回调时间
M_LISTENERS_HZ_LAST_SEND_TIME[tag] = TimeUtils.getNowMills()
val listener = it.value
listener.onLocationChanged(gnssInfo, sourceType)
}
override fun onObuLocationWGS84(data: MogoObuHvBasicsData) {
}
}

View File

@@ -0,0 +1,17 @@
#### 说明
##### 位置回调融合工控机、OBU、高德地图
```kotlin
// 注册监听位置变换
MoGoLocationManager.addListener(Companion.functionName, object : IMoGoLocationListener {
override fun onLocationChanged(
gnssInfo: MessagePad.GnssInfo,
sourceType: DataSourceType
) {
TODO("Not yet implemented")
}
})
// 设置数据回调频率单位HZ1HZ的周期是1秒50HZ的周期是1/50=0.02秒10HZ的周期是1/10=0.1秒。
MoGoLocationManager.setListenerHz(Companion.functionName, 20)
```

View File

@@ -37,9 +37,8 @@ class MoGoObuProvider : IMoGoObuProvider {
MogoObuDcCombineManager.INSTANCE.init(context)
CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress())
//bus乘客版本obu功能去掉
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(
FunctionBuildConfig.appIdentityMode
)
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
) {
//不处理
} else {
@@ -73,9 +72,8 @@ class MoGoObuProvider : IMoGoObuProvider {
* 通过控制面板设置ip进行传递
*/
override fun connect(ipAddress: String) {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(
FunctionBuildConfig.appIdentityMode
)
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
) {
//不处理
} else {

View File

@@ -5,6 +5,7 @@ import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
@@ -14,6 +15,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obucombine.CallerObuDcCombineListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
@@ -511,7 +513,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗,当收不到信号的时候触发一次
CallerHmiManager.disableWarningTrafficLight()
CallerTrafficLightListenerManager.disableTrafficLight()
CallerHmiManager.disableWarningV2X(appId.toString())
isShowGreenWave = false
isShowRunRedLight = false
@@ -626,7 +628,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
when (currentLight.light) {
// 灯光不可用
0 -> {
CallerHmiManager.showWarningTrafficLight(0, 2)
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.BLACK, DataSourceType.TELEMATIC)
}
// 红灯
@@ -636,9 +638,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
isRedLight = true
}
isGreenLight = false
CallerHmiManager.showWarningTrafficLight(1, 2)
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.RED, DataSourceType.TELEMATIC)
val red = currentLight.countDown / 10
CallerHmiManager.changeCountdownRed(red)
CallerTrafficLightListenerManager.changeCountdownRed(red)
}
// 绿灯
@@ -648,17 +650,17 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
isGreenLight = true
}
isRedLight = false
CallerHmiManager.showWarningTrafficLight(3, 2)
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.GREEN, DataSourceType.TELEMATIC)
val green = currentLight.countDown / 10
CallerHmiManager.changeCountdownGreen(green)
CallerTrafficLightListenerManager.changeCountdownGreen(green)
}
// 黄灯
7, 8 -> {
CallerHmiManager.disableWarningV2X(appId.toString())
CallerHmiManager.showWarningTrafficLight(2, 2)
CallerTrafficLightListenerManager.showTrafficLight(TrafficLightEnum.YELLOW, DataSourceType.TELEMATIC)
val yellow = currentLight.countDown / 10
CallerHmiManager.changeCountdownYellow(yellow)
CallerTrafficLightListenerManager.changeCountdownYellow(yellow)
}
}
}

View File

@@ -15,13 +15,12 @@ import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuTrafficLightListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.support.obu.MogoObuManager
import com.mogo.support.obu.OnMogoObuListener
@@ -48,9 +47,7 @@ class MogoPrivateObuNewManager private constructor() {
}
}
private var mContext: Context? = null
private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo()
private var mObuStatusInfo = CallerObuConnectListenerManager.getObuStatusInfo()
fun connectObu(context: Context, obuIpAddress: String, padIpAddress: String) {
MogoObuManager.getInstance().registerMogoObuListener(mogoObuListener)
@@ -100,16 +97,10 @@ class MogoPrivateObuNewManager private constructor() {
override fun onConnectStatus(connectStatus: Int) {
if (connectStatus == 0) { //断开连接
mObuStatusInfo.obuStatus = false
mObuStatusInfo.obuHvStatus = false
mObuStatusInfo.obuRvStatus = false
CallerObuListenerManager.invokeListener(mObuStatusInfo)
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", false) }
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", false) }
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", false) }
CallerObuConnectListenerManager.invokeObuConnectListener(mObuStatusInfo)
} else if (connectStatus == 1) { //连接成功
mObuStatusInfo.obuStatus = true
CallerObuListenerManager.invokeListener(mObuStatusInfo)
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) }
CallerObuConnectListenerManager.invokeObuConnectListener(mObuStatusInfo)
}
}
@@ -117,9 +108,6 @@ class MogoPrivateObuNewManager private constructor() {
* HV车辆基础信息 CvxHvCarIndInfo CvxHvInfoIndInfo
*/
override fun onMogoObuHvBasics(p0: MogoObuHvBasicsData?) {
mObuStatusInfo.obuHvStatus = true
CallerObuListenerManager.invokeListener(mObuStatusInfo)
if (p0 != null && p0.vehBasicsMsg != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
@@ -168,8 +156,6 @@ class MogoPrivateObuNewManager private constructor() {
override fun onMogoObuRvWarning(data: MogoObuRvWarningData) {
super.onMogoObuRvWarning(data)
// if (HmiBuildConfig.isShowObuV2vView) { //TODO 临时需要关闭v2v开关
mObuStatusInfo.obuRvStatus = true
CallerObuListenerManager.invokeListener(mObuStatusInfo)
if (!data.warningMsg.warningData.isNullOrEmpty()) {
// 更新数据远车数据之前要匹配uuid
TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data)?.let {
@@ -192,9 +178,7 @@ class MogoPrivateObuNewManager private constructor() {
appId = data.warningMsg.warningData[0].warningType.toString()
status = data.warningMsg.warningData[0].status
//拼凑数据
if (appId != null) {
handleSdkObu(appId, direction, status, level, data)
}
handleSdkObu(appId, direction, status, level, data)
}
}
@@ -215,15 +199,11 @@ class MogoPrivateObuNewManager private constructor() {
*/
override fun onMogoObuSpatWarning(data: MogoObuSpatWarningData) {
super.onMogoObuSpatWarning(data)
if (data != null) {
// if (HmiBuildConfig.isShowObuV2iView) {
handlerTrafficLight(
data.warningType,
data.status,
data.lights
)
// }
}
handlerTrafficLight(
data.warningType,
data.status,
data.lights
)
}
/**
@@ -232,7 +212,7 @@ class MogoPrivateObuNewManager private constructor() {
override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) {
super.onMogoObuRsiWarning(data)
// if (HmiBuildConfig.isShowObuV2iView) {
if (data != null && data.warningMsg != null && data.warningMsg.size > 0) {
if (data.warningMsg != null && data.warningMsg.size > 0) {
var alertContent = ""
var ttsContent = ""
var appId = data.warningMsg[0].sceneType.toString()
@@ -411,7 +391,7 @@ class MogoPrivateObuNewManager private constructor() {
//显示警告红边
// CallerHmiManager.showWarning(direction)
//不显示弹框,语音提示,数据在消息盒子里面展示,此处不在处理弹框
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
CallerMsgBoxManager.saveMsgBox(
@@ -571,7 +551,7 @@ class MogoPrivateObuNewManager private constructor() {
?.updateITrafficThreatLevelInfo(it)
}
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
//显示警告红边
@@ -650,7 +630,10 @@ class MogoPrivateObuNewManager private constructor() {
MogoObuConstants.STATUS.DELETE -> { // 删除
UiThreadHandler.post {
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(-1,DataSourceType.OBU)
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
-1,
DataSourceType.OBU
)
}
}
}
@@ -926,7 +909,7 @@ private fun handlerTrafficLight(appId: Int, status: Int, lights: List<SpatLight>
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗
CallerHmiManager.disableWarningTrafficLight()
CallerTrafficLightListenerManager.disableTrafficLight()
CallerHmiManager.disableWarningV2X(appId.toString())
isShowGreenWave = false
isShowRunRedLight = false
@@ -1069,7 +1052,7 @@ private fun changeTrafficLightStatus(
when (currentLight.light) {
// 灯光不可用
0 -> {
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(0)
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.BLACK)
}
// 红灯
2, 3 -> {
@@ -1079,9 +1062,8 @@ private fun changeTrafficLightStatus(
}
isGreenLight = false
isYellowLight = false
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(1)
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.RED)
val red = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownRed(red)
}
// 绿灯
@@ -1092,9 +1074,8 @@ private fun changeTrafficLightStatus(
}
isRedLight = false
isYellowLight = false
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(3)
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.GREEN)
val green = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownGreen(green)
}
// 黄灯
@@ -1105,9 +1086,8 @@ private fun changeTrafficLightStatus(
isRedLight = false
isGreenLight = false
CallerHmiManager.disableWarningV2X(appId.toString())
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(2)
CallerTrafficLightListenerManager.invokeObuTrafficLightStatus(TrafficLightEnum.YELLOW)
val yellow = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownYellow(yellow)
}
}
}

View File

@@ -0,0 +1,90 @@
package com.mogo.eagle.core.function.datacenter.obu.adapter
import com.mogo.eagle.core.function.call.obu.*
import com.mogo.support.obu.OnMogoObuListener
import com.mogo.support.obu.constants.Define.ConnectStatus
import com.mogo.support.obu.model.*
/**
* 适配 OBU 回调监听分发,这里不做业务,只做数据包装及分发处理
* @author dong hong yu
*/
object MoGoObuListenerImpl : OnMogoObuListener() {
/**
* 连接状态
*
* @param connectStatus 连接状态
* @since 1.0.0
*/
override fun onConnectStatus(@ConnectStatus connectStatus: Int) {
//断开连接
if (connectStatus == 0) {
CallerObuConnectListenerManager.getObuStatusInfo().obuStatus = false
}
//连接成功
else if (connectStatus == 1) {
CallerObuConnectListenerManager.getObuStatusInfo().obuStatus = true
}
CallerObuConnectListenerManager.invokeObuConnectListener()
}
/**
* HV车辆基础信息
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuHvBasics(data: MogoObuHvBasicsData) {
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(data)
}
/**
* V2V预警信息
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRvWarning(data: MogoObuRvWarningData) {
CallerObuWarningRvListenerManager.invokeObuRvWarning(data)
}
/**
* 红绿灯预警信息
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuSpatWarning(data: MogoObuSpatWarningData) {
}
/**
* RSI预警信息
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) {
}
/**
* RSM预警信息
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRsmWarning(data: MogoObuRsmWarningData) {
}
/**
* 地图匹配结果
*
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuMapMath(data: MogoObuMapMathData) {
}
}