MIP_SDK  latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
commands_system.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<commands_system::CommMode::Response>
16 {
18 
19  static constexpr inline ParameterInfo parameters[] = {
20  {
21  /* .name = */ "mode",
22  /* .docs = */ "",
23  /* .type = */ {Type::U8, nullptr},
24  /* .accessor = */ nullptr, //utils::access<type, uint8_t, &type::mode>,
25  /* .attributes = */ {true, false, false, false, false},
26  /* .count = */ 1,
27  /* .condition = */ {},
28  },
29  };
30 
31  static constexpr inline FieldInfo value = {
32  /* .name = */ "commands_system::CommMode::Response",
33  /* .title = */ "response",
34  /* .docs = */ "",
35  /* .parameters = */ parameters,
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  /* .name = */ "commands_system::CommMode",
62  /* .title = */ "comm_mode",
63  /* .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",
64  /* .parameters = */ parameters,
65  /* .descriptor = */ type::DESCRIPTOR,
66  /* .functions = */ {true, true, false, false, true},
67  /* .response = */ &MetadataFor<type::Response>::value,
68  };
69 };
70 
71 template<>
72 struct MetadataFor<commands_system::CommsInterface>
73 {
75 
76  static constexpr inline EnumInfo::Entry entries[] = {
77  { uint32_t(0), "ALL", "" },
78  { uint32_t(1), "MAIN", "An alias that directs to Main USB if it's connected, or Main UART otherwise" },
79  { 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." },
80  { uint32_t(18), "UART_2", "" },
81  { uint32_t(19), "UART_3", "" },
82  { uint32_t(33), "USB_1", "The first virtual serial port over USB (ie. COM5)" },
83  { uint32_t(34), "USB_2", "The second virtual serial port over USB (ie. COM6), only available on GNSS/INS devices. Recommended for NMEA/RTCM." },
84  };
85 
86  static constexpr inline EnumInfo value = {
87  /* .name = */ "CommsInterface",
88  /* .docs = */ "",
89  /* .type = */ Type::U8,
90  /* .entries = */ entries,
91  };
92 
93 };
94 
95 template<>
96 struct MetadataFor<commands_system::CommsProtocol>
97 {
99 
100  static constexpr inline BitfieldInfo::Entry entries[] = {
101  { uint32_t(1), "MIP_COMMANDS", "" },
102  { uint32_t(2), "MIP_DATA", "" },
103  { uint32_t(4), "NMEA", "" },
104  { uint32_t(8), "RTCM", "" },
105  { uint32_t(16), "SPARTN", "" },
106  };
107 
108  static constexpr inline BitfieldInfo value = {
109  /* .name = */ "CommsProtocol",
110  /* .docs = */ "",
111  /* .type = */ Type::U32,
112  /* .entries = */ entries,
113  };
114 
115 };
116 
117 template<>
118 struct MetadataFor<commands_system::InterfaceControl::Response>
119 {
121 
122  static constexpr inline ParameterInfo parameters[] = {
123  {
124  /* .name = */ "port",
125  /* .docs = */ "Which physical interface is being selected (USB, serial, etc)",
127  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsInterface, &type::port>,
128  /* .attributes = */ {true, true, true, true, true, /*echo*/true},
129  /* .count = */ 1,
130  /* .condition = */ {},
131  },
132  {
133  /* .name = */ "protocols_incoming",
134  /* .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.",
136  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsProtocol, &type::protocols_incoming>,
137  /* .attributes = */ {true, false, false, false, false},
138  /* .count = */ 1,
139  /* .condition = */ {},
140  },
141  {
142  /* .name = */ "protocols_outgoing",
143  /* .docs = */ "Data protocol(s) the port will output",
145  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsProtocol, &type::protocols_outgoing>,
146  /* .attributes = */ {true, false, false, false, false},
147  /* .count = */ 1,
148  /* .condition = */ {},
149  },
150  };
151 
152  static constexpr inline FieldInfo value = {
153  /* .name = */ "commands_system::InterfaceControl::Response",
154  /* .title = */ "response",
155  /* .docs = */ "",
156  /* .parameters = */ parameters,
157  /* .descriptor = */ type::DESCRIPTOR,
158  /* .functions = */ NO_FUNCTIONS,
159  /* .response = */ nullptr,
160  };
161 };
162 
163 template<>
164 struct MetadataFor<commands_system::InterfaceControl>
165 {
167 
168  static constexpr inline ParameterInfo parameters[] = {
169  FUNCTION_SELECTOR_PARAM,
170  {
171  /* .name = */ "port",
172  /* .docs = */ "Which physical interface is being selected (USB, serial, etc)",
174  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsInterface, &type::port>,
175  /* .attributes = */ {true, true, true, true, true, /*echo*/true},
176  /* .count = */ 1,
177  /* .condition = */ {},
178  },
179  {
180  /* .name = */ "protocols_incoming",
181  /* .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.",
183  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsProtocol, &type::protocols_incoming>,
184  /* .attributes = */ {true, false, false, false, false},
185  /* .count = */ 1,
186  /* .condition = */ {},
187  },
188  {
189  /* .name = */ "protocols_outgoing",
190  /* .docs = */ "Data protocol(s) the port will output",
192  /* .accessor = */ nullptr, //utils::access<type, commands_system::CommsProtocol, &type::protocols_outgoing>,
193  /* .attributes = */ {true, false, false, false, false},
194  /* .count = */ 1,
195  /* .condition = */ {},
196  },
197  };
198 
199  static constexpr inline FieldInfo value = {
200  /* .name = */ "commands_system::InterfaceControl",
201  /* .title = */ "Interface Control",
202  /* .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",
203  /* .parameters = */ parameters,
204  /* .descriptor = */ type::DESCRIPTOR,
205  /* .functions = */ {true, true, true, true, true},
206  /* .response = */ &MetadataFor<type::Response>::value,
207  };
208 };
209 
210 
211 static constexpr inline const FieldInfo* COMMANDS_SYSTEM_FIELDS[] = {
216 };
217 
218 static constexpr DescriptorSetInfo COMMANDS_SYSTEM = {
219  /*.descriptor =*/ mip::commands_system::DESCRIPTOR_SET,
220  /*.name =*/ "System Commands",
221  /*.fields =*/ COMMANDS_SYSTEM_FIELDS,
222 };
223 
224 } // namespace mip::metadata
225 
mip::metadata::MetadataFor< commands_system::CommMode::Response >::value
static constexpr FieldInfo value
Definition: commands_system.hpp:31
mip::commands_system::InterfaceControl
Definition: commands_system.hpp:208
mip::metadata::Type::ENUM
@ ENUM
mip::metadata::BitfieldInfo
Definition: mip_structures.hpp:91
mip::metadata
Definition: commands_3dm.hpp:10
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:152
mip::metadata::MetadataFor
Definition: mip_metadata.hpp:15
mip::commands_system::InterfaceControl::Response
Definition: commands_system.hpp:246
mip::metadata::MetadataFor< commands_system::CommMode >::value
static constexpr FieldInfo value
Definition: commands_system.hpp:60
mip::metadata::ParameterInfo
Definition: mip_structures.hpp:161
mip::metadata::EnumInfo::Entry
Definition: mip_structures.hpp:67
mip_metadata.hpp
mip::commands_system::CommsProtocol
Definition: commands_system.hpp:64
mip::commands_system::CommMode::Response
Definition: commands_system.hpp:154
mip::metadata::FieldInfo
Definition: mip_structures.hpp:216
mip::metadata::Type::U8
@ U8
mip::metadata::EnumInfo
Definition: mip_structures.hpp:65
mip::metadata::MetadataFor< commands_system::InterfaceControl >::value
static constexpr FieldInfo value
Definition: commands_system.hpp:199
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:119
common.hpp
mip::metadata::Type::U32
@ U32