ncc协议x

This commit is contained in:
xzb 2023-06-08 13:57:16 +08:00
parent b2ff6a0334
commit 6f5c63565e

View File

@ -2,43 +2,40 @@ package club.joylink.xiannccda.ats.message.line3;
import club.joylink.xiannccda.ats.message.MessageResponse;
import io.netty.buffer.ByteBuf;
import lombok.Getter;
@Getter
public class MessageAlarmResponse extends MessageResponse {
/**
* 线路号(2)
*/
private Short lineId;
private Short lineId;
/**
* 报警事件产生的时间(4)
*/
private Long genTime;
/**
* Tag_id字符串的长度(2)
*/
private Short tagLen;
private Long genTime;
/**
* 报警标识字符串(tagLen)
*/
private byte[] tagId;
/**
* 报警内容字符串长度(2)
*/
private Short alarmLen;
private String tagId;
/**
* 报警内容(alarmLen)
*/
private byte[] alarmContent;
private String alarmContent;
@Override
public void decode2(ByteBuf buf) throws Exception {
this.lineId = buf.readShort();
this.genTime = buf.readUnsignedInt();
this.tagLen = buf.readShort();
this.tagId = new byte[this.tagLen];
buf.readBytes(this.tagId);
this.alarmLen = buf.readShort();
this.alarmContent = new byte[this.alarmLen];
buf.readBytes(this.alarmContent);
final short tagLen = buf.readShort();
final byte[] tagId = new byte[tagLen];
buf.readBytes(tagId);
final short alarmLen = buf.readShort();
final byte[] alarmContent = new byte[alarmLen];
buf.readBytes(alarmContent);
//
this.tagId = new String(tagId, MessageCons.STRING_CHARSET);
this.alarmContent = new String(alarmContent, MessageCons.STRING_CHARSET);
}
}