[dev_arch_opt_3.0]录包工具三期

This commit is contained in:
xuxinchao
2023-02-22 18:44:33 +08:00
parent b8cbf7bb15
commit 088be3f4fb
52 changed files with 2128 additions and 123 deletions

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
@@ -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())
}
/**
* 向左变道
*/