[6.2.4]AI数据采集信息上报到工控机

This commit is contained in:
xuxinchao
2023-12-07 21:05:23 +08:00
parent 9782bd0045
commit 8e43c89760
2 changed files with 19 additions and 4 deletions

View File

@@ -12,6 +12,8 @@ import androidx.recyclerview.widget.RecyclerView
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.deva.badcase.AiDataEntity
import com.mogo.eagle.core.data.deva.badcase.BagDescriptionEntity
import com.mogo.eagle.core.data.deva.badcase.BagManagerEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.api.devatools.badcase.BadCaseNetListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
@@ -67,11 +69,13 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
private var aiDataListAdapter: AiDataListAdapter?= null
@Volatile
private var recordKey: String? = null //录制bag包key
private var recordKey: Long = 0 //录制bag包key
@Volatile
private var recordFileName: String? = null //录制文件包名
private var bagManagerEntity: BagManagerEntity = BagManagerEntity()
private lateinit var mFloatLayout: View
private var mInViewX = 0f
private var mInViewY = 0f
@@ -143,12 +147,15 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
ToastUtils.showShort("请选择最少一个原因")
return@setOnClickListener
}
//上报到工控机
CallerAutoPilotControlManager.recordCause(recordKey.toString(),recordFileName,"",
collectReason.toString())
GlobalScope.launch {
val uploadResult = presenter.upload(mutableMapOf<String, String>().also { itx ->
itx["carLicense"] = AppConfigInfo.plateNumber ?: "" //车牌号
itx["filename"] = recordFileName ?: "" //bag包文件地址
itx["filesize"] = "0" //bag包文件大小
itx["key"] = recordKey ?: "" //key
itx["key"] = recordKey.toString() //key
itx["reason"] = collectReason.toString() //采集原因
itx["duration"] = "20" //采集时长固定为20S
itx["startTime"] = System.currentTimeMillis().toString() //上报时间(时间戳格式)
@@ -166,6 +173,14 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
TipToast.shortTip("上报失败")
} else {
TipToast.shortTip("上报成功")
//将上报BI的结果同步给工控机记录保存
recordKey?.let {
val descReqEntity = BagDescriptionEntity(collectReason.toString(),false,"",true)
bagManagerEntity.reqType = 5
bagManagerEntity.keyReq = it
bagManagerEntity.descReq = descReqEntity
CallerAutoPilotControlManager.sendBagManagerCmd(bagManagerEntity)
}
BadCaseConfig.windowNum--
clickListener?.closeWindow()
}
@@ -197,7 +212,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
override fun onAutopilotRecordResult(recordPanel: RecordPanelOuterClass.RecordPanel) {
CallerLogger.d("${M_DEVA}${TAG}", "-- 收到工控机录制任务回调 -- $recordPanel")
ThreadUtils.runOnUiThread {
recordKey = recordPanel.key.toString()
recordKey = recordPanel.key
//开始录制
if(recordPanel.stat == 300){
BadCaseConfig.recordKeyList.add(recordPanel.key)