工控机升级
联调修复Bug
This commit is contained in:
@@ -13,7 +13,6 @@ import com.mogo.eagle.core.function.call.bindingcar.CallerBindingCarListenerMana
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.ipcupgrade.network.IPCUpgradeNetWorkModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import org.json.JSONObject
|
||||
|
||||
/**
|
||||
@@ -112,7 +111,7 @@ class IPCUpgradeManager: IMogoOnMessageListener<IPCUpgradeStateInfo> ,
|
||||
fun upgradeConfirm(images: List<String>,padSn: String,releaseId: String){
|
||||
ipcUpgradeNetWorkModel.upgradeConfirm(images,padSn,releaseId,
|
||||
onSuccess = {
|
||||
|
||||
CallerBindingCarListenerManager.invokePushServerConfirm()
|
||||
},
|
||||
onError = {
|
||||
|
||||
@@ -131,9 +130,10 @@ class IPCUpgradeManager: IMogoOnMessageListener<IPCUpgradeStateInfo> ,
|
||||
val images = jsonObject.getJSONArray("images")
|
||||
val dockerList = ArrayList<String>()
|
||||
for(i in 0 until images.length()){
|
||||
if(!i.toString().contains(dockerVersion)){
|
||||
if(!images[i].toString().contains(dockerVersion)){
|
||||
dockerList.add(images[i].toString())
|
||||
}
|
||||
|
||||
}
|
||||
//将数组结果回调
|
||||
CallerBindingCarListenerManager.invokeQueryContainersResponse(dockerList)
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
|
||||
@@ -974,6 +975,20 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
ThreadUtils.runOnUiThread{
|
||||
if(adUpgradeDialog == null){
|
||||
adUpgradeDialog = AdUpgradeDialog(requireContext(),images, padSn, releaseId)
|
||||
adUpgradeDialog?.setClickListener(object: AdUpgradeDialog.ClickListener{
|
||||
override fun confirm() {
|
||||
//确认升级
|
||||
CallerBindingcarManager.getBindingcarProvider().upgradeConfirm(images, padSn, releaseId)
|
||||
adUpgradeDialog?.dismiss()
|
||||
adUpgradeDialog = null
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
adUpgradeDialog?.dismiss()
|
||||
adUpgradeDialog = null
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
adUpgradeDialog?.showUpgradeDialog()
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.hmi.ui.tools
|
||||
import android.content.Context
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog
|
||||
|
||||
@@ -21,7 +20,6 @@ class AdUpgradeDialog(context: Context,images: List<String>,padSn: String,releas
|
||||
private var clickListener: ClickListener? = null
|
||||
|
||||
private var images: List<String>?=null
|
||||
private var imageVersion: String?=null
|
||||
private var padSn: String?=null
|
||||
private var releaseId: String?=null
|
||||
|
||||
@@ -33,13 +31,9 @@ class AdUpgradeDialog(context: Context,images: List<String>,padSn: String,releas
|
||||
|
||||
upgradeConfirm?.setOnClickListener{
|
||||
clickListener?.confirm()
|
||||
//确认升级
|
||||
CallerBindingcarManager.getBindingcarProvider().upgradeConfirm(images, padSn, releaseId)
|
||||
dismiss()
|
||||
}
|
||||
upgradeCancel?.setOnClickListener {
|
||||
clickListener?.cancel()
|
||||
dismiss()
|
||||
}
|
||||
this.images = images
|
||||
this.padSn = padSn
|
||||
|
||||
@@ -58,8 +58,6 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
private fun initView() {
|
||||
showCurrentPadVersion()
|
||||
showCurrentAdVersion()
|
||||
|
||||
|
||||
//鹰眼版本视图点击事件
|
||||
ivPadVersion.setOnClickListener {
|
||||
CallerLogger.i("$M_HMI$$TAG", "pad version view clicked")
|
||||
@@ -85,13 +83,28 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
when {
|
||||
AdUpgradeStateHelper.isDownloading(it.status) -> {
|
||||
//下载中,点击Toast提示:下载剩余时间
|
||||
ToastUtils.showShort(
|
||||
"预计" + AdUpgradeStateHelper.getRemainingTime(
|
||||
it.progress.progressDetail.total,
|
||||
previousProgress,
|
||||
currentProgress
|
||||
) + "下载完成"
|
||||
)
|
||||
it.progress?.let { progress->
|
||||
progress.progressDetail?.let {progressDetail->
|
||||
if(AdUpgradeStateHelper.getRemainingTime(
|
||||
progressDetail.total,
|
||||
previousProgress,
|
||||
currentProgress
|
||||
).isEmpty()){
|
||||
ToastUtils.showShort("下载已完成")
|
||||
}else{
|
||||
ToastUtils.showShort(
|
||||
"预计" + AdUpgradeStateHelper.getRemainingTime(
|
||||
progressDetail.total,
|
||||
previousProgress,
|
||||
currentProgress
|
||||
) + "下载完成"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
AdUpgradeStateHelper.isUpgrading(it.status) -> {
|
||||
//工控机状态为“升级中”
|
||||
@@ -118,7 +131,11 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
*/
|
||||
private fun setAdUpgradeInfo(ipcUpgradeStateInfo: IPCUpgradeStateInfo) {
|
||||
this.previousProgress = this.currentProgress
|
||||
this.currentProgress = ipcUpgradeStateInfo.progress.progressDetail.current
|
||||
ipcUpgradeStateInfo.progress?.let {
|
||||
it.progressDetail?.let {progressDetail->
|
||||
this.currentProgress = progressDetail.current
|
||||
}
|
||||
}
|
||||
this.ipcUpgradeStateInfo = ipcUpgradeStateInfo
|
||||
}
|
||||
|
||||
@@ -140,12 +157,18 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
CallerLogger.i(
|
||||
"$M_HMI$$TAG", "showAdUpgradeStatus status=$status"
|
||||
)
|
||||
adCircularProgressView.setProgress(
|
||||
AdUpgradeStateHelper.downloadProgress(
|
||||
ipcUpgradeStateInfo.progress.progressDetail.current,
|
||||
ipcUpgradeStateInfo.progress.progressDetail.total
|
||||
)
|
||||
)
|
||||
ipcUpgradeStateInfo.progress?.let { progress->
|
||||
progress.progressDetail?.let {progressDetail->
|
||||
adCircularProgressView.setProgress(
|
||||
AdUpgradeStateHelper.downloadProgress(
|
||||
progressDetail.current,
|
||||
progressDetail.total
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background)
|
||||
}
|
||||
@@ -155,6 +178,19 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background)
|
||||
}
|
||||
AdUpgradeStateHelper.isDownloadFinish(status) ->{
|
||||
//升级中,将状态设为“升级中”角标,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_upgrading)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background)
|
||||
}
|
||||
AdUpgradeStateHelper.isUpgrading(status) ->{
|
||||
//升级中,将状态设为“升级中”角标,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_upgrading)
|
||||
adCircularProgressView?.visibility = View.GONE
|
||||
ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background)
|
||||
}
|
||||
|
||||
AdUpgradeStateHelper.isUpgrading(status) ->{
|
||||
//升级中,将状态设为“升级中”角标,并隐藏进度条
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_upgrading)
|
||||
@@ -250,6 +286,9 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
showCurrentAdVersion()
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工控机新版本回调
|
||||
*/
|
||||
override fun queryContainersResponse(dockerList: List<String>) {
|
||||
this.dockerList = dockerList
|
||||
if(dockerList.isNotEmpty()){
|
||||
@@ -267,4 +306,15 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认升级回调
|
||||
*/
|
||||
override fun pushServerConfirm() {
|
||||
//将角标改为“下载中”
|
||||
ivAdStatus?.setImageResource(R.drawable.icon_downloading)
|
||||
ivAdVersion?.setBackgroundResource(R.drawable.version_latest_background)
|
||||
//设置状态为不可升级
|
||||
AdUpgradeStateHelper.setUpgradeableStatus(false)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,8 @@ import androidx.annotation.Nullable
|
||||
data class IPCUpgradeStateInfo(
|
||||
val callback_url: String,
|
||||
val images: List<String>,
|
||||
val progress: Progress,
|
||||
@Nullable
|
||||
val progress: Progress?,
|
||||
@Nullable
|
||||
val releaseId: String?,
|
||||
val status: String,
|
||||
@@ -19,7 +20,8 @@ data class IPCUpgradeStateInfo(
|
||||
|
||||
data class Progress(
|
||||
val id: String,
|
||||
val progressDetail: ProgressDetail,
|
||||
@Nullable
|
||||
val progressDetail: ProgressDetail?,
|
||||
val status: String
|
||||
)
|
||||
|
||||
|
||||
@@ -9,4 +9,6 @@ interface IMoGoBindingCarListener {
|
||||
|
||||
fun queryContainersResponse(dockerList: List<String>)
|
||||
|
||||
fun pushServerConfirm()
|
||||
|
||||
}
|
||||
@@ -62,4 +62,11 @@ object CallerBindingCarListenerManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun invokePushServerConfirm(){
|
||||
BINDING_CAR_LISTENER.forEach{
|
||||
val listener = it.value
|
||||
listener.pushServerConfirm()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user