From 87cba28b3dc8389e1df61f3ba7d986b09fd89db0 Mon Sep 17 00:00:00 2001
From: liusuyi <1951119284@qq.com>
Date: Sat, 02 Nov 2024 11:26:21 +0800
Subject: [PATCH] 增加:无人机设置接口
---
ard-work/src/main/java/com/ard/tianyu/netty/handler/MessageProtocolDecoder.java | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/ard-work/src/main/java/com/ard/tianyu/netty/handler/MessageProtocolDecoder.java b/ard-work/src/main/java/com/ard/tianyu/netty/handler/MessageProtocolDecoder.java
index ded0aa6..0675b91 100644
--- a/ard-work/src/main/java/com/ard/tianyu/netty/handler/MessageProtocolDecoder.java
+++ b/ard-work/src/main/java/com/ard/tianyu/netty/handler/MessageProtocolDecoder.java
@@ -16,6 +16,9 @@
import com.ard.tianyu.netty.command.register.HeartbeatReplyCmd;
import com.ard.tianyu.netty.command.register.RegisterReplyCmd;
import com.ard.tianyu.netty.command.register.UavInitReplyCmd;
+import com.ard.tianyu.netty.command.settings.ReturnHeightSettingReplyCmd;
+import com.ard.tianyu.netty.command.settings.ReturnPointSettingReplyCmd;
+import com.ard.tianyu.netty.command.settings.VideoStreamSettingReplyCmd;
import com.ard.tianyu.netty.command.wayline.*;
import com.ard.tianyu.netty.protobuf.TelemetryDataPB;
import com.google.protobuf.InvalidProtocolBufferException;
@@ -93,6 +96,11 @@
actionCode = in.readByte();//动作编号
baseCmd = processD1ReplyCmd(in, actionCode);
break;
+ case (byte) 0xD2:
+ in.readByte();//加密标志
+ actionCode = in.readByte();//动作编号
+ baseCmd = processD2ReplyCmd(in, actionCode);
+ break;
default:
in.readByte();//加密标志
actionCode = in.readByte();
@@ -134,8 +142,12 @@
return new WayLineResumeReplyCmd(boxSn, result, errorCode);
case 0x20:
return new WayLineEndReplyCmd(boxSn, result, errorCode);
+ case 0x21:
+ return new ReturnHeightSettingReplyCmd(boxSn, result, errorCode);
case 0x29:
return new LandForcedReplyCmd(boxSn, result, errorCode);
+ case 0x31:
+ return new ReturnPointSettingReplyCmd(boxSn, result, errorCode);
case 0x32:
return new EmergencyBrakeReplyCmd(boxSn, result, errorCode);
case 0x39:
@@ -156,11 +168,26 @@
return processSpecialD1ReplyCmd(in, actionCode, boxSn);
// Add other cases...
default:
- log.warn("无法识别的动作编号:{}", ByteUtils.byteToHex(actionCode));
+ log.warn("无法识别D1的动作编号:{}", ByteUtils.byteToHex(actionCode));
}
return null;
}
-
+ //处理D1指令回复
+ private BaseCmd processD2ReplyCmd(ByteBuf in, byte actionCode) {
+ byte result = in.readByte();
+ int errorCode = in.readInt();
+ byte[] uavData = new byte[15];
+ in.readBytes(uavData);
+ String boxSn = new String(uavData);
+ switch (actionCode) {
+ case 0x05:
+ return new VideoStreamSettingReplyCmd(boxSn, result, errorCode);
+ // Add other cases...
+ default:
+ log.warn("无法识别D2的动作编号:{}", ByteUtils.byteToHex(actionCode));
+ }
+ return null;
+ }
//处理特殊D1指令回复
private BaseCmd processSpecialD1ReplyCmd(ByteBuf in, byte actionCode, String boxSn) {
switch (actionCode) {
--
Gitblit v1.9.3