..
This commit is contained in:
@@ -54,7 +54,8 @@ class MogoPrivateObuManager private constructor() {
|
||||
mContext = context
|
||||
connectObu(context, ipAddress)
|
||||
//控制日志输出
|
||||
MogoObuManager.getInstance().init(MoGoAiCloudClientConfig.getInstance().getSn(), AppConfigInfo.toString())
|
||||
MogoObuManager.getInstance()
|
||||
.init(MoGoAiCloudClientConfig.getInstance().getSn(), AppConfigInfo.toString())
|
||||
MogoObuManager.getInstance().registerListener(mogoObuListener)
|
||||
}
|
||||
|
||||
@@ -112,7 +113,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"
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
@@ -125,7 +129,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
|
||||
@@ -177,7 +184,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) {
|
||||
@@ -201,7 +212,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 = ""
|
||||
@@ -212,12 +226,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) {
|
||||
// 道路危险情况预警
|
||||
@@ -233,13 +247,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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -254,7 +268,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
//事故
|
||||
0xC -> {
|
||||
appId =
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType
|
||||
}
|
||||
//拥堵
|
||||
0xD -> {
|
||||
@@ -263,7 +277,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
//行人
|
||||
0xF -> {
|
||||
appId =
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
|
||||
}
|
||||
//禁止停车
|
||||
0x13 -> {
|
||||
@@ -272,7 +286,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
//学校
|
||||
0x14 -> {
|
||||
appId =
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
|
||||
}
|
||||
//桥梁
|
||||
0x17 -> {
|
||||
@@ -285,7 +299,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
//人行横道
|
||||
0x19 -> {
|
||||
appId =
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
|
||||
}
|
||||
//减速慢行
|
||||
0x1A -> {
|
||||
@@ -316,13 +330,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 = "前方拥堵,减速慢行"
|
||||
@@ -330,8 +344,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"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -345,18 +359,19 @@ 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 {
|
||||
@@ -385,7 +400,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 +423,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 +453,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,18 +476,19 @@ 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
|
||||
)
|
||||
// }
|
||||
// 更新数据
|
||||
@@ -524,22 +546,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"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -605,8 +631,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) {
|
||||
// 添加
|
||||
@@ -632,9 +658,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 = ""
|
||||
@@ -642,8 +668,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) {
|
||||
@@ -656,8 +682,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
|
||||
@@ -667,7 +693,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
when (currentLight.phase) {
|
||||
// 灯光不可用
|
||||
0x0 -> {
|
||||
CallerHmiManager.showWarningTrafficLight(0,2)
|
||||
CallerHmiManager.showWarningTrafficLight(0, 2)
|
||||
}
|
||||
// 红灯
|
||||
0x1 -> {
|
||||
@@ -676,7 +702,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)
|
||||
@@ -691,7 +717,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)
|
||||
//防止数据出现问题的容错
|
||||
@@ -699,44 +725,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)
|
||||
@@ -756,91 +782,55 @@ 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 -> {
|
||||
EventTypeHelper.getLCW(direction){ alert, tts ->
|
||||
EventTypeHelper.getLCW(appId, direction) { alert, tts ->
|
||||
alertContent = alert
|
||||
ttsContent = tts
|
||||
}
|
||||
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, "右")
|
||||
}
|
||||
}
|
||||
|
||||
//车辆失控预警
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -856,34 +846,35 @@ 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)
|
||||
|
||||
@@ -59,6 +59,7 @@ import com.mogo.module.common.entity.*
|
||||
import com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum
|
||||
import com.mogo.module.common.enums.EventTypeEnum
|
||||
import com.mogo.module.common.enums.EventTypeEnum.FOURS_BLOCK_UP
|
||||
import com.mogo.module.common.enums.EventTypeHelper
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||
import com.mogo.service.statusmanager.StatusDescriptor
|
||||
import com.mogo.service.statusmanager.StatusDescriptor.ACC_STATUS
|
||||
@@ -525,70 +526,78 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
var changeVisualAngle = false
|
||||
when (message.status) {
|
||||
1 -> {
|
||||
var tts = ""
|
||||
var content = ""
|
||||
var appId = 0
|
||||
var tempAppId = 0
|
||||
var tempTts = ""
|
||||
var tempContent = ""
|
||||
when (message.typeId) {
|
||||
1001 -> {
|
||||
// 弱势交通碰撞预警
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt()
|
||||
tts = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.tts
|
||||
content = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.content
|
||||
EventTypeHelper.getVRU{ appId, tts, content ->
|
||||
tempAppId = appId
|
||||
tempTts = tts
|
||||
tempContent = content
|
||||
}
|
||||
}
|
||||
1002 -> {
|
||||
// 弱势交通逆行预警
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt()
|
||||
tts = "行人逆行预警"
|
||||
content = "行人逆行预警"
|
||||
EventTypeHelper.getVRURI { appId, tts, content ->
|
||||
tempAppId = appId
|
||||
tempTts = tts
|
||||
tempContent = content
|
||||
}
|
||||
}
|
||||
1003 -> {
|
||||
// 交叉路口碰撞预警
|
||||
changeVisualAngle = true
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_ICW.poiType.toInt()
|
||||
tts = EventTypeEnum.TYPE_USECASE_ID_ICW.tts
|
||||
content = EventTypeEnum.TYPE_USECASE_ID_ICW.content
|
||||
tempAppId = EventTypeEnum.TYPE_USECASE_ID_ICW.poiType.toInt()
|
||||
tempTts = EventTypeEnum.TYPE_USECASE_ID_ICW.tts
|
||||
tempContent = EventTypeEnum.TYPE_USECASE_ID_ICW.content
|
||||
}
|
||||
1004 -> {
|
||||
// 交叉路口碰撞预警
|
||||
changeVisualAngle = true
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_BSW.poiType.toInt()
|
||||
tts = String.format(
|
||||
tempAppId = EventTypeEnum.TYPE_USECASE_ID_BSW.poiType.toInt()
|
||||
tempTts = String.format(
|
||||
EventTypeEnum.TYPE_USECASE_ID_BSW.tts,
|
||||
getWarningDirection()
|
||||
)
|
||||
content = EventTypeEnum.TYPE_USECASE_ID_BSW.content
|
||||
tempContent = EventTypeEnum.TYPE_USECASE_ID_BSW.content
|
||||
}
|
||||
1006 -> {
|
||||
// 逆向超车预警
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_DNPW.poiType.toInt()
|
||||
tts = EventTypeEnum.TYPE_USECASE_ID_DNPW.tts
|
||||
content = EventTypeEnum.TYPE_USECASE_ID_DNPW.content
|
||||
tempAppId = EventTypeEnum.TYPE_USECASE_ID_DNPW.poiType.toInt()
|
||||
tempTts = EventTypeEnum.TYPE_USECASE_ID_DNPW.tts
|
||||
tempContent = EventTypeEnum.TYPE_USECASE_ID_DNPW.content
|
||||
}
|
||||
1005 -> {
|
||||
// 闯红灯预警
|
||||
appId = EventTypeEnum.TYPE_USECASE_ID_IVP.poiType.toInt()
|
||||
tts = EventTypeEnum.TYPE_USECASE_ID_IVP.tts
|
||||
content = EventTypeEnum.TYPE_USECASE_ID_IVP.content
|
||||
tempAppId = EventTypeEnum.TYPE_USECASE_ID_IVP.poiType.toInt()
|
||||
tempTts = EventTypeEnum.TYPE_USECASE_ID_IVP.tts
|
||||
tempContent = EventTypeEnum.TYPE_USECASE_ID_IVP.content
|
||||
}
|
||||
2001 -> {
|
||||
// 最优车道
|
||||
appId = EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.poiType.toInt()
|
||||
tts = EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.tts
|
||||
content = EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.content
|
||||
EventTypeHelper.getOptLine{ appId, tts, content ->
|
||||
tempAppId = appId
|
||||
tempTts = tts
|
||||
tempContent = content
|
||||
}
|
||||
}
|
||||
3001 -> {
|
||||
// 前方道路拥堵预警
|
||||
appId = FOURS_BLOCK_UP.poiType.toInt()
|
||||
tts = FOURS_BLOCK_UP.tts
|
||||
content = FOURS_BLOCK_UP.content
|
||||
EventTypeHelper.getTJW{ appId, tts, content ->
|
||||
tempAppId = appId
|
||||
tempTts = tts
|
||||
tempContent = content
|
||||
}
|
||||
}
|
||||
}
|
||||
// 显示弹框,语音提示
|
||||
CallerHmiManager.showWarningV2X(
|
||||
appId.toString(),
|
||||
content,
|
||||
tts,
|
||||
"$appId",
|
||||
tempAppId.toString(),
|
||||
tempContent,
|
||||
tempTts,
|
||||
"$tempAppId",
|
||||
object : IMoGoWarningStatusListener {
|
||||
val change = changeVisualAngle
|
||||
override fun onShow() {
|
||||
|
||||
Reference in New Issue
Block a user