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