| | |
| | | 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.camera.PicUploadCompletedReplyCmd; |
| | | import com.ard.tianyu.netty.command.notice.UavReadyReplyCmd; |
| | | import com.ard.tianyu.netty.command.real.SignalInfoCmd; |
| | | import com.ard.tianyu.netty.command.real.UavStateCmd; |
| | |
| | | import io.netty.channel.ChannelHandlerContext; |
| | | import io.netty.handler.codec.ByteToMessageDecoder; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | |
| | | baseCmd = new HeartbeatReplyCmd(timestamp); |
| | | log.debug("心跳回复: 时间戳 {}", timestamp); |
| | | break; |
| | | case 0x09: |
| | | in.readByte();//加密标志 |
| | | double longitude = in.readDouble(); |
| | | double latitude = in.readDouble(); |
| | | timestamp = in.readLong(); // 读取时间戳 |
| | | long picLength = in.readLong(); // 读取原图大小 |
| | | byte[] boxSn = new byte[15]; |
| | | in.readBytes(boxSn);// 读取boxSn |
| | | byte[] pic = new byte[dataLength - 49]; |
| | | in.readBytes(pic);// 读取原图地址 |
| | | baseCmd = new PicUploadCompletedReplyCmd(longitude, latitude, timestamp, picLength, boxSn, pic); |
| | | log.debug("图片上传完成通知回复: 图片长度 {}", picLength); |
| | | break; |
| | | case 0x0A: |
| | | byte status = in.readByte(); |
| | | baseCmd = new BoxPowerStatusReplyCmd(status); |
| | | log.debug("云盒开机/关机通知回复: 状态 {}", ByteUtils.byteToHex(status)); |
| | | break; |
| | | |
| | | case (byte) 0xA8: |
| | | byte[] uavStatus = new byte[dataLength - 1]; |
| | | in.readBytes(uavStatus); // 读取 ProtoBuf 数据 |
| | |
| | | case (byte) 0xA9: |
| | | byte[] telemetryDataBytes = new byte[dataLength - 1]; |
| | | in.readBytes(telemetryDataBytes); |
| | | TelemetryDataPB.TelemetryData telemetryDataPB = TelemetryDataPB.TelemetryData.parseFrom(telemetryDataBytes); |
| | | TelemetryDataPB.TelemetryData telemetryDataPB = |
| | | TelemetryDataPB.TelemetryData.parseFrom(telemetryDataBytes); |
| | | TelemetryData telemetryData = UavTelemetryDataConverter.convertProtoToEntity(telemetryDataPB); |
| | | baseCmd = new UavTelemetryDataCmd(telemetryData); |
| | | log.debug("遥测数据: {}", telemetryData.getBoxSn()); |
| | |
| | | signalInfoBytes = new byte[dataLength - 20]; |
| | | in.readBytes(signalInfoBytes); |
| | | TelemetryDataPB.SignalInfo signalInfoPB = TelemetryDataPB.SignalInfo.parseFrom(signalInfoBytes); |
| | | SignalInfo signalInfo =UavSignalInfoConverter.convertProtoToEntity(signalInfoPB); |
| | | SignalInfo signalInfo = UavSignalInfoConverter.convertProtoToEntity(signalInfoPB); |
| | | baseCmd = new SignalInfoCmd(signalInfo); |
| | | log.debug("信道质量数据: {}", delayTime); |
| | | break; |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //处理D2指令回复 |
| | | private BaseCmd processD2ReplyCmd(ByteBuf in, byte actionCode) { |
| | | byte result = in.readByte(); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //处理特殊D1指令回复 |
| | | private BaseCmd processSpecialD1ReplyCmd(ByteBuf in, byte actionCode, String boxSn) { |
| | | switch (actionCode) { |