[8.1.0_new_ota]OTA 2.0 版本

This commit is contained in:
xuxinchao
2025-06-23 14:57:21 +08:00
parent fa02d6c200
commit f64c5d273d
12 changed files with 173 additions and 8 deletions

View File

@@ -1556,6 +1556,14 @@ class MoGoAutopilotControlProvider :
return AdasManager.getInstance().sendSsmFuncOtaStatusQuery(token)>-1
}
/**
* OTA2.0查询
* @param queryStr {"cmd":"PAD_QUERY_UPGRADE_STATUS","token":"123"} JSON
*/
override fun sendOtaPadMsgQuery(queryStr: String): Boolean {
return AdasManager.getInstance().sendOtaPadMsgQuery(queryStr) > -1
}
/**
* 人工接管时获取前方和后方摄像头数据
* 一次请求域控回调次两次摄像头数据 根据{@link MessagePad.CaptureImgOnTakeOver#getUuid()}进行区分是否是哪次请求

View File

@@ -622,6 +622,9 @@ class MoGoAdasListenerImpl : OnAdasListener {
timestamp: Long,
status: SsmInfo.PureStr?
) {
if(status != null){
CallerOTAManager.invokeOtaPureStr(token,timestamp,status)
}
}
/**

View File

@@ -28,4 +28,23 @@ object OTAUpgradeConfig {
//已经提示过升级成功的列表
@JvmField
var upgradeFinish: ArrayList<String> = ArrayList()
var token: String = ""
}

View File

@@ -394,6 +394,65 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
}
/**
* OTA 2.0 新接口
* @param token PadSsmMsg唯一消息ID
* @param timestamp 消息发送时间 单位:毫秒
* @param status OTA 2.0 数据
*/
override fun onOtaPureStr(token: Long, timestamp: Long, status: SsmInfo.PureStr) {
super.onOtaPureStr(token, timestamp, status)
Log.i(TAG, "onOtaPureStr token=$token")
Log.i(TAG, "onOtaPureStr timestamp=$timestamp")
Log.i(TAG, "onOtaPureStr status=$status")
Log.i(TAG, "onOtaPureStr status.data=${status.data}")
val jsonObject = JSONObject(status.data)
val cmd = jsonObject.optString("cmd")
val otaToken = jsonObject.optString("token")
val otaStatus = jsonObject.optString("status")
val upgradeReason = jsonObject.optString("upgrade_reason")
val isDelay = jsonObject.optBoolean("is_delay")
val isCancel = jsonObject.optBoolean("is_cancel")
Log.i(TAG, "cmd=$cmd")
Log.i(TAG, "otaToken=$otaToken")
Log.i(TAG, "otaStatus=$otaStatus")
Log.i(TAG, "upgradeReason=$upgradeReason")
Log.i(TAG, "isDelay=$isDelay")
Log.i(TAG, "isCancel=$isCancel")
val products = jsonObject.optString("products")
val productsArray = JSONArray(products)
if(productsArray.length() > 0){
for(index in 0 until productsArray.length()){
val productInfo = productsArray[index] as JSONObject
val productStatus = productInfo.optString("status")
val failReason = productInfo.optString("fail_reason")
val speed = productInfo.optDouble("speed")
val leftTime = productInfo.optInt("left_time")
val name = productInfo.optString("name")
val curSize = productInfo.optInt("cur_size")
val totalSize = productInfo.optInt("total_size")
Log.i(TAG, "productStatus=$productStatus")
Log.i(TAG, "failReason=$failReason")
Log.i(TAG, "speed=$speed")
Log.i(TAG, "leftTime=$leftTime")
Log.i(TAG, "name=$name")
Log.i(TAG, "curSize=$curSize")
Log.i(TAG, "totalSize=$totalSize")
}
}
if(otaToken.isNotEmpty()){
CallerHmiManager.showOTAUpgradeDialog(true,upgradeReason)
}
}
private val pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+")
/**

View File

@@ -154,14 +154,24 @@ class CarInfoTabView @JvmOverloads constructor(
"${SceneConstant.M_HMI}${TAG}",
"ad version view clicked"
)
if(OTAUpgradeConfig.supportOTA){
//查询OTA状态
OTAUpgradeConfig.isQuery = true
OTAUpgradeConfig.promptedUpgrade.remove(OTAUpgradeConfig.otaToken)
CallerAutoPilotControlManager.sendSsmFuncOtaStatusQuery(OTAUpgradeConfig.otaToken)
}else{
ToastUtils.showLong("当前SSM节点未成功启动或当前版本不支持OTA升级")
}
// if(OTAUpgradeConfig.supportOTA){
// //查询OTA状态
// OTAUpgradeConfig.isQuery = true
// OTAUpgradeConfig.promptedUpgrade.remove(OTAUpgradeConfig.otaToken)
// CallerAutoPilotControlManager.sendSsmFuncOtaStatusQuery(OTAUpgradeConfig.otaToken)
// }else{
// ToastUtils.showLong("当前SSM节点未成功启动或当前版本不支持OTA升级")
// }
//查询OTA升级
val query: JSONObject = JSONObject()
query.put("cmd","PAD_QUERY_UPGRADE_STATUS")
query.put("token",OTAUpgradeConfig.token)
Log.i("xuxinchao",query.toString())
CallerAutoPilotControlManager.sendOtaPadMsgQuery(query.toString())
}
tvHDMapVersion.text = tvHDMapVersion.text.toString() + DebugConfig.getMapVersion()
//高精地图 检查更新

View File

@@ -730,6 +730,12 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider {
*/
fun sendSsmFuncOtaStatusQuery(token: String): Boolean
/**
* OTA2.0查询
* @param queryStr {"cmd":"PAD_QUERY_UPGRADE_STATUS","token":"123"} JSON
*/
fun sendOtaPadMsgQuery(queryStr: String): Boolean
/**
* 人工接管时获取前方和后方摄像头数据
* 一次请求域控回调次两次摄像头数据 根据{@link MessagePad.CaptureImgOnTakeOver#getUuid()}进行区分是否是哪次请求

View File

@@ -34,4 +34,12 @@ interface IOTAListener {
*/
fun onOtaDownloadStatus(status: Boolean){}
/**
* OTA 2.0 新接口
* @param token PadSsmMsg唯一消息ID
* @param timestamp 消息发送时间 单位:毫秒
* @param status OTA 2.0 数据
*/
fun onOtaPureStr(token: Long,timestamp: Long,status: SsmInfo.PureStr){}
}

View File

@@ -1095,6 +1095,14 @@ object CallerAutoPilotControlManager {
return providerApi?.sendSsmFuncOtaStatusQuery(token)?:false
}
/**
* OTA2.0查询
* @param queryStr {"cmd":"PAD_QUERY_UPGRADE_STATUS","token":"123"} JSON
*/
fun sendOtaPadMsgQuery(queryStr: String): Boolean{
return providerApi?.sendOtaPadMsgQuery(queryStr)?:false
}
/**
* 人工接管时获取前方和后方摄像头数据
* 一次请求域控回调次两次摄像头数据 根据{@link MessagePad.CaptureImgOnTakeOver#getUuid()}进行区分是否是哪次请求

View File

@@ -56,4 +56,17 @@ object CallerOTAManager: CallerBase<IOTAListener>() {
}
}
/**
* OTA 2.0 新接口
* @param token PadSsmMsg唯一消息ID
* @param timestamp 消息发送时间 单位:毫秒
* @param status OTA 2.0 数据
*/
fun invokeOtaPureStr(token: Long,timestamp: Long,status: SsmInfo.PureStr){
M_LISTENERS.forEach {
val listener = it.value
listener.onOtaPureStr(token, timestamp, status)
}
}
}