#include <Packet.h>
Public Member Functions | |
DataPacket () | |
char * | getBytestream (unsigned bytestreamNumber, unsigned &byteCount) |
unsigned | getBytestreamBufferLength (unsigned bytestreamNumber) |
void | verify (unsigned bufferLength=0) const |
Public Attributes | |
DataPacketHeader | header |
uint8_t | payload [PayloadSize] |
Static Public Attributes | |
static constexpr int | PayloadSize = DATA_PACKET_MAX - sizeof( DataPacketHeader ) |
DataPacket::DataPacket | ( | ) |
Double check that packet struct is correct length. Watch out for RTTI increasing the size.
References DataPacket().
Referenced by DataPacket().
char * DataPacket::getBytestream | ( | unsigned | bytestreamNumber, |
unsigned & | byteCount | ||
) |
Verify that packet is correct type
Check bytestreamNumber in bounds
Calc positions in packet
Sum size of preceding stream buffers to get position
Double check buffer is completely within packet
Return start of buffer
References e57::DataPacketHeader::bytestreamCount, e57::DATA_PACKET, e57::E57_ERROR_BAD_CV_PACKET, e57::E57_ERROR_INTERNAL, header, e57::DataPacketHeader::packetLogicalLengthMinus1, e57::DataPacketHeader::packetType, payload, and e57::toString().
Referenced by getBytestreamBufferLength().
unsigned DataPacket::getBytestreamBufferLength | ( | unsigned | bytestreamNumber | ) |
References getBytestream().
void DataPacket::verify | ( | unsigned | bufferLength = 0 | ) | const |
Verify header is good
Calc sum of lengths of each bytestream buffer in this packet
Calc size of packet needed
If needed is not with 3 bytes of actual packet size, have an error
Verify that padding at end of packet is zero
References e57::DataPacketHeader::bytestreamCount, e57::E57_ERROR_BAD_CV_PACKET, header, e57::DataPacketHeader::packetLogicalLengthMinus1, payload, e57::toString(), and e57::DataPacketHeader::verify().
Referenced by e57::PacketReadCache::readPacket().
DataPacketHeader e57::DataPacket::header |
Referenced by getBytestream(), and verify().
uint8_t e57::DataPacket::payload[PayloadSize] |
Referenced by getBytestream(), and verify().
|
staticconstexpr |