From 87c2f1ec41e244dfdd4722884fcdf285a1fe9b41 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期一, 24 三月 2025 14:41:25 +0800
Subject: [PATCH] 完成音视频协议接口对接

---
 ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNPlaybackMsgControl.java |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNPlaybackMsgControl.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNPlaybackMsgControl.java
index 335ce31..4021073 100644
--- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNPlaybackMsgControl.java
+++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNPlaybackMsgControl.java
@@ -1,5 +1,8 @@
 package com.ruoyi.dataInterchange.model;
 
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
+import io.netty.buffer.Unpooled;
 import lombok.Data;
 
 /**
@@ -52,4 +55,33 @@
 	 */
 	private Long dateTime;
 	
+	
+	/**
+	 * 编码回复报文
+	 */
+	public byte[] encode() {
+		ByteBuf byteBuf = Unpooled.buffer(38);
+		byte[] bytes1 = this.getVehicleNo().getBytes();
+		for (int i = 0; i < 21; i++) {
+			if (i < bytes1.length) {
+				byteBuf.writeByte(bytes1[i]);
+			} else {
+				byteBuf.writeByte(0x00);
+			}
+		}
+		byteBuf.writeByte(this.getVehicleColor());
+		byteBuf.writeShort(this.getDataType());
+		byteBuf.writeInt(this.getDataLength());
+		byteBuf.writeChar(this.getControlType());
+		byteBuf.writeChar(this.getFastTime());
+		if (null != this.getDateTime()) {
+			byteBuf.writeLong(this.getDateTime());
+		} else {
+			byteBuf.writeLong(0x00);
+		}
+		byte[] bytes = ByteBufUtil.getBytes(byteBuf);
+		byteBuf.release();
+		return bytes;
+	}
+	
 }

--
Gitblit v1.7.1