MIP_SDK  latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
data_system.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 #include <mip/mip_result.hpp>
6 #include <mip/mip_interface.hpp>
7 
8 #include <stdint.h>
9 #include <stddef.h>
10 
11 namespace mip {
12 namespace C {
13 struct mip_interface;
14 } // namespace C
15 
16 namespace data_system {
17 
24 
26 // Descriptors
28 
29 enum
30 {
32 
37 
38 };
39 
41 // Shared Type Definitions
43 
44 
46 // Mip Fields
48 
72 
74 {
76  uint8_t result[16] = {0};
77 
79  static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_system::DESCRIPTOR_SET;
80  static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_system::DATA_BUILT_IN_TEST;
82  static constexpr const char* NAME = "BuiltInTest";
83  static constexpr const char* DOC_NAME = "BuiltInTest";
84  static constexpr const bool HAS_FUNCTION_SELECTOR = false;
85 
86  auto asTuple() const
87  {
88  return std::make_tuple(result);
89  }
90 
91  auto asTuple()
92  {
93  return std::make_tuple(std::ref(result));
94  }
95 
97  void insert(Serializer& serializer) const;
98  void extract(Serializer& serializer);
99 
100 };
101 
109 
111 {
113  bool time_sync = 0;
114  uint8_t last_pps_rcvd = 0;
115 
117  static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_system::DESCRIPTOR_SET;
120  static constexpr const char* NAME = "TimeSyncStatus";
121  static constexpr const char* DOC_NAME = "TimeSyncStatus";
122  static constexpr const bool HAS_FUNCTION_SELECTOR = false;
123 
124  auto asTuple() const
125  {
126  return std::make_tuple(time_sync,last_pps_rcvd);
127  }
128 
129  auto asTuple()
130  {
131  return std::make_tuple(std::ref(time_sync),std::ref(last_pps_rcvd));
132  }
133 
135  void insert(Serializer& serializer) const;
136  void extract(Serializer& serializer);
137 
138 };
139 
165 
166 struct GpioState
167 {
169  uint8_t states = 0;
170 
172  static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_system::DESCRIPTOR_SET;
173  static constexpr const uint8_t FIELD_DESCRIPTOR = ::mip::data_system::DATA_GPIO_STATE;
175  static constexpr const char* NAME = "GpioState";
176  static constexpr const char* DOC_NAME = "GpioState";
177  static constexpr const bool HAS_FUNCTION_SELECTOR = false;
178 
179  auto asTuple() const
180  {
181  return std::make_tuple(states);
182  }
183 
184  auto asTuple()
185  {
186  return std::make_tuple(std::ref(states));
187  }
188 
190  void insert(Serializer& serializer) const;
191  void extract(Serializer& serializer);
192 
193 };
194 
203 
205 {
207  uint8_t gpio_id = 0;
208  float value = 0;
209 
211  static constexpr const uint8_t DESCRIPTOR_SET = ::mip::data_system::DESCRIPTOR_SET;
214  static constexpr const char* NAME = "GpioAnalogValue";
215  static constexpr const char* DOC_NAME = "GpioAnalogValue";
216  static constexpr const bool HAS_FUNCTION_SELECTOR = false;
217 
218  auto asTuple() const
219  {
220  return std::make_tuple(gpio_id,value);
221  }
222 
223  auto asTuple()
224  {
225  return std::make_tuple(std::ref(gpio_id),std::ref(value));
226  }
227 
229  void insert(Serializer& serializer) const;
230  void extract(Serializer& serializer);
231 
232 };
233 
236 
241 } // namespace data_system
242 } // namespace mip
243 
mip::data_system::BuiltInTest::FIELD_DESCRIPTOR
static constexpr const uint8_t FIELD_DESCRIPTOR
Definition: data_system.hpp:80
mip
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
mip::data_system::GpioAnalogValue::gpio_id
uint8_t gpio_id
Parameters.
Definition: data_system.hpp:207
mip::data_system::TimeSyncStatus::asTuple
auto asTuple()
Definition: data_system.hpp:129
mip_descriptors.hpp
mip::data_system::GpioAnalogValue::extract
void extract(Serializer &serializer)
Definition: data_system.cpp:69
mip::data_system::BuiltInTest::insert
void insert(Serializer &serializer) const
Serialization.
Definition: data_system.cpp:23
microstrain::Serializer
Serializes or deserializes data to/from a byte buffer.
Definition: serializer.hpp:125
mip::data_system::GpioAnalogValue::NAME
static constexpr const char * NAME
Definition: data_system.hpp:214
mip::data_system::BuiltInTest::asTuple
auto asTuple() const
Definition: data_system.hpp:86
mip::data_system::BuiltInTest::asTuple
auto asTuple()
Definition: data_system.hpp:91
mip::data_system::GpioState::extract
void extract(Serializer &serializer)
Definition: data_system.cpp:56
mip::data_system::DATA_BUILT_IN_TEST
@ DATA_BUILT_IN_TEST
Definition: data_system.hpp:33
mip::data_system::TimeSyncStatus::FIELD_DESCRIPTOR
static constexpr const uint8_t FIELD_DESCRIPTOR
Definition: data_system.hpp:118
mip::data_system::GpioState::NAME
static constexpr const char * NAME
Definition: data_system.hpp:175
mip::data_system::GpioState::DESCRIPTOR_SET
static constexpr const uint8_t DESCRIPTOR_SET
Descriptors.
Definition: data_system.hpp:172
mip::data_system::BuiltInTest::NAME
static constexpr const char * NAME
Definition: data_system.hpp:82
mip::C::mip_interface
struct mip::C::mip_interface mip_interface
State of the interface for communicating with a MIP device.
mip::data_system::GpioState::DOC_NAME
static constexpr const char * DOC_NAME
Definition: data_system.hpp:176
mip::data_system::TimeSyncStatus::DOC_NAME
static constexpr const char * DOC_NAME
Definition: data_system.hpp:121
mip::data_system::GpioState::asTuple
auto asTuple() const
Definition: data_system.hpp:179
mip::data_system::BuiltInTest::extract
void extract(Serializer &serializer)
Definition: data_system.cpp:29
mip::data_system::BuiltInTest::DESCRIPTOR_SET
static constexpr const uint8_t DESCRIPTOR_SET
Descriptors.
Definition: data_system.hpp:79
mip::data_system::TimeSyncStatus::asTuple
auto asTuple() const
Definition: data_system.hpp:124
mip::data_system::GpioState::FIELD_DESCRIPTOR
static constexpr const uint8_t FIELD_DESCRIPTOR
Definition: data_system.hpp:173
mip::data_system::GpioAnalogValue::HAS_FUNCTION_SELECTOR
static constexpr const bool HAS_FUNCTION_SELECTOR
Definition: data_system.hpp:216
mip::data_system::TimeSyncStatus::time_sync
bool time_sync
Parameters.
Definition: data_system.hpp:113
mip::data_system::GpioAnalogValue::FIELD_DESCRIPTOR
static constexpr const uint8_t FIELD_DESCRIPTOR
Definition: data_system.hpp:212
mip::data_system::GpioState::states
uint8_t states
Parameters.
Definition: data_system.hpp:169
mip::data_system::BuiltInTest::DOC_NAME
static constexpr const char * DOC_NAME
Definition: data_system.hpp:83
mip::data_system::GpioState::DESCRIPTOR
static constexpr const CompositeDescriptor DESCRIPTOR
Definition: data_system.hpp:174
mip::data_system::BuiltInTest::result
uint8_t result[16]
Parameters.
Definition: data_system.hpp:76
mip::data_system::TimeSyncStatus::extract
void extract(Serializer &serializer)
Definition: data_system.cpp:43
mip::data_system::TimeSyncStatus::NAME
static constexpr const char * NAME
Definition: data_system.hpp:120
mip::data_system::TimeSyncStatus::DESCRIPTOR
static constexpr const CompositeDescriptor DESCRIPTOR
Definition: data_system.hpp:119
mip::data_system::GpioAnalogValue::DESCRIPTOR
static constexpr const CompositeDescriptor DESCRIPTOR
Definition: data_system.hpp:213
mip::data_system::TimeSyncStatus::insert
void insert(Serializer &serializer) const
Serialization.
Definition: data_system.cpp:36
mip::data_system::GpioAnalogValue::insert
void insert(Serializer &serializer) const
Serialization.
Definition: data_system.cpp:62
mip::data_system::TimeSyncStatus::DESCRIPTOR_SET
static constexpr const uint8_t DESCRIPTOR_SET
Descriptors.
Definition: data_system.hpp:117
mip::data_system::DATA_TIME_SYNC_STATUS
@ DATA_TIME_SYNC_STATUS
Definition: data_system.hpp:34
mip::data_system::GpioAnalogValue::asTuple
auto asTuple()
Definition: data_system.hpp:223
mip::data_system::DATA_GPIO_ANALOG_VALUE
@ DATA_GPIO_ANALOG_VALUE
Definition: data_system.hpp:36
mip::data_system::DESCRIPTOR_SET
@ DESCRIPTOR_SET
Definition: data_system.hpp:31
mip::data_system::BuiltInTest::HAS_FUNCTION_SELECTOR
static constexpr const bool HAS_FUNCTION_SELECTOR
Definition: data_system.hpp:84
mip_interface.hpp
mip::data_system::GpioAnalogValue::DOC_NAME
static constexpr const char * DOC_NAME
Definition: data_system.hpp:215
mip::data_system::TimeSyncStatus::HAS_FUNCTION_SELECTOR
static constexpr const bool HAS_FUNCTION_SELECTOR
Definition: data_system.hpp:122
mip::data_system::TimeSyncStatus
Definition: data_system.hpp:110
mip::data_system::GpioAnalogValue::asTuple
auto asTuple() const
Definition: data_system.hpp:218
mip::data_system::GpioAnalogValue::DESCRIPTOR_SET
static constexpr const uint8_t DESCRIPTOR_SET
Descriptors.
Definition: data_system.hpp:211
mip::data_system::BuiltInTest
Definition: data_system.hpp:73
mip::data_system::GpioState::asTuple
auto asTuple()
Definition: data_system.hpp:184
mip::CompositeDescriptor
Convenience struct holding both descriptor set and field descriptor.
Definition: mip_descriptors.hpp:21
mip::data_system::GpioAnalogValue
Definition: data_system.hpp:204
mip::data_system::GpioState::insert
void insert(Serializer &serializer) const
Serialization.
Definition: data_system.cpp:51
mip::data_system::GpioState
Definition: data_system.hpp:166
mip::data_system::GpioAnalogValue::value
float value
Value of the GPIO line in scaled volts.
Definition: data_system.hpp:208
mip::data_system::BuiltInTest::DESCRIPTOR
static constexpr const CompositeDescriptor DESCRIPTOR
Definition: data_system.hpp:81
mip::data_system::TimeSyncStatus::last_pps_rcvd
uint8_t last_pps_rcvd
Elapsed time in seconds since last PPS was received, with a maximum value of 255.
Definition: data_system.hpp:114
common.hpp
mip::data_system::DATA_GPIO_STATE
@ DATA_GPIO_STATE
Definition: data_system.hpp:35
mip::data_system::GpioState::HAS_FUNCTION_SELECTOR
static constexpr const bool HAS_FUNCTION_SELECTOR
Definition: data_system.hpp:177
mip_result.hpp