Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / mavlink / v1.0 / common / mavlink_msg_command_long.h
blobad481c8d8fba09e31792d16dc214aba65938dbcd
1 // MESSAGE COMMAND_LONG PACKING
3 #define MAVLINK_MSG_ID_COMMAND_LONG 76
5 typedef struct __mavlink_command_long_t {
6 float param1; ///< Parameter 1, as defined by MAV_CMD enum.
7 float param2; ///< Parameter 2, as defined by MAV_CMD enum.
8 float param3; ///< Parameter 3, as defined by MAV_CMD enum.
9 float param4; ///< Parameter 4, as defined by MAV_CMD enum.
10 float param5; ///< Parameter 5, as defined by MAV_CMD enum.
11 float param6; ///< Parameter 6, as defined by MAV_CMD enum.
12 float param7; ///< Parameter 7, as defined by MAV_CMD enum.
13 uint16_t command; ///< Command ID, as defined by MAV_CMD enum.
14 uint8_t target_system; ///< System which should execute the command
15 uint8_t target_component; ///< Component which should execute the command, 0 for all components
16 uint8_t confirmation; ///< 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
17 } mavlink_command_long_t;
19 #define MAVLINK_MSG_ID_COMMAND_LONG_LEN 33
20 #define MAVLINK_MSG_ID_76_LEN 33
23 #define MAVLINK_MESSAGE_INFO_COMMAND_LONG \
24 { \
25 "COMMAND_LONG", \
26 11, \
27 { \
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 } \
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
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)
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)
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);
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;
94 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 33);
95 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
97 msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG;
98 return mavlink_finalize_message(msg, system_id, component_id, 33, 152);
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)
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)
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);
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;
153 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 33);
154 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
156 msg->msgid = MAVLINK_MSG_ID_COMMAND_LONG;
157 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 33, 152);
161 * @brief Encode a command_long struct into a message
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
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)
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);
174 * @brief Send a command_long message
175 * @param chan MAVLink channel to send the message
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.
189 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
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)
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);
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;
222 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_LONG, (const char *)&packet, 33, 152);
223 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
228 // MESSAGE COMMAND_LONG UNPACKING
232 * @brief Get field target_system from command_long message
234 * @return System which should execute the command
236 static inline uint8_t mavlink_msg_command_long_get_target_system(const mavlink_message_t *msg)
238 return _MAV_RETURN_uint8_t(msg, 30);
242 * @brief Get field target_component from command_long message
244 * @return Component which should execute the command, 0 for all components
246 static inline uint8_t mavlink_msg_command_long_get_target_component(const mavlink_message_t *msg)
248 return _MAV_RETURN_uint8_t(msg, 31);
252 * @brief Get field command from command_long message
254 * @return Command ID, as defined by MAV_CMD enum.
256 static inline uint16_t mavlink_msg_command_long_get_command(const mavlink_message_t *msg)
258 return _MAV_RETURN_uint16_t(msg, 28);
262 * @brief Get field confirmation from command_long message
264 * @return 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
266 static inline uint8_t mavlink_msg_command_long_get_confirmation(const mavlink_message_t *msg)
268 return _MAV_RETURN_uint8_t(msg, 32);
272 * @brief Get field param1 from command_long message
274 * @return Parameter 1, as defined by MAV_CMD enum.
276 static inline float mavlink_msg_command_long_get_param1(const mavlink_message_t *msg)
278 return _MAV_RETURN_float(msg, 0);
282 * @brief Get field param2 from command_long message
284 * @return Parameter 2, as defined by MAV_CMD enum.
286 static inline float mavlink_msg_command_long_get_param2(const mavlink_message_t *msg)
288 return _MAV_RETURN_float(msg, 4);
292 * @brief Get field param3 from command_long message
294 * @return Parameter 3, as defined by MAV_CMD enum.
296 static inline float mavlink_msg_command_long_get_param3(const mavlink_message_t *msg)
298 return _MAV_RETURN_float(msg, 8);
302 * @brief Get field param4 from command_long message
304 * @return Parameter 4, as defined by MAV_CMD enum.
306 static inline float mavlink_msg_command_long_get_param4(const mavlink_message_t *msg)
308 return _MAV_RETURN_float(msg, 12);
312 * @brief Get field param5 from command_long message
314 * @return Parameter 5, as defined by MAV_CMD enum.
316 static inline float mavlink_msg_command_long_get_param5(const mavlink_message_t *msg)
318 return _MAV_RETURN_float(msg, 16);
322 * @brief Get field param6 from command_long message
324 * @return Parameter 6, as defined by MAV_CMD enum.
326 static inline float mavlink_msg_command_long_get_param6(const mavlink_message_t *msg)
328 return _MAV_RETURN_float(msg, 20);
332 * @brief Get field param7 from command_long message
334 * @return Parameter 7, as defined by MAV_CMD enum.
336 static inline float mavlink_msg_command_long_get_param7(const mavlink_message_t *msg)
338 return _MAV_RETURN_float(msg, 24);
342 * @brief Decode a command_long message into a struct
344 * @param msg The message to decode
345 * @param command_long C-struct to decode the message contents into
347 static inline void mavlink_msg_command_long_decode(const mavlink_message_t *msg, mavlink_command_long_t *command_long)
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