diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/bean/IPCUpgradeStateInfo.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/bean/IPCUpgradeStateInfo.java index fefefe15b9..4e82b55e0f 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/bean/IPCUpgradeStateInfo.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/bean/IPCUpgradeStateInfo.java @@ -6,6 +6,47 @@ import com.google.gson.annotations.SerializedName; * 工控机升级 */ public class IPCUpgradeStateInfo extends BaseInfo { + /** + * 升级模式 + */ + public enum UpgradeMode { + /** + * 0:静默升级 + * 3:提示升级 + */ + DATA_NULL(-1, "数据为NULL"), + QUIET(0, "静默升级"), + HINT(3, "提示升级"); + public final int code; + public final String describe; + + private UpgradeMode(int code, String describe) { + this.code = code; + this.describe = describe; + } + + public static UpgradeMode getStatus(int code) { + switch (code) { + default: + case -1: + return DATA_NULL; + case 0: + return QUIET; + case 3: + return HINT; + + } + } + + @Override + public String toString() { + return "{" + + "code=" + code + + ", describe='" + describe + '\'' + + '}'; + } + } + /** * 下载状态 */ @@ -15,6 +56,7 @@ public class IPCUpgradeStateInfo extends BaseInfo { * 31:下载完成 * 32:下载失败 */ + DATA_NULL(-1, "数据为NULL"), START(30, "开始下载"), FINISH(31, "下载完成"), FAILED(32, "下载失败"); @@ -29,6 +71,8 @@ public class IPCUpgradeStateInfo extends BaseInfo { public static DownloadStatus getStatus(int code) { switch (code) { default: + case -1: + return DATA_NULL; case 30: return START; case 31: @@ -37,6 +81,14 @@ public class IPCUpgradeStateInfo extends BaseInfo { return FAILED; } } + + @Override + public String toString() { + return "{" + + "code=" + code + + ", describe='" + describe + '\'' + + '}'; + } } /** @@ -50,6 +102,7 @@ public class IPCUpgradeStateInfo extends BaseInfo { * 63:用户确认 * 64:用户取消 */ + DATA_NULL(-1, "数据为NULL"), AFFIRM(60, "是否升级"), SUCCEED(61, "升级成功"), FAILED(62, "升级失败"), @@ -66,6 +119,8 @@ public class IPCUpgradeStateInfo extends BaseInfo { public static UpgradeStatus getStatus(int code) { switch (code) { default: + case -1: + return DATA_NULL; case 60: return AFFIRM; case 61: @@ -78,6 +133,14 @@ public class IPCUpgradeStateInfo extends BaseInfo { return USER_CANCEL; } } + + @Override + public String toString() { + return "{" + + "code=" + code + + ", describe='" + describe + '\'' + + '}'; + } } public IPCUpgradeStateInfo(String action) { @@ -114,6 +177,16 @@ public class IPCUpgradeStateInfo extends BaseInfo { return this.values.upgradeStatus; } + /** + * 获取升级模式 + * + * @return + */ + public int getUpgradeMode() { + if (this.values == null) return -1;//数据或解析异常 + return this.values.upgradeMode; + } + /** * 获取版本号 * @@ -125,17 +198,22 @@ public class IPCUpgradeStateInfo extends BaseInfo { } public static class Values { + /** + * int 类型, 升级模式 静默升级不需要前端通知,工控机会自动升级 + */ + @SerializedName("upgrade_mode") + private int upgradeMode = -1; private Progress progress; /** * int 类型, 下载状态, 如果下载完成,下载进度会为空 */ @SerializedName("download_status") - private int downloadStatus; + private int downloadStatus = -1; /** * int 类型, 升级状态 */ @SerializedName("upgrade_status") - private int upgradeStatus; + private int upgradeStatus = -1; /** * string 类型,版本号 */ @@ -175,6 +253,9 @@ public class IPCUpgradeStateInfo extends BaseInfo { } /** + * upgrade_mode: + * 0-静默升级 + * 1-提示升级 * download_status: * 30:开始下载 * 31:下载完成 @@ -185,16 +266,17 @@ public class IPCUpgradeStateInfo extends BaseInfo { * 62:升级失败 * 63:用户确认 * 64:用户取消 - * { - * "action": "ipc_upgrade_status", - * "values": { - * "progress": { - * "total": 307405010, //int 类型 ,包总大小,字节 - * "current": 1071793 //int 类型 ,包已经下载大小,字节 - * }, - * "download_status": 31, //int 类型, 下载状态, 如果下载完成,下载进度会为空 - * "upgrade_status": 61, //int 类型, 升级状态 - * "images": "mogohub.tencentcloudcr.com/autocar/df:RoboTaxi_MAP-taxi_2.1.3.1_20211214_huzhengming" //string 类型,版本号* } - *

- * } + * *{ + * * "action": "ipc_upgrade_status", + * * "values": { + * * "progress": { + * * "total": 307405010, //int 类型 ,包总大小,字节 + * * "current": 1071793 //int 类型 ,包已经下载大小,字节 + * * }, + * * "download_status": 31, //int 类型, 下载状态, 如果下载完成,下载进度会为空 + * * "upgrade_status": 61, //int 类型, 升级状态 + * * "upgrade_mode": 1, //int 类型, 升级模式 + * * "images": "mogohub.tencentcloudcr.com/autocar/df:RoboTaxi_MAP-taxi_2.1.3.1_20211214_huzhengming"* } //string 类型,版本号 + * * + * * } */ diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/WsAutopilotUpgradeStatusMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/WsAutopilotUpgradeStatusMessage.java index c4dc8565eb..501077e959 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/WsAutopilotUpgradeStatusMessage.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/WsAutopilotUpgradeStatusMessage.java @@ -3,6 +3,7 @@ package com.zhidao.support.adas.high.msg; import com.google.gson.Gson; import com.zhidao.support.adas.high.OnAdasListener; import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo; +import com.zhidao.support.adas.high.common.CupidLogUtils; /** * @des 工控机升级状态 @@ -12,6 +13,7 @@ public class WsAutopilotUpgradeStatusMessage extends MyAbstractMessageHandler { @Override public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) { + CupidLogUtils.i("工控机升级", "msg=" + msg); IPCUpgradeStateInfo autopilotStatus = gson.fromJson(msg, IPCUpgradeStateInfo.class); if (adasListener != null) { adasListener.onUpgradeStateInfo(autopilotStatus);