Merge branch 'dev_robotaxi-d-app-module_251_220125_2.5.1' into dev_MogoAP_eagle-220_211207_8.0.17_merge

This commit is contained in:
donghongyu
2022-02-14 11:51:43 +08:00
5 changed files with 95 additions and 57 deletions

View File

@@ -1,5 +1,8 @@
package com.mogo.eagle.core.data.autopilot
import android.util.Log
import java.util.logging.Logger
/**
* @author XuXinChao
* @description 工控机升级状态实体类
@@ -30,7 +33,7 @@ class AdUpgradeStateHelper {
* @param upgradeStatus 升级状态
*/
fun showUpgradeTips(downloadStatus: Int,upgradeStatus: Int) : Boolean{
return isDownloading(downloadStatus) || isDownloadFinish(downloadStatus) || isUpgradeFailed(upgradeStatus)
return isDownloading(downloadStatus) || isDownloadFinish(downloadStatus,upgradeStatus) || getUpgradeStatus() || isUpgradeFailed(upgradeStatus)
}
/**
@@ -44,9 +47,10 @@ class AdUpgradeStateHelper {
/**
* 工控机是否处于“下载完成”(可升级)状态
* @param downloadStatus 下载状态
* @param upgradeStatus 升级状态
*/
fun isDownloadFinish(downloadStatus: Int) : Boolean{
return downloadStatus == DOWNLOAD_FINISH
fun isDownloadFinish(downloadStatus: Int,upgradeStatus: Int) : Boolean{
return downloadStatus == DOWNLOAD_FINISH && upgradeStatus == USER_AFFIRM
}
/**
@@ -79,7 +83,7 @@ class AdUpgradeStateHelper {
* @param totalProgress 包体总大小
*/
fun downloadProgress(currentProgress: Int,totalProgress: Int) : Int{
return currentProgress*100/totalProgress
return (currentProgress.toDouble()/totalProgress.toDouble()*100).toInt()
}
/**