liusuyi
2024-10-30 05ba868736725db54db1944ed5cf7a95d14efc37
ard-work/src/main/java/com/ard/tianyu/netty/handler/MessageProtocolDecoder.java
@@ -5,6 +5,7 @@
import com.ard.tianyu.netty.command.camera.CapturePicReplyCmd;
import com.ard.tianyu.netty.command.camera.RecordStartReplyCmd;
import com.ard.tianyu.netty.command.camera.RecordStopReplyCmd;
import com.ard.tianyu.netty.command.manual.*;
import com.ard.tianyu.netty.command.notice.BoxPowerStatusReplyCmd;
import com.ard.tianyu.netty.command.notice.FlyWayEndReplyCmd;
import com.ard.tianyu.netty.command.notice.UavReadyReplyCmd;
@@ -92,12 +93,84 @@
                byte encryptionFlag = in.readByte();
                byte actionCode = in.readByte();
                switch (actionCode) {
                    case 0x22:
                    case 0x11:
                        byte result = in.readByte();
                        int errorCode = in.readInt();
                        uavData = new byte[15];
                        in.readBytes(uavData);
                        String boxSn = new String(uavData);
                        baseCmd = new TakeOffReplyCmd(boxSn, result, errorCode);
                        log.debug("起飞回复: {}", boxSn);
                        break;
                    case 0x12:
                        result = in.readByte();
                        errorCode = in.readInt();
                        uavData = new byte[15];
                        in.readBytes(uavData);
                        boxSn = new String(uavData);
                        baseCmd = new ReturnHomeReplyCmd(boxSn, result, errorCode);
                        log.debug("返航回复: {}", boxSn);
                        break;
                    case 0x13:
                        result = in.readByte();
                        errorCode = in.readInt();
                        uavData = new byte[15];
                        in.readBytes(uavData);
                        boxSn = new String(uavData);
                        baseCmd = new ReturnHomeCancelReplyCmd(boxSn, result, errorCode);
                        log.debug("取消返航回复: {}", boxSn);
                        break;
                    case 0x14:
                        result = in.readByte();
                        errorCode = in.readInt();
                        uavData = new byte[15];
                        in.readBytes(uavData);
                        boxSn = new String(uavData);
                        baseCmd = new LandReplyCmd(boxSn, result, errorCode);
                        log.debug("降落回复: {}", boxSn);
                        break;
                    case 0x15:
                        result = in.readByte();
                        errorCode = in.readInt();
                        uavData = new byte[15];
                        in.readBytes(uavData);
                        boxSn = new String(uavData);
                        baseCmd = new LandCancelReplyCmd(boxSn, result, errorCode);
                        log.debug("取消降落回复: {}", boxSn);
                        break;
                    case 0x29:
                        result = in.readByte();
                        errorCode = in.readInt();
                        uavData = new byte[15];
                        in.readBytes(uavData);
                        boxSn = new String(uavData);
                        baseCmd = new LandForcedReplyCmd(boxSn, result, errorCode);
                        log.debug("强制降落回复: {}", boxSn);
                        break;
                    case 0x32:
                        result = in.readByte();
                        errorCode = in.readInt();
                        uavData = new byte[15];
                        in.readBytes(uavData);
                        boxSn = new String(uavData);
                        baseCmd = new EmergencyBrakeReplyCmd(boxSn, result, errorCode);
                        log.debug("紧急制动回复: {}", boxSn);
                        break;
                    case 0x39:
                        result = in.readByte();
                        errorCode = in.readInt();
                        uavData = new byte[15];
                        in.readBytes(uavData);
                        boxSn = new String(uavData);
                        baseCmd = new PointControlReachedReplyCmd(boxSn, result, errorCode);
                        log.debug("到达指点飞行位置回复: {}", boxSn);
                        break;
                    case 0x22:
                        result = in.readByte();
                        errorCode = in.readInt();
                        uavData = new byte[15];
                        in.readBytes(uavData);
                        boxSn = new String(uavData);
                        baseCmd = new CameraModeReplyCmd(boxSn, result, errorCode);
                        log.debug("设置相机模式回复: {}", boxSn);
                        break;