feat:【IoT 物联网】实现 OTA 升级推送任务 IotOtaUpgradeJob
This commit is contained in:
@@ -42,6 +42,10 @@ public enum IotDeviceMessageMethodEnum implements ArrayValuable<String> {
|
||||
|
||||
CONFIG_PUSH("thing.config.push", "配置推送", true),
|
||||
|
||||
// ========== OTA 固件 ==========
|
||||
|
||||
OTA_UPGRADE("thing.ota.upgrade", "OTA 推送固定信息", false),
|
||||
OTA_PROGRESS("thing.ota.progress", "OTA 上报升级进度", true),
|
||||
;
|
||||
|
||||
public static final String[] ARRAYS = Arrays.stream(values()).map(IotDeviceMessageMethodEnum::getMethod)
|
||||
|
||||
@@ -39,4 +39,8 @@ public enum IotDeviceStateEnum implements ArrayValuable<Integer> {
|
||||
return ONLINE.getState().equals(state);
|
||||
}
|
||||
|
||||
public static boolean isNotOnline(Integer state) {
|
||||
return !isOnline(state);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -140,4 +140,12 @@ public class IotDeviceMessage {
|
||||
MapUtil.of("state", IotDeviceStateEnum.OFFLINE.getState()));
|
||||
}
|
||||
|
||||
public static IotDeviceMessage buildOtaUpgrade(String version, String fileUrl, Long fileSize,
|
||||
String fileDigestAlgorithm, String fileDigestValue) {
|
||||
return requestOf(IotDeviceMessageMethodEnum.OTA_UPGRADE.getMethod(), MapUtil.builder()
|
||||
.put("version", version).put("fileUrl", fileUrl).put("fileSize", fileSize)
|
||||
.put("fileDigestAlgorithm", fileDigestAlgorithm).put("fileDigestValue", fileDigestValue)
|
||||
.build());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user