[8.2.0]OTA升级查询

This commit is contained in:
xuxinchao
2025-08-06 17:17:11 +08:00
parent a5fbd94d11
commit 0ad3339b04
5 changed files with 49 additions and 202 deletions

View File

@@ -48,6 +48,9 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
private var versionTwoTimeoutNum: Int = 0 //OTA2.0版本响应超时次数
private var shouldToast: Boolean = false //OTA1.0升级是否需要提示没有升级任务
private var secondVersionShouldToast: Boolean = true //OTA2.0升级是否需要提示没有任务升级
private val handler =object : Handler(Looper.getMainLooper()){
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
@@ -80,7 +83,7 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
val query = JSONObject()
query.put("cmd","PAD_QUERY_UPGRADE_STATUS")
query.put("token",OTAUpgradeConfig.token)
Log.i("xuxinchao",query.toString())
Log.i(TAG,query.toString())
CallerAutoPilotControlManager.sendOtaPadMsgQuery(query.toString())
this.sendEmptyMessageDelayed(3,30000)
}else{
@@ -88,6 +91,10 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
CallerHmiManager.showOTADownloadStatusDialog(false, emptyList())
CallerHmiManager.showOTAResultDialog(isShow = true, result = false)
}
}else if(msg.what == 4){
if(shouldToast && secondVersionShouldToast){
ToastUtils.showLong("暂无待升级任务!")
}
}
}
}
@@ -279,7 +286,8 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
//解析JSON
if(status.otaInfo.productName.isEmpty()){
if(OTAUpgradeConfig.isQuery){
ToastUtils.showLong("暂无待升级任务!")
// ToastUtils.showLong("暂无待升级任务!")
shouldToast = true
OTAUpgradeConfig.isQuery = false
}else{
//没有升级任务,取消查询,关掉弹窗
@@ -481,6 +489,7 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
//请求升级
if(cmd == "ASK_PAD_UPGRADE" && otaStatus == "init"){
secondVersionShouldToast = false //收到请求升级,故不需要进行提示
//冷启动已完成(包括成功/失败),且驾驶状态为非自驾状态,且当前无订单进行强提示,否则为弱提示
if(OTAUpgradeConfig.coldStartCompleted && !OTAUpgradeConfig.autopilotStatus
&& !OTAUpgradeConfig.inOrder){
@@ -503,7 +512,7 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
query.put("token",OTAUpgradeConfig.token)
query.put("allow_upgrade",false)
query.put("reason",reason)
Log.i("xuxinchao",query.toString())
Log.i(TAG,query.toString())
CallerAutoPilotControlManager.sendOtaPadMsgQuery(query.toString())
ToastUtils.showLong("收到车辆部署任务,请在车辆空闲时发起升级")
@@ -540,6 +549,13 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
}
override fun sendOtaPadMsgQuery() {
super.sendOtaPadMsgQuery()
shouldToast = false
secondVersionShouldToast = true
handler.sendEmptyMessageDelayed(4,3000)
}
private val pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+")