1078-设置矩形区域+删除矩形区域

This commit is contained in:
648540858
2024-05-04 14:35:45 +08:00
parent faa0a01b9f
commit 4a5de5a2db
8 changed files with 386 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
package com.genersoft.iot.vmp.jt1078.proc.response;
import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
import com.genersoft.iot.vmp.jt1078.bean.JTCircleArea;
import com.genersoft.iot.vmp.jt1078.bean.JTRectangleArea;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
/**
* 设置矩形区域
*/
@MsgId(id = "8602")
public class J8602 extends Rs {
/**
* 设置属性, 0更新区域 1追加区域 2修改区域
*/
private int attribute;
/**
* 区域项
*/
private List<JTRectangleArea> rectangleAreas;
@Override
public ByteBuf encode() {
ByteBuf buffer = Unpooled.buffer();
buffer.writeByte(attribute);
buffer.writeByte(rectangleAreas.size());
if (rectangleAreas.isEmpty()) {
return buffer;
}
for (JTRectangleArea area : rectangleAreas) {
buffer.writeBytes(area.encode());
}
return buffer;
}
public int getAttribute() {
return attribute;
}
public void setAttribute(int attribute) {
this.attribute = attribute;
}
public List<JTRectangleArea> getRectangleAreas() {
return rectangleAreas;
}
public void setRectangleAreas(List<JTRectangleArea> rectangleAreas) {
this.rectangleAreas = rectangleAreas;
}
}

View File

@@ -0,0 +1,44 @@
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.Unpooled;
import java.util.List;
/**
* 删除矩形区域
*/
@MsgId(id = "8603")
public class J8603 extends Rs {
/**
* 待删除的区域ID
*/
private List<Long> idList;
@Override
public ByteBuf encode() {
ByteBuf buffer = Unpooled.buffer();
if (idList == null || idList.isEmpty()) {
buffer.writeByte(0);
return buffer;
}else {
buffer.writeByte(idList.size());
}
for (Long id : idList) {
buffer.writeInt((int) (id & 0xffffffffL));
}
return buffer;
}
public List<Long> getIdList() {
return idList;
}
public void setIdList(List<Long> idList) {
this.idList = idList;
}
}