mavlink_msg_safety_allowed_area.h
Go to the documentation of this file.
1 // MESSAGE SAFETY_ALLOWED_AREA PACKING
2 
3 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA 55
4 
6 {
7  float p1x; /*< x position 1 / Latitude 1*/
8  float p1y; /*< y position 1 / Longitude 1*/
9  float p1z; /*< z position 1 / Altitude 1*/
10  float p2x; /*< x position 2 / Latitude 2*/
11  float p2y; /*< y position 2 / Longitude 2*/
12  float p2z; /*< z position 2 / Altitude 2*/
13  uint8_t frame; /*< Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.*/
15 
16 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN 25
17 #define MAVLINK_MSG_ID_55_LEN 25
18 
19 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC 3
20 #define MAVLINK_MSG_ID_55_CRC 3
21 
22 
23 
24 #define MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA { \
25  "SAFETY_ALLOWED_AREA", \
26  7, \
27  { { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_allowed_area_t, p1x) }, \
28  { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_allowed_area_t, p1y) }, \
29  { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_allowed_area_t, p1z) }, \
30  { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_allowed_area_t, p2x) }, \
31  { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_allowed_area_t, p2y) }, \
32  { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_allowed_area_t, p2z) }, \
33  { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_allowed_area_t, frame) }, \
34  } \
35 }
36 
37 
53 static inline uint16_t mavlink_msg_safety_allowed_area_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54  uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
55 {
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
58  _mav_put_float(buf, 0, p1x);
59  _mav_put_float(buf, 4, p1y);
60  _mav_put_float(buf, 8, p1z);
61  _mav_put_float(buf, 12, p2x);
62  _mav_put_float(buf, 16, p2y);
63  _mav_put_float(buf, 20, p2z);
64  _mav_put_uint8_t(buf, 24, frame);
65 
67 #else
69  packet.p1x = p1x;
70  packet.p1y = p1y;
71  packet.p1z = p1z;
72  packet.p2x = p2x;
73  packet.p2y = p2y;
74  packet.p2z = p2z;
75  packet.frame = frame;
76 
78 #endif
79 
81 #if MAVLINK_CRC_EXTRA
83 #else
84  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
85 #endif
86 }
87 
103 static inline uint16_t mavlink_msg_safety_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104  mavlink_message_t* msg,
105  uint8_t frame,float p1x,float p1y,float p1z,float p2x,float p2y,float p2z)
106 {
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
109  _mav_put_float(buf, 0, p1x);
110  _mav_put_float(buf, 4, p1y);
111  _mav_put_float(buf, 8, p1z);
112  _mav_put_float(buf, 12, p2x);
113  _mav_put_float(buf, 16, p2y);
114  _mav_put_float(buf, 20, p2z);
115  _mav_put_uint8_t(buf, 24, frame);
116 
118 #else
120  packet.p1x = p1x;
121  packet.p1y = p1y;
122  packet.p1z = p1z;
123  packet.p2x = p2x;
124  packet.p2y = p2y;
125  packet.p2z = p2z;
126  packet.frame = frame;
127 
129 #endif
130 
132 #if MAVLINK_CRC_EXTRA
134 #else
135  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
136 #endif
137 }
138 
147 static inline uint16_t mavlink_msg_safety_allowed_area_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_safety_allowed_area_t* safety_allowed_area)
148 {
149  return mavlink_msg_safety_allowed_area_pack(system_id, component_id, msg, safety_allowed_area->frame, safety_allowed_area->p1x, safety_allowed_area->p1y, safety_allowed_area->p1z, safety_allowed_area->p2x, safety_allowed_area->p2y, safety_allowed_area->p2z);
150 }
151 
161 static inline uint16_t mavlink_msg_safety_allowed_area_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_safety_allowed_area_t* safety_allowed_area)
162 {
163  return mavlink_msg_safety_allowed_area_pack_chan(system_id, component_id, chan, msg, safety_allowed_area->frame, safety_allowed_area->p1x, safety_allowed_area->p1y, safety_allowed_area->p1z, safety_allowed_area->p2x, safety_allowed_area->p2y, safety_allowed_area->p2z);
164 }
165 
178 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179 
180 static inline void mavlink_msg_safety_allowed_area_send(mavlink_channel_t chan, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
181 {
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184  _mav_put_float(buf, 0, p1x);
185  _mav_put_float(buf, 4, p1y);
186  _mav_put_float(buf, 8, p1z);
187  _mav_put_float(buf, 12, p2x);
188  _mav_put_float(buf, 16, p2y);
189  _mav_put_float(buf, 20, p2z);
190  _mav_put_uint8_t(buf, 24, frame);
191 
192 #if MAVLINK_CRC_EXTRA
194 #else
195  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
196 #endif
197 #else
199  packet.p1x = p1x;
200  packet.p1y = p1y;
201  packet.p1z = p1z;
202  packet.p2x = p2x;
203  packet.p2y = p2y;
204  packet.p2z = p2z;
205  packet.frame = frame;
206 
207 #if MAVLINK_CRC_EXTRA
208  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, (const char *)&packet, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC);
209 #else
210  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, (const char *)&packet, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
211 #endif
212 #endif
213 }
214 
215 #if MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
216 /*
217  This varient of _send() can be used to save stack space by re-using
218  memory from the receive buffer. The caller provides a
219  mavlink_message_t which is the size of a full mavlink message. This
220  is usually the receive buffer for the channel, and allows a reply to an
221  incoming message with minimum stack space usage.
222  */
223 static inline void mavlink_msg_safety_allowed_area_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
224 {
225 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226  char *buf = (char *)msgbuf;
227  _mav_put_float(buf, 0, p1x);
228  _mav_put_float(buf, 4, p1y);
229  _mav_put_float(buf, 8, p1z);
230  _mav_put_float(buf, 12, p2x);
231  _mav_put_float(buf, 16, p2y);
232  _mav_put_float(buf, 20, p2z);
233  _mav_put_uint8_t(buf, 24, frame);
234 
235 #if MAVLINK_CRC_EXTRA
237 #else
238  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
239 #endif
240 #else
242  packet->p1x = p1x;
243  packet->p1y = p1y;
244  packet->p1z = p1z;
245  packet->p2x = p2x;
246  packet->p2y = p2y;
247  packet->p2z = p2z;
248  packet->frame = frame;
249 
250 #if MAVLINK_CRC_EXTRA
252 #else
253  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, (const char *)packet, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
254 #endif
255 #endif
256 }
257 #endif
258 
259 #endif
260 
261 // MESSAGE SAFETY_ALLOWED_AREA UNPACKING
262 
263 
269 static inline uint8_t mavlink_msg_safety_allowed_area_get_frame(const mavlink_message_t* msg)
270 {
271  return _MAV_RETURN_uint8_t(msg, 24);
272 }
273 
279 static inline float mavlink_msg_safety_allowed_area_get_p1x(const mavlink_message_t* msg)
280 {
281  return _MAV_RETURN_float(msg, 0);
282 }
283 
289 static inline float mavlink_msg_safety_allowed_area_get_p1y(const mavlink_message_t* msg)
290 {
291  return _MAV_RETURN_float(msg, 4);
292 }
293 
299 static inline float mavlink_msg_safety_allowed_area_get_p1z(const mavlink_message_t* msg)
300 {
301  return _MAV_RETURN_float(msg, 8);
302 }
303 
309 static inline float mavlink_msg_safety_allowed_area_get_p2x(const mavlink_message_t* msg)
310 {
311  return _MAV_RETURN_float(msg, 12);
312 }
313 
319 static inline float mavlink_msg_safety_allowed_area_get_p2y(const mavlink_message_t* msg)
320 {
321  return _MAV_RETURN_float(msg, 16);
322 }
323 
329 static inline float mavlink_msg_safety_allowed_area_get_p2z(const mavlink_message_t* msg)
330 {
331  return _MAV_RETURN_float(msg, 20);
332 }
333 
340 static inline void mavlink_msg_safety_allowed_area_decode(const mavlink_message_t* msg, mavlink_safety_allowed_area_t* safety_allowed_area)
341 {
342 #if MAVLINK_NEED_BYTE_SWAP
343  safety_allowed_area->p1x = mavlink_msg_safety_allowed_area_get_p1x(msg);
344  safety_allowed_area->p1y = mavlink_msg_safety_allowed_area_get_p1y(msg);
345  safety_allowed_area->p1z = mavlink_msg_safety_allowed_area_get_p1z(msg);
346  safety_allowed_area->p2x = mavlink_msg_safety_allowed_area_get_p2x(msg);
347  safety_allowed_area->p2y = mavlink_msg_safety_allowed_area_get_p2y(msg);
348  safety_allowed_area->p2z = mavlink_msg_safety_allowed_area_get_p2z(msg);
349  safety_allowed_area->frame = mavlink_msg_safety_allowed_area_get_frame(msg);
350 #else
351  memcpy(safety_allowed_area, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
352 #endif
353 }
#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


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:25