From 41c64a5680521bf1d41fa6b9caadc55feac68ca3 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期四, 05 六月 2025 16:12:59 +0800 Subject: [PATCH] 优化报警 --- ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNRealvideoMsgEnd.java | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNRealvideoMsgEnd.java b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNRealvideoMsgEnd.java index b9b8b62..a8590e7 100644 --- a/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNRealvideoMsgEnd.java +++ b/ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/model/DOWNRealvideoMsgEnd.java @@ -1,6 +1,11 @@ package com.ruoyi.dataInterchange.model; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufUtil; +import io.netty.buffer.Unpooled; import lombok.Data; + +import java.io.UnsupportedEncodingException; /** * 主动请求停止实时音视频传输 @@ -37,4 +42,33 @@ * 0x02: 视频 */ private Integer avttemType; + + + /** + * 编码回复报文 + */ + public byte[] encode() { + ByteBuf byteBuf = Unpooled.buffer(30); + byte[] bytes1 = new byte[0]; + try { + bytes1 = this.getVehicleNo().getBytes("GBK"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + 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.getChannelId()); + byteBuf.writeChar(this.getAvttemType()); + byte[] bytes = ByteBufUtil.getBytes(byteBuf); + byteBuf.release(); + return bytes; + } } -- Gitblit v1.7.1