change the callerlogger
This commit is contained in:
@@ -5,8 +5,9 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuProvider
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -27,7 +28,7 @@ class MoGoObuProvider : IMoGoObuProvider {
|
||||
|
||||
|
||||
override fun init(context: Context) {
|
||||
LogUtils.dTag(TAG, "初始化蘑菇自研OBU……")
|
||||
CallerLogger.d("$M_OBU$TAG", "初始化蘑菇自研OBU……")
|
||||
mContext = context
|
||||
val ipAddress =
|
||||
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, "192.168.1.199")
|
||||
|
||||
@@ -4,12 +4,13 @@ import android.content.Context
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
|
||||
import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
|
||||
import com.mogo.module.common.drawer.TrafficMarkerDrawer
|
||||
@@ -42,9 +43,9 @@ class MogoPrivateObuManager private constructor() {
|
||||
private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo()
|
||||
|
||||
fun init(context: Context, ipAddress: String) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "obuManager初始化--")
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "obuManager初始化--")
|
||||
mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
|
||||
.navigation(context) as IMogoServiceApis
|
||||
.navigation(context) as IMogoServiceApis
|
||||
mContext = context
|
||||
mIMogoMapService = mMogoServiceApis!!.mapServiceApi
|
||||
|
||||
@@ -73,7 +74,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
|
||||
// OBU连接成功
|
||||
override fun onConnected() {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onConnected ------> ")
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onConnected ------> ")
|
||||
mObuStatusInfo.obuStatus = true
|
||||
CallerObuListenerManager.invokeListener(mObuStatusInfo)
|
||||
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) }
|
||||
@@ -81,7 +82,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
|
||||
// OBU连接失败
|
||||
override fun onConnectFail(isNeedReconnect: Boolean) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onConnectFail ------> ")
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onConnectFail ------> ")
|
||||
mObuStatusInfo.obuStatus = false
|
||||
mObuStatusInfo.obuHvStatus = false
|
||||
mObuStatusInfo.obuRvStatus = false
|
||||
@@ -93,7 +94,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
|
||||
// OBU断开连接
|
||||
override fun onDisconnect() {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onDisconnect ------> ")
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onDisconnect ------> ")
|
||||
mObuStatusInfo.obuStatus = false
|
||||
mObuStatusInfo.obuHvStatus = false
|
||||
mObuStatusInfo.obuRvStatus = false
|
||||
@@ -106,20 +107,20 @@ class MogoPrivateObuManager private constructor() {
|
||||
// 接收到的原始数据
|
||||
override fun onReceiveOriginData(data: String) {
|
||||
super.onReceiveOriginData(data)
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onReceiveOriginData ------> data = $data")
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onReceiveOriginData ------> data = $data")
|
||||
|
||||
}
|
||||
|
||||
// 发送的数据
|
||||
override fun onSendData(bytes: ByteArray) {
|
||||
super.onSendData(bytes)
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onSendData ------> ")
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onSendData ------> ")
|
||||
}
|
||||
|
||||
// CV2X系统信息
|
||||
override fun onCvxAppInitIndInfo(info: CvxAppInitIndInfo) {
|
||||
super.onCvxAppInitIndInfo(info)
|
||||
Logger.d(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
|
||||
@@ -141,7 +142,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", true) }
|
||||
mObuStatusInfo.obuHvStatus = true
|
||||
CallerObuListenerManager.invokeListener(mObuStatusInfo)
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxHvInfoIndInfo ------> $info")
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxHvInfoIndInfo ------> $info")
|
||||
if (info != null && info.basic_info != null && info.basic_info.position != null) {
|
||||
val movingObjectInfo = info.basic_info
|
||||
val position = movingObjectInfo.position
|
||||
@@ -191,7 +192,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
|
||||
// (3) 远车信息:CVX_RV_INFO_IND
|
||||
override fun onCvxRvInfoIndInfo(info: CvxRvInfoIndInfo) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRvInfoIndInfo ------> $info")
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxRvInfoIndInfo ------> $info")
|
||||
mObuStatusInfo.obuRvStatus = true
|
||||
CallerObuListenerManager.invokeListener(mObuStatusInfo)
|
||||
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", true) }
|
||||
@@ -203,7 +204,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
|
||||
// (3) 道路事件预警信息:CVX_RTI_THREAT_IND
|
||||
override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) {
|
||||
Logger.d(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,11 +213,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)
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRtiThreatIndInfo direction = $direction -- pos_classification = ${info.ext_info.pos_classification}")
|
||||
Logger.d(
|
||||
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} "
|
||||
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}"
|
||||
)
|
||||
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} "
|
||||
)
|
||||
when (appId) {
|
||||
// 道路危险情况预警
|
||||
@@ -232,13 +236,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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -253,7 +257,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
//事故
|
||||
0xC -> {
|
||||
appId =
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType
|
||||
}
|
||||
//拥堵
|
||||
0xD -> {
|
||||
@@ -262,7 +266,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
//行人
|
||||
0xF -> {
|
||||
appId =
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
|
||||
}
|
||||
//禁止停车
|
||||
0x13 -> {
|
||||
@@ -271,7 +275,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
//学校
|
||||
0x14 -> {
|
||||
appId =
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType
|
||||
}
|
||||
//桥梁
|
||||
0x17 -> {
|
||||
@@ -284,7 +288,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
//人行横道
|
||||
0x19 -> {
|
||||
appId =
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
|
||||
EventTypeEnum.TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType
|
||||
}
|
||||
//减速慢行
|
||||
0x1A -> {
|
||||
@@ -314,18 +318,24 @@ class MogoPrivateObuManager private constructor() {
|
||||
EventTypeEnum.TYPE_USECASE_ID_TJW.poiType -> {
|
||||
ttsContent = EventTypeEnum.getWarningTts(appId)
|
||||
if (info.threat_info != null) {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "ttsContent = $ttsContent --alertContent = $alertContent ---info.threat_info.distance = ${info.threat_info.distance} ")
|
||||
CallerLogger.d(
|
||||
"$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 = "前方拥堵,减速慢行"
|
||||
}
|
||||
}
|
||||
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "ttsContent = $ttsContent --alertContent = $alertContent")
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
"ttsContent = $ttsContent --alertContent = $alertContent"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,14 +348,19 @@ class MogoPrivateObuManager private constructor() {
|
||||
// CallerHmiManager.showWarning(direction)
|
||||
|
||||
//显示弹框,语音提示
|
||||
CallerHmiManager.showWarningV2X(appId.toInt(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
CallerHmiManager.showWarningV2X(appId.toInt(),
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
}, true, 5000L)
|
||||
},
|
||||
true,
|
||||
5000L
|
||||
)
|
||||
// 更新数据
|
||||
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
|
||||
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
|
||||
@@ -371,29 +386,29 @@ class MogoPrivateObuManager private constructor() {
|
||||
|
||||
// (4) V2I预警信息:CVX_IVP_THREAT_IND,红绿灯
|
||||
override fun onCvxIvpThreatIndInfo(info: CvxIvpThreatIndInfo?) {
|
||||
Logger.d(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
|
||||
&& info.ext_info.lights.isNotEmpty()
|
||||
&& 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.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?) {
|
||||
Logger.d(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)) {
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
|
||||
)
|
||||
var v2xType = ""
|
||||
if (info.ptc_type == 1) { //摩托车
|
||||
@@ -404,7 +419,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) {
|
||||
@@ -415,14 +430,19 @@ class MogoPrivateObuManager private constructor() {
|
||||
// if (level == 2 || level == 3) { //不考虑level
|
||||
//显示警告红边
|
||||
CallerHmiManager.showWarning(direction)
|
||||
CallerHmiManager.showWarningV2X(v2xType.toInt(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
CallerHmiManager.showWarningV2X(v2xType.toInt(),
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(v2xType + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
}, true, 5000L)
|
||||
},
|
||||
true,
|
||||
5000L
|
||||
)
|
||||
// }
|
||||
// 更新数据
|
||||
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
|
||||
@@ -450,7 +470,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
// (5) 限速预警信息:CVX_SLW_THREAT_IND
|
||||
override fun onCvxSlwThreatIndInfo(info: CvxSlwThreatIndInfo?) {
|
||||
//todo 限速走高精地图 屏蔽OBU限速\
|
||||
// Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxSlwThreatIndInfo ------> $info")
|
||||
// CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "onCvxSlwThreatIndInfo ------> $info")
|
||||
// if (info != null) {
|
||||
// when (info.status) {
|
||||
// // 添加
|
||||
@@ -459,8 +479,8 @@ class MogoPrivateObuManager private constructor() {
|
||||
// -> {
|
||||
// if (info.ext_info != null) {
|
||||
// // 计算为千米每小时 TODO 这里需要做一下向上取整数,40,60,80,120等
|
||||
// Logger.d(
|
||||
// MogoObuConst.TAG_MOGO_OBU,
|
||||
// CallerLogger.d(
|
||||
// "$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
// "info.ext_info.speed_limit_max ------> ${info.ext_info.speed_limit_max}"
|
||||
// )
|
||||
// CallerHmiManager.showLimitingVelocity((Math.round(((info.ext_info.speed_limit_max * 60 * 60) / 1000) / 10) * 10).toInt())
|
||||
@@ -477,7 +497,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
|
||||
// (1) V2V预警信息:CVX_V2V_THREAT_IND
|
||||
override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) {
|
||||
Logger.d(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 {
|
||||
@@ -487,11 +507,11 @@ class MogoPrivateObuManager private constructor() {
|
||||
val appId = info.threat_info.app_id
|
||||
val level = info.threat_info.threat_level
|
||||
val status = info.status
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"onCvxV2vThreatIndInfo target_classification = ${
|
||||
getMessageDirection(info.ext_info.target_classification)
|
||||
} --- direction = $direction --- appId = $appId ---level = $level -- status = $status"
|
||||
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"
|
||||
)
|
||||
handleSdkObu(appId, direction, status, level, info)
|
||||
}
|
||||
@@ -510,7 +530,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
* 获取消息的方位 车辆相关
|
||||
*/
|
||||
private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum {
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "预警红边:预警方向->$targetClassification")
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_OBU}", "预警红边:预警方向->$targetClassification")
|
||||
return when (targetClassification) {
|
||||
ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_IN_LANE,
|
||||
ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_IN_LANE,
|
||||
@@ -554,9 +574,9 @@ class MogoPrivateObuManager private constructor() {
|
||||
* 处理红绿灯
|
||||
*/
|
||||
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<Light>, index: Int) {
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"handlerTrafficLight appId = $appId --- status = $status ---index = $index ---lights.size = ${lights.size} ---lights = $lights "
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
"handlerTrafficLight appId = $appId --- status = $status ---index = $index ---lights.size = ${lights.size} ---lights = $lights "
|
||||
)
|
||||
when (status) {
|
||||
// 添加
|
||||
@@ -582,18 +602,18 @@ 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 = ""
|
||||
//这里需要根据真实数据确定 index 取值方式
|
||||
if (index != -1 && lights.size >= index) {
|
||||
val currentLight = lights[index]
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"currentLight = $currentLight ---currentLight.phase = ${currentLight.phase} ---rlvw_violation_type = ${currentLight.rlvw_violation_type} --- index = $index ---appId = $appId ---appId = $appId"
|
||||
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"
|
||||
)
|
||||
// 闯红灯预警
|
||||
when (currentLight.rlvw_violation_type) {
|
||||
@@ -605,8 +625,10 @@ class MogoPrivateObuManager private constructor() {
|
||||
0x2 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT
|
||||
ttsContent = EventTypeEnum.getWarningTts(appId.toString())
|
||||
alertContent = EventTypeEnum.getWarningContent(appId.toString())
|
||||
CallerHmiManager.showWarningV2X(appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(), null, true, 5000L)
|
||||
CallerHmiManager.showWarningV2X(
|
||||
appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(), null, true, 5000L
|
||||
)
|
||||
}
|
||||
0x3 -> {//闯黄灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_YELLOW_LIGHT
|
||||
}
|
||||
@@ -646,32 +668,39 @@ class MogoPrivateObuManager private constructor() {
|
||||
CallerHmiManager.changeCountdownRed(0)
|
||||
CallerHmiManager.changeCountdownYellow(0)
|
||||
// 拼接建议速度
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"speed_min = ${currentLight.glosa_suggested_speed_min} --speed_max = ${currentLight.glosa_suggested_speed_max.toInt()}"
|
||||
CallerLogger.d(
|
||||
"$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.toInt(), alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(), null, true, 5000L)
|
||||
CallerHmiManager.showWarningV2X(
|
||||
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType.toInt(),
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
appId.toString(),
|
||||
null,
|
||||
true,
|
||||
5000L
|
||||
)
|
||||
}
|
||||
}
|
||||
// 黄灯
|
||||
@@ -697,16 +726,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 提供的
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status"
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
"handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status"
|
||||
)
|
||||
var alertContent: String
|
||||
var ttsContent: String
|
||||
@@ -716,16 +745,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, "右")
|
||||
@@ -760,16 +789,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, "右")
|
||||
@@ -787,20 +816,25 @@ class MogoPrivateObuManager private constructor() {
|
||||
// 添加,更新 add的时候,可能级别是2,
|
||||
ObuConstants.STATUS.ADD,
|
||||
ObuConstants.STATUS.UPDATE -> {
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
|
||||
CallerLogger.d(
|
||||
"$M_OBU${MogoObuConst.TAG_MOGO_OBU}",
|
||||
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
|
||||
)
|
||||
if (level == 2 || level == 3) {
|
||||
//显示弹框,语音提示
|
||||
CallerHmiManager.showWarningV2X(appId, alertContent, ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
CallerHmiManager.showWarningV2X(appId,
|
||||
alertContent,
|
||||
ttsContent,// 只有第一次才tts,防止更新的时候不断的提醒
|
||||
(appId + direction.direction).toString(),//使用当前事件类型+方向记录tag,当发生变化的时候关闭当前弹出新的
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onDismiss() {
|
||||
// 关闭警告红边
|
||||
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
|
||||
}
|
||||
}, true, 5000L)
|
||||
},
|
||||
true,
|
||||
5000L
|
||||
)
|
||||
//显示警告红边
|
||||
CallerHmiManager.showWarning(direction)
|
||||
}
|
||||
|
||||
@@ -3,9 +3,10 @@ package com.mogo.eagle.core.function.obu.mogo.receiver
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
|
||||
import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
|
||||
import com.zhidao.support.obu.constants.ObuConstants
|
||||
import com.zhidao.support.obu.model.CvxIvpThreatIndInfo
|
||||
import com.zhidao.support.obu.model.CvxPtcThreatIndInfo
|
||||
@@ -13,7 +14,6 @@ import com.zhidao.support.obu.model.CvxRtiThreatIndInfo
|
||||
import com.zhidao.support.obu.model.CvxSlwThreatIndInfo
|
||||
import com.zhidao.support.obu.model.advance.*
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @date 2021/8/18
|
||||
@@ -38,8 +38,8 @@ class ObuRsuTestTriggerReceiver : BroadcastReceiver() {
|
||||
val pctType = intent.getIntExtra(MogoObuConst.BROADCAST_PTC_INFO_EXTRA_KEY, 0)
|
||||
val rtiType = intent.getIntExtra(MogoObuConst.BROADCAST_RTI_TYPE_EXTRA_KEY, 0)
|
||||
|
||||
LogUtils.dTag(
|
||||
TAG, "obuStatus:$obuStatus phase:$indicator obuType:$obuType obuLevel:$obuLevel"
|
||||
CallerLogger.d(
|
||||
"$M_OBU$TAG", "obuStatus:$obuStatus phase:$indicator obuType:$obuType obuLevel:$obuLevel"
|
||||
)
|
||||
|
||||
when (obuType) {
|
||||
|
||||
@@ -3,9 +3,10 @@ package com.mogo.eagle.core.function.obu.mogo.receiver
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
|
||||
import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
|
||||
import com.zhidao.support.obu.constants.ObuConstants
|
||||
import com.zhidao.support.obu.model.CvxV2vThreatIndInfo
|
||||
import com.zhidao.support.obu.model.advance.MovingObjectInfo
|
||||
@@ -38,8 +39,8 @@ class ObuTestTriggerReceiver : BroadcastReceiver() {
|
||||
val obuLevel = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_LEVEL_EXTRA_KEY, 3)
|
||||
val obuDirection =
|
||||
intent.getIntExtra(MogoObuConst.BROADCAST_OBU_EVENT_DIRECTION_EXTRA_KEY, 0x11)
|
||||
LogUtils.dTag(
|
||||
TAG, "obuType:$obuType obuStatus:$obuStatus obuDirection$obuDirection"
|
||||
CallerLogger.d(
|
||||
"$M_OBU$TAG", "obuType:$obuType obuStatus:$obuStatus obuDirection$obuDirection"
|
||||
)
|
||||
|
||||
when (obuType) {
|
||||
|
||||
@@ -3,9 +3,10 @@ package com.mogo.eagle.core.function.obu.mogo.receiver
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
|
||||
import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
|
||||
import com.zhidao.support.obu.model.CvxHvInfoIndInfo
|
||||
import com.zhidao.support.obu.model.advance.MovingObjectInfo
|
||||
import com.zhidao.support.obu.model.advance.Position
|
||||
@@ -33,7 +34,7 @@ class ObuTestTriggerRecognizedReceiver : BroadcastReceiver() {
|
||||
val obuType = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_TYPE_EXTRA_KEY, 0)
|
||||
val obuStatus = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_STATES_EXTRA_KEY, 0)
|
||||
val obuLevel = intent.getIntExtra(MogoObuConst.BROADCAST_OBU_LEVEL_EXTRA_KEY, 3)
|
||||
LogUtils.dTag(TAG, "obuType:$obuType obuStatus:$obuStatus obuLevel:$obuLevel")
|
||||
CallerLogger.d("$M_OBU$TAG", "obuType:$obuType obuStatus:$obuStatus obuLevel:$obuLevel")
|
||||
|
||||
val cvxHvInfoIndInfo = CvxHvInfoIndInfo(0, 1, 2)
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.mogo.eagle.core.function.obu.mogo.utils
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
|
||||
import com.zhidao.support.obu.constants.ObuConstants
|
||||
import com.zhidao.support.obu.model.CvxPtcThreatIndInfo
|
||||
import com.zhidao.support.obu.model.CvxRtiThreatIndInfo
|
||||
@@ -21,7 +22,7 @@ object TrafficDataConvertUtils {
|
||||
*/
|
||||
fun cvxRvInfoIndInfo2TrafficData(info: CvxRvInfoIndInfo): TrafficData? {
|
||||
if (info.basic_info == null || info.basic_info.position == null) {
|
||||
LogUtils.eTag(TAG, "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
|
||||
CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
|
||||
return null
|
||||
}
|
||||
val trafficData = TrafficData()
|
||||
@@ -48,7 +49,7 @@ object TrafficDataConvertUtils {
|
||||
|| info.zones_info.first().path_points.first() == null
|
||||
|| info.threat_info == null
|
||||
) {
|
||||
LogUtils.eTag(TAG, "数据转换异常,请检查参数是否齐全")
|
||||
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
|
||||
return null
|
||||
}
|
||||
val trafficData = TrafficData()
|
||||
@@ -68,7 +69,7 @@ object TrafficDataConvertUtils {
|
||||
*/
|
||||
fun cvxV2vThreatIndInfo2TrafficData(info: CvxV2vThreatIndInfo): TrafficData? {
|
||||
if (info.basic_info == null || info.basic_info.position == null || info.threat_info == null) {
|
||||
LogUtils.eTag(TAG, "数据转换异常,请检查参数是否齐全")
|
||||
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
|
||||
return null
|
||||
}
|
||||
val trafficData = TrafficData()
|
||||
@@ -94,7 +95,7 @@ object TrafficDataConvertUtils {
|
||||
*/
|
||||
fun cvxPtcThreatIndInfo2TrafficData(info: CvxPtcThreatIndInfo): TrafficData? {
|
||||
if (info.ptc_pos == null || info.threat_info == null) {
|
||||
LogUtils.eTag(TAG, "数据转换异常,请检查参数是否齐全")
|
||||
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
|
||||
return null
|
||||
}
|
||||
val trafficData = TrafficData()
|
||||
|
||||
Reference in New Issue
Block a user