[6.10.0]OTA升级修改
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.zhjt.mogo_core_function_devatools.ota
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -39,6 +42,25 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
}
|
||||
}
|
||||
|
||||
private var responseTimeoutNum: Int = 0 //响应超时次数
|
||||
private val handler =object : Handler(Looper.getMainLooper()){
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
if(msg.what == 1){
|
||||
if(responseTimeoutNum<40){
|
||||
responseTimeoutNum++
|
||||
//30秒没有收到OTA升级推送主动进行查询
|
||||
Log.i(TAG,"30秒没有收到OTA升级推送主动进行查询")
|
||||
CallerAutoPilotControlManager.sendSsmFuncOtaStatusQuery(OTAUpgradeConfig.otaToken)
|
||||
this.sendEmptyMessageDelayed(1,30000)
|
||||
}else{
|
||||
Log.i(TAG,"20分钟没有收到OTA升级推送置为失败")
|
||||
CallerHmiManager.showOTAResultDialog(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态信息
|
||||
* @param state 状态信息
|
||||
@@ -112,6 +134,7 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
val isDelay = productInfo.optBoolean("is_delay")
|
||||
val curSize = productInfo.optDouble("cur_size")
|
||||
val totalSize = productInfo.optDouble("total_size")
|
||||
val taskNumber = productInfo.optInt("task_number")
|
||||
|
||||
Log.i(TAG, "index=$index")
|
||||
Log.i(TAG, "token=$token")
|
||||
@@ -126,6 +149,7 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
Log.i(TAG, "is_delay=$isDelay")
|
||||
Log.i(TAG, "cur_size=$curSize")
|
||||
Log.i(TAG, "total_size=$totalSize")
|
||||
Log.i(TAG,"taskNumber=$taskNumber")
|
||||
|
||||
if(index == 0){
|
||||
//是否需要触发提示升级只判断第一个任务
|
||||
@@ -153,14 +177,25 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
if(productStatus == 0 || productStatus == 1 || productStatus == 2){
|
||||
upgradeComplete = false
|
||||
}
|
||||
if(productArray.length() != taskNumber){
|
||||
upgradeComplete = false
|
||||
}
|
||||
if(productName.contains(":")){
|
||||
productName = productName.trim().substringAfterLast(":")
|
||||
}
|
||||
val otaUpgradeInfo = OtaUpgradeInfo(token, productStatus,failReason,upgradeReason,
|
||||
taskId,taskItemId,otaType,productName,needRestart,isDelay,curSize,totalSize)
|
||||
taskId,taskItemId,otaType,productName,needRestart,isDelay,curSize,totalSize)
|
||||
otaUpgradeList.add(otaUpgradeInfo)
|
||||
}
|
||||
CallerHmiManager.showOTADownloadStatusDialog(true,otaUpgradeList)
|
||||
if(!upgradeComplete){
|
||||
responseTimeoutNum = 0
|
||||
handler.removeMessages(1)
|
||||
handler.sendEmptyMessageDelayed(1,30000)
|
||||
}else{
|
||||
responseTimeoutNum = 0
|
||||
handler.removeMessages(1)
|
||||
}
|
||||
if(upgradeComplete){
|
||||
OTAUpgradeConfig.otaToken = ""
|
||||
CallerOTAManager.invokeOtaDownloadStatus(false)
|
||||
@@ -183,7 +218,6 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
super.onOtaStatus(status)
|
||||
Log.i(TAG,"onOtaStatus status.otaInfo.otaToken"+status.otaInfo.otaToken)
|
||||
Log.i(TAG,"onOtaStatus status.otaInfo.productName"+status.otaInfo.productName)
|
||||
|
||||
if(status.otaInfo.otaToken.isNotEmpty()){
|
||||
if(OTAUpgradeConfig.otaToken != status.otaInfo.otaToken){
|
||||
OTAUpgradeConfig.otaToken = status.otaInfo.otaToken
|
||||
@@ -210,6 +244,7 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
val isDelay = productInfo.optBoolean("is_delay")
|
||||
val curSize = productInfo.optDouble("cur_size")
|
||||
val totalSize = productInfo.optDouble("total_size")
|
||||
val taskNumber = productInfo.optInt("task_number")
|
||||
|
||||
Log.i(TAG, "index=$index")
|
||||
Log.i(TAG, "token=$token")
|
||||
@@ -224,6 +259,7 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
Log.i(TAG, "is_delay=$isDelay")
|
||||
Log.i(TAG, "cur_size=$curSize")
|
||||
Log.i(TAG, "total_size=$totalSize")
|
||||
Log.i(TAG,"task_number=$taskNumber")
|
||||
|
||||
if(index == 0){
|
||||
//是否需要触发提示升级只判断第一个任务
|
||||
@@ -252,6 +288,9 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
if(productStatus == 0 || productStatus == 1 || productStatus == 2){
|
||||
upgradeComplete = false
|
||||
}
|
||||
if(productArray.length() != taskNumber){
|
||||
upgradeComplete = false
|
||||
}
|
||||
if(productStatus == 4){
|
||||
upgradeResult = false
|
||||
}
|
||||
@@ -262,17 +301,22 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
taskId,taskItemId,otaType,productName,needRestart,isDelay,curSize,totalSize)
|
||||
otaUpgradeList.add(otaUpgradeInfo)
|
||||
}
|
||||
if(!upgradeComplete){
|
||||
responseTimeoutNum = 0
|
||||
handler.removeMessages(1)
|
||||
handler.sendEmptyMessageDelayed(1,30000)
|
||||
}else{
|
||||
responseTimeoutNum = 0
|
||||
handler.removeMessages(1)
|
||||
}
|
||||
if(upgradeComplete){
|
||||
OTAUpgradeConfig.otaToken = ""
|
||||
if(OTAUpgradeConfig.isQuery){
|
||||
ToastUtils.showLong("暂无待升级任务!")
|
||||
OTAUpgradeConfig.isQuery = false
|
||||
}else{
|
||||
if(!OTAUpgradeConfig.upgradeFinish.contains(status.otaInfo.otaToken)){
|
||||
CallerHmiManager.showOTADownloadStatusDialog(true,otaUpgradeList)
|
||||
CallerHmiManager.showOTAResultDialog(upgradeResult)
|
||||
OTAUpgradeConfig.upgradeFinish.add(status.otaInfo.otaToken)
|
||||
}
|
||||
CallerHmiManager.showOTADownloadStatusDialog(false,otaUpgradeList)
|
||||
CallerHmiManager.showOTAResultDialog(upgradeResult)
|
||||
}
|
||||
CallerOTAManager.invokeOtaDownloadStatus(false)
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user