From c8b3e87ccdc42f766c01f958b59f07d3fad19f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=A1=E8=B4=A4=E7=A5=A5?= Date: Mon, 6 Sep 2021 18:32:01 +0800 Subject: [PATCH 1/3] shi9.6 --- .idea/codeStyles/Project.xml | 52 +++ .idea/encodings.xml | 2 +- .idea/inspectionProfiles/Project_Default.xml | 37 ++ .../java/me/hekr/iotos/api/IotClient.java | 290 ++++++++++++++- .../hekr/iotos/api/dto/CloudSendMsgDTO.java | 20 + .../hekr/iotos/api/dto/DataValueChecker.java | 48 +++ .../iotos/api/dto/DataValueEnumChecker.java | 107 ++++++ .../iotos/api/dto/DataValueLengthChecker.java | 78 ++++ .../iotos/api/dto/DataValueNoneChecker.java | 42 +++ .../iotos/api/dto/DataValueRangeChecker.java | 56 +++ .../me/hekr/iotos/api/dto/DelTopoResp.java | 50 +++ .../me/hekr/iotos/api/dto/DeviceApiDTO.java | 113 ++++++ .../java/me/hekr/iotos/api/dto/DeviceDTO.java | 349 ++++++++++++++++++ .../hekr/iotos/api/dto/DeviceStatusRes.java | 14 + .../java/me/hekr/iotos/api/dto/IpInfo.java | 93 +++++ .../me/hekr/iotos/api/dto/ModelCmdDTO.java | 77 ++++ .../me/hekr/iotos/api/dto/ModelParamDTO.java | 97 +++++ .../hekr/iotos/api/dto/ModelParamValue.java | 48 +++ .../hekr/iotos/api/dto/ModelProtocolDTO.java | 69 ++++ .../java/me/hekr/iotos/api/dto/Snapshot.java | 127 +++++++ src/main/java/me/hekr/iotos/api/dto/Tag.java | 44 +++ .../me/hekr/iotos/api/dto/klink/AddTopo.java | 37 ++ .../hekr/iotos/api/dto/klink/AddTopoResp.java | 48 +++ .../iotos/api/dto/klink/BatchDevSend.java | 38 ++ .../hekr/iotos/api/dto/klink/CloudSend.java | 38 ++ .../me/hekr/iotos/api/dto/klink/DelTopo.java | 38 ++ .../java/me/hekr/iotos/api/dto/klink/Dev.java | 33 ++ .../me/hekr/iotos/api/dto/klink/DevLogin.java | 55 +++ .../hekr/iotos/api/dto/klink/DevLogout.java | 71 ++++ .../me/hekr/iotos/api/dto/klink/DevSend.java | 38 ++ .../hekr/iotos/api/dto/klink/DevUpgrade.java | 150 ++++++++ .../api/dto/klink/DevUpgradeProgress.java | 90 +++++ .../hekr/iotos/api/dto/klink/GetConfig.java | 30 ++ .../iotos/api/dto/klink/GetConfigResp.java | 105 ++++++ .../me/hekr/iotos/api/dto/klink/GetTopo.java | 28 ++ .../me/hekr/iotos/api/dto/klink/Klink.java | 54 +++ .../me/hekr/iotos/api/dto/klink/KlinkDev.java | 37 ++ .../hekr/iotos/api/dto/klink/KlinkResp.java | 104 ++++++ .../hekr/iotos/api/dto/klink/ModelData.java | 85 +++++ .../hekr/iotos/api/dto/klink/NotSupport.java | 27 ++ .../me/hekr/iotos/api/dto/klink/Register.java | 214 +++++++++++ .../iotos/api/dto/klink/RegisterResp.java | 85 +++++ .../iotos/api/dto/klink/ReportFirmware.java | 47 +++ .../hekr/iotos/api/dto/klink/SuModelData.java | 38 ++ .../me/hekr/iotos/api/dto/klink/TopoSub.java | 67 ++++ .../java/me/hekr/iotos/api/enums/Action.java | 141 +++++++ .../me/hekr/iotos/api/enums/CheckType.java | 18 + .../me/hekr/iotos/api/enums/DataType.java | 122 ++++++ .../me/hekr/iotos/api/enums/DeviceType.java | 20 + .../me/hekr/iotos/api/enums/ErrorCode.java | 92 +++++ .../me/hekr/iotos/api/enums/FrameType.java | 34 ++ .../iotos/api/enums/MessageSourceType.java | 16 + .../iotos/api/service/RetrofitIotService.java | 177 ++++++++- .../java/me/hekr/iotos/api/util/JsonUtil.java | 107 ++++++ 54 files changed, 4084 insertions(+), 13 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 src/main/java/me/hekr/iotos/api/dto/CloudSendMsgDTO.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/DataValueChecker.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/DataValueEnumChecker.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/DataValueLengthChecker.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/DataValueNoneChecker.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/DataValueRangeChecker.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/DelTopoResp.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/DeviceApiDTO.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/DeviceDTO.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/DeviceStatusRes.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/IpInfo.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/ModelCmdDTO.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/ModelParamDTO.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/ModelParamValue.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/ModelProtocolDTO.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/Snapshot.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/Tag.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/AddTopo.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/AddTopoResp.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/BatchDevSend.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/CloudSend.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/DelTopo.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/Dev.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/DevLogin.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/DevLogout.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/DevSend.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/DevUpgrade.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/DevUpgradeProgress.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/GetConfig.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/GetConfigResp.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/GetTopo.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/Klink.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/KlinkDev.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/KlinkResp.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/ModelData.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/NotSupport.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/Register.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/RegisterResp.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/ReportFirmware.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/SuModelData.java create mode 100644 src/main/java/me/hekr/iotos/api/dto/klink/TopoSub.java create mode 100644 src/main/java/me/hekr/iotos/api/enums/Action.java create mode 100644 src/main/java/me/hekr/iotos/api/enums/CheckType.java create mode 100644 src/main/java/me/hekr/iotos/api/enums/DataType.java create mode 100644 src/main/java/me/hekr/iotos/api/enums/DeviceType.java create mode 100644 src/main/java/me/hekr/iotos/api/enums/ErrorCode.java create mode 100644 src/main/java/me/hekr/iotos/api/enums/FrameType.java create mode 100644 src/main/java/me/hekr/iotos/api/enums/MessageSourceType.java create mode 100644 src/main/java/me/hekr/iotos/api/util/JsonUtil.java diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..49f7b87 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml index aa00ffa..fade66b 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -1,7 +1,7 @@ + - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..387ba8b --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,37 @@ + + + + \ No newline at end of file diff --git a/src/main/java/me/hekr/iotos/api/IotClient.java b/src/main/java/me/hekr/iotos/api/IotClient.java index 04c7b7d..0b1fa2f 100644 --- a/src/main/java/me/hekr/iotos/api/IotClient.java +++ b/src/main/java/me/hekr/iotos/api/IotClient.java @@ -2,23 +2,49 @@ package me.hekr.iotos.api; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import iot.cloud.os.common.utils.JsonUtil; -import iot.cloud.os.core.api.dto.ModelProtocolDTO; -import iot.cloud.os.core.api.enums.ErrorCode; +//import iot.cloud.os.common.utils.JsonUtil; +//import iot.cloud.os.core.api.dto.DeviceDTO; +//import iot.cloud.os.core.api.dto.ModelProtocolDTO; +//import iot.cloud.os.core.api.dto.Snapshot; +//import iot.cloud.os.core.api.dto.klink.AddTopoResp; +//import iot.cloud.os.core.api.dto.klink.DelTopoResp; +//import iot.cloud.os.core.api.dto.klink.KlinkResp; +//import iot.cloud.os.core.api.dto.klink.ModelData; +//import iot.cloud.os.core.api.dto.klink.TopoSub; +//import iot.cloud.os.core.api.enums.DeviceType; +//import iot.cloud.os.core.api.enums.ErrorCode; import java.net.URLEncoder; import java.util.List; +import java.util.Map; import java.util.concurrent.TimeUnit; import javax.crypto.Mac; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import lombok.Data; import lombok.SneakyThrows; +import me.hekr.iotos.api.dto.BatchAddDeviceResp; +import me.hekr.iotos.api.dto.CloudSendMsgDTO; +import me.hekr.iotos.api.dto.DelTopoResp; +import me.hekr.iotos.api.dto.DevIdListReq; import me.hekr.iotos.api.dto.Device; import me.hekr.iotos.api.dto.DeviceAddReq; +import me.hekr.iotos.api.dto.DeviceApiDTO; +import me.hekr.iotos.api.dto.DeviceDTO; +import me.hekr.iotos.api.dto.DevicePacketResp; +import me.hekr.iotos.api.dto.DeviceUpdateNameReq; import me.hekr.iotos.api.dto.LoginRsp; +import me.hekr.iotos.api.dto.ModelProtocolDTO; import me.hekr.iotos.api.dto.Product; +import me.hekr.iotos.api.dto.Snapshot; +import me.hekr.iotos.api.dto.klink.AddTopoResp; +import me.hekr.iotos.api.dto.klink.KlinkResp; +import me.hekr.iotos.api.dto.klink.ModelData; +import me.hekr.iotos.api.dto.klink.TopoSub; +import me.hekr.iotos.api.enums.DeviceType; +import me.hekr.iotos.api.enums.ErrorCode; import me.hekr.iotos.api.exception.IotException; import me.hekr.iotos.api.service.RetrofitIotService; +import me.hekr.iotos.api.util.JsonUtil; import me.hekr.iotos.api.util.Pagec; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -224,6 +250,264 @@ public class IotClient { return execute(retrofitIotService.getLoginToken()); } + /** + * \ + * @param page + * @param size + * @return + */ + Call> getProduct(int page, int size) { + return retrofitIotService.getProduct(page, size); + } + + /** + * + * @param pk + * @param devId + * @return + */ + Call addTopo(String pk, String devId) { + return retrofitIotService.addTopo(pk, devId); + } + + /** + * + * @param req + * @return + */ + Call addTopo(DevIdListReq req) { + return retrofitIotService.addTopo(req); + } + + /** + * + * @param pk + * @param batchName + * @return + */ + Call> getBatchDevices(String pk, String batchName) { + return retrofitIotService.getBatchDevices(pk, batchName); + } + + Call> getDeviceList(Map params) { + return retrofitIotService.getDeviceList(params); + } + + /** + * + * @param req + * @return + */ + Call getDeviceList(DeviceUpdateNameReq req) { + return retrofitIotService.getDeviceList(req); + } + + /** + * + * @param req + * @return + */ + Call getDeviceStatus(DevIdListReq req) { + return retrofitIotService.getDeviceStatus(req); + } + + /** + * + * @param pk + * @param devId + * @return + */ + Call getDeviceStatus(String pk, String devId) { + return retrofitIotService.getDeviceStatus(pk, devId); + } + + /** + * + * @param pk + * @param devId + * @return + */ + Call getDeviceHistoryData(String pk, String devId) { + return retrofitIotService.getDeviceHistoryData(pk, devId); + } + + /** + * + * @param pk + * @param devId + * @return + */ + Call getSnapshot(String pk, String devId) { + return retrofitIotService.getSnapshot(pk, devId); + } + + /** + * + * @param reqDto + * @return + */ + DeviceApiDTO addDevice(DeviceAddReq reqDto) { + return retrofitIotService.addDevice(reqDto); + } + + /** + * + * @param devIdListReq + * @return + */ + Map batchAddDevices(DevIdListReq devIdListReq) { + return retrofitIotService.batchAddDevices(devIdListReq); + } + + /** + * + * @param pk + * @param keyword + * @param page + * @param deviceType + * @param online + * @param size + * @return + */ + public Pagec getDeviceList( + String pk, String keyword, int page, DeviceType deviceType, Boolean online, int size) { + return retrofitIotService.getDeviceList(pk, keyword, page, deviceType, online, size); + } + + /** + * + * @param reqDto + */ + public void updateName(DeviceAddReq reqDto) { + retrofitIotService.updateName(reqDto); + } + + /** + * + * @param reqDto + */ + public void updateTags(DeviceAddReq reqDto) { + retrofitIotService.updateTags(reqDto); + } + + /** + * + * @param pk + * @param devId + * @return + */ + public DeviceApiDTO deviceInfo(String pk, String devId) { + return retrofitIotService.deviceInfo(pk, devId); + } + + /** + * + * @param pk + * @param devId + * @return + */ + public Snapshot getDeviceSnapshot(String pk, String devId) { + return retrofitIotService.getDeviceSnapshot(pk, devId); + } + + /** + * + * @param pk + * @param devId + * @param delSnapshot + */ + public void delDevice(String pk, String devId, boolean delSnapshot) { + retrofitIotService.delDevice(pk, devId, delSnapshot); + } + + /** + * + * @param deviceList + */ + public void bathDelDevice(List deviceList) { + retrofitIotService.bathDelDevice(deviceList); + } + + /** + * + * @param pk + * @param devId + * @param startTime + * @param endTime + * @param action + * @param page + * @param size + * @return + */ + public List getDeviceHistoryData( + String pk, String devId, Long startTime, Long endTime, String action, int page, int size) { + return retrofitIotService.getDeviceHistoryData( + pk, devId, startTime, endTime, action, page, size); + } + + /** + * + * @param pk + * @param devId + * @param data + * @return + */ + public KlinkResp deviceCloudSend(String pk, String devId, ModelData data) { + return retrofitIotService.deviceCloudSend(pk, devId, data); + } + + /** + * + * @param messageId + * @return + */ + public CloudSendMsgDTO cloudSendMsgInfo(String messageId) { + return retrofitIotService.cloudSendMsgInfo(messageId); + } + + /** + * + * @param page + * @param size + * @param pk + * @param devId + * @param startTime + * @param endTime + * @return + */ + public Pagec cloudSendMsgList( + Integer page, Integer size, String pk, String devId, Long startTime, Long endTime) { + return retrofitIotService.cloudSendMsgList(page, size, pk, devId, startTime, endTime); + } + + /** + * + * @param pk + * @param devId + * @param sub + * @return + */ + public AddTopoResp addTopo(String pk,String devId, TopoSub sub){ + return retrofitIotService.addTopo(pk, devId,sub); + } + + /** + * + * @param pk + * @param devId + * @param sub + * @return + */ + public DelTopoResp delTopo(String pk,String devId,TopoSub sub){ + return retrofitIotService.delTopo(pk, devId, sub); + } + + + + + + + @Data public static class Builder { private String host; diff --git a/src/main/java/me/hekr/iotos/api/dto/CloudSendMsgDTO.java b/src/main/java/me/hekr/iotos/api/dto/CloudSendMsgDTO.java new file mode 100644 index 0000000..6202ed1 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/CloudSendMsgDTO.java @@ -0,0 +1,20 @@ +package me.hekr.iotos.api.dto; + +import lombok.Data; + +import java.util.Date; + +/** + * @author :jiatao + * @date :2019-12-12 + */ +@Data +public class CloudSendMsgDTO { + private String messageId; + /*错误码*/ + private int code; + /*描述*/ + private String desc; + /*消息创建时间*/ + private Date createTime; +} diff --git a/src/main/java/me/hekr/iotos/api/dto/DataValueChecker.java b/src/main/java/me/hekr/iotos/api/dto/DataValueChecker.java new file mode 100644 index 0000000..80ff06e --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/DataValueChecker.java @@ -0,0 +1,48 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonSubTypes.Type; +import com.fasterxml.jackson.annotation.JsonTypeInfo.As; +import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; +//import iot.cloud.os.core.api.dto.DataValueEnumChecker; +//import iot.cloud.os.core.api.dto.DataValueLengthChecker; +//import iot.cloud.os.core.api.dto.DataValueNoneChecker; +//import iot.cloud.os.core.api.dto.DataValueRangeChecker; +import me.hekr.iotos.api.enums.CheckType; +import me.hekr.iotos.api.enums.DataType; +//import iot.cloud.os.core.api.enums.CheckType; +//import iot.cloud.os.core.api.enums.DataType; + +@JsonTypeInfo( + use = Id.NAME, + include = As.EXISTING_PROPERTY, + property = "type" +) +@JsonSubTypes({@Type( + value = DataValueNoneChecker.class, + name = "NONE" +), @Type( + value = DataValueEnumChecker.class, + name = "ENUM" +), @Type( + value = DataValueRangeChecker.class, + name = "RANGE" +), @Type( + value = DataValueLengthChecker.class, + name = "LENGTH" +)}) +public interface DataValueChecker { + boolean isValid(DataType var1, Object var2); + + CheckType getType(); + + boolean canConvertTo(DataType var1); + + boolean valid(DataType var1); +} diff --git a/src/main/java/me/hekr/iotos/api/dto/DataValueEnumChecker.java b/src/main/java/me/hekr/iotos/api/dto/DataValueEnumChecker.java new file mode 100644 index 0000000..5d339bc --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/DataValueEnumChecker.java @@ -0,0 +1,107 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeName; +import iot.cloud.os.core.api.dto.DataValueChecker; +import iot.cloud.os.core.api.dto.ModelParamValue; +import iot.cloud.os.core.api.enums.CheckType; +import iot.cloud.os.core.api.enums.DataType; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; + +@JsonTypeName("ENUM") +public class DataValueEnumChecker implements DataValueChecker { + private List> values; + + @Override + @JsonIgnore + public boolean isValid(DataType dataType, Object value) { + DataType valueDataType = DataType.fromValue(value); + if (!DataType.isValid(dataType, value)) { + return false; + } else { + Iterator var4 = this.values.iterator(); + + ModelParamValue v; + do { + if (!var4.hasNext()) { + return false; + } + + v = (ModelParamValue)var4.next(); + } while(!valueDataType.isEq(v.getValue(), value)); + + return true; + } + } + + @Override + @JsonIgnore + public boolean canConvertTo(DataType dataType) { + List> result = new ArrayList(this.values.size()); + Iterator var3 = this.values.iterator(); + + while(var3.hasNext()) { + ModelParamValue o = (ModelParamValue)var3.next(); + + try { + Object v = dataType.convert(o.getValue()); + result.add(new ModelParamValue(v, o.getDesc())); + } catch (Exception var6) { + return false; + } + } + + this.values.clear(); + this.values.addAll(result); + return true; + } + + @Override + public boolean valid(DataType dataType) { + return this.values == null ? false : this.values.stream().allMatch((v) -> { + if (v != null && v.getValue() != null) { + if (dataType == DataType.FLOAT && DataType.fromValue(v.getValue()) == DataType.INT) { + return true; + } else { + return DataType.fromValue(v.getValue()) == dataType; + } + } else { + return false; + } + }); + } + + @Override + public CheckType getType() { + return CheckType.ENUM; + } + + @Override + public String toString() { + String str = this.values == null ? "[]" : "[" + (String)this.values.stream().map((m) -> { + return m.getValue() + ":" + m.getDesc(); + }).collect(Collectors.joining(", ")) + "]"; + return "enum check, enum values:" + str; + } + + public DataValueEnumChecker() { + } + + public List> getValues() { + return this.values; + } + + public void setValues(List> values) { + this.values = values; + } + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/DataValueLengthChecker.java b/src/main/java/me/hekr/iotos/api/dto/DataValueLengthChecker.java new file mode 100644 index 0000000..01bb3fd --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/DataValueLengthChecker.java @@ -0,0 +1,78 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import com.fasterxml.jackson.annotation.JsonTypeName; +import iot.cloud.os.core.api.dto.DataValueChecker; +import iot.cloud.os.core.api.dto.ModelParamValue; +import iot.cloud.os.core.api.enums.CheckType; +import iot.cloud.os.core.api.enums.DataType; + +@JsonTypeName("LENGTH") +public class DataValueLengthChecker implements DataValueChecker { + private ModelParamValue max; + private ModelParamValue min; + + @Override + public CheckType getType() { + return CheckType.LENGTH; + } + + @Override + public boolean isValid(DataType dataType, Object value) { + if (value == null) { + return false; + } else { + DataType datatype = DataType.fromValue(value); + boolean isTypeValid = datatype == DataType.STRING; + if (!isTypeValid) { + return false; + } else { + String val = (String)value; + return (long)val.length() >= (Long)this.min.getValue() && (long)val.length() <= (Long)this.max.getValue(); + } + } + } + + @Override + public boolean canConvertTo(DataType dataType) { + return true; + } + + @Override + public boolean valid(DataType dataType) { + return this.max != null && this.min != null && this.max.getValue() != null && this.min.getValue() != null; + } + + @Override + public String toString() { + return "length check, length range: [" + this.min.getValue() + ", " + this.max.getValue() + "]"; + } + + public DataValueLengthChecker() { + } + + public ModelParamValue getMax() { + return this.max; + } + + public ModelParamValue getMin() { + return this.min; + } + + public void setMax(ModelParamValue max) { + this.max = max; + } + + public void setMin(ModelParamValue min) { + this.min = min; + } + + + + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/DataValueNoneChecker.java b/src/main/java/me/hekr/iotos/api/dto/DataValueNoneChecker.java new file mode 100644 index 0000000..53eec00 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/DataValueNoneChecker.java @@ -0,0 +1,42 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import me.hekr.iotos.api.enums.CheckType; +import me.hekr.iotos.api.enums.DataType; + +@JsonTypeName("NONE") +public class DataValueNoneChecker implements DataValueChecker { + + @Override + @JsonIgnore + public boolean isValid(DataType dataType, Object value) { + return DataType.isValid(dataType, value); + } + + + @Override + @JsonIgnore + public boolean canConvertTo(DataType dataType) { + return true; + } + + + @Override + public boolean valid(DataType dataType) { + return true; + } + + @Override + public CheckType getType() { + return CheckType.NONE; + } + + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/DataValueRangeChecker.java b/src/main/java/me/hekr/iotos/api/dto/DataValueRangeChecker.java new file mode 100644 index 0000000..e1597fa --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/DataValueRangeChecker.java @@ -0,0 +1,56 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +//import iot.cloud.os.core.api.dto.DataValueChecker; +//import iot.cloud.os.core.api.dto.ModelParamValue; +import me.hekr.iotos.api.enums.CheckType; +import me.hekr.iotos.api.enums.DataType; + +//import iot.cloud.os.core.api.enums.CheckType; +//import iot.cloud.os.core.api.enums.DataType; + +@JsonTypeName("RANGE") +@JsonInclude(Include.NON_NULL) +public class DataValueRangeChecker implements DataValueChecker { + private ModelParamValue max; + private ModelParamValue min; + + @Override + public CheckType getType() { + return CheckType.RANGE; + } + + @Override + public boolean isValid(DataType dataType, Object value) { + if (!DataType.isValid(dataType, value)) { + return false; + } else { + DataType datatype = DataType.fromValue(value); + boolean isTypeValid = datatype == DataType.INT || datatype == DataType.FLOAT; + if (!isTypeValid) { + return false; + } else { + double dVal = ((Number)value).doubleValue(); + return dVal >= ((Number)this.min.getValue()).doubleValue() && dVal <= ((Number)this.max.getValue()).doubleValue(); + } + } + } + + @Override + public boolean canConvertTo(DataType dataType) { + return true; + } + + @Override + public boolean valid(DataType dataType) { + return this.max != null && this.min != null && this.max.getValue() != null && this.min.getValue() != null; + } + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/DelTopoResp.java b/src/main/java/me/hekr/iotos/api/dto/DelTopoResp.java new file mode 100644 index 0000000..7e5f4db --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/DelTopoResp.java @@ -0,0 +1,50 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.Dev; +//import iot.cloud.os.core.api.dto.klink.KlinkResp; +//import iot.cloud.os.core.api.enums.Action; +//import iot.cloud.os.core.api.enums.ErrorCode; + +import me.hekr.iotos.api.dto.klink.Dev; +import me.hekr.iotos.api.dto.klink.KlinkResp; +import me.hekr.iotos.api.enums.Action; +import me.hekr.iotos.api.enums.ErrorCode; + +public class DelTopoResp extends KlinkResp { + private Dev sub; + + public DelTopoResp(ErrorCode errorCode, String desc) { + super(errorCode, desc); + } + + public DelTopoResp(ErrorCode errorCode) { + super(errorCode); + } + + @Override + public String getAction() { + return Action.DEL_TOPO_RESP.getAction(); + } + + public Dev getSub() { + return this.sub; + } + + public void setSub(Dev sub) { + this.sub = sub; + } + + @Override + public String toString() { + return "DelTopoResp(super=" + super.toString() + ", sub=" + this.getSub() + ")"; + } + + public DelTopoResp() { + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/DeviceApiDTO.java b/src/main/java/me/hekr/iotos/api/dto/DeviceApiDTO.java new file mode 100644 index 0000000..edb1abf --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/DeviceApiDTO.java @@ -0,0 +1,113 @@ +package me.hekr.iotos.api.dto; + +import com.fasterxml.jackson.annotation.JsonInclude; +import iot.cloud.os.core.api.dto.IpInfo; +import iot.cloud.os.core.api.dto.Tag; +import iot.cloud.os.core.api.enums.DeviceType; +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; + + +public class DeviceApiDTO implements Serializable { + + private static final long serialVersionUID = 6148192738636573612L; + + /** 顶级节点设备的pk,不存在则没有顶级节点,自身为顶级节点 */ + @JsonInclude(JsonInclude.Include.NON_NULL) + protected String rootPk; + + @JsonInclude(JsonInclude.Include.NON_NULL) + protected String name; + /** + * 顶级节点设备的pk,不存在则没有顶级节点,自身为顶级节点 + * + *

parentPk 和 parentDevId 要么同时存在,要么同时不存在 + */ + @JsonInclude(JsonInclude.Include.NON_NULL) + protected String rootDevId; + + /** 父节点设备的pk,不存在则没有父节点 */ + @JsonInclude(JsonInclude.Include.NON_NULL) + protected String parentPk; + /** + * 父节点设备的devId,不存在则没有父节点; + * + *

parentPk 和 parentDevId 要么同时存在,要么同时不存在 + */ + @JsonInclude(JsonInclude.Include.NON_NULL) + protected String parentDevId; + /** 创建时间 */ + @CreatedDate + protected Date createdDate; + /** 更新时间 */ + @LastModifiedDate + protected Date updatedDate; + + /** 是否启用,false 禁用,否则启用 */ + protected Boolean enable; + + protected String pk; + protected String devId; + + /** 在线状态,如果是子设备,这个状态在数据库中并不随着父节点的状态发生变更,只有查询返回的时候动态设置 */ + protected boolean online; + + /** 设备密钥 */ + protected String devSecret; + + /** 最近一次登录时间 */ + protected Date loginTime; + + /** 最后一次登出时间 */ + protected Date logoutTime; + + /** 注册时间 */ + protected Date registerTime; + + /** 第一次登录时间,也算是上电激活时间 */ + protected Date firstLoginTime; + + protected DeviceType deviceType; + + protected IpInfo ipInfo; + + /** 模组固件版本 */ + protected String moduleVersion; + /** mcu固件版本 */ + protected String mcuVersion; + /** 远程配置版本 */ + protected String configVersion; + + /** 批次添加名字 */ + protected String batchName; + /** 设备 imei 如果有的话,全局唯一 */ + protected String imei; + + protected List tags; + + /** 产品品牌 */ + private String brand; + + /** 产品型号 */ + private String model; + + /** + * 设备是否被启用 + * + * @return true 启用,否则禁用 + */ + public boolean isEnable() { + return !Boolean.FALSE.equals(enable); + } + + public Boolean getEnable() { + return isEnable(); + } + + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/DeviceDTO.java b/src/main/java/me/hekr/iotos/api/dto/DeviceDTO.java new file mode 100644 index 0000000..2537e68 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/DeviceDTO.java @@ -0,0 +1,349 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +//import iot.cloud.os.core.api.dto.IpInfo; +//import iot.cloud.os.core.api.dto.Tag; +//import iot.cloud.os.core.api.enums.DeviceType; +//import iot.cloud.os.core.api.enums.MessageSourceType; +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import me.hekr.iotos.api.enums.DeviceType; +import me.hekr.iotos.api.enums.MessageSourceType; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.Id; +import org.springframework.data.annotation.LastModifiedDate; + +public class DeviceDTO implements Serializable { + private static final long serialVersionUID = 1546822448972991937L; + @Id + protected String id; + protected String finger; + protected String sessionId; + protected MessageSourceType messageSourceType; + @JsonInclude(Include.NON_NULL) + protected String rootPk; + @JsonInclude(Include.NON_NULL) + protected String name; + @JsonInclude(Include.NON_NULL) + protected String rootDevId; + @JsonInclude(Include.NON_NULL) + protected String parentPk; + @JsonInclude(Include.NON_NULL) + protected String parentDevId; + @CreatedDate + protected Date createdDate; + @LastModifiedDate + protected Date updatedDate; + protected Boolean enable; + protected String pk; + protected String devId; + protected boolean online; + protected String devSecret; + protected Date loginTime; + protected Date logoutTime; + protected Date registerTime; + protected Date firstLoginTime; + protected DeviceType deviceType; + protected List tags; + protected IpInfo ipInfo; + protected String moduleVersion; + protected String mcuVersion; + protected String configVersion; + protected String batchName; + protected String imei; + @JsonInclude(Include.NON_NULL) + protected Boolean gatewayOnline; + + public boolean isEnable() { + return !Boolean.FALSE.equals(this.enable); + } + + public Boolean getEnable() { + return this.isEnable(); + } + + public DeviceDTO() { + } + + public String getId() { + return this.id; + } + + public String getFinger() { + return this.finger; + } + + public String getSessionId() { + return this.sessionId; + } + + public MessageSourceType getMessageSourceType() { + return this.messageSourceType; + } + + public String getRootPk() { + return this.rootPk; + } + + public String getName() { + return this.name; + } + + public String getRootDevId() { + return this.rootDevId; + } + + public String getParentPk() { + return this.parentPk; + } + + public String getParentDevId() { + return this.parentDevId; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public Date getUpdatedDate() { + return this.updatedDate; + } + + public String getPk() { + return this.pk; + } + + public String getDevId() { + return this.devId; + } + + public boolean isOnline() { + return this.online; + } + + public String getDevSecret() { + return this.devSecret; + } + + public Date getLoginTime() { + return this.loginTime; + } + + public Date getLogoutTime() { + return this.logoutTime; + } + + public Date getRegisterTime() { + return this.registerTime; + } + + public Date getFirstLoginTime() { + return this.firstLoginTime; + } + + public DeviceType getDeviceType() { + return this.deviceType; + } + + public List getTags() { + return this.tags; + } + + public IpInfo getIpInfo() { + return this.ipInfo; + } + + public String getModuleVersion() { + return this.moduleVersion; + } + + public String getMcuVersion() { + return this.mcuVersion; + } + + public String getConfigVersion() { + return this.configVersion; + } + + public String getBatchName() { + return this.batchName; + } + + public String getImei() { + return this.imei; + } + + public Boolean getGatewayOnline() { + return this.gatewayOnline; + } + + public void setId(String id) { + this.id = id; + } + + public void setFinger(String finger) { + this.finger = finger; + } + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + public void setMessageSourceType(MessageSourceType messageSourceType) { + this.messageSourceType = messageSourceType; + } + + public void setRootPk(String rootPk) { + this.rootPk = rootPk; + } + + public void setName(String name) { + this.name = name; + } + + public void setRootDevId(String rootDevId) { + this.rootDevId = rootDevId; + } + + public void setParentPk(String parentPk) { + this.parentPk = parentPk; + } + + public void setParentDevId(String parentDevId) { + this.parentDevId = parentDevId; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public void setUpdatedDate(Date updatedDate) { + this.updatedDate = updatedDate; + } + + public void setEnable(Boolean enable) { + this.enable = enable; + } + + public void setPk(String pk) { + this.pk = pk; + } + + public void setDevId(String devId) { + this.devId = devId; + } + + public void setOnline(boolean online) { + this.online = online; + } + + public void setDevSecret(String devSecret) { + this.devSecret = devSecret; + } + + public void setLoginTime(Date loginTime) { + this.loginTime = loginTime; + } + + public void setLogoutTime(Date logoutTime) { + this.logoutTime = logoutTime; + } + + public void setRegisterTime(Date registerTime) { + this.registerTime = registerTime; + } + + public void setFirstLoginTime(Date firstLoginTime) { + this.firstLoginTime = firstLoginTime; + } + + public void setDeviceType(DeviceType deviceType) { + this.deviceType = deviceType; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public void setIpInfo(IpInfo ipInfo) { + this.ipInfo = ipInfo; + } + + public void setModuleVersion(String moduleVersion) { + this.moduleVersion = moduleVersion; + } + + public void setMcuVersion(String mcuVersion) { + this.mcuVersion = mcuVersion; + } + + public void setConfigVersion(String configVersion) { + this.configVersion = configVersion; + } + + public void setBatchName(String batchName) { + this.batchName = batchName; + } + + public void setImei(String imei) { + this.imei = imei; + } + + public void setGatewayOnline(Boolean gatewayOnline) { + this.gatewayOnline = gatewayOnline; + } + + @Override + public String toString() { + return "DeviceDTO(id=" + this.getId() + ", finger=" + this.getFinger() + ", sessionId=" + this.getSessionId() + ", messageSourceType=" + this.getMessageSourceType() + ", rootPk=" + this.getRootPk() + ", name=" + this.getName() + ", rootDevId=" + this.getRootDevId() + ", parentPk=" + this.getParentPk() + ", parentDevId=" + this.getParentDevId() + ", createdDate=" + this.getCreatedDate() + ", updatedDate=" + this.getUpdatedDate() + ", enable=" + this.getEnable() + ", pk=" + this.getPk() + ", devId=" + this.getDevId() + ", online=" + this.isOnline() + ", devSecret=" + this.getDevSecret() + ", loginTime=" + this.getLoginTime() + ", logoutTime=" + this.getLogoutTime() + ", registerTime=" + this.getRegisterTime() + ", firstLoginTime=" + this.getFirstLoginTime() + ", deviceType=" + this.getDeviceType() + ", tags=" + this.getTags() + ", ipInfo=" + this.getIpInfo() + ", moduleVersion=" + this.getModuleVersion() + ", mcuVersion=" + this.getMcuVersion() + ", configVersion=" + this.getConfigVersion() + ", batchName=" + this.getBatchName() + ", imei=" + this.getImei() + ", gatewayOnline=" + this.getGatewayOnline() + ")"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof iot.cloud.os.core.api.dto.DeviceDTO)) { + return false; + } else { + DeviceDTO other = (DeviceDTO)o; + if (!other.canEqual(this)) { + return false; + } else { + Object this$pk = this.getPk(); + Object other$pk = other.getPk(); + if (this$pk == null) { + if (other$pk != null) { + return false; + } + } else if (!this$pk.equals(other$pk)) { + return false; + } + + Object this$devId = this.getDevId(); + Object other$devId = other.getDevId(); + if (this$devId == null) { + if (other$devId != null) { + return false; + } + } else if (!this$devId.equals(other$devId)) { + return false; + } + + return true; + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof iot.cloud.os.core.api.dto.DeviceDTO; + } + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/DeviceStatusRes.java b/src/main/java/me/hekr/iotos/api/dto/DeviceStatusRes.java new file mode 100644 index 0000000..38fa554 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/DeviceStatusRes.java @@ -0,0 +1,14 @@ +package me.hekr.iotos.api.dto; + +import lombok.Data; + +import java.util.Date; + +@Data +public class DeviceStatusRes { + protected String pk; + protected String devId; + protected boolean online; + /* 最近登录时间*/ + protected Date loginTime; +} diff --git a/src/main/java/me/hekr/iotos/api/dto/IpInfo.java b/src/main/java/me/hekr/iotos/api/dto/IpInfo.java new file mode 100644 index 0000000..77337df --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/IpInfo.java @@ -0,0 +1,93 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import java.io.Serializable; + +public class IpInfo implements Serializable { + private static final long serialVersionUID = -8527104618122701513L; + private String ip; + private String country; + private String province; + private String city; + + public IpInfo(String ip) { + this.ip = ip; + } + + public String getIp() { + return this.ip; + } + + public String getCountry() { + return this.country; + } + + public String getProvince() { + return this.province; + } + + public String getCity() { + return this.city; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setProvince(String province) { + this.province = province; + } + + public void setCity(String city) { + this.city = city; + } + + @Override + public String toString() { + return "IpInfo(ip=" + this.getIp() + ", country=" + this.getCountry() + ", province=" + this.getProvince() + ", city=" + this.getCity() + ")"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof iot.cloud.os.core.api.dto.IpInfo)) { + return false; + } else { + IpInfo other = (IpInfo)o; + if (!other.canEqual(this)) { + return false; + } else { + Object this$ip = this.getIp(); + Object other$ip = other.getIp(); + if (this$ip == null) { + if (other$ip != null) { + return false; + } + } else if (!this$ip.equals(other$ip)) { + return false; + } + + return true; + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof iot.cloud.os.core.api.dto.IpInfo; + } + + + + public IpInfo() { + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/ModelCmdDTO.java b/src/main/java/me/hekr/iotos/api/dto/ModelCmdDTO.java new file mode 100644 index 0000000..2f68a60 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/ModelCmdDTO.java @@ -0,0 +1,77 @@ +package me.hekr.iotos.api.dto; +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +//import iot.cloud.os.core.api.enums.FrameType; +import java.io.Serializable; +import java.util.TreeSet; +import me.hekr.iotos.api.enums.FrameType; + +@JsonInclude(Include.NON_NULL) +public class ModelCmdDTO implements Serializable { + private static final long serialVersionUID = -6040947199844685210L; + protected String name; + protected String cmd; + protected FrameType frameType; + protected TreeSet params; + protected String desc; + protected TreeSet tags; + + public TreeSet getParams() { + return this.params == null ? new TreeSet() : this.params; + } + + public ModelCmdDTO() { + } + + public String getName() { + return this.name; + } + + public String getCmd() { + return this.cmd; + } + + public FrameType getFrameType() { + return this.frameType; + } + + public String getDesc() { + return this.desc; + } + + public TreeSet getTags() { + return this.tags; + } + + public void setName(String name) { + this.name = name; + } + + public void setCmd(String cmd) { + this.cmd = cmd; + } + + public void setFrameType(FrameType frameType) { + this.frameType = frameType; + } + + public void setParams(TreeSet params) { + this.params = params; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public void setTags(TreeSet tags) { + this.tags = tags; + } + + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/ModelParamDTO.java b/src/main/java/me/hekr/iotos/api/dto/ModelParamDTO.java new file mode 100644 index 0000000..8ce6ad3 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/ModelParamDTO.java @@ -0,0 +1,97 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +//import iot.cloud.os.core.api.dto.DataValueChecker; +//import iot.cloud.os.core.api.dto.Tag; +//import iot.cloud.os.core.api.enums.DataType; + +import java.io.Serializable; +import java.util.TreeSet; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import me.hekr.iotos.api.enums.DataType; +import me.hekr.iotos.api.enums.FrameType; + +@JsonInclude(Include.NON_NULL) +public class ModelParamDTO implements Serializable { + private static final long serialVersionUID = 5644859178187540679L; + @NotBlank + protected String name; + @NotBlank + protected String param; + @NotNull + protected DataType dataType; + @NotNull + protected FrameType frameType; + @NotNull + protected DataValueChecker checkType; + protected String desc; + protected TreeSet tags; + + public ModelParamDTO() { + } + + public String getName() { + return this.name; + } + + public String getParam() { + return this.param; + } + + public DataType getDataType() { + return this.dataType; + } + + public FrameType getFrameType() { + return this.frameType; + } + + public DataValueChecker getCheckType() { + return this.checkType; + } + + public String getDesc() { + return this.desc; + } + + public TreeSet getTags() { + return this.tags; + } + + public void setName(String name) { + this.name = name; + } + + public void setParam(String param) { + this.param = param; + } + + public void setDataType(DataType dataType) { + this.dataType = dataType; + } + + public void setFrameType(FrameType frameType) { + this.frameType = frameType; + } + + public void setCheckType(DataValueChecker checkType) { + this.checkType = checkType; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public void setTags(TreeSet tags) { + this.tags = tags; + } + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/ModelParamValue.java b/src/main/java/me/hekr/iotos/api/dto/ModelParamValue.java new file mode 100644 index 0000000..fcb255c --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/ModelParamValue.java @@ -0,0 +1,48 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +import java.io.Serializable; + +public class ModelParamValue implements Serializable { + private static final long serialVersionUID = 8577717179885559003L; + private T value; + private String desc; + + public ModelParamValue(T value) { + this.value = value; + } + + public T getValue() { + return this.value; + } + + public String getDesc() { + return this.desc; + } + + public void setValue(T value) { + this.value = value; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + @Override + public String toString() { + return "ModelParamValue(value=" + this.getValue() + ", desc=" + this.getDesc() + ")"; + } + + public ModelParamValue() { + } + + public ModelParamValue(T value, String desc) { + this.value = value; + this.desc = desc; + } + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/ModelProtocolDTO.java b/src/main/java/me/hekr/iotos/api/dto/ModelProtocolDTO.java new file mode 100644 index 0000000..6999531 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/ModelProtocolDTO.java @@ -0,0 +1,69 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) + + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; + +public class ModelProtocolDTO implements Serializable { + private static final long serialVersionUID = -2739480258311156282L; + protected String pk; + protected List params; + protected List cmds; + @CreatedDate + protected Date createdDate; + @LastModifiedDate + protected Date updatedDate; + + public ModelProtocolDTO() { + } + + public String getPk() { + return this.pk; + } + + public List getParams() { + return this.params; + } + + public List getCmds() { + return this.cmds; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public Date getUpdatedDate() { + return this.updatedDate; + } + + public void setPk(String pk) { + this.pk = pk; + } + + public void setParams(List params) { + this.params = params; + } + + public void setCmds(List cmds) { + this.cmds = cmds; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public void setUpdatedDate(Date updatedDate) { + this.updatedDate = updatedDate; + } + + + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/Snapshot.java b/src/main/java/me/hekr/iotos/api/dto/Snapshot.java new file mode 100644 index 0000000..95dc8ee --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/Snapshot.java @@ -0,0 +1,127 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.ModelData; +import java.io.Serializable; +import me.hekr.iotos.api.dto.klink.ModelData; + +public class Snapshot implements Serializable { + private static final long serialVersionUID = -9064767418611128865L; + private String pk; + private String devId; + private long timestamp; + private ModelData data; + + public Snapshot(String pk, String devId) { + this.pk = pk; + this.devId = devId; + } + + public String getPk() { + return this.pk; + } + + public String getDevId() { + return this.devId; + } + + public long getTimestamp() { + return this.timestamp; + } + + public ModelData getData() { + return this.data; + } + + public void setPk(String pk) { + this.pk = pk; + } + + public void setDevId(String devId) { + this.devId = devId; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + public void setData(ModelData data) { + this.data = data; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof iot.cloud.os.core.api.dto.Snapshot)) { + return false; + } else { + Snapshot other = (Snapshot)o; + if (!other.canEqual(this)) { + return false; + } else { + Object this$pk = this.getPk(); + Object other$pk = other.getPk(); + if (this$pk == null) { + if (other$pk != null) { + return false; + } + } else if (!this$pk.equals(other$pk)) { + return false; + } + + Object this$devId = this.getDevId(); + Object other$devId = other.getDevId(); + if (this$devId == null) { + if (other$devId != null) { + return false; + } + } else if (!this$devId.equals(other$devId)) { + return false; + } + + if (this.getTimestamp() != other.getTimestamp()) { + return false; + } else { + Object this$data = this.getData(); + Object other$data = other.getData(); + if (this$data == null) { + if (other$data != null) { + return false; + } + } else if (!this$data.equals(other$data)) { + return false; + } + + return true; + } + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof iot.cloud.os.core.api.dto.Snapshot; + } + + + + @Override + public String toString() { + return "Snapshot(pk=" + this.getPk() + ", devId=" + this.getDevId() + ", timestamp=" + this.getTimestamp() + ", data=" + this.getData() + ")"; + } + + public Snapshot() { + } + + public Snapshot(String pk, String devId, long timestamp, ModelData data) { + this.pk = pk; + this.devId = devId; + this.timestamp = timestamp; + this.data = data; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/Tag.java b/src/main/java/me/hekr/iotos/api/dto/Tag.java new file mode 100644 index 0000000..f940d49 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/Tag.java @@ -0,0 +1,44 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import java.io.Serializable; + +public class Tag implements Serializable { + private static final long serialVersionUID = -2216750312738203195L; + private String key; + private String value; + + public static iot.cloud.os.core.api.dto.Tag of(String key, String value) { + return new iot.cloud.os.core.api.dto.Tag(key, value); + } + + public String getKey() { + return this.key; + } + + public String getValue() { + return this.value; + } + + public void setKey(String key) { + this.key = key; + } + + public void setValue(String value) { + this.value = value; + } + + + public Tag(String key, String value) { + this.key = key; + this.value = value; + } + + public Tag() { + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/AddTopo.java b/src/main/java/me/hekr/iotos/api/dto/klink/AddTopo.java new file mode 100644 index 0000000..4114ac4 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/AddTopo.java @@ -0,0 +1,37 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.dto.klink.TopoSub; +import me.hekr.iotos.api.enums.Action; +//import iot.cloud.os.core.api.enums.Action; + +public class AddTopo extends KlinkDev { + private TopoSub sub; + + public AddTopo() { + } + + @Override + public String getAction() { + return Action.ADD_TOPO.getAction(); + } + + public TopoSub getSub() { + return this.sub; + } + + public void setSub(TopoSub sub) { + this.sub = sub; + } + + @Override + public String toString() { + return "AddTopo(super=" + super.toString() + ", sub=" + this.getSub() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/AddTopoResp.java b/src/main/java/me/hekr/iotos/api/dto/klink/AddTopoResp.java new file mode 100644 index 0000000..b1fd165 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/AddTopoResp.java @@ -0,0 +1,48 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +//import iot.cloud.os.core.api.dto.klink.Dev; +//import iot.cloud.os.core.api.dto.klink.KlinkResp; +//import iot.cloud.os.core.api.enums.Action; +//import me.hekr.iotos.api.enums.ErrorCode; +//import iot.cloud.os.core.api.enums.ErrorCode; + +import me.hekr.iotos.api.enums.Action; +import me.hekr.iotos.api.enums.ErrorCode; + +public class AddTopoResp extends KlinkResp { + private Dev sub; + + public AddTopoResp(ErrorCode errorCode, String desc) { + super(errorCode, desc); + } + + public AddTopoResp(ErrorCode errorCode) { + super(errorCode); + } + + @Override + public String getAction() { + return Action.ADD_TOPO_RESP.getAction(); + } + + public Dev getSub() { + return this.sub; + } + + public void setSub(Dev sub) { + this.sub = sub; + } + + @Override + public String toString() { + return "AddTopoResp(super=" + super.toString() + ", sub=" + this.getSub() + ")"; + } + + public AddTopoResp() { + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/BatchDevSend.java b/src/main/java/me/hekr/iotos/api/dto/klink/BatchDevSend.java new file mode 100644 index 0000000..b4f4714 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/BatchDevSend.java @@ -0,0 +1,38 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.dto.klink.SuModelData; +//import iot.cloud.os.core.api.enums.Action; +import java.util.List; +import me.hekr.iotos.api.enums.Action; + +public class BatchDevSend extends KlinkDev { + private List data; + + public BatchDevSend() { + } + + @Override + public String getAction() { + return Action.BATCH_DEV_SEND.getAction(); + } + + public List getData() { + return this.data; + } + + public void setData(List data) { + this.data = data; + } + + @Override + public String toString() { + return "BatchDevSend(super=" + super.toString() + ", data=" + this.getData() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/CloudSend.java b/src/main/java/me/hekr/iotos/api/dto/klink/CloudSend.java new file mode 100644 index 0000000..df991bd --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/CloudSend.java @@ -0,0 +1,38 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.dto.klink.ModelData; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class CloudSend extends KlinkDev { + private ModelData data; + + public CloudSend() { + } + + @Override + public String getAction() { + return Action.CLOUD_SEND.getAction(); + } + + public ModelData getData() { + return this.data; + } + + public void setData(ModelData data) { + this.data = data; + } + + @Override + public String toString() { + return "CloudSend(super=" + super.toString() + ", data=" + this.getData() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DelTopo.java b/src/main/java/me/hekr/iotos/api/dto/klink/DelTopo.java new file mode 100644 index 0000000..f389567 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DelTopo.java @@ -0,0 +1,38 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.dto.klink.TopoSub; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class DelTopo extends KlinkDev { + private TopoSub sub; + + @Override + public String getAction() { + return Action.DEL_TOPO.getAction(); + } + + public TopoSub getSub() { + return this.sub; + } + + public void setSub(TopoSub sub) { + this.sub = sub; + } + + @Override + public String toString() { + return "DelTopo(super=" + super.toString() + ", sub=" + this.getSub() + ")"; + } + + public DelTopo() { + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/Dev.java b/src/main/java/me/hekr/iotos/api/dto/klink/Dev.java new file mode 100644 index 0000000..d6947b9 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/Dev.java @@ -0,0 +1,33 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import java.io.Serializable; + +public class Dev implements Serializable { + private static final long serialVersionUID = -3682121569498210336L; + private String pk; + private String devId; + + public String getPk() { + return this.pk; + } + + public String getDevId() { + return this.devId; + } + + public void setPk(String pk) { + this.pk = pk; + } + + public void setDevId(String devId) { + this.devId = devId; + } + + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DevLogin.java b/src/main/java/me/hekr/iotos/api/dto/klink/DevLogin.java new file mode 100644 index 0000000..1bfa98e --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevLogin.java @@ -0,0 +1,55 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// +// +// +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class DevLogin extends KlinkDev { + private String random; + private String hashMethod; + private String sign; + + public DevLogin() { + } + + @Override + public String getAction() { + return Action.DEV_LOGIN.getAction(); + } + + public String getRandom() { + return this.random; + } + + public String getHashMethod() { + return this.hashMethod; + } + + public String getSign() { + return this.sign; + } + + public void setRandom(String random) { + this.random = random; + } + + public void setHashMethod(String hashMethod) { + this.hashMethod = hashMethod; + } + + public void setSign(String sign) { + this.sign = sign; + } + + @Override + public String toString() { + return "DevLogin(super=" + super.toString() + ", random=" + this.getRandom() + ", hashMethod=" + this.getHashMethod() + ", sign=" + this.getSign() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DevLogout.java b/src/main/java/me/hekr/iotos/api/dto/klink/DevLogout.java new file mode 100644 index 0000000..d32460e --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevLogout.java @@ -0,0 +1,71 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class DevLogout extends KlinkDev { + private String reason; + + @Override + public String getAction() { + return Action.DEV_LOGOUT.getAction(); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof DevLogout)) { + return false; + } else { + DevLogout other = (DevLogout)o; + if (!other.canEqual(this)) { + return false; + } else if (!super.equals(o)) { + return false; + } else { + Object this$reason = this.getReason(); + Object other$reason = other.getReason(); + if (this$reason == null) { + if (other$reason != null) { + return false; + } + } else if (!this$reason.equals(other$reason)) { + return false; + } + + return true; + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof DevLogout; + } + + + + public DevLogout() { + } + + public String getReason() { + return this.reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + @Override + public String toString() { + return "DevLogout(reason=" + this.getReason() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DevSend.java b/src/main/java/me/hekr/iotos/api/dto/klink/DevSend.java new file mode 100644 index 0000000..ed3de2c --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevSend.java @@ -0,0 +1,38 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +// +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.dto.klink.ModelData; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class DevSend extends KlinkDev { + private ModelData data; + + public DevSend() { + } + + @Override + public String getAction() { + return Action.DEV_SEND.getAction(); + } + + public ModelData getData() { + return this.data; + } + + public void setData(ModelData data) { + this.data = data; + } + + @Override + public String toString() { + return "DevSend(super=" + super.toString() + ", data=" + this.getData() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgrade.java b/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgrade.java new file mode 100644 index 0000000..8a7ec0c --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgrade.java @@ -0,0 +1,150 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class DevUpgrade extends KlinkDev { + private static final long serialVersionUID = 4913904608150992167L; + private String url; + private String md5; + private String version; + private String type; + + @Override + public String getAction() { + return Action.DEV_UPGRADE.getAction(); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.DevUpgrade)) { + return false; + } else { + DevUpgrade other = (DevUpgrade)o; + if (!other.canEqual(this)) { + return false; + } else if (!super.equals(o)) { + return false; + } else { + label61: { + Object this$url = this.getUrl(); + Object other$url = other.getUrl(); + if (this$url == null) { + if (other$url == null) { + break label61; + } + } else if (this$url.equals(other$url)) { + break label61; + } + + return false; + } + + label54: { + Object this$md5 = this.getMd5(); + Object other$md5 = other.getMd5(); + if (this$md5 == null) { + if (other$md5 == null) { + break label54; + } + } else if (this$md5.equals(other$md5)) { + break label54; + } + + return false; + } + + Object this$version = this.getVersion(); + Object other$version = other.getVersion(); + if (this$version == null) { + if (other$version != null) { + return false; + } + } else if (!this$version.equals(other$version)) { + return false; + } + + Object this$type = this.getType(); + Object other$type = other.getType(); + if (this$type == null) { + if (other$type != null) { + return false; + } + } else if (!this$type.equals(other$type)) { + return false; + } + + return true; + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof iot.cloud.os.core.api.dto.klink.DevUpgrade; + } + + @Override + public int hashCode() { + + int result = super.hashCode(); + Object $url = this.getUrl(); + result = result * 59 + ($url == null ? 43 : $url.hashCode()); + Object $md5 = this.getMd5(); + result = result * 59 + ($md5 == null ? 43 : $md5.hashCode()); + Object $version = this.getVersion(); + result = result * 59 + ($version == null ? 43 : $version.hashCode()); + Object $type = this.getType(); + result = result * 59 + ($type == null ? 43 : $type.hashCode()); + return result; + } + + public DevUpgrade() { + } + + public String getUrl() { + return this.url; + } + + public String getMd5() { + return this.md5; + } + + public String getVersion() { + return this.version; + } + + public String getType() { + return this.type; + } + + public void setUrl(String url) { + this.url = url; + } + + public void setMd5(String md5) { + this.md5 = md5; + } + + public void setVersion(String version) { + this.version = version; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public String toString() { + return "DevUpgrade(url=" + this.getUrl() + ", md5=" + this.getMd5() + ", version=" + this.getVersion() + ", type=" + this.getType() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgradeProgress.java b/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgradeProgress.java new file mode 100644 index 0000000..8d6acf0 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgradeProgress.java @@ -0,0 +1,90 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class DevUpgradeProgress extends KlinkDev { + private static final long serialVersionUID = 9016217483636057893L; + private int progress; + private String type; + + @Override + public String getAction() { + return Action.DEV_UPGRADE_PROGRESS.getAction(); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.DevUpgradeProgress)) { + return false; + } else { + DevUpgradeProgress other = (DevUpgradeProgress)o; + if (!other.canEqual(this)) { + return false; + } else if (!super.equals(o)) { + return false; + } else if (this.getProgress() != other.getProgress()) { + return false; + } else { + Object this$type = this.getType(); + Object other$type = other.getType(); + if (this$type == null) { + if (other$type == null) { + return true; + } + } else if (this$type.equals(other$type)) { + return true; + } + + return false; + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof iot.cloud.os.core.api.dto.klink.DevUpgradeProgress; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = result * 59 + this.getProgress(); + Object $type = this.getType(); + result = result * 59 + ($type == null ? 43 : $type.hashCode()); + return result; + } + + public DevUpgradeProgress() { + } + + public int getProgress() { + return this.progress; + } + + public String getType() { + return this.type; + } + + public void setProgress(int progress) { + this.progress = progress; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public String toString() { + return "DevUpgradeProgress(progress=" + this.getProgress() + ", type=" + this.getType() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/GetConfig.java b/src/main/java/me/hekr/iotos/api/dto/klink/GetConfig.java new file mode 100644 index 0000000..0b52051 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/GetConfig.java @@ -0,0 +1,30 @@ +package me.hekr.iotos.api.dto.klink; + + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class GetConfig extends KlinkDev { + private static final long serialVersionUID = -8668881267356068518L; + + public GetConfig() { + } + + @Override + public String getAction() { + return Action.GET_CONFIG.getAction(); + } + + @Override + public String toString() { + return "GetConfig(super=" + super.toString() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/GetConfigResp.java b/src/main/java/me/hekr/iotos/api/dto/klink/GetConfigResp.java new file mode 100644 index 0000000..ff6049c --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/GetConfigResp.java @@ -0,0 +1,105 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkResp; +//import iot.cloud.os.core.api.enums.Action; +//import iot.cloud.os.core.api.enums.ErrorCode; + +import me.hekr.iotos.api.enums.Action; +import me.hekr.iotos.api.enums.ErrorCode; + +public class GetConfigResp extends KlinkResp { + private static final long serialVersionUID = 3722041793170943339L; + private String url; + private String md5; + + public GetConfigResp(ErrorCode errorCode) { + super(errorCode); + } + + @Override + public String getAction() { + return Action.GET_CONFIG_RESP.getAction(); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.GetConfigResp)) { + return false; + } else { + GetConfigResp other = (GetConfigResp)o; + if (!other.canEqual(this)) { + return false; + } else if (!super.equals(o)) { + return false; + } else { + Object this$url = this.getUrl(); + Object other$url = other.getUrl(); + if (this$url == null) { + if (other$url != null) { + return false; + } + } else if (!this$url.equals(other$url)) { + return false; + } + + Object this$md5 = this.getMd5(); + Object other$md5 = other.getMd5(); + if (this$md5 == null) { + if (other$md5 != null) { + return false; + } + } else if (!this$md5.equals(other$md5)) { + return false; + } + + return true; + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof iot.cloud.os.core.api.dto.klink.GetConfigResp; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + Object $url = this.getUrl(); + result = result * 59 + ($url == null ? 43 : $url.hashCode()); + Object $md5 = this.getMd5(); + result = result * 59 + ($md5 == null ? 43 : $md5.hashCode()); + return result; + } + + public String getUrl() { + return this.url; + } + + public String getMd5() { + return this.md5; + } + + public void setUrl(String url) { + this.url = url; + } + + public void setMd5(String md5) { + this.md5 = md5; + } + + @Override + public String toString() { + return "GetConfigResp(super=" + super.toString() + ", url=" + this.getUrl() + ", md5=" + this.getMd5() + ")"; + } + + public GetConfigResp() { + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/GetTopo.java b/src/main/java/me/hekr/iotos/api/dto/klink/GetTopo.java new file mode 100644 index 0000000..2cc2374 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/GetTopo.java @@ -0,0 +1,28 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class GetTopo extends KlinkDev { + private static final long serialVersionUID = 4118414118485680261L; + + public GetTopo() { + } + + @Override + public String getAction() { + return Action.GET_TOPO.getAction(); + } + + @Override + public String toString() { + return "GetTopo(super=" + super.toString() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/Klink.java b/src/main/java/me/hekr/iotos/api/dto/klink/Klink.java new file mode 100644 index 0000000..437ba18 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/Klink.java @@ -0,0 +1,54 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import java.io.Serializable; + +@JsonInclude(Include.NON_NULL) +public class Klink implements Serializable { + @JsonIgnore + public static final String CMD = "cmd"; + private static final long serialVersionUID = -4341021820638489039L; + protected String action; + protected long msgId; + protected String sysCustomRaw; + + public Klink() { + } + + public String getAction() { + return this.action; + } + + public long getMsgId() { + return this.msgId; + } + + public String getSysCustomRaw() { + return this.sysCustomRaw; + } + + public void setAction(String action) { + this.action = action; + } + + public void setMsgId(long msgId) { + this.msgId = msgId; + } + + public void setSysCustomRaw(String sysCustomRaw) { + this.sysCustomRaw = sysCustomRaw; + } + + @Override + public String toString() { + return "Klink(action=" + this.getAction() + ", msgId=" + this.getMsgId() + ", sysCustomRaw=" + this.getSysCustomRaw() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/KlinkDev.java b/src/main/java/me/hekr/iotos/api/dto/klink/KlinkDev.java new file mode 100644 index 0000000..5815703 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/KlinkDev.java @@ -0,0 +1,37 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +//import iot.cloud.os.core.api.dto.klink.Klink; + +public class KlinkDev extends Klink { + private static final long serialVersionUID = 78156295896577172L; + protected String pk; + protected String devId; + + public KlinkDev() { + } + + public String getPk() { + return this.pk; + } + + public String getDevId() { + return this.devId; + } + + public void setPk(String pk) { + this.pk = pk; + } + + public void setDevId(String devId) { + this.devId = devId; + } + + public String toString() { + return "KlinkDev(super=" + super.toString() + ", pk=" + this.getPk() + ", devId=" + this.getDevId() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/KlinkResp.java b/src/main/java/me/hekr/iotos/api/dto/klink/KlinkResp.java new file mode 100644 index 0000000..6de1d67 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/KlinkResp.java @@ -0,0 +1,104 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +//import iot.cloud.os.core.api.dto.klink.Klink; +//import iot.cloud.os.core.api.enums.ErrorCode; +import java.util.Map; +import me.hekr.iotos.api.enums.ErrorCode; + +public class KlinkResp extends Klink { + private static final long serialVersionUID = -4341021820638489039L; + protected String pk; + protected String devId; + protected int code; + @JsonInclude(Include.NON_NULL) + protected String desc; + @JsonInclude(Include.NON_NULL) + protected Map params; + + public KlinkResp() { + this.code = ErrorCode.SUCCESS.getCode(); + } + + public KlinkResp(ErrorCode errorCode) { + this(errorCode, (String)null); + } + + public KlinkResp(ErrorCode errorCode, String desc, Map params) { + this.code = errorCode.getCode(); + this.desc = errorCode.getDesc(); + if (desc != null) { + this.desc = this.desc + ", " + desc; + } + + this.params = params; + } + + public KlinkResp(ErrorCode errorCode, String desc) { + this(errorCode, desc, (Map)null); + } + + @JsonIgnore + public boolean isSuccess() { + return this.code == ErrorCode.SUCCESS.getCode(); + } + + public KlinkResp setErrorCode(ErrorCode errorCode) { + this.code = errorCode.getCode(); + this.desc = errorCode.getDesc(); + return this; + } + + @Override + public String toString() { + return "KlinkResp(super=" + super.toString() + ", pk=" + this.getPk() + ", devId=" + this.getDevId() + ", code=" + this.getCode() + ", desc=" + this.getDesc() + ", params=" + this.getParams() + ")"; + } + + public String getPk() { + return this.pk; + } + + public String getDevId() { + return this.devId; + } + + public int getCode() { + return this.code; + } + + public String getDesc() { + return this.desc; + } + + public Map getParams() { + return this.params; + } + + public void setPk(String pk) { + this.pk = pk; + } + + public void setDevId(String devId) { + this.devId = devId; + } + + public void setCode(int code) { + this.code = code; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public void setParams(Map params) { + this.params = params; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/ModelData.java b/src/main/java/me/hekr/iotos/api/dto/klink/ModelData.java new file mode 100644 index 0000000..f798fdc --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/ModelData.java @@ -0,0 +1,85 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import java.io.Serializable; +import java.util.Collections; +import java.util.Map; + +public class ModelData implements Serializable { + private static final long serialVersionUID = 5838451843005203760L; + private String cmd; + @JsonInclude(Include.NON_NULL) + private Map params; + + public Map getParams() { + return this.params == null ? Collections.emptyMap() : this.params; + } + + public ModelData() { + } + + public String getCmd() { + return this.cmd; + } + + public void setCmd(String cmd) { + this.cmd = cmd; + } + + public void setParams(Map params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.ModelData)) { + return false; + } else { + ModelData other = (ModelData)o; + if (!other.canEqual(this)) { + return false; + } else { + Object this$cmd = this.getCmd(); + Object other$cmd = other.getCmd(); + if (this$cmd == null) { + if (other$cmd != null) { + return false; + } + } else if (!this$cmd.equals(other$cmd)) { + return false; + } + + Object this$params = this.getParams(); + Object other$params = other.getParams(); + if (this$params == null) { + if (other$params != null) { + return false; + } + } else if (!this$params.equals(other$params)) { + return false; + } + + return true; + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof iot.cloud.os.core.api.dto.klink.ModelData; + } + + + @Override + public String toString() { + return "ModelData(cmd=" + this.getCmd() + ", params=" + this.getParams() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/NotSupport.java b/src/main/java/me/hekr/iotos/api/dto/klink/NotSupport.java new file mode 100644 index 0000000..3283004 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/NotSupport.java @@ -0,0 +1,27 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class NotSupport extends KlinkDev { + public NotSupport() { + } + + @Override + public String getAction() { + return Action.NOT_SUPPORT.getAction(); + } + + @Override + public String toString() { + return "NotSupport(super=" + super.toString() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/Register.java b/src/main/java/me/hekr/iotos/api/dto/klink/Register.java new file mode 100644 index 0000000..4503bd6 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/Register.java @@ -0,0 +1,214 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.Tag; +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.enums.Action; +import java.util.List; +import me.hekr.iotos.api.dto.Tag; +import me.hekr.iotos.api.enums.Action; + +public class Register extends KlinkDev { + private static final long serialVersionUID = 6099206158766831129L; + private String random; + private String hashMethod; + private String sign; + private String name; + private String imei; + private String batchName; + private List tags; + + @Override + public String getAction() { + return Action.REGISTER.getAction(); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.Register)) { + return false; + } else { + Register other = (Register)o; + if (!other.canEqual(this)) { + return false; + } else if (!super.equals(o)) { + return false; + } else { + label97: { + Object this$random = this.getRandom(); + Object other$random = other.getRandom(); + if (this$random == null) { + if (other$random == null) { + break label97; + } + } else if (this$random.equals(other$random)) { + break label97; + } + + return false; + } + + Object this$hashMethod = this.getHashMethod(); + Object other$hashMethod = other.getHashMethod(); + if (this$hashMethod == null) { + if (other$hashMethod != null) { + return false; + } + } else if (!this$hashMethod.equals(other$hashMethod)) { + return false; + } + + Object this$sign = this.getSign(); + Object other$sign = other.getSign(); + if (this$sign == null) { + if (other$sign != null) { + return false; + } + } else if (!this$sign.equals(other$sign)) { + return false; + } + + label76: { + Object this$name = this.getName(); + Object other$name = other.getName(); + if (this$name == null) { + if (other$name == null) { + break label76; + } + } else if (this$name.equals(other$name)) { + break label76; + } + + return false; + } + + Object this$imei = this.getImei(); + Object other$imei = other.getImei(); + if (this$imei == null) { + if (other$imei != null) { + return false; + } + } else if (!this$imei.equals(other$imei)) { + return false; + } + + Object this$batchName = this.getBatchName(); + Object other$batchName = other.getBatchName(); + if (this$batchName == null) { + if (other$batchName != null) { + return false; + } + } else if (!this$batchName.equals(other$batchName)) { + return false; + } + + Object this$tags = this.getTags(); + Object other$tags = other.getTags(); + if (this$tags == null) { + if (other$tags != null) { + return false; + } + } else if (!this$tags.equals(other$tags)) { + return false; + } + + return true; + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof iot.cloud.os.core.api.dto.klink.Register; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + Object $random = this.getRandom(); + result = result * 59 + ($random == null ? 43 : $random.hashCode()); + Object $hashMethod = this.getHashMethod(); + result = result * 59 + ($hashMethod == null ? 43 : $hashMethod.hashCode()); + Object $sign = this.getSign(); + result = result * 59 + ($sign == null ? 43 : $sign.hashCode()); + Object $name = this.getName(); + result = result * 59 + ($name == null ? 43 : $name.hashCode()); + Object $imei = this.getImei(); + result = result * 59 + ($imei == null ? 43 : $imei.hashCode()); + Object $batchName = this.getBatchName(); + result = result * 59 + ($batchName == null ? 43 : $batchName.hashCode()); + Object $tags = this.getTags(); + result = result * 59 + ($tags == null ? 43 : $tags.hashCode()); + return result; + } + + public Register() { + } + + public String getRandom() { + return this.random; + } + + public String getHashMethod() { + return this.hashMethod; + } + + public String getSign() { + return this.sign; + } + + public String getName() { + return this.name; + } + + public String getImei() { + return this.imei; + } + + public String getBatchName() { + return this.batchName; + } + + public List getTags() { + return this.tags; + } + + public void setRandom(String random) { + this.random = random; + } + + public void setHashMethod(String hashMethod) { + this.hashMethod = hashMethod; + } + + public void setSign(String sign) { + this.sign = sign; + } + + public void setName(String name) { + this.name = name; + } + + public void setImei(String imei) { + this.imei = imei; + } + + public void setBatchName(String batchName) { + this.batchName = batchName; + } + + public void setTags(List tags) { + this.tags = tags; + } + + @Override + public String toString() { + return "Register(random=" + this.getRandom() + ", hashMethod=" + this.getHashMethod() + ", sign=" + this.getSign() + ", name=" + this.getName() + ", imei=" + this.getImei() + ", batchName=" + this.getBatchName() + ", tags=" + this.getTags() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/RegisterResp.java b/src/main/java/me/hekr/iotos/api/dto/klink/RegisterResp.java new file mode 100644 index 0000000..f1b6edb --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/RegisterResp.java @@ -0,0 +1,85 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +// +//import iot.cloud.os.core.api.dto.klink.KlinkResp; +//import iot.cloud.os.core.api.enums.Action; +//import iot.cloud.os.core.api.enums.ErrorCode; + +import me.hekr.iotos.api.enums.Action; +import me.hekr.iotos.api.enums.ErrorCode; + +public class RegisterResp extends KlinkResp { + private static final long serialVersionUID = -6728983939835762139L; + private String devSecret; + + public RegisterResp(ErrorCode errorCode, String desc) { + super(errorCode, desc); + } + + @Override + public String getAction() { + return Action.REGISTER_RESP.getAction(); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.RegisterResp)) { + return false; + } else { + RegisterResp other = (RegisterResp)o; + if (!other.canEqual(this)) { + return false; + } else if (!super.equals(o)) { + return false; + } else { + Object this$devSecret = this.getDevSecret(); + Object other$devSecret = other.getDevSecret(); + if (this$devSecret == null) { + if (other$devSecret != null) { + return false; + } + } else if (!this$devSecret.equals(other$devSecret)) { + return false; + } + + return true; + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof iot.cloud.os.core.api.dto.klink.RegisterResp; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + Object $devSecret = this.getDevSecret(); + result = result * 59 + ($devSecret == null ? 43 : $devSecret.hashCode()); + return result; + } + + public String getDevSecret() { + return this.devSecret; + } + + public void setDevSecret(String devSecret) { + this.devSecret = devSecret; + } + + @Override + public String toString() { + return "RegisterResp(super=" + super.toString() + ", devSecret=" + this.getDevSecret() + ")"; + } + + public RegisterResp() { + } +} + diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/ReportFirmware.java b/src/main/java/me/hekr/iotos/api/dto/klink/ReportFirmware.java new file mode 100644 index 0000000..2fa5dcd --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/ReportFirmware.java @@ -0,0 +1,47 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.KlinkDev; +//import iot.cloud.os.core.api.enums.Action; + +import me.hekr.iotos.api.enums.Action; + +public class ReportFirmware extends KlinkDev { + private String type; + private String version; + + public ReportFirmware() { + } + + @Override + public String getAction() { + return Action.REPORT_FIRMWARE.getAction(); + } + + public String getType() { + return this.type; + } + + public String getVersion() { + return this.version; + } + + public void setType(String type) { + this.type = type; + } + + public void setVersion(String version) { + this.version = version; + } + + @Override + public String toString() { + return "ReportFirmware(super=" + super.toString() + ", type=" + this.getType() + ", version=" + this.getVersion() + ")"; + } +} + diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/SuModelData.java b/src/main/java/me/hekr/iotos/api/dto/klink/SuModelData.java new file mode 100644 index 0000000..d3b0f50 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/SuModelData.java @@ -0,0 +1,38 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +//import iot.cloud.os.core.api.dto.klink.ModelData; + +public class SuModelData extends ModelData { + private static final long serialVersionUID = -136551194596662462L; + private String pk; + private String devId; + + public SuModelData() { + } + + @Override + public String toString() { + return "SuModelData(super=" + super.toString() + ", pk=" + this.getPk() + ", devId=" + this.getDevId() + ")"; + } + + public String getPk() { + return this.pk; + } + + public String getDevId() { + return this.devId; + } + + public void setPk(String pk) { + this.pk = pk; + } + + public void setDevId(String devId) { + this.devId = devId; + } +} diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/TopoSub.java b/src/main/java/me/hekr/iotos/api/dto/klink/TopoSub.java new file mode 100644 index 0000000..ab31b7a --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/klink/TopoSub.java @@ -0,0 +1,67 @@ +package me.hekr.iotos.api.dto.klink; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +public class TopoSub { + protected String pk; + protected String devId; + private String random; + private String hashMethod; + private String sign; + + public TopoSub() { + } + + public String getPk() { + return this.pk; + } + + public String getDevId() { + return this.devId; + } + + public String getRandom() { + return this.random; + } + + public String getHashMethod() { + return this.hashMethod; + } + + public String getSign() { + return this.sign; + } + + public void setPk(String pk) { + this.pk = pk; + } + + public void setDevId(String devId) { + this.devId = devId; + } + + public void setRandom(String random) { + this.random = random; + } + + public void setHashMethod(String hashMethod) { + this.hashMethod = hashMethod; + } + + public void setSign(String sign) { + this.sign = sign; + } + + @Override + public String toString() { + return "TopoSub(super=" + super.toString() + ", pk=" + this.getPk() + ", devId=" + this.getDevId() + ", random=" + this.getRandom() + ", hashMethod=" + this.getHashMethod() + ", sign=" + this.getSign() + ")"; + } +} diff --git a/src/main/java/me/hekr/iotos/api/enums/Action.java b/src/main/java/me/hekr/iotos/api/enums/Action.java new file mode 100644 index 0000000..6404de4 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/enums/Action.java @@ -0,0 +1,141 @@ +package me.hekr.iotos.api.enums; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +//import iot.cloud.os.core.api.dto.klink.AddTopo; +//import iot.cloud.os.core.api.dto.klink.BatchDevSend; +//import iot.cloud.os.core.api.dto.klink.CloudSend; +//import iot.cloud.os.core.api.dto.klink.DelTopo; +//import iot.cloud.os.core.api.dto.klink.DevLogin; +//import iot.cloud.os.core.api.dto.klink.DevLogout; +//import iot.cloud.os.core.api.dto.klink.DevSend; +//import iot.cloud.os.core.api.dto.klink.DevUpgrade; +//import iot.cloud.os.core.api.dto.klink.DevUpgradeProgress; +//import iot.cloud.os.core.api.dto.klink.GetConfig; +//import iot.cloud.os.core.api.dto.klink.GetConfigResp; +//import iot.cloud.os.core.api.dto.klink.GetTopo; +//import iot.cloud.os.core.api.dto.klink.Klink; +//import iot.cloud.os.core.api.dto.klink.KlinkResp; +//import iot.cloud.os.core.api.dto.klink.NotSupport; +//import iot.cloud.os.core.api.dto.klink.Register; +//import iot.cloud.os.core.api.dto.klink.RegisterResp; +//import iot.cloud.os.core.api.dto.klink.ReportFirmware; +//import iot.cloud.os.core.api.enums.FrameType; +import java.util.Arrays; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import me.hekr.iotos.api.dto.klink.AddTopo; +import me.hekr.iotos.api.dto.klink.BatchDevSend; +import me.hekr.iotos.api.dto.klink.CloudSend; +import me.hekr.iotos.api.dto.klink.DelTopo; +import me.hekr.iotos.api.dto.klink.DevLogin; +import me.hekr.iotos.api.dto.klink.DevLogout; +import me.hekr.iotos.api.dto.klink.DevSend; +import me.hekr.iotos.api.dto.klink.DevUpgrade; +import me.hekr.iotos.api.dto.klink.DevUpgradeProgress; +import me.hekr.iotos.api.dto.klink.GetConfig; +import me.hekr.iotos.api.dto.klink.GetConfigResp; +import me.hekr.iotos.api.dto.klink.GetTopo; +import me.hekr.iotos.api.dto.klink.Klink; +import me.hekr.iotos.api.dto.klink.KlinkResp; +import me.hekr.iotos.api.dto.klink.NotSupport; +import me.hekr.iotos.api.dto.klink.Register; +import me.hekr.iotos.api.dto.klink.RegisterResp; +import me.hekr.iotos.api.dto.klink.ReportFirmware; + +public enum Action { + NOT_SUPPORT("_notSupport_"), + INNER_MQTT_SUB("innerMqttSub", FrameType.INNER), + INNER_MQTT_PUB("innerMqttPub", FrameType.INNER), + GATEWAY_LOGIN("gatewayLogin"), + GATEWAY_LOGOUT("gatewayLogout"), + DATA_CHANGED("dataChanged"), + CLOUD_SEND("cloudSend", FrameType.DEV_DOWN, CloudSend.class), + CLOUD_SEND_RESP("cloudSendResp", FrameType.DEV_UP, KlinkResp.class), + DEV_SEND("devSend", FrameType.DEV_UP, DevSend.class), + DEV_SEND_RESP("devSendResp", FrameType.DEV_DOWN), + BATCH_DEV_SEND("batchDevSend", FrameType.DEV_UP, BatchDevSend.class), + BATCH_DEV_SEND_RESP("batchDevSendResp", FrameType.DEV_DOWN), + DEV_LOGIN("devLogin", FrameType.DEV_UP, DevLogin.class), + DEV_LOGIN_RESP("devLoginResp", FrameType.DEV_DOWN), + DEV_LOGOUT("devLogout", FrameType.DEV_UP, DevLogout.class), + DEV_LOGOUT_RESP("devLogoutResp", FrameType.DEV_DOWN), + ADD_TOPO("addTopo", FrameType.DEV_UP, AddTopo.class), + ADD_TOPO_RESP("addTopoResp", FrameType.DEV_DOWN), + GET_TOPO("getTopo", FrameType.DEV_UP, GetTopo.class), + GET_TOPO_RESP("getTopoResp", FrameType.DEV_DOWN), + DEL_TOPO("delTopo", FrameType.DEV_UP, DelTopo.class), + DEL_TOPO_RESP("delTopoResp", FrameType.DEV_DOWN), + REPORT_FIRMWARE("reportFirmware", FrameType.DEV_UP, ReportFirmware.class), + REPORT_FIRMWARE_RESP("reportFirmwareResp", FrameType.DEV_DOWN), + DEV_UPGRADE_PROGRESS("devUpgradeProgress", FrameType.DEV_UP, DevUpgradeProgress.class), + DEV_UPGRADE_PROGRESS_RESP("devUpgradeProgressResp", FrameType.DEV_DOWN, KlinkResp.class), + DEV_UPGRADE("devUpgrade", FrameType.DEV_DOWN, DevUpgrade.class), + DEV_UPGRADE_RESP("devUpgradeResp", FrameType.DEV_UP, KlinkResp.class), + REGISTER("register", FrameType.DEV_UP, Register.class), + REGISTER_RESP("registerResp", FrameType.DEV_DOWN, RegisterResp.class), + GET_CONFIG("getConfig", FrameType.DEV_UP, GetConfig.class), + GET_CONFIG_RESP("getConfigResp", FrameType.DEV_DOWN, GetConfigResp.class); + + public static final String ACTION_NAME = "action"; + private static final Map ACTION_MAP = (Map)Arrays.stream(values()).collect(Collectors.toMap( + Action::getAction, Function.identity())); + private String action; + private Class klinkClass; + private FrameType frameType; + + private Action(String action, FrameType frameType, Class klinkClass) { + this.action = action; + this.frameType = frameType; + this.klinkClass = klinkClass; + } + + private Action(String action) { + this(action, (FrameType)null, NotSupport.class); + } + + private Action(String action, FrameType frameType) { + this(action, frameType, NotSupport.class); + } + + public static Action of(String action) { + return (Action)ACTION_MAP.getOrDefault(action, NOT_SUPPORT); + } + + public Action getPair() { + if (this.isResp()) { + return of(this.action.substring(0, this.getAction().indexOf("Resp"))); + } else { + return this.isSend() ? of(this.action + "Resp") : this; + } + } + + public boolean isResp() { + return this.action.endsWith("Resp"); + } + + public boolean isSend() { + return this != NOT_SUPPORT && !this.isResp(); + } + + public boolean isAsyncResp() { + return this == DEV_UPGRADE_RESP || this == CLOUD_SEND_RESP; + } + + public String getAction() { + return this.action; + } + + public Class getKlinkClass() { + return this.klinkClass; + } + + public FrameType getFrameType() { + return this.frameType; + } +} diff --git a/src/main/java/me/hekr/iotos/api/enums/CheckType.java b/src/main/java/me/hekr/iotos/api/enums/CheckType.java new file mode 100644 index 0000000..32ed636 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/enums/CheckType.java @@ -0,0 +1,18 @@ +package me.hekr.iotos.api.enums; + +public enum CheckType { + NONE("none"), + RANGE("range"), + ENUM("enum"), + LENGTH("length"); + + private String type; + + private CheckType(String type) { + this.type = type; + } + + public String getType() { + return this.type; + } +} diff --git a/src/main/java/me/hekr/iotos/api/enums/DataType.java b/src/main/java/me/hekr/iotos/api/enums/DataType.java new file mode 100644 index 0000000..018c5b0 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/enums/DataType.java @@ -0,0 +1,122 @@ +package me.hekr.iotos.api.enums; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +//import iot.cloud.os.core.api.dto.DataValueChecker; +//import iot.cloud.os.core.api.dto.DataValueEnumChecker; +//import iot.cloud.os.core.api.dto.DataValueLengthChecker; +//import iot.cloud.os.core.api.dto.DataValueNoneChecker; +import iot.cloud.os.core.api.dto.DataValueRangeChecker; + + +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.Set; +import java.util.stream.Collectors; +import me.hekr.iotos.api.dto.DataValueChecker; +import me.hekr.iotos.api.dto.DataValueEnumChecker; +import me.hekr.iotos.api.dto.DataValueLengthChecker; +import me.hekr.iotos.api.dto.DataValueNoneChecker; + +public enum DataType { + STRING(new Class[]{DataValueNoneChecker.class, DataValueLengthChecker.class, DataValueEnumChecker.class}) { + @Override + public String convert(Object obj) { + return String.valueOf(obj); + } + }, + INT(new Class[]{DataValueNoneChecker.class, DataValueRangeChecker.class, DataValueEnumChecker.class}) { + @Override + public Long convert(Object obj) { + if (obj instanceof Number) { + return ((Number)obj).longValue(); + } else { + throw new NumberFormatException(obj + " is not number"); + } + } + }, + FLOAT(new Class[]{DataValueNoneChecker.class, DataValueRangeChecker.class, DataValueEnumChecker.class}) { + @Override + public Double convert(Object obj) { + if (obj instanceof Number) { + return ((Number)obj).doubleValue(); + } else { + throw new NumberFormatException(obj + " is not number"); + } + } + }; + + private Set> supportCheckTypes; + + private DataType(Class... checkTypes) { + if (checkTypes != null && checkTypes.length != 0) { + this.supportCheckTypes = (Set)Arrays.stream(checkTypes).collect(Collectors.toSet()); + } else { + this.supportCheckTypes = Collections.emptySet(); + } + + } + + public static DataType fromValue(Object value) { + if (!(value instanceof Double) && !(value instanceof Float)) { + if (value instanceof Number) { + return INT; + } else { + return value instanceof String ? STRING : null; + } + } else { + return FLOAT; + } + } + + public static boolean isValid(DataType dataType, Object value) { + if (dataType == null) { + return false; + } else { + DataType type = fromValue(value); + if (type == null) { + return false; + } else { + return dataType == type || type == INT && dataType == FLOAT; + } + } + } + + public abstract T convert(Object var1); + + public boolean isEq(Object v1, Object v2) { + try { + return this.convert(v1).equals(this.convert(v2)); + } catch (Exception var4) { + return false; + } + } + + public boolean isSupport(DataValueChecker checkType) { + return checkType == null ? false : this.supportCheckTypes.contains(checkType.getClass()); + } + + public String getSupportCheckTypesDesc() throws IllegalAccessException, InstantiationException { + try { + if (this.supportCheckTypes == null) { + return ""; + } else { + StringBuilder desc = new StringBuilder(); + Iterator var2 = this.supportCheckTypes.iterator(); + + while(var2.hasNext()) { + Class clazz = (Class)var2.next(); + desc.append(((DataValueChecker)clazz.newInstance()).getType().getType()).append(","); + } + + return desc.length() == 0 ? desc.toString() : desc.deleteCharAt(desc.length() - 1).toString(); + } + } catch (Throwable var4) { + throw var4; + } + } +} diff --git a/src/main/java/me/hekr/iotos/api/enums/DeviceType.java b/src/main/java/me/hekr/iotos/api/enums/DeviceType.java new file mode 100644 index 0000000..0ebb5bd --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/enums/DeviceType.java @@ -0,0 +1,20 @@ +package me.hekr.iotos.api.enums; +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +public enum DeviceType { + GENERAL, + SWITCH, + GATEWAY, + TERMINAL; + + private DeviceType() { + } + + public static boolean isDirectConnectType(DeviceType deviceType) { + return deviceType == GENERAL || deviceType == GATEWAY; + } +} diff --git a/src/main/java/me/hekr/iotos/api/enums/ErrorCode.java b/src/main/java/me/hekr/iotos/api/enums/ErrorCode.java new file mode 100644 index 0000000..f477471 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/enums/ErrorCode.java @@ -0,0 +1,92 @@ +package me.hekr.iotos.api.enums; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import java.util.Arrays; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +public enum ErrorCode { + SUCCESS(0, "success"), + UNDEFINED(65535, "undefined"), + PARAM_INVALID(4000, "param invalid"), + JSON_PARSE_ERROR(1001, "json parse error"), + ACTION_NOT_SUPPORT(1002, "action not support"), + DEVICE_NOT_LOGIN(1003, "device not login"), + DEVICE_NOT_EXIST(1004, "device not exist"), + DEVICE_LOGIN_AUTH_FAILED(1005, "device login auth failed"), + DEVICE_NOT_SUPPORT_SUB_DEV(1006, "device not support sub device"), + DEVICE_TOPO_NOT_ALLOW_CIRCLE(1007, "device topo not allow circle"), + DEVICE_NOT_ONLINE(1008, "device not online"), + DEVICE_DISABLED(1009, "device is disabled"), + DEVICE_NOT_HAS_SUB_DEVICE(1010, "device not has the sub device"), + PRODUCT_NOT_EXIST(1104, "product not exist"), + PRODUCT_NOT_SUPPORT_REMOTE_CONFIG(1105, "product not support remote config"), + PRODUCT_DELETED(1106, "product deleted"), + DEVICE_IMEI_INVALID(1107, "device imei invalid"), + DEVICE_IMEI_EXIST(1108, "device imei exist"), + RULE_SELECT_PARAM_INVALID(1109, "rule select param not valid"), + RULE_EXPRESSION_INVALID(1110, "rule expression not valid"), + RULE_NOT_FOUND(1111, "rule not found"), + RULE_DEST_HTTP_NOT_VALID(1112, "rule dest http url not valid"), + MODEL_DATA_PARAM_INVALID(1113, "model params not valid"), + QUOTA_EXIST(1114, "quota exist"), + QUOTA_NOT_FOUND(1115, "quota not found"), + UPGRADE_TASK_ENABLE_CONFLICT(1116, "upgrade task enable conflict"), + UPGRADE_TASK_ENABLE_CYCLE(1117, "upgrade task has cycle"), + UPGRADE_TASK_NOT_FOUND(1118, "upgrade task not found"), + AVAILABLE_REMOTE_CONFIG_NOT_FOUND(1119, "available remote config not found"), + QUOTA_INSUFFICIENT(1120, "quota insufficient"), + MODEL_DATA_PARAM_NAME_CONFLICT(1121, "model data param name conflict"), + MODEL_DATA_PARAM_IDENTIFIER_CONFLICT(1122, "model data param identifier conflict"), + MODEL_DATA_CMD_NAME_CONFLICT(1123, "model data cmd name conflict"), + MODEL_DATA_CMD_IDENTIFIER_CONFLICT(1124, "model data cmd identifier conflict"), + DEV_ID_INVALID(1125, "devId invalid"), + DEV_ID_EXIST(1126, "device id exist"), + PRODUCT_NOT_ALLOW_DELETE_DEVICE_EXIST(1127, "product has devices not allow to delete"), + DEVICE_NOT_ALLOW_TO_DIRECT_CONNECT(1128, "device(sub) not allow to direct connect"), + DEVICE_GATEWAY_NOT_ONLINE(1129, "device's gateway not online"), + PRODUCT_SCRIPT_NOT_RUNNING(1130, "product script not running or not exist"), + PRODUCT_SCRIPT_ENCODE_ERROR(1131, "product script encode error"), + PRODUCT_SCRIPT_DECODE_ERROR(1132, "product script decode error"), + PRODUCT_NOT_SUPPORT_SCRIPT(1133, "product not support script"), + PRODUCT_SCRIPT_RETURN_VALUE_INVALID(1134, "product script return value invalid"), + PRODUCT_SCRIPT_COMPILE_ERROR(1135, "product script compile error"), + DEVICE_NOT_SUPPORT_BATCH_DEV_SEND(1136, "device not support batch dev send, only gateway support"), + DEVICE_TOPO_NOT_EXIST(1137, "device topo not exist"), + PAYLOAD_IS_EMPTY(1138, "payload is empty"), + DEVICE_LOGIN_TOO_FREQUENTLY(1139, "device login too frequently"), + TAG_KEY_INVALID(1140, "tag key invalid, not allow null or start or end of blank"), + TAG_KEY_DUPLICATED(1141, "tag key duplicated"), + REMOTE_CONFIG_MULTI_DEVICE(1142, "remote config devices count max is one"), + REMOTE_CONFIG_NOT_EXIST(1143, "remote config not exist"), + PRODUCT_EXIST(1144, "product exist"), + INTERNAL_ERROR(500, "internal error"); + + private static final Map ERROR_CODE_MAP = (Map)Arrays.stream(values()).collect(Collectors.toMap( + ErrorCode::getCode, Function.identity())); + private int code; + private String desc; + + private ErrorCode(int code, String desc) { + this.code = code; + this.desc = desc; + } + + public static ErrorCode of(int code) { + return (ErrorCode)ERROR_CODE_MAP.getOrDefault(code, UNDEFINED); + } + + public int getCode() { + return this.code; + } + + public String getDesc() { + return this.desc; + } +} diff --git a/src/main/java/me/hekr/iotos/api/enums/FrameType.java b/src/main/java/me/hekr/iotos/api/enums/FrameType.java new file mode 100644 index 0000000..4ef7cd4 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/enums/FrameType.java @@ -0,0 +1,34 @@ +package me.hekr.iotos.api.enums; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import java.util.Arrays; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +public enum FrameType { + DEV_UP("up"), + DEV_DOWN("down"), + DEV_UP_DOWN("up_down"), + INNER("inner"); + + private static final Map TYPE_MAP = (Map)Arrays.stream(values()).collect(Collectors.toMap(FrameType::getType, Function.identity())); + private String type; + + private FrameType(String type) { + this.type = type; + } + + public static FrameType of(String action) { + return (FrameType)TYPE_MAP.get(action); + } + + public String getType() { + return this.type; + } +} diff --git a/src/main/java/me/hekr/iotos/api/enums/MessageSourceType.java b/src/main/java/me/hekr/iotos/api/enums/MessageSourceType.java new file mode 100644 index 0000000..2f65c7d --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/enums/MessageSourceType.java @@ -0,0 +1,16 @@ +package me.hekr.iotos.api.enums; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +public enum MessageSourceType { + MQTT, + REDIS_STEAM; + + private MessageSourceType() { + } +} + diff --git a/src/main/java/me/hekr/iotos/api/service/RetrofitIotService.java b/src/main/java/me/hekr/iotos/api/service/RetrofitIotService.java index 42ce58e..fa7f992 100644 --- a/src/main/java/me/hekr/iotos/api/service/RetrofitIotService.java +++ b/src/main/java/me/hekr/iotos/api/service/RetrofitIotService.java @@ -1,28 +1,40 @@ package me.hekr.iotos.api.service; -import iot.cloud.os.common.utils.JsonUtil; -import iot.cloud.os.core.api.dto.ModelProtocolDTO; -import iot.cloud.os.core.api.dto.Snapshot; -import iot.cloud.os.core.api.dto.klink.AddTopoResp; -import iot.cloud.os.core.api.enums.ErrorCode; +//import iot.cloud.os.core.api.dto.DeviceDTO; +//import iot.cloud.os.core.api.dto.ModelProtocolDTO; +//import iot.cloud.os.core.api.dto.Snapshot; +//import iot.cloud.os.core.api.dto.klink.AddTopoResp; +//import iot.cloud.os.core.api.dto.klink.DelTopoResp; +//import iot.cloud.os.core.api.dto.klink.KlinkResp; +//import iot.cloud.os.core.api.dto.klink.ModelData; +//import iot.cloud.os.core.api.dto.klink.TopoSub; +//import iot.cloud.os.core.api.enums.DeviceType; + import java.util.List; import java.util.Map; -import lombok.SneakyThrows; -import me.hekr.iotos.api.IotErrorResponse; import me.hekr.iotos.api.dto.BatchAddDeviceResp; +import me.hekr.iotos.api.dto.CloudSendMsgDTO; +import me.hekr.iotos.api.dto.DelTopoResp; import me.hekr.iotos.api.dto.DevIdListReq; import me.hekr.iotos.api.dto.Device; import me.hekr.iotos.api.dto.DeviceAddReq; +import me.hekr.iotos.api.dto.DeviceApiDTO; +import me.hekr.iotos.api.dto.DeviceDTO; import me.hekr.iotos.api.dto.DevicePacketResp; import me.hekr.iotos.api.dto.DeviceUpdateNameReq; import me.hekr.iotos.api.dto.LoginRsp; +import me.hekr.iotos.api.dto.ModelProtocolDTO; import me.hekr.iotos.api.dto.Product; -import me.hekr.iotos.api.exception.IotException; +import me.hekr.iotos.api.dto.Snapshot; +import me.hekr.iotos.api.dto.klink.AddTopoResp; +import me.hekr.iotos.api.dto.klink.KlinkResp; +import me.hekr.iotos.api.dto.klink.ModelData; +import me.hekr.iotos.api.dto.klink.TopoSub; +import me.hekr.iotos.api.enums.DeviceType; import me.hekr.iotos.api.util.Pagec; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import retrofit2.Call; -import retrofit2.Response; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; @@ -183,4 +195,151 @@ public interface RetrofitIotService { */ @GET("/api/device/getSnapshot") Call getSnapshot(@Query("pk") String pk, @Query("devId") String devId); + + // =================================================== + // ==================================================== + + /** + * @param reqDto + * @return + */ + @POST("/api/device/addDevice") + DeviceApiDTO addDevice(@Query("reqDto") DeviceAddReq reqDto); + + /** + * @param devIdListReq + * @return + */ + @POST("/api/device/batchAddDevices") + Map batchAddDevices(@Query("devIdListReq") DevIdListReq devIdListReq); + + /** + * @param pk + * @param keyword + * @param page + * @param deviceType + * @param online + * @param size + * @return + */ + @GET("/api/device/getDeviceList") + public Pagec getDeviceList( + @Query("pk") String pk, + @Query("keyword") String keyword, + @Query("page") int page, + @Query("deviceType") DeviceType deviceType, + @Query("online") Boolean online, + @Query("size") int size); + + /** @param reqDto */ + @PUT("/api/device/updateName") + public void updateName(@Query("reqDto") DeviceAddReq reqDto); + + /** @param reqDto */ + @PUT("/api/device/updateTags") + public void updateTags(@Query("reqDto") DeviceAddReq reqDto); + + /** + * @param pk + * @param devId + * @return + */ + @GET("/api/device/deviceInfo/{pk}/{devId}") + public DeviceApiDTO deviceInfo(@Path("pk") String pk, @Path("devId") String devId); + + /** + * @param pk + * @param devId + * @return + */ + @GET("/api/device/getSnapshot") + public Snapshot getDeviceSnapshot(@Query("pk") String pk, @Query("devId") String devId); + + /** + * @param pk + * @param devId + * @param delSnapshot + */ + @DELETE("/api/device/delDevice/{pk}/{devId}") + public void delDevice( + @Path("pk") String pk, @Path("devId") String devId, @Path("delSnapshot") boolean delSnapshot); + + /** @param deviceList */ + @DELETE("/api/device/batchDelDevice") + public void bathDelDevice(@Query("deviceList") List deviceList); + + /** + * @param pk + * @param devId + * @param startTime + * @param endTime + * @param action + * @param page + * @param size + * @return + */ + @GET("/api/device/getDeviceHistoryData/{pk}/{devId}") + public List getDeviceHistoryData( + @Path("pk") String pk, + @Path("devId") String devId, + @Path("startTime") Long startTime, + @Path("endTime") Long endTime, + @Path("action") String action, + @Path("page") int page, + @Path("size") int size); + + /** + * @param pk + * @param devId + * @param data + * @return + */ + @POST("/api/device/cloudSend/{pk}/{devId}") + public KlinkResp deviceCloudSend( + @Path("pk") String pk, @Path("devId") String devId, @Path("data") ModelData data); + + /** + * @param messageId + * @return + */ + @GET("/api/device/cloudSendMsgInfo/{messageId}") + public CloudSendMsgDTO cloudSendMsgInfo(@Path("messageId") String messageId); + + /** + * @param page + * @param size + * @param pk + * @param devId + * @param startTime + * @param endTime + * @return + */ + @GET("/api/device/cloudSendMsgList") + public Pagec cloudSendMsgList( + @Query("page") Integer page, + @Query("size") Integer size, + @Query("pk") String pk, + @Query("devId") String devId, + @Query("startTime") Long startTime, + @Query("endTime") Long endTime); + + /** + * @param pk + * @param devId + * @param sub + * @return + */ + @PUT("/api/device/addTopo/{pk}/{devId}") + public AddTopoResp addTopo( + @Path("pk") String pk, @Path("devId") String devId, @Path("sub") TopoSub sub); + + /** + * @param pk + * @param devId + * @param sub + * @return + */ + @PUT("/api/device/delTopo/{pk}/{devId}") + public DelTopoResp delTopo( + @Path("pk") String pk, @Path("devId") String devId, @Path("sub") TopoSub sub); } diff --git a/src/main/java/me/hekr/iotos/api/util/JsonUtil.java b/src/main/java/me/hekr/iotos/api/util/JsonUtil.java new file mode 100644 index 0000000..96467b1 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/util/JsonUtil.java @@ -0,0 +1,107 @@ +package me.hekr.iotos.api.util; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import org.apache.commons.codec.binary.Base64; + +public class JsonUtil { + private static ObjectMapper objectMapper = new ObjectMapper(); + + public JsonUtil() { + } + + public static JsonNode parse(String str) throws IOException { + try { + return (JsonNode)objectMapper.readValue(str, JsonNode.class); + } catch (Throwable var2) { + throw var2; + } + } + + public static String toJson(Object obj) throws JsonProcessingException { + try { + return objectMapper.writeValueAsString(obj); + } catch (Throwable var2) { + throw var2; + } + } + + public static byte[] toBytes(Object obj) throws JsonProcessingException { + try { + return objectMapper.writeValueAsBytes(obj); + } catch (Throwable var2) { + throw var2; + } + } + + public static String toBase64(Object obj) throws JsonProcessingException { + try { + return Base64.encodeBase64String(objectMapper.writeValueAsBytes(obj)); + } catch (Throwable var2) { + throw var2; + } + } + + public static T fromJson(String payload, Class tClass) throws IOException { + try { + return objectMapper.readValue(payload, tClass); + } catch (Throwable var3) { + throw var3; + } + } + + public static T fromJson(String payload, TypeReference tTypeReference) throws IOException { + try { + return objectMapper.readValue(payload, tTypeReference); + } catch (Throwable var3) { + throw var3; + } + } + + public static T fromBase64(String payload, Class tClass) throws IOException { + try { + return objectMapper.readValue(Base64.decodeBase64(payload), tClass); + } catch (Throwable var3) { + throw var3; + } + } + + public static T fromBytes(byte[] payload, Class tClass) throws IOException { + try { + return objectMapper.readValue(payload, tClass); + } catch (Throwable var3) { + throw var3; + } + } + + public static T fromBase64(String payload, TypeReference tTypeReference) + throws IOException { + try { + return objectMapper.readValue(Base64.decodeBase64(payload), tTypeReference); + } catch (Throwable var3) { + throw var3; + } + } + + public static T convert(Object obj, Class clazz) { + return objectMapper.convertValue(obj, clazz); + } + + public static T convert(Object obj, TypeReference tTypeReference) { + return objectMapper.convertValue(obj, tTypeReference); + } + + static { + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).configure(DeserializationFeature.FAIL_ON_TRAILING_TOKENS, true); + } +} -- Gitee From f6fdff51a746f6bde883a4e9c60db46b121ca948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=A1=E8=B4=A4=E7=A5=A5?= Date: Tue, 7 Sep 2021 18:25:38 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 19 ++ .idea/codeStyles/codeStyleConfig.xml | 5 + pom.xml | 31 +- .../java/me/hekr/iotos/api/IotClient.java | 170 +++++----- .../hekr/iotos/api/dto/DataValueChecker.java | 7 +- .../iotos/api/dto/DataValueEnumChecker.java | 6 +- .../iotos/api/dto/DataValueLengthChecker.java | 7 +- .../iotos/api/dto/DataValueRangeChecker.java | 5 - .../me/hekr/iotos/api/dto/DelTopoResp.java | 5 - .../java/me/hekr/iotos/api/dto/Device.java | 4 +- .../me/hekr/iotos/api/dto/DeviceApiDTO.java | 6 +- .../java/me/hekr/iotos/api/dto/DeviceDTO.java | 8 +- .../hekr/iotos/api/dto/DevicePacketResp.java | 1 - .../java/me/hekr/iotos/api/dto/IpInfo.java | 4 +- .../me/hekr/iotos/api/dto/ModelCmdDTO.java | 1 - .../me/hekr/iotos/api/dto/ModelParamDTO.java | 4 - .../java/me/hekr/iotos/api/dto/Product.java | 4 +- .../me/hekr/iotos/api/dto/ProductDTO.java | 201 ++++++++++++ .../java/me/hekr/iotos/api/dto/Snapshot.java | 5 +- src/main/java/me/hekr/iotos/api/dto/Tag.java | 4 +- .../me/hekr/iotos/api/dto/klink/AddTopo.java | 3 - .../hekr/iotos/api/dto/klink/AddTopoResp.java | 6 - .../iotos/api/dto/klink/BatchDevSend.java | 4 +- .../hekr/iotos/api/dto/klink/CloudSend.java | 3 - .../me/hekr/iotos/api/dto/klink/DelTopo.java | 4 - .../me/hekr/iotos/api/dto/klink/DevLogin.java | 4 - .../hekr/iotos/api/dto/klink/DevLogout.java | 4 - .../me/hekr/iotos/api/dto/klink/DevSend.java | 5 - .../hekr/iotos/api/dto/klink/DevUpgrade.java | 7 +- .../api/dto/klink/DevUpgradeProgress.java | 8 +- .../hekr/iotos/api/dto/klink/GetConfig.java | 3 - .../iotos/api/dto/klink/GetConfigResp.java | 8 +- .../me/hekr/iotos/api/dto/klink/GetTopo.java | 2 - .../me/hekr/iotos/api/dto/klink/Klink.java | 1 + .../me/hekr/iotos/api/dto/klink/KlinkDev.java | 2 +- .../hekr/iotos/api/dto/klink/KlinkResp.java | 3 +- .../hekr/iotos/api/dto/klink/ModelData.java | 4 +- .../hekr/iotos/api/dto/klink/NotSupport.java | 3 - .../me/hekr/iotos/api/dto/klink/Register.java | 7 +- .../iotos/api/dto/klink/RegisterResp.java | 8 +- .../iotos/api/dto/klink/ReportFirmware.java | 2 - .../hekr/iotos/api/dto/klink/SuModelData.java | 1 - .../java/me/hekr/iotos/api/enums/Action.java | 19 -- .../hekr/iotos/api/enums/DataCheckMode.java | 17 + .../me/hekr/iotos/api/enums/DataFormat.java | 21 ++ .../me/hekr/iotos/api/enums/DataType.java | 8 +- .../me/hekr/iotos/api/enums/ErrorCode.java | 8 +- .../me/hekr/iotos/api/enums/TransferType.java | 6 +- .../iotos/api/service/RetrofitIotService.java | 300 +++++++++++------- .../java/me/hekr/iotos/api/IotClientTest.java | 223 ++++++++++++- 50 files changed, 806 insertions(+), 385 deletions(-) create mode 100644 .editorconfig create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 src/main/java/me/hekr/iotos/api/dto/ProductDTO.java create mode 100644 src/main/java/me/hekr/iotos/api/enums/DataCheckMode.java create mode 100644 src/main/java/me/hekr/iotos/api/enums/DataFormat.java diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..2277400 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +[*] +charset=utf-8 +end_of_line=crlf +insert_final_newline=false +indent_style=space +indent_size=2 + +[*.properties] +indent_style=space +indent_size=4 + +[.editorconfig] +indent_style=space +indent_size=4 + +[{*.gy,*.groovy,*.gant,*.gradle,*.gdsl}] +indent_style=space +indent_size=4 + diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..6df95bc --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index ceb00c6..1587461 100644 --- a/pom.xml +++ b/pom.xml @@ -120,21 +120,22 @@ - - iot.cloud.os - cloud-os-core-api - 0.0.8 - - - org.springframework.boot - spring-boot - - - org.springframework - spring-beans - - - + + + + + + + + + + + + + + + + junit junit diff --git a/src/main/java/me/hekr/iotos/api/IotClient.java b/src/main/java/me/hekr/iotos/api/IotClient.java index 0b1fa2f..79ff068 100644 --- a/src/main/java/me/hekr/iotos/api/IotClient.java +++ b/src/main/java/me/hekr/iotos/api/IotClient.java @@ -2,17 +2,6 @@ package me.hekr.iotos.api; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -//import iot.cloud.os.common.utils.JsonUtil; -//import iot.cloud.os.core.api.dto.DeviceDTO; -//import iot.cloud.os.core.api.dto.ModelProtocolDTO; -//import iot.cloud.os.core.api.dto.Snapshot; -//import iot.cloud.os.core.api.dto.klink.AddTopoResp; -//import iot.cloud.os.core.api.dto.klink.DelTopoResp; -//import iot.cloud.os.core.api.dto.klink.KlinkResp; -//import iot.cloud.os.core.api.dto.klink.ModelData; -//import iot.cloud.os.core.api.dto.klink.TopoSub; -//import iot.cloud.os.core.api.enums.DeviceType; -//import iot.cloud.os.core.api.enums.ErrorCode; import java.net.URLEncoder; import java.util.List; import java.util.Map; @@ -56,6 +45,8 @@ import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.jackson.JacksonConverterFactory; + + public class IotClient { private static final String MAC_NAME = "HmacSHA1"; private static final ObjectMapper objectMapper = new ObjectMapper(); @@ -251,115 +242,118 @@ public class IotClient { } /** - * \ - * @param page - * @param size - * @return - */ - Call> getProduct(int page, int size) { - return retrofitIotService.getProduct(page, size); - } - - /** + * 获取产品列表 * - * @param pk - * @param devId + *

获取产品列表 + * + * @param page 当前页,从0开始 + * @param size 分页大小,最大100,最小1 * @return */ - Call addTopo(String pk, String devId) { - return retrofitIotService.addTopo(pk, devId); + public Pagec getProduct(int page, int size) { + return execute(retrofitIotService.getProduct(page, size)); } + /** + * 网关添加子设备 * * @param req * @return */ - Call addTopo(DevIdListReq req) { - return retrofitIotService.addTopo(req); + public BatchAddDeviceResp addTopo(DevIdListReq req) { + return execute(retrofitIotService.addTopo(req)); } /** + * 获取批次下所有设备 * * @param pk * @param batchName * @return */ - Call> getBatchDevices(String pk, String batchName) { - return retrofitIotService.getBatchDevices(pk, batchName); - } - - Call> getDeviceList(Map params) { - return retrofitIotService.getDeviceList(params); + public List getBatchDevices(String pk, String batchName) { + return execute(retrofitIotService.getBatchDevices(pk, batchName)); } /** + * 查询设备列表 * - * @param req + * @param params * @return */ - Call getDeviceList(DeviceUpdateNameReq req) { - return retrofitIotService.getDeviceList(req); + public Pagec getDeviceList(Map params) { + return execute(retrofitIotService.getDeviceList(params)); } /** + * * + * + *

更改设备名称 * * @param req * @return */ - Call getDeviceStatus(DevIdListReq req) { - return retrofitIotService.getDeviceStatus(req); + public void updateName(DeviceUpdateNameReq req) { + execute(retrofitIotService.updateName(req)); } /** + * * * - * @param pk - * @param devId - * @return - */ - Call getDeviceStatus(String pk, String devId) { - return retrofitIotService.getDeviceStatus(pk, devId); - } - - /** + *

批量查询状态 * - * @param pk - * @param devId + * @param req * @return */ - Call getDeviceHistoryData(String pk, String devId) { - return retrofitIotService.getDeviceHistoryData(pk, devId); + public Device getDeviceStatus(DevIdListReq req) { + return execute(retrofitIotService.getDeviceStatus(req)); } /** + * 删除设备 * * @param pk * @param devId * @return */ - Call getSnapshot(String pk, String devId) { - return retrofitIotService.getSnapshot(pk, devId); + public Device delDevice(String pk, String devId) { + return execute(retrofitIotService.delDevice(pk, devId)); } +// /** +// * 查询历史上下行数据"> +// * +// * @param pk +// * @param devId +// * @return +// */ +// public DevicePacketResp getDeviceHistoryData(String pk, String devId) { +// return execute(retrofitIotService.getDeviceHistoryData(pk, devId)); +// } + /** + * 新增设备 * * @param reqDto * @return */ - DeviceApiDTO addDevice(DeviceAddReq reqDto) { - return retrofitIotService.addDevice(reqDto); + public DeviceApiDTO addDevice(DeviceAddReq reqDto) { + return execute(retrofitIotService.addDevice(reqDto)); } /** + * 导入设备 * * @param devIdListReq * @return */ - Map batchAddDevices(DevIdListReq devIdListReq) { - return retrofitIotService.batchAddDevices(devIdListReq); + public Map batchAddDevices(DevIdListReq devIdListReq) { + return execute(retrofitIotService.batchAddDevices(devIdListReq)); } /** + * 查询设备列表 * * @param pk * @param keyword @@ -371,64 +365,71 @@ public class IotClient { */ public Pagec getDeviceList( String pk, String keyword, int page, DeviceType deviceType, Boolean online, int size) { - return retrofitIotService.getDeviceList(pk, keyword, page, deviceType, online, size); + return execute(retrofitIotService.getDeviceList(pk, keyword, page, deviceType, online, size)); } - /** - * - * @param reqDto - */ - public void updateName(DeviceAddReq reqDto) { - retrofitIotService.updateName(reqDto); - } + // /** + // * 更改设备名称 + // * + // * @param reqDto + // */ + // public Call updateName(DeviceUpdateNameReq reqDto) { + // retrofitIotService.updateName(reqDto); + // } /** + * ???? * * @param reqDto */ public void updateTags(DeviceAddReq reqDto) { - retrofitIotService.updateTags(reqDto); + execute(retrofitIotService.updateTags(reqDto)); } /** + * 查询设备详情 * * @param pk * @param devId * @return */ public DeviceApiDTO deviceInfo(String pk, String devId) { - return retrofitIotService.deviceInfo(pk, devId); + return execute(retrofitIotService.deviceInfo(pk, devId)); } /** + * 查询设备影子 * * @param pk * @param devId * @return */ public Snapshot getDeviceSnapshot(String pk, String devId) { - return retrofitIotService.getDeviceSnapshot(pk, devId); + return execute(retrofitIotService.getDeviceSnapshot(pk, devId)); } /** + * 删除设备 * * @param pk * @param devId * @param delSnapshot */ public void delDevice(String pk, String devId, boolean delSnapshot) { - retrofitIotService.delDevice(pk, devId, delSnapshot); + execute(retrofitIotService.delDevice(pk, devId, delSnapshot)); } /** + * 批量查删除设备 * * @param deviceList */ public void bathDelDevice(List deviceList) { - retrofitIotService.bathDelDevice(deviceList); + execute(retrofitIotService.bathDelDevice(deviceList)); } /** + * 查询历史上下行数 * * @param pk * @param devId @@ -441,11 +442,12 @@ public class IotClient { */ public List getDeviceHistoryData( String pk, String devId, Long startTime, Long endTime, String action, int page, int size) { - return retrofitIotService.getDeviceHistoryData( - pk, devId, startTime, endTime, action, page, size); + return execute(retrofitIotService.getDeviceHistoryData( + pk, devId, startTime, endTime, action, page, size)); } /** + * 下发控制命令 * * @param pk * @param devId @@ -453,19 +455,21 @@ public class IotClient { * @return */ public KlinkResp deviceCloudSend(String pk, String devId, ModelData data) { - return retrofitIotService.deviceCloudSend(pk, devId, data); + return execute(retrofitIotService.deviceCloudSend(pk, devId, data)); } /** + * 查询命令状态 * * @param messageId * @return */ public CloudSendMsgDTO cloudSendMsgInfo(String messageId) { - return retrofitIotService.cloudSendMsgInfo(messageId); + return execute(retrofitIotService.cloudSendMsgInfo(messageId)); } /** + * * 查询历史控制命令 * * @param page * @param size @@ -477,37 +481,33 @@ public class IotClient { */ public Pagec cloudSendMsgList( Integer page, Integer size, String pk, String devId, Long startTime, Long endTime) { - return retrofitIotService.cloudSendMsgList(page, size, pk, devId, startTime, endTime); + return execute(retrofitIotService.cloudSendMsgList(page, size, pk, devId, startTime, endTime)); } /** + * 网关添加子设备 * * @param pk * @param devId * @param sub * @return */ - public AddTopoResp addTopo(String pk,String devId, TopoSub sub){ - return retrofitIotService.addTopo(pk, devId,sub); + public AddTopoResp addTopo(String pk, String devId, TopoSub sub) { + return execute(retrofitIotService.addTopo(pk, devId, sub)); } /** + * 网关删除子设备 * * @param pk * @param devId * @param sub * @return */ - public DelTopoResp delTopo(String pk,String devId,TopoSub sub){ - return retrofitIotService.delTopo(pk, devId, sub); + public DelTopoResp delTopo(String pk, String devId, TopoSub sub) { + return execute(retrofitIotService.delTopo(pk, devId, sub)); } - - - - - - @Data public static class Builder { private String host; diff --git a/src/main/java/me/hekr/iotos/api/dto/DataValueChecker.java b/src/main/java/me/hekr/iotos/api/dto/DataValueChecker.java index 80ff06e..9589423 100644 --- a/src/main/java/me/hekr/iotos/api/dto/DataValueChecker.java +++ b/src/main/java/me/hekr/iotos/api/dto/DataValueChecker.java @@ -10,14 +10,9 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -//import iot.cloud.os.core.api.dto.DataValueEnumChecker; -//import iot.cloud.os.core.api.dto.DataValueLengthChecker; -//import iot.cloud.os.core.api.dto.DataValueNoneChecker; -//import iot.cloud.os.core.api.dto.DataValueRangeChecker; import me.hekr.iotos.api.enums.CheckType; import me.hekr.iotos.api.enums.DataType; -//import iot.cloud.os.core.api.enums.CheckType; -//import iot.cloud.os.core.api.enums.DataType; + @JsonTypeInfo( use = Id.NAME, diff --git a/src/main/java/me/hekr/iotos/api/dto/DataValueEnumChecker.java b/src/main/java/me/hekr/iotos/api/dto/DataValueEnumChecker.java index 5d339bc..efb599c 100644 --- a/src/main/java/me/hekr/iotos/api/dto/DataValueEnumChecker.java +++ b/src/main/java/me/hekr/iotos/api/dto/DataValueEnumChecker.java @@ -8,14 +8,12 @@ package me.hekr.iotos.api.dto; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonTypeName; -import iot.cloud.os.core.api.dto.DataValueChecker; -import iot.cloud.os.core.api.dto.ModelParamValue; -import iot.cloud.os.core.api.enums.CheckType; -import iot.cloud.os.core.api.enums.DataType; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; +import me.hekr.iotos.api.enums.CheckType; +import me.hekr.iotos.api.enums.DataType; @JsonTypeName("ENUM") public class DataValueEnumChecker implements DataValueChecker { diff --git a/src/main/java/me/hekr/iotos/api/dto/DataValueLengthChecker.java b/src/main/java/me/hekr/iotos/api/dto/DataValueLengthChecker.java index 01bb3fd..238dc91 100644 --- a/src/main/java/me/hekr/iotos/api/dto/DataValueLengthChecker.java +++ b/src/main/java/me/hekr/iotos/api/dto/DataValueLengthChecker.java @@ -7,10 +7,9 @@ package me.hekr.iotos.api.dto; import com.fasterxml.jackson.annotation.JsonTypeName; -import iot.cloud.os.core.api.dto.DataValueChecker; -import iot.cloud.os.core.api.dto.ModelParamValue; -import iot.cloud.os.core.api.enums.CheckType; -import iot.cloud.os.core.api.enums.DataType; +import me.hekr.iotos.api.enums.CheckType; +import me.hekr.iotos.api.enums.DataType; + @JsonTypeName("LENGTH") public class DataValueLengthChecker implements DataValueChecker { diff --git a/src/main/java/me/hekr/iotos/api/dto/DataValueRangeChecker.java b/src/main/java/me/hekr/iotos/api/dto/DataValueRangeChecker.java index e1597fa..4b17ef7 100644 --- a/src/main/java/me/hekr/iotos/api/dto/DataValueRangeChecker.java +++ b/src/main/java/me/hekr/iotos/api/dto/DataValueRangeChecker.java @@ -8,14 +8,9 @@ package me.hekr.iotos.api.dto; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonInclude.Include; -//import iot.cloud.os.core.api.dto.DataValueChecker; -//import iot.cloud.os.core.api.dto.ModelParamValue; import me.hekr.iotos.api.enums.CheckType; import me.hekr.iotos.api.enums.DataType; -//import iot.cloud.os.core.api.enums.CheckType; -//import iot.cloud.os.core.api.enums.DataType; - @JsonTypeName("RANGE") @JsonInclude(Include.NON_NULL) public class DataValueRangeChecker implements DataValueChecker { diff --git a/src/main/java/me/hekr/iotos/api/dto/DelTopoResp.java b/src/main/java/me/hekr/iotos/api/dto/DelTopoResp.java index 7e5f4db..f93c6e7 100644 --- a/src/main/java/me/hekr/iotos/api/dto/DelTopoResp.java +++ b/src/main/java/me/hekr/iotos/api/dto/DelTopoResp.java @@ -6,11 +6,6 @@ package me.hekr.iotos.api.dto; // -//import iot.cloud.os.core.api.dto.klink.Dev; -//import iot.cloud.os.core.api.dto.klink.KlinkResp; -//import iot.cloud.os.core.api.enums.Action; -//import iot.cloud.os.core.api.enums.ErrorCode; - import me.hekr.iotos.api.dto.klink.Dev; import me.hekr.iotos.api.dto.klink.KlinkResp; import me.hekr.iotos.api.enums.Action; diff --git a/src/main/java/me/hekr/iotos/api/dto/Device.java b/src/main/java/me/hekr/iotos/api/dto/Device.java index 902f2cf..b01cddb 100644 --- a/src/main/java/me/hekr/iotos/api/dto/Device.java +++ b/src/main/java/me/hekr/iotos/api/dto/Device.java @@ -1,14 +1,12 @@ package me.hekr.iotos.api.dto; import com.fasterxml.jackson.annotation.JsonInclude; -import iot.cloud.os.core.api.dto.IpInfo; -import iot.cloud.os.core.api.dto.Tag; -import iot.cloud.os.core.api.enums.DeviceType; import java.io.Serializable; import java.util.Date; import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; +import me.hekr.iotos.api.enums.DeviceType; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; diff --git a/src/main/java/me/hekr/iotos/api/dto/DeviceApiDTO.java b/src/main/java/me/hekr/iotos/api/dto/DeviceApiDTO.java index edb1abf..76a65e9 100644 --- a/src/main/java/me/hekr/iotos/api/dto/DeviceApiDTO.java +++ b/src/main/java/me/hekr/iotos/api/dto/DeviceApiDTO.java @@ -1,18 +1,16 @@ package me.hekr.iotos.api.dto; import com.fasterxml.jackson.annotation.JsonInclude; -import iot.cloud.os.core.api.dto.IpInfo; -import iot.cloud.os.core.api.dto.Tag; -import iot.cloud.os.core.api.enums.DeviceType; import java.io.Serializable; import java.util.Date; import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; +import me.hekr.iotos.api.enums.DeviceType; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; - +@Data public class DeviceApiDTO implements Serializable { private static final long serialVersionUID = 6148192738636573612L; diff --git a/src/main/java/me/hekr/iotos/api/dto/DeviceDTO.java b/src/main/java/me/hekr/iotos/api/dto/DeviceDTO.java index 2537e68..768b923 100644 --- a/src/main/java/me/hekr/iotos/api/dto/DeviceDTO.java +++ b/src/main/java/me/hekr/iotos/api/dto/DeviceDTO.java @@ -8,10 +8,6 @@ package me.hekr.iotos.api.dto; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; -//import iot.cloud.os.core.api.dto.IpInfo; -//import iot.cloud.os.core.api.dto.Tag; -//import iot.cloud.os.core.api.enums.DeviceType; -//import iot.cloud.os.core.api.enums.MessageSourceType; import java.io.Serializable; import java.util.Date; import java.util.List; @@ -310,7 +306,7 @@ public class DeviceDTO implements Serializable { public boolean equals(Object o) { if (o == this) { return true; - } else if (!(o instanceof iot.cloud.os.core.api.dto.DeviceDTO)) { + } else if (!(o instanceof DeviceDTO)) { return false; } else { DeviceDTO other = (DeviceDTO)o; @@ -343,7 +339,7 @@ public class DeviceDTO implements Serializable { } protected boolean canEqual(Object other) { - return other instanceof iot.cloud.os.core.api.dto.DeviceDTO; + return other instanceof DeviceDTO; } } diff --git a/src/main/java/me/hekr/iotos/api/dto/DevicePacketResp.java b/src/main/java/me/hekr/iotos/api/dto/DevicePacketResp.java index 7ed4e66..ac817c9 100644 --- a/src/main/java/me/hekr/iotos/api/dto/DevicePacketResp.java +++ b/src/main/java/me/hekr/iotos/api/dto/DevicePacketResp.java @@ -1,6 +1,5 @@ package me.hekr.iotos.api.dto; -import iot.cloud.os.core.api.dto.IpInfo; import lombok.Data; /** @author du */ diff --git a/src/main/java/me/hekr/iotos/api/dto/IpInfo.java b/src/main/java/me/hekr/iotos/api/dto/IpInfo.java index 77337df..a846eda 100644 --- a/src/main/java/me/hekr/iotos/api/dto/IpInfo.java +++ b/src/main/java/me/hekr/iotos/api/dto/IpInfo.java @@ -60,7 +60,7 @@ public class IpInfo implements Serializable { public boolean equals(Object o) { if (o == this) { return true; - } else if (!(o instanceof iot.cloud.os.core.api.dto.IpInfo)) { + } else if (!(o instanceof IpInfo)) { return false; } else { IpInfo other = (IpInfo)o; @@ -83,7 +83,7 @@ public class IpInfo implements Serializable { } protected boolean canEqual(Object other) { - return other instanceof iot.cloud.os.core.api.dto.IpInfo; + return other instanceof IpInfo; } diff --git a/src/main/java/me/hekr/iotos/api/dto/ModelCmdDTO.java b/src/main/java/me/hekr/iotos/api/dto/ModelCmdDTO.java index 2f68a60..ebfdf8c 100644 --- a/src/main/java/me/hekr/iotos/api/dto/ModelCmdDTO.java +++ b/src/main/java/me/hekr/iotos/api/dto/ModelCmdDTO.java @@ -7,7 +7,6 @@ package me.hekr.iotos.api.dto; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; -//import iot.cloud.os.core.api.enums.FrameType; import java.io.Serializable; import java.util.TreeSet; import me.hekr.iotos.api.enums.FrameType; diff --git a/src/main/java/me/hekr/iotos/api/dto/ModelParamDTO.java b/src/main/java/me/hekr/iotos/api/dto/ModelParamDTO.java index 8ce6ad3..04a0d98 100644 --- a/src/main/java/me/hekr/iotos/api/dto/ModelParamDTO.java +++ b/src/main/java/me/hekr/iotos/api/dto/ModelParamDTO.java @@ -8,10 +8,6 @@ package me.hekr.iotos.api.dto; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; -//import iot.cloud.os.core.api.dto.DataValueChecker; -//import iot.cloud.os.core.api.dto.Tag; -//import iot.cloud.os.core.api.enums.DataType; - import java.io.Serializable; import java.util.TreeSet; import javax.validation.constraints.NotBlank; diff --git a/src/main/java/me/hekr/iotos/api/dto/Product.java b/src/main/java/me/hekr/iotos/api/dto/Product.java index 1c14d2a..c5c83a7 100644 --- a/src/main/java/me/hekr/iotos/api/dto/Product.java +++ b/src/main/java/me/hekr/iotos/api/dto/Product.java @@ -1,10 +1,10 @@ package me.hekr.iotos.api.dto; -import iot.cloud.os.core.api.dto.ProductDTO; -import iot.cloud.os.core.api.enums.DataFormat; + import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; +import me.hekr.iotos.api.enums.DataFormat; import me.hekr.iotos.api.enums.DeviceLinkType; import me.hekr.iotos.api.enums.TransferType; diff --git a/src/main/java/me/hekr/iotos/api/dto/ProductDTO.java b/src/main/java/me/hekr/iotos/api/dto/ProductDTO.java new file mode 100644 index 0000000..71c45b5 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/dto/ProductDTO.java @@ -0,0 +1,201 @@ +package me.hekr.iotos.api.dto; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.validation.constraints.NotNull; +import me.hekr.iotos.api.enums.DataCheckMode; +import me.hekr.iotos.api.enums.DataFormat; +import me.hekr.iotos.api.enums.DeviceType; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.Id; +import org.springframework.data.annotation.LastModifiedDate; + +public class ProductDTO implements Serializable { + private static final long serialVersionUID = 2147481103660105166L; + @Id + protected String pk; + protected boolean deleted; + @CreatedDate + protected Date createdDate; + @LastModifiedDate + protected Date updatedDate; + @NotNull + protected DeviceType deviceType; + protected String productSecret; + protected List tags; + protected boolean dynamicRegister; + protected boolean registerCheck; + protected boolean loginCheck; + protected boolean supportRemoteConfig; + protected DataCheckMode dataCheckMode; + private Integer quota; + private Integer usedQuota; + private DataFormat dataFormat; + + public DataFormat getDataFormat() { + return this.dataFormat == null ? DataFormat.KLINK : this.dataFormat; + } + + public DataCheckMode getDataCheckMode() { + return this.dataCheckMode == null ? DataCheckMode.STRICT : this.dataCheckMode; + } + + public ProductDTO() { + } + + public String getPk() { + return this.pk; + } + + public boolean isDeleted() { + return this.deleted; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public Date getUpdatedDate() { + return this.updatedDate; + } + + public DeviceType getDeviceType() { + return this.deviceType; + } + + public String getProductSecret() { + return this.productSecret; + } + + public List getTags() { + return this.tags; + } + + public boolean isDynamicRegister() { + return this.dynamicRegister; + } + + public boolean isRegisterCheck() { + return this.registerCheck; + } + + public boolean isLoginCheck() { + return this.loginCheck; + } + + public boolean isSupportRemoteConfig() { + return this.supportRemoteConfig; + } + + public Integer getQuota() { + return this.quota; + } + + public Integer getUsedQuota() { + return this.usedQuota; + } + + public void setPk(String pk) { + this.pk = pk; + } + + public void setDeleted(boolean deleted) { + this.deleted = deleted; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public void setUpdatedDate(Date updatedDate) { + this.updatedDate = updatedDate; + } + + public void setDeviceType(DeviceType deviceType) { + this.deviceType = deviceType; + } + + public void setProductSecret(String productSecret) { + this.productSecret = productSecret; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public void setDynamicRegister(boolean dynamicRegister) { + this.dynamicRegister = dynamicRegister; + } + + public void setRegisterCheck(boolean registerCheck) { + this.registerCheck = registerCheck; + } + + public void setLoginCheck(boolean loginCheck) { + this.loginCheck = loginCheck; + } + + public void setSupportRemoteConfig(boolean supportRemoteConfig) { + this.supportRemoteConfig = supportRemoteConfig; + } + + public void setDataCheckMode(DataCheckMode dataCheckMode) { + this.dataCheckMode = dataCheckMode; + } + + public void setQuota(Integer quota) { + this.quota = quota; + } + + public void setUsedQuota(Integer usedQuota) { + this.usedQuota = usedQuota; + } + + public void setDataFormat(DataFormat dataFormat) { + this.dataFormat = dataFormat; + } + + @Override + public String toString() { + return "ProductDTO(pk=" + this.getPk() + ", deleted=" + this.isDeleted() + ", createdDate=" + this.getCreatedDate() + ", updatedDate=" + this.getUpdatedDate() + ", deviceType=" + this.getDeviceType() + ", productSecret=" + this.getProductSecret() + ", tags=" + this.getTags() + ", dynamicRegister=" + this.isDynamicRegister() + ", registerCheck=" + this.isRegisterCheck() + ", loginCheck=" + this.isLoginCheck() + ", supportRemoteConfig=" + this.isSupportRemoteConfig() + ", dataCheckMode=" + this.getDataCheckMode() + ", quota=" + this.getQuota() + ", usedQuota=" + this.getUsedQuota() + ", dataFormat=" + this.getDataFormat() + ")"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof ProductDTO)) { + return false; + } else { + ProductDTO other = (ProductDTO)o; + if (!other.canEqual(this)) { + return false; + } else { + Object this$pk = this.getPk(); + Object other$pk = other.getPk(); + if (this$pk == null) { + if (other$pk != null) { + return false; + } + } else if (!this$pk.equals(other$pk)) { + return false; + } + + return true; + } + } + } + + protected boolean canEqual(Object other) { + return other instanceof ProductDTO; + } + + +} diff --git a/src/main/java/me/hekr/iotos/api/dto/Snapshot.java b/src/main/java/me/hekr/iotos/api/dto/Snapshot.java index 95dc8ee..4b82d21 100644 --- a/src/main/java/me/hekr/iotos/api/dto/Snapshot.java +++ b/src/main/java/me/hekr/iotos/api/dto/Snapshot.java @@ -6,7 +6,6 @@ package me.hekr.iotos.api.dto; // -//import iot.cloud.os.core.api.dto.klink.ModelData; import java.io.Serializable; import me.hekr.iotos.api.dto.klink.ModelData; @@ -58,7 +57,7 @@ public class Snapshot implements Serializable { public boolean equals(Object o) { if (o == this) { return true; - } else if (!(o instanceof iot.cloud.os.core.api.dto.Snapshot)) { + } else if (!(o instanceof Snapshot)) { return false; } else { Snapshot other = (Snapshot)o; @@ -105,7 +104,7 @@ public class Snapshot implements Serializable { } protected boolean canEqual(Object other) { - return other instanceof iot.cloud.os.core.api.dto.Snapshot; + return other instanceof Snapshot; } diff --git a/src/main/java/me/hekr/iotos/api/dto/Tag.java b/src/main/java/me/hekr/iotos/api/dto/Tag.java index f940d49..4e111db 100644 --- a/src/main/java/me/hekr/iotos/api/dto/Tag.java +++ b/src/main/java/me/hekr/iotos/api/dto/Tag.java @@ -13,8 +13,8 @@ public class Tag implements Serializable { private String key; private String value; - public static iot.cloud.os.core.api.dto.Tag of(String key, String value) { - return new iot.cloud.os.core.api.dto.Tag(key, value); + public static Tag of(String key, String value) { + return new Tag(key, value); } public String getKey() { diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/AddTopo.java b/src/main/java/me/hekr/iotos/api/dto/klink/AddTopo.java index 4114ac4..055dc3e 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/AddTopo.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/AddTopo.java @@ -6,10 +6,7 @@ package me.hekr.iotos.api.dto.klink; // -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.dto.klink.TopoSub; import me.hekr.iotos.api.enums.Action; -//import iot.cloud.os.core.api.enums.Action; public class AddTopo extends KlinkDev { private TopoSub sub; diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/AddTopoResp.java b/src/main/java/me/hekr/iotos/api/dto/klink/AddTopoResp.java index b1fd165..700072a 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/AddTopoResp.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/AddTopoResp.java @@ -5,12 +5,6 @@ package me.hekr.iotos.api.dto.klink; // (powered by Fernflower decompiler) // -//import iot.cloud.os.core.api.dto.klink.Dev; -//import iot.cloud.os.core.api.dto.klink.KlinkResp; -//import iot.cloud.os.core.api.enums.Action; -//import me.hekr.iotos.api.enums.ErrorCode; -//import iot.cloud.os.core.api.enums.ErrorCode; - import me.hekr.iotos.api.enums.Action; import me.hekr.iotos.api.enums.ErrorCode; diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/BatchDevSend.java b/src/main/java/me/hekr/iotos/api/dto/klink/BatchDevSend.java index b4f4714..dbb5758 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/BatchDevSend.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/BatchDevSend.java @@ -6,9 +6,7 @@ package me.hekr.iotos.api.dto.klink; // -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.dto.klink.SuModelData; -//import iot.cloud.os.core.api.enums.Action; + import java.util.List; import me.hekr.iotos.api.enums.Action; diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/CloudSend.java b/src/main/java/me/hekr/iotos/api/dto/klink/CloudSend.java index df991bd..8b6968b 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/CloudSend.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/CloudSend.java @@ -6,9 +6,6 @@ package me.hekr.iotos.api.dto.klink; // -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.dto.klink.ModelData; -//import iot.cloud.os.core.api.enums.Action; import me.hekr.iotos.api.enums.Action; diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DelTopo.java b/src/main/java/me/hekr/iotos/api/dto/klink/DelTopo.java index f389567..65ccad2 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/DelTopo.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DelTopo.java @@ -6,10 +6,6 @@ package me.hekr.iotos.api.dto.klink; // -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.dto.klink.TopoSub; -//import iot.cloud.os.core.api.enums.Action; - import me.hekr.iotos.api.enums.Action; public class DelTopo extends KlinkDev { diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DevLogin.java b/src/main/java/me/hekr/iotos/api/dto/klink/DevLogin.java index 1bfa98e..58e116f 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/DevLogin.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevLogin.java @@ -4,10 +4,6 @@ package me.hekr.iotos.api.dto.klink; // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // -// -// -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.enums.Action; import me.hekr.iotos.api.enums.Action; diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DevLogout.java b/src/main/java/me/hekr/iotos/api/dto/klink/DevLogout.java index d32460e..3537be2 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/DevLogout.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevLogout.java @@ -5,10 +5,6 @@ package me.hekr.iotos.api.dto.klink; // (powered by Fernflower decompiler) // - -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.enums.Action; - import me.hekr.iotos.api.enums.Action; public class DevLogout extends KlinkDev { diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DevSend.java b/src/main/java/me/hekr/iotos/api/dto/klink/DevSend.java index ed3de2c..46b8727 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/DevSend.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevSend.java @@ -5,11 +5,6 @@ package me.hekr.iotos.api.dto.klink; // (powered by Fernflower decompiler) // -// -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.dto.klink.ModelData; -//import iot.cloud.os.core.api.enums.Action; - import me.hekr.iotos.api.enums.Action; public class DevSend extends KlinkDev { diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgrade.java b/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgrade.java index 8a7ec0c..28ad473 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgrade.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgrade.java @@ -6,9 +6,6 @@ package me.hekr.iotos.api.dto.klink; // -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.enums.Action; - import me.hekr.iotos.api.enums.Action; public class DevUpgrade extends KlinkDev { @@ -27,7 +24,7 @@ public class DevUpgrade extends KlinkDev { public boolean equals(Object o) { if (o == this) { return true; - } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.DevUpgrade)) { + } else if (!(o instanceof DevUpgrade)) { return false; } else { DevUpgrade other = (DevUpgrade)o; @@ -90,7 +87,7 @@ public class DevUpgrade extends KlinkDev { } protected boolean canEqual(Object other) { - return other instanceof iot.cloud.os.core.api.dto.klink.DevUpgrade; + return other instanceof DevUpgrade; } @Override diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgradeProgress.java b/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgradeProgress.java index 8d6acf0..be1904c 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgradeProgress.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgradeProgress.java @@ -5,10 +5,6 @@ package me.hekr.iotos.api.dto.klink; // (powered by Fernflower decompiler) // - -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.enums.Action; - import me.hekr.iotos.api.enums.Action; public class DevUpgradeProgress extends KlinkDev { @@ -25,7 +21,7 @@ public class DevUpgradeProgress extends KlinkDev { public boolean equals(Object o) { if (o == this) { return true; - } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.DevUpgradeProgress)) { + } else if (!(o instanceof DevUpgradeProgress)) { return false; } else { DevUpgradeProgress other = (DevUpgradeProgress)o; @@ -52,7 +48,7 @@ public class DevUpgradeProgress extends KlinkDev { } protected boolean canEqual(Object other) { - return other instanceof iot.cloud.os.core.api.dto.klink.DevUpgradeProgress; + return other instanceof DevUpgradeProgress; } @Override diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/GetConfig.java b/src/main/java/me/hekr/iotos/api/dto/klink/GetConfig.java index 0b52051..b5c3323 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/GetConfig.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/GetConfig.java @@ -7,9 +7,6 @@ package me.hekr.iotos.api.dto.klink; // -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.enums.Action; - import me.hekr.iotos.api.enums.Action; public class GetConfig extends KlinkDev { diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/GetConfigResp.java b/src/main/java/me/hekr/iotos/api/dto/klink/GetConfigResp.java index ff6049c..d65ced9 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/GetConfigResp.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/GetConfigResp.java @@ -6,10 +6,6 @@ package me.hekr.iotos.api.dto.klink; // -//import iot.cloud.os.core.api.dto.klink.KlinkResp; -//import iot.cloud.os.core.api.enums.Action; -//import iot.cloud.os.core.api.enums.ErrorCode; - import me.hekr.iotos.api.enums.Action; import me.hekr.iotos.api.enums.ErrorCode; @@ -31,7 +27,7 @@ public class GetConfigResp extends KlinkResp { public boolean equals(Object o) { if (o == this) { return true; - } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.GetConfigResp)) { + } else if (!(o instanceof GetConfigResp)) { return false; } else { GetConfigResp other = (GetConfigResp)o; @@ -66,7 +62,7 @@ public class GetConfigResp extends KlinkResp { } protected boolean canEqual(Object other) { - return other instanceof iot.cloud.os.core.api.dto.klink.GetConfigResp; + return other instanceof GetConfigResp; } @Override diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/GetTopo.java b/src/main/java/me/hekr/iotos/api/dto/klink/GetTopo.java index 2cc2374..81e637a 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/GetTopo.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/GetTopo.java @@ -5,8 +5,6 @@ package me.hekr.iotos.api.dto.klink; // (powered by Fernflower decompiler) // -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.enums.Action; import me.hekr.iotos.api.enums.Action; diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/Klink.java b/src/main/java/me/hekr/iotos/api/dto/klink/Klink.java index 437ba18..16f0cef 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/Klink.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/Klink.java @@ -47,6 +47,7 @@ public class Klink implements Serializable { this.sysCustomRaw = sysCustomRaw; } + @Override public String toString() { return "Klink(action=" + this.getAction() + ", msgId=" + this.getMsgId() + ", sysCustomRaw=" + this.getSysCustomRaw() + ")"; diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/KlinkDev.java b/src/main/java/me/hekr/iotos/api/dto/klink/KlinkDev.java index 5815703..dd51ab5 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/KlinkDev.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/KlinkDev.java @@ -5,7 +5,6 @@ package me.hekr.iotos.api.dto.klink; // (powered by Fernflower decompiler) // -//import iot.cloud.os.core.api.dto.klink.Klink; public class KlinkDev extends Klink { private static final long serialVersionUID = 78156295896577172L; @@ -31,6 +30,7 @@ public class KlinkDev extends Klink { this.devId = devId; } + @Override public String toString() { return "KlinkDev(super=" + super.toString() + ", pk=" + this.getPk() + ", devId=" + this.getDevId() + ")"; } diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/KlinkResp.java b/src/main/java/me/hekr/iotos/api/dto/klink/KlinkResp.java index 6de1d67..1c77b9e 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/KlinkResp.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/KlinkResp.java @@ -9,8 +9,7 @@ package me.hekr.iotos.api.dto.klink; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; -//import iot.cloud.os.core.api.dto.klink.Klink; -//import iot.cloud.os.core.api.enums.ErrorCode; + import java.util.Map; import me.hekr.iotos.api.enums.ErrorCode; diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/ModelData.java b/src/main/java/me/hekr/iotos/api/dto/klink/ModelData.java index f798fdc..0152d94 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/ModelData.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/ModelData.java @@ -41,7 +41,7 @@ public class ModelData implements Serializable { public boolean equals(Object o) { if (o == this) { return true; - } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.ModelData)) { + } else if (!(o instanceof ModelData)) { return false; } else { ModelData other = (ModelData)o; @@ -74,7 +74,7 @@ public class ModelData implements Serializable { } protected boolean canEqual(Object other) { - return other instanceof iot.cloud.os.core.api.dto.klink.ModelData; + return other instanceof ModelData; } diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/NotSupport.java b/src/main/java/me/hekr/iotos/api/dto/klink/NotSupport.java index 3283004..b770444 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/NotSupport.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/NotSupport.java @@ -6,9 +6,6 @@ package me.hekr.iotos.api.dto.klink; // -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.enums.Action; - import me.hekr.iotos.api.enums.Action; public class NotSupport extends KlinkDev { diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/Register.java b/src/main/java/me/hekr/iotos/api/dto/klink/Register.java index 4503bd6..6e8875f 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/Register.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/Register.java @@ -6,9 +6,6 @@ package me.hekr.iotos.api.dto.klink; // -//import iot.cloud.os.core.api.dto.Tag; -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.enums.Action; import java.util.List; import me.hekr.iotos.api.dto.Tag; import me.hekr.iotos.api.enums.Action; @@ -32,7 +29,7 @@ public class Register extends KlinkDev { public boolean equals(Object o) { if (o == this) { return true; - } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.Register)) { + } else if (!(o instanceof Register)) { return false; } else { Register other = (Register)o; @@ -125,7 +122,7 @@ public class Register extends KlinkDev { } protected boolean canEqual(Object other) { - return other instanceof iot.cloud.os.core.api.dto.klink.Register; + return other instanceof Register; } @Override diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/RegisterResp.java b/src/main/java/me/hekr/iotos/api/dto/klink/RegisterResp.java index f1b6edb..2360c89 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/RegisterResp.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/RegisterResp.java @@ -6,10 +6,6 @@ package me.hekr.iotos.api.dto.klink; // // -//import iot.cloud.os.core.api.dto.klink.KlinkResp; -//import iot.cloud.os.core.api.enums.Action; -//import iot.cloud.os.core.api.enums.ErrorCode; - import me.hekr.iotos.api.enums.Action; import me.hekr.iotos.api.enums.ErrorCode; @@ -30,7 +26,7 @@ public class RegisterResp extends KlinkResp { public boolean equals(Object o) { if (o == this) { return true; - } else if (!(o instanceof iot.cloud.os.core.api.dto.klink.RegisterResp)) { + } else if (!(o instanceof RegisterResp)) { return false; } else { RegisterResp other = (RegisterResp)o; @@ -55,7 +51,7 @@ public class RegisterResp extends KlinkResp { } protected boolean canEqual(Object other) { - return other instanceof iot.cloud.os.core.api.dto.klink.RegisterResp; + return other instanceof RegisterResp; } @Override diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/ReportFirmware.java b/src/main/java/me/hekr/iotos/api/dto/klink/ReportFirmware.java index 2fa5dcd..35e4f9f 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/ReportFirmware.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/ReportFirmware.java @@ -6,8 +6,6 @@ package me.hekr.iotos.api.dto.klink; // -//import iot.cloud.os.core.api.dto.klink.KlinkDev; -//import iot.cloud.os.core.api.enums.Action; import me.hekr.iotos.api.enums.Action; diff --git a/src/main/java/me/hekr/iotos/api/dto/klink/SuModelData.java b/src/main/java/me/hekr/iotos/api/dto/klink/SuModelData.java index d3b0f50..df06908 100644 --- a/src/main/java/me/hekr/iotos/api/dto/klink/SuModelData.java +++ b/src/main/java/me/hekr/iotos/api/dto/klink/SuModelData.java @@ -5,7 +5,6 @@ package me.hekr.iotos.api.dto.klink; // (powered by Fernflower decompiler) // -//import iot.cloud.os.core.api.dto.klink.ModelData; public class SuModelData extends ModelData { private static final long serialVersionUID = -136551194596662462L; diff --git a/src/main/java/me/hekr/iotos/api/enums/Action.java b/src/main/java/me/hekr/iotos/api/enums/Action.java index 6404de4..18e77a5 100644 --- a/src/main/java/me/hekr/iotos/api/enums/Action.java +++ b/src/main/java/me/hekr/iotos/api/enums/Action.java @@ -6,25 +6,6 @@ package me.hekr.iotos.api.enums; // -//import iot.cloud.os.core.api.dto.klink.AddTopo; -//import iot.cloud.os.core.api.dto.klink.BatchDevSend; -//import iot.cloud.os.core.api.dto.klink.CloudSend; -//import iot.cloud.os.core.api.dto.klink.DelTopo; -//import iot.cloud.os.core.api.dto.klink.DevLogin; -//import iot.cloud.os.core.api.dto.klink.DevLogout; -//import iot.cloud.os.core.api.dto.klink.DevSend; -//import iot.cloud.os.core.api.dto.klink.DevUpgrade; -//import iot.cloud.os.core.api.dto.klink.DevUpgradeProgress; -//import iot.cloud.os.core.api.dto.klink.GetConfig; -//import iot.cloud.os.core.api.dto.klink.GetConfigResp; -//import iot.cloud.os.core.api.dto.klink.GetTopo; -//import iot.cloud.os.core.api.dto.klink.Klink; -//import iot.cloud.os.core.api.dto.klink.KlinkResp; -//import iot.cloud.os.core.api.dto.klink.NotSupport; -//import iot.cloud.os.core.api.dto.klink.Register; -//import iot.cloud.os.core.api.dto.klink.RegisterResp; -//import iot.cloud.os.core.api.dto.klink.ReportFirmware; -//import iot.cloud.os.core.api.enums.FrameType; import java.util.Arrays; import java.util.Map; import java.util.function.Function; diff --git a/src/main/java/me/hekr/iotos/api/enums/DataCheckMode.java b/src/main/java/me/hekr/iotos/api/enums/DataCheckMode.java new file mode 100644 index 0000000..5db8f28 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/enums/DataCheckMode.java @@ -0,0 +1,17 @@ +package me.hekr.iotos.api.enums; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + + +public enum DataCheckMode { + STRICT, + LOOSE, + LESS, + MORE; + + private DataCheckMode() { + } +} diff --git a/src/main/java/me/hekr/iotos/api/enums/DataFormat.java b/src/main/java/me/hekr/iotos/api/enums/DataFormat.java new file mode 100644 index 0000000..8f70342 --- /dev/null +++ b/src/main/java/me/hekr/iotos/api/enums/DataFormat.java @@ -0,0 +1,21 @@ +package me.hekr.iotos.api.enums; + +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +public enum DataFormat { + KLINK("KLink(标准格式)"), + CUSTOM("自定义"); + + private final String desc; + + private DataFormat(String desc) { + this.desc = desc; + } + + public String getDesc() { + return this.desc; + } +} diff --git a/src/main/java/me/hekr/iotos/api/enums/DataType.java b/src/main/java/me/hekr/iotos/api/enums/DataType.java index 018c5b0..4621961 100644 --- a/src/main/java/me/hekr/iotos/api/enums/DataType.java +++ b/src/main/java/me/hekr/iotos/api/enums/DataType.java @@ -5,13 +5,6 @@ package me.hekr.iotos.api.enums; // (powered by Fernflower decompiler) // -//import iot.cloud.os.core.api.dto.DataValueChecker; -//import iot.cloud.os.core.api.dto.DataValueEnumChecker; -//import iot.cloud.os.core.api.dto.DataValueLengthChecker; -//import iot.cloud.os.core.api.dto.DataValueNoneChecker; -import iot.cloud.os.core.api.dto.DataValueRangeChecker; - - import java.util.Arrays; import java.util.Collections; import java.util.Iterator; @@ -21,6 +14,7 @@ import me.hekr.iotos.api.dto.DataValueChecker; import me.hekr.iotos.api.dto.DataValueEnumChecker; import me.hekr.iotos.api.dto.DataValueLengthChecker; import me.hekr.iotos.api.dto.DataValueNoneChecker; +import me.hekr.iotos.api.dto.DataValueRangeChecker; public enum DataType { STRING(new Class[]{DataValueNoneChecker.class, DataValueLengthChecker.class, DataValueEnumChecker.class}) { diff --git a/src/main/java/me/hekr/iotos/api/enums/ErrorCode.java b/src/main/java/me/hekr/iotos/api/enums/ErrorCode.java index f477471..689f1b3 100644 --- a/src/main/java/me/hekr/iotos/api/enums/ErrorCode.java +++ b/src/main/java/me/hekr/iotos/api/enums/ErrorCode.java @@ -5,6 +5,10 @@ package me.hekr.iotos.api.enums; // (powered by Fernflower decompiler) // +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// import java.util.Arrays; import java.util.Map; @@ -68,8 +72,8 @@ public enum ErrorCode { PRODUCT_EXIST(1144, "product exist"), INTERNAL_ERROR(500, "internal error"); - private static final Map ERROR_CODE_MAP = (Map)Arrays.stream(values()).collect(Collectors.toMap( - ErrorCode::getCode, Function.identity())); + private static final Map ERROR_CODE_MAP = (Map)Arrays.stream(values()).collect(Collectors.toMap( + ErrorCode::getCode, Function.identity())); private int code; private String desc; diff --git a/src/main/java/me/hekr/iotos/api/enums/TransferType.java b/src/main/java/me/hekr/iotos/api/enums/TransferType.java index d8634e4..0092fc1 100644 --- a/src/main/java/me/hekr/iotos/api/enums/TransferType.java +++ b/src/main/java/me/hekr/iotos/api/enums/TransferType.java @@ -1,14 +1,14 @@ package me.hekr.iotos.api.enums; -import static iot.cloud.os.core.api.enums.DataFormat.CUSTOM; -import static iot.cloud.os.core.api.enums.DataFormat.KLINK; -import iot.cloud.os.core.api.enums.DataFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import lombok.Getter; +import static me.hekr.iotos.api.enums.DataFormat.CUSTOM; +import static me.hekr.iotos.api.enums.DataFormat.KLINK; + /** * @author du *

数据传输类型 diff --git a/src/main/java/me/hekr/iotos/api/service/RetrofitIotService.java b/src/main/java/me/hekr/iotos/api/service/RetrofitIotService.java index fa7f992..1785bcb 100644 --- a/src/main/java/me/hekr/iotos/api/service/RetrofitIotService.java +++ b/src/main/java/me/hekr/iotos/api/service/RetrofitIotService.java @@ -1,14 +1,5 @@ package me.hekr.iotos.api.service; -//import iot.cloud.os.core.api.dto.DeviceDTO; -//import iot.cloud.os.core.api.dto.ModelProtocolDTO; -//import iot.cloud.os.core.api.dto.Snapshot; -//import iot.cloud.os.core.api.dto.klink.AddTopoResp; -//import iot.cloud.os.core.api.dto.klink.DelTopoResp; -//import iot.cloud.os.core.api.dto.klink.KlinkResp; -//import iot.cloud.os.core.api.dto.klink.ModelData; -//import iot.cloud.os.core.api.dto.klink.TopoSub; -//import iot.cloud.os.core.api.enums.DeviceType; import java.util.List; import java.util.Map; @@ -32,6 +23,7 @@ import me.hekr.iotos.api.dto.klink.ModelData; import me.hekr.iotos.api.dto.klink.TopoSub; import me.hekr.iotos.api.enums.DeviceType; import me.hekr.iotos.api.util.Pagec; +import org.omg.CORBA.Any; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import retrofit2.Call; @@ -50,7 +42,7 @@ public interface RetrofitIotService { /** * 获取产品列表 * - *

文档 + *

获取产品列表 * * @param page 当前页,从0开始 * @param size 分页大小,最大100,最小1 @@ -62,30 +54,20 @@ public interface RetrofitIotService { /** * 获取物模型 * - *

产品物模型查询/a> * - * @param pk + * @param pk 产品PK * @return */ @GET("/model/protocol/{pk}") Call getProtocol(@Path("pk") String pk); - /** - * 添加拓扑 - * - *

文档 - * - * @param pk - * @param devId - * @return - */ - @PUT("/api/device/addTopo/{pk}/{devId}") - Call addTopo(@Path("pk") String pk, @Path("devId") String devId); + /** * 新增设备 * - *

新增设备 * * @param addReq * @return @@ -96,7 +78,7 @@ public interface RetrofitIotService { /** * 导入设备 * - *

文档 + *

导入设备 * * @return */ @@ -106,10 +88,10 @@ public interface RetrofitIotService { /** * 获取批次下所有设备 * - *

文档 + *

获取批次下所有设备 * - * @param pk - * @param batchName + * @param pk 产品PK + * @param batchName 批次名称 * @return */ @GET("/api/device/getBatchDevices/{pk}/{batchName}") @@ -118,7 +100,7 @@ public interface RetrofitIotService { /** * 查询设备列表 * - *

文档 + *

查询设备列表 * * @param params * @return @@ -129,21 +111,21 @@ public interface RetrofitIotService { /** * 更改设备名称 * - *

文档 + *

更改设备名称 * - * @param req + * @param req 设备信息(pk,devId,name) * @return */ @PUT("/api/device/updateName") - Call getDeviceList(@Body DeviceUpdateNameReq req); + Call updateName(@Body DeviceUpdateNameReq req); /** * 查询设备详情 * - *

文档 + *

查询设备详情 * - * @param pk - * @param devId + * @param pk 产品PK + * @param devId 设备ID * @return */ @GET("/api/device/deviceInfo/{pk}/{devId}") @@ -152,78 +134,98 @@ public interface RetrofitIotService { /** * 批量查询状态 * - *

文档 + *

批量查询状态 * - * @param req + * @param req 设备信息(pk,devId,name) * @return */ @POST("/api/device/getDeviceStatus") Call getDeviceStatus(@Body DevIdListReq req); /** - * 删除设备 + * 删除设备 * - * @param pk - * @param devId + *

删除设备 + * + * @param pk 产品PK + * @param devId 设备ID * @return */ @DELETE("/api/device/delDevice/{pk}/{devId}") - Call getDeviceStatus(@Path("pk") String pk, @Path("devId") String devId); + Call delDevice(@Path("pk") String pk, @Path("devId") String devId); /** - * 获取鉴权信息 + * 获取鉴权信息 + * + *

获取鉴权信息 * * @return */ @GET("/api/user/getLoginToken") Call getLoginToken(); - /** - * 查询历史上下行数据"> - * - * @param pk - * @param devId - * @return - */ - @GET("/api/device/getDeviceHistoryData/{pk}/{devId}") - Call getDeviceHistoryData(@Path("pk") String pk, @Path("devId") String devId); - - /** - * 查询设备影子 - * - * @return - */ - @GET("/api/device/getSnapshot") - Call getSnapshot(@Query("pk") String pk, @Query("devId") String devId); +// /** +// * 查询历史上下行数据 +// * +// *

查询历史上下行数据"> +// * +// * @param pk 产品PK +// * @param devId 设备ID +// * @return +// */ +// @GET("/api/device/getDeviceHistoryData/{pk}/{devId}") +// Call getDeviceHistoryData(@Path("pk") String pk, @Path("devId") String devId); + + // /** + // * 查询设备影子 + // * + // * 查询设备影子 + // * + // * @return + // */ + // @GET("/api/device/getSnapshot") + // Call getSnapshot(@Query("pk") String pk, @Query("devId") String devId); // =================================================== // ==================================================== /** - * @param reqDto + * 新增设备 + * + *

新增设备 + * + * @param reqDto 设备信息(pk,devId,name) * @return */ @POST("/api/device/addDevice") - DeviceApiDTO addDevice(@Query("reqDto") DeviceAddReq reqDto); + Call addDevice(@Body DeviceAddReq reqDto); /** - * @param devIdListReq + * 导入设备 + * + *

导入设备 + * + * @param devIdListReq (产品PK和设备ID列表) * @return */ @POST("/api/device/batchAddDevices") - Map batchAddDevices(@Query("devIdListReq") DevIdListReq devIdListReq); + Call> batchAddDevices(@Body DevIdListReq devIdListReq); /** - * @param pk - * @param keyword - * @param page - * @param deviceType - * @param online - * @param size + * 查询设备列表 + * + *

查询设备列表 + * + * @param pk 产品PK + * @param keyword 搜索关键词 + * @param page 当前页面,最大100,最小1 + * @param deviceType 节点类型(普通设备:GENERAL;中继设备:SWITCH;网关设备:GATEWAY;终端子设备:TERMINAL) + * @param online 是否在线,true为在线 + * @param size 分页大小,默认10, * @return */ @GET("/api/device/getDeviceList") - public Pagec getDeviceList( + Call> getDeviceList( @Query("pk") String pk, @Query("keyword") String keyword, @Query("page") int page, @@ -231,91 +233,139 @@ public interface RetrofitIotService { @Query("online") Boolean online, @Query("size") int size); - /** @param reqDto */ - @PUT("/api/device/updateName") - public void updateName(@Query("reqDto") DeviceAddReq reqDto); + // /** + // * 更改设备名称 + // * + // * 更改设备名称 + // * + // * @param reqDto + // */ + // @PUT("/api/device/updateName") + // void updateName(@Query("reqDto") DeviceAddReq reqDto); - /** @param reqDto */ + /** + * ???? + * + *

???? + * + * @param reqDto + */ @PUT("/api/device/updateTags") - public void updateTags(@Query("reqDto") DeviceAddReq reqDto); + Call updateTags(@Body DeviceAddReq reqDto); /** - * @param pk - * @param devId + * 查询设备详情 + * + *

查询设备详情 + * + * @param pk 产品PK + * @param devId 设备ID * @return */ @GET("/api/device/deviceInfo/{pk}/{devId}") - public DeviceApiDTO deviceInfo(@Path("pk") String pk, @Path("devId") String devId); + Call deviceInfo(@Path("pk") String pk, @Path("devId") String devId); /** - * @param pk - * @param devId + * 查询设备影子 + * + *

查询设备影子 + * + * @param pk 产品PK + * @param devId 设备ID * @return */ @GET("/api/device/getSnapshot") - public Snapshot getDeviceSnapshot(@Query("pk") String pk, @Query("devId") String devId); + Call getDeviceSnapshot(@Query("pk") String pk, @Query("devId") String devId); /** - * @param pk - * @param devId + * 删除设备 + * + *

删除设备 + * + * @param pk 产品PK + * @param devId 设备ID * @param delSnapshot */ @DELETE("/api/device/delDevice/{pk}/{devId}") - public void delDevice( - @Path("pk") String pk, @Path("devId") String devId, @Path("delSnapshot") boolean delSnapshot); + Call delDevice( + @Path("pk") String pk, + @Path("devId") String devId, + @Query("delSnapshot") boolean delSnapshot); - /** @param deviceList */ + /** + * 批量查删除设备 + * + *

批量删除设备 + * + * @param deviceList 设备DTO列表 + */ @DELETE("/api/device/batchDelDevice") - public void bathDelDevice(@Query("deviceList") List deviceList); + Call bathDelDevice(@Query("deviceList") List deviceList); /** - * @param pk - * @param devId - * @param startTime - * @param endTime - * @param action - * @param page - * @param size + * 查询历史上下行数 + * + *

查询历史上下行数 + * + * @param pk 产品PK + * @param devId 设备ID + * @param startTime 开始事件 + * @param endTime 结束事件 + * @param action 事件 + * @param page 当前页 从0开始 + * @param size 分页大小,最大100,最小1 * @return */ @GET("/api/device/getDeviceHistoryData/{pk}/{devId}") - public List getDeviceHistoryData( + Call> getDeviceHistoryData( @Path("pk") String pk, @Path("devId") String devId, - @Path("startTime") Long startTime, - @Path("endTime") Long endTime, - @Path("action") String action, - @Path("page") int page, - @Path("size") int size); + @Query("startTime") Long startTime, + @Query("endTime") Long endTime, + @Query("action") String action, + @Query("page") int page, + @Query("size") int size); /** - * @param pk - * @param devId - * @param data + * 下发控制命令 + * + *

下发控制命令 + * + * @param pk 产品PK + * @param devId 设备ID + * @param data (cmd 命令标识符 ,params 参数值) * @return */ @POST("/api/device/cloudSend/{pk}/{devId}") - public KlinkResp deviceCloudSend( - @Path("pk") String pk, @Path("devId") String devId, @Path("data") ModelData data); + Call deviceCloudSend( + @Path("pk") String pk, @Path("devId") String devId, @Query("data") ModelData data); /** - * @param messageId + * 查询命令状态 + * + *

查询命令状态 + * + * @param messageId 所查询命令的ID * @return */ @GET("/api/device/cloudSendMsgInfo/{messageId}") - public CloudSendMsgDTO cloudSendMsgInfo(@Path("messageId") String messageId); + Call cloudSendMsgInfo(@Path("messageId") String messageId); /** - * @param page - * @param size - * @param pk - * @param devId - * @param startTime - * @param endTime + * 查询历史控制命令 + * + *

查询历史控制命令 + * + * @param page 当前页面,最小0 + * @param size 分页大小,最大100,最小0 + * @param pk 产品PK + * @param devId 设备ID + * @param startTime 查询开始时间 + * @param endTime 查询结束事件 * @return */ @GET("/api/device/cloudSendMsgList") - public Pagec cloudSendMsgList( + Call> cloudSendMsgList( @Query("page") Integer page, @Query("size") Integer size, @Query("pk") String pk, @@ -324,22 +374,28 @@ public interface RetrofitIotService { @Query("endTime") Long endTime); /** - * @param pk - * @param devId + * 网关添加子设备 + * + *

网关添加子设备 + * + * @param pk 产品PK + * @param devId 设备ID * @param sub * @return */ @PUT("/api/device/addTopo/{pk}/{devId}") - public AddTopoResp addTopo( - @Path("pk") String pk, @Path("devId") String devId, @Path("sub") TopoSub sub); + Call addTopo(@Path("pk") String pk, @Path("devId") String devId, @Body TopoSub sub); /** - * @param pk - * @param devId + * 网关删除子设备 + * + *

网关删除子设备 + * + * @param pk 产品PK + * @param devId 设备ID * @param sub * @return */ @PUT("/api/device/delTopo/{pk}/{devId}") - public DelTopoResp delTopo( - @Path("pk") String pk, @Path("devId") String devId, @Path("sub") TopoSub sub); + Call delTopo(@Path("pk") String pk, @Path("devId") String devId, @Body TopoSub sub); } diff --git a/src/test/java/me/hekr/iotos/api/IotClientTest.java b/src/test/java/me/hekr/iotos/api/IotClientTest.java index 1671e45..6bd7940 100644 --- a/src/test/java/me/hekr/iotos/api/IotClientTest.java +++ b/src/test/java/me/hekr/iotos/api/IotClientTest.java @@ -1,18 +1,40 @@ package me.hekr.iotos.api; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import me.hekr.iotos.api.dto.DevIdListReq; +import me.hekr.iotos.api.dto.DeviceAddReq; +import me.hekr.iotos.api.dto.DeviceApiDTO; +import me.hekr.iotos.api.dto.DeviceDTO; +import me.hekr.iotos.api.dto.DeviceUpdateNameReq; +import me.hekr.iotos.api.dto.klink.ModelData; +import me.hekr.iotos.api.dto.klink.TopoSub; +import me.hekr.iotos.api.enums.DeviceType; import org.junit.BeforeClass; import org.junit.Test; // @Ignore + public class IotClientTest { private static IotClient client; @BeforeClass public static void before() { - String host = System.getProperty("host"); - String ak = System.getProperty("ak"); - String as = System.getProperty("as"); - client = IotClient.builder().host(host).prefix("").ak(ak).as(as).build(); + // String host = System.getProperty("host"); + // String ak = System.getProperty("ak"); + // String as = System.getProperty("as"); + client = + IotClient.builder() + .host("http://10.1.1.200:7003") + .ak("kuQrzR2GowzdSXGULwSvABY9") + .as("ERKp4JwzTQv3RUCVTBtITzNfFkAMog") + .build(); + } + + @Test + public void test() { + System.out.println("233"); } @Test @@ -24,4 +46,197 @@ public class IotClientTest { public void testGetLoginToken() { System.out.println(client.getLoginToken()); } + + @Test + public void getLoginToken() { + System.out.println(client.getLoginToken()); + } + + @Test + public void getProduct() { + int page = 0; + int size = 10; + System.out.println(client.getProduct(page, size)); + } + + @Test + public void addTopo0() { + DevIdListReq req = new DevIdListReq(); + System.out.println(client.addTopo(req)); + } + + @Test + public void getBatchDevices() { + String pk = "c33d447799e343f4bb2237390b82604d"; + String batchName = ""; + System.out.println(client.getBatchDevices(pk, batchName)); + } + + // @Test + // public void getDeviceList() { + // Map params=null; + // System.out.println(client.getDeviceList(params)); + // } + + @Test + public void updateName() { + DeviceUpdateNameReq req = new DeviceUpdateNameReq(); + req.setPk("c33d447799e343f4bb2237390b82604d"); + req.setDevId("device001"); + req.setName("dev0000000"); + try{ + client.updateName(req); + }catch (Exception e){ + e.printStackTrace(); + } + System.out.println("success!!"); + } + + + + + @Test + public void getDeviceStatus() { + DevIdListReq req = new DevIdListReq(); + List list = Arrays.asList("device001","device002"); + req.setPk("c33d447799e343f4bb2237390b82604d"); + req.setDevIds(list); + System.out.println(client.getDeviceStatus(req)); + System.out.println("success!!!"); + } + + @Test + public void delDeviceStatus() { + String pk = "c33d447799e343f4bb2237390b82604d"; + String devId = "device001"; + System.out.println(client.delDevice(pk, devId)); + } + +// @Test +// public void getDeviceHistoryData0() { +// String pk = "c33d447799e343f4bb2237390b82604d"; +// String devId = "device001"; +// System.out.println(client.getDeviceHistoryData(pk, devId)); +// } + + @Test + public void addDevice() { + DeviceAddReq reqDto = new DeviceAddReq(); + reqDto.setDevId("device003"); + reqDto.setName("dev003"); + reqDto.setPk("c33d447799e343f4bb2237390b82604d"); + System.out.println(client.addDevice(reqDto)); + } + + @Test + public void batchAddDevices() { + + DevIdListReq devIdListReq = new DevIdListReq(); + List list = Arrays.asList("device006","device004","device005"); + + devIdListReq.setPk("c33d447799e343f4bb2237390b82604d"); + devIdListReq.setDevIds(list); + + System.out.println(client.batchAddDevices(devIdListReq)); + } + + @Test + public void getDeviceList() { + String pk = "c33d447799e343f4bb2237390b82604d"; + String keyword = "网关001"; + int page = 0; + DeviceType deviceType= DeviceType.GATEWAY; + Boolean online =true; + int size = 10; + System.out.println(client.getDeviceList(pk, keyword, page, deviceType, online, size)); + } + + @Test + public void updateTags() { + DeviceAddReq reqDto = new DeviceAddReq(); + client.updateTags(reqDto); + } + + @Test + public void deviceInfo() { + String pk = "c33d447799e343f4bb2237390b82604d"; + String devId = "device002"; + DeviceApiDTO deviceApiDTO =client.deviceInfo(pk, devId); + System.out.println(deviceApiDTO.getName()); + } + + @Test + public void getDeviceSnapshot() { + String pk = ""; + String devId = ""; + System.out.println(client.getDeviceSnapshot(pk, devId)); + } + + @Test + public void delDevice() { + String pk = ""; + String devId = ""; + boolean delSnapshot = true; + client.delDevice(pk, devId, delSnapshot); + } + + @Test + public void bathDelDevice() { + List deviceList = new ArrayList<>(); + client.bathDelDevice(deviceList); + } + + @Test + public void getDeviceHistoryData() { + String pk = "c33d447799e343f4bb2237390b82604d"; + String devId = "device001"; + Long startTime = new Long(10); + Long endTime = new Long(100); + String action = ""; + int page = 0; + int size = 10; + System.out.println( + client.getDeviceHistoryData(pk, devId, startTime, endTime, action, page, size)); + } + + @Test + public void deviceCloudSend() { + String pk = "c33d447799e343f4bb2237390b82604d"; + String devId = "device001"; + ModelData data = new ModelData(); + System.out.println(client.deviceCloudSend(pk, devId, data)); + } + + @Test + public void cloudSendMsgInfo() { + String messageId = ""; + System.out.println(client.cloudSendMsgInfo(messageId)); + } + + @Test + public void cloudSendMsgList() { + Integer page = 0; + Integer size = 10; + String pk = ""; + String devId = ""; + Long startTime = new Long(10); + Long endTime = new Long(100); + System.out.println(client.cloudSendMsgList(page, size, pk, devId, startTime, endTime)); + } + + @Test + public void addTopo1() { + String pk = ""; + String devId = ""; + TopoSub sub = new TopoSub(); + System.out.println(client.addTopo(pk, devId, sub)); + } + + @Test + public void delTopo() { + String pk = ""; + String devId = ""; + TopoSub sub = new TopoSub(); + System.out.println(client.delTopo(pk, devId, sub)); + } } -- Gitee From 01b1416f1aaa6fba76938a279a4837e9279052d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=A2=C2=80=C3=A2=E6=96=BD=E6=B5=99=E6=96=8C?= Date: Tue, 7 Sep 2021 18:30:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?9.7=E6=B5=8B=E8=AF=95=E6=8E=A5=C3=A5=C2=8F(?= =?UTF-8?q?=E6=9C=AA=E5=AE=8C=E6=88=90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/me/hekr/iotos/api/IotClientTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/me/hekr/iotos/api/IotClientTest.java b/src/test/java/me/hekr/iotos/api/IotClientTest.java index 6bd7940..f127a7f 100644 --- a/src/test/java/me/hekr/iotos/api/IotClientTest.java +++ b/src/test/java/me/hekr/iotos/api/IotClientTest.java @@ -234,7 +234,7 @@ public class IotClientTest { @Test public void delTopo() { - String pk = ""; + String pk = "c33d447799e343f4bb2237390b82604d"; String devId = ""; TopoSub sub = new TopoSub(); System.out.println(client.delTopo(pk, devId, sub)); -- Gitee