修复TTS预警播报

This commit is contained in:
董宏宇
2021-09-13 16:09:33 +08:00
committed by chenfufeng
parent 396a35efd2
commit c29f4e21b6
3 changed files with 27 additions and 43 deletions

View File

@@ -237,7 +237,8 @@ object TrafficMarkerDrawer {
trafficData.heading.toFloat(),
stepTime
)
} catch (e: NullPointerException) {
} catch (e:Exception) {
e.printStackTrace()
try {
drawObuRecognizedDataMarker(trafficData)
} catch (e: Exception) {

View File

@@ -30,19 +30,19 @@ enum class WarningDirectionEnum(
),
ALERT_WARNING_TOP_RIGHT(
5,
"前方"
"前方"
),
ALERT_WARNING_BOTTOM_RIGHT(
6,
"正前"
"右后"
),
ALERT_WARNING_BOTTOM_LEFT(
7,
"正前"
"左后"
),
ALERT_WARNING_TOP_LEFT(
8,
"前方"
"前方"
),
ALERT_WARNING_ALL(
9,

View File

@@ -3,7 +3,6 @@ package com.mogo.module.obu.mogo
import android.content.Context
import android.util.Log
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.commons.voice.AIAssist
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
import com.mogo.module.common.drawer.TrafficMarkerDrawer
import com.mogo.module.common.enums.EventTypeEnum
@@ -567,8 +566,6 @@ class MogoPrivateObuManager private constructor() {
}
private var isStrikeTts = false
/**
* 构造对应展示数据和场景 根据obu的场景add change delete确定是否展示
*
@@ -677,32 +674,31 @@ class MogoPrivateObuManager private constructor() {
}
when (status) {
// 添加, add的时候可能级别是2
ObuConstants.STATUS.ADD -> {
Log.d(
MogoObuConst.TAG_MOGO_OBU,
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
)
//显示警告红边
mIMoGoWaringProvider?.showWarning(direction)
//显示弹框,语音提示
mIMoGoWaringProvider?.showWarningV2X(
appId,
alertContent,
if (level == 2||level == 3) ttsContent else "",
appId.toString()
)
if (level == 2||level == 3) {
isStrikeTts = true
}
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let {
TrafficMarkerDrawer.updateITrafficInfo(it)
// 添加,更新 add的时候可能级别是2
ObuConstants.STATUS.ADD,
ObuConstants.STATUS.UPDATE -> {
if (level == 2 || level == 3) {
Log.d(
MogoObuConst.TAG_MOGO_OBU,
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
)
//显示警告红边
mIMoGoWaringProvider?.showWarning(direction)
//显示弹框,语音提示
mIMoGoWaringProvider?.showWarningV2X(
appId,
alertContent,
ttsContent,
appId.toString()
)
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let {
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
}
}
// 删除
ObuConstants.STATUS.DELETE -> {
isStrikeTts = false
// 关闭警告红边
mIMoGoWaringProvider!!.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
@@ -713,19 +709,6 @@ class MogoPrivateObuManager private constructor() {
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
}
// 更新
else -> {
//显示警告红边
mIMoGoWaringProvider?.showWarning(direction)
if (!isStrikeTts) {
AIAssist.getInstance(mContext).speakTTSVoice(ttsContent)
isStrikeTts = true
}
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let {
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
}
}
}
}