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/SweeperLimitingVelocityView.kt
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficDataView.java
#	OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml
This commit is contained in:
donghongyu
2023-01-31 17:25:18 +08:00
185 changed files with 2897 additions and 5656 deletions

View File

@@ -0,0 +1,226 @@
#### 说明
自研OBU感知预警模块,wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=58209118
接收OBU回调数据,进行UI呈现及相关业务
硬件记录:
经纬度采用WGS84坐标系
自车信息100毫秒回调一次需要处理断连风险采用Android系统自身定位信息「可能需要转换下坐标」
V2I场景会有持续性通知Status。需要有保底的情况进行超时清除事件
RV场景收到即显示收不到或断链的时候清除
多预警场景触发HVRV 会采用两个通道,同时触发的时候会采用集合的形式回调,优先级高的在最上面(待验证)
# OBU Lib
## 下载
* 步骤1添加到项目根目录 build.gradle 中
```groovy
allprojects {
repositories {
maven{
url 'http://maven.aliyun.com/nexus/content/groups/public/'}
maven {
url 'http://nexus.zhidaoauto.com/repository/maven-releases/'
}
maven {
url 'http://nexus.zhidaoauto.com/repository/maven-public/'
}
...
}
}
```
* 步骤2添加依赖关系
```groovy
dependencies {
implementation 'com.zhidao.support.obu:mogoobu:1.0.0.8'
...
}
```
## 初始化
```java
MogoObuManager.getInstance().init(Context context);
```
## 连接
```java
//默认192.168.8.199
MogoObuManager.getInstance().connect();
//自定义 IP
MogoObuManager.getInstance().connect(String ip);
```
## 断开连接
```java
MogoObuManager.getInstance().disConnect();
```
## 注册监听
```java
MogoObuManager.getInstance().registerListener(OnMogoObuListener obuListener);
```
## 取消注册监听
```java
MogoObuManager.getInstance().unregisterListener();
```
## OBU监听
```java
private OnMogoObuListener listener = new OnMogoObuListener() {
@Override
public void onConnected() {
//OBU连接成功
}
@Override
public void onConnectFail(boolean isNeedReconnect) {
//OBU连接失败
}
@Override
public void onDisconnect() {
//OBU断开连接
}
@Override
public void onReceiveOriginData(byte[] data) {
super.onReceiveOriginData(data);
//接收到的原始数据
}
@Override
public void onReceiveOriginData(String data) {
super.onReceiveOriginData(data);
//接收到的原始数据
}
@Override
public void onSendData(byte[] bytes) {
super.onSendData(bytes);
//发送的数据
}
@Override
public void onCvxHvCarIndInfo(CvxHvCarIndInfo info) {
super.onCvxHvCarIndInfo(info);
//主车车辆信息
}
@Override
public void onCvxHvInfoIndInfo(CvxHvInfoIndInfo info) {
//主车信息
}
@Override
public void onCvxRvInfoIndInfo(CvxRvInfoIndInfo info) {
//远车信息
}
@Override
public void onCvxRoadTrafficInfoIndInfo(CvxRoadTrafficInfoIndInfo info) {
super.onCvxRoadTrafficInfoIndInfo(info);
}
@Override
public void onCvxPtcInfoIndInfo(CvxPtcInfoIndInfo info) {
super.onCvxPtcInfoIndInfo(info);
}
@Override
public void onCvxMapSpatInfoIndInfo(CvxMapSpatInfoIndInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
}
@Override
public void onCvxV2vThreatIndInfo(CvxV2vThreatIndInfo info) {
//V2V预警信息
}
@Override
public void onCvxPtcThreatIndInfo(CvxPtcThreatIndInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
}
@Override
public void onCvxRtiThreatIndInfo(CvxRtiThreatIndInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
}
@Override
public void onCvxIvpThreatIndInfo(CvxIvpThreatIndInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
}
@Override
public void onCvxSlwThreatIndInfo(CvxSlwThreatIndInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
}
@Override
public void onCvxThreatRankIndInfo(CvxThreatRankIndInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
}
@Override
public void onCvxAppInitIndInfo(CvxAppInitIndInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
// CVX系统信息
}
@Override
public void onCvxAppErrorIndInfo(CvxAppErrorIndInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
}
@Override
public void onCvxAppDbgRangeCheckIndInfo(CvxAppDbgRangeCheckIndInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
}
@Override
public void onCvxSetConfigCfm(CvxSetConfigCfmInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
//设置CVX系统的配置确认
}
@Override
public void onCvxAppErrorCfmInfo(CvxAppErrorCfmInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
}
@Override
public void onNuImplInfo(NuImplInfo info) {
super.onCvxMapSpatInfoIndInfo(info);
//异常/错误/未知数据
}
};
```
## 测试数据
```java
//CVX_V2V_THREAT_IND USECASE_ID_ICW 交叉路口碰撞预警
String data = "0200003901000000000000000FFAE449D7DCF8228D0000142A03000907E507020C032C012C00000F1B010B50000B00000662470A5700000653";
//CVX_V2V_THREAT_IND USECASE_ID_FCW 前向碰撞预警
String data = "02000138010000000000001effd7892b11a4440af70100142a02000907e506100e033b0258000006a0010000000b0000146411005a00000c290010000a17f5ea0f45955b1000fd68da01d200090a0006012c01f4009600080032003200320032000b00000000000000000000000000000000190000002300000895000000060000089500000890695a11000000a20010000a17f5eb5a459568ed00fd00001e140010000a17f5eb004595796b00fd000267fa0010000a17f5e9bc45957b9b00fd0002709c0010000a17f5e81945957a9700fd0002786c0010000a17f5e87a4595757300fd000285500010000a17f5e8fd4595649400fd0002a3000010000a17f5e74a459536a400fe0002f6fc0010000a17f5e8ef459525a001000006bb700010000a17f5e92a4595144a01010006d7f400060000448e2710";
//CVX_V2V_THREAT_IND USECASE_ID_BSW 盲区预警
String data = "020000ba010000000000001effd2b073b490d08b0e0100142a07000907e506100c2b070258fffff364010000000b0000365a22465700003a980010000a17f5e977459491bd01032283012e00090a0006012c01f400960008009d009d009d009d000b0000000000000000000000000000000019fffffffcfffff0acfffffd62fffff17000000f4a699222000000240010000a17f5e8fa45948c230103000037dc0010000a17f5e6a345948a4c0121000259f40006000027101f40";
// CVX_V2V_THREAT_IND USECASE_ID_EBW 紧急制动预警
String data = "02000126010000000000001EFF58E70F553F9EA4DE0100142A01000907E506120E360500C8000004930322F7000B000008A4118B99000001F00010000A17F595114595DC2500FB02BD027200090A0006012C01F400960008FE76FE76FE76FE76000B0000000000000000000000000000000019FFFFFFB400000687FFFFFFB4000006870000068C01E511000000900010000A17F588164595D9FF00FB000015180010000A17F579234595D8A900FA000101D00010000A17F577844595D67E00FA00010FD60010000A17F578A64595D49400FA00011B8E0010000A17F57E884595D68B00FA00012D900010000A17F5AA0D4595DE5100FC000184AC0010000A17F5BFB04595E08300FC000204040010000A17F5C0EA4595E06A00F5000798EC00060004FFEC2710";
//CVX_HV_INFO_IND 自车信息
String data = "010100D70000000000000003DF000907E506120E090E01900010000A17F5EF204595EBFF00DB098B028700060000000000000008004E004E004E004E000B000000000000000000000000000000007E0010000A17F5ED014595EA8300DB0000044C0010000A17F5E9914595E5B300DB00000F3C0010000A17F5E82C4595DDE600DB000020D00010000A17F5E88945959A4200E500009A4C0010000A17F5E78945958C6300E50000B8C30010000A17F5E8C8459580A100D40007F51C0010000A17F5E90D459565C900DE000820780006FFFFF07617700000";
//CVX_RV_INFO_IND 远车信息
String data = "010200E700000000000001FEFF58E70F553F9EA4DE00000907E506120F050B00B50010000A17F587544595D9DE00FA145300DE000600000000000000090A0006012C01F400960008FFC7FFC7FFC7FFC7000B0000000000000000000000000000000019FFFFFD9200000834FFFFFD920000083400000891425F000000005A0010000A17F5871A4595D84500FB000006A40010000A17F588AD4595D6DC00FA0000125C0010000A17F5A3264595DD1000FB000682680010000A17F5EC2E4595E99A00FD000718040010000A17F5EE664595E9F900FD00071D180006FFFFD8F0177000000000000000";
```
## 测试方法调用
```java
/**
* @param data 原始OBU数据流
*/
MogoObuManager.getInstance().test(String data);
/**
* @param opCode 参数1: OP_CODE
* 参数2: 目前只有OP_CODE = ObuConstants.OP_CODE.CVX_V2V_THREAT_IND时有效,OP_CODE为其他值时不需要传入
* 当OP_CODE = ObuConstants.OP_CODE.CVX_V2V_THREAT_IND预警时 默认不填紧急制动预警,0:交叉路口碰撞预警,1:前向碰撞预警,2:盲区预警
*/
MogoObuManager.getInstance().test(@Define.OpCode int... opCode) {
```

View File

@@ -54,16 +54,17 @@ dependencies {
kapt rootProject.ext.dependencies.androidxroomcompiler
implementation rootProject.ext.dependencies.androidxroomktx
implementation rootProject.ext.dependencies.mogoami
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation rootProject.ext.dependencies.mogoobu
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation project(':libraries:mogo-adas')
implementation rootProject.ext.dependencies.mogocommons
} else {
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
@@ -71,8 +72,6 @@ dependencies {
implementation project(':libraries:mogo-adas')
implementation project(':foudations:mogo-commons')
}
}

View File

@@ -1,6 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
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" />
<category android:name="android.intent.category.DEFAULT" />
</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" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestNewObuRsiReceiver">
<intent-filter>
<action android:name="com.obu.test_newobu_rsi" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -0,0 +1,21 @@
package com.mogo.eagle.core.function
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.datacenter.IDataCenterProvider
@Route(path = MogoServicePaths.PATH_DATA_CENTER_MODULE)
class DataCenterProvider: IDataCenterProvider {
override val functionName: String
get() = "DataCenterProvider"
override fun init(context: Context?) {
}
override fun onDestroy() {
}
}

View File

@@ -62,9 +62,9 @@ import java.util.concurrent.TimeUnit
/**
* 域控制器
* @author xiaoyuzhou
* @date 2021/9/22 8:43 下午
* 域控制器
*/
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
class MoGoAutopilotProvider :

View File

@@ -0,0 +1,105 @@
package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.obu.IMoGoObuProvider
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
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.CommonUtils
import com.mogo.support.obu.MogoObuManager
/**
* @author xiaoyuzhou
* @date 2021/8/2 5:52 下午
*/
@Route(path = MogoServicePaths.PATH_V2X_OBU_MOGO)
class MoGoObuProvider : IMoGoObuProvider {
private val TAG = "MoGoObuProvider"
private var mContext: Context? = null
private val busObuIp = "192.168.8.199"
private val taxiObuIp = "192.168.1.199"
override val functionName: String
get() = TAG
override fun onDestroy() {
}
override fun init(context: Context) {
//obu融合数据
MogoObuDcCombineManager.INSTANCE.init(context)
CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU…… localIp = " + CommonUtils.getLocalIPAddress())
//bus乘客版本obu功能去掉
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(
FunctionBuildConfig.appIdentityMode
)
) {
//不处理
} else {
mContext = context
mContext?.let {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //bus 司机端
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, busObuIp)
//mogo obu
MogoPrivateObuNewManager.INSTANCE.connectObu(
it,
ipAddress,
CommonUtils.getIpAddressString()
)
} else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp)
//mogo obu
MogoPrivateObuNewManager.INSTANCE.connectObu(
it,
ipAddress,
CommonUtils.getIpAddressString()
)
}
}
}
}
/**
* 通过控制面板设置ip进行传递
*/
override fun connect(ipAddress: String) {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(
FunctionBuildConfig.appIdentityMode
)
) {
//不处理
} else {
mContext?.let {
// 保存本地OBU IP地址
SharedPrefsMgr.getInstance(it).putString(MoGoConfig.OBU_IP, ipAddress)
//连接 mogo obu
MogoPrivateObuNewManager.INSTANCE.connectObu(
it,
ipAddress,
CommonUtils.getIpAddressString()
)
}
}
}
override fun disConnect() {
MogoPrivateObuNewManager.INSTANCE.disconnect()
}
override fun isConnected(): Boolean {
return MogoObuManager.getInstance().connectStatus == 1
}
}

View File

@@ -0,0 +1,33 @@
package com.mogo.eagle.core.function.datacenter.obu;
/**
* author : lxiiaopeng
* date : 2021-08-4
* desc : 常量
*/
public class MogoObuConst {
/**
* 自研obu的tag
*/
public static final String TAG_MOGO_OBU = "MogoObu";
public static final String TAG_MOGO_NEW_OBU = "MogoNewObu";
// OBU 场景测试
// 场景类型
public static String BROADCAST_OBU_TYPE_EXTRA_KEY = "obuType";
// 场景操作状态ObuConstants.STATUS
public static String BROADCAST_OBU_STATES_EXTRA_KEY = "obuStates";
// 场景预警等级2-弹窗3-弹窗+tts+地图绘制
public static String BROADCAST_OBU_LEVEL_EXTRA_KEY = "obuLevel";
//红绿灯标识 0:不可用1红灯2绿灯3黄灯
public static String BROADCAST_LIGHT_LEVEL_EXTRA_KEY = "lightLevel";
//弱势交通 0未知1非机动车2行人
public static String BROADCAST_PTC_INFO_EXTRA_KEY = "ptcInfo";
//道路交通信息类型 0x0--0x17
public static String BROADCAST_RTI_TYPE_EXTRA_KEY = "rtiType";
//道路交通信息触发方向 0x11--0x47
public static String BROADCAST_OBU_EVENT_DIRECTION_EXTRA_KEY = "obuEventDirection";
}

View File

@@ -0,0 +1,666 @@
package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
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.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.obucombine.IMoGoObuDcCombineListener
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.v2x.CallerLimitingVelocityListenerManager
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.constants.MogoObuConstants
import mogo.v2x.ObuWarningEvent
import mogo.v2x.ObuWarningEvent.*
import kotlin.math.roundToInt
/**
*
* @author lixiaopeng
* @since 2021/11/30
* @description 工控机融合数据
*/
class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener {
companion object {
val INSTANCE: MogoObuDcCombineManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
MogoObuDcCombineManager()
}
}
private var mContext: Context? = null
private val TAG = "MogoObuDcCombineManager"
fun init(context: Context) {
mContext = context
CallerObuDcCombineListenerManager.addListener(TAG, this)
}
fun destoryListener() {
CallerObuDcCombineListenerManager.removeListener(TAG)
}
/**
* 通过工控机中转的obu数据,包括rsirsmspat
*
*/
override fun onMoGoObuDcCombineData(obuWarningData: ObuWarningEvent.ObuWarningData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMoGoObuDcCombineData obuWarningData = ${obuWarningData.toString()} ---obuWarningData.msgDataType = ${obuWarningData?.msgDataType}"
)
obuWarningData?.let {
when (obuWarningData.msgDataType) {
1 -> { //rsiEvent
onMogoObuDcRsiWarning(obuWarningData.rsiEvent)
}
2 -> { //RsmEvent
onMogoObuDcRsmWarning(obuWarningData.rsmEvent)
}
3 -> { //SpatEvent
onMogoObuDcSpatWarning(obuWarningData.spatEvent)
}
4 -> { //map
onMogoObuMapMath(obuWarningData.mapMatchData)
}
}
}
}
/**
* RSI预警信息 CvxRtiThreatIndInfo交通标志预警前方限速、前方学校等等交通事件预警前方拥堵、前方积水等等
*/
fun onMogoObuDcRsiWarning(rsiWarningData: RsiWarningData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuRsiWarning ------> ${rsiWarningData.toString()}"
)
if (rsiWarningData != null && rsiWarningData.warningMsgList != null && rsiWarningData.warningMsgList.size > 0) {
var alertContent = ""
var ttsContent = "" //列表只有一项
var appId = rsiWarningData.warningMsgList[0].sceneType.toString()
val status = rsiWarningData.status
val level = rsiWarningData.warningMsgList[0].warningLevel
val direction = getMessageDirection(rsiWarningData.warningMsgList[0].targetPosition)
CallerLogger.d("${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuDcRsiWarning appId = $appId --status = $status --level = $level -- eventSerialNum = ${rsiWarningData.warningMsgList[0].eventSerialNum} ---signSerialNum = ${rsiWarningData.warningMsgList[0].signSerialNum} --- direction = $direction -- targetPosition = ${rsiWarningData.warningMsgList[0].targetPosition}"
)
when (appId) {
// 道路危险情况预警
MogoObuConstants.RSI_SCENE_TYPE.HLW.toString() -> {
when (rsiWarningData.warningMsgList[0].eventSerialNum) {
MogoObuConstants.RTE.RTI_TYPE_BREAKDOWN -> {//车辆故障
appId = EventTypeEnumNew.TYPE_USECASE_ID_BREAKDOWN_WARNING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_ROAD_WATER -> { //道路积水
appId = EventTypeEnumNew.FOURS_PONDING.poiType
}
MogoObuConstants.RTE.RTI_TYPE_PARKING_VIOLATION -> { //异常停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PARKING.poiType
}
// MogoObuConstants.RTE.RTI_TYPE_CONSTRUCTION_RTE -> { //施工占道,和标牌重复
// appId = EventTypeEnumNew.FOURS_ROAD_WORK.poiType
// }
MogoObuConstants.RTE.RTI_TYPE_SPEEDING -> { //超速行驶
appId = EventTypeEnumNew.TYPE_USECASE_ID_SLW.poiType
}
MogoObuConstants.RTE.RTI_TYPE_RETRIGRADE -> { //车辆逆行
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_VEHICLE_RETROGRADE.poiType
}
}
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //事件才有影响范围
alertContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(),
Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(),
Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString()
)
}
//车内标牌
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
}
MogoObuConstants.RTS.RTI_TYPE_BRIDGE -> { //桥梁
appId = EventTypeEnumNew.TYPE_ID_BRIDGE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_PEDESTRIAN -> { //行人
appId = EventTypeEnumNew.TYPE_ID_PEDESTRIAN.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SLIPPERY_ROAD -> { //路滑
appId = EventTypeEnumNew.TYPE_ID_SLIPPERY_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_TUNNEL -> { //隧道
appId = EventTypeEnumNew.TYPE_ID_TUNNEL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_FERRY -> { //渡轮
appId = EventTypeEnumNew.TYPE_ID_FERRY.poiType
}
MogoObuConstants.RTS.RTI_TYPE_UNEVEN_ROAD -> { //路面不平
appId = EventTypeEnumNew.TYPE_ID_UNEVEN_ROAD.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NON_MOTOR_VEHICLE -> { //非机动车
appId = EventTypeEnumNew.TYPE_ID_NON_MOTOR_VEHICLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_OBSTACLE -> { //障碍
appId = EventTypeEnumNew.TYPE_ID_OBSTACLE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_CONSTRUCTION -> { //施工
appId = EventTypeEnumNew.TYPE_FOURS_ROAD_WORK.poiType
}
MogoObuConstants.RTS.RTI_TYPE_VEHICLE_QUEUE -> { //车队
appId = EventTypeEnumNew.TYPE_VEHICLE_QUEUE.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_PASSING -> { //不通
appId = EventTypeEnumNew.TYPE_NO_PASSING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TURNING_AROUND -> { //禁止掉头
appId = EventTypeEnumNew.TYPE_NO_TURNING_AROUND.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_STOPPING -> { //禁止停车
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_PARKING.poiType
}
MogoObuConstants.RTS.RTI_TYPE_NO_TOOTING -> { //禁止鸣笛
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_NO_TOOTING.poiType
}
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
}
MogoObuConstants.RTS.RTI_TYPE_NARROW_RIGHT -> { //右侧变窄/车道数减少
appId = EventTypeEnumNew.TYPE_USECASE_ID_NARROW_RIGHT.poiType
}
MogoObuConstants.RTS.RTI_TYPE_GAS_STATION -> { //加油站
appId = EventTypeEnumNew.TYPE_USECASE_ID_GAS_STATION.poiType
}
MogoObuConstants.RTS.RTI_TYPE_SCHOOL -> { //学校
appId =
EventTypeEnumNew.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
}
MogoObuConstants.RTS.RTI_TYPE_ACCIDENT -> { //事故
appId = EventTypeEnumNew.TYPE_USECASE_ID_ACCIDENT.poiType
}
}
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //标牌是没有影响范围的
alertContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString()
)
}
// 拥堵
MogoObuConstants.RSI_SCENE_TYPE.TJW.toString() -> {
appId = EventTypeEnumNew.TYPE_USECASE_ID_TJW.poiType
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
alertContent = String.format( //事件才有影响范围
alertContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(),
Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString()
)
ttsContent = String.format(
ttsContent,
Math.round(rsiWarningData.warningMsgList[0].distance / 100.0).toString(),
Math.round(rsiWarningData.warningMsgList[0].eventRadius / 10.0).toString()
)
}
//限速预警, ADD处理一次
MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
}
}
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager ttsContent = $ttsContent --alertContent = $alertContent --appId = $appId ---direction = ${direction.direction} --distance = ${rsiWarningData.warningMsgList[0].distance} ---eventRadius = ${rsiWarningData.warningMsgList[0].eventRadius} --speedMaxLimit = ${rsiWarningData.warningMsgList[0].speedMaxLimit}"
)
when (status) {
// 添加
MogoObuConstants.STATUS.ADD -> {
//显示警告红边
CallerHmiManager.showWarning(direction)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
appId,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
)
// 更新数据,是否需要
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)?.let {
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
// CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
CallerHmiManager.disableWarningV2X((appId + direction.direction))
// 更新数据,删除标牌?
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)
// ?.let {
// // 事件结束,还原车辆颜色
// it.threatLevel = 0x01
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficInfo(it)
// }
}
}
}
}
/**
* RSM预警信息 CvxPtcThreatIndInfo CvxPtcInfoIndInfo主车与弱势交通参与者之间的预警弱势交通参与者碰撞预警
*/
fun onMogoObuDcRsmWarning(rsmWarningData: RsmWarningData?) {
if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuRsmWarning ------> ${rsmWarningData.toString()}"
)
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (rsmWarningData != null && rsmWarningData.participantOfOne != null) {
var v2xType = ""
if (rsmWarningData.participantOfOne.ptcType == 1) { //机动车
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participantOfOne.ptcType == 2) { //非机动车
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participantOfOne.ptcType == 3) { //行人
v2xType =
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
}
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
val alertContent =
EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction =
getMessageDirection(rsmWarningData.participantOfOne.targetPosition) //TODO 只有一个
if (rsmWarningData.warningMsg != null && rsmWarningData.warningMsg.warningDataList != null && rsmWarningData.warningMsg.warningDataList.size > 0) {
level = rsmWarningData.warningMsg.warningDataList[0].warningLevel
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuRsmWarning ---status---> ${rsmWarningData.status} --list status----> ${rsmWarningData.warningMsg.warningDataList.get(0).status} --v2xType--- $v2xType ---alertContent = $alertContent ---ttsContent= $ttsContent"
)
when (rsmWarningData.warningMsg.warningDataList.get(0).status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//显示警告红边
CallerHmiManager.showWarning(direction)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
v2xType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerHmiManager.warningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(v2xType + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(
WarningDirectionEnum.ALERT_WARNING_NON
)
}
},
true,
5000L
)
// 更新数据 TODO
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
}
MogoObuConstants.STATUS.UPDATE -> {// 更新
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据 TODO 由于obu通过域控需要转换单位这里临时转换后面3.0不需要转换
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
// // 事件结束,还原交通参与者颜色
// it.threatLevel = 0x01
//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString())
// TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString())
}
}
}
}
}
}
/**
* 红绿灯预警信息
*/
fun onMogoObuDcSpatWarning(spatWarningData: SpatWarningData?) {
CallerLogger.d("${M_OBU}${TAG}", "onMogoObuDcSpatWarning warningType = ${spatWarningData!!.warningType} --status = ${spatWarningData?.status} --lightsList = ${spatWarningData.lightsList}")
handlerTrafficLight(
spatWarningData!!.warningType,
spatWarningData?.status,
spatWarningData?.lightsList
)
}
/**
* 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道
*/
fun onMogoObuMapMath(data: MapMatchData?) {
CallerLogger.d("${M_OBU}${TAG}", "MogoObuDcCombineManager onMogoObuMapMath HmiBuildConfig.isShowObuLimitSpeedView = " + HmiBuildConfig.isShowObuLimitSpeedView)
if(HmiBuildConfig.isShowObuLimitSpeedView) {
if (data != null) {
CallerLogger.d("${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuMapMath = ${data.status} --speedMaxLimit = ${Math.round((data.speedMaxLimit*0.02*3.6))} --- data.speedMaxLimit = ${data.speedMaxLimit}")
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加 TODO
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
(data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(),DataSourceType.OBU)
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(-1 ,DataSourceType.OBU)
}
}
}
}
}
/**
* 获取消息的方位 车辆相关
*/
private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum {
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
}
}
/**
* 处理红绿灯
*/
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<ObuWarningEvent.SpatLight>) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId"
)
when (status) {
// 添加
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE
-> {
if (lights != null && lights.isNotEmpty()) {
changeTrafficLightStatus(appId, lights)
}
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗,当收不到信号的时候触发一次
CallerHmiManager.disableWarningTrafficLight()
CallerHmiManager.disableWarningV2X(appId.toString())
isShowGreenWave = false
isShowRunRedLight = false
}
}
}
private var isRedLight = false
private var isGreenLight = false
private var isShowGreenWave = false
private var isShowRunRedLight = false
/**
* 修改红绿灯
*/
@Synchronized
private fun changeTrafficLightStatus(
appId: Int,
lights: List<ObuWarningEvent.SpatLight>
) {
var ttsContent = ""
var alertContent = ""
//这里需要根据真实数据确定 index 取值方式
val currentLight = lights[0]
CallerLogger.e(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager currentLight = $currentLight ---currentLight.phaseID = ${currentLight.phaseID} ---appId = $appId ---isShowRunRedLight = $isShowRunRedLight ---isShowGreenWave = $isShowGreenWave"
)
// 闯红灯预警和绿波通行底层是互斥的
when (appId) {
0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效
}
1 -> { //闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if (!isShowRunRedLight) {
isShowRunRedLight = true
CallerHmiManager.disableWarningV2X(1667.toString())
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
CallerLogger.d("${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防止更新的时候不断的提醒
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, null, true, 5000L)
}
}
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次
if (!isShowGreenWave) {
isShowGreenWave = true
CallerHmiManager.disableWarningV2X(1666.toString())
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager 绿波通行引导 --------> speed_min = ${currentLight.suggestMinSpeed} --speed_max = ${currentLight.suggestMaxSpeed}")
val adviceSpeed =
"${Math.round(currentLight.suggestMinSpeed*3.6*0.02)} - ${Math.round(currentLight.suggestMaxSpeed*3.6*0.02)}"
val adviceSpeedTts =
"${Math.round(currentLight.suggestMinSpeed*3.6*0.02)} - ${Math.round(currentLight.suggestMaxSpeed*3.6*0.02)}"
ttsContent =
String.format(
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeedTts
)
alertContent =
String.format(
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
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防止更新的时候不断的提醒
appId.toString(),
null,
true,
5000L
)
}
}
}
}
when (currentLight.light) {
// 灯光不可用
0 -> {
CallerHmiManager.showWarningTrafficLight(0, 2)
}
// 红灯
2, 3 -> {
if (!isRedLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isRedLight = true
}
isGreenLight = false
CallerHmiManager.showWarningTrafficLight(1, 2)
val red = currentLight.countDown / 10
CallerHmiManager.changeCountdownRed(red)
}
// 绿灯
4, 5, 6 -> {
if (!isGreenLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isGreenLight = true
}
isRedLight = false
CallerHmiManager.showWarningTrafficLight(3, 2)
val green = currentLight.countDown / 10
CallerHmiManager.changeCountdownGreen(green)
}
// 黄灯
7, 8 -> {
CallerHmiManager.disableWarningV2X(appId.toString())
CallerHmiManager.showWarningTrafficLight(2, 2)
val yellow = currentLight.countDown / 10
CallerHmiManager.changeCountdownYellow(yellow)
}
}
}
}

View File

@@ -0,0 +1,120 @@
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

@@ -0,0 +1,58 @@
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.datacenter.obu.MogoPrivateObuNewManager
import com.mogo.support.obu.model.MogoObuRvWarningData
import com.mogo.support.obu.model.advance.V2xWarning
import com.mogo.support.obu.model.advance.VehBasics
import com.mogo.support.obu.model.advance.WarningData
/**
* @author lixiaopeng
* @date 2022/9/8 10:50 上午
*
* 自研OBU 模拟场景
*/
class ObuTestNewObuReceiver : BroadcastReceiver() {
private var mContext: Context? = null
companion object {
private const val TAG = "ObuTestNewObuReceiver"
}
override fun onReceive(context: Context, intent: Intent) {
mContext = context
/**
* OBU 场景类型
* @see com.zhidao.support.obu.constants.ObuConstants.USE_CASE_ID
*/
val obuType = intent.getIntExtra("type", 0)
val obuStatus = intent.getIntExtra("status", 0)
val obuLevel = intent.getIntExtra("level", 3)
val direction = intent.getIntExtra("direction", 0)
val vehBasicsMsg = VehBasics(1)
vehBasicsMsg.targetPosition = direction
val warningMsg = V2xWarning(1)
val warningData1 = WarningData(1, 2)
warningData1.warningType = obuType
warningData1.warningLevel = obuLevel
// val warningData2 = WarningData(1, 3)
val warningList = listOf(warningData1)
warningMsg.warningData = warningList
val cvxHvInfoIndInfo = MogoObuRvWarningData(0, vehBasicsMsg, warningMsg)
MogoPrivateObuNewManager.INSTANCE
.getMogoObuListener()
.onMogoObuRvWarning(cvxHvInfoIndInfo)
}
}

View File

@@ -0,0 +1,52 @@
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.datacenter.obu.MogoPrivateObuNewManager
import com.mogo.support.obu.model.MogoObuRsiWarningData
import com.mogo.support.obu.model.advance.RsiWarning
/**
* @author lixiaopeng
* @date 2023/1/13 10:50 上午
*
* 自研OBU RSI 模拟场景
*/
class ObuTestNewObuRsiReceiver : BroadcastReceiver() {
private var mContext: Context? = null
companion object {
private const val TAG = "ObuTestNewObuReceiver"
}
override fun onReceive(context: Context, intent: Intent) {
mContext = context
/**
* OBU 场景类型
*/
val obuSceneType = intent.getIntExtra("sceneType", 0)
val obuStatus = intent.getIntExtra("status", 0)
// val obuDistance = intent.getDoubleExtra("distance", 0.0)
val obuEventSeriaNum = intent.getIntExtra("seriaNum", 0)
val obuSignSerialNum = intent.getIntExtra("signSerialNum", 0)
val rsiWarning = RsiWarning(1)
rsiWarning.warningLevel = 1
rsiWarning.setDistance(1000)
rsiWarning.sceneType = obuSceneType //预警类型 0无效 1限速信息 2道路危险 3车内标牌 4前方拥堵
rsiWarning.eventSerialNum = obuEventSeriaNum //根据预警类型匹配 101 车辆故障
rsiWarning.signSerialNum = obuSignSerialNum // 2急转弯8桥梁
val rsiWarningList = listOf(rsiWarning) //TODO
val cvxObuRsiInfo = MogoObuRsiWarningData(obuStatus, 1, rsiWarningList)
MogoPrivateObuNewManager.INSTANCE
.getMogoObuListener()
.onMogoObuRsiWarning(cvxObuRsiInfo)
}
}

View File

@@ -0,0 +1,89 @@
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

@@ -0,0 +1,61 @@
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.model.CvxHvInfoIndInfo
//import com.zhidao.support.obu.model.advance.MovingObjectInfo
//import com.zhidao.support.obu.model.advance.Position
//import kotlin.random.Random
/**
* @author xiaoyuzhou
* @date 2021/8/11 10:50 上午
*
* OBU 模拟自车
*/
class ObuTestTriggerRecognizedReceiver : BroadcastReceiver() {
private var mContext: Context? = null
companion object {
private const val TAG = "ObuTestTriggerRecognizedReceiver"
}
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)
// CallerLogger.d("$M_OBU$TAG", "obuType:$obuType obuStatus:$obuStatus obuLevel:$obuLevel")
//
// val cvxHvInfoIndInfo = CvxHvInfoIndInfo(0, 1, 2)
//
// 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
// )
// cvxHvInfoIndInfo.basic_info = movingObjectInfo
//
// MogoPrivateObuManager.INSTANCE
// .getMogoObuListener()
// .onCvxHvInfoIndInfo(cvxHvInfoIndInfo)
}
}

View File

@@ -0,0 +1,132 @@
package com.mogo.eagle.core.function.datacenter.obu.utils
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.traffic.TrafficData
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.model.MogoObuRsiWarningData
import com.mogo.support.obu.model.MogoObuRsmWarningData
import com.mogo.support.obu.model.MogoObuRvWarningData
/**
* @description 自研obu数据转换
*
* @author lixiaopeng
* @since 2022/8/24
*/
object TrafficDataConvertUtilsNew {
val TAG = "TrafficDataConvertUtilsNew"
/**
* OBU 远车 转换交通元素数据,是否需要
*/
fun cvxRvInfoIndInfo2TrafficData(info: MogoObuRvWarningData): TrafficData? {
if (info.vehBasicsMsg == null) {
CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE
trafficData.uuid = info.vehBasicsMsg.id
trafficData.lat = info.vehBasicsMsg.latitude
trafficData.lon = info.vehBasicsMsg.longitude
trafficData.heading = info.vehBasicsMsg.heading
trafficData.speed = info.vehBasicsMsg.speed
return trafficData
}
/**
* OBU RSU道路事件预警信息 转换交通元素数据 标牌 为何要显示level
*/
fun cvxRtiThreatIndInfo2TrafficData(info: MogoObuRsiWarningData): TrafficData? {
if (info.warningMsg == null || info.warningMsg.size < 1 || info.warningMsg[0].position == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG
trafficData.uuid = info.warningMsg[0].signSerialNum.toString()
trafficData.lat = info.warningMsg[0].position.latitude
trafficData.lon = info.warningMsg[0].position.longitude
trafficData.threatLevel = info.warningMsg[0].warningLevel
return trafficData
}
/**
* OBU 预警事件 转换交通元素数据 他车预警
*/
fun cvxV2vThreatIndInfo2TrafficData(info: MogoObuRvWarningData): TrafficData? {
if (info == null || info.vehBasicsMsg == null || info.warningMsg == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.uuid = info.vehBasicsMsg.id
trafficData.lat = info.vehBasicsMsg.latitude
trafficData.lon = info.vehBasicsMsg.longitude
trafficData.heading = info.vehBasicsMsg.heading
trafficData.speed = info.vehBasicsMsg.speed
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg.warningData != null) {
trafficData.threatLevel = info.warningMsg.warningData[0].warningLevel
} else {
trafficData.threatLevel = 1
}
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE
return trafficData
}
/**
* OBU 弱势交通参与者信息 转换交通元素数据
*/
fun cvxPtcThreatIndInfo2TrafficData(info: MogoObuRsmWarningData): TrafficData? {
if (info.participant == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.uuid = info.participant.ptcId.toString()
trafficData.lat = info.participant.latitude
trafficData.lon = info.participant.longitude
trafficData.heading = info.participant.heading
trafficData.speed = info.participant.speed
/**
* 交通参与者类型
* 0未知
* 1机动车
* 2非机动车
* 3行人
* 4OBU自身
*/
when (info.participant.ptcType) {
// 未知
0 -> {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI
}
//机动车
1 -> {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO
}
// 非机动车
2 -> {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE
}
// 行人
3 -> {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE
}
}
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg != null && info.warningMsg.warningData != null) {
trafficData.threatLevel = info.warningMsg.warningData[0].warningLevel
} else {
trafficData.threatLevel = 1
}
return trafficData
}
}