修改Obu模块调用Utils为:core:mogo-core-utils

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-09-17 19:25:46 +08:00
parent 47670a7a4c
commit 351d883388
7 changed files with 40 additions and 41 deletions

View File

@@ -51,15 +51,15 @@ dependencies {
kapt rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogoutils
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduledata
} else {
api project(":foudations:mogo-utils")
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-call')
}

View File

@@ -2,9 +2,9 @@ package com.mogo.module.obu.mogo
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.utilcode.util.LogUtils
import com.mogo.service.MogoServicePaths
import com.mogo.service.obu.IMoGoObuProvider
import com.mogo.utils.logger.Logger
/**
* @author xiaoyuzhou
@@ -14,7 +14,7 @@ import com.mogo.utils.logger.Logger
class MoGoObuProvider : IMoGoObuProvider {
private val TAG = "MoGoObuProvider"
override fun init(context: Context) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "初始化蘑菇自研OBU……")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "初始化蘑菇自研OBU……")
MogoPrivateObuManager.INSTANCE.init(context)
}

View File

@@ -1,7 +1,6 @@
package com.mogo.module.obu.mogo
import android.content.Context
import android.util.Log
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
import com.mogo.module.common.drawer.TrafficMarkerDrawer
@@ -14,7 +13,7 @@ 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.utils.logger.Logger
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
@@ -42,7 +41,7 @@ class MogoPrivateObuManager private constructor() {
private var mContext: Context? = null
fun init(context: Context?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "obuManager初始化--")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "obuManager初始化--")
mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
.navigation(context) as IMogoServiceApis
mContext = context
@@ -58,13 +57,13 @@ class MogoPrivateObuManager private constructor() {
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
// OBU连接成功
override fun onConnected() {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onConnected ------> ")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onConnected ------> ")
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) }
}
// OBU连接失败
override fun onConnectFail(isNeedReconnect: Boolean) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onConnectFail ------> ")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onConnectFail ------> ")
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", false) }
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", false) }
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", false) }
@@ -72,7 +71,7 @@ class MogoPrivateObuManager private constructor() {
// OBU断开连接
override fun onDisconnect() {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onDisconnect ------> ")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onDisconnect ------> ")
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", false) }
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", false) }
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", false) }
@@ -81,26 +80,26 @@ class MogoPrivateObuManager private constructor() {
// 接收到的原始数据
override fun onReceiveOriginData(data: String) {
super.onReceiveOriginData(data)
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onReceiveOriginData ------> data = $data")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onReceiveOriginData ------> data = $data")
}
// 发送的数据
override fun onSendData(bytes: ByteArray) {
super.onSendData(bytes)
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onSendData ------> ")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onSendData ------> ")
}
// CV2X系统信息
override fun onCvxAppInitIndInfo(info: CvxAppInitIndInfo) {
super.onCvxAppInitIndInfo(info)
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxAppInitIndInfo ------> $info")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onCvxAppInitIndInfo ------> $info")
}
// (2) 车辆信息CVX_HV_INFO_IND
override fun onCvxHvInfoIndInfo(info: CvxHvInfoIndInfo?) {
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_HV", true) }
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxHvInfoIndInfo ------> $info")
LogUtils.dTag(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
@@ -147,7 +146,7 @@ class MogoPrivateObuManager private constructor() {
// (3) 远车信息CVX_RV_INFO_IND
override fun onCvxRvInfoIndInfo(info: CvxRvInfoIndInfo) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRvInfoIndInfo ------> $info")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onCvxRvInfoIndInfo ------> $info")
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", true) }
// 更新数据
TrafficDataConvertUtils.cvxRvInfoIndInfo2TrafficData(info)?.let {
@@ -157,7 +156,7 @@ class MogoPrivateObuManager private constructor() {
// (3) 道路事件预警信息CVX_RTI_THREAT_IND
override fun onCvxRtiThreatIndInfo(info: CvxRtiThreatIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRtiThreatIndInfo ------> $info")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onCvxRtiThreatIndInfo ------> $info")
if (info != null && info.threat_info != null && info.ext_info != null) {
var alertContent = ""
@@ -170,7 +169,7 @@ class MogoPrivateObuManager private constructor() {
when (appId) {
// 道路危险情况预警
EventTypeEnum.TYPE_USECASE_ID_HLW.poiType -> {
Logger.d(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 -> {
@@ -291,7 +290,7 @@ class MogoPrivateObuManager private constructor() {
// (4) V2I预警信息CVX_IVP_THREAT_IND
override fun onCvxIvpThreatIndInfo(info: CvxIvpThreatIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "CvxIvpThreatIndInfo ------> $info")
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,
@@ -304,7 +303,7 @@ class MogoPrivateObuManager private constructor() {
// (6) 地图红绿灯信息CVX_MAP_SPAT_INFO_IND
override fun onCvxMapSpatInfoIndInfo(info: CvxMapSpatInfoIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxMapSpatInfoIndInfo ------> $info")
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,
@@ -317,9 +316,9 @@ class MogoPrivateObuManager private constructor() {
// (2) 弱势交通参与者预警信息CVX_PTC_THREAT_IND
override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxPtcInfoIndInfo ------> $info")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onCvxPtcInfoIndInfo ------> $info")
if (info != null) {
Logger.d(
LogUtils.dTag(
MogoObuConst.TAG_MOGO_OBU,
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
)
@@ -381,7 +380,7 @@ class MogoPrivateObuManager private constructor() {
// (5) 限速预警信息CVX_SLW_THREAT_IND
override fun onCvxSlwThreatIndInfo(info: CvxSlwThreatIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxSlwThreatIndInfo ------> $info")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onCvxSlwThreatIndInfo ------> $info")
if (info != null) {
when (info.status) {
// 添加
@@ -403,7 +402,7 @@ class MogoPrivateObuManager private constructor() {
// (1) V2V预警信息CVX_V2V_THREAT_IND
override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxV2vThreatIndInfo ------> $info")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "onCvxV2vThreatIndInfo ------> $info")
info?.let {
//预警信息,预警类型 threat_level 2、3
info.threat_info?.let {
@@ -413,7 +412,7 @@ class MogoPrivateObuManager private constructor() {
val appId = info.threat_info.app_id
val level = info.threat_info.threat_level
val status = info.status
Logger.d(
LogUtils.dTag(
MogoObuConst.TAG_MOGO_OBU,
"onCvxV2vThreatIndInfo target_classification = ${
getMessageDirection(info.ext_info.target_classification)
@@ -436,7 +435,7 @@ class MogoPrivateObuManager private constructor() {
* 获取消息的方位 车辆相关
*/
private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "预警红边:预警方向->$targetClassification")
LogUtils.dTag(MogoObuConst.TAG_MOGO_OBU, "预警红边:预警方向->$targetClassification")
return when (targetClassification) {
ObuConstants.TARGET_CLASSIFICATION.TC_ONCOMING_IN_LANE,
ObuConstants.TARGET_CLASSIFICATION.TC_AHEAD_IN_LANE,
@@ -480,7 +479,7 @@ class MogoPrivateObuManager private constructor() {
* 处理红绿灯
*/
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<Light>, indicator: Int) {
Logger.d(
LogUtils.dTag(
MogoObuConst.TAG_MOGO_OBU,
"handlerTrafficLight appId = $appId --- status = $status ---indicator = $indicator ---lights = $lights ---lights.size = ${lights.size}"
)
@@ -516,7 +515,7 @@ class MogoPrivateObuManager private constructor() {
// TODO 这里需要根据真实数据确定 indicator 取值方式,暂时写 0 调试
if (lights.size >= indicator) {
val currentLight = lights[0]
Logger.d(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 -> {
@@ -554,7 +553,7 @@ class MogoPrivateObuManager private constructor() {
mIMoGoWaringProvider?.changeCountdownRed(0)
mIMoGoWaringProvider?.changeCountdownYellow(0)
// 拼接建议速度
Logger.d(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()}"
@@ -611,7 +610,7 @@ class MogoPrivateObuManager private constructor() {
info: CvxV2vThreatIndInfo
) {
// 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnum 提供的
Log.d(
LogUtils.dTag(
MogoObuConst.TAG_MOGO_OBU,
"handleSdkObu appId = $appId --- handleDirection = $direction ---level = $level ---status = $status"
)
@@ -707,7 +706,7 @@ class MogoPrivateObuManager private constructor() {
// 添加,更新 add的时候可能级别是2
ObuConstants.STATUS.ADD,
ObuConstants.STATUS.UPDATE -> {
Log.d(
LogUtils.dTag(
MogoObuConst.TAG_MOGO_OBU,
"appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
)

View File

@@ -3,9 +3,9 @@ package com.mogo.module.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.module.obu.mogo.MogoObuConst
import com.mogo.module.obu.mogo.MogoPrivateObuManager
import com.mogo.utils.logger.Logger
import com.zhidao.support.obu.constants.ObuConstants
import com.zhidao.support.obu.model.CvxIvpThreatIndInfo
import com.zhidao.support.obu.model.CvxPtcThreatIndInfo
@@ -38,7 +38,7 @@ 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)
Logger.d(
LogUtils.dTag(
TAG, "obuStatus:$obuStatus phase:$indicator obuType:$obuType obuLevel:$obuLevel"
)

View File

@@ -3,9 +3,9 @@ package com.mogo.module.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.module.obu.mogo.MogoObuConst
import com.mogo.module.obu.mogo.MogoPrivateObuManager
import com.mogo.utils.logger.Logger
import com.zhidao.support.obu.constants.ObuConstants
import com.zhidao.support.obu.model.CvxV2vThreatIndInfo
import com.zhidao.support.obu.model.advance.MovingObjectInfo
@@ -38,7 +38,7 @@ 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)
Logger.d(
LogUtils.dTag(
TAG, "obuType:$obuType obuStatus:$obuStatus obuDirection$obuDirection"
)

View File

@@ -3,9 +3,9 @@ package com.mogo.module.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.module.obu.mogo.MogoObuConst
import com.mogo.module.obu.mogo.MogoPrivateObuManager
import com.mogo.utils.logger.Logger
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 +33,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)
Logger.d(TAG, "obuType:$obuType obuStatus:$obuStatus obuLevel:$obuLevel")
LogUtils.dTag(TAG, "obuType:$obuType obuStatus:$obuStatus obuLevel:$obuLevel")
val cvxHvInfoIndInfo = CvxHvInfoIndInfo(0, 1, 2)

View File

@@ -1,8 +1,8 @@
package com.mogo.module.obu.mogo.utils
import com.mogo.eagle.core.utilcode.util.LogUtils
import com.mogo.module.common.drawer.bean.TrafficData
import com.mogo.module.common.enums.TrafficTypeEnum
import com.mogo.utils.logger.Logger
import com.zhidao.support.obu.constants.ObuConstants
import com.zhidao.support.obu.model.CvxPtcThreatIndInfo
import com.zhidao.support.obu.model.CvxRtiThreatIndInfo
@@ -21,7 +21,7 @@ object TrafficDataConvertUtils {
*/
fun cvxRvInfoIndInfo2TrafficData(info: CvxRvInfoIndInfo): TrafficData? {
if (info.basic_info == null || info.basic_info.position == null) {
Logger.e(TAG, "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
LogUtils.eTag(TAG, "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
@@ -45,7 +45,7 @@ object TrafficDataConvertUtils {
|| info.zones_info.first().path_points.first() == null
|| info.threat_info == null
) {
Logger.e(TAG, "数据转换异常,请检查参数是否齐全")
LogUtils.eTag(TAG, "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
@@ -65,7 +65,7 @@ object TrafficDataConvertUtils {
*/
fun cvxV2vThreatIndInfo2TrafficData(info: CvxV2vThreatIndInfo): TrafficData? {
if (info.basic_info == null || info.basic_info.position == null || info.threat_info == null) {
Logger.e(TAG, "数据转换异常,请检查参数是否齐全")
LogUtils.eTag(TAG, "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
@@ -91,7 +91,7 @@ object TrafficDataConvertUtils {
*/
fun cvxPtcThreatIndInfo2TrafficData(info: CvxPtcThreatIndInfo): TrafficData? {
if (info.ptc_pos == null || info.threat_info == null) {
Logger.e(TAG, "数据转换异常,请检查参数是否齐全")
LogUtils.eTag(TAG, "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()