[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

@@ -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+")
/**