1078-添加文件上传控制

This commit is contained in:
648540858
2024-04-07 07:02:06 +08:00
parent 5fc1000fcc
commit 4ec4d618d6
2 changed files with 72 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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 +
'}';
}
}