ncc协议x

This commit is contained in:
xzb 2023-06-07 16:31:24 +08:00
parent 99f101a06f
commit e71876efd7

View File

@ -0,0 +1,47 @@
package club.joylink.xiannccda.ats.message.line3;
import club.joylink.xiannccda.ats.message.MessageId;
import club.joylink.xiannccda.ats.message.MessageRequest;
import io.netty.buffer.ByteBuf;
import java.time.LocalDateTime;
import java.util.Arrays;
/**
* 2.9.3.1 断点续传申请消息<br>
* 时间范围说明<br>
* 申请消息的时间范围结束时间与开始时间之差不超过1小时<br>
*/
public class ResumeAskRequest extends MessageRequest {
/**
* 线路号(2)
*/
private Short lineId;
/**
* 开始时间(7)
*/
private byte[] beginTime;
/**
* 结束时间(7)
*/
private byte[] endTime;
public ResumeAskRequest(Short lineId, LocalDateTime begin, LocalDateTime end) {
super(MessageId.Resume_ASK, 2 + 7 + 7);
this.lineId = lineId;
this.beginTime = new byte[7];
Arrays.fill(this.beginTime, (byte) 0);
DateTimeUtil.convert(begin, this.beginTime);
this.endTime = new byte[7];
Arrays.fill(this.endTime, (byte) 0);
DateTimeUtil.convert(end, this.endTime);
}
@Override
public void encode2(ByteBuf buf) {
buf.writeShort(this.lineId);
buf.writeBytes(this.beginTime);
buf.writeBytes(this.endTime);
}
}