Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | // MESSAGE COMMAND_LONG PACKING |
2 | |||
3 | #define MAVLINK_MSG_ID_COMMAND_LONG 76 |
||
4 | |||
5 | typedef struct __mavlink_command_long_t |
||
6 | { |
||
7 | float param1; ///< Parameter 1, as defined by MAV_CMD enum. |
||
8 | float param2; ///< Parameter 2, as defined by MAV_CMD enum. |
||
9 | float param3; ///< Parameter 3, as defined by MAV_CMD enum. |
||
10 | float param4; ///< Parameter 4, as defined by MAV_CMD enum. |
||
11 | float param5; ///< Parameter 5, as defined by MAV_CMD enum. |
||
12 | float param6; ///< Parameter 6, as defined by MAV_CMD enum. |
||
13 | float param7; ///< Parameter 7, as defined by MAV_CMD enum. |
||
14 | uint16_t command; ///< Command ID, as defined by MAV_CMD enum. |
||
15 | uint8_t target_system; ///< System which should execute the command |
||
16 | uint8_t target_component; ///< Component which should execute the command, 0 for all components |
||
17 | uint8_t confirmation; ///< 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) |
||
18 | } mavlink_command_long_t; |
||
19 | |||
20 | #define MAVLINK_MSG_ID_COMMAND_LONG_LEN 33 |
||
21 | #define MAVLINK_MSG_ID_76_LEN 33 |
||
22 | |||
23 | |||
24 | |||
25 | #define MAVLINK_MESSAGE_INFO_COMMAND_LONG { \ |
||
26 | "COMMAND_LONG", \ |
||
27 | 11, \ |
||
28 | { { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_long_t, param1) }, \ |
||
29 | { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_long_t, param2) }, \ |
||
30 | { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_long_t, param3) }, \ |
||
31 | { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_long_t, param4) }, \ |
||
32 | { "param5", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_command_long_t, param5) }, \ |
||
33 | { "param6", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_command_long_t, param6) }, \ |
||
34 | { "param7", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_long_t, param7) }, \ |
||
35 | { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_command_long_t, command) }, \ |
||
36 | { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_command_long_t, target_system) }, \ |
||
37 | { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_command_long_t, target_component) }, \ |
||
38 | { "confirmation", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_command_long_t, confirmation) }, \ |
||
39 | } \ |
||
40 | } |
||
41 | |||
42 | |||
43 | /** |
||
44 | * @brief Pack a command_long message |
||
45 | * @param system_id ID of this system |
||
46 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
47 | * @param msg The MAVLink message to compress the data into |
||
48 | * |
||
49 | * @param target_system System which should execute the command |
||
50 | * @param target_component Component which should execute the command, 0 for all components |
||
51 | * @param command Command ID, as defined by MAV_CMD enum. |
||
52 | * @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) |
||
53 | * @param param1 Parameter 1, as defined by MAV_CMD enum. |
||
54 | * @param param2 Parameter 2, as defined by MAV_CMD enum. |
||
55 | * @param param3 Parameter 3, as defined by MAV_CMD enum. |
||
56 | * @param param4 Parameter 4, as defined by MAV_CMD enum. |
||
57 | * @param param5 Parameter 5, as defined by MAV_CMD enum. |
||
58 | * @param param6 Parameter 6, as defined by MAV_CMD enum. |
||
59 | * @param param7 Parameter 7, as defined by MAV_CMD enum. |
||
60 | * @return length of the message in bytes (excluding serial stream start sign) |
||
61 | */ |
||
62 | static inline uint16_t mavlink_msg_command_long_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
||
63 | uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7) |
||
64 | { |
||
65 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
66 | char buf[33]; |
||
67 | _mav_put_float(buf, 0, param1); |
||
68 | _mav_put_float(buf, 4, param2); |
||
69 | _mav_put_float(buf, 8, param3); |
||
70 | _mav_put_float(buf, 12, param4); |
||
71 | _mav_put_float(buf, 16, param5); |
||
72 | _mav_put_float(buf, 20, param6); |
||
73 | _mav_put_float(buf, 24, param7); |
||
74 | _mav_put_uint16_t(buf, 28, command); |
||
75 | _mav_put_uint8_t(buf, 30, target_system); |
||
76 | _mav_put_uint8_t(buf, 31, target_component); |
||
77 | _mav_put_uint8_t(buf, 32, confirmation); |
||
78 | |||
79 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 33); |
||
80 | #else |
||
81 | mavlink_command_long_t packet; |
||
82 | packet.param1 = param1; |
||
83 | packet.param2 = param2; |
||
84 | packet.param3 = param3; |
||
85 | packet.param4 = param4; |
||
86 | packet.param5 = param5; |
||
87 | packet.param6 = param6; |
||
88 | packet.param7 = param7; |
||
89 | packet.command = command; |
||
90 | packet.target_system = target_system; |
||
91 | packet.target_component = target_component; |
||
92 | packet.confirmation = confirmation; |
||
93 | |||
94 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 33); |
||
95 | #endif |
||
96 | |||
97 | msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG; |
||
98 | return mavlink_finalize_message(msg, system_id, component_id, 33, 152); |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * @brief Pack a command_long message on a channel |
||
103 | * @param system_id ID of this system |
||
104 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
105 | * @param chan The MAVLink channel this message was sent over |
||
106 | * @param msg The MAVLink message to compress the data into |
||
107 | * @param target_system System which should execute the command |
||
108 | * @param target_component Component which should execute the command, 0 for all components |
||
109 | * @param command Command ID, as defined by MAV_CMD enum. |
||
110 | * @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) |
||
111 | * @param param1 Parameter 1, as defined by MAV_CMD enum. |
||
112 | * @param param2 Parameter 2, as defined by MAV_CMD enum. |
||
113 | * @param param3 Parameter 3, as defined by MAV_CMD enum. |
||
114 | * @param param4 Parameter 4, as defined by MAV_CMD enum. |
||
115 | * @param param5 Parameter 5, as defined by MAV_CMD enum. |
||
116 | * @param param6 Parameter 6, as defined by MAV_CMD enum. |
||
117 | * @param param7 Parameter 7, as defined by MAV_CMD enum. |
||
118 | * @return length of the message in bytes (excluding serial stream start sign) |
||
119 | */ |
||
120 | static inline uint16_t mavlink_msg_command_long_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
||
121 | mavlink_message_t* msg, |
||
122 | uint8_t target_system,uint8_t target_component,uint16_t command,uint8_t confirmation,float param1,float param2,float param3,float param4,float param5,float param6,float param7) |
||
123 | { |
||
124 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
125 | char buf[33]; |
||
126 | _mav_put_float(buf, 0, param1); |
||
127 | _mav_put_float(buf, 4, param2); |
||
128 | _mav_put_float(buf, 8, param3); |
||
129 | _mav_put_float(buf, 12, param4); |
||
130 | _mav_put_float(buf, 16, param5); |
||
131 | _mav_put_float(buf, 20, param6); |
||
132 | _mav_put_float(buf, 24, param7); |
||
133 | _mav_put_uint16_t(buf, 28, command); |
||
134 | _mav_put_uint8_t(buf, 30, target_system); |
||
135 | _mav_put_uint8_t(buf, 31, target_component); |
||
136 | _mav_put_uint8_t(buf, 32, confirmation); |
||
137 | |||
138 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 33); |
||
139 | #else |
||
140 | mavlink_command_long_t packet; |
||
141 | packet.param1 = param1; |
||
142 | packet.param2 = param2; |
||
143 | packet.param3 = param3; |
||
144 | packet.param4 = param4; |
||
145 | packet.param5 = param5; |
||
146 | packet.param6 = param6; |
||
147 | packet.param7 = param7; |
||
148 | packet.command = command; |
||
149 | packet.target_system = target_system; |
||
150 | packet.target_component = target_component; |
||
151 | packet.confirmation = confirmation; |
||
152 | |||
153 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 33); |
||
154 | #endif |
||
155 | |||
156 | msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG; |
||
157 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 33, 152); |
||
158 | } |
||
159 | |||
160 | /** |
||
161 | * @brief Encode a command_long struct into a message |
||
162 | * |
||
163 | * @param system_id ID of this system |
||
164 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
165 | * @param msg The MAVLink message to compress the data into |
||
166 | * @param command_long C-struct to read the message contents from |
||
167 | */ |
||
168 | static inline uint16_t mavlink_msg_command_long_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_long_t* command_long) |
||
169 | { |
||
170 | return mavlink_msg_command_long_pack(system_id, component_id, msg, command_long->target_system, command_long->target_component, command_long->command, command_long->confirmation, command_long->param1, command_long->param2, command_long->param3, command_long->param4, command_long->param5, command_long->param6, command_long->param7); |
||
171 | } |
||
172 | |||
173 | /** |
||
174 | * @brief Send a command_long message |
||
175 | * @param chan MAVLink channel to send the message |
||
176 | * |
||
177 | * @param target_system System which should execute the command |
||
178 | * @param target_component Component which should execute the command, 0 for all components |
||
179 | * @param command Command ID, as defined by MAV_CMD enum. |
||
180 | * @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) |
||
181 | * @param param1 Parameter 1, as defined by MAV_CMD enum. |
||
182 | * @param param2 Parameter 2, as defined by MAV_CMD enum. |
||
183 | * @param param3 Parameter 3, as defined by MAV_CMD enum. |
||
184 | * @param param4 Parameter 4, as defined by MAV_CMD enum. |
||
185 | * @param param5 Parameter 5, as defined by MAV_CMD enum. |
||
186 | * @param param6 Parameter 6, as defined by MAV_CMD enum. |
||
187 | * @param param7 Parameter 7, as defined by MAV_CMD enum. |
||
188 | */ |
||
189 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
||
190 | |||
191 | static inline void mavlink_msg_command_long_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t command, uint8_t confirmation, float param1, float param2, float param3, float param4, float param5, float param6, float param7) |
||
192 | { |
||
193 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
194 | char buf[33]; |
||
195 | _mav_put_float(buf, 0, param1); |
||
196 | _mav_put_float(buf, 4, param2); |
||
197 | _mav_put_float(buf, 8, param3); |
||
198 | _mav_put_float(buf, 12, param4); |
||
199 | _mav_put_float(buf, 16, param5); |
||
200 | _mav_put_float(buf, 20, param6); |
||
201 | _mav_put_float(buf, 24, param7); |
||
202 | _mav_put_uint16_t(buf, 28, command); |
||
203 | _mav_put_uint8_t(buf, 30, target_system); |
||
204 | _mav_put_uint8_t(buf, 31, target_component); |
||
205 | _mav_put_uint8_t(buf, 32, confirmation); |
||
206 | |||
207 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, 33, 152); |
||
208 | #else |
||
209 | mavlink_command_long_t packet; |
||
210 | packet.param1 = param1; |
||
211 | packet.param2 = param2; |
||
212 | packet.param3 = param3; |
||
213 | packet.param4 = param4; |
||
214 | packet.param5 = param5; |
||
215 | packet.param6 = param6; |
||
216 | packet.param7 = param7; |
||
217 | packet.command = command; |
||
218 | packet.target_system = target_system; |
||
219 | packet.target_component = target_component; |
||
220 | packet.confirmation = confirmation; |
||
221 | |||
222 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)&packet, 33, 152); |
||
223 | #endif |
||
224 | } |
||
225 | |||
226 | #endif |
||
227 | |||
228 | // MESSAGE COMMAND_LONG UNPACKING |
||
229 | |||
230 | |||
231 | /** |
||
232 | * @brief Get field target_system from command_long message |
||
233 | * |
||
234 | * @return System which should execute the command |
||
235 | */ |
||
236 | static inline uint8_t mavlink_msg_command_long_get_target_system(const mavlink_message_t* msg) |
||
237 | { |
||
238 | return _MAV_RETURN_uint8_t(msg, 30); |
||
239 | } |
||
240 | |||
241 | /** |
||
242 | * @brief Get field target_component from command_long message |
||
243 | * |
||
244 | * @return Component which should execute the command, 0 for all components |
||
245 | */ |
||
246 | static inline uint8_t mavlink_msg_command_long_get_target_component(const mavlink_message_t* msg) |
||
247 | { |
||
248 | return _MAV_RETURN_uint8_t(msg, 31); |
||
249 | } |
||
250 | |||
251 | /** |
||
252 | * @brief Get field command from command_long message |
||
253 | * |
||
254 | * @return Command ID, as defined by MAV_CMD enum. |
||
255 | */ |
||
256 | static inline uint16_t mavlink_msg_command_long_get_command(const mavlink_message_t* msg) |
||
257 | { |
||
258 | return _MAV_RETURN_uint16_t(msg, 28); |
||
259 | } |
||
260 | |||
261 | /** |
||
262 | * @brief Get field confirmation from command_long message |
||
263 | * |
||
264 | * @return 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command) |
||
265 | */ |
||
266 | static inline uint8_t mavlink_msg_command_long_get_confirmation(const mavlink_message_t* msg) |
||
267 | { |
||
268 | return _MAV_RETURN_uint8_t(msg, 32); |
||
269 | } |
||
270 | |||
271 | /** |
||
272 | * @brief Get field param1 from command_long message |
||
273 | * |
||
274 | * @return Parameter 1, as defined by MAV_CMD enum. |
||
275 | */ |
||
276 | static inline float mavlink_msg_command_long_get_param1(const mavlink_message_t* msg) |
||
277 | { |
||
278 | return _MAV_RETURN_float(msg, 0); |
||
279 | } |
||
280 | |||
281 | /** |
||
282 | * @brief Get field param2 from command_long message |
||
283 | * |
||
284 | * @return Parameter 2, as defined by MAV_CMD enum. |
||
285 | */ |
||
286 | static inline float mavlink_msg_command_long_get_param2(const mavlink_message_t* msg) |
||
287 | { |
||
288 | return _MAV_RETURN_float(msg, 4); |
||
289 | } |
||
290 | |||
291 | /** |
||
292 | * @brief Get field param3 from command_long message |
||
293 | * |
||
294 | * @return Parameter 3, as defined by MAV_CMD enum. |
||
295 | */ |
||
296 | static inline float mavlink_msg_command_long_get_param3(const mavlink_message_t* msg) |
||
297 | { |
||
298 | return _MAV_RETURN_float(msg, 8); |
||
299 | } |
||
300 | |||
301 | /** |
||
302 | * @brief Get field param4 from command_long message |
||
303 | * |
||
304 | * @return Parameter 4, as defined by MAV_CMD enum. |
||
305 | */ |
||
306 | static inline float mavlink_msg_command_long_get_param4(const mavlink_message_t* msg) |
||
307 | { |
||
308 | return _MAV_RETURN_float(msg, 12); |
||
309 | } |
||
310 | |||
311 | /** |
||
312 | * @brief Get field param5 from command_long message |
||
313 | * |
||
314 | * @return Parameter 5, as defined by MAV_CMD enum. |
||
315 | */ |
||
316 | static inline float mavlink_msg_command_long_get_param5(const mavlink_message_t* msg) |
||
317 | { |
||
318 | return _MAV_RETURN_float(msg, 16); |
||
319 | } |
||
320 | |||
321 | /** |
||
322 | * @brief Get field param6 from command_long message |
||
323 | * |
||
324 | * @return Parameter 6, as defined by MAV_CMD enum. |
||
325 | */ |
||
326 | static inline float mavlink_msg_command_long_get_param6(const mavlink_message_t* msg) |
||
327 | { |
||
328 | return _MAV_RETURN_float(msg, 20); |
||
329 | } |
||
330 | |||
331 | /** |
||
332 | * @brief Get field param7 from command_long message |
||
333 | * |
||
334 | * @return Parameter 7, as defined by MAV_CMD enum. |
||
335 | */ |
||
336 | static inline float mavlink_msg_command_long_get_param7(const mavlink_message_t* msg) |
||
337 | { |
||
338 | return _MAV_RETURN_float(msg, 24); |
||
339 | } |
||
340 | |||
341 | /** |
||
342 | * @brief Decode a command_long message into a struct |
||
343 | * |
||
344 | * @param msg The message to decode |
||
345 | * @param command_long C-struct to decode the message contents into |
||
346 | */ |
||
347 | static inline void mavlink_msg_command_long_decode(const mavlink_message_t* msg, mavlink_command_long_t* command_long) |
||
348 | { |
||
349 | #if MAVLINK_NEED_BYTE_SWAP |
||
350 | command_long->param1 = mavlink_msg_command_long_get_param1(msg); |
||
351 | command_long->param2 = mavlink_msg_command_long_get_param2(msg); |
||
352 | command_long->param3 = mavlink_msg_command_long_get_param3(msg); |
||
353 | command_long->param4 = mavlink_msg_command_long_get_param4(msg); |
||
354 | command_long->param5 = mavlink_msg_command_long_get_param5(msg); |
||
355 | command_long->param6 = mavlink_msg_command_long_get_param6(msg); |
||
356 | command_long->param7 = mavlink_msg_command_long_get_param7(msg); |
||
357 | command_long->command = mavlink_msg_command_long_get_command(msg); |
||
358 | command_long->target_system = mavlink_msg_command_long_get_target_system(msg); |
||
359 | command_long->target_component = mavlink_msg_command_long_get_target_component(msg); |
||
360 | command_long->confirmation = mavlink_msg_command_long_get_confirmation(msg); |
||
361 | #else |
||
362 | memcpy(command_long, _MAV_PAYLOAD(msg), 33); |
||
363 | #endif |
||
364 | } |