封装Hmi调用MoGoEagleEye.core.mogo-core-function-call
Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
@@ -2,18 +2,17 @@ package com.mogo.eagle.core.function.obu.mogo
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
|
||||
import com.mogo.module.common.drawer.TrafficMarkerDrawer
|
||||
import com.mogo.module.common.enums.EventTypeEnum
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.map.IMogoMapService
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
import com.zhidao.support.obu.MogoObuManager
|
||||
import com.zhidao.support.obu.OnMogoObuListener
|
||||
@@ -36,17 +35,14 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
|
||||
private var mMogoServiceApis: IMogoServiceApis? = null
|
||||
private var mIMoGoWaringProvider: IMoGoWaringProvider? = null
|
||||
private var mIMogoMapService: IMogoMapService? = null
|
||||
private var mContext: Context? = null
|
||||
|
||||
fun init(context: Context?) {
|
||||
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "obuManager初始化--")
|
||||
mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
|
||||
.navigation(context) as IMogoServiceApis
|
||||
.navigation(context) as IMogoServiceApis
|
||||
mContext = context
|
||||
// 获取预警模块的接口
|
||||
mIMoGoWaringProvider = CallerHmiManager.getWaringProviderApi()
|
||||
mIMogoMapService = mMogoServiceApis!!.mapServiceApi
|
||||
|
||||
//自研obu
|
||||
@@ -165,11 +161,14 @@ class MogoPrivateObuManager private constructor() {
|
||||
val status = info.status
|
||||
val level = info.threat_info.threat_level
|
||||
val direction =
|
||||
getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1)
|
||||
getMessageDirection(if (info.ext_info != null) info.ext_info.pos_classification else -1)
|
||||
when (appId) {
|
||||
// 道路危险情况预警
|
||||
EventTypeEnum.TYPE_USECASE_ID_HLW.poiType -> {
|
||||
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type}")
|
||||
LogUtils.dTag(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type}"
|
||||
)
|
||||
when (info.ext_info.rti_type) {
|
||||
//急转弯
|
||||
0x2 -> {
|
||||
@@ -250,9 +249,9 @@ class MogoPrivateObuManager private constructor() {
|
||||
-> {
|
||||
if (level == 2 || level == 3) {
|
||||
//显示警告红边
|
||||
mIMoGoWaringProvider!!.showWarning(direction)
|
||||
CallerHmiManager.showWarning(direction)
|
||||
//显示弹框,语音提示
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
CallerHmiManager.showWarningV2X(
|
||||
appId.toInt(),
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
@@ -260,7 +259,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
object : WarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
mIMoGoWaringProvider?.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -273,9 +272,9 @@ class MogoPrivateObuManager private constructor() {
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
// 关闭警告红边
|
||||
mIMoGoWaringProvider?.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
// 移除顶部弹窗
|
||||
mIMoGoWaringProvider?.disableWarningV2X((appId + direction.direction).toString())
|
||||
CallerHmiManager.disableWarningV2X((appId + direction.direction).toString())
|
||||
// 更新数据
|
||||
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
|
||||
// 事件结束,还原车辆颜色
|
||||
@@ -293,10 +292,10 @@ class MogoPrivateObuManager private constructor() {
|
||||
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "CvxIvpThreatIndInfo ------> $info")
|
||||
if (info != null && info.ext_info != null && info.threat_info != null && info.ext_info.lights != null && info.ext_info.lights.isNotEmpty()) {
|
||||
handlerTrafficLight(
|
||||
info.threat_info.app_id,
|
||||
info.status,
|
||||
info.ext_info.lights,
|
||||
info.ext_info.indicator
|
||||
info.threat_info.app_id,
|
||||
info.status,
|
||||
info.ext_info.lights,
|
||||
info.ext_info.indicator
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -306,10 +305,10 @@ class MogoPrivateObuManager private constructor() {
|
||||
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onCvxMapSpatInfoIndInfo ------> $info")
|
||||
if (info != null && info.ivp_threat_ext != null && info.ivp_threat_ext.lights != null && info.ivp_threat_ext.lights.isNotEmpty()) {
|
||||
handlerTrafficLight(
|
||||
info.ivp_threat_info.app_id,
|
||||
info.status,
|
||||
info.ivp_threat_ext.lights,
|
||||
info.ivp_threat_ext.indicator
|
||||
info.ivp_threat_info.app_id,
|
||||
info.status,
|
||||
info.ivp_threat_ext.lights,
|
||||
info.ivp_threat_ext.indicator
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -320,7 +319,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
if (info != null) {
|
||||
LogUtils.dTag(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
|
||||
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
|
||||
)
|
||||
var v2xType = ""
|
||||
if (info.ptc_type == 1) { //摩托车
|
||||
@@ -331,7 +330,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
val ttsContent = EventTypeEnum.getWarningTts(v2xType)
|
||||
val alertContent = EventTypeEnum.getWarningContent(v2xType)
|
||||
val direction =
|
||||
getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1)
|
||||
getMessageDirection(if (info.ext_info != null) info.ext_info.target_classification else -1)
|
||||
val level = if (info.threat_info != null) info.threat_info.threat_level else -1
|
||||
|
||||
when (info.status) {
|
||||
@@ -341,8 +340,8 @@ class MogoPrivateObuManager private constructor() {
|
||||
-> {
|
||||
if (level == 2 || level == 3) {
|
||||
//显示警告红边
|
||||
mIMoGoWaringProvider?.showWarning(direction)
|
||||
mIMoGoWaringProvider?.showWarningV2X(
|
||||
CallerHmiManager.showWarning(direction)
|
||||
CallerHmiManager.showWarningV2X(
|
||||
v2xType.toInt(),
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
@@ -350,7 +349,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
object : WarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
mIMoGoWaringProvider!!.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -363,14 +362,14 @@ class MogoPrivateObuManager private constructor() {
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
// 关闭警告红边
|
||||
mIMoGoWaringProvider!!.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
// 更新数据
|
||||
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
|
||||
// 事件结束,还原交通参与者颜色
|
||||
it.threatLevel = 0x01
|
||||
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
|
||||
}
|
||||
mIMoGoWaringProvider?.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString())
|
||||
CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,12 +387,12 @@ class MogoPrivateObuManager private constructor() {
|
||||
ObuConstants.STATUS.UPDATE,
|
||||
-> {
|
||||
if (info.ext_info != null) {
|
||||
mIMoGoWaringProvider?.showLimitingVelocity(info.ext_info.speed_limit_max.toInt())
|
||||
CallerHmiManager.showLimitingVelocity(info.ext_info.speed_limit_max.toInt())
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
mIMoGoWaringProvider?.disableLimitingVelocity()
|
||||
CallerHmiManager.disableLimitingVelocity()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -414,9 +413,9 @@ class MogoPrivateObuManager private constructor() {
|
||||
val status = info.status
|
||||
LogUtils.dTag(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"onCvxV2vThreatIndInfo target_classification = ${
|
||||
"onCvxV2vThreatIndInfo target_classification = ${
|
||||
getMessageDirection(info.ext_info.target_classification)
|
||||
} --- direction = $direction --- appId = $appId ---level = $level -- status = $status"
|
||||
} --- direction = $direction --- appId = $appId ---level = $level -- status = $status"
|
||||
)
|
||||
handleSdkObu(appId, direction, status, level, info)
|
||||
}
|
||||
@@ -481,7 +480,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<Light>, indicator: Int) {
|
||||
LogUtils.dTag(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"handlerTrafficLight appId = $appId --- status = $status ---indicator = $indicator ---lights = $lights ---lights.size = ${lights.size}"
|
||||
"handlerTrafficLight appId = $appId --- status = $status ---indicator = $indicator ---lights = $lights ---lights.size = ${lights.size}"
|
||||
)
|
||||
when (status) {
|
||||
// 添加
|
||||
@@ -492,9 +491,9 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
mIMoGoWaringProvider?.disableWarningTrafficLight()
|
||||
// 移除顶部弹窗
|
||||
mIMoGoWaringProvider?.disableWarningV2X(appId.toString())
|
||||
CallerHmiManager.disableWarningTrafficLight()
|
||||
CallerHmiManager.disableWarningV2X(appId.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -506,59 +505,65 @@ class MogoPrivateObuManager private constructor() {
|
||||
* 修改红绿灯
|
||||
*/
|
||||
private fun changeTrafficLightStatus(
|
||||
appId: Int,
|
||||
lights: List<Light>,
|
||||
indicator: Int
|
||||
appId: Int,
|
||||
lights: List<Light>,
|
||||
indicator: Int
|
||||
) {
|
||||
var ttsContent = ""
|
||||
var alertContent = ""
|
||||
// TODO 这里需要根据真实数据确定 indicator 取值方式,暂时写 0 调试
|
||||
if (lights.size >= indicator) {
|
||||
val currentLight = lights[0]
|
||||
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} --- indicator = $indicator ---appId = $appId")
|
||||
LogUtils.dTag(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} --- indicator = $indicator ---appId = $appId"
|
||||
)
|
||||
when (currentLight.phase) {
|
||||
// 灯光不可用
|
||||
0x0 -> {
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(0)
|
||||
CallerHmiManager.showWarningTrafficLight(0)
|
||||
}
|
||||
// 红灯
|
||||
0x1 -> {
|
||||
if (!isRedLight) {
|
||||
mIMoGoWaringProvider!!.disableWarningV2X(appId.toString())
|
||||
CallerHmiManager.disableWarningV2X(appId.toString())
|
||||
isRedLight = true
|
||||
}
|
||||
isGreenLight = false
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(1)
|
||||
mIMoGoWaringProvider?.changeCountdownRed(currentLight.count_down.toInt())
|
||||
CallerHmiManager.showWarningTrafficLight(1)
|
||||
CallerHmiManager.changeCountdownRed(currentLight.count_down.toInt())
|
||||
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
|
||||
alertContent = EventTypeEnum.getWarningContent(appId.toString())
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(),
|
||||
null
|
||||
CallerHmiManager.showWarningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(),
|
||||
null
|
||||
)
|
||||
}
|
||||
// 绿灯
|
||||
0x2 -> {
|
||||
if (!isGreenLight) {
|
||||
mIMoGoWaringProvider!!.disableWarningV2X(appId.toString())
|
||||
CallerHmiManager.disableWarningV2X(appId.toString())
|
||||
isGreenLight = true
|
||||
}
|
||||
isRedLight = false
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(3)
|
||||
mIMoGoWaringProvider?.changeCountdownGreen(currentLight.count_down.toInt() + 1)
|
||||
CallerHmiManager.showWarningTrafficLight(3)
|
||||
CallerHmiManager.changeCountdownGreen(currentLight.count_down.toInt() + 1)
|
||||
//防止数据出现问题的容错
|
||||
mIMoGoWaringProvider?.changeCountdownRed(0)
|
||||
mIMoGoWaringProvider?.changeCountdownYellow(0)
|
||||
CallerHmiManager.changeCountdownRed(0)
|
||||
CallerHmiManager.changeCountdownYellow(0)
|
||||
// 拼接建议速度
|
||||
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "speed_min = ${currentLight.glosa_suggested_speed_min} --speed_max = ${currentLight.glosa_suggested_speed_max.toInt()}")
|
||||
LogUtils.dTag(
|
||||
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(
|
||||
@@ -573,21 +578,23 @@ class MogoPrivateObuManager private constructor() {
|
||||
)
|
||||
|
||||
var maxSpeed = currentLight.glosa_suggested_speed_max.toInt()
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(),
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(),
|
||||
null
|
||||
)
|
||||
if (maxSpeed > 0) {
|
||||
CallerHmiManager.showWarningV2X(
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(),
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(),
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
// 黄灯
|
||||
0x3 -> {
|
||||
mIMoGoWaringProvider!!.disableWarningV2X(appId.toString())
|
||||
mIMoGoWaringProvider?.showWarningTrafficLight(2)
|
||||
mIMoGoWaringProvider?.changeCountdownYellow(currentLight.count_down.toInt() + 1)
|
||||
mIMoGoWaringProvider?.changeCountdownGreen(0)
|
||||
mIMoGoWaringProvider?.changeCountdownRed(0)
|
||||
CallerHmiManager.disableWarningV2X(appId.toString())
|
||||
CallerHmiManager.showWarningTrafficLight(2)
|
||||
CallerHmiManager.changeCountdownYellow(currentLight.count_down.toInt() + 1)
|
||||
CallerHmiManager.changeCountdownGreen(0)
|
||||
CallerHmiManager.changeCountdownRed(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -603,16 +610,16 @@ 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 提供的
|
||||
LogUtils.dTag(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status"
|
||||
"handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status"
|
||||
)
|
||||
var alertContent: String
|
||||
var ttsContent: String
|
||||
@@ -622,16 +629,16 @@ class MogoPrivateObuManager private constructor() {
|
||||
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
|
||||
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
|
||||
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, "右")
|
||||
@@ -652,15 +659,15 @@ class MogoPrivateObuManager private constructor() {
|
||||
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
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
|
||||
) {
|
||||
ttsContent = String.format(ttsContent, "左")
|
||||
} else if (
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
|
||||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
|
||||
) {
|
||||
ttsContent = String.format(ttsContent, "右")
|
||||
}
|
||||
@@ -679,16 +686,16 @@ class MogoPrivateObuManager private constructor() {
|
||||
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
|
||||
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
|
||||
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, "右")
|
||||
@@ -708,24 +715,24 @@ class MogoPrivateObuManager private constructor() {
|
||||
ObuConstants.STATUS.UPDATE -> {
|
||||
LogUtils.dTag(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
|
||||
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
|
||||
)
|
||||
if (level == 2 || level == 3) {
|
||||
//显示弹框,语音提示
|
||||
mIMoGoWaringProvider?.showWarningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : WarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
mIMoGoWaringProvider!!.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
CallerHmiManager.showWarningV2X(
|
||||
appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : WarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
}
|
||||
)
|
||||
//显示警告红边
|
||||
mIMoGoWaringProvider?.showWarning(direction)
|
||||
CallerHmiManager.showWarning(direction)
|
||||
}
|
||||
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
|
||||
TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let {
|
||||
@@ -735,9 +742,9 @@ class MogoPrivateObuManager private constructor() {
|
||||
// 删除
|
||||
ObuConstants.STATUS.DELETE -> {
|
||||
// 关闭警告红边
|
||||
mIMoGoWaringProvider!!.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
// 移除顶部弹窗
|
||||
mIMoGoWaringProvider?.disableWarningV2X((appId + direction.direction).toString())
|
||||
CallerHmiManager.disableWarningV2X((appId + direction.direction).toString())
|
||||
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
|
||||
TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let {
|
||||
it.threatLevel = 0x01
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.eagle.core.function.call.hmi;
|
||||
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider;
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/17 3:59 下午
|
||||
*/
|
||||
public class CallerHmiManager extends CallerBase {
|
||||
|
||||
public static IMoGoWaringProvider getWaringProviderApi() {
|
||||
return getApiInstance(IMoGoWaringProvider.class, MogoServicePaths.PATH_V2X_WARNING);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.mogo.eagle.core.function.call.hmi
|
||||
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.WarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/9/17 3:59 下午
|
||||
*/
|
||||
object CallerHmiManager : CallerBase() {
|
||||
private val waringProviderApi: IMoGoWaringProvider
|
||||
get() = getApiInstance(IMoGoWaringProvider::class.java, MogoServicePaths.PATH_V2X_WARNING)
|
||||
|
||||
|
||||
/**
|
||||
* 展示VR下V2X预警
|
||||
*
|
||||
* @param v2xType V2X类型
|
||||
* @param alertContent 提醒文本
|
||||
* @param ttsContent tts语音播报消息
|
||||
* @param tag tag绑定弹窗的标志
|
||||
*/
|
||||
fun showWarningV2X(
|
||||
v2xType: Int,
|
||||
alertContent: String?,
|
||||
ttsContent: String?,
|
||||
tag: String?,
|
||||
listener: WarningStatusListener?
|
||||
) {
|
||||
waringProviderApi.showWarningV2X(v2xType, alertContent, ttsContent, tag, listener)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭指定floatTag 的 VR下V2X预警弹窗
|
||||
* @param tag 弹窗标识
|
||||
*/
|
||||
fun disableWarningV2X(tag: String?) {
|
||||
waringProviderApi.disableWarningV2X(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示红绿灯预警
|
||||
*
|
||||
* @param checkLightId 0-都是默认,1-红,2-黄,3-绿
|
||||
*/
|
||||
fun showWarningTrafficLight(checkLightId: Int) {
|
||||
waringProviderApi.showWarningTrafficLight(checkLightId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭红绿灯预警
|
||||
*/
|
||||
fun disableWarningTrafficLight() {
|
||||
waringProviderApi.disableWarningTrafficLight()
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改红灯倒计时
|
||||
*/
|
||||
fun changeCountdownRed(redNum: Int) {
|
||||
waringProviderApi.changeCountdownRed(redNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改黄灯倒计时
|
||||
*/
|
||||
fun changeCountdownYellow(yellowNum: Int) {
|
||||
waringProviderApi.changeCountdownYellow(yellowNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownGreen(greenNum: Int) {
|
||||
waringProviderApi.changeCountdownGreen(greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
waringProviderApi.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示限速预警
|
||||
*
|
||||
* @param limitingSpeed 限速速度
|
||||
*/
|
||||
fun showLimitingVelocity(limitingSpeed: Int) {
|
||||
waringProviderApi.showLimitingVelocity(limitingSpeed)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭限速预警
|
||||
*/
|
||||
fun disableLimitingVelocity() {
|
||||
waringProviderApi.disableLimitingVelocity()
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示指定方位上的红框预警
|
||||
* @param direction
|
||||
* @see WarningDirectionEnum
|
||||
*/
|
||||
fun showWarning(direction: WarningDirectionEnum) {
|
||||
waringProviderApi.showWarning(direction)
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示指定方位上的红框预警
|
||||
* @param direction
|
||||
* @see WarningDirectionEnum
|
||||
* @param closeTime 倒计时
|
||||
*/
|
||||
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
|
||||
waringProviderApi.showWarning(direction, closeTime)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user