[8.0.0]调整TTS语音+下架V2N绿波通行

This commit is contained in:
xuxinchao
2025-04-24 11:21:14 +08:00
parent 400154bf38
commit 5d12752125
7 changed files with 104 additions and 133 deletions

View File

@@ -352,93 +352,94 @@ internal object V2NIdentifyDrawer : IEventDismissListener {
)
}.receive()
} else if (msg.what == MSG_WHAT_DRAW_GREEN_WAVE) {
val data = msg.obj as? V2nCrossSpeed ?: return@Callback true
val destX = data.lng
val destY = data.lat
val location = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
if (DrivingDirectionUtils.getDegreeOfCar2Poi(
location.longitude,
location.latitude,
destX,
destY,
location.heading.toInt()
) >= 90
) {
V2XBizTrace.onAck(data, "green-wave-event" to "事件在车的后面,不触发", true)
return@Callback true
}
val id = "${destX}_${destY}"
AiRoadMarker.aiMakers.getOrPut(id) {
AiRoadMarker().apply {
try {
val current = abs(location.gnssSpeed).toInt()
val min = abs(data.speedStraightMin).toInt()
val max = abs(data.speedStraightMax).toInt()
marker(
Marker(
id,
EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType,
destX,
destY,
0.0,
null,
null,
null
), drawMarker = false, false
)
var alertTts = ""
var alertContent = ""
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
AppStateManager.currentActivity()?.let {
val speakText = StringBuilder("保持当前车速即可通过路口,好丝滑!")
if (current < min) {
speakText.setLength(0)
speakText.append(
"${
SkinResources.getInstance()
.getString(R.string.operation_platform_name)
}推荐您提升车速至${min}千米每小时, 当前车速${current}千米每小时"
)
}
if (current > max) {
speakText.setLength(0)
speakText.append(
"${
SkinResources.getInstance()
.getString(R.string.operation_platform_name)
}推荐您降低车速至${max}千米每小时, 当前车速${current}千米每小时"
)
}
val tts = speakText.toString()
alertTts = tts
alertContent = tts
AIAssist.getInstance(it).speakTTSVoice(tts)
}
}
//消息埋点
V2XEventAnalyticsManager.triggerV2XEvent(
EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType,
alertContent,
alertTts,
DataSourceType.AICLOUD,
CommunicationType.V2N
)
CallerHmiManager.showGreenWave(
min,
max,
computeCrossCountBetween(
Triple(
location.longitude,
location.latitude,
location.heading
), kotlin.Pair(destX, destY)
)
)
} finally {
receive()
}
}
}
//下架V2N绿波通行
// val data = msg.obj as? V2nCrossSpeed ?: return@Callback true
// val destX = data.lng
// val destY = data.lat
// val location = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
// if (DrivingDirectionUtils.getDegreeOfCar2Poi(
// location.longitude,
// location.latitude,
// destX,
// destY,
// location.heading.toInt()
// ) >= 90
// ) {
// V2XBizTrace.onAck(data, "green-wave-event" to "事件在车的后面,不触发", true)
// return@Callback true
// }
// val id = "${destX}_${destY}"
// AiRoadMarker.aiMakers.getOrPut(id) {
// AiRoadMarker().apply {
// try {
// val current = abs(location.gnssSpeed).toInt()
// val min = abs(data.speedStraightMin).toInt()
// val max = abs(data.speedStraightMax).toInt()
// marker(
// Marker(
// id,
// EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType,
// destX,
// destY,
// 0.0,
// null,
// null,
// null
// ), drawMarker = false, false
// )
// var alertTts = ""
// var alertContent = ""
// if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
// AppStateManager.currentActivity()?.let {
// val speakText = StringBuilder("保持当前车速即可通过路口,好丝滑!")
// if (current < min) {
// speakText.setLength(0)
// speakText.append(
// "${
// SkinResources.getInstance()
// .getString(R.string.operation_platform_name)
// }推荐您提升车速至${min}千米每小时, 当前车速${current}千米每小时"
// )
// }
// if (current > max) {
// speakText.setLength(0)
// speakText.append(
// "${
// SkinResources.getInstance()
// .getString(R.string.operation_platform_name)
// }推荐您降低车速至${max}千米每小时, 当前车速${current}千米每小时"
// )
// }
// val tts = speakText.toString()
// alertTts = tts
// alertContent = tts
// AIAssist.getInstance(it).speakTTSVoice(tts)
// }
// }
// //消息埋点
// V2XEventAnalyticsManager.triggerV2XEvent(
// EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType,
// alertContent,
// alertTts,
// DataSourceType.AICLOUD,
// CommunicationType.V2N
// )
// CallerHmiManager.showGreenWave(
// min,
// max,
// computeCrossCountBetween(
// Triple(
// location.longitude,
// location.latitude,
// location.heading
// ), kotlin.Pair(destX, destY)
// )
// )
// } finally {
// receive()
// }
// }
// }
} else if (msg.what == MSG_WHAT_DRAW_PEOPLE_CROSS) {
Logger.i(TAG, "people cross -- 1 --")
val data = msg.obj as? MessagePad.Event ?: return@Callback true
@@ -689,7 +690,7 @@ internal object V2NIdentifyDrawer : IEventDismissListener {
}
private fun drawGreenWave(crossSpeed: V2nCrossSpeed) {
if (V2NCarTypeCheck.verifyCarType() && FunctionBuildConfig.v2nTotalSwitch && FunctionBuildConfig.v2nGreenWave) {
if (V2NCarTypeCheck.verifyCarType() && FunctionBuildConfig.v2nTotalSwitch) {
handler.removeMessages(MSG_WHAT_DRAW_GREEN_WAVE)
handler.sendMessage(Message.obtain(handler, MSG_WHAT_DRAW_GREEN_WAVE, crossSpeed))
}
@@ -818,7 +819,7 @@ internal object V2NIdentifyDrawer : IEventDismissListener {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
ThreadUtils.runOnUiThread {
AIAssist.getInstance(Utils.getApp())
.speakTTSVoiceWithLevel("蘑菇发现前方路口有车龙", AIAssist.NEW_LEVEL_2)
.speakTTSVoiceWithLevel("前方路口有车龙", AIAssist.NEW_LEVEL_2)
}
}
}