paqueteCnC
|
Public Member Functions | |
Packet | readPacket (const std::byte *buffer) |
void | writePacket (std::byte *buffer, Packet &packet) |
Packet PacketBufferIO::readPacket | ( | const std::byte * | ptrBuffer | ) |
Some bytes have multiple fields. Depending on if the word has multiple fields or not I will increase or not the ptrBuffer.
Map of byte to fields: XXX X X 0 XX... | std::byte = version, type, dfh, 0, source... ...XXX XXXXX | std::byte = ...source, destination XX XXXXXX... | std::byte = seq_ctrl_flags, seq_ctrl_count... ...XXXXXXXX | std::byte = ...seq_ctrl_count XXXXXXXX... | std::byte = length... ...XXXXXXXX | std::byte = ...length X XXX XXXX | std::byte = ccsds, pus, ack XXXXXXXX | std::byte = type .XXXXXXX... | std::byte = subtype
(...) | (application data)
00000000... ! std::byte = error control... (all 0 this byte) XXXXXXXX ! std::byte = ...error control
Note: extractFieldFrom() assumes that the rightmost bit is index 0 on each byte.
void PacketBufferIO::writePacket | ( | std::byte * | ptrBuffer, |
Packet & | packet | ||
) |
See readPacket() for the structure.
I shift the words around so that a final OR results in the wanted byte.