24 std::vector<uint8_t> payload;
28 std::vector<uint8_t> token;
36 Packet(
CommandType cmd, std::vector<uint8_t> data, std::vector<uint8_t> tokenData = {});
41 std::vector<uint8_t>
serialize()
const override;
46 void deserialize(
const std::vector<uint8_t>& buffer)
override;
52 uint32_t
size()
const override;
uint32_t size() const override
Gets the total size of the packet in bytes.
Definition Packet.cpp:81
Packet(CommandType cmd, std::vector< uint8_t > data, std::vector< uint8_t > tokenData={})
Constructs a Packet with command, payload, and optional token.
Definition Packet.cpp:11
void deserialize(const std::vector< uint8_t > &buffer) override
Deserializes the packet from a byte vector.
Definition Packet.cpp:45
std::vector< uint8_t > serialize() const override
Serializes the packet to a byte vector.
Definition Packet.cpp:19
const std::vector< uint8_t > getPayload() const
Gets the payload data of the packet.
Definition Packet.cpp:90
CommandType
Definition PacketConstants.h:12