Merge branch 'dev_arch_opt_3.0' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_arch_opt_3.0

This commit is contained in:
xinfengkun
2023-02-21 11:47:49 +08:00
5 changed files with 80 additions and 103 deletions

View File

@@ -13,7 +13,6 @@ import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
* 处理obu分发出来在消息盒子展示的消息
*/
object V2xObuEventManager : IMoGoObuSaveMessageListener {
private const val TAG = "V2xObuEventManager"
fun init(context: Context) {
@@ -33,7 +32,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
* @param content 事件内容
* @param tts 事件语音播报
*/
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String) {
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, source: DataSourceType) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
@@ -43,7 +42,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
tts
)
).apply {
sourceType = DataSourceType.OBU
sourceType = source
}
)
}

View File

@@ -16,19 +16,16 @@ import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningSpatListener
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.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.obu.*
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
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.support.obu.ObuScene
import com.mogo.support.obu.constants.MogoObuConstants
import kotlin.math.roundToInt
/**
*
* @author lixiaopeng
@@ -78,7 +75,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
onMogoObuMapMath(mapMatchData)
}
/**
* RSI预警信息 CvxRtiThreatIndInfo交通标志预警前方限速、前方学校等等交通事件预警前方拥堵、前方积水等等
*/
@@ -140,9 +136,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
//车内标牌
MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> {
when (rsiWarningData.warningMsgList[0].signSerialNum) {
// MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口
// appId = V2iEventTypeEnum.TYPE_ID_NTERSECTION.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
}
@@ -191,10 +184,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
}
// MogoObuConstants.RTS.RTI_TYPE_GO_STRAIGHT_TURN_RIGHT -> { //直行或右转
// appId =
// EventTypeEnumNew.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType
}
@@ -258,11 +247,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.STATUS.ADD -> {
saveObuToDcData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
// 更新数据,是否需要
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)?.let {
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
@@ -272,14 +256,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据,删除标牌?
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)
// ?.let {
// // 事件结束,还原车辆颜色
// it.threatLevel = 0x01
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficInfo(it)
// }
}
}
}
@@ -296,25 +272,55 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (rsmWarningData != null && rsmWarningData.participant != null) {
var v2xType = ""
if (rsmWarningData.participant.ptcType == 1) { //机动车
v2xType =
var v2xType = when (rsmWarningData.participant.ptcType) {
1 -> { //机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participant.ptcType == 2) { //非机动车
v2xType =
}
2 -> { //非机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participant.ptcType == 3) { //行人
v2xType =
}
3 -> { //行人
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
}
else -> { //未知
EventTypeEnumNew.TYPE_ERROR.poiType
}
}
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
val alertContent =
EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction =
getMessageDirection(rsmWarningData.participant.targetPosition) //TODO 只有一个
val direction = getMessageDirection(rsmWarningData.participant.targetPosition)
//模型的显示
when (rsmWarningData.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
// 更新数据模型变色的时候是不是update,如果不是更新可能导致模型不变色add的时候是否有level高的 TODO
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
// 更新数据 TODO 删除原来的改变颜色删除marker。不影响别的模型添加
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
}
}
if (rsmWarningData.warningMsg != null && rsmWarningData.warningMsg.warningDataList != null && rsmWarningData.warningMsg.warningDataList.size > 0) {
level = rsmWarningData.warningMsg.warningDataList[0].warningLevel
CallerLogger.d(
@@ -323,45 +329,36 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
rsmWarningData.warningMsg.warningDataList[0].status
} --v2xType--- $v2xType ---alertContent = $alertContent ---ttsContent= $ttsContent"
)
when (rsmWarningData.warningMsg.warningDataList[0].status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//更新模型的颜色
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(v2xType, alertContent, ttsContent)
showWarning(v2xType, alertContent, ttsContent, direction)
// 更新数据 TODO
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
}
MogoObuConstants.STATUS.UPDATE -> {// 更新
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
MogoObuConstants.STATUS.DELETE -> { // 删除
// 关闭警告红边
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
// 更新数据 TODO 由于obu通过域控需要转换单位这里临时转换后面3.0不需要转换
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
// // 事件结束,还原交通参与者颜色
// it.threatLevel = 0x01
//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
// TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString())
}
}
}
}
}
}
/**
@@ -383,10 +380,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
* 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道
*/
fun onMogoObuMapMath(data: ObuScene.MapMatchData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuMapMath HmiBuildConfig.isShowObuLimitSpeedView = " + HmiBuildConfig.isShowObuLimitSpeedView
)
if (HmiBuildConfig.isShowObuLimitSpeedView) {
if (data != null) {
CallerLogger.d(
@@ -398,7 +391,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
} --- data.speedMaxLimit = ${data.speedMaxLimit}"
)
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加 TODO
MogoObuConstants.STATUS.ADD -> { // 添加
CallerLimitingVelocityListenerManager.invokeUnion(
(data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(),
DataSourceType.OBU
@@ -469,6 +462,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗,当收不到信号的时候触发一次
CallerTrafficLightListenerManager.disableTrafficLight()
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
isShowGreenWave = false
isShowRunRedLight = false
}
@@ -598,18 +592,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
* 保存obu通过工控机传输的数据到消息盒子
*/
private fun saveObuToDcData(type: String, content: String, tts: String) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
type,
content,
tts
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.TELEMATIC)
}
/**

View File

@@ -107,7 +107,7 @@ class MogoPrivateObuNewManager private constructor() {
fun setObuLog(isChecked: Boolean) {
ObuManager.getInstance().setEnableLog(isChecked)
val builder: com.mogo.support.obu.option.MogoObuLog.Builder =
val builder: MogoObuLog.Builder =
MogoObuLog.newBuilder().setEnableStdio(isChecked)
if (isChecked) {
builder.setStdioLevel(MogoObuLogLevel.DBG)
@@ -437,27 +437,24 @@ class MogoPrivateObuNewManager private constructor() {
if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (data != null && data.participant != null) {
var v2xType = ""
if (data.participant.ptcType == 1) { //机动车
v2xType =
var v2xType = when (data.participant.ptcType) {
1 -> { //机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (data.participant.ptcType == 2) { //非机动车
v2xType =
}
2 -> { //非机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (data.participant.ptcType == 3) { //行人
v2xType =
}
3 -> { //行人
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
}
else -> { //未知
EventTypeEnumNew.TYPE_ERROR.poiType
}
}
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
val alertContent =
EventTypeEnumNew.getWarningContent(v2xType)
val alertContent = EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction = getMessageDirection(data.participant.targetPosition)
//物体数据绘制
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuRsmWarning ---- data.status = ${data.status} ---data.participant.ptcId = ${data.participant.ptcId} ---data.participant.ptcType = ${data.participant.ptcType} ---data.warningMsg = ${data.warningMsg} -----data = ${data.toString()}"
@@ -745,11 +742,6 @@ class MogoPrivateObuNewManager private constructor() {
v2xType = EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType
}
// 这里处理固定的提示信息,包括了<紧急车辆提醒>
else -> {
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
}
}
when (status) {
@@ -830,9 +822,9 @@ class MogoPrivateObuNewManager private constructor() {
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗
CallerTrafficLightListenerManager.disableTrafficLight()
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
isShowGreenWave = false
isShowRunRedLight = false
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
}
}
}
@@ -969,7 +961,7 @@ class MogoPrivateObuNewManager private constructor() {
* 保存obu直连数据到消息盒子
*/
private fun saveObuData(type: String, content: String, tts: String) {
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts)
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.OBU)
}
/**

View File

@@ -1,5 +1,7 @@
package com.mogo.eagle.core.function.api.obu
import com.mogo.eagle.core.data.enums.DataSourceType
/**
* OBU 数据保存
* @author lixiaopeng
@@ -11,8 +13,8 @@ interface IMoGoObuSaveMessageListener {
* @param type 事件id类似与uuid
* @param content 事件内容
* @param tts 事件语音播报
*
* @param sourceType 来源
*/
fun onMoGoObuSaveMessage(type: String, content: String, tts: String)
fun onMoGoObuSaveMessage(type: String, content: String, tts: String, sourceType: DataSourceType)
}

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.function.call.obu
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.obu.IMoGoObuSaveMessageListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener
import com.mogo.eagle.core.function.call.base.CallerBase
@@ -11,11 +12,11 @@ import com.mogo.support.obu.ObuScene
*/
object CallerObuSaveMessageListenerManager : CallerBase<IMoGoObuSaveMessageListener>() {
fun invokeObuSaveMessage(type: String, content: String, tts: String) {
fun invokeObuSaveMessage(type: String, content: String, tts: String, sourceType: DataSourceType) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onMoGoObuSaveMessage(type, content, tts)
listener.onMoGoObuSaveMessage(type, content, tts, sourceType)
}
}