This commit is contained in:
xzb 2023-06-08 17:06:54 +08:00
commit c926a4a6b5
13 changed files with 627 additions and 519 deletions

View File

@ -6,6 +6,7 @@ import java.nio.ByteBuffer;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@ -83,52 +84,6 @@ public abstract class MessageData {
return this.length + 2;
}
@NoArgsConstructor
public static class DateTime {
private short year;
private byte month;
private byte day;
private byte hour;
private byte minute;
private byte second;
public DateTime(ByteBuf buf) {
this.year = buf.readShort();
this.month = buf.readByte();
this.day = buf.readByte();
this.hour = buf.readByte();
this.minute = buf.readByte();
this.second = buf.readByte();
}
private DateTime(LocalDateTime localDateTime) {
this.year = (short) localDateTime.getYear();
this.month = (byte) localDateTime.getMonth().getValue();
this.day = (byte) localDateTime.getDayOfMonth();
this.hour = (byte) localDateTime.getHour();
this.minute = (byte) localDateTime.getMinute();
this.second = (byte) localDateTime.getSecond();
}
public byte[] requestData() {
ByteBuffer buf = ByteBuffer.allocate(7);
buf.putShort(this.year);
buf.put(this.month);
buf.put(this.day);
buf.put(this.hour);
buf.put(this.minute);
buf.put(this.second);
return buf.array();
}
public static DateTime parseNow() {
return new DateTime(LocalDateTime.now());
}
}
public enum ReportSiteEnum {
STATION(0x01), CENTER(0x02), UNKNOW(0x00);
@ -181,408 +136,5 @@ public abstract class MessageData {
}
}
public enum DeviceTypeEnum {
/**
* 未知的设备
*/
DEVICE_TYPE_UNKNOW(0),
/**
* 集中站
*/
DEVICE_TYPE_RTU(1),
/**
* 车站
*/
DEVICE_TYPE_STATION(2),
/**
* 信号机
*/
DEVICE_TYPE_SIGNAL(3),
/**
* 道岔
*/
DEVICE_TYPE_SWITCH(4),
/**
* 轨道
*/
DEVICE_TYPE_TRACK(5),
/**
* 方向
*/
DEVICE_TYPE_ENTRY(6),
/**
* 站台
*/
DEVICE_TYPE_PLATFORM(7),
/**
* 供电区段
*/
DEVICE_TYPE_SCADA(9),
/**
* 防淹门
*/
DEVICE_TYPE_WATERPROOF_DOOR(11),
/**
* 工作区
*/
DEVICE_TYPE_WORK_AREA(12),
/**
* 区域自动驾驶
*/
DEVICE_TYPE_GAMA(13),
;
int val;
DeviceTypeEnum(int d) {
this.val = d;
}
public static DeviceTypeEnum of(int d) {
return Arrays.stream(DeviceTypeEnum.values()).filter(dd -> dd.val == d).findFirst().orElse(null);
}
}
/**
* 表6.3-1设备状态定义表 - RTU
*/
public enum DeviceTypeStatusRTUEnum {
IP_RTU_STUS_DOWN(0x00008000),// 通信中断
IP_RTU_STUS_IN_LOCAL_CTRL(0x00000001),// 站控
IP_RTU_STUS_IN_CENTRAL_CTRL(0x00000002),// 遥控
IP_RTU_STUS_IN_EMERGENCY_CTRL(0x00000004);// 紧急站控
int val;
DeviceTypeStatusRTUEnum(int val) {
this.val = val;
}
}
/**
* 表6.3-2 设备状态定义表 STATION
* <p>
* 西安3号线信号系统不提供此类型设备的状态
*/
public enum DeviceTypeStatusSTATIONEnum {
IP_STA_STUS_TERM_MODE1(0x00000001),//终端模式1(terminaL3)
IP_STA_STUS_TERM_MODE2(0x00000002),//终端模式2(terminal2)
IP_STA_STUS_TERM_MODE3(0x00000004),//终端模式3(terminal3)
IP_STA_STUS_TERM_MODE4(0x00000008),//终端模式4(terminal4)
IP_STA_STUS_TERM_MODE5(0x00000010),//终端模式5(terminal5)
IP_STA_STUS_TERM_MODE6(0x00000020),//终端模式6(terminal6)
IP_STA_STUS_EXPECT_TERM_MODE1(0x00000040),//中间状态用户请求终端模式1中
IP_STA_STUS_EXPECT_TERM_MODE2(0x00000080),//中间状态用户请求终端模式2中
IP_STA_STUS_EXPECT_TERM_MODE3(0x00000100),//中间状态用户请求终端模式3中
IP_STA_STUS_EXPECT_TERM_MODE4(0x00000200),//中间状态用户请求终端模式4中
IP_STA_STUS_EXPECT_TERM_MODE5(0x00000400),//中间状态用户请求终端模式5中
IP_STA_STUS_EXPECT_TERM_MODE6(0x00000800),//中间状态用户请求终端模式6中
IP_STA_STUS_IN_CYCLE1(0x00001000),//自动折返1(CY1-CYC)
IP_STA_STUS_IN_CYCLE2(0x00002000),//自动折返2(CY2-CYC)
IP_STA_STUS_IN_CYCLE3(0x00004000),//自动折返3(CY3-CYC)
IP_STA_STUS_IN_CYCLE4(0x00008000),//自动折返4(CY4-CYC)
IP_STA_STUS_IN_CYCLE5(0x00010000),//自动折返5(CY5-CYC)
IP_STA_STUS_IN_CYCLE6(0x00020000),//自动折返6(CY6-CYC)
IP_STA_STUS_EXPECT_CYCLE1(0x00040000),//中间状态用户请求自动折返1中
IP_STA_STUS_EXPECT_CYCLE2(0x00080000),//中间状态用户请求自动折返2中
IP_STA_STUS_EXPECT_CYCLE3(0x00100000),//中间状态用户请求自动折返3中
IP_STA_STUS_EXPECT_CYCLE4(0x00200000),//中间状态用户请求自动折返4中
IP_STA_STUS_EXPECT_CYCLE5(0x00400000),//中间状态用户请求自动折返5中
IP_STA_STUS_EXPECT_CYCLE6(0x00800000),//中间状态用户请求自动折返6中
;
int val;
DeviceTypeStatusSTATIONEnum(int val) {
this.val = val;
}
}
/**
* 表6.3-3 设备状态定义表 SIGNAL
* <p>
* 西安3号线信号系统不提供序号为2468101213141723的信号机状态
*/
public enum DeviceTypeStatusSIGNALEnum {
// 定义枚举对象RED_OPEN值为0x00000001表示红灯亮
RED_OPEN(0x00000001),
// 定义枚举对象RED_FLASH值为0x00000002表示红灯闪
RED_FLASH(0x00000002),
// 定义枚举对象GREEN_OPEN值为0x00000004表示绿灯亮
GREEN_OPEN(0x00000004),
// 定义枚举对象GREEN_FLASH值为0x00000008表示绿灯闪
GREEN_FLASH(0x00000008),
// 定义枚举对象YELLOW_OPEN值为0x00000010表示黄灯亮
YELLOW_OPEN(0x00000010),
// 定义枚举对象YELLOW_FLASH值为0x00000020表示黄灯闪
YELLOW_FLASH(0x00000020),
// 定义枚举对象WHITE_OPEN值为0x00000040表示白灯亮
WHITE_OPEN(0x00000040),
// 定义枚举对象WHITE_FLASH值为0x00000080表示白灯闪
WHITE_FLASH(0x00000080),
// 定义枚举对象BLUE_OPEN值为0x00000100表示蓝灯亮
BLUE_OPEN(0x00000100),
// 定义枚举对象BLUE_FLASH值为0x00000200表示蓝灯闪
BLUE_FLASH(0x00000200),
// 定义枚举对象FLEET_MODE值为0x00010000表示信号机fleet模式
FLEET_MODE(0x00010000),
// 定义枚举对象CTRL_FLEET_MODE值为0x00020000表示设置或取消信号机fleet模式办理中
CTRL_FLEET_MODE(0x00020000),
// 定义枚举对象AUTO_MODE值为0x00040000表示信号机处于auto模式即CAD允许信号机为始端进路自动触发
AUTO_MODE(0x00040000),
// 定义枚举对象CTRL_AUTO_MODE值为0x00080000表示设置或取消信号机auto模式办理中
CTRL_AUTO_MODE(0x00080000),
// 定义枚举对象EXTINGUISH值为0x00100000表示信号机处于灭灯状态
EXTINGUISH(0x00100000),
// 定义枚举对象APPROACH_LOCK值为0x00200000表示进路处于接近锁闭
APPROACH_LOCK(0x00200000),
// 定义枚举对象PROTECT_ROUTE值为0x00400000表示进路的保护进路已办理
PROTECT_ROUTE(0x00400000),
// 定义枚举对象AUTO_ROUTE_DISABLE值为0x00800000表示信号机后方有进路被关闭自动触发功能信号机后方有进路处于人工控
AUTO_ROUTE_DISABLE(0x00800000),
// 定义枚举对象CALLON值为0x01000000表示信号机引导状态
CALLON(0x01000000),
// 定义枚举对象YELLOW_YELLOW值为0x02000000表示信号机双黄灯
YELLOW_YELLOW(0x02000000),
// 定义枚举对象YELLOW_GREEN值为0x04000000表示信号机黄绿灯
YELLOW_GREEN(0x04000000),
// 定义枚举对象BLOCKED值为0x08000000表示信号机封锁
BLOCKED(0x08000000),
// 定义枚举对象LAMP_FAILURE值为0x10000000表示信号机灯丝断丝
LAMP_FAILURE(0x10000000);
int val;
DeviceTypeStatusSIGNALEnum(int val) {
this.val = val;
}
}
/**
* 表6.3-4设备状态定义表 ENTRY 西安3号线信号系统不提供此类型设备的状态
*/
public enum DeviceTypeStatusENTRYEnum {
// 定义枚举对象DIR_LEFT值为0x00000001
DIR_LEFT(0x00000001),
// 定义枚举对象DIR_RIGHT值为0x00000002
DIR_RIGHT(0x00000002),
// 定义枚举对象DIR_LOCKED值为0x00000004
DIR_LOCKED(0x00000004);
int val;
DeviceTypeStatusENTRYEnum(int val) {
this.val = val;
}
}
/**
* 表6.3-5 设备状态定义表 SWITCH
* <p>
* 西安3号线信号系统不提供序号为910111213141516的道岔状态
*/
public enum DeviceTypeStatusSWITCHEnum {
IP_SINGLE_SWITCH_STUS_CI_OCCUPIED(0x00000002),//联锁报告道岔占用
IP_SINGLE_SWITCH_STUS_CBTC_OCCUPIED(0x00000004),//CBTC报告列车占用该道岔
IP_SINGLE_SWITCH_STUS_LOCKED(0x00000008),//道岔锁闭
IP_SINGLE_SWITCH_STUS_FAIL_LOCKED(0x00000010),//道岔故障锁闭
IP_SINGLE_SWITCH_STUS_NORMAL(0x00000020),//道岔定位
IP_SINGLE_SWITCH_STUS_REVERSE(0x00000040),//道岔反位
IP_SINGLE_SWITCH_STUS_BLOCKED_1(0x00000080),//道岔单锁
IP_SINGLE_SWITCH_STUS_JAMMED(0x00000100),//道岔挤岔
IP_SINGLE_SWITCH_STUS_EXPECT_LOCK(0x00000200),//期望锁闭
IP_SINGLE_SWITCH_STUS_EXPECT_UNLOCK(0x00000400),//期望解除锁闭
IP_SINGLE_SWITCH_STUS_EXPECT_NORMAL(0x00000800),//进路和道岔单操命令中的期望道岔定位
IP_SINGLE_SWITCH_STUS_EXPECT_REVERSE(0x00001000),//进路和道岔单操命令中的期望道岔反位
IP_SINGLE_SWITCH_STUS_EXPECT_BLOCK(0x00002000),//期望道岔单锁
IP_SINGLE_SWITCH_STUS_EXPECT_UNBLOCK(0x00004000),//期望道岔解除单锁
IP_SINGLE_SWITCH_STUS_IN_ROUTE(0x00008000),//是否在进路中锁闭控制是否需要显示锁闭
IP_SINGLE_SWITCH_STUS_MANUAL_MODE(0x00010000),//道岔为手动操作模式
IP_SINGLE_SWITCH_STUS_CUT(0x00020000),//道岔切除
IP_SINGLE_SWITCH_STUS_ATC_INVALID(0x00040000),//道岔区段被ATC报告失效
IP_SINGLE_SWITCH_STUS_OVERLAP(0x00080000),//OVERLAP
IP_SINGLE_SWITCH_STUS_TSR_CBTC_MAIN(0x00100000),//CBTC岔前限速
IP_SINGLE_SWITCH_STUS_TSR_CBTC_NORMAL(0x00200000),//CBTC定位限速
IP_SINGLE_SWITCH_STUS_TSR_CBTC_REVERSE(0x00400000),//CBTC反位限速
IP_SINGLE_SWITCH_STUS_TSR_BM_MAIN(0x00800000),//BM岔前限速
IP_SINGLE_SWITCH_STUS_TSR_BM_NORMAL(0x01000000),//BM定位限速
IP_SINGLE_SWITCH_STUS_TSR_BM_REVERSE(0x02000000),//BM反位限速
IP_SINGLE_SWITCH_STUS_BLOCKED_2(0x04000000),//道岔封锁
IP_SINGLE_SWITCH_STUS_LOST_INDICATION(0x08000000);//道岔失表示
int val;
DeviceTypeStatusSWITCHEnum(int val) {
this.val = val;
}
}
/**
* 表6.3-6 设备状态定义表 TRACK
*/
public enum DeviceTypeStatusTRACKEnum {
CI_OCCUPIED(0x00000002), // 联锁报告区段占用
CBTC_OCCUPIED(0x00000004), // CBTC信息报告轨道占用
LOCKED(0x00000008), // 锁闭
FAIL_LOCKED(0x00000010), // 故障锁闭
EXPECT_LOCK(0x00000020), // 进路办理中期望锁闭
EXPECT_UNLOCK(0x00000040), // 进路取消中期望解除锁闭
IN_ROUTE(0x00000080), // 是否在进路中锁闭控制是否需要显示锁闭
CUT(0x00000100), // 轨道切除
ATC_INVALID(0x00000200), // 轨道区段被ATC报告失效
OVERLAP(0x00000400), // OVERLAP
BLOCKED(0x00000800); // 轨道区段封锁
//TODO 0xABC00000 AB这个字节表示限速值KM/H
//C
//为1时CBTC限速
//为2时联锁限速
//为4时同时限速
int val;
DeviceTypeStatusTRACKEnum(int val) {
this.val = val;
}
}
/**
* 表6.3-7 设备状态定义表 PLATFORM
*/
public enum DeviceTypeStatusPLATFORMEnum {
EMERGSTOP(0x00000001), // 紧急关闭
TRAINBERTH(0x00000002), // 列车停站
CLOSE(0x00000004), // 站台关闭清客
UP_HOLD(0x00000010), // 上行方向车站扣车
DOWN_HOLD(0x00000020), // 下行方向车站扣车
UP_OCC_HOLD(0x00000040), // 上行方向中心扣车
DOWN_OCC_HOLD(0x00000080), // 下行方向中心扣车
PSD_OPEN(0x00000100), // 屏蔽门开
PSD_CUT(0x00000200), // 屏蔽门切除
UP_SKIPSTOP(0x00000400), // 上行方向跳停
DOWN_SKIPSTOP(0x00000800), // 下行方向跳停
UP_TRAIN_SKIPSTOP(0x00001000), // 上行方向指定列车跳停
DOWN_TRAIN_SKIPSTOP(0x00002000); // 下行方向指定列车跳停
//TODO 0xABCD0000 ABCD这两个字节表示停站时间
int val;
DeviceTypeStatusPLATFORMEnum(int val) {
this.val = val;
}
}
public enum DeviceTypeStatusSCADAEnum {
SCADA_ON(0x00000001), // 有电
SCADA_SINGLE_POWER(0x00000002), // 单边供电
SCADA_UNKOWN(0x00000004); // 未知状态
private final int value;
DeviceTypeStatusSCADAEnum(int value) {
this.value = value;
}
}
/**
* 设备状态定义表 WATERPROOF_DOOR
*/
public enum DeviceTypeStatusWATERPROOF_DOOREnum {
DOOR_CLOSED(0x00000001), // 防淹门关闭
DOOR_EXPECT_CLOSE(0x00000002), // 请求防淹门关闭
DOOR_AGREE_CLOSED(0x00000004), // 同意防淹门关闭
DOOR_CLOSING(0x00000008), // 防淹门处于关门过程中
DOOR_OPEN_LOCK(0x00000010); // 防淹门处于开门且锁紧状态
// 枚举类型的值
private final int value;
// 获取枚举类型的值
public int getValue() {
return value;
}
DeviceTypeStatusWATERPROOF_DOOREnum(int value) {
this.value = value;
}
}
/**
* 设备状态定义表 WORK_AREA
*/
public enum DeviceTypeStatusWORK_AREAEnum {
/**
* 该位为1 工作区使能
*/
IP_STUS_WORK_AREA_ENABLE(0x00000001);;
int val;
DeviceTypeStatusWORK_AREAEnum(int val) {
this.val = val;
}
}
/**
* 设备状态定义表 GAMA
*/
public enum DeviceTypeStatusGAMAEnum {
/**
* 该位为1 GAMA不使能
*/
IP_STUS_GAMA_DISABLE(0x00000001);
int val;
DeviceTypeStatusGAMAEnum(int val) {
this.val = val;
}
}
/**
* TRAIN_MODE
*/
public enum DeviceTypeStatusTRAIN_MODEEnum {
IP_MODE_TRAIN_TYPE_MANUAL(0x00000000), // 人工车
IP_MODE_TRAIN_TYPE_HEAD(0x00000001), // 头码车
IP_MODE_TRAIN_TYPE_SPECIAL(0x00000002), // 特殊人工车
IP_MODE_TRAIN_TYPE_SCHEDULE(0x00000003), // 计划车
IP_MODE_TRAIN_TYPE_ROUTE(0x00000004), // 运行线车
IP_MODE_TRAIN_TYPE_SHUTTLE(0x00000005), // 单线往返车
IP_MODE_TRAIN_TYPE_LINEUP(0x00000006), // 预定义车
IP_MODE_TRAIN_SCHD_EARLY(0x00000008), // 早点计划车
IP_MODE_TRAIN_SCHD_LATE(0x00000010), // 晚点计划车
IP_MODE_TRAIN_SKIPSTOP(0x00000100), // 设置跳停
IP_MODE_TRAIN_CBTC_MODE(0x00000200), // CBTC跟踪模式
IP_MODE_TRAIN_ATP_CUT(0x00000400), // 列车ATP切除
IP_MODE_TRAIN_BERTHED(0x00000800), // 在站台或存车线停站
IP_MODE_TRAIN_STOPED(0x00001000), // 列车停止运动
IP_MODE_TRAIN_HOLDED(0x00002000), // 被扣车
IP_MODE_TRAIN_ITAMA(0x00004000), // ITAMA允许
IP_MODE_TRAIN_DIR_UP(0x00008000), // 跟踪的列车运动方向为上行
IP_MODE_TRAIN_DIR_DOWN(0x00010000), // 跟踪的列车运动方向为下行
IP_MODE_TRAIN_DIR_HEAD_UP(0x00020000), // 根据ATC报告列车上行头牵引
IP_MODE_TRAIN_DIR_HEAD_DOWN(0x00040000), // 根据ATC报告列车下行头牵引
IP_MODE_TRAIN_DOOR_OPEN(0x00080000), // 列车车门状态关闭开启
IP_MODE_TRAIN_RS_ALARM(0x00100000), // 列车车辆接口告警状态
IP_MODE_TRAIN_DOOR_ALARM(0x00200000), // 列车车门告警状态
IP_MODE_TRAIN_EB_ALARM(0x00400000), // 列车紧急制动告警
IP_MODE_TRAIN_INTEGRITY_ALARM(0x00800000), // 列车完整性告警
// 列车驾驶模式掩码
IP_MODE_TRAIN_DRIVE_MODE_AM(0x10000000), // CBTC模式下有人自动驾驶模式
IP_MODE_TRAIN_DRIVE_MODE_CM(0x20000000), // CBTC模式下人工驾驶模式
IP_MODE_TRAIN_DRIVE_MODE_RMF(0x30000000), // RM模式前进
IP_MODE_TRAIN_DRIVE_MODE_DTO(0x40000000), // DTO无人驾驶模式
IP_MODE_TRAIN_DRIVE_MODE_ATB(0x50000000), // ATB自动折返模式
IP_MODE_TRAIN_DRIVE_BLOCK_AM(0x60000000), // 点式有人自动驾驶模式
IP_MODE_TRAIN_DRIVE_BLOCK_CM(0x70000000), // 点式人工驾驶模式
IP_MODE_TRAIN_DRIVE_MODE_RMR(0x80000000), // RM模式后退
IP_MODE_TRAIN_DRIVE_MODE_WASH(0x90000000); // 洗车模式
// 枚举类型的值
private final int value;
// 枚举类型的构造函数
DeviceTypeStatusTRAIN_MODEEnum(int value) {
this.value = value;
}
// 获取枚举类型的值
public int getValue() {
return value;
}
}
}

View File

@ -3,6 +3,7 @@ package club.joylink.xiannccda.ats.message.rep;
import club.joylink.xiannccda.ats.message.MessageId;
import club.joylink.xiannccda.ats.message.MessageResponse;
import club.joylink.xiannccda.ats.message.rep.EntityParseUtil.ReadData;
import club.joylink.xiannccda.ats.message.rep.device.DeviceType;
import io.netty.buffer.ByteBuf;
import java.util.List;
@ -70,25 +71,83 @@ public class DeviceStatusBitmapResponse extends MessageResponse {
* <p>
* 注1 type:设备类型定义包括信号机,道岔,站台,轨道,报警集中站设备,车站设备等但列车的设备状态不在本消息里面发送
*/
private DeviceTypeEnum type;
private DeviceType type;
/**
* 该类设备的数目(2)
*/
private Short objCount;
/**
* 设备名称(24)左对齐其它空字符填\0
*/
private String devName;
/**
* 设备的状态见附录3(4)
*/
private Integer status;
/**
* 预留(4)
*/
private Integer spare;
private List<DeviceEntity> deviceList;
public void runTime() {
if (type == DeviceType.DEVICE_TYPE_PLATFORM) {
// this.spare;
}
}
public void runLevel() {
if (type == DeviceType.DEVICE_TYPE_PLATFORM) {
// this.spare;
}
}
public void speedLimit() {
if (type == DeviceType.DEVICE_TYPE_SWITCH) {
// this.spare;
}
}
@Override
public DeviceTypeEntity read(ByteBuf buf) {
DeviceTypeEntity entity = new DeviceTypeEntity();
entity.type = DeviceTypeEnum.of(buf.readShort());
entity.type = DeviceType.of(buf.readShort());
entity.objCount = buf.readShort();
entity.devName = EntityParseUtil.convertStr(buf, 24);
entity.status = buf.readInt();
entity.spare = buf.readInt();
entity.deviceList = EntityParseUtil.collect(entity.objCount, buf, DeviceEntity.class);
return entity;
}
}
public static void main(String[] args) {
/* int d = 0x00040000;
System.out.println((d & DeviceTypeStatusSIGNALEnum.APPROACH_LOCK.getVal()));
boolean dd = (d & DeviceTypeStatusSIGNALEnum.APPROACH_LOCK.getVal()) == DeviceTypeStatusSIGNALEnum.APPROACH_LOCK.getVal();
System.out.println(dd);*/
int i1 = -119;
String s1 = Integer.toBinaryString(i1);
System.out.println(s1);
int i2 = 240;
String s2 = Integer.toBinaryString(i2);
System.out.println(s2);
int i3 = i1 & i2;
System.out.println(i3);
String s3 = Integer.toBinaryString(i3);
System.out.println(s3);
System.out.println(i1 & i2);
System.out.println(4 & 7);
}
public static class DeviceEntity implements ReadData<DeviceEntity> {
/**

View File

@ -3,6 +3,7 @@ package club.joylink.xiannccda.ats.message.rep;
import club.joylink.xiannccda.ats.message.MessageData;
import club.joylink.xiannccda.ats.message.MessageId;
import club.joylink.xiannccda.ats.message.MessageResponse;
import club.joylink.xiannccda.ats.message.rep.device.DeviceType;
import io.netty.buffer.ByteBuf;
/**
@ -33,17 +34,25 @@ public class DeviceStatusChangeResponse extends MessageResponse {
/**
* 设备类型(2)见附录2
*/
private Short type;
private DeviceType type;
/**
* 设备名称(24)
*/
private byte[] devName = new byte[24];
private String devName;
/**
* 设备的状态(4)见附录3
*/
private Integer deviceStatus;
/**
* 预留(4)
* <p>
* 当Type为DEVICE_TYPE_PLATFORM时预留的4个字节处填充区间运行时间或区间运行等级
* <p>
* 0xABCD0001ABCD这两个字节表示下一区间运行时间0x0000AB02AB这个字节表示下一区间运行等级
* <p>
* 当Type为DEVICE_TYPE_SWITCH时预留的4个字节处填充限速值
* <p>
* 0x000000ABAB这个字节表示限速值KM/H
*/
private Integer spare;
@ -51,8 +60,8 @@ public class DeviceStatusChangeResponse extends MessageResponse {
public void decode2(ByteBuf buf) throws Exception {
this.lineId = buf.readShort();
this.rtuId = buf.readShort();
this.type = buf.readShort();
buf.readBytes(this.devName);
this.type = DeviceType.of(buf.readShort());
this.devName = EntityParseUtil.convertStr(buf, 24);
this.deviceStatus = buf.readInt();
this.spare = buf.readInt();
}

View File

@ -2,8 +2,10 @@ package club.joylink.xiannccda.ats.message.rep;
import club.joylink.xiannccda.ats.message.MessageId;
import club.joylink.xiannccda.ats.message.MessageResponse;
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
import club.joylink.xiannccda.ats.message.rep.EntityParseUtil.ReadData;
import io.netty.buffer.ByteBuf;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -38,12 +40,12 @@ public class HistoryScheduleResponse extends MessageResponse {
* <p>
* 0x0003:计划列车运行信息消息结束标记
*/
private Short subId;
private ScheduleSubIdType subId;
/**
* 车组号(9)
*/
private byte[] groupId = new byte[9];
private String groupId;
/**
* 记录数(2)
*/
@ -56,10 +58,11 @@ public class HistoryScheduleResponse extends MessageResponse {
public void decode2(ByteBuf buf) throws Exception {
this.lineId = buf.readShort();
this.date = new DateTime(buf);
this.subId = buf.readShort();
this.subId = ScheduleSubIdType.of(buf.readShort());
if (this.subId == ScheduleSubIdType.RUNING) {
this.groupId = EntityParseUtil.convertStr(buf, 9);
if (this.subId == ScheduleSubIdType.RUNING.val) {
buf.readBytes(this.groupId);
this.recCnt = buf.readShort();
this.entityList = EntityParseUtil.collect(this.recCnt, buf, HistoryScheduleEntity.class);
@ -81,11 +84,11 @@ public class HistoryScheduleResponse extends MessageResponse {
/**
* 到站时间(7)
*/
private DateTime aTime;
private LocalDateTime aTime;
/**
* 离站时间(7)
*/
private DateTime dTime;
private LocalDateTime dTime;
/**
* 1表示下行
* <p>
@ -97,15 +100,15 @@ public class HistoryScheduleResponse extends MessageResponse {
/**
* 表号(9)
*/
private byte[] serviceId;
private String serviceId;
/**
* 车次号12
*/
private byte[] globalId = new byte[12];
private String globalId;
/**
* 目的地号(4)
*/
private byte[] destinationId;
private String destinationId;
/**
* 类型
* <p>
@ -113,7 +116,7 @@ public class HistoryScheduleResponse extends MessageResponse {
* <p>
* 0表示非计划车
*/
private Short type;
private Boolean planType;
/**
* 局部序列号(4)
*/
@ -125,22 +128,15 @@ public class HistoryScheduleResponse extends MessageResponse {
HistoryScheduleEntity entity = new HistoryScheduleEntity();
entity.stationId = buf.readShort();
entity.platformId = buf.readShort();
entity.aTime = new DateTime(buf);
entity.dTime = new DateTime(buf);
entity.aTime = DateTimeUtil.convert(buf);
entity.dTime = DateTimeUtil.convert(buf);
entity.flag = buf.readShort();
entity.serviceId = EntityParseUtil.convertStr(buf, 9);
entity.globalId = EntityParseUtil.convertStr(buf, 12);
entity.destinationId = EntityParseUtil.convertStr(buf, 4);
buf.readBytes(entity.serviceId);
buf.readBytes(entity.globalId);
buf.readBytes(entity.destinationId);
entity.type = buf.readShort();
entity.planType = buf.readShort() == 1;
entity.localSubId = buf.readInt();
return entity;

View File

@ -2,8 +2,10 @@ package club.joylink.xiannccda.ats.message.rep;
import club.joylink.xiannccda.ats.message.MessageId;
import club.joylink.xiannccda.ats.message.MessageResponse;
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
import club.joylink.xiannccda.ats.message.rep.EntityParseUtil.ReadData;
import io.netty.buffer.ByteBuf;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -31,7 +33,7 @@ public class InusedScheduleResponse extends MessageResponse {
/**
* INUSED_SCHEDULE日期(7)
*/
private DateTime date;
private LocalDateTime date;
/**
* 0x0001: 计划列车运行信息消息开始标记
* <p>
@ -39,11 +41,11 @@ public class InusedScheduleResponse extends MessageResponse {
* <p>
* 0x0003:计划列车运行信息消息结束标记
*/
private Short subId;
private ScheduleSubIdType subId;
/**
* 表号(9)
*/
private byte[] trainId = new byte[9];
private String trainId;
/**
* 单程数(2)
*/
@ -53,10 +55,11 @@ public class InusedScheduleResponse extends MessageResponse {
@Override
public void decode2(ByteBuf buf) throws Exception {
this.lineId = buf.readShort();
this.date = new DateTime(buf);
this.subId = buf.readShort();
if (this.subId == ScheduleSubIdType.RUNING.val) {
buf.readBytes(this.trainId);
this.date = DateTimeUtil.convert(buf);
this.subId = ScheduleSubIdType.of(buf.readShort());
if (this.subId == ScheduleSubIdType.RUNING) {
this.trainId = EntityParseUtil.convertStr(buf, 9);
this.tripCnt = buf.readShort();
this.entityList = EntityParseUtil.collect(this.tripCnt, buf, InusedScheduleEntity.class);
}
@ -67,15 +70,15 @@ public class InusedScheduleResponse extends MessageResponse {
/**
* 车次号(12)
*/
private byte[] globalId = new byte[12];
private String globalId;
/**
* 车组号本字段预留(9)
*/
private byte[] groupId;
private String groupId;
/**
* 目的地号(4);
*/
private byte[] destinationId;
private String destinationId;
/**
* 记录数本车次经过的站台数(2)
*/
@ -87,9 +90,9 @@ public class InusedScheduleResponse extends MessageResponse {
public InusedScheduleEntity read(ByteBuf buf) {
InusedScheduleEntity entity = new InusedScheduleEntity();
buf.readBytes(entity.globalId);
buf.readBytes(entity.groupId);
buf.readBytes(entity.destinationId);
entity.globalId = EntityParseUtil.convertStr(buf, 12);
entity.groupId = EntityParseUtil.convertStr(buf, 9);
entity.destinationId = EntityParseUtil.convertStr(buf, 4);
entity.recCnt = buf.readShort();
entity.recordList = EntityParseUtil.collect(entity.recCnt, buf, EntityRecord.class);
return entity;
@ -109,11 +112,11 @@ public class InusedScheduleResponse extends MessageResponse {
/**
* 到站时间(7)
*/
private DateTime aTime;
private LocalDateTime aTime;
/**
* 离站时间
*/
private DateTime dTime;
private LocalDateTime dTime;
/**
* 第4位为1表示出库
* <p>
@ -126,6 +129,19 @@ public class InusedScheduleResponse extends MessageResponse {
private Short flag;
private byte[] flagBit;
public boolean Outing() {
return this.flagBit[3] == 1;
}
public boolean Ining() {
return this.flagBit[4] == 1;
}
public boolean up() {
return this.flagBit[5] == 1;
}
/**
* 局部序列号(4)
*/
@ -138,8 +154,8 @@ public class InusedScheduleResponse extends MessageResponse {
record.stationId = buf.readShort();
record.platformId = buf.readShort();
record.aTime = new DateTime(buf);
record.dTime = new DateTime(buf);
record.aTime = DateTimeUtil.convert(buf);
record.dTime = DateTimeUtil.convert(buf);
record.flag = buf.readShort();
record.LocalSubId = buf.readInt();
@ -150,4 +166,6 @@ public class InusedScheduleResponse extends MessageResponse {
return record;
}
}
}

View File

@ -27,7 +27,7 @@ public class NetworkAliveStatusResponse extends MessageResponse {
* <p>
* 0代表断开
*/
private Byte status;
private Boolean connect;
public NetworkAliveStatusResponse() {
@ -37,6 +37,6 @@ public class NetworkAliveStatusResponse extends MessageResponse {
@Override
public void decode2(ByteBuf buf) throws Exception {
this.linId = buf.readShort();
this.status = buf.readByte();
this.connect = buf.readByte() == 1;
}
}

View File

@ -3,6 +3,7 @@ package club.joylink.xiannccda.ats.message.rep;
import club.joylink.xiannccda.ats.message.MessageId;
import club.joylink.xiannccda.ats.message.MessageResponse;
import io.netty.buffer.ByteBuf;
import java.util.Arrays;
/**
* 2.8.12 查询无结果消息
@ -40,17 +41,31 @@ public class ReportNackResponse extends MessageResponse {
* <p>
* 3查询异常原因为content字段内容描述
*/
private Integer result;
private ResultCode result;
/**
* 异常描述(50)
*/
private byte[] content = new byte[50];
private String content;
@Override
public void decode2(ByteBuf buf) throws Exception {
this.lineId = buf.readShort();
this.reportId = buf.readShort();
this.result = buf.readInt();
buf.readBytes(this.content);
this.result = ResultCode.of(buf.readInt());
this.content = EntityParseUtil.convertStr(buf, 50);
}
public enum ResultCode {
NO_DATA(0), MANY_DATA_SIZE(1), UN_CONNECT(2), ERROR(3);
private final int value;
ResultCode(int val) {
this.value = val;
}
public static ResultCode of(int d) {
return Arrays.stream(ResultCode.values()).filter(dd -> dd.value == d).findFirst().orElse(null);
}
}
}

View File

@ -1,5 +1,8 @@
package club.joylink.xiannccda.ats.message.rep;
import club.joylink.xiannccda.ats.message.MessageData.ActionTypeControlEnum;
import java.util.Arrays;
public enum ScheduleSubIdType {
BEGIN(0X0001),
RUNING(0X0002),
@ -10,4 +13,9 @@ public enum ScheduleSubIdType {
ScheduleSubIdType(int d) {
this.val = d;
}
public static ScheduleSubIdType of(int d) {
return Arrays.stream(ScheduleSubIdType.values()).filter(dd -> dd.val == d).findFirst().orElse(null);
}
}

View File

@ -4,6 +4,7 @@ import club.joylink.xiannccda.ats.message.MessageId;
import club.joylink.xiannccda.ats.message.MessageResponse;
import club.joylink.xiannccda.ats.message.rep.EntityParseUtil.ReadData;
import io.netty.buffer.ByteBuf;
import java.util.Arrays;
import java.util.List;
@ -57,7 +58,7 @@ public class SignalRouteStatusResponse extends MessageResponse {
/**
* 信号机名称(20)
*/
private byte[] signalName = new byte[20];
private String signalName;
/**
* 进路数量(1)
@ -70,7 +71,7 @@ public class SignalRouteStatusResponse extends MessageResponse {
public SignalStatusEntity read(ByteBuf buf) {
SignalStatusEntity entity = new SignalStatusEntity();
buf.readBytes(entity.signalName);
entity.signalName = EntityParseUtil.convertStr(buf, 20);
entity.routeCount = buf.readByte();
entity.routes = EntityParseUtil.collect(entity.routeCount, buf, RouteStatusEntity.class);
return entity;
@ -82,7 +83,7 @@ public class SignalRouteStatusResponse extends MessageResponse {
/**
* 进路名称(64)
*/
private byte[] routeName = new byte[64];
private String routeName;
/**
* 进路控制模式(1)
@ -92,15 +93,15 @@ public class SignalRouteStatusResponse extends MessageResponse {
* 0xaa:非ATS自动信号模式
*/
private Byte routeStatus;
private RouteStatusEnum routeStatus;
@Override
public RouteStatusEntity read(ByteBuf buf) {
RouteStatusEntity entity = new RouteStatusEntity();
entity.routeName = EntityParseUtil.convertStr(buf, 64);
buf.readBytes(entity.routeName);
entity.routeStatus = buf.readByte();
entity.routeStatus = RouteStatusEnum.of(buf.readByte());
return entity;
}
}
@ -112,5 +113,10 @@ public class SignalRouteStatusResponse extends MessageResponse {
RouteStatusEnum(int v) {
this.val = v;
}
public static RouteStatusEnum of(int d) {
return Arrays.stream(RouteStatusEnum.values()).filter(dd -> dd.val == d).findFirst().orElse(null);
}
}
}

View File

@ -0,0 +1,352 @@
package club.joylink.xiannccda.ats.message.rep.device;
import lombok.Getter;
public class DeviceStatus {
/**
* 表6.3-1设备状态定义表 - RTU
*/
public enum RTU {
IP_RTU_STUS_DOWN(0x00008000),// 通信中断
IP_RTU_STUS_IN_LOCAL_CTRL(0x00000001),// 站控
IP_RTU_STUS_IN_CENTRAL_CTRL(0x00000002),// 遥控
IP_RTU_STUS_IN_EMERGENCY_CTRL(0x00000004);// 紧急站控
int val;
RTU(int val) {
this.val = val;
}
}
/**
* 表6.3-2 设备状态定义表 STATION
* <p>
* 西安3号线信号系统不提供此类型设备的状态
*/
public enum STATION {
IP_STA_STUS_TERM_MODE1(0x00000001),//终端模式1(terminaL3)
IP_STA_STUS_TERM_MODE2(0x00000002),//终端模式2(terminal2)
IP_STA_STUS_TERM_MODE3(0x00000004),//终端模式3(terminal3)
IP_STA_STUS_TERM_MODE4(0x00000008),//终端模式4(terminal4)
IP_STA_STUS_TERM_MODE5(0x00000010),//终端模式5(terminal5)
IP_STA_STUS_TERM_MODE6(0x00000020),//终端模式6(terminal6)
IP_STA_STUS_EXPECT_TERM_MODE1(0x00000040),//中间状态用户请求终端模式1中
IP_STA_STUS_EXPECT_TERM_MODE2(0x00000080),//中间状态用户请求终端模式2中
IP_STA_STUS_EXPECT_TERM_MODE3(0x00000100),//中间状态用户请求终端模式3中
IP_STA_STUS_EXPECT_TERM_MODE4(0x00000200),//中间状态用户请求终端模式4中
IP_STA_STUS_EXPECT_TERM_MODE5(0x00000400),//中间状态用户请求终端模式5中
IP_STA_STUS_EXPECT_TERM_MODE6(0x00000800),//中间状态用户请求终端模式6中
IP_STA_STUS_IN_CYCLE1(0x00001000),//自动折返1(CY1-CYC)
IP_STA_STUS_IN_CYCLE2(0x00002000),//自动折返2(CY2-CYC)
IP_STA_STUS_IN_CYCLE3(0x00004000),//自动折返3(CY3-CYC)
IP_STA_STUS_IN_CYCLE4(0x00008000),//自动折返4(CY4-CYC)
IP_STA_STUS_IN_CYCLE5(0x00010000),//自动折返5(CY5-CYC)
IP_STA_STUS_IN_CYCLE6(0x00020000),//自动折返6(CY6-CYC)
IP_STA_STUS_EXPECT_CYCLE1(0x00040000),//中间状态用户请求自动折返1中
IP_STA_STUS_EXPECT_CYCLE2(0x00080000),//中间状态用户请求自动折返2中
IP_STA_STUS_EXPECT_CYCLE3(0x00100000),//中间状态用户请求自动折返3中
IP_STA_STUS_EXPECT_CYCLE4(0x00200000),//中间状态用户请求自动折返4中
IP_STA_STUS_EXPECT_CYCLE5(0x00400000),//中间状态用户请求自动折返5中
IP_STA_STUS_EXPECT_CYCLE6(0x00800000),//中间状态用户请求自动折返6中
;
int val;
STATION(int val) {
this.val = val;
}
}
/**
* 表6.3-3 设备状态定义表 SIGNAL
* <p>
* 3西安3号线信号系统不提供序号为2468101213141723的信号机状态
*/
public enum SIGNAL {
// 定义枚举对象RED_OPEN值为0x00000001表示红灯亮
RED_OPEN(0x00000001),
// 定义枚举对象RED_FLASH值为0x00000002表示红灯闪
RED_FLASH(0x00000002),
// 定义枚举对象GREEN_OPEN值为0x00000004表示绿灯亮
GREEN_OPEN(0x00000004),
// 定义枚举对象GREEN_FLASH值为0x00000008表示绿灯闪
GREEN_FLASH(0x00000008),
// 定义枚举对象YELLOW_OPEN值为0x00000010表示黄灯亮
YELLOW_OPEN(0x00000010),
// 定义枚举对象YELLOW_FLASH值为0x00000020表示黄灯闪
YELLOW_FLASH(0x00000020),
// 定义枚举对象WHITE_OPEN值为0x00000040表示白灯亮
WHITE_OPEN(0x00000040),
// 定义枚举对象WHITE_FLASH值为0x00000080表示白灯闪
WHITE_FLASH(0x00000080),
// 定义枚举对象BLUE_OPEN值为0x00000100表示蓝灯亮
BLUE_OPEN(0x00000100),
// 定义枚举对象BLUE_FLASH值为0x00000200表示蓝灯闪
BLUE_FLASH(0x00000200),
// 定义枚举对象FLEET_MODE值为0x00010000表示信号机fleet模式
FLEET_MODE(0x00010000),
// 定义枚举对象CTRL_FLEET_MODE值为0x00020000表示设置或取消信号机fleet模式办理中
CTRL_FLEET_MODE(0x00020000),
// 定义枚举对象AUTO_MODE值为0x00040000表示信号机处于auto模式即CAD允许信号机为始端进路自动触发
AUTO_MODE(0x00040000),
// 定义枚举对象CTRL_AUTO_MODE值为0x00080000表示设置或取消信号机auto模式办理中
CTRL_AUTO_MODE(0x00080000),
// 定义枚举对象EXTINGUISH值为0x00100000表示信号机处于灭灯状态
EXTINGUISH(0x00100000),
// 定义枚举对象APPROACH_LOCK值为0x00200000表示进路处于接近锁闭
APPROACH_LOCK(0x00200000),
// 定义枚举对象PROTECT_ROUTE值为0x00400000表示进路的保护进路已办理
PROTECT_ROUTE(0x00400000),
// 定义枚举对象AUTO_ROUTE_DISABLE值为0x00800000表示信号机后方有进路被关闭自动触发功能信号机后方有进路处于人工控
AUTO_ROUTE_DISABLE(0x00800000),
// 定义枚举对象CALLON值为0x01000000表示信号机引导状态
CALLON(0x01000000),
// 定义枚举对象YELLOW_YELLOW值为0x02000000表示信号机双黄灯
YELLOW_YELLOW(0x02000000),
// 定义枚举对象YELLOW_GREEN值为0x04000000表示信号机黄绿灯
YELLOW_GREEN(0x04000000),
// 定义枚举对象BLOCKED值为0x08000000表示信号机封锁
BLOCKED(0x08000000),
// 定义枚举对象LAMP_FAILURE值为0x10000000表示信号机灯丝断丝
LAMP_FAILURE(0x10000000);
@Getter
int val;
SIGNAL(int val) {
this.val = val;
}
}
/**
* 表6.3-4设备状态定义表 ENTRY 西安3号线信号系统不提供此类型设备的状态
*/
public enum ENTRY {
// 定义枚举对象DIR_LEFT值为0x00000001
DIR_LEFT(0x00000001),
// 定义枚举对象DIR_RIGHT值为0x00000002
DIR_RIGHT(0x00000002),
// 定义枚举对象DIR_LOCKED值为0x00000004
DIR_LOCKED(0x00000004);
int val;
ENTRY(int val) {
this.val = val;
}
}
/**
* 表6.3-5 设备状态定义表 SWITCH
* <p>
* 西安3号线信号系统不提供序号为910111213141516的道岔状态
*/
public enum SWITCH {
IP_SINGLE_SWITCH_STUS_CI_OCCUPIED(0x00000002),//联锁报告道岔占用
IP_SINGLE_SWITCH_STUS_CBTC_OCCUPIED(0x00000004),//CBTC报告列车占用该道岔
IP_SINGLE_SWITCH_STUS_LOCKED(0x00000008),//道岔锁闭
IP_SINGLE_SWITCH_STUS_FAIL_LOCKED(0x00000010),//道岔故障锁闭
IP_SINGLE_SWITCH_STUS_NORMAL(0x00000020),//道岔定位
IP_SINGLE_SWITCH_STUS_REVERSE(0x00000040),//道岔反位
IP_SINGLE_SWITCH_STUS_BLOCKED_1(0x00000080),//道岔单锁
IP_SINGLE_SWITCH_STUS_JAMMED(0x00000100),//道岔挤岔
IP_SINGLE_SWITCH_STUS_EXPECT_LOCK(0x00000200),//期望锁闭
IP_SINGLE_SWITCH_STUS_EXPECT_UNLOCK(0x00000400),//期望解除锁闭
IP_SINGLE_SWITCH_STUS_EXPECT_NORMAL(0x00000800),//进路和道岔单操命令中的期望道岔定位
IP_SINGLE_SWITCH_STUS_EXPECT_REVERSE(0x00001000),//进路和道岔单操命令中的期望道岔反位
IP_SINGLE_SWITCH_STUS_EXPECT_BLOCK(0x00002000),//期望道岔单锁
IP_SINGLE_SWITCH_STUS_EXPECT_UNBLOCK(0x00004000),//期望道岔解除单锁
IP_SINGLE_SWITCH_STUS_IN_ROUTE(0x00008000),//是否在进路中锁闭控制是否需要显示锁闭
IP_SINGLE_SWITCH_STUS_MANUAL_MODE(0x00010000),//道岔为手动操作模式
IP_SINGLE_SWITCH_STUS_CUT(0x00020000),//道岔切除
IP_SINGLE_SWITCH_STUS_ATC_INVALID(0x00040000),//道岔区段被ATC报告失效
IP_SINGLE_SWITCH_STUS_OVERLAP(0x00080000),//OVERLAP
IP_SINGLE_SWITCH_STUS_TSR_CBTC_MAIN(0x00100000),//CBTC岔前限速
IP_SINGLE_SWITCH_STUS_TSR_CBTC_NORMAL(0x00200000),//CBTC定位限速
IP_SINGLE_SWITCH_STUS_TSR_CBTC_REVERSE(0x00400000),//CBTC反位限速
IP_SINGLE_SWITCH_STUS_TSR_BM_MAIN(0x00800000),//BM岔前限速
IP_SINGLE_SWITCH_STUS_TSR_BM_NORMAL(0x01000000),//BM定位限速
IP_SINGLE_SWITCH_STUS_TSR_BM_REVERSE(0x02000000),//BM反位限速
IP_SINGLE_SWITCH_STUS_BLOCKED_2(0x04000000),//道岔封锁
IP_SINGLE_SWITCH_STUS_LOST_INDICATION(0x08000000);//道岔失表示
int val;
SWITCH(int val) {
this.val = val;
}
}
/**
* 表6.3-6 设备状态定义表 TRACK
*/
public enum TRACK {
CI_OCCUPIED(0x00000002), // 联锁报告区段占用
CBTC_OCCUPIED(0x00000004), // CBTC信息报告轨道占用
LOCKED(0x00000008), // 锁闭
FAIL_LOCKED(0x00000010), // 故障锁闭
EXPECT_LOCK(0x00000020), // 进路办理中期望锁闭
EXPECT_UNLOCK(0x00000040), // 进路取消中期望解除锁闭
IN_ROUTE(0x00000080), // 是否在进路中锁闭控制是否需要显示锁闭
CUT(0x00000100), // 轨道切除
ATC_INVALID(0x00000200), // 轨道区段被ATC报告失效
OVERLAP(0x00000400), // OVERLAP
BLOCKED(0x00000800); // 轨道区段封锁
//TODO 0xABC00000 AB这个字节表示限速值KM/H
//C
//为1时CBTC限速
//为2时联锁限速
//为4时同时限速
int val;
TRACK(int val) {
this.val = val;
}
}
/**
* 表6.3-7 设备状态定义表 PLATFORM
*/
public enum PLATFORM {
EMERGSTOP(0x00000001), // 紧急关闭
TRAINBERTH(0x00000002), // 列车停站
CLOSE(0x00000004), // 站台关闭清客
UP_HOLD(0x00000010), // 上行方向车站扣车
DOWN_HOLD(0x00000020), // 下行方向车站扣车
UP_OCC_HOLD(0x00000040), // 上行方向中心扣车
DOWN_OCC_HOLD(0x00000080), // 下行方向中心扣车
PSD_OPEN(0x00000100), // 屏蔽门开
PSD_CUT(0x00000200), // 屏蔽门切除
UP_SKIPSTOP(0x00000400), // 上行方向跳停
DOWN_SKIPSTOP(0x00000800), // 下行方向跳停
UP_TRAIN_SKIPSTOP(0x00001000), // 上行方向指定列车跳停
DOWN_TRAIN_SKIPSTOP(0x00002000); // 下行方向指定列车跳停
//TODO 0xABCD0000 ABCD这两个字节表示停站时间
int val;
PLATFORM(int val) {
this.val = val;
}
}
public enum SCADA {
SCADA_ON(0x00000001), // 有电
SCADA_SINGLE_POWER(0x00000002), // 单边供电
SCADA_UNKOWN(0x00000004); // 未知状态
private final int value;
SCADA(int value) {
this.value = value;
}
}
/**
* 设备状态定义表 WATERPROOF_DOOR
*/
public enum WATERPROOF_DOOR {
DOOR_CLOSED(0x00000001), // 防淹门关闭
DOOR_EXPECT_CLOSE(0x00000002), // 请求防淹门关闭
DOOR_AGREE_CLOSED(0x00000004), // 同意防淹门关闭
DOOR_CLOSING(0x00000008), // 防淹门处于关门过程中
DOOR_OPEN_LOCK(0x00000010); // 防淹门处于开门且锁紧状态
// 枚举类型的值
private final int value;
// 获取枚举类型的值
public int getValue() {
return value;
}
WATERPROOF_DOOR(int value) {
this.value = value;
}
}
/**
* 设备状态定义表 WORK_AREA
*/
public enum WORK_AREA {
/**
* 该位为1 工作区使能
*/
IP_STUS_WORK_AREA_ENABLE(0x00000001);;
int val;
WORK_AREA(int val) {
this.val = val;
}
}
/**
* 设备状态定义表 GAMA
*/
public enum DeviceTypeStatusGAMAEnum {
/**
* 该位为1 GAMA不使能
*/
IP_STUS_GAMA_DISABLE(0x00000001);
int val;
DeviceTypeStatusGAMAEnum(int val) {
this.val = val;
}
}
/**
* TRAIN_MODE
*/
public enum DeviceTypeStatusTRAIN_MODEEnum {
IP_MODE_TRAIN_TYPE_MANUAL(0x00000000), // 人工车
IP_MODE_TRAIN_TYPE_HEAD(0x00000001), // 头码车
IP_MODE_TRAIN_TYPE_SPECIAL(0x00000002), // 特殊人工车
IP_MODE_TRAIN_TYPE_SCHEDULE(0x00000003), // 计划车
IP_MODE_TRAIN_TYPE_ROUTE(0x00000004), // 运行线车
IP_MODE_TRAIN_TYPE_SHUTTLE(0x00000005), // 单线往返车
IP_MODE_TRAIN_TYPE_LINEUP(0x00000006), // 预定义车
IP_MODE_TRAIN_SCHD_EARLY(0x00000008), // 早点计划车
IP_MODE_TRAIN_SCHD_LATE(0x00000010), // 晚点计划车
IP_MODE_TRAIN_SKIPSTOP(0x00000100), // 设置跳停
IP_MODE_TRAIN_CBTC_MODE(0x00000200), // CBTC跟踪模式
IP_MODE_TRAIN_ATP_CUT(0x00000400), // 列车ATP切除
IP_MODE_TRAIN_BERTHED(0x00000800), // 在站台或存车线停站
IP_MODE_TRAIN_STOPED(0x00001000), // 列车停止运动
IP_MODE_TRAIN_HOLDED(0x00002000), // 被扣车
IP_MODE_TRAIN_ITAMA(0x00004000), // ITAMA允许
IP_MODE_TRAIN_DIR_UP(0x00008000), // 跟踪的列车运动方向为上行
IP_MODE_TRAIN_DIR_DOWN(0x00010000), // 跟踪的列车运动方向为下行
IP_MODE_TRAIN_DIR_HEAD_UP(0x00020000), // 根据ATC报告列车上行头牵引
IP_MODE_TRAIN_DIR_HEAD_DOWN(0x00040000), // 根据ATC报告列车下行头牵引
IP_MODE_TRAIN_DOOR_OPEN(0x00080000), // 列车车门状态关闭开启
IP_MODE_TRAIN_RS_ALARM(0x00100000), // 列车车辆接口告警状态
IP_MODE_TRAIN_DOOR_ALARM(0x00200000), // 列车车门告警状态
IP_MODE_TRAIN_EB_ALARM(0x00400000), // 列车紧急制动告警
IP_MODE_TRAIN_INTEGRITY_ALARM(0x00800000), // 列车完整性告警
// 列车驾驶模式掩码
IP_MODE_TRAIN_DRIVE_MODE_AM(0x10000000), // CBTC模式下有人自动驾驶模式
IP_MODE_TRAIN_DRIVE_MODE_CM(0x20000000), // CBTC模式下人工驾驶模式
IP_MODE_TRAIN_DRIVE_MODE_RMF(0x30000000), // RM模式前进
IP_MODE_TRAIN_DRIVE_MODE_DTO(0x40000000), // DTO无人驾驶模式
IP_MODE_TRAIN_DRIVE_MODE_ATB(0x50000000), // ATB自动折返模式
IP_MODE_TRAIN_DRIVE_BLOCK_AM(0x60000000), // 点式有人自动驾驶模式
IP_MODE_TRAIN_DRIVE_BLOCK_CM(0x70000000), // 点式人工驾驶模式
IP_MODE_TRAIN_DRIVE_MODE_RMR(0x80000000), // RM模式后退
IP_MODE_TRAIN_DRIVE_MODE_WASH(0x90000000); // 洗车模式
// 枚举类型的值
private final int value;
// 枚举类型的构造函数
DeviceTypeStatusTRAIN_MODEEnum(int value) {
this.value = value;
}
// 获取枚举类型的值
public int getValue() {
return value;
}
}
}

View File

@ -0,0 +1,65 @@
package club.joylink.xiannccda.ats.message.rep.device;
import java.util.Arrays;
public enum DeviceType {
/**
* 未知的设备
*/
DEVICE_TYPE_UNKNOW(0),
/**
* 集中站
*/
DEVICE_TYPE_RTU(1),
/**
* 车站
*/
DEVICE_TYPE_STATION(2),
/**
* 信号机
*/
DEVICE_TYPE_SIGNAL(3),
/**
* 道岔
*/
DEVICE_TYPE_SWITCH(4),
/**
* 轨道
*/
DEVICE_TYPE_TRACK(5),
/**
* 方向
*/
DEVICE_TYPE_ENTRY(6),
/**
* 站台
*/
DEVICE_TYPE_PLATFORM(7),
/**
* 供电区段
*/
DEVICE_TYPE_SCADA(9),
/**
* 防淹门
*/
DEVICE_TYPE_WATERPROOF_DOOR(11),
/**
* 工作区
*/
DEVICE_TYPE_WORK_AREA(12),
/**
* 区域自动驾驶
*/
DEVICE_TYPE_GAMA(13),
;
int val;
DeviceType(int d) {
this.val = d;
}
public static DeviceType of(int d) {
return Arrays.stream(DeviceType.values()).filter(dd -> dd.val == d).findFirst().orElse(null);
}
}

View File

@ -3,7 +3,11 @@ package club.joylink.xiannccda.ats.message.req;
import club.joylink.xiannccda.ats.message.MessageData;
import club.joylink.xiannccda.ats.message.MessageId;
import club.joylink.xiannccda.ats.message.MessageRequest;
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
import club.joylink.xiannccda.ats.message.rep.ScheduleSubIdType;
import io.netty.buffer.ByteBuf;
import java.time.LocalDateTime;
import java.util.Arrays;
/**
* 2.8.9 事件及告警信息请求消息
@ -37,22 +41,41 @@ public class AlarmAckRequest extends MessageRequest {
* <p>
* 02H:列车信息系统事件
*/
private Short msgType;
private MsgTypeEnum msgType;
/**
* 开始时间(7)
*/
private MessageData.DateTime startTime;
private LocalDateTime startTime;
/**
* 结束时间(7)
*/
private MessageData.DateTime endTime;
private LocalDateTime endTime;
@Override
public void encode2(ByteBuf buf) {
buf.writeShort(this.lineId);
buf.writeShort(this.reportId);
buf.writeShort(this.msgType);
buf.writeBytes(startTime.requestData());
buf.writeBytes(endTime.requestData());
buf.writeShort(this.msgType.val);
byte[] st = new byte[7];
DateTimeUtil.convert(LocalDateTime.now(), st);
byte[] et = new byte[7];
DateTimeUtil.convert(LocalDateTime.now(), et);
buf.writeBytes(st);
buf.writeBytes(et);
}
public enum MsgTypeEnum {
OPTION_COMMON(0X01), TRAIN_EVENT(0X02);
private final int val;
MsgTypeEnum(int val) {
this.val = val;
}
public static MsgTypeEnum of(int d) {
return Arrays.stream(MsgTypeEnum.values()).filter(dd -> dd.val == d).findFirst().orElse(null);
}
}
}

View File

@ -2,7 +2,9 @@ package club.joylink.xiannccda.ats.message.req;
import club.joylink.xiannccda.ats.message.MessageId;
import club.joylink.xiannccda.ats.message.MessageRequest;
import club.joylink.xiannccda.ats.message.line3.DateTimeUtil;
import io.netty.buffer.ByteBuf;
import java.time.LocalDateTime;
/**
* 2.8.13 历史运行图申请消息 定义
@ -29,7 +31,7 @@ public class LoadHistoryTGDataRequest extends MessageRequest {
/**
* 日期(7)
*/
private DateTime date;
private LocalDateTime date;
/**
* 申请类型(1)
* <p>
@ -37,14 +39,17 @@ public class LoadHistoryTGDataRequest extends MessageRequest {
* <p>
* 0x02:实际图
*/
private Byte tgType;
private ApplyTypeEnum tgType;
@Override
public void encode2(ByteBuf buf) {
buf.writeShort(this.lineId);
buf.writeBytes(this.date.requestData());
buf.writeByte(this.tgType);
byte[] s = new byte[7];
DateTimeUtil.convert(LocalDateTime.now(), s);
buf.writeBytes(s);
buf.writeByte(this.tgType.val);
}
public enum ApplyTypeEnum {