MIP_SDK  latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
mip_field.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdint.h>
4 #include <stdbool.h>
5 #include "mip_packet.h"
6 
7 #ifdef __cplusplus
8 namespace mip {
9 namespace C {
10 extern "C" {
11 #endif
12 
13 
17 
37 
52 typedef struct mip_field_view
53 {
54  const uint8_t* _payload;
55  uint8_t _payload_length;
56  uint8_t _field_descriptor;
57  uint8_t _descriptor_set;
58  uint8_t _remaining_length;
60 
61 
62 void mip_field_init(mip_field_view* field, uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t* payload, uint8_t payload_length);
63 
70 
71 uint8_t mip_field_descriptor_set(const mip_field_view* field);
72 uint8_t mip_field_field_descriptor(const mip_field_view* field);
73 uint8_t mip_field_payload_length(const mip_field_view* field);
74 const uint8_t* mip_field_payload(const mip_field_view* field);
75 
76 bool mip_field_is_valid(const mip_field_view* field);
77 
102 
104 
105 mip_field_view mip_field_from_header_ptr(const uint8_t* header, uint8_t total_length, uint8_t descriptor_set);
106 
109 bool mip_field_next(mip_field_view* field);
110 
111 bool mip_field_next_in_packet(mip_field_view* field, const mip_packet_view* packet);
112 
113 // bool mip_field_is_at_end(const struct mip_field* field);
114 
120 
121 #ifdef __cplusplus
122 } // extern "C"
123 } // namespace C
124 } // namespace mip
125 #endif
mip_packet.h
mip
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
mip::C::mip_field_next_in_packet
bool mip_field_next_in_packet(mip_field_view *field, const mip_packet_view *packet)
Iterates over all fields in a packet.
Definition: mip_field.c:233
mip::C::mip_field_descriptor_set
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::C::mip_field_view
struct mip::C::mip_field_view mip_field_view
A structure representing a MIP field.
mip::C::mip_field_from_header_ptr
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
mip::C::mip_packet_view
Structure representing a MIP Packet.
Definition: mip_packet.h:50
mip::C::mip_field_next_after
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
mip::C::mip_field_view
A structure representing a MIP field.
Definition: mip_field.h:52
mip::C::mip_field_init_empty
void mip_field_init_empty(mip_field_view *field)
Initialize a mip_field struct to an invalid/empty state.
Definition: mip_field.c:99
mip::C::mip_field_next
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
mip::C::mip_field_payload_length
uint8_t mip_field_payload_length(const mip_field_view *field)
Returns the length of the payload.
Definition: mip_field.c:66
mip::C::mip_field_first_from_packet
mip_field_view mip_field_first_from_packet(const mip_packet_view *packet)
Extracts the first field from a MIP packet.
Definition: mip_field.c:170
mip::C::mip_field_is_valid
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
mip::C::mip_field_field_descriptor
uint8_t mip_field_field_descriptor(const mip_field_view *field)
Returns the field descriptor.
Definition: mip_field.c:58
mip::C::mip_field_init
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
mip::C::mip_field_payload
const uint8_t * mip_field_payload(const mip_field_view *field)
Returns the payload pointer for the field data.
Definition: mip_field.c:76