MIP_SDK  v3.0.0-208-gdb90bae
MicroStrain Communications Library for embedded systems
commands_system.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<commands_system::CommMode::Response>
14 {
16 
17  static constexpr inline ParameterInfo parameters[] = {
18  {
19  /* .name = */ "mode",
20  /* .docs = */ "",
21  /* .type = */ {Type::U8, nullptr},
22  /* .accessor = */ nullptr, //utils::access<type, uint8_t, &type::mode>,
23  /* .attributes = */ {true, false, false, false, false},
24  /* .count = */ 1,
25  /* .condition = */ {},
26  },
27  };
28 
29  static constexpr inline FieldInfo value = {
30  {
31  /* .name = */ "commands_system::CommMode::Response",
32  /* .title = */ "response",
33  /* .docs = */ "",
34  /* .parameters = */ parameters,
35  },
36  /* .descriptor = */ type::DESCRIPTOR,
37  /* .functions = */ NO_FUNCTIONS,
38  /* .response = */ nullptr,
39  };
40 };
41 
42 template<>
43 struct MetadataFor<commands_system::CommMode>
44 {
46 
47  static constexpr inline ParameterInfo parameters[] = {
48  FUNCTION_SELECTOR_PARAM,
49  {
50  /* .name = */ "mode",
51  /* .docs = */ "",
52  /* .type = */ {Type::U8, nullptr},
53  /* .accessor = */ nullptr, //utils::access<type, uint8_t, &type::mode>,
54  /* .attributes = */ {true, false, false, false, false},
55  /* .count = */ 1,
56  /* .condition = */ {},
57  },
58  };
59 
60  static constexpr inline FieldInfo value = {
61  {
62  /* .name = */ "commands_system::CommMode",
63  /* .title = */ "comm_mode",
64  /* .docs = */ "Advanced specialized communication modes.\n\nThis command allows the user to communicate directly with various subsystems which may be present in MIP devices (i.e. IMU, GNSS, etc.)\nPlease see the specific device's user manual for possible modes.\n\nThis command responds with an ACK/NACK just prior to switching to the new protocol.\nFor all functions except 0x01 (use new settings), the new communications mode value is ignored.\n\n",
65  /* .parameters = */ parameters,
66  },
67  /* .descriptor = */ type::DESCRIPTOR,
68  /* .functions = */ {true, true, false, false, true},
69  /* .response = */ &MetadataFor<type::Response>::value,
70  };
71 };
72 
73 template<>
74 struct MetadataFor<commands_system::CommsInterface>
75 {
77 
78  static constexpr inline EnumInfo::Entry entries[] = {
79  { uint32_t(0), "ALL", "" },
80  { uint32_t(1), "MAIN", "An alias that directs to Main USB if it's connected, or Main UART otherwise" },
81  { uint32_t(17), "UART_1", "Depending on your device, this may mean either the first UART *currently configured*, or the first port on which UART *can be configured*. Refer to your device manual." },
82  { uint32_t(18), "UART_2", "" },
83  { uint32_t(19), "UART_3", "" },
84  { uint32_t(33), "USB_1", "The first virtual serial port over USB (ie. COM5)" },
85  { uint32_t(34), "USB_2", "The second virtual serial port over USB (ie. COM6), only available on GNSS/INS devices. Recommended for NMEA/RTCM." },
86  };
87 
88  static constexpr inline EnumInfo value = {
89  /* .name = */ "CommsInterface",
90  /* .docs = */ "",
91  /* .type = */ Type::U8,
92  /* .entries = */ entries,
93  };
94 
95 };
96 
97 template<>
98 struct MetadataFor<commands_system::CommsProtocol>
99 {
101 
102  static constexpr inline BitfieldInfo::Entry entries[] = {
103  { uint32_t(1), "MIP", "Microstrain Inertial Protocol" },
104  { uint32_t(256), "NMEA", "" },
105  { uint32_t(512), "RTCM", "" },
106  { uint32_t(16777216), "SPARTN", "" },
107  };
108 
109  static constexpr inline BitfieldInfo value = {
110  /* .name = */ "CommsProtocol",
111  /* .docs = */ "",
112  /* .type = */ Type::U32,
113  /* .entries = */ entries,
114  };
115 
116 };
117 
118 template<>
119 struct MetadataFor<commands_system::InterfaceControl::Response>
120 {
122 
123  static constexpr inline ParameterInfo parameters[] = {
124  {
125  /* .name = */ "port",
126  /* .docs = */ "Which physical interface is being selected (USB, serial, etc)",
128  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsInterface, &type::port>,
129  /* .attributes = */ {true, true, true, true, true, /*echo*/true},
130  /* .count = */ 1,
131  /* .condition = */ {},
132  },
133  {
134  /* .name = */ "protocols_incoming",
135  /* .docs = */ "Input protocol(s) the port will accept. If the protocol supports ACK/NACK or detailed responses, it will be sent over this port even if no corresponding output protocol is set.",
137  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsProtocol, &type::protocols_incoming>,
138  /* .attributes = */ {true, false, false, false, false},
139  /* .count = */ 1,
140  /* .condition = */ {},
141  },
142  {
143  /* .name = */ "protocols_outgoing",
144  /* .docs = */ "Data protocol(s) the port will output",
146  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsProtocol, &type::protocols_outgoing>,
147  /* .attributes = */ {true, false, false, false, false},
148  /* .count = */ 1,
149  /* .condition = */ {},
150  },
151  };
152 
153  static constexpr inline FieldInfo value = {
154  {
155  /* .name = */ "commands_system::InterfaceControl::Response",
156  /* .title = */ "response",
157  /* .docs = */ "",
158  /* .parameters = */ parameters,
159  },
160  /* .descriptor = */ type::DESCRIPTOR,
161  /* .functions = */ NO_FUNCTIONS,
162  /* .response = */ nullptr,
163  };
164 };
165 
166 template<>
167 struct MetadataFor<commands_system::InterfaceControl>
168 {
170 
171  static constexpr inline ParameterInfo parameters[] = {
172  FUNCTION_SELECTOR_PARAM,
173  {
174  /* .name = */ "port",
175  /* .docs = */ "Which physical interface is being selected (USB, serial, etc)",
177  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsInterface, &type::port>,
178  /* .attributes = */ {true, true, true, true, true, /*echo*/true},
179  /* .count = */ 1,
180  /* .condition = */ {},
181  },
182  {
183  /* .name = */ "protocols_incoming",
184  /* .docs = */ "Input protocol(s) the port will accept. If the protocol supports ACK/NACK or detailed responses, it will be sent over this port even if no corresponding output protocol is set.",
186  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsProtocol, &type::protocols_incoming>,
187  /* .attributes = */ {true, false, false, false, false},
188  /* .count = */ 1,
189  /* .condition = */ {},
190  },
191  {
192  /* .name = */ "protocols_outgoing",
193  /* .docs = */ "Data protocol(s) the port will output",
195  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsProtocol, &type::protocols_outgoing>,
196  /* .attributes = */ {true, false, false, false, false},
197  /* .count = */ 1,
198  /* .condition = */ {},
199  },
200  };
201 
202  static constexpr inline FieldInfo value = {
203  {
204  /* .name = */ "commands_system::InterfaceControl",
205  /* .title = */ "Interface Control",
206  /* .docs = */ "Reassign data protocols, both incoming and outgoing.\n\nResponds over the port that sent the command with an ACK/NACK immediately after the operation is complete. It is the user's responsibility to not\nsend any critical information or commands while awaiting a response! Doing so while this command processes may cause those packets to be dropped.\n\nConstraints:\n- Limited parsers and data streams are available. Refer to your device manual for more information.\n- The Main port always has a MIP parser and MIP data stream bound. Additionally, Main is the only port that can process interface control commands.\n\nIf response is NACK, no change was made. Here's what can cause a NACK:\n- The requested protocol isn't supported on this device, or on this port, or this device doesn't support that many parsers.\n- The request would break the general constraints listed above, or a device-specific constraint.\n\n",
207  /* .parameters = */ parameters,
208  },
209  /* .descriptor = */ type::DESCRIPTOR,
210  /* .functions = */ {true, true, true, true, true},
211  /* .response = */ &MetadataFor<type::Response>::value,
212  };
213 };
214 
215 
216 static constexpr inline const FieldInfo* COMMANDS_SYSTEM_FIELDS[] = {
221 };
222 
223 static constexpr DescriptorSetInfo COMMANDS_SYSTEM = {
224  /* .descriptor = */ mip::commands_system::DESCRIPTOR_SET,
225  /* .name = */ "System Commands",
226  /* .fields = */ COMMANDS_SYSTEM_FIELDS,
227 };
228 
229 } // namespace mip::metadata
230 
mip::metadata::MetadataFor< commands_system::CommMode::Response >::value
static constexpr FieldInfo value
Definition: commands_system.hpp:29
common.hpp
mip::commands_system::InterfaceControl
Definition: commands_system.hpp:205
mip::metadata::Type::ENUM
@ ENUM
mip::metadata::BitfieldInfo
Definition: mip_structures.hpp:89
mip::metadata
Definition: common.hpp:8
mip::commands_system::CommsInterface
CommsInterface
Definition: commands_system.hpp:53
commands_system.hpp
mip::metadata::MetadataFor< commands_system::InterfaceControl::Response >::value
static constexpr FieldInfo value
Definition: commands_system.hpp:153
mip::metadata::MetadataFor
Definition: mip_metadata.hpp:13
mip::commands_system::InterfaceControl::Response
Definition: commands_system.hpp:243
mip::metadata::MetadataFor< commands_system::CommMode >::value
static constexpr FieldInfo value
Definition: commands_system.hpp:60
mip::metadata::ParameterInfo
Definition: mip_structures.hpp:158
mip::metadata::EnumInfo::Entry
Definition: mip_structures.hpp:65
mip_metadata.hpp
mip::commands_system::CommsProtocol
Definition: commands_system.hpp:64
mip::commands_system::CommMode::Response
Definition: commands_system.hpp:151
mip::metadata::FieldInfo
Definition: mip_structures.hpp:212
mip::metadata::Type::U8
@ U8
mip::metadata::EnumInfo
Definition: mip_structures.hpp:63
mip::metadata::MetadataFor< commands_system::InterfaceControl >::value
static constexpr FieldInfo value
Definition: commands_system.hpp:202
mip::commands_system::DESCRIPTOR_SET
@ DESCRIPTOR_SET
Definition: commands_system.hpp:31
mip::metadata::Type::BITS
@ BITS
mip::commands_system::CommMode
Definition: commands_system.hpp:116
mip::metadata::Type::U32
@ U32