同步212 版本

This commit is contained in:
lixiaopeng
2022-11-15 19:05:33 +08:00
730 changed files with 31009 additions and 55206 deletions

View File

@@ -102,4 +102,12 @@ class MoGoObuProvider : IMoGoObuProvider {
}
}
override fun disConnect() {
MogoPrivateObuManager.INSTANCE.disConnectObu()
}
override fun isConnected(): Boolean {
return MogoPrivateObuManager.INSTANCE.isConnected()
}
}

View File

@@ -22,6 +22,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.module.common.drawer.TrafficMarkerDrawer
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.module.common.enums.EventTypeHelper
import com.mogo.service.IMogoServiceApis
import com.zhidao.support.obu.MogoObuManager
import com.zhidao.support.obu.OnMogoObuListener
@@ -55,7 +56,8 @@ class MogoPrivateObuManager private constructor() {
//连接obu设备
connectObu(context, ipAddress)
//控制日志输出
MogoObuManager.getInstance().init(MoGoAiCloudClientConfig.getInstance().getSn(), AppConfigInfo.toString())
MogoObuManager.getInstance()
.init(MoGoAiCloudClientConfig.getInstance().getSn(), AppConfigInfo.toString())
MogoObuManager.getInstance().registerListener(mogoObuListener)
}
@@ -76,6 +78,19 @@ class MogoPrivateObuManager private constructor() {
}
}
fun disConnectObu(){
try {
MogoObuManager.getInstance().disConnect()
} catch (e: Exception) {
e.printStackTrace()
}
}
fun isConnected(): Boolean{
return MogoObuManager.getInstance().isConnected
}
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
// OBU连接成功
override fun onConnected() {
@@ -115,7 +130,10 @@ class MogoPrivateObuManager private constructor() {
// 接收到的原始数据
override fun onReceiveOriginData(data: String) {
super.onReceiveOriginData(data)
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onReceiveOriginData ------> data = $data")
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onReceiveOriginData ------> data = $data"
)
}
@@ -128,7 +146,10 @@ class MogoPrivateObuManager private constructor() {
// CV2X系统信息
override fun onCvxAppInitIndInfo(info: CvxAppInitIndInfo) {
super.onCvxAppInitIndInfo(info)
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxAppInitIndInfo ------> $info")
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxAppInitIndInfo ------> $info"
)
if (info != null) {
if (!info.stack_info.isNullOrEmpty()) {
mObuStatusInfo.stackInfo = info.stack_info
@@ -180,7 +201,11 @@ class MogoPrivateObuManager private constructor() {
// 同步给MAP地图
CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(data)
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(System.currentTimeMillis()/1000.0,position.longitude, position.latitude)
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(
System.currentTimeMillis() / 1000.0,
position.longitude,
position.latitude
)
}
} catch (e: Exception) {
@@ -203,7 +228,10 @@ class MogoPrivateObuManager private constructor() {
// (3) 道路事件预警信息CVX_RTI_THREAT_IND
override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxRtiThreatIndInfo ------> $info")
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo ------> $info"
)
if (info != null && info.threat_info != null && info.ext_info != null) {
var alertContent = ""
@@ -214,12 +242,12 @@ class MogoPrivateObuManager private constructor() {
val direction =
getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1)
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}"
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}"
)
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type} --direction = $direction -- pos_classification = ${info.ext_info.pos_classification} "
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type} --direction = $direction -- pos_classification = ${info.ext_info.pos_classification} "
)
when (appId) {
// 道路危险情况预警
@@ -235,13 +263,13 @@ class MogoPrivateObuManager private constructor() {
WarningDirectionEnum.ALERT_WARNING_TOP_LEFT,
WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType
}
WarningDirectionEnum.ALERT_WARNING_RIGHT,
WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT,
WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType
EventTypeEnum.TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType
}
}
}
@@ -256,7 +284,7 @@ class MogoPrivateObuManager private constructor() {
//事故
0xC -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType
EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType
}
//拥堵
0xD -> {
@@ -265,7 +293,7 @@ class MogoPrivateObuManager private constructor() {
//行人
0xF -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
}
//禁止停车
0x13 -> {
@@ -274,7 +302,7 @@ class MogoPrivateObuManager private constructor() {
//学校
0x14 -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
}
//桥梁
0x17 -> {
@@ -287,7 +315,7 @@ class MogoPrivateObuManager private constructor() {
//人行横道
0x19 -> {
appId =
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
}
//减速慢行
0x1A -> {
@@ -318,13 +346,13 @@ class MogoPrivateObuManager private constructor() {
ttsContent = EventTypeEnum.getWarningTts(appId)
if (info.threat_info != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"ttsContent = $ttsContent --alertContent = $alertContent ---info.threat_info.distance = ${info.threat_info.distance} "
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"ttsContent = $ttsContent --alertContent = $alertContent ---info.threat_info.distance = ${info.threat_info.distance} "
)
if (info.threat_info.distance.toInt() != 0) {
alertContent = String.format(
EventTypeEnum.getWarningContent(appId),
info.threat_info.distance.toInt()
EventTypeEnum.getWarningContent(appId),
info.threat_info.distance.toInt()
)
} else {
alertContent = "前方拥堵,减速慢行"
@@ -332,8 +360,8 @@ class MogoPrivateObuManager private constructor() {
}
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"ttsContent = $ttsContent --alertContent = $alertContent"
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"ttsContent = $ttsContent --alertContent = $alertContent"
)
}
}
@@ -347,21 +375,23 @@ class MogoPrivateObuManager private constructor() {
// CallerHmiManager.showWarning(direction)
//显示弹框,语音提示
CallerHmiManager.showWarningV2X(appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
CallerHmiManager.showWarningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
)
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.invokeTrackerWarningInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
}
@@ -373,9 +403,10 @@ class MogoPrivateObuManager private constructor() {
CallerHmiManager.disableWarningV2X((appId + direction.direction).toString())
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.removeTrackerWarningInfo(it)
// 事件结束,还原车辆颜色
it.threatLevel = 0x01
TrafficMarkerDrawer.updateITrafficInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
}
}
@@ -385,7 +416,10 @@ class MogoPrivateObuManager private constructor() {
// (4) V2I预警信息CVX_IVP_THREAT_IND红绿灯
override fun onCvxIvpThreatIndInfo(info: CvxIvpThreatIndInfo?) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "CvxIvpThreatIndInfo ------> $info")
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"CvxIvpThreatIndInfo ------> $info"
)
if (info != null && info.ext_info != null
&& info.threat_info != null
&& info.ext_info.lights != null
@@ -405,17 +439,20 @@ class MogoPrivateObuManager private constructor() {
// )
handlerTrafficLight(
info.threat_info.app_id,
info.status,
info.ext_info.lights,
info.ext_info.index
info.threat_info.app_id,
info.status,
info.ext_info.lights,
info.ext_info.index
)
}
}
// (2) 弱势交通参与者预警信息CVX_PTC_THREAT_IND
override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxPtcInfoIndInfo ------> $info")
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxPtcInfoIndInfo ------> $info"
)
// 交通参与者类型 0x0:未知 UNKNOWN | 0x1:非机动车 NON_MOTOR | 0x2:行人 PEDESTRIAN 0x3:RSU
if (info != null && (info.ptc_type == 1 || info.ptc_type == 2)) {
//v2i数据传输延迟
@@ -432,8 +469,8 @@ class MogoPrivateObuManager private constructor() {
// )
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
)
var v2xType = ""
if (info.ptc_type == 1) { //摩托车
@@ -455,23 +492,25 @@ class MogoPrivateObuManager private constructor() {
// if (level == 2 || level == 3) { //不考虑level
//显示警告红边
CallerHmiManager.showWarning(direction)
CallerHmiManager.showWarningV2X(v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
CallerHmiManager.showWarningV2X(
v2xType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
}
},
true,
5000L
)
// }
// 更新数据
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
TrafficMarkerDrawer.updateITrafficInfo(it)
CallerObuListenerManager.invokeTrackerWarningInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
}
// 删除
@@ -480,6 +519,7 @@ class MogoPrivateObuManager private constructor() {
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.removeTrackerWarningInfo(it)
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
@@ -522,22 +562,26 @@ class MogoPrivateObuManager private constructor() {
// (1) V2V预警信息CVX_V2V_THREAT_IND
override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxV2vThreatIndInfo ------> $info")
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxV2vThreatIndInfo ------> $info"
)
info?.let {
//预警信息,预警类型 threat_level 2、3
info.threat_info?.let {
//预警方位
val direction = getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1)
val direction =
getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1)
//处理预警类型
val appId = info.threat_info.app_id
val level = info.threat_info.threat_level
val status = info.status
if (info.ext_info != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxV2vThreatIndInfo target_classification = ${
getMessageDirection(info.ext_info.target_classification)
} --- direction = $direction --- appId = $appId ---level = $level -- status = $status"
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"onCvxV2vThreatIndInfo target_classification = ${
getMessageDirection(info.ext_info.target_classification)
} --- direction = $direction --- appId = $appId ---level = $level -- status = $status"
)
}
@@ -603,8 +647,8 @@ class MogoPrivateObuManager private constructor() {
*/
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<Light>, index: Int) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"handlerTrafficLight appId = $appId --- status = $status ---index = $index ---lights.size = ${lights.size} ---lights = $lights "
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"handlerTrafficLight appId = $appId --- status = $status ---index = $index ---lights.size = ${lights.size} ---lights = $lights "
)
when (status) {
// 添加
@@ -630,9 +674,9 @@ class MogoPrivateObuManager private constructor() {
*/
@Synchronized
private fun changeTrafficLightStatus(
appId: Int,
lights: List<Light>,
index: Int
appId: Int,
lights: List<Light>,
index: Int
) {
var ttsContent = ""
var alertContent = ""
@@ -640,8 +684,8 @@ class MogoPrivateObuManager private constructor() {
if (index != -1 && lights.size >= index) {
val currentLight = lights[index]
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} ---rlvw_violation_type = ${currentLight.rlvw_violation_type} --- index = $index ---appId = $appId ---appId = $appId"
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} ---rlvw_violation_type = ${currentLight.rlvw_violation_type} --- index = $index ---appId = $appId ---appId = $appId"
)
// 闯红灯预警
when (currentLight.rlvw_violation_type) {
@@ -654,8 +698,8 @@ class MogoPrivateObuManager private constructor() {
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
alertContent = EventTypeEnum.getWarningContent(appId.toString())
CallerHmiManager.showWarningV2X(
appId.toString(), alertContent, ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
appId.toString(), null, true, 5000L
appId.toString(), alertContent, ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
appId.toString(), null, true, 5000L
)
}
0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT
@@ -665,7 +709,7 @@ class MogoPrivateObuManager private constructor() {
when (currentLight.phase) {
// 灯光不可用
0x0 -> {
CallerHmiManager.showWarningTrafficLight(0,2)
CallerHmiManager.showWarningTrafficLight(0, 2)
}
// 红灯
0x1 -> {
@@ -674,7 +718,7 @@ class MogoPrivateObuManager private constructor() {
isRedLight = true
}
isGreenLight = false
CallerHmiManager.showWarningTrafficLight(1,2)
CallerHmiManager.showWarningTrafficLight(1, 2)
val red = currentLight.count_down.toInt()
CallerHmiManager.changeCountdownRed(red)
@@ -689,7 +733,7 @@ class MogoPrivateObuManager private constructor() {
isGreenLight = true
}
isRedLight = false
CallerHmiManager.showWarningTrafficLight(3,2)
CallerHmiManager.showWarningTrafficLight(3, 2)
val green = currentLight.count_down.toInt()
CallerHmiManager.changeCountdownGreen(green)
//防止数据出现问题的容错
@@ -697,44 +741,44 @@ class MogoPrivateObuManager private constructor() {
CallerHmiManager.changeCountdownYellow(0)
// 拼接建议速度
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"speed_min = ${currentLight.glosa_suggested_speed_min} --speed_max = ${currentLight.glosa_suggested_speed_max.toInt()}"
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"speed_min = ${currentLight.glosa_suggested_speed_min} --speed_max = ${currentLight.glosa_suggested_speed_max.toInt()}"
)
val adviceSpeed =
"${currentLight.glosa_suggested_speed_min.toInt()} - ${currentLight.glosa_suggested_speed_max.toInt()}"
"${currentLight.glosa_suggested_speed_min.toInt()} - ${currentLight.glosa_suggested_speed_max.toInt()}"
val adviceSpeedTts =
"${currentLight.glosa_suggested_speed_min.toInt()}${currentLight.glosa_suggested_speed_max.toInt()}"
"${currentLight.glosa_suggested_speed_min.toInt()}${currentLight.glosa_suggested_speed_max.toInt()}"
ttsContent =
String.format(
EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeedTts
)
String.format(
EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeedTts
)
alertContent =
String.format(
EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
String.format(
EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
val maxSpeed = currentLight.glosa_suggested_speed_max.toInt()
if (maxSpeed > 0) {
CallerHmiManager.showWarningV2X(
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
appId.toString(),
null,
true,
5000L
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
appId.toString(),
null,
true,
5000L
)
}
}
// 黄灯
0x3 -> {
CallerHmiManager.disableWarningV2X(appId.toString())
CallerHmiManager.showWarningTrafficLight(2,2)
CallerHmiManager.showWarningTrafficLight(2, 2)
val yellow = currentLight.count_down.toInt()
CallerHmiManager.changeCountdownYellow(yellow)
CallerHmiManager.changeCountdownGreen(0)
@@ -746,6 +790,7 @@ class MogoPrivateObuManager private constructor() {
}
//todo 二期优化此处内容,注解参数
/**
* 构造对应展示数据和场景 根据obu的场景add change delete确定是否展示
*
@@ -754,86 +799,76 @@ class MogoPrivateObuManager private constructor() {
* @see com.mogo.module.common.enums.EventTypeEnum
*/
private fun handleSdkObu(
appId: Int,
direction: WarningDirectionEnum,
status: Int,
level: Int,
info: CvxV2vThreatIndInfo
appId: Int,
direction: WarningDirectionEnum,
status: Int,
level: Int,
info: CvxV2vThreatIndInfo
) {
// 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnum 提供的
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status"
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status"
)
var alertContent: String
var ttsContent: String
var alertContent: String? = null
var ttsContent: String? = null
var changeVisualAngle = false
when (appId.toString()) {
// 变道预警,注意左后车辆/注意右后车辆
EventTypeEnum.TYPE_USECASE_ID_LCW.poiType -> {
alertContent = EventTypeEnum.getWarningContent(appId.toString())
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
if (
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
) {
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
} else if (
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
) {
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
EventTypeHelper.getLCW(appId, direction) { alert, tts ->
alertContent = alert
ttsContent = tts
}
}
//车辆失控预警
EventTypeEnum.TYPE_USECASE_ID_CLW.poiType -> {
alertContent = EventTypeEnum.getWarningContent(appId.toString())
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
alertContent = String.format(alertContent, direction.desc)
ttsContent = String.format(ttsContent, direction.desc)
EventTypeHelper.getCLW(appId, direction) { alert, tts ->
alertContent = alert
ttsContent = tts
}
}
//左转辅助
EventTypeEnum.TYPE_USECASE_ID_LTA.poiType -> {
alertContent = EventTypeEnum.getWarningContent(appId.toString())
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
EventTypeHelper.getLTA(appId) { alert, tts ->
alertContent = alert
ttsContent = tts
}
}
//异常车辆提醒
EventTypeEnum.TYPE_USECASE_ID_AVW.poiType -> {
alertContent = EventTypeEnum.getWarningContent(appId.toString())
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
alertContent = String.format(alertContent, direction.desc)
ttsContent = String.format(ttsContent, direction.desc)
EventTypeHelper.getAVW(appId, direction) { alert, tts ->
alertContent = alert
ttsContent = tts
}
}
//盲区预警
EventTypeEnum.TYPE_USECASE_ID_BSW.poiType -> {
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
alertContent = EventTypeEnum.getWarningContent(appId.toString())
if (
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
) { //左后
changeVisualAngle = true
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
} else if (
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
) { //右后
changeVisualAngle = true
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
EventTypeHelper.getBSW(appId, direction) { alert, tts, visualAngle ->
alertContent = alert
ttsContent = tts
changeVisualAngle = visualAngle
}
}
//前车急刹预警
EventTypeEnum.TYPE_USECASE_ID_EBW.poiType -> {
EventTypeHelper.getEBW(appId){ alert ,tts ->
alertContent = alert
ttsContent = tts
}
}
//前向碰撞预警
EventTypeEnum.TYPE_USECASE_ID_FCW.poiType -> {
EventTypeHelper.getFCW(appId){ alert ,tts ->
alertContent = alert
ttsContent = tts
}
}
//逆向超车预警
EventTypeEnum.TYPE_USECASE_ID_DNPW.poiType -> {
EventTypeHelper.getDNPW(appId){ alert ,tts ->
alertContent = alert
ttsContent = tts
}
}
@@ -849,40 +884,42 @@ class MogoPrivateObuManager private constructor() {
ObuConstants.STATUS.ADD,
ObuConstants.STATUS.UPDATE -> {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
)
if (level == 2 || level == 3) {
//显示弹框,语音提示
CallerHmiManager.showWarningV2X(appId.toString(),
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
CallerHmiManager.showWarningV2X(
appId.toString(),
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onShow() {
super.onShow()
if (changeVisualAngle) {
CallerVisualAngleManager.changeVisualAngle(TooClose)
}
override fun onShow() {
super.onShow()
if (changeVisualAngle) {
CallerVisualAngleManager.changeVisualAngle(TooClose)
}
}
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
if (changeVisualAngle) {
CallerVisualAngleManager.changeVisualAngle(Default())
}
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
if (changeVisualAngle) {
CallerVisualAngleManager.changeVisualAngle(Default())
}
},
true,
5000L
}
},
true,
5000L
)
//显示警告红边
CallerHmiManager.showWarning(direction)
}
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.invokeTrackerWarningInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
}
@@ -894,6 +931,7 @@ class MogoPrivateObuManager private constructor() {
CallerHmiManager.disableWarningV2X((appId + direction.direction).toString())
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.removeTrackerWarningInfo(it)
it.threatLevel = 0x01
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}