[dev_arch_opt_3.0] 优化obu

This commit is contained in:
lixiaopeng
2023-02-14 11:51:59 +08:00
parent 96f74c3f96
commit 8d8a078d6d
10 changed files with 133 additions and 469 deletions

View File

@@ -3,13 +3,7 @@
package="com.mogo.eagle.core.function.datacenter">
<application>
<receiver android:name=".obu.receiver.ObuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_trigger" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestTriggerRecognizedReceiver">
<intent-filter>
<action android:name="com.obu.test_trigger_recognized" />
@@ -18,13 +12,6 @@
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuRsuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_light_recognized" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestNewObuReceiver">
<intent-filter>
<action android:name="com.obu.test_newobu" />

View File

@@ -223,14 +223,14 @@ object MoGoLocationDispatcher :
/**
* OBU定位回调监听
*/
override fun onObuLocationWGS84(data: MogoObuHvBasicsData) {
override fun onObuLocationWGS84(data: MessagePad.GnssInfo) {
// 更新GNSS 信息
lastOBULocation.longitude = data.vehBasicsMsg.longitude
lastOBULocation.latitude = data.vehBasicsMsg.latitude
lastOBULocation.heading = data.vehBasicsMsg.heading
lastOBULocation.gnssSpeed = data.vehBasicsMsg.speed.toFloat()
lastOBULocation.altitude = data.vehBasicsMsg.elevation
lastOBULocation.satelliteTime = data.vehBasicsMsg.secMark
lastOBULocation.longitude = data.longitude
lastOBULocation.latitude = data.latitude
lastOBULocation.heading = data.heading
lastOBULocation.gnssSpeed = data.gnssSpeed.toFloat()
lastOBULocation.altitude = data.altitude
lastOBULocation.satelliteTime = (data.satelliteTime * 1000).toLong()
lastOBULocation.lastReceiveTime = TimeUtils.getNowMills()
// 将高德中的一些用于业务的数据进行融合例如CityCode、address等

View File

@@ -256,24 +256,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
when (status) {
// 添加
MogoObuConstants.STATUS.ADD -> {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
appId,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent, null, direction
)
saveObuToDcData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
// 更新数据,是否需要
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)?.let {
// CallerMapUIServiceManager.getMarkerService()
@@ -342,25 +326,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
when (rsmWarningData.warningMsg.warningDataList[0].status) {
MogoObuConstants.STATUS.ADD -> { // 添加
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
v2xType,
alertContent,
ttsContent,
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,
null,
direction
)
saveObuToDcData(v2xType, alertContent, ttsContent)
showWarning(v2xType, alertContent, ttsContent, direction)
// 更新数据 TODO
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
@@ -459,27 +426,19 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
return when (targetClassification) {
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT
-> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT
-> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方
MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
else -> WarningDirectionEnum.ALERT_WARNING_ALL
}
@@ -552,24 +511,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
"${M_OBU}${TAG}",
"MogoObuDcCombineManager changeTrafficLightStatus 闯红灯 --------> ttsContent = $ttsContent ---alertContent = $alertContent "
)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
saveObuToDcData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
}
@@ -605,23 +548,8 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
val maxSpeed = currentLight.suggestMaxSpeed * 3.6
if (maxSpeed > 0) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
saveObuToDcData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
}
}
@@ -666,4 +594,35 @@ 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
}
)
}
/**
* 消息盒子对应消息的语音播报
*/
private fun showWarning(type: String, content: String, tts: String, direction: WarningDirectionEnum) {
CallerHmiManager.warningV2X(
type,
content,
tts,
null,
direction
)
}
}

View File

@@ -29,7 +29,6 @@ import com.mogo.support.obu.constants.MogoObuComType
import com.mogo.support.obu.constants.MogoObuConstants
import com.mogo.support.obu.constants.MogoObuTopicId
import com.mogo.support.obu.model.*
import com.mogo.support.obu.model.advance.SpatLight
import com.mogo.support.obu.option.MogoObuCom
import com.mogo.support.obu.option.MogoObuOptions
import com.zhidao.support.obu.ObuManager
@@ -72,7 +71,7 @@ class MogoPrivateObuNewManager private constructor() {
.registerTopic(MogoObuTopicId.MAP_MATCH)
.build()
//每次连接的时候如果连接连接了,先断开
//每次连接的时候如果连接连接了,先断开防止ip改变等导致的连接失败
if (ObuManager.getInstance().connectStatus == 1) {
try {
ObuManager.getInstance().disconnect()
@@ -80,7 +79,6 @@ class MogoPrivateObuNewManager private constructor() {
e.printStackTrace()
}
}
ObuManager.getInstance().connect(options)
}
@@ -92,7 +90,6 @@ class MogoPrivateObuNewManager private constructor() {
ObuManager.getInstance().disconnect()
}
private val mogoObuListener: OnObuListener = object : OnObuListener {
/**
* 连接状态的改变
@@ -111,15 +108,15 @@ class MogoPrivateObuNewManager private constructor() {
* HV车辆基础信息 gnssInfo
*/
override fun onGnssInfo(gnssInfo: MessagePad.GnssInfo?) {
if (gnssInfo != null ) {
if (gnssInfo != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onGnssInfo lon = ${gnssInfo.longitude} --- lat = ${gnssInfo.latitude} ---speed = ${gnssInfo.gnssSpeed} ---heading = ${gnssInfo.heading} --acceleration = ${gnssInfo.acceleration} --yawRate = ${gnssInfo.yawRate}"
)
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统1-工控机2-OBU
if (2 == FunctionBuildConfig.gpsProvider) {
// 同步给MAP地图 TODO
// CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
// 同步给MAP地图
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(
System.currentTimeMillis() / 1000.0,
@@ -244,9 +241,6 @@ class MogoPrivateObuNewManager private constructor() {
//车内标牌
MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> {
when (data.warningMsgList[0].signSerialNum) {
// MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口
// appId = EventTypeEnumNew.TYPE_ID_NTERSECTION.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
}
@@ -296,11 +290,6 @@ class MogoPrivateObuNewManager private constructor() {
// 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
}
@@ -371,24 +360,8 @@ class MogoPrivateObuNewManager private constructor() {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
appId,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
null, direction
)
saveObuData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
// 更新数据
TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(data)?.let {
@@ -472,19 +445,6 @@ class MogoPrivateObuNewManager private constructor() {
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
//处理删除逻辑,
// if (rsmPtcIdMap.containsKey(data.participant.ptcId.toString())) {
// var oldTime = rsmPtcIdMap[data.participant.ptcId.toString()]
// var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000
// if (timeDiff > 3) { //超过3秒,删除对应弱势交通元素
// CallerMapUIServiceManager.getMarkerService()
// ?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString())
// }
// rsmPtcIdMap.remove(data.participant.ptcId.toString())
// rsmPtcIdMap[data.participant.ptcId.toString()] = System.currentTimeMillis()
// } else {
// rsmPtcIdMap[data.participant.ptcId.toString()] = System.currentTimeMillis()
// }
}
MogoObuConstants.STATUS.DELETE -> { // 删除
@@ -522,25 +482,8 @@ class MogoPrivateObuNewManager private constructor() {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
v2xType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
null, direction
)
saveObuData(v2xType, alertContent, ttsContent)
showWarning(v2xType, alertContent, ttsContent, direction)
}
MogoObuConstants.STATUS.UPDATE -> {// 更新
@@ -593,9 +536,8 @@ class MogoPrivateObuNewManager private constructor() {
}
}
}
}
}
}
}
}
/**
* 获取消息的方位 车辆相关
@@ -605,27 +547,19 @@ class MogoPrivateObuNewManager private constructor() {
return when (targetClassification) {
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT
-> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT
-> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方
MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
else -> WarningDirectionEnum.ALERT_WARNING_ALL
}
@@ -633,10 +567,9 @@ class MogoPrivateObuNewManager private constructor() {
/**
* 构造对应展示数据和场景 根据obu的场景add change delete确定是否展示
*
* @param appId 使用WarningTypeEnum获取icon、提示内容、tts内容 TODO 添加事件频繁播报拦截
*
* @see com.mogo.module.common.enums.EventTypeEnum
* @see com.mogo.module.common.enums.EventTypeEnumNew
* EventTypeEnumNew在定义的id为了防止重复和原始数据是不一样的有对应关系
*/
private fun handleSdkObu(
appId: String,
@@ -766,9 +699,9 @@ class MogoPrivateObuNewManager private constructor() {
}
// 这里处理固定的提示信息,包括了<紧急车辆提醒>
else -> { //TODO
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
else -> {
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
}
}
@@ -782,18 +715,7 @@ class MogoPrivateObuNewManager private constructor() {
)
if (level == 2 || level == 3) {
//不显示弹框,其它保留
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
appId,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
saveObuData(appId, alertContent, ttsContent)
CallerHmiManager.warningV2X(
appId,
alertContent,
@@ -837,7 +759,11 @@ class MogoPrivateObuNewManager private constructor() {
/**
* 处理红绿灯
*/
private fun handlerTrafficLight(appId: Int, status: Int, lights: MutableList<ObuBase.SpatLight>) {
private fun handlerTrafficLight(
appId: Int,
status: Int,
lights: MutableList<ObuBase.SpatLight>
) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId"
@@ -845,8 +771,7 @@ class MogoPrivateObuNewManager private constructor() {
when (status) {
// 添加
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE
-> {
MogoObuConstants.STATUS.UPDATE -> {
if (lights != null && lights.isNotEmpty()) {
changeTrafficLightStatus(appId, lights)
}
@@ -857,9 +782,6 @@ class MogoPrivateObuNewManager private constructor() {
CallerTrafficLightListenerManager.disableTrafficLight()
isShowGreenWave = false
isShowRunRedLight = false
// lightCountDownRed = 1
// lightCountDownGreen = 1
// lightCountDownYellow = 1
}
}
}
@@ -867,7 +789,6 @@ class MogoPrivateObuNewManager private constructor() {
private var isShowGreenWave = false
private var isShowRunRedLight = false
/**
* 修改红绿灯
*/
@@ -893,31 +814,13 @@ class MogoPrivateObuNewManager private constructor() {
if (!isShowRunRedLight) {
isShowRunRedLight = true
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"changeTrafficLightStatus 闯红灯 --------> "
)
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "changeTrafficLightStatus 闯红灯 --------> ")
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
saveObuData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
}
@@ -935,33 +838,16 @@ class MogoPrivateObuNewManager private constructor() {
ttsContent =
String.format(
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeedTts
)
adviceSpeedTts)
alertContent =
String.format(
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
adviceSpeed)
val maxSpeed = currentLight.suggestMaxSpeed
if (maxSpeed > 0) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent// 只有第一次才tts防止更新的时候不断的提醒
)
saveObuData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
}
}
@@ -1004,4 +890,39 @@ class MogoPrivateObuNewManager private constructor() {
)
}
}
}
}
/**
* 保存obu直连数据到消息盒子
*/
private fun saveObuData(type: String, content: String, tts: String) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
type,
content,
tts
)
).apply {
sourceType = DataSourceType.OBU
}
)
}
/**
* 消息盒子对应消息的语音播报
*/
private fun showWarning(type: String, content: String, tts: String, direction: WarningDirectionEnum) {
CallerHmiManager.warningV2X(
type,
content,
tts,
null,
direction
)
}
}

View File

@@ -1,15 +1,17 @@
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.ObuScene
import com.mogo.support.obu.constants.Define.ConnectStatus
import com.mogo.support.obu.model.*
import com.zhidao.support.obu.OnObuListener
import mogo.telematics.pad.MessagePad
/**
* 适配 OBU 回调监听分发,这里不做业务,只做数据包装及分发处理
* @author dong hong yu
*/
object MoGoObuListenerImpl : OnMogoObuListener() {
object MoGoObuListenerImpl : OnObuListener {
/**
* 连接状态
@@ -36,8 +38,10 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuHvBasics(data: MogoObuHvBasicsData) {
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(data)
override fun onGnssInfo(gnssInfo: MessagePad.GnssInfo?) {
if (gnssInfo != null) {
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
}
}
/**
@@ -46,8 +50,7 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRvWarning(data: MogoObuRvWarningData) {
CallerObuWarningRvListenerManager.invokeObuRvWarning(data)
override fun onObuRvWarning(rvWarningData: ObuScene.RvWarningData?) {
}
/**
@@ -56,8 +59,7 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuSpatWarning(data: MogoObuSpatWarningData) {
override fun onObuSpatWarning(spatWarningData: ObuScene.SpatWarningData?) {
}
/**
@@ -66,8 +68,7 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRsiWarning(data: MogoObuRsiWarningData) {
override fun onObuRsiWarning(rsiWarningData: ObuScene.RsiWarningData?) {
}
/**
@@ -76,7 +77,7 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuRsmWarning(data: MogoObuRsmWarningData) {
override fun onObuRsmWarning(rsmWarningData: ObuScene.RsmWarningData?) {
}
/**
@@ -85,6 +86,8 @@ object MoGoObuListenerImpl : OnMogoObuListener() {
* @param data 数据
* @since 1.0.0
*/
override fun onMogoObuMapMath(data: MogoObuMapMathData) {
override fun onObuMapMath(mapMatchData: ObuScene.MapMatchData?) {
}
}

View File

@@ -1,120 +0,0 @@
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
//import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
//import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuManager
//import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
//import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
//import com.zhidao.support.obu.constants.ObuConstants
//import com.zhidao.support.obu.model.CvxIvpThreatIndInfo
//import com.zhidao.support.obu.model.CvxPtcThreatIndInfo
//import com.zhidao.support.obu.model.CvxRtiThreatIndInfo
//import com.zhidao.support.obu.model.CvxSlwThreatIndInfo
//import com.zhidao.support.obu.model.advance.*
/**
* @author lixiaopeng
* @date 2021/8/18
*
* OBU 测试使用
* 红绿灯
*/
class ObuRsuTestTriggerReceiver : BroadcastReceiver() {
private var mContext: Context? = null
companion object {
private const val TAG = "ObuRsuTestTriggerReceiver"
}
override fun onReceive(context: Context, intent: Intent) {
mContext = context
// val obuType = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_TYPE_EXTRA_KEY, 0)
// val obuStatus = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_STATES_EXTRA_KEY, 0)
// val obuLevel = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_LEVEL_EXTRA_KEY, 3)
// val indicator = intent.getIntExtra(MogoObuConst.BROADCAST_LIGHT_LEVEL_EXTRA_KEY, 0)
// val pctType = intent.getIntExtra(MogoObuConst.BROADCAST_PTC_INFO_EXTRA_KEY, 0)
// val rtiType = intent.getIntExtra(MogoObuConst.BROADCAST_RTI_TYPE_EXTRA_KEY, 0)
//
// CallerLogger.d(
// "$M_OBU$TAG", "obuStatus:$obuStatus phase:$indicator obuType:$obuType obuLevel:$obuLevel"
// )
//
// when (obuType) {
// ObuConstants.USE_CASE_ID.IVP -> { //构建红绿灯数据
// val cvxIvpThreatIndInfo = CvxIvpThreatIndInfo(1, 1, 1L)
//
// val ivpThreat = IvpThreat(1, obuType, null, 1000, obuLevel, 100)
//
// cvxIvpThreatIndInfo.threat_info = ivpThreat
//
// val lightList = listOf(
// Light(1, 0x0, 1000, 3000, 6000, 3000, 100, 1000),
// Light(1, 0x1, 1000, 3000, 6000, 3000, 100, 1000),
// Light(1, 0x2, 1000, 3000, 6000, 3000, 100, 1000),
// Light(1, 0x3, 1000, 3000, 6000, 3000, 100, 1000)
// )
// val ivpThreatExt = IvpThreatExt(1, 1000, 1000, 0, indicator, lightList)
// cvxIvpThreatIndInfo.ext_info = ivpThreatExt
// cvxIvpThreatIndInfo.status = obuStatus
// cvxIvpThreatIndInfo.link_id = "1"
//
// MogoPrivateObuManager.INSTANCE.getMogoObuListener()
// .onCvxIvpThreatIndInfo(cvxIvpThreatIndInfo)
// }
//
// ObuConstants.USE_CASE_ID.SLW -> { //限速预警
// val cvxSlwThreatIndInfo = CvxSlwThreatIndInfo(1, 1, 1L)
// val slwThreatExt = SlwThreatExt(1, 2, 6000, 2000)
//
// cvxSlwThreatIndInfo.ext_info = slwThreatExt
// cvxSlwThreatIndInfo.status = obuStatus
//
// MogoPrivateObuManager.INSTANCE.getMogoObuListener()
// .onCvxSlwThreatIndInfo(cvxSlwThreatIndInfo)
// }
//
// //弱势交通参与者碰撞预警,行人/摩托车碰撞预警
// ObuConstants.USE_CASE_ID.VRUCW -> {
// val cvxPtcIndInfo = CvxPtcThreatIndInfo(1, 1, 1)
// val position = Position(1, 399739429, 1164115207, 20)
// cvxPtcIndInfo.ptc_pos = position
// cvxPtcIndInfo.ptc_id = "111"
// cvxPtcIndInfo.ptc_type = pctType
// cvxPtcIndInfo.status = obuStatus
//
// val v2vThreat = V2vThreat(1, obuType, null, 1000, obuLevel, 100)
// cvxPtcIndInfo.threat_info = v2vThreat
//
// MogoPrivateObuManager.INSTANCE.getMogoObuListener()
// .onCvxPtcThreatIndInfo(cvxPtcIndInfo)
// }
//
// //道路危险情况, 车内标牌, 前方拥堵提醒
// ObuConstants.USE_CASE_ID.HLW, ObuConstants.USE_CASE_ID.IVS, ObuConstants.USE_CASE_ID.TJW -> {
// val cvxRtiThreatIndInfo = CvxRtiThreatIndInfo(1, 1, 1L)
// val dateTime = DateTime(1, 1, 1, 1, 1, 1, 1, 1)
// val rtiThread = RtiThreat(1, obuType, dateTime, 100000, obuLevel, 100)
// val extInfo = RtiThreatExt(1, rtiType, 0x02, 100000, 100000)
// val position = Position(1, 399739429, 1164115207, 20)
//
// // 位置围栏
// val zonesInfo = listOf(
// ZoneInfo(1, 2000, 2000, listOf(position))
// )
//
// cvxRtiThreatIndInfo.rti_id = "123123"
// cvxRtiThreatIndInfo.zones_info = zonesInfo
// cvxRtiThreatIndInfo.threat_info = rtiThread
// cvxRtiThreatIndInfo.ext_info = extInfo
// cvxRtiThreatIndInfo.status = obuStatus
//
// MogoPrivateObuManager.INSTANCE.getMogoObuListener()
// .onCvxRtiThreatIndInfo(cvxRtiThreatIndInfo)
// }
// }
}
}

View File

@@ -14,7 +14,7 @@ import com.mogo.support.obu.model.advance.WarningData
* @author lixiaopeng
* @date 2022/9/8 10:50 上午
*
* 自研OBU 模拟场景
* 自研OBU 模拟场景 HV
*/
class ObuTestNewObuReceiver : BroadcastReceiver() {
private var mContext: Context? = null
@@ -49,6 +49,8 @@ class ObuTestNewObuReceiver : BroadcastReceiver() {
// val cvxHvInfoIndInfo = MogoRvWarningData(0, vehBasicsMsg, warningMsg)
// val gnssInfo = MessagePad.GnssInfo()
// MogoPrivateObuNewManager.INSTANCE
// .getMogoObuListener()
// .onGnssInfo(cvxHvInfoIndInfo)

View File

@@ -1,89 +0,0 @@
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
//import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
//import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuManager
//import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
//import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
//import com.zhidao.support.obu.constants.ObuConstants
//import com.zhidao.support.obu.model.CvxV2vThreatIndInfo
//import com.zhidao.support.obu.model.advance.MovingObjectInfo
//import com.zhidao.support.obu.model.advance.Position
//import com.zhidao.support.obu.model.advance.V2vThreat
//import com.zhidao.support.obu.model.advance.V2vThreatExt
//import kotlin.random.Random
/**
* @author xiaoyuzhou
* @date 2021/8/11 10:50 上午
*
* OBU 测试使用
*/
class ObuTestTriggerReceiver : BroadcastReceiver() {
private var mContext: Context? = null
companion object {
private const val TAG = "ObuTestTriggerReceiver"
}
override fun onReceive(context: Context, intent: Intent) {
// mContext = context
// /**
// * OBU 场景类型
// * @see com.zhidao.support.obu.constants.ObuConstants.USE_CASE_ID
// */
// val obuType = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_TYPE_EXTRA_KEY, 0)
// val obuStatus = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_STATES_EXTRA_KEY, 0)
// val obuLevel = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_LEVEL_EXTRA_KEY, 3)
// val obuDirection =
// intent.getIntExtra(MogoObuConst.BROADCAST_OBU_EVENT_DIRECTION_EXTRA_KEY, 0x11)
// CallerLogger.d(
// "$M_OBU$TAG", "obuType:$obuType obuStatus:$obuStatus obuDirection$obuDirection"
// )
//
// when (obuType) {
// ObuConstants.USE_CASE_ID.EBW, ObuConstants.USE_CASE_ID.FCW, ObuConstants.USE_CASE_ID.ICW,
// ObuConstants.USE_CASE_ID.CLW, ObuConstants.USE_CASE_ID.DNPW, ObuConstants.USE_CASE_ID.AVW,
// ObuConstants.USE_CASE_ID.BSW, ObuConstants.USE_CASE_ID.LCW, ObuConstants.USE_CASE_ID.EVW, ObuConstants.USE_CASE_ID.VRUCW,
// ObuConstants.USE_CASE_ID.SLW, ObuConstants.USE_CASE_ID.LTA, ObuConstants.USE_CASE_ID.HLW, ObuConstants.USE_CASE_ID.IVS,
// ObuConstants.USE_CASE_ID.TJW, ObuConstants.USE_CASE_ID.IVP, ObuConstants.USE_CASE_ID.COC -> {
//
// // 构建测试数据
// val cvxV2vThreatIndInfo = CvxV2vThreatIndInfo(1, 1, 1L)
//
// val v2vThreat = V2vThreat(1, obuType, null, 1000, obuLevel, 100)
// cvxV2vThreatIndInfo.threat_info = v2vThreat
//
// val v2vThreatExt =
// V2vThreatExt(
// 1, 1, obuDirection, 1, 1
// )
// cvxV2vThreatIndInfo.ext_info = v2vThreatExt
// cvxV2vThreatIndInfo.status = obuStatus
// cvxV2vThreatIndInfo.vehicle_id = "123321"
//
//
// // 设置位置
// val randomLocation = Random.nextInt(100, 2000)
//
// val position = Position(
// 0, (399739429 + randomLocation).toLong(),
// (1164115207 + randomLocation).toLong(), 20
// )
// val movingObjectInfo = MovingObjectInfo(
// 0,
// position,
// 1800 +randomLocation,
// 6000 +randomLocation
// )
// cvxV2vThreatIndInfo.basic_info = movingObjectInfo
//
// MogoPrivateObuManager.INSTANCE.getMogoObuListener()
// .onCvxV2vThreatIndInfo(cvxV2vThreatIndInfo)
// }
// }
}
}

View File

@@ -1,6 +1,6 @@
package com.mogo.eagle.core.function.api.obu
import com.mogo.support.obu.model.MogoObuHvBasicsData
import mogo.telematics.pad.MessagePad
/**
* OBU HV 自车车辆基础信息数据,自车定位数据 WGS84 坐标系
@@ -15,6 +15,6 @@ interface IMoGoObuLocationWGS84Listener {
* @param data 数据
* @since 1.0.0
*/
fun onObuLocationWGS84(data: MogoObuHvBasicsData)
fun onObuLocationWGS84(data: MessagePad.GnssInfo)
}

View File

@@ -3,13 +3,14 @@ package com.mogo.eagle.core.function.call.obu
import com.mogo.eagle.core.function.api.obu.IMoGoObuLocationWGS84Listener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.support.obu.model.MogoObuHvBasicsData
import mogo.telematics.pad.MessagePad
/**
* OBU HV 自车车辆基础信息数据,自车定位数据 WGS84 坐标系
*/
object CallerObuLocationWGS84ListenerManager : CallerBase<IMoGoObuLocationWGS84Listener>() {
fun invokeObuLocationWGS84(data: MogoObuHvBasicsData) {
fun invokeObuLocationWGS84(data: MessagePad.GnssInfo) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value