MIP_SDK  v3.0.0
MicroStrain Communications Library for embedded systems
data_shared.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
6 
8 
9 namespace mip::metadata
10 {
11 
12 
13 template<>
14 struct MetadataFor<data_shared::EventSource>
15 {
17 
18  static constexpr inline ParameterInfo parameters[] = {
19  {
20  /* .name = */ "trigger_id",
21  /* .docs = */ "Trigger ID number. If 0, this message was emitted due to being\nscheduled in the 3DM Message Format Command (0x0C,0x0F).",
22  /* .type = */ {Type::U8, nullptr},
23  /* .accessor = */ nullptr, //utils::access<type, uint8_t, &type::trigger_id>,
24  /* .attributes = */ {true, false, false, false, false},
25  /* .count = */ 1,
26  /* .condition = */ {},
27  },
28  };
29 
30  static constexpr inline FieldInfo value = {
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  /* .descriptor = */ type::DESCRIPTOR,
36  /* .functions = */ NO_FUNCTIONS,
37  /* .proprietary = */ false,
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  /* .name = */ "data_shared::Ticks",
61  /* .title = */ "ticks",
62  /* .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).",
63  /* .parameters = */ parameters,
64  /* .descriptor = */ type::DESCRIPTOR,
65  /* .functions = */ NO_FUNCTIONS,
66  /* .proprietary = */ false,
67  /* .response = */ nullptr,
68  };
69 };
70 
71 template<>
72 struct MetadataFor<data_shared::DeltaTicks>
73 {
75 
76  static constexpr inline ParameterInfo parameters[] = {
77  {
78  /* .name = */ "ticks",
79  /* .docs = */ "Ticks since last output.",
80  /* .type = */ {Type::U32, nullptr},
81  /* .accessor = */ nullptr, //utils::access<type, uint32_t, &type::ticks>,
82  /* .attributes = */ {true, false, false, false, false},
83  /* .count = */ 1,
84  /* .condition = */ {},
85  },
86  };
87 
88  static constexpr inline FieldInfo value = {
89  /* .name = */ "data_shared::DeltaTicks",
90  /* .title = */ "delta_ticks",
91  /* .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).",
92  /* .parameters = */ parameters,
93  /* .descriptor = */ type::DESCRIPTOR,
94  /* .functions = */ NO_FUNCTIONS,
95  /* .proprietary = */ false,
96  /* .response = */ nullptr,
97  };
98 };
99 
100 template<>
101 struct MetadataFor<data_shared::GpsTimestamp::ValidFlags>
102 {
104 
105  static constexpr inline BitfieldInfo::Entry entries[] = {
106  { uint32_t(1), "tow", "Whole number seconds TOW has been set" },
107  { uint32_t(2), "week_number", "Week number has been set" },
108  { uint32_t(3), "time_valid", "Both TOW and Week Number have been set" },
109  };
110 
111  static constexpr inline BitfieldInfo value = {
112  /* .name = */ "ValidFlags",
113  /* .docs = */ "",
114  /* .type = */ Type::U16,
115  /* .entries = */ entries,
116  };
117 
118 };
119 
120 template<>
121 struct MetadataFor<data_shared::GpsTimestamp>
122 {
124 
125  static constexpr inline ParameterInfo parameters[] = {
126  {
127  /* .name = */ "tow",
128  /* .docs = */ "GPS Time of Week [seconds]",
129  /* .type = */ {Type::DOUBLE, nullptr},
130  /* .accessor = */ nullptr, //utils::access<type, double, &type::tow>,
131  /* .attributes = */ {true, false, false, false, false},
132  /* .count = */ 1,
133  /* .condition = */ {},
134  },
135  {
136  /* .name = */ "week_number",
137  /* .docs = */ "GPS Week Number since 1980 [weeks]",
138  /* .type = */ {Type::U16, nullptr},
139  /* .accessor = */ nullptr, //utils::access<type, uint16_t, &type::week_number>,
140  /* .attributes = */ {true, false, false, false, false},
141  /* .count = */ 1,
142  /* .condition = */ {},
143  },
144  {
145  /* .name = */ "valid_flags",
146  /* .docs = */ "",
148  /* .accessor = */ nullptr, //utils::access<type, data_shared::GpsTimestamp::ValidFlags, &type::valid_flags>,
149  /* .attributes = */ {true, false, false, false, false},
150  /* .count = */ 1,
151  /* .condition = */ {},
152  },
153  };
154 
155  static constexpr inline FieldInfo value = {
156  /* .name = */ "data_shared::GpsTimestamp",
157  /* .title = */ "gps_timestamp",
158  /* .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.",
159  /* .parameters = */ parameters,
160  /* .descriptor = */ type::DESCRIPTOR,
161  /* .functions = */ NO_FUNCTIONS,
162  /* .proprietary = */ false,
163  /* .response = */ nullptr,
164  };
165 };
166 
167 template<>
168 struct MetadataFor<data_shared::DeltaTime>
169 {
171 
172  static constexpr inline ParameterInfo parameters[] = {
173  {
174  /* .name = */ "seconds",
175  /* .docs = */ "Seconds since last output.",
176  /* .type = */ {Type::DOUBLE, nullptr},
177  /* .accessor = */ nullptr, //utils::access<type, double, &type::seconds>,
178  /* .attributes = */ {true, false, false, false, false},
179  /* .count = */ 1,
180  /* .condition = */ {},
181  },
182  };
183 
184  static constexpr inline FieldInfo value = {
185  /* .name = */ "data_shared::DeltaTime",
186  /* .title = */ "delta_time",
187  /* .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.",
188  /* .parameters = */ parameters,
189  /* .descriptor = */ type::DESCRIPTOR,
190  /* .functions = */ NO_FUNCTIONS,
191  /* .proprietary = */ false,
192  /* .response = */ nullptr,
193  };
194 };
195 
196 template<>
197 struct MetadataFor<data_shared::ReferenceTimestamp>
198 {
200 
201  static constexpr inline ParameterInfo parameters[] = {
202  {
203  /* .name = */ "nanoseconds",
204  /* .docs = */ "Nanoseconds since initialization.",
205  /* .type = */ {Type::U64, nullptr},
206  /* .accessor = */ nullptr, //utils::access<type, uint64_t, &type::nanoseconds>,
207  /* .attributes = */ {true, false, false, false, false},
208  /* .count = */ 1,
209  /* .condition = */ {},
210  },
211  };
212 
213  static constexpr inline FieldInfo value = {
214  /* .name = */ "data_shared::ReferenceTimestamp",
215  /* .title = */ "reference_timestamp",
216  /* .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.",
217  /* .parameters = */ parameters,
218  /* .descriptor = */ type::DESCRIPTOR,
219  /* .functions = */ NO_FUNCTIONS,
220  /* .proprietary = */ false,
221  /* .response = */ nullptr,
222  };
223 };
224 
225 template<>
226 struct MetadataFor<data_shared::ReferenceTimeDelta>
227 {
229 
230  static constexpr inline ParameterInfo parameters[] = {
231  {
232  /* .name = */ "dt_nanos",
233  /* .docs = */ "Nanoseconds since the last occurrence of this field in a packet of the same descriptor set and event source.",
234  /* .type = */ {Type::U64, nullptr},
235  /* .accessor = */ nullptr, //utils::access<type, uint64_t, &type::dt_nanos>,
236  /* .attributes = */ {true, false, false, false, false},
237  /* .count = */ 1,
238  /* .condition = */ {},
239  },
240  };
241 
242  static constexpr inline FieldInfo value = {
243  /* .name = */ "data_shared::ReferenceTimeDelta",
244  /* .title = */ "reference_time_delta",
245  /* .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.",
246  /* .parameters = */ parameters,
247  /* .descriptor = */ type::DESCRIPTOR,
248  /* .functions = */ NO_FUNCTIONS,
249  /* .proprietary = */ false,
250  /* .response = */ nullptr,
251  };
252 };
253 
254 template<>
255 struct MetadataFor<data_shared::ExternalTimestamp::ValidFlags>
256 {
258 
259  static constexpr inline BitfieldInfo::Entry entries[] = {
260  { uint32_t(1), "nanoseconds", "" },
261  };
262 
263  static constexpr inline BitfieldInfo value = {
264  /* .name = */ "ValidFlags",
265  /* .docs = */ "",
266  /* .type = */ Type::U16,
267  /* .entries = */ entries,
268  };
269 
270 };
271 
272 template<>
273 struct MetadataFor<data_shared::ExternalTimestamp>
274 {
276 
277  static constexpr inline ParameterInfo parameters[] = {
278  {
279  /* .name = */ "nanoseconds",
280  /* .docs = */ "",
281  /* .type = */ {Type::U64, nullptr},
282  /* .accessor = */ nullptr, //utils::access<type, uint64_t, &type::nanoseconds>,
283  /* .attributes = */ {true, false, false, false, false},
284  /* .count = */ 1,
285  /* .condition = */ {},
286  },
287  {
288  /* .name = */ "valid_flags",
289  /* .docs = */ "",
291  /* .accessor = */ nullptr, //utils::access<type, data_shared::ExternalTimestamp::ValidFlags, &type::valid_flags>,
292  /* .attributes = */ {true, false, false, false, false},
293  /* .count = */ 1,
294  /* .condition = */ {},
295  },
296  };
297 
298  static constexpr inline FieldInfo value = {
299  /* .name = */ "data_shared::ExternalTimestamp",
300  /* .title = */ "external_timestamp",
301  /* .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.",
302  /* .parameters = */ parameters,
303  /* .descriptor = */ type::DESCRIPTOR,
304  /* .functions = */ NO_FUNCTIONS,
305  /* .proprietary = */ false,
306  /* .response = */ nullptr,
307  };
308 };
309 
310 template<>
311 struct MetadataFor<data_shared::ExternalTimeDelta::ValidFlags>
312 {
314 
315  static constexpr inline BitfieldInfo::Entry entries[] = {
316  { uint32_t(1), "dt_nanos", "" },
317  };
318 
319  static constexpr inline BitfieldInfo value = {
320  /* .name = */ "ValidFlags",
321  /* .docs = */ "",
322  /* .type = */ Type::U16,
323  /* .entries = */ entries,
324  };
325 
326 };
327 
328 template<>
329 struct MetadataFor<data_shared::ExternalTimeDelta>
330 {
332 
333  static constexpr inline ParameterInfo parameters[] = {
334  {
335  /* .name = */ "dt_nanos",
336  /* .docs = */ "Nanoseconds since the last occurrence of this field in a packet of the same descriptor set and event source.",
337  /* .type = */ {Type::U64, nullptr},
338  /* .accessor = */ nullptr, //utils::access<type, uint64_t, &type::dt_nanos>,
339  /* .attributes = */ {true, false, false, false, false},
340  /* .count = */ 1,
341  /* .condition = */ {},
342  },
343  {
344  /* .name = */ "valid_flags",
345  /* .docs = */ "",
347  /* .accessor = */ nullptr, //utils::access<type, data_shared::ExternalTimeDelta::ValidFlags, &type::valid_flags>,
348  /* .attributes = */ {true, false, false, false, false},
349  /* .count = */ 1,
350  /* .condition = */ {},
351  },
352  };
353 
354  static constexpr inline FieldInfo value = {
355  /* .name = */ "data_shared::ExternalTimeDelta",
356  /* .title = */ "external_time_delta",
357  /* .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.",
358  /* .parameters = */ parameters,
359  /* .descriptor = */ type::DESCRIPTOR,
360  /* .functions = */ NO_FUNCTIONS,
361  /* .proprietary = */ false,
362  /* .response = */ nullptr,
363  };
364 };
365 
366 
367 static constexpr inline std::initializer_list<const FieldInfo*> DATA_SHARED = {
377 };
378 
379 
380 } // namespace mip::metadata
381 
mip::data_shared::ExternalTimestamp::ValidFlags
Definition: data_shared.hpp:401
mip::data_shared::ReferenceTimestamp
Definition: data_shared.hpp:308
mip::metadata::MetadataFor< data_shared::EventSource >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:30
mip::metadata::BitfieldInfo
Definition: mip_structures.hpp:81
mip::metadata
Definition: commands_3dm.hpp:9
mip::metadata::MetadataFor< data_shared::ReferenceTimeDelta >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:242
mip::metadata::MetadataFor< data_shared::ReferenceTimestamp >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:213
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:15
mip::metadata::MetadataFor< data_shared::GpsTimestamp >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:155
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:127
mip::metadata::MetadataFor< data_shared::ExternalTimeDelta >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:354
mip::metadata::EnumInfo::Entry
Definition: mip_structures.hpp:67
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:182
mip::metadata::Type::U8
@ U8
mip::metadata::MetadataFor< data_shared::DeltaTime >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:184
mip::data_shared::ExternalTimeDelta
Definition: data_shared.hpp:473
mip::metadata::MetadataFor< data_shared::ExternalTimestamp >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:298
mip::metadata::MetadataFor< data_shared::DeltaTicks >::value
static constexpr FieldInfo value
Definition: data_shared.hpp:88
mip::metadata::Type::BITS
@ BITS
common.hpp
mip::metadata::Type::U32
@ U32
mip::data_shared::EventSource
Definition: data_shared.hpp:65