ncc协议x
This commit is contained in:
parent
87cae1312d
commit
206495212a
@ -0,0 +1,136 @@
|
||||
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.9列车信息全体消息
|
||||
*/
|
||||
public class TrainIndicationInitRsp extends MessageData {
|
||||
/**
|
||||
* 线路号(2)
|
||||
*/
|
||||
private Short lineId;
|
||||
/**
|
||||
* 列车数量(2)
|
||||
*/
|
||||
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<trainCnt;cnt++){
|
||||
this.trains.add(new TrainCell().decode(buf));
|
||||
}
|
||||
}
|
||||
public static class TrainCell{
|
||||
/**
|
||||
* 集中站站号(2)
|
||||
*/
|
||||
private Short rtuId;
|
||||
/**
|
||||
* NCC车次窗编号(2)
|
||||
*/
|
||||
private Short nccWindow;
|
||||
/**
|
||||
* 列车在车次窗中的位置(1)
|
||||
*/
|
||||
private Byte nccWindowOffset;
|
||||
/**
|
||||
* 列车所在的设备的类型(2)
|
||||
*/
|
||||
private Short devType;
|
||||
/**
|
||||
* 列车所在的设备的名称(24)
|
||||
*/
|
||||
private byte[] devName = new byte[24];
|
||||
/**
|
||||
* 列车标示号,全线唯一(若无法提供,缺省值为0)(10)
|
||||
*/
|
||||
private byte[] trainIndex = new byte[10];
|
||||
/**
|
||||
* 列车编组号(9)
|
||||
*/
|
||||
private byte[] groupId = new byte[9];
|
||||
/**
|
||||
* 表号(9)
|
||||
*/
|
||||
private byte[] trainId = new byte[9];
|
||||
/**
|
||||
* 车次号(12)
|
||||
*/
|
||||
private byte[] globalId = new byte[12];
|
||||
/**
|
||||
* 目的地号(4)
|
||||
*/
|
||||
private byte[] destinationId = new byte[4];
|
||||
/**
|
||||
* 编组数量(1)
|
||||
*/
|
||||
private byte rollingStock;
|
||||
/**
|
||||
* 司机号(13)
|
||||
*/
|
||||
private byte[] driverId = new byte[13];
|
||||
/**
|
||||
* 根据实际报点和计划的偏离时间(单位:秒,-215- +215 ,正数表示列车晚点秒数,负数表示列车早点秒数)(4)
|
||||
*/
|
||||
private Integer otpTime;
|
||||
/**
|
||||
* 列车状态,见附录6.3.14列车状态定义(4)
|
||||
*/
|
||||
private Integer mode;
|
||||
/**
|
||||
* 列车到点(7)
|
||||
*/
|
||||
private byte[] arriveTime = new byte[7];
|
||||
/**
|
||||
* 列车发点(7)
|
||||
*/
|
||||
private byte[] departTime = new byte[7];
|
||||
/**
|
||||
* 满载率(百分比,例如50,表示满载率为50%)(4)
|
||||
*/
|
||||
private Integer rate;
|
||||
/**
|
||||
* 速度(KM/H)(1)
|
||||
*/
|
||||
private byte speed;
|
||||
/**
|
||||
* 预留(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();
|
||||
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);
|
||||
this.otpTime=buf.readInt();
|
||||
this.mode=buf.readInt();
|
||||
buf.readBytes(this.arriveTime);
|
||||
buf.readBytes(this.departTime);
|
||||
this.rate = buf.readInt();
|
||||
this.speed=buf.readByte();
|
||||
buf.readBytes(this.reserve);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package club.joylink.xiannccda.ats.message.line3;
|
||||
|
||||
import club.joylink.xiannccda.ats.message.MessageData;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
/**
|
||||
* 2.7.8列车报点消息
|
||||
*/
|
||||
public class TrainRecordRsp extends MessageData {
|
||||
|
||||
/**
|
||||
* 线路号(2)
|
||||
*/
|
||||
private Short lineId;
|
||||
/**
|
||||
* 表号(9)
|
||||
*/
|
||||
private byte[] trainId = new byte[9];
|
||||
/**
|
||||
* 车次号(12)
|
||||
*/
|
||||
private byte[] globalId = new byte[12];
|
||||
/**
|
||||
* 局部序列号(4)
|
||||
*/
|
||||
private byte[] localSubId = new byte[4];
|
||||
/**
|
||||
* 车组号(9)
|
||||
*/
|
||||
private byte[] groupId = new byte[9];
|
||||
/**
|
||||
* 目的地(4)
|
||||
*/
|
||||
private byte[] destinationId = new byte[4];
|
||||
/**
|
||||
* 列车类型(2)
|
||||
*/
|
||||
private Short trainType;
|
||||
/**
|
||||
* 运行方向(1)
|
||||
*/
|
||||
private Byte direction;
|
||||
/**
|
||||
* 站号(2)
|
||||
*/
|
||||
private Short stationId;
|
||||
/**
|
||||
* 站台编号(2)
|
||||
*/
|
||||
private Short sideId;
|
||||
/**
|
||||
* 轨道名称(小区段名称)(20)
|
||||
*/
|
||||
private byte[] trackName = new byte[20];
|
||||
/**
|
||||
* 到发点类型(2)
|
||||
*/
|
||||
private Short recordType;
|
||||
/**
|
||||
* 到发时间(7)
|
||||
*/
|
||||
private byte[] recordTime = new byte[7];
|
||||
/**
|
||||
* 预留(4)
|
||||
*/
|
||||
private byte[] reserve = new byte[4];
|
||||
|
||||
@Override
|
||||
public void decode2(ByteBuf buf) throws Exception {
|
||||
this.lineId = buf.readShort();
|
||||
buf.readBytes(this.trainId);
|
||||
buf.readBytes(this.globalId);
|
||||
buf.readBytes(this.localSubId);
|
||||
buf.readBytes(this.groupId);
|
||||
buf.readBytes(this.destinationId);
|
||||
this.trainType = buf.readShort();
|
||||
this.direction = buf.readByte();
|
||||
this.stationId = buf.readShort();
|
||||
this.sideId = buf.readShort();
|
||||
buf.readBytes(this.trackName);
|
||||
this.recordType = buf.readShort();
|
||||
buf.readBytes(this.recordTime);
|
||||
buf.readBytes(this.reserve);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user