diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/cmd/JT1078Template.java b/src/main/java/com/genersoft/iot/vmp/jt1078/cmd/JT1078Template.java index d6e8a424b..141c811fe 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/cmd/JT1078Template.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/cmd/JT1078Template.java @@ -23,6 +23,7 @@ public class JT1078Template { private static final String H9202 = "9202"; private static final String H9205 = "9205"; private static final String H9206 = "9206"; + private static final String H9207 = "9207"; private static final String H0001 = "0001"; private static final String H1205 = "1205"; @@ -129,6 +130,23 @@ public class JT1078Template { return SessionManager.INSTANCE.request(cmd, timeOut); } + /** + * 文件上传控制 + * + * @param devId 设备号 + * @param j9207 文件上传控制参数 + */ + public String fileUploadControl(String devId, J9207 j9207, Integer timeOut) { + Cmd cmd = new Cmd.Builder() + .setDevId(devId) + .setPackageNo(randomInt()) + .setMsgId(H9207) + .setRespId(H0001) + .setRs(j9207) + .build(); + return SessionManager.INSTANCE.request(cmd, timeOut); + } + private Long randomInt() { return (long) random.nextInt(1000) + 1; } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J9207.java b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J9207.java new file mode 100644 index 000000000..43f8acac7 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J9207.java @@ -0,0 +1,54 @@ +package com.genersoft.iot.vmp.jt1078.proc.response; + +import com.genersoft.iot.vmp.jt1078.annotation.MsgId; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufUtil; +import io.netty.buffer.Unpooled; +import io.netty.util.CharsetUtil; + +/** + * 文件上传控制 + * + */ +@MsgId(id = "9207") +public class J9207 extends Rs { + + // 对应平台文件上传消息的流水号 + Integer respNo; + + // 控制: 0:暂停; 1:继续; 2:取消 + private int control; + + @Override + public ByteBuf encode() { + ByteBuf buffer = Unpooled.buffer(); + buffer.writeShort(respNo); + buffer.writeByte(control); + return buffer; + } + + + public Integer getRespNo() { + return respNo; + } + + public void setRespNo(Integer respNo) { + this.respNo = respNo; + } + + public int getControl() { + return control; + } + + public void setControl(int control) { + this.control = control; + } + + @Override + public String toString() { + return "J9207{" + + "respNo=" + respNo + + ", control=" + control + + '}'; + } +}