The MIP SDK includes an additional set of definitions for each MIP field which contain additional information beyond that needed for the core functionality of sending commands and receiving data. It includes human-readable field names and information on each parameter, such as name, type, size, etc. This information is accessible at compile time and can be used for things like pretty-printing, CSV generation, and more.
Metadata is currently an experimental feature and is subject to changes. It requires C++17 or later.
Usage:
- Include the metadata definition header for the corresponding descriptor set.
- Get a reference or pointer to the metadata for your field.
- Access members of the reference.
#include <cstdio>
template<class FieldType>
void print_parameters()
{
std::printf("Field (0x%02X,%02X) %s:\n", field.descriptor.descriptorSet, field.descriptor.fieldDescriptor, field.title);
unsigned int p=0;
{
std::printf(
" Parameter %u: %s\n", p, param.
name);
std::printf(
" Parameter %u: %s[%u]\n", p, param.
name, param.
count.
count);
std::printf(
" Parameter %u: %s[%s]\n", p, param.
name, field.parameters[param.
count.counter.index()].name);
else
std::printf(
" Parameter %u: %s[]\n", p, param.
name);
p++;
}
std::printf("\n");
}
int main()
{
print_parameters<mip::commands_3dm::MessageFormat>();
print_parameters<mip::commands_3dm::PpsSource>();
print_parameters<mip::data_sensor::ScaledAccel>();
return 0;
}