C++ class representing a MIP field.
More...
#include <mip.hpp>
|
| Field () |
| Construct an empty MIP field. More...
|
|
| Field (uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t *payload, uint8_t payload_length) |
| Constructs a mip_field given the parameters. More...
|
|
| Field (const uint8_t *header, uint8_t total_length, uint8_t descriptor_set) |
| Constructs a mip_field from a pointer to the heaader. More...
|
|
| Field (const C::mip_field &other) |
| Creates a Field class from the mip_field C struct. More...
|
|
uint8_t | descriptorSet () const |
| Returns the descriptor set of the packet containing this field._. More...
|
|
uint8_t | fieldDescriptor () const |
| Returns the field descriptor. More...
|
|
uint8_t | payloadLength () const |
| Returns the length of the payload. More...
|
|
const uint8_t * | payload () const |
| Returns the payload pointer for the field data. More...
|
|
template<class Field > |
bool | extract (Field &field) const |
|
uint8_t | payload (unsigned int index) const |
| Index the payload at the given location. More...
|
|
bool | isValid () const |
| Returns true if the field has a valid field descriptor. More...
|
|
Field | nextAfter () const |
| Gets the next field after the specified field._. More...
|
|
bool | next () |
| Updates the mip_field to refer to the next field in a packet. More...
|
|
bool | isCommandSet () const |
| Determines if the field is from a command descriptor set (a command, reply, or response field). More...
|
|
bool | isData () const |
| Determines if the field contains a data field. More...
|
|
bool | isCommand () const |
| Determines if the field holds a command. More...
|
|
bool | isResponse () const |
| Determines if the field holds command response data. More...
|
|
bool | isReply () const |
| Determines if the field holds an ack/nack reply code. More...
|
|
C++ class representing a MIP field.
◆ Field() [1/4]
Construct an empty MIP field.
◆ Field() [2/4]
mip::Field::Field |
( |
uint8_t |
descriptor_set, |
|
|
uint8_t |
field_descriptor, |
|
|
const uint8_t * |
payload, |
|
|
uint8_t |
payload_length |
|
) |
| |
|
inline |
Constructs a mip_field given the parameters.
- Parameters
-
field | |
descriptor_set | The MIP descriptor set of the packet. |
field_descriptor | The MIP field descriptor. |
payload | A pointer to a buffer containing the field payload, not including the field header. The data must exist while the field is in use. Can be NULL if payload_length is 0. |
payload_length | The length of the payload. Cannot exceed MIP_FIELD_PAYLOAD_LENGTH_MAX. |
- Returns
- A mip_field initialized with the specified values.
◆ Field() [3/4]
mip::Field::Field |
( |
const uint8_t * |
header, |
|
|
uint8_t |
total_length, |
|
|
uint8_t |
descriptor_set |
|
) |
| |
|
inline |
Constructs a mip_field from a pointer to the heaader.
Generally you should use mip_field_from_packet() or mip_field_create() instead.
- Parameters
-
header | A pointer to the header and payload. Usually inside of a MIP packet. |
total_length | The total length of either the field or packet payload, starting from header_ptr and including the header bytes. If total_length is longer than the field (i.e. if it's the packet payload length) then mip_field_next() may be used to iterate fields. |
descriptor_set | The descriptor set for the packet containing this field. May be 0x00 if not used by any function handling the field. |
- Returns
- a mip_field struct with the field data.
◆ Field() [4/4]
Creates a Field class from the mip_field C struct.
◆ descriptorSet()
uint8_t mip::Field::descriptorSet |
( |
| ) |
const |
|
inline |
Returns the descriptor set of the packet containing this field._.
◆ extract()
template<class Field >
bool mip::Field::extract |
( |
Field & |
field | ) |
const |
|
inline |
◆ fieldDescriptor()
uint8_t mip::Field::fieldDescriptor |
( |
| ) |
const |
|
inline |
Returns the field descriptor.
◆ isCommand()
bool mip::Field::isCommand |
( |
| ) |
const |
|
inline |
Determines if the field holds a command.
◆ isCommandSet()
bool mip::Field::isCommandSet |
( |
| ) |
const |
|
inline |
Determines if the field is from a command descriptor set (a command, reply, or response field).
◆ isData()
bool mip::Field::isData |
( |
| ) |
const |
|
inline |
Determines if the field contains a data field.
◆ isReply()
bool mip::Field::isReply |
( |
| ) |
const |
|
inline |
Determines if the field holds an ack/nack reply code.
◆ isResponse()
bool mip::Field::isResponse |
( |
| ) |
const |
|
inline |
Determines if the field holds command response data.
◆ isValid()
bool mip::Field::isValid |
( |
| ) |
const |
|
inline |
Returns true if the field has a valid field descriptor.
◆ next()
bool mip::Field::next |
( |
| ) |
|
|
inline |
Updates the mip_field to refer to the next field in a packet.
- Parameters
-
field | This mip_field struct will be updated to the next field._ Can be an invalid field, in which case the result will be invalid as well. |
- Returns
- true if the field exists and is valid.
◆ nextAfter()
Field mip::Field::nextAfter |
( |
| ) |
const |
|
inline |
Gets the next field after the specified field._.
- Parameters
-
field | An existing MIP field in a packet. Can be invalid, in which case the result will also be invalid. |
- Returns
- A mip_field struct referencing the next field after the input field._ Check mip_field_is_valid() to see if the field exists.
◆ payload() [1/2]
const uint8_t* mip::Field::payload |
( |
| ) |
const |
|
inline |
Returns the payload pointer for the field data.
◆ payload() [2/2]
uint8_t mip::Field::payload |
( |
unsigned int |
index | ) |
const |
|
inline |
Index the payload at the given location.
- Parameters
-
- Returns
- payload byte
◆ payloadLength()
uint8_t mip::Field::payloadLength |
( |
| ) |
const |
|
inline |
Returns the length of the payload.
The documentation for this class was generated from the following file: