| | |
| | | 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; |
| | |
| | | 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(); |
| | |
| | | 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: |
| | |
| | | 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) { |