ncc协议x

This commit is contained in:
xzb 2023-06-08 11:18:53 +08:00
parent f6f30a083f
commit bf3267a695
2 changed files with 35 additions and 6 deletions

View File

@ -3,6 +3,8 @@ package club.joylink.xiannccda.ats.message.line3;
import club.joylink.xiannccda.ats.message.MessageResponse;
import io.netty.buffer.ByteBuf;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ -55,20 +57,36 @@ public class DispatcherReportResponse extends MessageResponse {
/**
* 日期(7)
*/
private byte[] reportTime = new byte[7];
private LocalDateTime reportTime;
/**
* 调度员(32)
*/
private byte[] userName = new byte[32];
private String userName;
/**
* 记录内容(256)
*/
private byte[] logItem = new byte[256];
private String logItem;
public LogCell decode(final ByteBuf buf) {
buf.readBytes(this.reportTime);
buf.readBytes(this.userName);
buf.readBytes(this.logItem);
/**
* 日期(7)
*/
final byte[] reportTime = new byte[7];
/**
* 调度员(32)
*/
final byte[] userName = new byte[32];
/**
* 记录内容(256)
*/
final byte[] logItem = new byte[256];
buf.readBytes(reportTime);
buf.readBytes(userName);
buf.readBytes(logItem);
//
this.reportTime = DateTimeUtil.convert(reportTime);
this.userName = new String(userName, MessageCons.STRING_CHARSET);
//
return this;
}
}

View File

@ -0,0 +1,11 @@
package club.joylink.xiannccda.ats.message.line3;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
public class MessageCons {
/**
* 协议中字符串编码
*/
public static final Charset STRING_CHARSET = StandardCharsets.UTF_8;
}