Merge branch 'dev_robotaxi-d_250620_8.1.0_new_ota' into dev_robotaxi-d_250804_8.2.0
# Conflicts: # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt
This commit is contained in:
@@ -28,4 +28,26 @@ object OTAUpgradeConfig {
|
||||
//已经提示过升级成功的列表
|
||||
@JvmField
|
||||
var upgradeFinish: ArrayList<String> = ArrayList()
|
||||
|
||||
//OTA2.0 Token
|
||||
@JvmField
|
||||
var token: String = ""
|
||||
|
||||
//已经提示过升级的列表
|
||||
var promptedUpgradeTwo: ArrayList<String> = ArrayList()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -46,6 +46,8 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
private var responseTimeoutNum: Int = 0 //响应超时次数
|
||||
private var shouldShowColdStartWindow: Boolean = false //是否需要展示冷启动页面
|
||||
|
||||
private var versionTwoTimeoutNum: Int = 0 //OTA2.0版本响应超时次数
|
||||
|
||||
private val handler =object : Handler(Looper.getMainLooper()){
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
@@ -68,6 +70,24 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
//司机屏弹窗提示用车人执行车辆下电操作
|
||||
CallerHmiManager.showOTAPowerOffFinishDialog()
|
||||
shouldShowColdStartWindow = true
|
||||
}else if(msg.what == 3){
|
||||
//OTA2.0超时查询
|
||||
if(versionTwoTimeoutNum<40){
|
||||
versionTwoTimeoutNum++
|
||||
//30秒没有收到OTA升级推送主动进行查询
|
||||
Log.i(TAG,"30秒没有收到OTA升级推送主动进行查询")
|
||||
//查询OTA升级
|
||||
val query = JSONObject()
|
||||
query.put("cmd","PAD_QUERY_UPGRADE_STATUS")
|
||||
query.put("token",OTAUpgradeConfig.token)
|
||||
Log.i("xuxinchao",query.toString())
|
||||
CallerAutoPilotControlManager.sendOtaPadMsgQuery(query.toString())
|
||||
this.sendEmptyMessageDelayed(3,30000)
|
||||
}else{
|
||||
Log.i(TAG,"20分钟没有收到OTA升级推送置为失败")
|
||||
CallerHmiManager.showOTADownloadStatusDialog(false, emptyList())
|
||||
CallerHmiManager.showOTAResultDialog(isShow = true, result = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,6 +414,133 @@ 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")
|
||||
|
||||
//无升级任务
|
||||
if("ASK_PAD_NO_UPGRADE" == cmd){
|
||||
ToastUtils.showShort("暂无OTA升级任务")
|
||||
return
|
||||
}
|
||||
|
||||
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")
|
||||
|
||||
OTAUpgradeConfig.token = otaToken
|
||||
|
||||
val products = jsonObject.optString("products")
|
||||
val productsArray = JSONArray(products)
|
||||
val otaUpgradeList = ArrayList<OtaUpgradeInfo>()
|
||||
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.optDouble("cur_size")
|
||||
val totalSize = productInfo.optDouble("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")
|
||||
|
||||
val otaUpgradeInfo = OtaUpgradeInfo(otaToken, getProjectStatus(productStatus),failReason,upgradeReason,
|
||||
0,0,1,name,true,isDelay,curSize,totalSize,leftTime)
|
||||
otaUpgradeList.add(otaUpgradeInfo)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//请求升级
|
||||
if(cmd == "ASK_PAD_UPGRADE" && otaStatus == "init"){
|
||||
//冷启动已完成(包括成功/失败),且驾驶状态为非自驾状态,且当前无订单进行强提示,否则为弱提示
|
||||
if(OTAUpgradeConfig.coldStartCompleted && !OTAUpgradeConfig.autopilotStatus
|
||||
&& !OTAUpgradeConfig.inOrder){
|
||||
//触发强提示升级
|
||||
CallerHmiManager.showOTAUpgradeDialog(true,upgradeReason)
|
||||
}else{
|
||||
//触发弱提示升级
|
||||
//冷启动未完成(进行中),或驾驶状态为自驾状态,或当前有订单,直接默认选择稍后升级,
|
||||
// 并toast提示“收到车辆部署任务,请在车辆空闲时发起升级”
|
||||
|
||||
val reason = if(OTAUpgradeConfig.autopilotStatus){
|
||||
"处于自驾中"
|
||||
}else if(OTAUpgradeConfig.inOrder){
|
||||
"处于订单中"
|
||||
}else{
|
||||
"冷启动未完成"
|
||||
}
|
||||
val query = JSONObject()
|
||||
query.put("cmd","ASK_PAD_UPGRADE_RES")
|
||||
query.put("token",OTAUpgradeConfig.token)
|
||||
query.put("allow_upgrade",false)
|
||||
query.put("reason",reason)
|
||||
Log.i("xuxinchao",query.toString())
|
||||
CallerAutoPilotControlManager.sendOtaPadMsgQuery(query.toString())
|
||||
|
||||
ToastUtils.showLong("收到车辆部署任务,请在车辆空闲时发起升级")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//升级中
|
||||
if(cmd == "PAD_UPGRADE_REPORT"){
|
||||
CallerHmiManager.showOTADownloadStatusDialog(true,otaUpgradeList)
|
||||
versionTwoTimeoutNum = 0
|
||||
handler.removeMessages(3)
|
||||
handler.sendEmptyMessageDelayed(3,30000)
|
||||
}
|
||||
//升级完成
|
||||
if(otaStatus == "fail"){
|
||||
CallerHmiManager.showOTADownloadStatusDialog(false,emptyList())
|
||||
CallerHmiManager.showOTAResultDialog(isShow = true, result = false)
|
||||
versionTwoTimeoutNum = 0
|
||||
handler.removeMessages(3)
|
||||
CallerOTAManager.invokeOtaDownloadStatus(false)
|
||||
}
|
||||
if(otaStatus == "success"){
|
||||
//升级成功,自动执行优雅停服
|
||||
CallerAutoPilotControlManager.sendIpcPowerOff()
|
||||
//当优雅停服完成、需要车辆下电的时候(比如当前是停服触发60s后),车端告知鹰眼,司机屏弹窗提示用车人执行车辆下电操作
|
||||
handler.sendEmptyMessageDelayed(2,60000)
|
||||
CallerOTAManager.invokeOtaDownloadStatus(false)
|
||||
CallerHmiManager.showOTADownloadStatusDialog(false,emptyList())
|
||||
CallerHmiManager.showOTAResultDialog(isShow = true, result = true)
|
||||
versionTwoTimeoutNum = 0
|
||||
handler.removeMessages(3)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private val pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+")
|
||||
|
||||
/**
|
||||
@@ -438,5 +585,32 @@ object OTAUpgradeManager: IMoGoAutopilotStatusListener, IDataCenterBizListener,
|
||||
return version
|
||||
}
|
||||
|
||||
private fun getProjectStatus(status: String): Int{
|
||||
return when(status){
|
||||
"init"->{
|
||||
0
|
||||
}
|
||||
"downloading"->{
|
||||
1
|
||||
}
|
||||
"sync_slave"->{
|
||||
2
|
||||
}
|
||||
"upgrading"->{
|
||||
2
|
||||
}
|
||||
"success"->{
|
||||
3
|
||||
}
|
||||
"fail"->{
|
||||
4
|
||||
}
|
||||
else->{
|
||||
0
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user