MIP_SDK
v3.0.0
MicroStrain Communications Library for embedded systems
|
Go to the documentation of this file.
31 FieldView() { C::mip_field_view::_payload=
nullptr; C::mip_field_view::_payload_length=0; C::mip_field_view::_field_descriptor=0x00; C::mip_field_view::_descriptor_set=0x00; C::mip_field_view::_remaining_length=0; }
86 template<
class FieldType>
87 bool extract(FieldType& field,
bool exact_size=
true)
const {
return microstrain::extract<microstrain::serialization::Endian::big>(field,
payload(),
payloadLength(), 0, exact_size); }
bool isCommandDescriptorSet(uint8_t descriptorSet)
Definition: mip_descriptors.hpp:82
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
bool isData() const
Determines if the field holds data (and not a command, reply, or response).
Definition: mip_field.hpp:91
bool next()
Updates the mip_field to refer to the next field in a packet.
Definition: mip_field.hpp:69
uint8_t payload(unsigned int index) const
Index the payload at the given location.
Definition: mip_field.hpp:57
uint8_t mip_field_descriptor_set(const mip_field_view *field)
Returns the descriptor set of the packet containing this field._.
Definition: mip_field.c:50
mip_field_view mip_field_from_header_ptr(const uint8_t *header, uint8_t total_length, uint8_t descriptor_set)
Constructs a mip_field from a pointer to the heaader.
Definition: mip_field.c:122
bool isCommandFieldDescriptor(uint8_t fieldDescriptor)
Definition: mip_descriptors.hpp:87
bool extract(FieldType &field, bool exact_size=true) const
Deserializes the field data to specific field struct.
Definition: mip_field.hpp:87
Implementation of std::span from C++20.
Definition: span.hpp:40
bool isDataDescriptorSet(uint8_t descriptorSet)
Definition: mip_descriptors.hpp:81
@ MIP_FIELD_PAYLOAD_LENGTH_MAX
Definition: mip_offsets.h:35
mip_field_view mip_field_next_after(const mip_field_view *field)
Gets the next field after the specified field.
Definition: mip_field.c:185
A structure representing a MIP field.
Definition: mip_field.h:52
bool isReply() const
Determines if the field holds an ack/nack reply code.
Definition: mip_field.hpp:100
uint8_t payloadLength() const
Returns the length of the payload.
Definition: mip_field.hpp:50
bool isResponseFieldDescriptor(uint8_t fieldDescriptor)
Definition: mip_descriptors.hpp:89
FieldView(const uint8_t *header, uint8_t total_length, uint8_t descriptor_set)
Constructs a mip_field from a pointer to the heaader.
Definition: mip_field.hpp:35
C++ class representing a MIP field.
Definition: mip_field.hpp:25
bool mip_field_next(mip_field_view *field)
Updates the mip_field to refer to the next field in a packet.
Definition: mip_field.c:204
uint8_t operator[](unsigned int index) const
Definition: mip_field.hpp:59
uint8_t fieldDescriptor() const
Returns the field descriptor.
Definition: mip_field.hpp:46
bool isReplyFieldDescriptor(uint8_t fieldDescriptor)
Definition: mip_descriptors.hpp:88
uint8_t mip_field_payload_length(const mip_field_view *field)
Returns the length of the payload.
Definition: mip_field.c:66
FieldView(const C::mip_field_view &other)
Creates a Field class from the mip_field C struct.
Definition: mip_field.hpp:37
FieldView(uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t *payload, uint8_t payload_length)
Constructs a field view given the parameters.
Definition: mip_field.hpp:33
bool mip_field_is_valid(const mip_field_view *field)
Returns true if the field has a valid field descriptor.
Definition: mip_field.c:84
CompositeDescriptor descriptor() const
Returns the descriptor set and field descriptor.
Definition: mip_field.hpp:48
bool isCommand() const
Determines if the field holds a command.
Definition: mip_field.hpp:97
microstrain::Span< const uint8_t > payloadSpan() const
Definition: mip_field.hpp:61
bool isValid() const
Returns true if the field has a valid field descriptor.
Definition: mip_field.hpp:64
uint8_t mip_field_field_descriptor(const mip_field_view *field)
Returns the field descriptor.
Definition: mip_field.c:58
bool isCommandSet() const
Determines if the field is from a command descriptor set (a command, reply, or response field).
Definition: mip_field.hpp:94
void mip_field_init(mip_field_view *field, uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t *payload, uint8_t payload_length)
Constructs a field view given the parameters.
Definition: mip_field.c:34
Convenience struct holding both descriptor set and field descriptor.
Definition: mip_descriptors.hpp:22
bool isResponse() const
Determines if the field holds command response data (not an ack/nack reply).
Definition: mip_field.hpp:103
FieldView()
Construct an empty MIP field.
Definition: mip_field.hpp:31
uint8_t descriptorSet() const
Returns the descriptor set of the packet containing this field._.
Definition: mip_field.hpp:44
FieldView nextAfter() const
Gets the next field after the specified field.
Definition: mip_field.hpp:67
const uint8_t * mip_field_payload(const mip_field_view *field)
Returns the payload pointer for the field data.
Definition: mip_field.c:76
static constexpr size_t MAX_PAYLOAD_LENGTH
Definition: mip_field.hpp:28
const uint8_t * payload() const
Returns the payload pointer for the field data.
Definition: mip_field.hpp:52