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 04c7b7d9c9d41bb89a2fc46a24d1237f6b8b0f49..79ff0687843f6df5cd755cd163329aabf04e8373 100644
--- a/src/main/java/me/hekr/iotos/api/IotClient.java
+++ b/src/main/java/me/hekr/iotos/api/IotClient.java
@@ -2,23 +2,38 @@ 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 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;
@@ -30,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();
@@ -224,6 +241,273 @@ public class IotClient {
return execute(retrofitIotService.getLoginToken());
}
+ /**
+ * 获取产品列表
+ *
+ * 获取产品列表
+ *
+ * @param page 当前页,从0开始
+ * @param size 分页大小,最大100,最小1
+ * @return
+ */
+ public Pagec getProduct(int page, int size) {
+ return execute(retrofitIotService.getProduct(page, size));
+ }
+
+
+ /**
+ * 网关添加子设备
+ *
+ * @param req
+ * @return
+ */
+ public BatchAddDeviceResp addTopo(DevIdListReq req) {
+ return execute(retrofitIotService.addTopo(req));
+ }
+
+ /**
+ * 获取批次下所有设备
+ *
+ * @param pk
+ * @param batchName
+ * @return
+ */
+ public List getBatchDevices(String pk, String batchName) {
+ return execute(retrofitIotService.getBatchDevices(pk, batchName));
+ }
+
+ /**
+ * 查询设备列表
+ *
+ * @param params
+ * @return
+ */
+ public Pagec getDeviceList(Map params) {
+ return execute(retrofitIotService.getDeviceList(params));
+ }
+
+ /**
+ * *
+ *
+ * 更改设备名称
+ *
+ * @param req
+ * @return
+ */
+ public void updateName(DeviceUpdateNameReq req) {
+ execute(retrofitIotService.updateName(req));
+ }
+
+ /**
+ * *
+ *
+ *
批量查询状态
+ *
+ * @param req
+ * @return
+ */
+ public Device getDeviceStatus(DevIdListReq req) {
+ return execute(retrofitIotService.getDeviceStatus(req));
+ }
+
+ /**
+ * 删除设备
+ *
+ * @param pk
+ * @param devId
+ * @return
+ */
+ 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
+ */
+ public DeviceApiDTO addDevice(DeviceAddReq reqDto) {
+ return execute(retrofitIotService.addDevice(reqDto));
+ }
+
+ /**
+ * 导入设备
+ *
+ * @param devIdListReq
+ * @return
+ */
+ public Map batchAddDevices(DevIdListReq devIdListReq) {
+ return execute(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 execute(retrofitIotService.getDeviceList(pk, keyword, page, deviceType, online, size));
+ }
+
+ // /**
+ // * 更改设备名称
+ // *
+ // * @param reqDto
+ // */
+ // public Call> updateName(DeviceUpdateNameReq reqDto) {
+ // retrofitIotService.updateName(reqDto);
+ // }
+
+ /**
+ * ????
+ *
+ * @param reqDto
+ */
+ public void updateTags(DeviceAddReq reqDto) {
+ execute(retrofitIotService.updateTags(reqDto));
+ }
+
+ /**
+ * 查询设备详情
+ *
+ * @param pk
+ * @param devId
+ * @return
+ */
+ public DeviceApiDTO deviceInfo(String pk, String devId) {
+ return execute(retrofitIotService.deviceInfo(pk, devId));
+ }
+
+ /**
+ * 查询设备影子
+ *
+ * @param pk
+ * @param devId
+ * @return
+ */
+ public Snapshot getDeviceSnapshot(String pk, String devId) {
+ return execute(retrofitIotService.getDeviceSnapshot(pk, devId));
+ }
+
+ /**
+ * 删除设备
+ *
+ * @param pk
+ * @param devId
+ * @param delSnapshot
+ */
+ public void delDevice(String pk, String devId, boolean delSnapshot) {
+ execute(retrofitIotService.delDevice(pk, devId, delSnapshot));
+ }
+
+ /**
+ * 批量查删除设备
+ *
+ * @param deviceList
+ */
+ public void bathDelDevice(List deviceList) {
+ execute(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 execute(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 execute(retrofitIotService.deviceCloudSend(pk, devId, data));
+ }
+
+ /**
+ * 查询命令状态
+ *
+ * @param messageId
+ * @return
+ */
+ public CloudSendMsgDTO cloudSendMsgInfo(String messageId) {
+ return execute(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 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 execute(retrofitIotService.addTopo(pk, devId, sub));
+ }
+
+ /**
+ * 网关删除子设备
+ *
+ * @param pk
+ * @param devId
+ * @param sub
+ * @return
+ */
+ 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/CloudSendMsgDTO.java b/src/main/java/me/hekr/iotos/api/dto/CloudSendMsgDTO.java
new file mode 100644
index 0000000000000000000000000000000000000000..6202ed11b8c7e7f679327c2e9c33c1c408cb1732
--- /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 0000000000000000000000000000000000000000..958942327a3575726dbf6d3379b6845385c0626e
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/DataValueChecker.java
@@ -0,0 +1,43 @@
+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 me.hekr.iotos.api.enums.CheckType;
+import me.hekr.iotos.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 0000000000000000000000000000000000000000..efb599c9deb87a2d01ece392b0e2485a5d0fa482
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/DataValueEnumChecker.java
@@ -0,0 +1,105 @@
+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 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 {
+ 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 0000000000000000000000000000000000000000..238dc91666dec276281a730cdf4d2401168c07f2
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/DataValueLengthChecker.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.JsonTypeName;
+import me.hekr.iotos.api.enums.CheckType;
+import me.hekr.iotos.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 0000000000000000000000000000000000000000..53eec00c9bad25e191c192c31d2f5eb217af5504
--- /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 0000000000000000000000000000000000000000..4b17ef7fa76df9c19be685b9c7a83eb9b71662eb
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/DataValueRangeChecker.java
@@ -0,0 +1,51 @@
+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 me.hekr.iotos.api.enums.CheckType;
+import me.hekr.iotos.api.enums.DataType;
+
+@JsonTypeName("RANGE")
+@JsonInclude(Include.NON_NULL)
+public class DataValueRangeChecker implements DataValueChecker {
+ private ModelParamValue extends Number> max;
+ private ModelParamValue extends Number> 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 0000000000000000000000000000000000000000..f93c6e717c41c915217ef39077a847369168a799
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/DelTopoResp.java
@@ -0,0 +1,45 @@
+package me.hekr.iotos.api.dto;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+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/Device.java b/src/main/java/me/hekr/iotos/api/dto/Device.java
index 902f2cfc8747bec2e0012ee3f98621108d4883f5..b01cddb397b5555ae8e1d7005b03fc7255552c2c 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
new file mode 100644
index 0000000000000000000000000000000000000000..76a65e9858a679e80dfd8357ad8fa976e7649cdc
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/DeviceApiDTO.java
@@ -0,0 +1,111 @@
+package me.hekr.iotos.api.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+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;
+
+ /** 顶级节点设备的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 0000000000000000000000000000000000000000..768b923f78017b66839e1616cc99d87076191e86
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/DeviceDTO.java
@@ -0,0 +1,345 @@
+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 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 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 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 7ed4e66ccaed1d64bb3994ffdf3c3a0093e20615..ac817c924294d37961a5a16d120ff47f229e0831 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/DeviceStatusRes.java b/src/main/java/me/hekr/iotos/api/dto/DeviceStatusRes.java
new file mode 100644
index 0000000000000000000000000000000000000000..38fa554ce82efec71ff5f400865323f0b9a46be8
--- /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 0000000000000000000000000000000000000000..a846eda446b825fad0a759a7afb9cf059b62c579
--- /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 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 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 0000000000000000000000000000000000000000..ebfdf8ca05599fbef64686152a4a0b021ad711ba
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/ModelCmdDTO.java
@@ -0,0 +1,76 @@
+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 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 0000000000000000000000000000000000000000..04a0d980dbf61b3b1cdad7690eb142603323a5f3
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/ModelParamDTO.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 com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+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 0000000000000000000000000000000000000000..fcb255c62f1bc449d0747f44bf01a5ee8bc9a839
--- /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 0000000000000000000000000000000000000000..69995316834a4a2f1274dbd954d47a8e4e39a41a
--- /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/Product.java b/src/main/java/me/hekr/iotos/api/dto/Product.java
index 1c14d2a9811ecf32d4d723a9f5bba207c290bcc6..c5c83a77140ab6c6c2ed8919e063a290ea2204a0 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 0000000000000000000000000000000000000000..71c45b55fcb067d97b615d885d6ed3278f21bbb9
--- /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
new file mode 100644
index 0000000000000000000000000000000000000000..4b82d21ec57e7d3a63902a4558b1a13f25a6a614
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/Snapshot.java
@@ -0,0 +1,126 @@
+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 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 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 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 0000000000000000000000000000000000000000..4e111db335fa9aebc7afeeb829d903b35bbb2ffe
--- /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 Tag of(String key, String value) {
+ return new 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 0000000000000000000000000000000000000000..055dc3e3740521b2167b16a758e00af653823bf3
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/AddTopo.java
@@ -0,0 +1,34 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+import me.hekr.iotos.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 0000000000000000000000000000000000000000..700072af321a7054516768445cab327938fab532
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/AddTopoResp.java
@@ -0,0 +1,42 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+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 0000000000000000000000000000000000000000..dbb57585e196302309253d24b39b8dcd2101b0d3
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/BatchDevSend.java
@@ -0,0 +1,36 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+
+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 0000000000000000000000000000000000000000..8b6968b20db08f6d554a6ae7d544664583eee747
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/CloudSend.java
@@ -0,0 +1,35 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+
+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 0000000000000000000000000000000000000000..65ccad29277ca19fad9c81483c1b0d5a7ef896ff
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/DelTopo.java
@@ -0,0 +1,34 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+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 0000000000000000000000000000000000000000..d6947b9557b91ae6923a251be2724c93ee883ed4
--- /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 0000000000000000000000000000000000000000..58e116f4bd9eaaf5347e65dc82a2f1e005949e30
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevLogin.java
@@ -0,0 +1,51 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+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 0000000000000000000000000000000000000000..3537be22518a2770542bf52827b770e05870f87d
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevLogout.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 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 0000000000000000000000000000000000000000..46b8727f3a0cc8cfa37e274a6991819e5bac86e7
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevSend.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 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 0000000000000000000000000000000000000000..28ad4739bd96a8883647f103c2f5f237d63e8d4e
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgrade.java
@@ -0,0 +1,147 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+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 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 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 0000000000000000000000000000000000000000..be1904c011336f45b8ad9bb24ed29db443737454
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/DevUpgradeProgress.java
@@ -0,0 +1,86 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+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 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 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 0000000000000000000000000000000000000000..b5c33233ffb5fef0c191620cefb1e425c348e916
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/GetConfig.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 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 0000000000000000000000000000000000000000..d65ced99639c4d94744755de38229c6b45f35991
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/GetConfigResp.java
@@ -0,0 +1,101 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+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 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 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 0000000000000000000000000000000000000000..81e637ad0421b27a0cdf91da9694a08874338e5c
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/GetTopo.java
@@ -0,0 +1,26 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+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 0000000000000000000000000000000000000000..16f0cef691a6b53c0dbc26ab6ed6830ab007dcce
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/Klink.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 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 0000000000000000000000000000000000000000..dd51ab51e9073b2e441080aa61b9dc0b08a66b53
--- /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)
+//
+
+
+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;
+ }
+
+ @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
new file mode 100644
index 0000000000000000000000000000000000000000..1c77b9ea9e69bebabb9a128e6f0eb0a72c9bbcb9
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/KlinkResp.java
@@ -0,0 +1,103 @@
+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.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 0000000000000000000000000000000000000000..0152d947e1b3141d9aa9335c5ffe3b7a6ea2ab71
--- /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 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 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 0000000000000000000000000000000000000000..b7704449240028d4a140a95de325866874371e41
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/NotSupport.java
@@ -0,0 +1,24 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+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 0000000000000000000000000000000000000000..6e8875f93d6a847b08f79c0b5323b55efd92737f
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/Register.java
@@ -0,0 +1,211 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+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 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 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 0000000000000000000000000000000000000000..2360c8975a421f6cb034e2d9e08a50a6badeee93
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/RegisterResp.java
@@ -0,0 +1,81 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+//
+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 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 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 0000000000000000000000000000000000000000..35e4f9f929b5e4c9589286f044bacd3e1d0e7915
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/ReportFirmware.java
@@ -0,0 +1,45 @@
+package me.hekr.iotos.api.dto.klink;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+
+
+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 0000000000000000000000000000000000000000..df0690840def518d494ea20715e018f5dcd8912d
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/dto/klink/SuModelData.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)
+//
+
+
+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 0000000000000000000000000000000000000000..ab31b7a64d80cbd6dfe38cc7e42585af3e20a4d8
--- /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 0000000000000000000000000000000000000000..18e77a5c26be9252c12ebc57f33c67df9b99cf8c
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/enums/Action.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 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 extends Klink> klinkClass;
+ private FrameType frameType;
+
+ private Action(String action, FrameType frameType, Class extends Klink> 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 extends Klink> 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 0000000000000000000000000000000000000000..32ed63632e1d8e6fbe2d772f335c3cf0960d9388
--- /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/DataCheckMode.java b/src/main/java/me/hekr/iotos/api/enums/DataCheckMode.java
new file mode 100644
index 0000000000000000000000000000000000000000..5db8f283191f1bba231ce4663c0b790888644534
--- /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 0000000000000000000000000000000000000000..8f70342117ff97e62134ee533f02947f48756028
--- /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
new file mode 100644
index 0000000000000000000000000000000000000000..46219611c2851c6ba83516a8455a57806915e351
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/enums/DataType.java
@@ -0,0 +1,116 @@
+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.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;
+import me.hekr.iotos.api.dto.DataValueRangeChecker;
+
+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 extends DataValueChecker>... 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 extends DataValueChecker> 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 0000000000000000000000000000000000000000..0ebb5bd8fb3eae45462fed312a5da54b8c464178
--- /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 0000000000000000000000000000000000000000..689f1b323ce3eabc257a984df26db5f4c2d3a1d6
--- /dev/null
+++ b/src/main/java/me/hekr/iotos/api/enums/ErrorCode.java
@@ -0,0 +1,96 @@
+package me.hekr.iotos.api.enums;
+
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (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;
+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 0000000000000000000000000000000000000000..4ef7cd40e246ee0936ada8afff125938a6ca0ba1
--- /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 0000000000000000000000000000000000000000..2f65c7db8ef2523f2dde6b4e7f6756ff7e119ee9
--- /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/enums/TransferType.java b/src/main/java/me/hekr/iotos/api/enums/TransferType.java
index d8634e410ac70f960eeb103cce72cd29a361a30b..0092fc1984c300a73e368893b6cc208e863d842d 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 42ce58ed6b633e39c66b19f92d44e1cde878ecb9..1785bcb1bdccf65935278ac96078ec231244e801 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,32 @@
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 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.omg.CORBA.Any;
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;
@@ -38,7 +42,7 @@ public interface RetrofitIotService {
/**
* 获取产品列表
*
- *
文档
+ *
获取产品列表
*
* @param page 当前页,从0开始
* @param size 分页大小,最大100,最小1
@@ -50,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
@@ -84,7 +78,7 @@ public interface RetrofitIotService {
/**
* 导入设备
*
- *
文档
+ *
导入设备
*
* @return
*/
@@ -94,10 +88,10 @@ public interface RetrofitIotService {
/**
* 获取批次下所有设备
*
- *
文档
+ *
获取批次下所有设备
*
- * @param pk
- * @param batchName
+ * @param pk 产品PK
+ * @param batchName 批次名称
* @return
*/
@GET("/api/device/getBatchDevices/{pk}/{batchName}")
@@ -106,7 +100,7 @@ public interface RetrofitIotService {
/**
* 查询设备列表
*
- *
文档
+ *
查询设备列表
*
* @param params
* @return
@@ -117,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}")
@@ -140,47 +134,268 @@ 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 产品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 pk
- * @param devId
+ * @param reqDto 设备信息(pk,devId,name)
* @return
*/
- @GET("/api/device/getDeviceHistoryData/{pk}/{devId}")
- Call getDeviceHistoryData(@Path("pk") String pk, @Path("devId") String devId);
+ @POST("/api/device/addDevice")
+ Call addDevice(@Body DeviceAddReq reqDto);
/**
- * 查询设备影子
+ * 导入设备
+ *
+ * 导入设备
*
+ * @param devIdListReq (产品PK和设备ID列表)
+ * @return
+ */
+ @POST("/api/device/batchAddDevices")
+ Call