MIP_SDK  v3.0.0-208-gdb90bae
MicroStrain Communications Library for embedded systems
data_shared.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
7 
8 namespace mip::metadata
9 {
10 
11 
12 template<>
13 struct MetadataFor<data_shared::EventSource>
14 {
16 
17  static constexpr inline ParameterInfo parameters[] = {
18  {
19  /* .name = */ "trigger_id",
20  /* .docs = */ "Trigger ID number. If 0, this message was emitted due to being\nscheduled in the 3DM Message Format Command (0x0C,0x0F).",
21  /* .type = */ {Type::U8, nullptr},
22  /* .accessor = */ nullptr, //utils::access<type, uint8_t, &type::trigger_id>,
23  /* .attributes = */ {true, false, false, false, false},
24  /* .count = */ 1,
25  /* .condition = */ {},
26  },
27  };
28 
29  static constexpr inline FieldInfo value = {
30  {
31  /* .name = */ "data_shared::EventSource",
32  /* .title = */ "event_source",
33  /* .docs = */ "Identifies which event trigger caused this packet to be emitted.\n\nGenerally this is used to determine whether a packet was emitted\ndue to scheduled streaming or due to an event.",
34  /* .parameters = */ parameters,
35  },
36  /* .descriptor = */ type::DESCRIPTOR,
37  /* .functions = */ NO_FUNCTIONS,
38  /* .response = */ nullptr,
39  };
40 };
41 
42 template<>
43 struct MetadataFor<data_shared::Ticks>
44 {
46 
47  static constexpr inline ParameterInfo parameters[] = {
48  {
49  /* .name = */ "ticks",
50  /* .docs = */ "Ticks since powerup.",
51  /* .type = */ {Type::U32, nullptr},
52  /* .accessor = */ nullptr, //utils::access<type, uint32_t, &type::ticks>,
53  /* .attributes = */ {true, false, false, false, false},
54  /* .count = */ 1,
55  /* .condition = */ {},
56  },
57  };
58 
59  static constexpr inline FieldInfo value = {
60  {
61  /* .name = */ "data_shared::Ticks",
62  /* .title = */ "ticks",
63  /* .docs = */ "Time since powerup in multiples of the base rate.\n\nThe counter will wrap around to 0 after approximately 50 days.\nOne tick is equivalent to one base period (reciprocal of the base rate).",
64  /* .parameters = */ parameters,
65  },
66  /* .descriptor = */ type::DESCRIPTOR,
67  /* .functions = */ NO_FUNCTIONS,
68  /* .response = */ nullptr,
69  };
70 };
71 
72 template<>
73 struct MetadataFor<data_shared::DeltaTicks>
74 {
76 
77  static constexpr inline ParameterInfo parameters[] = {
78  {
79  /* .name = */ "ticks",
80  /* .docs = */ "Ticks since last output.",
81  /* .type = */ {Type::U32, nullptr},
82  /* .accessor = */ nullptr, //utils::access<type, uint32_t, &type::ticks>,
83  /* .attributes = */ {true, false, false, false, false},
84  /* .count = */ 1,
85  /* .condition = */ {},
86  },
87  };
88 
89  static constexpr inline FieldInfo value = {
90  {
91  /* .name = */ "data_shared::DeltaTicks",
92  /* .title = */ "delta_ticks",
93  /* .docs = */ "Ticks since the last output of this field.\n\nThis field can be used to track the amount of time passed between\nevent occurrences.\nOne tick is equivalent to one base period (reciprocal of the base rate).",
94  /* .parameters = */ parameters,
95  },
96  /* .descriptor = */ type::DESCRIPTOR,
97  /* .functions = */ NO_FUNCTIONS,
98  /* .response = */ nullptr,
99  };
100 };
101 
102 template<>
103 struct MetadataFor<data_shared::GpsTimestamp::ValidFlags>
104 {
106 
107  static constexpr inline BitfieldInfo::Entry entries[] = {
108  { uint32_t(1), "tow", "Whole number seconds TOW has been set" },
109  { uint32_t(2), "week_number", "Week number has been set" },
110  { uint32_t(3), "time_valid", "Both TOW and Week Number have been set" },
111  };
112 
113  static constexpr inline BitfieldInfo value = {
114  /* .name = */ "ValidFlags",
115  /* .docs = */ "",
116  /* .type = */ Type::U16,
117  /* .entries = */ entries,
118  };
119 
120 };
121 
122 template<>
123 struct MetadataFor<data_shared::GpsTimestamp>
124 {
126 
127  static constexpr inline ParameterInfo parameters[] = {
128  {
129  /* .name = */ "tow",
130  /* .docs = */ "GPS Time of Week [seconds]",
131  /* .type = */ {Type::DOUBLE, nullptr},
132  /* .accessor = */ nullptr, //utils::access<type, double, &type::tow>,
133  /* .attributes = */ {true, false, false, false, false},
134  /* .count = */ 1,
135  /* .condition = */ {},
136  },
137  {
138  /* .name = */ "week_number",
139  /* .docs = */ "GPS Week Number since 1980 [weeks]",
140  /* .type = */ {Type::U16, nullptr},
141  /* .accessor = */ nullptr, //utils::access<type, uint16_t, &type::week_number>,
142  /* .attributes = */ {true, false, false, false, false},
143  /* .count = */ 1,
144  /* .condition = */ {},
145  },
146  {
147  /* .name = */ "valid_flags",
148  /* .docs = */ "",
150  /* .accessor = */ nullptr, //utils::access<type, data_shared::GpsTimestamp::ValidFlags, &type::valid_flags>,
151  /* .attributes = */ {true, false, false, false, false},
152  /* .count = */ 1,
153  /* .condition = */ {},
154  },
155  };
156 
157  static constexpr inline FieldInfo value = {
158  {
159  /* .name = */ "data_shared::GpsTimestamp",
160  /* .title = */ "gps_timestamp",
161  /* .docs = */ "Outputs the current GPS system time in time-of-week and week number format.\n\nFor events, this is the time of the event trigger.\nIn order to be valid, a PPS signal needs to be present, and both a valid GPS time-of-week and week number command (0x0C, 0x72) need to be received after PPS sync has been achieved.",
162  /* .parameters = */ parameters,
163  },
164  /* .descriptor = */ type::DESCRIPTOR,
165  /* .functions = */ NO_FUNCTIONS,
166  /* .response = */ nullptr,
167  };
168 };
169 
170 template<>
171 struct MetadataFor<data_shared::DeltaTime>
172 {
174 
175  static constexpr inline ParameterInfo parameters[] = {
176  {
177  /* .name = */ "seconds",
178  /* .docs = */ "Seconds since last output.",
179  /* .type = */ {Type::DOUBLE, nullptr},
180  /* .accessor = */ nullptr, //utils::access<type, double, &type::seconds>,
181  /* .attributes = */ {true, false, false, false, false},
182  /* .count = */ 1,
183  /* .condition = */ {},
184  },
185  };
186 
187  static constexpr inline FieldInfo value = {
188  {
189  /* .name = */ "data_shared::DeltaTime",
190  /* .title = */ "delta_time",
191  /* .docs = */ "Time in the synchronized clock domain since the last output of this field within the same descriptor set and event instance.\n\nThis can be used to track the amount of time passed between\nevent occurrences. See the manual page on delta time quantities.\n\nThis field contains the same value as the delta external time field, 0xD8,\nbut is expressed in seconds. Transmission of either of these fields\nrestarts a shared counter, so only one should be streamed at a time to\navoid confusion. The counter is not shared across descriptors sets or\nbetween event instances.",
192  /* .parameters = */ parameters,
193  },
194  /* .descriptor = */ type::DESCRIPTOR,
195  /* .functions = */ NO_FUNCTIONS,
196  /* .response = */ nullptr,
197  };
198 };
199 
200 template<>
201 struct MetadataFor<data_shared::ReferenceTimestamp>
202 {
204 
205  static constexpr inline ParameterInfo parameters[] = {
206  {
207  /* .name = */ "nanoseconds",
208  /* .docs = */ "Nanoseconds since initialization.",
209  /* .type = */ {Type::U64, nullptr},
210  /* .accessor = */ nullptr, //utils::access<type, uint64_t, &type::nanoseconds>,
211  /* .attributes = */ {true, false, false, false, false},
212  /* .count = */ 1,
213  /* .condition = */ {},
214  },
215  };
216 
217  static constexpr inline FieldInfo value = {
218  {
219  /* .name = */ "data_shared::ReferenceTimestamp",
220  /* .title = */ "reference_timestamp",
221  /* .docs = */ "Internal reference timestamp.\n\nThis timestamp represents the time at which the corresponding\ndata was sampled, according to the internal reference clock.\n\nThis is a monotonic clock which never jumps. The value is always valid.\n\nFor events, this is the time of the event trigger.",
222  /* .parameters = */ parameters,
223  },
224  /* .descriptor = */ type::DESCRIPTOR,
225  /* .functions = */ NO_FUNCTIONS,
226  /* .response = */ nullptr,
227  };
228 };
229 
230 template<>
231 struct MetadataFor<data_shared::ReferenceTimeDelta>
232 {
234 
235  static constexpr inline ParameterInfo parameters[] = {
236  {
237  /* .name = */ "dt_nanos",
238  /* .docs = */ "Nanoseconds since the last occurrence of this field in a packet of the same descriptor set and event source.",
239  /* .type = */ {Type::U64, nullptr},
240  /* .accessor = */ nullptr, //utils::access<type, uint64_t, &type::dt_nanos>,
241  /* .attributes = */ {true, false, false, false, false},
242  /* .count = */ 1,
243  /* .condition = */ {},
244  },
245  };
246 
247  static constexpr inline FieldInfo value = {
248  {
249  /* .name = */ "data_shared::ReferenceTimeDelta",
250  /* .title = */ "reference_time_delta",
251  /* .docs = */ "Delta time since the last packet.\n\nDifference between the time as reported by the shared reference time field, 0xD5,\nand the previous output of this delta quantity within the same descriptor set and event instance.\n\nThe delta is based on the reference time which never jumps. The value\nis always valid.\n\nThis can be used to track the amount of time passed between\nevent occurrences. See the manual page on delta time quantities.",
252  /* .parameters = */ parameters,
253  },
254  /* .descriptor = */ type::DESCRIPTOR,
255  /* .functions = */ NO_FUNCTIONS,
256  /* .response = */ nullptr,
257  };
258 };
259 
260 template<>
261 struct MetadataFor<data_shared::ExternalTimestamp::ValidFlags>
262 {
264 
265  static constexpr inline BitfieldInfo::Entry entries[] = {
266  { uint32_t(1), "nanoseconds", "" },
267  };
268 
269  static constexpr inline BitfieldInfo value = {
270  /* .name = */ "ValidFlags",
271  /* .docs = */ "",
272  /* .type = */ Type::U16,
273  /* .entries = */ entries,
274  };
275 
276 };
277 
278 template<>
279 struct MetadataFor<data_shared::ExternalTimestamp>
280 {
282 
283  static constexpr inline ParameterInfo parameters[] = {
284  {
285  /* .name = */ "nanoseconds",
286  /* .docs = */ "",
287  /* .type = */ {Type::U64, nullptr},
288  /* .accessor = */ nullptr, //utils::access<type, uint64_t, &type::nanoseconds>,
289  /* .attributes = */ {true, false, false, false, false},
290  /* .count = */ 1,
291  /* .condition = */ {},
292  },
293  {
294  /* .name = */ "valid_flags",
295  /* .docs = */ "",
297  /* .accessor = */ nullptr, //utils::access<type, data_shared::ExternalTimestamp::ValidFlags, &type::valid_flags>,
298  /* .attributes = */ {true, false, false, false, false},
299  /* .count = */ 1,
300  /* .condition = */ {},
301  },
302  };
303 
304  static constexpr inline FieldInfo value = {
305  {
306  /* .name = */ "data_shared::ExternalTimestamp",
307  /* .title = */ "external_timestamp",
308  /* .docs = */ "External timestamp in nanoseconds.\n\nThis timestamp represents the time at which the corresponding\ndata was sampled in the external clock domain.\nEquivalent to the GPS Timestamp but in nanoseconds.\n\nFor events, this is the time of the event trigger.\n\nTo be valid, external clock sync must be achieved using the PPS input.",
309  /* .parameters = */ parameters,
310  },
311  /* .descriptor = */ type::DESCRIPTOR,
312  /* .functions = */ NO_FUNCTIONS,
313  /* .response = */ nullptr,
314  };
315 };
316 
317 template<>
318 struct MetadataFor<data_shared::ExternalTimeDelta::ValidFlags>
319 {
321 
322  static constexpr inline BitfieldInfo::Entry entries[] = {
323  { uint32_t(1), "dt_nanos", "" },
324  };
325 
326  static constexpr inline BitfieldInfo value = {
327  /* .name = */ "ValidFlags",
328  /* .docs = */ "",
329  /* .type = */ Type::U16,
330  /* .entries = */ entries,
331  };
332 
333 };
334 
335 template<>
336 struct MetadataFor<data_shared::ExternalTimeDelta>
337 {
339 
340  static constexpr inline ParameterInfo parameters[] = {
341  {
342  /* .name = */ "dt_nanos",
343  /* .docs = */ "Nanoseconds since the last occurrence of this field in a packet of the same descriptor set and event source.",
344  /* .type = */ {Type::U64, nullptr},
345  /* .accessor = */ nullptr, //utils::access<type, uint64_t, &type::dt_nanos>,
346  /* .attributes = */ {true, false, false, false, false},
347  /* .count = */ 1,
348  /* .condition = */ {},
349  },
350  {
351  /* .name = */ "valid_flags",
352  /* .docs = */ "",
354  /* .accessor = */ nullptr, //utils::access<type, data_shared::ExternalTimeDelta::ValidFlags, &type::valid_flags>,
355  /* .attributes = */ {true, false, false, false, false},
356  /* .count = */ 1,
357  /* .condition = */ {},
358  },
359  };
360 
361  static constexpr inline FieldInfo value = {
362  {
363  /* .name = */ "data_shared::ExternalTimeDelta",
364  /* .title = */ "external_time_delta",
365  /* .docs = */ "Delta time since the last packet containing delta external (0xFF,0xD4) or delta gps time (0xFF,0xD8).\n\nDifference between the time as reported by the shared external time field, 0xD7,\nand the previous output of this delta quantity within the same descriptor set and event instance.\n\nThis can be used to track the amount of time passed between\nevent occurrences. See the manual page on delta time quantities.\n\nThis field contains the same value as the delta gps time field, 0xD4,\nbut is expressed in nanoseconds. Transmission of either of these fields\nrestarts a shared counter, so only one should be streamed at a time to\navoid confusion. The counter is not shared across descriptors sets or\nbetween event instances.",
366  /* .parameters = */ parameters,
367  },
368  /* .descriptor = */ type::DESCRIPTOR,
369  /* .functions = */ NO_FUNCTIONS,
370  /* .response = */ nullptr,
371  };
372 };
373 
374 
375 static constexpr inline const FieldInfo* DATA_SHARED_FIELDS[] = {
385 };
386 
387 static constexpr DescriptorSetInfo DATA_SHARED = {
388  /* .descriptor = */ mip::data_shared::DESCRIPTOR_SET,
389  /* .name = */ "Shared Data",
390  /* .fields = */ DATA_SHARED_FIELDS,
391 };
392 
393 } // namespace mip::metadata
394 
mip::data_shared::ExternalTimestamp::ValidFlags
Definition: data_shared.hpp:401
mip::data_shared::ReferenceTimestamp
Definition: data_shared.hpp:308
common.hpp
mip::metadata::MetadataFor< data_shared::EventSource >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:29
mip::metadata::BitfieldInfo
Definition: mip_structures.hpp:89
mip::metadata
Definition: common.hpp:8
mip::metadata::MetadataFor< data_shared::ReferenceTimeDelta >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:247
mip::metadata::MetadataFor< data_shared::ReferenceTimestamp >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:217
mip::data_shared::DeltaTicks
Definition: data_shared.hpp:146
mip::data_shared::DeltaTime
Definition: data_shared.hpp:264
mip::data_shared::ExternalTimestamp
Definition: data_shared.hpp:399
mip::metadata::Type::U16
@ U16
mip::metadata::MetadataFor
Definition: mip_metadata.hpp:13
mip::data_shared::DESCRIPTOR_SET
@ DESCRIPTOR_SET
Definition: data_shared.hpp:31
mip::metadata::MetadataFor< data_shared::GpsTimestamp >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:157
mip::data_shared::GpsTimestamp
Definition: data_shared.hpp:186
data_shared.hpp
mip::data_shared::Ticks
Definition: data_shared.hpp:105
mip::data_shared::ExternalTimeDelta::ValidFlags
Definition: data_shared.hpp:475
mip::metadata::Type::DOUBLE
@ DOUBLE
mip::data_shared::GpsTimestamp::ValidFlags
Definition: data_shared.hpp:188
mip::metadata::ParameterInfo
Definition: mip_structures.hpp:158
mip::metadata::MetadataFor< data_shared::ExternalTimeDelta >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:361
mip::metadata::EnumInfo::Entry
Definition: mip_structures.hpp:65
mip::data_shared::ReferenceTimeDelta
Definition: data_shared.hpp:354
mip_metadata.hpp
mip::metadata::MetadataFor< data_shared::Ticks >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:59
mip::metadata::Type::U64
@ U64
mip::metadata::FieldInfo
Definition: mip_structures.hpp:212
mip::metadata::Type::U8
@ U8
mip::metadata::MetadataFor< data_shared::DeltaTime >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:187
mip::data_shared::ExternalTimeDelta
Definition: data_shared.hpp:473
mip::metadata::MetadataFor< data_shared::ExternalTimestamp >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:304
mip::metadata::MetadataFor< data_shared::DeltaTicks >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:89
mip::metadata::Type::BITS
@ BITS
mip::metadata::Type::U32
@ U32
mip::data_shared::EventSource
Definition: data_shared.hpp:65