红绿灯预警方法合并
This commit is contained in:
@@ -13,6 +13,7 @@ import com.zhidao.support.obu.MogoObuManager
|
||||
import com.zhidao.support.obu.OnMogoObuListener
|
||||
import com.zhidao.support.obu.constants.ObuConstants
|
||||
import com.zhidao.support.obu.model.*
|
||||
import com.zhidao.support.obu.model.advance.Light
|
||||
|
||||
/**
|
||||
* @description
|
||||
@@ -129,37 +130,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
override fun onCvxIvpThreatIndInfo(info: CvxIvpThreatIndInfo?) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "CvxIvpThreatIndInfo ------> $info")
|
||||
info?.let {
|
||||
when (info.status) {
|
||||
// 添加
|
||||
ObuConstants.STATUS.ADD -> {
|
||||
info.ext_info.lights.forEach {
|
||||
when (it.phase) {
|
||||
// 灯光不可用
|
||||
0x0 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(0)
|
||||
}
|
||||
// 红灯
|
||||
0x1 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(1)
|
||||
}
|
||||
// 绿灯
|
||||
0x2 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(3)
|
||||
}
|
||||
// 黄灯
|
||||
0x3 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
mIMoGoWaringProvider?.disableWarningTrafficLight()
|
||||
}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
handlerTrafficLight(info.status, info.ext_info.lights)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,42 +138,10 @@ class MogoPrivateObuManager private constructor() {
|
||||
override fun onCvxMapSpatInfoIndInfo(info: CvxMapSpatInfoIndInfo?) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxMapSpatInfoIndInfo ------> $info")
|
||||
info?.let {
|
||||
when (info.status) {
|
||||
// 添加
|
||||
ObuConstants.STATUS.ADD -> {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 删除红绿灯
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
mIMoGoWaringProvider?.disableWarningTrafficLight()
|
||||
}
|
||||
// 更新
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
handlerTrafficLight(info.status, info.ivp_threat_ext.lights)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 弱势交通预警
|
||||
override fun onCvxPtcInfoIndInfo(info: CvxPtcInfoIndInfo?) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxPtcInfoIndInfo ------> $info")
|
||||
@@ -270,6 +209,42 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理红绿灯
|
||||
*/
|
||||
private fun handlerTrafficLight(status: Int, lights: List<Light>) =
|
||||
when (status) {
|
||||
// 添加
|
||||
ObuConstants.STATUS.ADD -> {
|
||||
lights.forEach {
|
||||
when (it.phase) {
|
||||
// 灯光不可用
|
||||
0x0 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(0)
|
||||
}
|
||||
// 红灯
|
||||
0x1 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(1)
|
||||
}
|
||||
// 绿灯
|
||||
0x2 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(3)
|
||||
}
|
||||
// 黄灯
|
||||
0x3 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
mIMoGoWaringProvider?.disableWarningTrafficLight()
|
||||
}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回OBU监听
|
||||
*/
|
||||
@@ -411,9 +386,9 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
when (status) {
|
||||
when (status) {
|
||||
// 添加
|
||||
ObuConstants.STATUS.ADD-> {
|
||||
ObuConstants.STATUS.ADD -> {
|
||||
//显示警告红边
|
||||
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
|
||||
getMessageDirection(direction),
|
||||
|
||||
Reference in New Issue
Block a user