ncc协议x
This commit is contained in:
parent
a94d64947e
commit
d33f6366ac
@ -3,17 +3,92 @@ package club.joylink.xiannccda.ats.message.line3;
|
||||
import club.joylink.xiannccda.ats.message.MessageData;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 2.7.13 列车阻塞消息
|
||||
*/
|
||||
public class TrainBlockInfoRsp extends MessageData {
|
||||
|
||||
/**
|
||||
* 线路号(2)
|
||||
*/
|
||||
private Short lineId;
|
||||
private Short lineId;
|
||||
/**
|
||||
* 列车数量(2)
|
||||
*/
|
||||
private Short trainCnt;
|
||||
private Short trainCnt;
|
||||
/**
|
||||
* 列车列表
|
||||
*/
|
||||
private List<TrainCell> trains;
|
||||
|
||||
@Override
|
||||
public void decode2(ByteBuf buf) throws Exception {
|
||||
this.lineId = buf.readShort();
|
||||
this.trainCnt = buf.readShort();
|
||||
this.trains = new ArrayList<>(this.trainCnt);
|
||||
for (int cnt = 0; cnt < this.trainCnt; cnt++) {
|
||||
this.trains.add(new TrainCell().decode(buf));
|
||||
}
|
||||
}
|
||||
|
||||
public static class TrainCell {
|
||||
|
||||
/**
|
||||
* 列车编组号(9)
|
||||
*/
|
||||
private byte[] groupId = new byte[9];
|
||||
/**
|
||||
* 表号(9)
|
||||
*/
|
||||
private byte[] trainId = new byte[9];
|
||||
/**
|
||||
* 方向(1)
|
||||
* 0:上行
|
||||
* 1:下行
|
||||
* 2:未知
|
||||
*/
|
||||
private byte direction;
|
||||
/**
|
||||
* 列车所在区间左边车站的站号(2)
|
||||
*/
|
||||
private Short stationIdInUpSide;
|
||||
/**
|
||||
* 列车所在区间右边车站的站号(2)
|
||||
*/
|
||||
private Short stationIdInDownSide;
|
||||
/**
|
||||
* 集中站站号(2)
|
||||
*/
|
||||
private Short rtuId;
|
||||
/**
|
||||
* 列车所在的设备的类型(2)
|
||||
*/
|
||||
private Short devType;
|
||||
/**
|
||||
* 列车所在的设备的名称(24)
|
||||
*/
|
||||
private byte[] devName = new byte[24];
|
||||
/**
|
||||
* 列车阻塞标记(1)
|
||||
* 1:列车阻塞
|
||||
* 0:列车没有阻塞
|
||||
*/
|
||||
private byte blockFlag;
|
||||
|
||||
private TrainCell decode(final ByteBuf buf) {
|
||||
buf.readBytes(this.groupId);
|
||||
buf.readBytes(this.trainId);
|
||||
this.direction = buf.readByte();
|
||||
this.stationIdInUpSide = buf.readShort();
|
||||
this.stationIdInDownSide = buf.readShort();
|
||||
this.rtuId = buf.readShort();
|
||||
this.devType = buf.readShort();
|
||||
buf.readBytes(this.devName);
|
||||
this.blockFlag = buf.readByte();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,14 +10,15 @@ import java.util.List;
|
||||
* 2.7.9列车信息全体消息
|
||||
*/
|
||||
public class TrainIndicationInitRsp extends MessageData {
|
||||
|
||||
/**
|
||||
* 线路号(2)
|
||||
*/
|
||||
private Short lineId;
|
||||
private Short lineId;
|
||||
/**
|
||||
* 列车数量(2)
|
||||
*/
|
||||
private Short trainCnt;
|
||||
private Short trainCnt;
|
||||
/**
|
||||
* 列车列表
|
||||
*/
|
||||
@ -25,62 +26,64 @@ public class TrainIndicationInitRsp extends MessageData {
|
||||
|
||||
@Override
|
||||
public void decode2(ByteBuf buf) throws Exception {
|
||||
this.lineId = buf.readShort();
|
||||
this.lineId = buf.readShort();
|
||||
this.trainCnt = buf.readShort();
|
||||
this.trains = new ArrayList<>(this.trainCnt);
|
||||
for(int cnt = 0;cnt<trainCnt;cnt++){
|
||||
this.trains = new ArrayList<>(this.trainCnt);
|
||||
for (int cnt = 0; cnt < trainCnt; cnt++) {
|
||||
this.trains.add(new TrainCell().decode(buf));
|
||||
}
|
||||
}
|
||||
public static class TrainCell{
|
||||
|
||||
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 Short devType;
|
||||
/**
|
||||
* 列车所在的设备的名称(24)
|
||||
*/
|
||||
private byte[] devName = new byte[24];
|
||||
private byte[] devName = new byte[24];
|
||||
/**
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)(10)
|
||||
*/
|
||||
private byte[] trainIndex = new byte[10];
|
||||
private byte[] trainIndex = new byte[10];
|
||||
/**
|
||||
* 列车编组号(9)
|
||||
*/
|
||||
private byte[] groupId = new byte[9];
|
||||
private byte[] groupId = new byte[9];
|
||||
/**
|
||||
* 表号(9)
|
||||
*/
|
||||
private byte[] trainId = new byte[9];
|
||||
private byte[] trainId = new byte[9];
|
||||
/**
|
||||
* 车次号(12)
|
||||
*/
|
||||
private byte[] globalId = new byte[12];
|
||||
private byte[] globalId = new byte[12];
|
||||
/**
|
||||
* 目的地号(4)
|
||||
*/
|
||||
private byte[] destinationId = new byte[4];
|
||||
private byte[] destinationId = new byte[4];
|
||||
/**
|
||||
* 编组数量(1)
|
||||
*/
|
||||
private byte rollingStock;
|
||||
private byte rollingStock;
|
||||
/**
|
||||
* 司机号(13)
|
||||
*/
|
||||
private byte[] driverId = new byte[13];
|
||||
private byte[] driverId = new byte[13];
|
||||
/**
|
||||
* 根据实际报点和计划的偏离时间(单位:秒,-215- +215 ,正数表示列车晚点秒数,负数表示列车早点秒数)(4)
|
||||
*/
|
||||
@ -92,11 +95,11 @@ public class TrainIndicationInitRsp extends MessageData {
|
||||
/**
|
||||
* 列车到点(7)
|
||||
*/
|
||||
private byte[] arriveTime = new byte[7];
|
||||
private byte[] arriveTime = new byte[7];
|
||||
/**
|
||||
* 列车发点(7)
|
||||
*/
|
||||
private byte[] departTime = new byte[7];
|
||||
private byte[] departTime = new byte[7];
|
||||
/**
|
||||
* 满载率(百分比,例如50,表示满载率为50%)(4)
|
||||
*/
|
||||
@ -104,31 +107,31 @@ public class TrainIndicationInitRsp extends MessageData {
|
||||
/**
|
||||
* 速度(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){
|
||||
this.rtuId = buf.readShort();
|
||||
this.nccWindow = buf.readShort();
|
||||
this.nccWindowOffset=buf.readByte();
|
||||
this.devType=buf.readShort();
|
||||
private TrainCell decode(final ByteBuf buf) {
|
||||
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();
|
||||
this.rollingStock = buf.readByte();
|
||||
buf.readBytes(this.driverId);
|
||||
this.otpTime=buf.readInt();
|
||||
this.mode=buf.readInt();
|
||||
this.otpTime = buf.readInt();
|
||||
this.mode = buf.readInt();
|
||||
buf.readBytes(this.arriveTime);
|
||||
buf.readBytes(this.departTime);
|
||||
this.rate = buf.readInt();
|
||||
this.speed=buf.readByte();
|
||||
this.rate = buf.readInt();
|
||||
this.speed = buf.readByte();
|
||||
buf.readBytes(this.reserve);
|
||||
return this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user