package com.ard.tianyu.netty.command.real;
|
|
import com.ard.tianyu.netty.command.BaseCommand;
|
import com.ard.tianyu.netty.protobuf.TelemetryDataPB;
|
import io.netty.buffer.ByteBuf;
|
|
public class UavStateCommand extends BaseCommand {
|
private TelemetryDataPB.UavState uavState; // ProtoBuf 数据类
|
|
// 构造函数
|
public UavStateCommand(TelemetryDataPB.UavState uavState) {
|
setDataHeader((short) 0x6A77); // 设置帧头
|
// setDataLength((short) (1 + uavState.toByteArray().length)); // 数据长度
|
setCmdCode((byte) 0xA8); // 设置命令编号
|
this.uavState = uavState;
|
}
|
|
// 获取无人机状态数据
|
public TelemetryDataPB.UavState getUavState() {
|
return uavState;
|
}
|
|
// 实现 encode 方法,如果需要
|
@Override
|
public void encode(ByteBuf out) {
|
// 根据需要实现编码
|
}
|
}
|