MIP_SDK
v3.0.0-736-g212583cf
MicroStrain Communications Library for embedded systems
|
Go to the documentation of this file.
41 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; }
123 template<
class FieldType>
124 bool extract(FieldType& field,
bool exact_size=
true)
const {
return microstrain::extract<microstrain::serialization::Endian::big>(field,
payload(), 0, exact_size); }
bool isCommandDescriptorSet(uint8_t descriptorSet)
Definition: mip_descriptors.hpp:80
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:128
@ MIP_FIELD_INDEX_DESC
Definition: mip_field.h:65
bool next()
Updates the mip_field to refer to the next field in a packet.
Definition: mip_field.hpp:106
microstrain::ConstU8ArrayView payload() const
Get a const view of the payload data.
Definition: mip_field.hpp:70
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:49
uint8_t mip_field_total_length(const mip_field_view *field)
Returns the total length of the field including the header.
Definition: mip_field.c:75
uint8_t totalLength() const
Returns the total length of the field including the header.
Definition: mip_field.hpp:64
static constexpr size_t PAYLOAD_LENGTH_MIN
Definition: mip_field.hpp:37
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:129
bool isCommandFieldDescriptor(uint8_t fieldDescriptor)
Definition: mip_descriptors.hpp:85
microstrain::ConstU8ArrayView bytes() const
Gets a view of the entire field, including the header.
Definition: mip_field.hpp:98
bool extract(FieldType &field, bool exact_size=true) const
Deserializes the field data to specific field struct.
Definition: mip_field.hpp:124
static constexpr size_t LENGTH_MAX
Definition: mip_field.hpp:36
@ MIP_FIELD_INDEX_LENGTH
Definition: mip_field.h:64
static constexpr size_t PAYLOAD_LENGTH_MAX
Definition: mip_field.hpp:38
bool isDataDescriptorSet(uint8_t descriptorSet)
Definition: mip_descriptors.hpp:79
mip_field_view mip_field_next_after(const mip_field_view *field)
Gets the next field after the specified field.
Definition: mip_field.c:192
A structure representing a MIP field.
Definition: mip_field.h:53
@ MIP_FIELD_INDEX_PAYLOAD
Definition: mip_field.h:66
bool isReply() const
Determines if the field holds an ack/nack reply code.
Definition: mip_field.hpp:137
FieldView(CompositeDescriptor descriptor, microstrain::ConstU8ArrayView payload)
Construct from descriptor and payload bytes.
Definition: mip_field.hpp:50
@ MIP_FIELD_PAYLOAD_LENGTH_MAX
Definition: mip_field.h:75
uint8_t payloadLength() const
Returns the length of the payload.
Definition: mip_field.hpp:67
bool isResponseFieldDescriptor(uint8_t fieldDescriptor)
Definition: mip_descriptors.hpp:87
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:45
C++ class representing a MIP field.
Definition: mip_field.hpp:24
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:211
uint8_t operator[](size_t index) const
Definition: mip_field.hpp:77
uint8_t fieldDescriptor() const
Returns the field descriptor.
Definition: mip_field.hpp:59
@ MIP_FIELD_LENGTH_MAX
Definition: mip_field.h:73
bool isReplyFieldDescriptor(uint8_t fieldDescriptor)
Definition: mip_descriptors.hpp:86
uint8_t mip_field_payload_length(const mip_field_view *field)
Returns the length of the payload.
Definition: mip_field.c:65
uint8_t payload(size_t index) const
Index the payload at the given location.
Definition: mip_field.hpp:75
FieldView(const C::mip_field_view &other)
Creates a Field class from the mip_field C struct.
Definition: mip_field.hpp:47
@ MIP_FIELD_HEADER_LENGTH
Definition: mip_field.h:71
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:43
bool mip_field_is_valid(const mip_field_view *field)
Returns true if the field has a valid field descriptor.
Definition: mip_field.c:91
CompositeDescriptor descriptor() const
Returns the descriptor set and field descriptor.
Definition: mip_field.hpp:61
bool isCommand() const
Determines if the field holds a command.
Definition: mip_field.hpp:134
bool isValid() const
Returns true if the field has a valid field descriptor.
Definition: mip_field.hpp:101
Represents a view over a contiguous array of objects, similar to std::span, and is implemented as a p...
Definition: array_view.hpp:44
@ MIP_FIELD_LENGTH_MIN
Definition: mip_field.h:72
uint8_t mip_field_field_descriptor(const mip_field_view *field)
Returns the field descriptor.
Definition: mip_field.c:57
bool isCommandSet() const
Determines if the field is from a command descriptor set (a command, reply, or response field).
Definition: mip_field.hpp:131
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:33
Convenience struct holding both descriptor set and field descriptor.
Definition: mip_descriptors.hpp:21
bool isResponse() const
Determines if the field holds command response data (not an ack/nack reply).
Definition: mip_field.hpp:140
static constexpr size_t LENGTH_MIN
Definition: mip_field.hpp:35
FieldView()
Construct an empty MIP field.
Definition: mip_field.hpp:41
Index
Definition: mip_field.hpp:27
uint8_t descriptorSet() const
Returns the descriptor set of the packet containing this field._.
Definition: mip_field.hpp:57
FieldView nextAfter() const
Gets the next field after the specified field.
Definition: mip_field.hpp:104
const uint8_t * mip_field_payload(const mip_field_view *field)
Returns the payload pointer for the field data.
Definition: mip_field.c:83
static constexpr size_t HEADER_LENGTH
Definition: mip_field.hpp:34
@ MIP_FIELD_PAYLOAD_LENGTH_MIN
Definition: mip_field.h:74