Merge branch 'dev_arch_opt_3.0' into dev_robosweeper-d_app-module_221230_1.1.0

# Conflicts:
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/fragment/BaseSweeperTabFragment.java
#	app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java
#	app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java
#	core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java
This commit is contained in:
bxb
2023-03-01 09:35:07 +08:00
207 changed files with 4556 additions and 1509 deletions

View File

@@ -44,7 +44,7 @@ MogoObuManager.getInstance().init(Context context);
```
## 连接
```java
//默认192.168.1.199
//默认
MogoObuManager.getInstance().connect();
//自定义 IP
MogoObuManager.getInstance().connect(String ip);

View File

@@ -45,28 +45,30 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.androidxroomruntime
kapt rootProject.ext.dependencies.androidxroomcompiler
implementation rootProject.ext.dependencies.androidxroomktx
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')
implementation project(":foudations:mogo-aicloud-services-sdk")
implementation project(':core:mogo-core-data')
} else {
implementation project(':core:mogo-core-utils')
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.androidxroomruntime
kapt rootProject.ext.dependencies.androidxroomcompiler
implementation rootProject.ext.dependencies.androidxroomktx
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation project(':core:mogo-core-function-call')
implementation project(':foudations:mogo-commons')
implementation project(":foudations:mogo-commons")
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
//apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.datacenter.aicloud
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.cloud.socket.SocketManager
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
@@ -13,13 +12,15 @@ class AiCloudSocketBizProvider : IMoGoFunctionServerProvider {
get() = "AiCloudSocketBizProvider"
override fun init(context: Context?) {
SocketManager.getInstance().init(AbsMogoApplication.getApp(), 0.0, 0.0)
SocketManager.getInstance().registerOnMessageListener(401012, V2XMessageListener401012())
SocketManager.getInstance().registerOnMessageListener(401018, V2XMessageListener401018())
SocketManager.getInstance().registerOnMessageListener(402000, V2XMessageListener402000())
SocketManager.getInstance().registerOnMessageListener(404000, V2XMessageListener404000())
//SocketManager.getInstance().registerOnMessageListener(503000, V2XMessageListener503000())
SocketManager.getInstance().registerOnMessageListener(70001, V2XMessageListener70001())
context?.let {
SocketManager.getInstance().init(it, 0.0, 0.0)
SocketManager.getInstance().registerOnMessageListener(401012, V2XMessageListener401012())
SocketManager.getInstance().registerOnMessageListener(401018, V2XMessageListener401018())
SocketManager.getInstance().registerOnMessageListener(402000, V2XMessageListener402000())
SocketManager.getInstance().registerOnMessageListener(404000, V2XMessageListener404000())
//SocketManager.getInstance().registerOnMessageListener(503000, V2XMessageListener503000())
SocketManager.getInstance().registerOnMessageListener(70001, V2XMessageListener70001())
}
}
override fun onDestroy() {

View File

@@ -3,12 +3,14 @@ package com.mogo.eagle.core.function.datacenter.autopilot
import android.Manifest.permission
import android.content.Context
import androidx.annotation.RequiresPermission
import bag_manager.BagManagerOuterClass
import chassis.SpecialVehicleTaskCmdOuterClass
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.toAutoPilotLine
import com.mogo.eagle.core.data.autopilot.toRouteInfo
import com.mogo.eagle.core.data.badcase.BagManagerEntity
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
@@ -52,7 +54,7 @@ import com.zhidao.support.adas.high.common.Constants
import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS
import com.zhidao.support.adas.high.common.CupidLogUtils
import com.zhidao.support.adas.high.common.MessageType
import com.zhidao.support.adas.high.common.MogoReport
import com.zhjt.mogo.adas.data.bean.MogoReport
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants
import io.netty.channel.Channel
@@ -105,7 +107,7 @@ class MoGoAutopilotControlProvider :
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
.setClient(false)
.setIdentityMode(FunctionBuildConfig.appIdentityMode)
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear)
// .setSubscribeInterfaceOptions(subscribeInterfaceOptions)//
.build()
@@ -196,7 +198,7 @@ class MoGoAutopilotControlProvider :
val options = AdasOptions
.Builder()
.setClient(true)
.setIdentityMode(FunctionBuildConfig.appIdentityMode)
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear)
.build()
AdasManager.getInstance()
.create(options, MoGoAdasMsgConnectStatusListenerImpl())
@@ -224,7 +226,7 @@ class MoGoAutopilotControlProvider :
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
.setClient(false)// 乘客端直连工控机改为false
.setIdentityMode(FunctionBuildConfig.appIdentityMode)
.setUnableLaunchAutopilotGear(FunctionBuildConfig.unableLaunchAutopilotGear)
.build()
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
//////////////////////////////////注意先后顺序AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
@@ -546,6 +548,108 @@ class MoGoAutopilotControlProvider :
return AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache)
}
/**
* 获取数据采集录制模式配置列表
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
* @return boolean
*/
override fun sendBagManagerCmd(bagManagerEntity: BagManagerEntity): Boolean {
val bagManager = BagManagerOuterClass.BagManager
.newBuilder()
.setReqType(bagManagerEntity.reqType)
.setKeyReq(bagManagerEntity.keyReq)
// 更新包附加信息,发送请求且reqType=5时有效
val descReq = BagManagerOuterClass.BagDescription
.newBuilder()
bagManagerEntity.descReq?.let {
descReq.description = it.description
descReq.hasAudio = it.hasAudio
descReq.audioUrl = it.audioUrl
descReq.setReportBI(it.reportBI)
}
bagManager.descReq = descReq.build()
// 空间使用信息,获取响应且reqType=1时有效
for(diskSpaceInfoEntity in bagManagerEntity.spaceInfoResp){
val spaceInfoResp = BagManagerOuterClass.BagSpaceInfo
.newBuilder()
val diskSpaceInfo = BagManagerOuterClass.SpaceInfo
.newBuilder()
.setDirectory(diskSpaceInfoEntity.diskSpaceInfo.directory)
.setTotal(diskSpaceInfoEntity.diskSpaceInfo.total)
.setFree(diskSpaceInfoEntity.diskSpaceInfo.free)
.setUsed(diskSpaceInfoEntity.diskSpaceInfo.used)
.build()
spaceInfoResp
.setHost(diskSpaceInfoEntity.host).diskSpaceInfo = diskSpaceInfo
for(entity in diskSpaceInfoEntity.BagDirsSpaceInfo){
val bagDirsSpaceInfo = BagManagerOuterClass.SpaceInfo
.newBuilder()
.setDirectory(entity.directory)
.setTotal(entity.total)
.setFree(entity.free)
.setUsed(entity.used)
.build()
spaceInfoResp.addBagDirsSpaceInfo(bagDirsSpaceInfo)
}
bagManager.addSpaceInfoResp(spaceInfoResp.build())
}
// 包信息列表,获取响应且reqType=2时有效
for(bagsInfoRespEntity in bagManagerEntity.bagsInfoResp){
if(bagsInfoRespEntity.itemType == 0){
// 包描述信息
val bagDescription = BagManagerOuterClass.BagDescription
.newBuilder()
bagsInfoRespEntity.description?.let {
bagDescription.description = it.description
bagDescription.hasAudio = it.hasAudio
bagDescription.audioUrl = it.audioUrl
bagDescription.setReportBI(it.reportBI)
}
val bagsInfoResp = BagManagerOuterClass.BagInfo
.newBuilder()
.setKey(bagsInfoRespEntity.key)
.setTotalSize(bagsInfoRespEntity.totalSize)
.setTimestamp(bagsInfoRespEntity.timestamp)
.setBagPath(bagsInfoRespEntity.bagPath)
.setMergeStat(bagsInfoRespEntity.mergeStat)
.setUploadStat(bagsInfoRespEntity.uploadStat)
.setDescription(bagDescription.build())
// 子包信息
for(subBagEntity in bagsInfoRespEntity.subBags){
val subBag = BagManagerOuterClass.SubBag
.newBuilder()
.setKey(subBagEntity.key)
.setHost(subBagEntity.host)
.setSize(subBagEntity.size)
.build()
bagsInfoResp.addSubBags(subBag)
}
bagManager.addBagsInfoResp(bagsInfoResp)
}
}
//反馈上传cos桶结果,获取响应且reqType=3时有效
val uploadCosResp = BagManagerOuterClass.UploadCosStat
.newBuilder()
bagManagerEntity.uploadCosResp?.let {
uploadCosResp.key = it.key
uploadCosResp.stat = it.stat
uploadCosResp.message = it.message
bagManager.uploadCosResp = uploadCosResp.build()
}
return AdasManager.getInstance().sendBagManagerCmd(bagManager.build())
}
/**
* 向左变道
*/
@@ -644,27 +748,29 @@ class MoGoAutopilotControlProvider :
}
override fun connectSpecifiedServer(ip: String) {
NSDNettyManager.getInstance().connectSpecifiedServer(
ip,
NettyTcpServer.SERVER_PORT,
MoGoAiCloudClientConfig.getInstance().sn,
object : NettyClientListener<MogoProtocolMsg> {
override fun onMessageResponseClient(
msg: MogoProtocolMsg?,
sign: String?,
channel: Channel
) {
msgHandler.handleMsgFromServer(msg, channel)
}
ThreadUtils.getIoPool().submit {
NSDNettyManager.getInstance().connectSpecifiedServer(
ip,
NettyTcpServer.SERVER_PORT,
MoGoAiCloudClientConfig.getInstance().sn,
object : NettyClientListener<MogoProtocolMsg> {
override fun onMessageResponseClient(
msg: MogoProtocolMsg?,
sign: String?,
channel: Channel
) {
msgHandler.handleMsgFromServer(msg, channel)
}
override fun onClientStatusConnectChanged(
statusCode: Int,
sign: String?,
channel: Channel
) {
msgHandler.handleClientConnStatus(statusCode, sign, channel)
}
})
override fun onClientStatusConnectChanged(
statusCode: Int,
sign: String?,
channel: Channel
) {
msgHandler.handleClientConnStatus(statusCode, sign, channel)
}
})
}
}
/**

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.datacenter.autopilot.adapter
import android.content.Context
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.debug.DebugConfig.*
import com.mogo.eagle.core.data.config.FunctionBuildConfig

View File

@@ -1,7 +1,5 @@
package com.mogo.eagle.core.function.datacenter.location
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.map.MogoLocation
@@ -13,7 +11,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02Lis
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerGaoDeMapLocationListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import mogo.telematics.pad.MessagePad
@@ -119,25 +116,6 @@ object MoGoLocationDispatcher :
}
}
// 本地SP缓存城市Code
val cityCode = mogoLocation.cityCode
if (cityCode != null && cityCode.isNotEmpty()) {
mCityCode = mogoLocation.cityCode
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode)
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(
SharedPrefsConstants.LOCATION_LATITUDE,
mogoLocation.latitude.toString()
)
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
.putString(
SharedPrefsConstants.LOCATION_LONGITUDE,
mogoLocation.longitude.toString()
)
}
}
/**

View File

@@ -4,6 +4,7 @@ import android.content.Context
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.data.obu.MogoObuConst
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
@@ -18,7 +19,6 @@ import com.mogo.eagle.core.utilcode.util.CommonUtils
class MoGoObuProvider : IMoGoObuProvider {
private val TAG = "MoGoObuProvider"
private var mContext: Context? = null
private val taxiObuIp = "192.168.1.199" //obu的taxi和bus的ip已经全部统一成1网段ip
override val functionName: String
get() = TAG
@@ -36,7 +36,7 @@ class MoGoObuProvider : IMoGoObuProvider {
mContext = context
mContext?.let {
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp)
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, MogoObuConst.OBU_DEFAULT_IP)
//mogo obu
MogoPrivateObuNewManager.INSTANCE.connectObu(
it,
@@ -44,6 +44,9 @@ class MoGoObuProvider : IMoGoObuProvider {
CommonUtils.getIpAddressString()
)
}
//监听obu版本数据
MogoPrivateObuNewManager.INSTANCE.readSystemConfig()
}
/**
@@ -74,4 +77,12 @@ class MoGoObuProvider : IMoGoObuProvider {
override fun setObuLog(isChecked: Boolean) {
MogoPrivateObuNewManager.INSTANCE.setObuLog(isChecked)
}
override fun uploadObuPack(filePathArray: Array<String>) {
MogoPrivateObuNewManager.INSTANCE.uploadObuPack(filePathArray)
}
override fun deleteObuFile() {
MogoPrivateObuNewManager.INSTANCE.deleteObuFile()
}
}

View File

@@ -1,33 +0,0 @@
package com.mogo.eagle.core.function.datacenter.obu;
/**
* author : lxiiaopeng
* date : 2021-08-4
* desc : 常量
*/
public class MogoObuConst {
/**
* 自研obu的tag
*/
public static final String TAG_MOGO_OBU = "MogoObu";
public static final String TAG_MOGO_NEW_OBU = "MogoNewObu";
// OBU 场景测试
// 场景类型
public static String BROADCAST_OBU_TYPE_EXTRA_KEY = "obuType";
// 场景操作状态ObuConstants.STATUS
public static String BROADCAST_OBU_STATES_EXTRA_KEY = "obuStates";
// 场景预警等级2-弹窗3-弹窗+tts+地图绘制
public static String BROADCAST_OBU_LEVEL_EXTRA_KEY = "obuLevel";
//红绿灯标识 0:不可用1红灯2绿灯3黄灯
public static String BROADCAST_LIGHT_LEVEL_EXTRA_KEY = "lightLevel";
//弱势交通 0未知1非机动车2行人
public static String BROADCAST_PTC_INFO_EXTRA_KEY = "ptcInfo";
//道路交通信息类型 0x0--0x17
public static String BROADCAST_RTI_TYPE_EXTRA_KEY = "rtiType";
//道路交通信息触发方向 0x11--0x47
public static String BROADCAST_OBU_EVENT_DIRECTION_EXTRA_KEY = "obuEventDirection";
}

View File

@@ -229,6 +229,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
//限速预警, ADD处理一次
MogoObuConstants.RSI_SCENE_TYPE.SLW.toString() -> {
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
alertContent = EventTypeEnumNew.getWarningContent(appId)
ttsContent = EventTypeEnumNew.getWarningTts(appId)
}
@@ -241,6 +242,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
when (status) {
// 添加
MogoObuConstants.STATUS.ADD -> {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
}
@@ -501,6 +505,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
"${M_OBU}${TAG}",
"MogoObuDcCombineManager changeTrafficLightStatus 闯红灯 --------> ttsContent = $ttsContent ---alertContent = $alertContent "
)
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}
@@ -538,6 +545,9 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
val maxSpeed = currentLight.suggestMaxSpeed * 3.6
if (maxSpeed > 0) {
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent)
showWarning(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType, alertContent, ttsContent, WarningDirectionEnum.ALERT_WARNING_NON)
}

View File

@@ -4,10 +4,12 @@ import android.content.Context
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.*
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.map.angle.Default
import com.mogo.eagle.core.function.api.map.angle.TooClose
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
@@ -18,8 +20,10 @@ import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew
import com.mogo.eagle.core.utilcode.breakpoint.Config
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.util.FileUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.support.obu.ObuBase
import com.mogo.support.obu.ObuScene
@@ -31,6 +35,8 @@ import com.mogo.support.obu.model.*
import com.mogo.support.obu.option.MogoObuCom
import com.mogo.support.obu.option.MogoObuLog
import com.mogo.support.obu.option.MogoObuOptions
import com.mogo.support.obu.upgrade.ObuSoftwareUpgradeStatus
import com.mogo.support.obu.upgrade.OnUpgradeListener
import com.zhidao.support.obu.ObuManager
import com.zhidao.support.obu.OnObuListener
import mogo.telematics.pad.MessagePad
@@ -42,7 +48,7 @@ import kotlin.math.roundToInt
* @since 2021/8/23
* @description 自研OBU 管理
*/
class MogoPrivateObuNewManager private constructor() {
class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
companion object {
val INSTANCE: MogoPrivateObuNewManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
MogoPrivateObuNewManager()
@@ -50,9 +56,12 @@ class MogoPrivateObuNewManager private constructor() {
}
private var mObuStatusInfo = CallerObuConnectListenerManager.getObuStatusInfo()
private var mContext: Context? = null
var mVersionName: String? = null
fun connectObu(context: Context, obuIpAddress: String, padIpAddress: String) {
ObuManager.getInstance().registerObuListener(mogoObuListener)
mContext = context
val com = MogoObuCom.newBuilder()
.setLocalIp(padIpAddress)
.setComType(MogoObuComType.UDP)
@@ -82,6 +91,65 @@ class MogoPrivateObuNewManager private constructor() {
ObuManager.getInstance().connect(options)
}
/**
* 上传obu文件的状态, 升级成功需要删除obu的文件和解压文件夹
*/
override fun onUpgradeStatus(status: ObuSoftwareUpgradeStatus?, t: Throwable?) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "onUpgradeStatus status = $status ")
//上传完成就相当于成功了,立即升级,比上电升级,只是多了一个重启
if (status == ObuSoftwareUpgradeStatus.UPLOAD_FINISH|| status == ObuSoftwareUpgradeStatus.EXEC_UPGRADE_PROGRAM_FINISH
|| status == ObuSoftwareUpgradeStatus.CONNECTION_FAILED|| status == ObuSoftwareUpgradeStatus.AUTHENTICATION_FAILED
|| status == ObuSoftwareUpgradeStatus.CHANNEL_ABNORMITY|| status == ObuSoftwareUpgradeStatus.UPGRADE_PACKAGE_ERROR
|| status == ObuSoftwareUpgradeStatus.UPGRADE_PACKAGE_CHECK_FAILED || status == ObuSoftwareUpgradeStatus.PACKAGE_UPLOAD_FAILED
|| status == ObuSoftwareUpgradeStatus.EXEC_UPGRADE_PROGRAM_FAILED || status == ObuSoftwareUpgradeStatus.UNKNOWN) {
deleteObuFile()
}
}
/**
* 当前的obu版本
*/
override fun onCurrentVersion(version: MogoObuSystemBConfigData) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "onCurrentVersion version = ${version.version}")
if (!version.version.isNullOrEmpty()) {
mVersionName = version.version
CallerDevaToolsManager.queryObuUpgrade(version.version)
}
}
/**
* 删除obu相关的文件夹
*/
fun deleteObuFile(){
UiThreadHandler.post {
var isDeleteSuccess = FileUtils.delete(Config.downLoadObuPath)
var isDeleteUnzipSuccess = FileUtils.delete(Config.downLoadUnzipObuPath)
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", "deleteObuFile isDeleteSuccess = $isDeleteSuccess ----isDeleteUnzipSuccess = $isDeleteUnzipSuccess")
}
}
/**
* 监听obu
*/
fun readSystemConfig() {
ObuManager.getInstance().readSystemBConfig(mContext, MogoObuConst.OBU_DEFAULT_IP, this)
}
/**
* 传递obu升级包给硬件
* @param upgradePackage 升级包文件绝对路径 只能包含 升级包MD5文件和升级包文件
* @param isUpgradeNow 是否立即升级
* falseOBU设备下次上电时执行升级程序
* ture: OBU设备立即执行升级程序 TODO 警告:执行立即升级时请确保车辆是静止状态。车辆在运行过程中升级设备可能会影响驾驶,严重时可能造成安全隐患!!!
* @param listener 升级回调
* @return 是否调用成功
*/
fun uploadObuPack(filePathArray: Array<String>) {
CallerLogger.d("$M_OBU${MogoObuConst.TAG_UPGRADE_OBU}", " uploadObuPack filePathArray = $filePathArray")
ObuManager.getInstance().uploadUpgradePackage(MogoObuConst.OBU_DEFAULT_IP, filePathArray,true,this)
}
/**
* 断开新obu
*/
@@ -100,6 +168,9 @@ class MogoPrivateObuNewManager private constructor() {
return ObuManager.getInstance().connectStatus == MogoObuConstants.CONNECT_STATUS.CONNECTED
}
/**
* 设置obu sdk日志的输出
*/
fun setObuLog(isChecked: Boolean) {
ObuManager.getInstance().setEnableLog(isChecked)
val builder: MogoObuLog.Builder =
@@ -110,6 +181,9 @@ class MogoPrivateObuNewManager private constructor() {
ObuManager.getInstance().logConfig(builder.build())
}
/**
* obu 回调监听
*/
private val mogoObuListener: OnObuListener = object : OnObuListener {
/**
* 连接状态的改变
@@ -154,11 +228,14 @@ class MogoPrivateObuNewManager private constructor() {
if (HmiBuildConfig.isShowObuV2vView) {
if (data.warningMsg != null) {
// 更新数据远车数据之前要匹配uuid
TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(data.vehBasicsMsg)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficLocationInfo(it)
}
data.vehBasicsMsg?.let {
TrafficDataConvertUtilsNew.cvxRvInfoIndInfo2TrafficData(it)
?.let { data ->
CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(data)
}
}.also {
CallerLogger.e("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
}
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", data.toString())
//预警信息,预警类型 threat_level 2、3
@@ -607,12 +684,9 @@ class MogoPrivateObuNewManager private constructor() {
when (appId) {
//前向碰撞预警
MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> {
if (FunctionBuildConfig.isObuWarningFusionUnion) {
if (FunctionBuildConfig.isObuWarningFusionUnion && level == 3) {
alertContent = "前车距离过近"
ttsContent = "前车距离过近"
CallerObuWarningListenerManager.invokeTrackerFusionData(
ObuManager.getInstance().obuRvToTrackedObject(info)
)
} else {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
@@ -952,7 +1026,12 @@ class MogoPrivateObuNewManager private constructor() {
* 保存obu直连数据到消息盒子
*/
private fun saveObuData(type: String, content: String, tts: String) {
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.OBU)
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(
type,
content,
tts,
DataSourceType.OBU
)
}
/**

View File

@@ -6,9 +6,6 @@ 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.support.obu.ObuBase
import com.mogo.support.obu.ObuScene
import com.mogo.support.obu.model.MogoObuRsiWarningData
import com.mogo.support.obu.model.MogoObuRsmWarningData
import com.mogo.support.obu.model.MogoObuRvWarningData
/**
* @description 自研obu数据转换
@@ -23,10 +20,6 @@ object TrafficDataConvertUtilsNew {
* OBU 远车 转换交通元素数据,是否需要
*/
fun cvxRvInfoIndInfo2TrafficData(info: ObuBase.VehicleBasics): TrafficData? {
if (info == null) {
CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE
trafficData.uuid = info.id
@@ -59,7 +52,7 @@ object TrafficDataConvertUtilsNew {
* OBU 预警事件 转换交通元素数据 他车预警
*/
fun cvxV2vThreatIndInfo2TrafficData(info: ObuScene.RvWarningData): TrafficData? {
if (info?.vehBasicsMsg == null || info.warningMsg == null) {
if (info.vehBasicsMsg == null || info.warningMsg == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
@@ -70,7 +63,7 @@ object TrafficDataConvertUtilsNew {
trafficData.heading = info.vehBasicsMsg.heading
trafficData.speed = info.vehBasicsMsg.speed
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg.warningDataList != null) {
if (info.warningMsg.warningDataList != null && info.warningMsg.warningDataList.size > 0) {
trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel
} else {
trafficData.threatLevel = 1
@@ -123,7 +116,7 @@ object TrafficDataConvertUtilsNew {
}
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg != null && info.warningMsg.warningDataList != null) {
if (info.warningMsg != null && info.warningMsg.warningDataList != null && info.warningMsg.warningDataList.size > 0) {
trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel
} else {
trafficData.threatLevel = 1