ncc协议x

This commit is contained in:
xzb 2023-06-07 15:18:04 +08:00
parent 86b4e39390
commit fa5c8ba927
2 changed files with 76 additions and 1 deletions

View File

@ -70,7 +70,7 @@ public enum MessageId {
/**
* 调度日志报告
*/
DISPATCHER_REPORT(0x0015, null),
DISPATCHER_REPORT(0x0015, ()->new DispatcherReportResponse()),
/**
* 存备车报告
*/

View File

@ -0,0 +1,75 @@
package club.joylink.xiannccda.ats.message.line3;
import club.joylink.xiannccda.ats.message.MessageResponse;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
/**
* 2.8.6 调度日志报告消息
*/
public class DispatcherReportResponse extends MessageResponse {
/**
* 线路号(2)
*/
private Short lineId;
/**
* 查询标识号(2)<br>
* 同一时间多个查询的report_id不允许重复答复消息中的report_id值跟查询消息中的相同
*/
private Short reportId;
/**
* 消息总数(2)
*/
private Short totalMessage;
/**
* 本消息的顺序号(2)
*/
private Short messageSequence;
/**
* 记录条数(2)
*/
private Short count;
/**
* 调度日志报告列表
*/
private List<LogCell> logs;
@Override
public void decode2(ByteBuf buf) throws Exception {
this.lineId=buf.readShort();
this.reportId=buf.readShort();
this.totalMessage=buf.readShort();
this.messageSequence=buf.readShort();
this.count=buf.readShort();
this.logs=new ArrayList<>(this.count);
for(int i=0;i<this.count;i++){
this.logs.add(new LogCell().decode(buf));
}
}
public static class LogCell {
/**
* 日期(7)
*/
private byte[] reportTime = new byte[7];
/**
* 调度员(32)
*/
private byte[] userName = new byte[32];
/**
* 记录内容(256)
*/
private byte[] logItem = new byte[256];
public LogCell decode(final ByteBuf buf) {
buf.readBytes(this.reportTime);
buf.readBytes(this.userName);
buf.readBytes(this.logItem);
return this;
}
}
}