This commit is contained in:
weizhihong 2023-06-08 15:07:47 +08:00
commit f1cb61ddf4
3 changed files with 91 additions and 52 deletions

View File

@ -42,44 +42,44 @@ public class TrainBlockInfoResponse extends MessageResponse {
/**
* 列车编组号(9)
*/
private String groupId;
private String groupId;
/**
* 表号(9)
*/
private String trainId;
private String trainId;
/**
* 方向(1)
* 0上行
* 1下行
* 2未知
*/
private DirectionEnum direction;
private DirectionEnum direction;
/**
* 列车所在区间左边车站的站号(2)
*/
private Short stationIdInUpSide;
private Short stationIdInUpSide;
/**
* 列车所在区间右边车站的站号(2)
*/
private Short stationIdInDownSide;
private Short stationIdInDownSide;
/**
* 集中站站号(2)
*/
private Short rtuId;
private Short rtuId;
/**
* 列车所在的设备的类型(2)
*/
private Short devType;
private DeviceTypeEnum devType;
/**
* 列车所在的设备的名称(24)
*/
private String devName;
private String devName;
/**
* 列车阻塞标记(1)
* 1列车阻塞
* 0列车没有阻塞
*/
private Boolean blockFlag;
private Boolean blockFlag;
private TrainCell decode(final ByteBuf buf) {
final byte[] groupId = new byte[9];
@ -87,6 +87,7 @@ public class TrainBlockInfoResponse extends MessageResponse {
byte direction;
final byte[] devName = new byte[24];
byte blockFlag;
short devType;
//
buf.readBytes(groupId);
buf.readBytes(trainId);
@ -94,12 +95,13 @@ public class TrainBlockInfoResponse extends MessageResponse {
this.stationIdInUpSide = buf.readShort();
this.stationIdInDownSide = buf.readShort();
this.rtuId = buf.readShort();
this.devType = buf.readShort();
devType = buf.readShort();
buf.readBytes(devName);
blockFlag = buf.readByte();
//
this.groupId = new String(groupId, MessageCons.STRING_CHARSET);
this.trainId = new String(trainId, MessageCons.STRING_CHARSET);
this.devType = DeviceTypeEnum.of(devType);
this.devName = new String(devName, MessageCons.STRING_CHARSET);
this.direction = DirectionEnum.of(direction);
switch (blockFlag) {

View File

@ -2,13 +2,16 @@ package club.joylink.xiannccda.ats.message.line3;
import club.joylink.xiannccda.ats.message.MessageResponse;
import io.netty.buffer.ByteBuf;
import lombok.Getter;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* 2.7.9列车信息全体消息
*/
@Getter
public class TrainIndicationInitResponse extends MessageResponse {
/**
@ -34,105 +37,127 @@ public class TrainIndicationInitResponse extends MessageResponse {
}
}
@Getter
public static class TrainCell {
/**
* 集中站站号(2)
*/
private Short rtuId;
private Short rtuId;
/**
* NCC车次窗编号(2)
*/
private Short nccWindow;
private Short nccWindow;
/**
* 列车在车次窗中的位置(1)
*/
private Byte nccWindowOffset;
private Byte nccWindowOffset;
/**
* 列车所在的设备的类型(2)
*/
private Short devType;
private DeviceTypeEnum devType;
/**
* 列车所在的设备的名称(24)
*/
private byte[] devName = new byte[24];
private String devName;
/**
* 列车标示号全线唯一若无法提供缺省值为0(10)
*/
private byte[] trainIndex = new byte[10];
private String trainIndex;
/**
* 列车编组号(9)
*/
private byte[] groupId = new byte[9];
private String groupId;
/**
* 表号(9)
*/
private byte[] trainId = new byte[9];
private String trainId;
/**
* 车次号(12)
*/
private byte[] globalId = new byte[12];
private String globalId;
/**
* 目的地号(4)
*/
private byte[] destinationId = new byte[4];
private Integer destinationId;
/**
* 编组数量(1)
*/
private byte rollingStock;
private byte rollingStock;
/**
* 司机号(13)
*/
private byte[] driverId = new byte[13];
private String driverId;
/**
* 根据实际报点和计划的偏离时间单位-215- +215 正数表示列车晚点秒数负数表示列车早点秒数(4)
*/
private Integer otpTime;
private Integer otpTime;
/**
* 列车状态见附录6.3.14列车状态定义(4)
*/
private Integer mode;
private Integer mode;
/**
* 列车到点(7)
*/
private byte[] arriveTime = new byte[7];
private LocalDateTime arriveTime;
/**
* 列车发点(7)
*/
private byte[] departTime = new byte[7];
private LocalDateTime departTime;
/**
* 满载率百分比例如50表示满载率为50%(4)
*/
private Integer rate;
private Integer rate;
/**
* 速度KM/H(1)
*/
private byte speed;
private byte speed;
/**
* 预留(2)
*/
private byte[] reserve = new byte[2];
private byte[] reserve = new byte[2];
private TrainCell decode(final ByteBuf buf) {
short devType;
final byte[] devName = new byte[24];
final byte[] trainIndex = new byte[10];
final byte[] groupId = new byte[9];
final byte[] trainId = new byte[9];
final byte[] globalId = new byte[12];
final byte[] driverId = new byte[13];
final byte[] arriveTime = new byte[7];
final byte[] departTime = new byte[7];
//
this.rtuId = buf.readShort();
this.nccWindow = buf.readShort();
this.nccWindowOffset = buf.readByte();
this.devType = buf.readShort();
buf.readBytes(this.devName);
buf.readBytes(this.trainIndex);
buf.readBytes(this.groupId);
buf.readBytes(this.trainId);
buf.readBytes(this.globalId);
buf.readBytes(this.destinationId);
this.rollingStock = buf.readByte();
buf.readBytes(this.driverId);
devType = buf.readShort();
buf.readBytes(devName);
buf.readBytes(trainIndex);
buf.readBytes(groupId);
buf.readBytes(trainId);
buf.readBytes(globalId);
this.destinationId = buf.readInt();
this.rollingStock = buf.readByte();
buf.readBytes(driverId);
this.otpTime = buf.readInt();
this.mode = buf.readInt();
buf.readBytes(this.arriveTime);
buf.readBytes(this.departTime);
buf.readBytes(arriveTime);
buf.readBytes(departTime);
this.rate = buf.readInt();
this.speed = buf.readByte();
buf.readBytes(this.reserve);
//
this.devType = DeviceTypeEnum.of(devType);
this.devName = new String(devName, MessageCons.STRING_CHARSET);
this.trainIndex = new String(trainIndex, MessageCons.STRING_CHARSET);
this.groupId = new String(groupId, MessageCons.STRING_CHARSET);
this.trainId = new String(trainId, MessageCons.STRING_CHARSET);
this.globalId = new String(globalId, MessageCons.STRING_CHARSET);
this.driverId = new String(driverId, MessageCons.STRING_CHARSET);
this.arriveTime = DateTimeUtil.convert(arriveTime);
this.departTime = DateTimeUtil.convert(departTime);
//
return this;
}
}

View File

@ -2,54 +2,66 @@ package club.joylink.xiannccda.ats.message.line3;
import club.joylink.xiannccda.ats.message.MessageResponse;
import io.netty.buffer.ByteBuf;
import lombok.Getter;
/**
* 2.7.11 列车信息删除消息
*/
@Getter
public class TrainIndicationRemoveResponse extends MessageResponse {
/**
* 线路号(2)
*/
private Short lineId;
private Short lineId;
/**
* 集中站站号(2)
*/
private Short rtuId;
private Short rtuId;
/**
* NCC车次窗编号(2)
*/
private Short nccWindow;
private Short nccWindow;
/**
* 列车在车次窗中的位置(1)
*/
private Byte nccWindowOffset;
private Byte nccWindowOffset;
/**
* 列车所在的设备的类型(2)
*/
private Short devType;
private DeviceTypeEnum devType;
/**
* 列车所在的设备的名称(24)
*/
private byte[] devName = new byte[24];
private String devName;
/**
* 列车标示号全线唯一若无法提供缺省值为0(10)
*/
private byte[] trainIndex = new byte[10];
private String trainIndex;
/**
* 列车编组号(9)
*/
private byte[] groupId = new byte[9];
private String groupId;
@Override
public void decode2(ByteBuf buf) throws Exception {
short devType;
final byte[] devName = new byte[24];
final byte[] trainIndex = new byte[10];
final byte[] groupId = new byte[9];
//
this.lineId = buf.readShort();
this.rtuId = buf.readShort();
this.nccWindow = buf.readShort();
this.nccWindowOffset = buf.readByte();
this.devType = buf.readShort();
buf.readBytes(this.devName);
buf.readBytes(this.trainIndex);
buf.readBytes(this.groupId);
devType = buf.readShort();
buf.readBytes(devName);
buf.readBytes(trainIndex);
buf.readBytes(groupId);
//
this.devType = DeviceTypeEnum.of(devType);
this.devName = new String(devName, MessageCons.STRING_CHARSET);
this.trainIndex = new String(trainIndex, MessageCons.STRING_CHARSET);
this.groupId = new String(groupId, MessageCons.STRING_CHARSET);
}
}