|
3es
0.7
|
A utility class used for managing read/write operations to a PacketHeader payload.
More...
#include <3espacketstream.h>
Classes | |
| struct | IsConst |
Type traits: is T const? More... | |
| struct | IsConst< const T > |
Type traits: is T const? More... | |
Public Types | |
| enum | SeekPos { Begin, Current, End } |
| Control values for seeking. More... | |
| enum | Status { Ok = 0, EOP = (1 << 0), Fail = (1 << 1), ReadOnly = (1 << 2), CrcValid = (1 << 3) } |
| Status bits. More... | |
| typedef uint16_t | CrcType |
| Defies the packet CRC type. | |
Public Member Functions | |
| PacketStream (HEADER &packet) | |
Create a stream to read from beginning at packet. More... | |
| uint32_t | marker () const |
| Fetch the marker bytes in local endian. More... | |
| uint16_t | versionMajor () const |
| Fetch the major version bytes in local endian. More... | |
| uint16_t | versionMinor () const |
| Fetch the minor version bytes in local endian. More... | |
| uint16_t | payloadSize () const |
| Fetch the payload size bytes in local endian. More... | |
| uint16_t | packetSize () const |
| Returns the size of the packet plus payload, giving the full data packet size including the CRC. More... | |
| uint16_t | routingId () const |
| Fetch the routing ID bytes in local endian. More... | |
| uint16_t | messageId () const |
| Fetch the message ID bytes in local endian. More... | |
| CrcType | crc () const |
| Fetch the CRC bytes in local endian. More... | |
| CrcType * | crcPtr () |
| Fetch a pointer to the CRC bytes. More... | |
| const CrcType * | crcPtr () const |
| uint16_t | status () const |
Report the Status bits. More... | |
| bool | isEop () const |
| At end of packet/stream? More... | |
| bool | isOk () const |
| Status OK? More... | |
| bool | isFail () const |
| Fail bit set? More... | |
| bool | isReadOnly () const |
| Read only stream? More... | |
| bool | isCrcValid () const |
| CRC validated? More... | |
| HEADER & | packet () const |
Access the head of the packet buffer, for direct PacketHeader access. More... | |
| uint16_t | tell () const |
| Tell the current stream position. More... | |
| bool | seek (int offset, SeekPos pos=Begin) |
| Seek to the indicated position. More... | |
| const uint8_t * | payload () const |
| Direct payload pointer access. More... | |
Protected Attributes | |
| HEADER & | _packet |
| Packet header and buffer start address. | |
| uint16_t | _status |
Status bits. | |
| uint16_t | _payloadPosition |
| Payload cursor. | |
A utility class used for managing read/write operations to a PacketHeader payload.
The template type is intended to be either a PacketReader or a const PacketHeader for use with PacketWriter and PacketReader respectively.
| enum tes::PacketStream::SeekPos |
| enum tes::PacketStream::Status |
| tes::PacketStream< HEADER >::PacketStream | ( | HEADER & | packet | ) |
Create a stream to read from beginning at packet.
| packet | The beginning of the data packet. |
|
inline |
Fetch the CRC bytes in local endian.
Invalid for packets with the PF_NoCrc flag set.
| PacketStream< HEADER >::CrcType * tes::PacketStream< HEADER >::crcPtr | ( | ) |
Fetch a pointer to the CRC bytes.
Invalid for packets with the PF_NoCrc flag set.
Referenced by tes::PacketStream< PacketHeader >::crc().
| const PacketStream< HEADER >::CrcType * tes::PacketStream< HEADER >::crcPtr | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
CRC validated?
|
inline |
At end of packet/stream?
|
inline |
Fail bit set?
Referenced by tes::PacketStream< PacketHeader >::isOk().
|
inline |
Status OK?
|
inline |
Read only stream?
|
inline |
Fetch the marker bytes in local endian.
PacketHeader::marker bytes.
|
inline |
Fetch the message ID bytes in local endian.
PacketHeader::messageId bytes.
|
inline |
Access the head of the packet buffer, for direct PacketHeader access.
Note: values are in network Endian.
PacketHeader. Referenced by tes::PacketStream< PacketHeader >::isCrcValid(), and tes::PacketStream< PacketHeader >::packetSize().
|
inline |
Returns the size of the packet plus payload, giving the full data packet size including the CRC.
Referenced by tes::sendMessage().
|
inline |
Direct payload pointer access.
Referenced by tes::PacketStream< PacketHeader >::isCrcValid().
|
inline |
Fetch the payload size bytes in local endian.
PacketHeader::payloadSize bytes. Referenced by tes::PacketStream< PacketHeader >::packetSize(), and tes::PacketStream< PacketHeader >::seek().
|
inline |
Fetch the routing ID bytes in local endian.
PacketHeader::routingId bytes. | bool tes::PacketStream< HEADER >::seek | ( | int | offset, |
| SeekPos | pos = Begin |
||
| ) |
Seek to the indicated position.
| offset | Seek offset from pos. |
| pos | The seek reference position. |
Referenced by tes::PacketStream< PacketHeader >::isCrcValid().
|
inline |
Report the Status bits.
Status flags. Referenced by tes::PacketStream< PacketHeader >::crc().
|
inline |
Tell the current stream position.
Referenced by tes::PacketStream< PacketHeader >::isCrcValid().
|
inline |
Fetch the major version bytes in local endian.
PacketHeader::versionMajor bytes.
|
inline |
Fetch the minor version bytes in local endian.
PacketHeader::versionMinor bytes.