修改V2V逻辑
This commit is contained in:
@@ -14,6 +14,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.MovingObjectInfo
|
||||
|
||||
/**
|
||||
* @description
|
||||
@@ -251,53 +252,34 @@ class MogoPrivateObuManager private constructor() {
|
||||
override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) {
|
||||
Logger.e(MogoObuConst.TAG_MOGO_OBU, "onCvxV2vThreatIndInfo ------> $info")
|
||||
info?.let {
|
||||
when (info.status) {
|
||||
// 添加
|
||||
ObuConstants.STATUS.ADD -> {
|
||||
//预警信息,预警类型 threat_level 3
|
||||
info.threat_info?.let {
|
||||
if (info.threat_info.threat_level > 1) {
|
||||
//预警方位
|
||||
val direction = info.ext_info.target_classification
|
||||
//显示警告红边
|
||||
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
|
||||
getMessageDirection(direction),
|
||||
"ACTION_V2X_FRONT_WARNING"
|
||||
)
|
||||
//预警信息,预警类型 threat_level 3
|
||||
info.threat_info?.let {
|
||||
if (info.threat_info.threat_level > 1) {
|
||||
//预警方位
|
||||
val direction = info.ext_info.target_classification
|
||||
//显示警告红边
|
||||
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
|
||||
getMessageDirection(direction),
|
||||
"ACTION_V2X_FRONT_WARNING"
|
||||
)
|
||||
|
||||
//处理预警类型
|
||||
val appId = info.threat_info.app_id
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"direction = " + direction + "----" + getMessageDirection(
|
||||
direction
|
||||
) + "--appId = " + appId
|
||||
)
|
||||
handleSdkObu(
|
||||
appId,
|
||||
info.threat_info.threat_level,
|
||||
getMessageDirection(direction),
|
||||
info.status
|
||||
)
|
||||
// 这里不主动添加元素,原因是onCvxRvInfoIndInfo中会展示周边车,只用修改对应的车辆位置即可
|
||||
}
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
// 移除顶部弹窗
|
||||
mIMoGoWaringProvider?.disableWarningV2X(info.vehicle_id)
|
||||
// 移除地图元素
|
||||
mObuRecognizedResultDrawer?.removeCvxRvInfoIndInfo(info.vehicle_id)
|
||||
}
|
||||
// 更新
|
||||
else -> {
|
||||
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
|
||||
mObuRecognizedResultDrawer?.updateCvxRvInfoIndInfo(
|
||||
info.threat_info.threat_level,
|
||||
//处理预警类型
|
||||
val appId = info.threat_info.app_id
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"direction = " + direction + "----" + getMessageDirection(
|
||||
direction
|
||||
) + "--appId = " + appId
|
||||
)
|
||||
handleSdkObu(
|
||||
info.vehicle_id,
|
||||
appId,
|
||||
info.threat_info.threat_level,
|
||||
getMessageDirection(direction),
|
||||
info.status,
|
||||
info.basic_info
|
||||
)
|
||||
// 这里不主动添加元素,原因是onCvxRvInfoIndInfo中会展示周边车,只用修改对应的车辆位置即可
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,7 +318,14 @@ class MogoPrivateObuManager private constructor() {
|
||||
*
|
||||
* @see com.mogo.module.common.enum.WarningTypeEnum
|
||||
*/
|
||||
private fun handleSdkObu(useCaseId: Int, level: Int, direction: Int, status: Int) {
|
||||
private fun handleSdkObu(
|
||||
vehicleId: String,
|
||||
useCaseId: Int,
|
||||
level: Int,
|
||||
direction: Int,
|
||||
status: Int,
|
||||
basicInfo: MovingObjectInfo
|
||||
) {
|
||||
var alertContent = ""
|
||||
var ttsContent = ""
|
||||
Log.d(MogoObuConst.TAG_MOGO_OBU, "useCaseId = $ " + useCaseId)
|
||||
@@ -433,16 +422,34 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
//显示弹框,语音提示
|
||||
if (status == ObuConstants.STATUS.ADD) {
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
useCaseId,
|
||||
alertContent,
|
||||
if (level == 3) ttsContent else "",
|
||||
useCaseId.toString()
|
||||
)
|
||||
} else if (status == ObuConstants.STATUS.DELETE) {
|
||||
mIMoGoWaringProvider!!.disableWarningV2X(useCaseId.toString())
|
||||
|
||||
when (status) {
|
||||
// 添加
|
||||
ObuConstants.STATUS.ADD -> {
|
||||
//显示弹框,语音提示
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
useCaseId,
|
||||
alertContent,
|
||||
if (level == 3) ttsContent else "",
|
||||
useCaseId.toString()
|
||||
)
|
||||
}
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
// 移除顶部弹窗
|
||||
mIMoGoWaringProvider?.disableWarningV2X(useCaseId.toString())
|
||||
// 移除地图元素
|
||||
mObuRecognizedResultDrawer?.removeCvxRvInfoIndInfo(vehicleId)
|
||||
}
|
||||
// 更新
|
||||
else -> {
|
||||
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
|
||||
mObuRecognizedResultDrawer?.updateCvxRvInfoIndInfo(
|
||||
level,
|
||||
vehicleId,
|
||||
basicInfo
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user