From 86b4e393906791a8119c89e8ca7fdc6363014b53 Mon Sep 17 00:00:00 2001
From: xzb <223@qq.com>
Date: Wed, 7 Jun 2023 14:57:17 +0800
Subject: [PATCH] =?UTF-8?q?ncc=E5=8D=8F=E8=AE=AEx?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../xiannccda/ats/message/MessageId.java | 2 +-
.../line3/DriverDistanceReportResponse.java | 76 +++++++++++++++++++
2 files changed, 77 insertions(+), 1 deletion(-)
create mode 100644 src/main/java/club/joylink/xiannccda/ats/message/line3/DriverDistanceReportResponse.java
diff --git a/src/main/java/club/joylink/xiannccda/ats/message/MessageId.java b/src/main/java/club/joylink/xiannccda/ats/message/MessageId.java
index 162ddf0..5c3b345 100644
--- a/src/main/java/club/joylink/xiannccda/ats/message/MessageId.java
+++ b/src/main/java/club/joylink/xiannccda/ats/message/MessageId.java
@@ -66,7 +66,7 @@ public enum MessageId {
/**
* 司机驾驶里程报告
*/
- DRIVER_DISTANCE_REPORT(0x0014, null),
+ DRIVER_DISTANCE_REPORT(0x0014, ()->new DriverDistanceReportResponse()),
/**
* 调度日志报告
*/
diff --git a/src/main/java/club/joylink/xiannccda/ats/message/line3/DriverDistanceReportResponse.java b/src/main/java/club/joylink/xiannccda/ats/message/line3/DriverDistanceReportResponse.java
new file mode 100644
index 0000000..833f5bb
--- /dev/null
+++ b/src/main/java/club/joylink/xiannccda/ats/message/line3/DriverDistanceReportResponse.java
@@ -0,0 +1,76 @@
+package club.joylink.xiannccda.ats.message.line3;
+
+import club.joylink.xiannccda.ats.message.MessageResponse;
+import io.netty.buffer.ByteBuf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 2.8.5 司机驾驶里程报告消息
+ */
+public class DriverDistanceReportResponse extends MessageResponse {
+
+ /**
+ * 线路号(2)
+ */
+ private Short lineId;
+ /**
+ * 查询标识号(2)
+ * 同一时间多个查询的report_id不允许重复,答复消息中的report_id值跟查询消息中的相同
+ */
+ private Short reportId;
+ /**
+ * 消息总数(2)
+ */
+ private Short totalMessage;
+ /**
+ * 本消息的顺序号(2)
+ */
+ private Short messageSequence;
+ /**
+ * 记录条数(2)
+ */
+ private Short count;
+ /**
+ * 司机驾驶列表
+ */
+ private List drivers;
+
+ @Override
+ public void decode2(ByteBuf buf) throws Exception {
+ this.lineId = buf.readShort();
+ this.reportId = buf.readShort();
+ this.totalMessage = buf.readShort();
+ this.messageSequence = buf.readShort();
+ this.count = buf.readShort();
+ this.drivers = new ArrayList<>(this.count);
+ for (int i = 0; i < this.count; i++) {
+ this.drivers.add(new DriverCell().decode(buf));
+ }
+
+ }
+
+ public static class DriverCell {
+
+ /**
+ * 日期(7)
+ */
+ private byte[] date = new byte[7];
+ /**
+ * 司机号(13)
+ */
+ private byte[] driverId = new byte[13];
+ /**
+ * 行驶距离(4)
+ */
+ private Integer distance;
+
+ public DriverCell decode(final ByteBuf buf) {
+ buf.readBytes(this.date);
+ buf.readBytes(this.driverId);
+ this.distance = buf.readInt();
+ return this;
+ }
+ }
+}