mavlink_msg_command_long.h
Go to the documentation of this file.
1 // MESSAGE COMMAND_LONG PACKING
2 
3 #define MAVLINK_MSG_ID_COMMAND_LONG 76
4 
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)*/
19 
20 #define MAVLINK_MSG_ID_COMMAND_LONG_LEN 33
21 #define MAVLINK_MSG_ID_76_LEN 33
22 
23 #define MAVLINK_MSG_ID_COMMAND_LONG_CRC 152
24 #define MAVLINK_MSG_ID_76_CRC 152
25 
26 
27 
28 #define MAVLINK_MESSAGE_INFO_COMMAND_LONG { \
29  "COMMAND_LONG", \
30  11, \
31  { { "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_long_t, param1) }, \
32  { "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_long_t, param2) }, \
33  { "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_long_t, param3) }, \
34  { "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_long_t, param4) }, \
35  { "param5", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_command_long_t, param5) }, \
36  { "param6", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_command_long_t, param6) }, \
37  { "param7", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_command_long_t, param7) }, \
38  { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_command_long_t, command) }, \
39  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_command_long_t, target_system) }, \
40  { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_command_long_t, target_component) }, \
41  { "confirmation", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_command_long_t, confirmation) }, \
42  } \
43 }
44 
45 
65 static inline uint16_t mavlink_msg_command_long_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
66  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)
67 {
68 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
70  _mav_put_float(buf, 0, param1);
71  _mav_put_float(buf, 4, param2);
72  _mav_put_float(buf, 8, param3);
73  _mav_put_float(buf, 12, param4);
74  _mav_put_float(buf, 16, param5);
75  _mav_put_float(buf, 20, param6);
76  _mav_put_float(buf, 24, param7);
77  _mav_put_uint16_t(buf, 28, command);
78  _mav_put_uint8_t(buf, 30, target_system);
79  _mav_put_uint8_t(buf, 31, target_component);
80  _mav_put_uint8_t(buf, 32, confirmation);
81 
83 #else
85  packet.param1 = param1;
86  packet.param2 = param2;
87  packet.param3 = param3;
88  packet.param4 = param4;
89  packet.param5 = param5;
90  packet.param6 = param6;
91  packet.param7 = param7;
92  packet.command = command;
95  packet.confirmation = confirmation;
96 
98 #endif
99 
100  msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG;
101 #if MAVLINK_CRC_EXTRA
103 #else
104  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
105 #endif
106 }
107 
127 static inline uint16_t mavlink_msg_command_long_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
128  mavlink_message_t* msg,
129  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)
130 {
131 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
133  _mav_put_float(buf, 0, param1);
134  _mav_put_float(buf, 4, param2);
135  _mav_put_float(buf, 8, param3);
136  _mav_put_float(buf, 12, param4);
137  _mav_put_float(buf, 16, param5);
138  _mav_put_float(buf, 20, param6);
139  _mav_put_float(buf, 24, param7);
140  _mav_put_uint16_t(buf, 28, command);
141  _mav_put_uint8_t(buf, 30, target_system);
142  _mav_put_uint8_t(buf, 31, target_component);
143  _mav_put_uint8_t(buf, 32, confirmation);
144 
146 #else
147  mavlink_command_long_t packet;
148  packet.param1 = param1;
149  packet.param2 = param2;
150  packet.param3 = param3;
151  packet.param4 = param4;
152  packet.param5 = param5;
153  packet.param6 = param6;
154  packet.param7 = param7;
155  packet.command = command;
156  packet.target_system = target_system;
158  packet.confirmation = confirmation;
159 
161 #endif
162 
163  msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG;
164 #if MAVLINK_CRC_EXTRA
166 #else
167  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
168 #endif
169 }
170 
179 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)
180 {
181  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);
182 }
183 
193 static inline uint16_t mavlink_msg_command_long_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_command_long_t* command_long)
194 {
195  return mavlink_msg_command_long_pack_chan(system_id, component_id, chan, 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);
196 }
197 
214 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
215 
216 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)
217 {
218 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
220  _mav_put_float(buf, 0, param1);
221  _mav_put_float(buf, 4, param2);
222  _mav_put_float(buf, 8, param3);
223  _mav_put_float(buf, 12, param4);
224  _mav_put_float(buf, 16, param5);
225  _mav_put_float(buf, 20, param6);
226  _mav_put_float(buf, 24, param7);
227  _mav_put_uint16_t(buf, 28, command);
230  _mav_put_uint8_t(buf, 32, confirmation);
231 
232 #if MAVLINK_CRC_EXTRA
234 #else
235  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
236 #endif
237 #else
238  mavlink_command_long_t packet;
239  packet.param1 = param1;
240  packet.param2 = param2;
241  packet.param3 = param3;
242  packet.param4 = param4;
243  packet.param5 = param5;
244  packet.param6 = param6;
245  packet.param7 = param7;
246  packet.command = command;
247  packet.target_system = target_system;
249  packet.confirmation = confirmation;
250 
251 #if MAVLINK_CRC_EXTRA
252  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
253 #else
254  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
255 #endif
256 #endif
257 }
258 
259 #if MAVLINK_MSG_ID_COMMAND_LONG_LEN <= MAVLINK_MAX_PAYLOAD_LEN
260 /*
261  This varient of _send() can be used to save stack space by re-using
262  memory from the receive buffer. The caller provides a
263  mavlink_message_t which is the size of a full mavlink message. This
264  is usually the receive buffer for the channel, and allows a reply to an
265  incoming message with minimum stack space usage.
266  */
267 static inline void mavlink_msg_command_long_send_buf(mavlink_message_t *msgbuf, 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)
268 {
269 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
270  char *buf = (char *)msgbuf;
271  _mav_put_float(buf, 0, param1);
272  _mav_put_float(buf, 4, param2);
273  _mav_put_float(buf, 8, param3);
274  _mav_put_float(buf, 12, param4);
275  _mav_put_float(buf, 16, param5);
276  _mav_put_float(buf, 20, param6);
277  _mav_put_float(buf, 24, param7);
278  _mav_put_uint16_t(buf, 28, command);
281  _mav_put_uint8_t(buf, 32, confirmation);
282 
283 #if MAVLINK_CRC_EXTRA
285 #else
286  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, buf, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
287 #endif
288 #else
290  packet->param1 = param1;
291  packet->param2 = param2;
292  packet->param3 = param3;
293  packet->param4 = param4;
294  packet->param5 = param5;
295  packet->param6 = param6;
296  packet->param7 = param7;
297  packet->command = command;
298  packet->target_system = target_system;
300  packet->confirmation = confirmation;
301 
302 #if MAVLINK_CRC_EXTRA
303  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN, MAVLINK_MSG_ID_COMMAND_LONG_CRC);
304 #else
305  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)packet, MAVLINK_MSG_ID_COMMAND_LONG_LEN);
306 #endif
307 #endif
308 }
309 #endif
310 
311 #endif
312 
313 // MESSAGE COMMAND_LONG UNPACKING
314 
315 
321 static inline uint8_t mavlink_msg_command_long_get_target_system(const mavlink_message_t* msg)
322 {
323  return _MAV_RETURN_uint8_t(msg, 30);
324 }
325 
331 static inline uint8_t mavlink_msg_command_long_get_target_component(const mavlink_message_t* msg)
332 {
333  return _MAV_RETURN_uint8_t(msg, 31);
334 }
335 
341 static inline uint16_t mavlink_msg_command_long_get_command(const mavlink_message_t* msg)
342 {
343  return _MAV_RETURN_uint16_t(msg, 28);
344 }
345 
351 static inline uint8_t mavlink_msg_command_long_get_confirmation(const mavlink_message_t* msg)
352 {
353  return _MAV_RETURN_uint8_t(msg, 32);
354 }
355 
361 static inline float mavlink_msg_command_long_get_param1(const mavlink_message_t* msg)
362 {
363  return _MAV_RETURN_float(msg, 0);
364 }
365 
371 static inline float mavlink_msg_command_long_get_param2(const mavlink_message_t* msg)
372 {
373  return _MAV_RETURN_float(msg, 4);
374 }
375 
381 static inline float mavlink_msg_command_long_get_param3(const mavlink_message_t* msg)
382 {
383  return _MAV_RETURN_float(msg, 8);
384 }
385 
391 static inline float mavlink_msg_command_long_get_param4(const mavlink_message_t* msg)
392 {
393  return _MAV_RETURN_float(msg, 12);
394 }
395 
401 static inline float mavlink_msg_command_long_get_param5(const mavlink_message_t* msg)
402 {
403  return _MAV_RETURN_float(msg, 16);
404 }
405 
411 static inline float mavlink_msg_command_long_get_param6(const mavlink_message_t* msg)
412 {
413  return _MAV_RETURN_float(msg, 20);
414 }
415 
421 static inline float mavlink_msg_command_long_get_param7(const mavlink_message_t* msg)
422 {
423  return _MAV_RETURN_float(msg, 24);
424 }
425 
432 static inline void mavlink_msg_command_long_decode(const mavlink_message_t* msg, mavlink_command_long_t* command_long)
433 {
434 #if MAVLINK_NEED_BYTE_SWAP
435  command_long->param1 = mavlink_msg_command_long_get_param1(msg);
436  command_long->param2 = mavlink_msg_command_long_get_param2(msg);
437  command_long->param3 = mavlink_msg_command_long_get_param3(msg);
438  command_long->param4 = mavlink_msg_command_long_get_param4(msg);
439  command_long->param5 = mavlink_msg_command_long_get_param5(msg);
440  command_long->param6 = mavlink_msg_command_long_get_param6(msg);
441  command_long->param7 = mavlink_msg_command_long_get_param7(msg);
442  command_long->command = mavlink_msg_command_long_get_command(msg);
446 #else
447  memcpy(command_long, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_COMMAND_LONG_LEN);
448 #endif
449 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Oct 24 2019 03:17:18