NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_rally_point.h
Go to the documentation of this file.
1 // MESSAGE RALLY_POINT PACKING
2 
3 #define MAVLINK_MSG_ID_RALLY_POINT 175
4 
5 typedef struct __mavlink_rally_point_t
6 {
7  int32_t lat;
8  int32_t lng;
9  int16_t alt;
10  int16_t break_alt;
11  uint16_t land_dir;
12  uint8_t target_system;
13  uint8_t target_component;
14  uint8_t idx;
15  uint8_t count;
16  uint8_t flags;
18 
19 #define MAVLINK_MSG_ID_RALLY_POINT_LEN 19
20 #define MAVLINK_MSG_ID_175_LEN 19
21 
22 #define MAVLINK_MSG_ID_RALLY_POINT_CRC 138
23 #define MAVLINK_MSG_ID_175_CRC 138
24 
25 
26 
27 #define MAVLINK_MESSAGE_INFO_RALLY_POINT { \
28  "RALLY_POINT", \
29  10, \
30  { { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_rally_point_t, lat) }, \
31  { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_rally_point_t, lng) }, \
32  { "alt", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_rally_point_t, alt) }, \
33  { "break_alt", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_rally_point_t, break_alt) }, \
34  { "land_dir", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rally_point_t, land_dir) }, \
35  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_rally_point_t, target_system) }, \
36  { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_rally_point_t, target_component) }, \
37  { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_rally_point_t, idx) }, \
38  { "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_rally_point_t, count) }, \
39  { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_rally_point_t, flags) }, \
40  } \
41 }
42 
43 
62 static inline uint16_t mavlink_msg_rally_point_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
63  uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, int32_t lat, int32_t lng, int16_t alt, int16_t break_alt, uint16_t land_dir, uint8_t flags)
64 {
65 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
67  _mav_put_int32_t(buf, 0, lat);
68  _mav_put_int32_t(buf, 4, lng);
69  _mav_put_int16_t(buf, 8, alt);
70  _mav_put_int16_t(buf, 10, break_alt);
71  _mav_put_uint16_t(buf, 12, land_dir);
72  _mav_put_uint8_t(buf, 14, target_system);
73  _mav_put_uint8_t(buf, 15, target_component);
74  _mav_put_uint8_t(buf, 16, idx);
75  _mav_put_uint8_t(buf, 17, count);
76  _mav_put_uint8_t(buf, 18, flags);
77 
79 #else
80  mavlink_rally_point_t packet;
81  packet.lat = lat;
82  packet.lng = lng;
83  packet.alt = alt;
84  packet.break_alt = break_alt;
85  packet.land_dir = land_dir;
86  packet.target_system = target_system;
87  packet.target_component = target_component;
88  packet.idx = idx;
89  packet.count = count;
90  packet.flags = flags;
91 
93 #endif
94 
95  msg->msgid = MAVLINK_MSG_ID_RALLY_POINT;
96 #if MAVLINK_CRC_EXTRA
98 #else
99  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RALLY_POINT_LEN);
100 #endif
101 }
102 
121 static inline uint16_t mavlink_msg_rally_point_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
122  mavlink_message_t* msg,
123  uint8_t target_system,uint8_t target_component,uint8_t idx,uint8_t count,int32_t lat,int32_t lng,int16_t alt,int16_t break_alt,uint16_t land_dir,uint8_t flags)
124 {
125 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
127  _mav_put_int32_t(buf, 0, lat);
128  _mav_put_int32_t(buf, 4, lng);
129  _mav_put_int16_t(buf, 8, alt);
130  _mav_put_int16_t(buf, 10, break_alt);
131  _mav_put_uint16_t(buf, 12, land_dir);
132  _mav_put_uint8_t(buf, 14, target_system);
133  _mav_put_uint8_t(buf, 15, target_component);
134  _mav_put_uint8_t(buf, 16, idx);
135  _mav_put_uint8_t(buf, 17, count);
136  _mav_put_uint8_t(buf, 18, flags);
137 
139 #else
140  mavlink_rally_point_t packet;
141  packet.lat = lat;
142  packet.lng = lng;
143  packet.alt = alt;
144  packet.break_alt = break_alt;
145  packet.land_dir = land_dir;
146  packet.target_system = target_system;
147  packet.target_component = target_component;
148  packet.idx = idx;
149  packet.count = count;
150  packet.flags = flags;
151 
153 #endif
154 
155  msg->msgid = MAVLINK_MSG_ID_RALLY_POINT;
156 #if MAVLINK_CRC_EXTRA
158 #else
159  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RALLY_POINT_LEN);
160 #endif
161 }
162 
171 static inline uint16_t mavlink_msg_rally_point_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_rally_point_t* rally_point)
172 {
173  return mavlink_msg_rally_point_pack(system_id, component_id, msg, rally_point->target_system, rally_point->target_component, rally_point->idx, rally_point->count, rally_point->lat, rally_point->lng, rally_point->alt, rally_point->break_alt, rally_point->land_dir, rally_point->flags);
174 }
175 
185 static inline uint16_t mavlink_msg_rally_point_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_rally_point_t* rally_point)
186 {
187  return mavlink_msg_rally_point_pack_chan(system_id, component_id, chan, msg, rally_point->target_system, rally_point->target_component, rally_point->idx, rally_point->count, rally_point->lat, rally_point->lng, rally_point->alt, rally_point->break_alt, rally_point->land_dir, rally_point->flags);
188 }
189 
205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
206 
207 static inline void mavlink_msg_rally_point_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, int32_t lat, int32_t lng, int16_t alt, int16_t break_alt, uint16_t land_dir, uint8_t flags)
208 {
209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
211  _mav_put_int32_t(buf, 0, lat);
212  _mav_put_int32_t(buf, 4, lng);
213  _mav_put_int16_t(buf, 8, alt);
214  _mav_put_int16_t(buf, 10, break_alt);
215  _mav_put_uint16_t(buf, 12, land_dir);
216  _mav_put_uint8_t(buf, 14, target_system);
217  _mav_put_uint8_t(buf, 15, target_component);
218  _mav_put_uint8_t(buf, 16, idx);
219  _mav_put_uint8_t(buf, 17, count);
220  _mav_put_uint8_t(buf, 18, flags);
221 
222 #if MAVLINK_CRC_EXTRA
224 #else
225  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, buf, MAVLINK_MSG_ID_RALLY_POINT_LEN);
226 #endif
227 #else
228  mavlink_rally_point_t packet;
229  packet.lat = lat;
230  packet.lng = lng;
231  packet.alt = alt;
232  packet.break_alt = break_alt;
233  packet.land_dir = land_dir;
234  packet.target_system = target_system;
235  packet.target_component = target_component;
236  packet.idx = idx;
237  packet.count = count;
238  packet.flags = flags;
239 
240 #if MAVLINK_CRC_EXTRA
241  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, (const char *)&packet, MAVLINK_MSG_ID_RALLY_POINT_LEN, MAVLINK_MSG_ID_RALLY_POINT_CRC);
242 #else
243  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, (const char *)&packet, MAVLINK_MSG_ID_RALLY_POINT_LEN);
244 #endif
245 #endif
246 }
247 
248 #if MAVLINK_MSG_ID_RALLY_POINT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
249 /*
250  This varient of _send() can be used to save stack space by re-using
251  memory from the receive buffer. The caller provides a
252  mavlink_message_t which is the size of a full mavlink message. This
253  is usually the receive buffer for the channel, and allows a reply to an
254  incoming message with minimum stack space usage.
255  */
256 static inline void mavlink_msg_rally_point_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, int32_t lat, int32_t lng, int16_t alt, int16_t break_alt, uint16_t land_dir, uint8_t flags)
257 {
258 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
259  char *buf = (char *)msgbuf;
260  _mav_put_int32_t(buf, 0, lat);
261  _mav_put_int32_t(buf, 4, lng);
262  _mav_put_int16_t(buf, 8, alt);
263  _mav_put_int16_t(buf, 10, break_alt);
264  _mav_put_uint16_t(buf, 12, land_dir);
265  _mav_put_uint8_t(buf, 14, target_system);
266  _mav_put_uint8_t(buf, 15, target_component);
267  _mav_put_uint8_t(buf, 16, idx);
268  _mav_put_uint8_t(buf, 17, count);
269  _mav_put_uint8_t(buf, 18, flags);
270 
271 #if MAVLINK_CRC_EXTRA
273 #else
274  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, buf, MAVLINK_MSG_ID_RALLY_POINT_LEN);
275 #endif
276 #else
277  mavlink_rally_point_t *packet = (mavlink_rally_point_t *)msgbuf;
278  packet->lat = lat;
279  packet->lng = lng;
280  packet->alt = alt;
281  packet->break_alt = break_alt;
282  packet->land_dir = land_dir;
283  packet->target_system = target_system;
284  packet->target_component = target_component;
285  packet->idx = idx;
286  packet->count = count;
287  packet->flags = flags;
288 
289 #if MAVLINK_CRC_EXTRA
290  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, (const char *)packet, MAVLINK_MSG_ID_RALLY_POINT_LEN, MAVLINK_MSG_ID_RALLY_POINT_CRC);
291 #else
292  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RALLY_POINT, (const char *)packet, MAVLINK_MSG_ID_RALLY_POINT_LEN);
293 #endif
294 #endif
295 }
296 #endif
297 
298 #endif
299 
300 // MESSAGE RALLY_POINT UNPACKING
301 
302 
308 static inline uint8_t mavlink_msg_rally_point_get_target_system(const mavlink_message_t* msg)
309 {
310  return _MAV_RETURN_uint8_t(msg, 14);
311 }
312 
318 static inline uint8_t mavlink_msg_rally_point_get_target_component(const mavlink_message_t* msg)
319 {
320  return _MAV_RETURN_uint8_t(msg, 15);
321 }
322 
328 static inline uint8_t mavlink_msg_rally_point_get_idx(const mavlink_message_t* msg)
329 {
330  return _MAV_RETURN_uint8_t(msg, 16);
331 }
332 
338 static inline uint8_t mavlink_msg_rally_point_get_count(const mavlink_message_t* msg)
339 {
340  return _MAV_RETURN_uint8_t(msg, 17);
341 }
342 
348 static inline int32_t mavlink_msg_rally_point_get_lat(const mavlink_message_t* msg)
349 {
350  return _MAV_RETURN_int32_t(msg, 0);
351 }
352 
358 static inline int32_t mavlink_msg_rally_point_get_lng(const mavlink_message_t* msg)
359 {
360  return _MAV_RETURN_int32_t(msg, 4);
361 }
362 
368 static inline int16_t mavlink_msg_rally_point_get_alt(const mavlink_message_t* msg)
369 {
370  return _MAV_RETURN_int16_t(msg, 8);
371 }
372 
378 static inline int16_t mavlink_msg_rally_point_get_break_alt(const mavlink_message_t* msg)
379 {
380  return _MAV_RETURN_int16_t(msg, 10);
381 }
382 
388 static inline uint16_t mavlink_msg_rally_point_get_land_dir(const mavlink_message_t* msg)
389 {
390  return _MAV_RETURN_uint16_t(msg, 12);
391 }
392 
398 static inline uint8_t mavlink_msg_rally_point_get_flags(const mavlink_message_t* msg)
399 {
400  return _MAV_RETURN_uint8_t(msg, 18);
401 }
402 
409 static inline void mavlink_msg_rally_point_decode(const mavlink_message_t* msg, mavlink_rally_point_t* rally_point)
410 {
411 #if MAVLINK_NEED_BYTE_SWAP
412  rally_point->lat = mavlink_msg_rally_point_get_lat(msg);
413  rally_point->lng = mavlink_msg_rally_point_get_lng(msg);
414  rally_point->alt = mavlink_msg_rally_point_get_alt(msg);
415  rally_point->break_alt = mavlink_msg_rally_point_get_break_alt(msg);
416  rally_point->land_dir = mavlink_msg_rally_point_get_land_dir(msg);
417  rally_point->target_system = mavlink_msg_rally_point_get_target_system(msg);
418  rally_point->target_component = mavlink_msg_rally_point_get_target_component(msg);
419  rally_point->idx = mavlink_msg_rally_point_get_idx(msg);
420  rally_point->count = mavlink_msg_rally_point_get_count(msg);
421  rally_point->flags = mavlink_msg_rally_point_get_flags(msg);
422 #else
423  memcpy(rally_point, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_RALLY_POINT_LEN);
424 #endif
425 }
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:238
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:134
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:142
uint16_t flags
Definition: ledstrip.h:11
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139
#define _mav_put_int16_t(buf, wire_offset, b)
Definition: protocol.h:140