完成OBU红绿灯状态控制
This commit is contained in:
@@ -58,52 +58,59 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
|
||||
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
|
||||
//OBU连接成功
|
||||
override fun onConnected() {
|
||||
//OBU连接成功
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onConnected ------> ")
|
||||
}
|
||||
|
||||
//OBU连接失败
|
||||
override fun onConnectFail(isNeedReconnect: Boolean) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onConnectFail ------> ")
|
||||
//OBU连接失败
|
||||
|
||||
}
|
||||
|
||||
//OBU断开连接
|
||||
override fun onDisconnect() {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onDisconnect ------> ")
|
||||
//OBU断开连接
|
||||
|
||||
}
|
||||
|
||||
//接收到的原始数据
|
||||
override fun onReceiveOriginData(data: String) {
|
||||
super.onReceiveOriginData(data)
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onReceiveOriginData ------> data = $data")
|
||||
//接收到的原始数据
|
||||
|
||||
}
|
||||
|
||||
//发送的数据
|
||||
override fun onSendData(bytes: ByteArray) {
|
||||
super.onSendData(bytes)
|
||||
//发送的数据
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onSendData ------> ")
|
||||
}
|
||||
|
||||
//CV2X系统信息
|
||||
override fun onCvxAppInitIndInfo(info: CvxAppInitIndInfo) {
|
||||
super.onCvxAppInitIndInfo(info)
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxAppInitIndInfo ------> $info")
|
||||
//CV2X系统信息
|
||||
|
||||
}
|
||||
|
||||
//设置CV2X系统的配置确认
|
||||
override fun onCvxSetConfigCfm(info: CvxSetConfigCfmInfo) {
|
||||
super.onCvxSetConfigCfm(info)
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxSetConfigCfm ------> $info")
|
||||
//设置CV2X系统的配置确认
|
||||
|
||||
}
|
||||
|
||||
//主车车辆信息
|
||||
override fun onCvxHvCarIndInfo(info: CvxHvCarIndInfo) {
|
||||
//主车车辆信息
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxHvCarIndInfo ------> $info")
|
||||
}
|
||||
|
||||
//主车信息
|
||||
override fun onCvxHvInfoIndInfo(info: CvxHvInfoIndInfo) {
|
||||
//主车信息
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxHvInfoIndInfo ------> $info")
|
||||
|
||||
}
|
||||
|
||||
override fun onCvxRvInfoIndInfo(info: CvxRvInfoIndInfo) {
|
||||
@@ -116,10 +123,49 @@ class MogoPrivateObuManager private constructor() {
|
||||
// 弱势交通预警
|
||||
override fun onCvxPtcInfoIndInfo(info: CvxPtcInfoIndInfo?) {
|
||||
super.onCvxPtcInfoIndInfo(info)
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxPtcInfoIndInfo ------> $info")
|
||||
|
||||
}
|
||||
|
||||
//TODO 他车是否一直出现
|
||||
// 红绿灯信息
|
||||
override fun onCvxMapSpatInfoIndInfo(info: CvxMapSpatInfoIndInfo?) {
|
||||
super.onCvxMapSpatInfoIndInfo(info)
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxMapSpatInfoIndInfo ------> $info")
|
||||
info?.let {
|
||||
when (info.status) {
|
||||
// 删除红绿灯
|
||||
2 -> {
|
||||
mIMoGoWaringProvider?.disableWarningTrafficLight()
|
||||
}
|
||||
// 添加\更新红绿灯状态
|
||||
else -> {
|
||||
info.ivp_threat_ext.lights.forEach {
|
||||
when (it.phase) {
|
||||
// 灯光不可用
|
||||
0x0 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(0)
|
||||
}
|
||||
// 红灯
|
||||
0x1 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(1)
|
||||
}
|
||||
// 绿灯
|
||||
0x2 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(3)
|
||||
}
|
||||
// 黄灯
|
||||
0x3 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//V2V预警信息 TODO 他车是否一直出现
|
||||
override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo) {
|
||||
Logger.e(MogoObuConst.TAG_MOGO_OBU, "onCvxV2vThreatIndInfo ------> $info")
|
||||
//预警信息,预警类型 threat_level 3
|
||||
@@ -188,7 +234,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
/**
|
||||
* 构造对应展示数据和场景 根据obu的场景,add change delete确定是否展示
|
||||
*
|
||||
* @param useCaseId TODO 这里需要修改成 使用WarningTypeEnum获取icon、提示内容、tts内容
|
||||
* @param useCaseId 使用WarningTypeEnum获取icon、提示内容、tts内容
|
||||
*
|
||||
* @see com.mogo.module.common.enum.WarningTypeEnum
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user