2 // MESSAGE SAFETY_ALLOWED_AREA PACKING
4 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA 55
7 typedef struct __mavlink_safety_allowed_area_t
{
8 float p1x
; /*< [m] x position 1 / Latitude 1*/
9 float p1y
; /*< [m] y position 1 / Longitude 1*/
10 float p1z
; /*< [m] z position 1 / Altitude 1*/
11 float p2x
; /*< [m] x position 2 / Latitude 2*/
12 float p2y
; /*< [m] y position 2 / Longitude 2*/
13 float p2z
; /*< [m] z position 2 / Altitude 2*/
14 uint8_t frame
; /*< Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.*/
15 } mavlink_safety_allowed_area_t
;
17 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN 25
18 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN 25
19 #define MAVLINK_MSG_ID_55_LEN 25
20 #define MAVLINK_MSG_ID_55_MIN_LEN 25
22 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC 3
23 #define MAVLINK_MSG_ID_55_CRC 3
27 #if MAVLINK_COMMAND_24BIT
28 #define MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA { \
30 "SAFETY_ALLOWED_AREA", \
32 { { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_allowed_area_t, frame) }, \
33 { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_allowed_area_t, p1x) }, \
34 { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_allowed_area_t, p1y) }, \
35 { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_allowed_area_t, p1z) }, \
36 { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_allowed_area_t, p2x) }, \
37 { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_allowed_area_t, p2y) }, \
38 { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_allowed_area_t, p2z) }, \
42 #define MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA { \
43 "SAFETY_ALLOWED_AREA", \
45 { { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_allowed_area_t, frame) }, \
46 { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_allowed_area_t, p1x) }, \
47 { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_allowed_area_t, p1y) }, \
48 { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_allowed_area_t, p1z) }, \
49 { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_allowed_area_t, p2x) }, \
50 { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_allowed_area_t, p2y) }, \
51 { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_allowed_area_t, p2z) }, \
57 * @brief Pack a safety_allowed_area message
58 * @param system_id ID of this system
59 * @param component_id ID of this component (e.g. 200 for IMU)
60 * @param msg The MAVLink message to compress the data into
62 * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
63 * @param p1x [m] x position 1 / Latitude 1
64 * @param p1y [m] y position 1 / Longitude 1
65 * @param p1z [m] z position 1 / Altitude 1
66 * @param p2x [m] x position 2 / Latitude 2
67 * @param p2y [m] y position 2 / Longitude 2
68 * @param p2z [m] z position 2 / Altitude 2
69 * @return length of the message in bytes (excluding serial stream start sign)
71 static inline uint16_t mavlink_msg_safety_allowed_area_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
72 uint8_t frame
, float p1x
, float p1y
, float p1z
, float p2x
, float p2y
, float p2z
)
74 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
75 char buf
[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
];
76 _mav_put_float(buf
, 0, p1x
);
77 _mav_put_float(buf
, 4, p1y
);
78 _mav_put_float(buf
, 8, p1z
);
79 _mav_put_float(buf
, 12, p2x
);
80 _mav_put_float(buf
, 16, p2y
);
81 _mav_put_float(buf
, 20, p2z
);
82 _mav_put_uint8_t(buf
, 24, frame
);
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
86 mavlink_safety_allowed_area_t packet
;
95 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
98 msg
->msgid
= MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
;
99 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
103 * @brief Pack a safety_allowed_area message on a channel
104 * @param system_id ID of this system
105 * @param component_id ID of this component (e.g. 200 for IMU)
106 * @param chan The MAVLink channel this message will be sent over
107 * @param msg The MAVLink message to compress the data into
108 * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
109 * @param p1x [m] x position 1 / Latitude 1
110 * @param p1y [m] y position 1 / Longitude 1
111 * @param p1z [m] z position 1 / Altitude 1
112 * @param p2x [m] x position 2 / Latitude 2
113 * @param p2y [m] y position 2 / Longitude 2
114 * @param p2z [m] z position 2 / Altitude 2
115 * @return length of the message in bytes (excluding serial stream start sign)
117 static inline uint16_t mavlink_msg_safety_allowed_area_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
118 mavlink_message_t
* msg
,
119 uint8_t frame
,float p1x
,float p1y
,float p1z
,float p2x
,float p2y
,float p2z
)
121 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
122 char buf
[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
];
123 _mav_put_float(buf
, 0, p1x
);
124 _mav_put_float(buf
, 4, p1y
);
125 _mav_put_float(buf
, 8, p1z
);
126 _mav_put_float(buf
, 12, p2x
);
127 _mav_put_float(buf
, 16, p2y
);
128 _mav_put_float(buf
, 20, p2z
);
129 _mav_put_uint8_t(buf
, 24, frame
);
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
133 mavlink_safety_allowed_area_t packet
;
140 packet
.frame
= frame
;
142 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
145 msg
->msgid
= MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
;
146 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
150 * @brief Encode a safety_allowed_area struct
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param msg The MAVLink message to compress the data into
155 * @param safety_allowed_area C-struct to read the message contents from
157 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
)
159 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
);
163 * @brief Encode a safety_allowed_area struct on a channel
165 * @param system_id ID of this system
166 * @param component_id ID of this component (e.g. 200 for IMU)
167 * @param chan The MAVLink channel this message will be sent over
168 * @param msg The MAVLink message to compress the data into
169 * @param safety_allowed_area C-struct to read the message contents from
171 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
)
173 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
);
177 * @brief Send a safety_allowed_area message
178 * @param chan MAVLink channel to send the message
180 * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
181 * @param p1x [m] x position 1 / Latitude 1
182 * @param p1y [m] y position 1 / Longitude 1
183 * @param p1z [m] z position 1 / Altitude 1
184 * @param p2x [m] x position 2 / Latitude 2
185 * @param p2y [m] y position 2 / Longitude 2
186 * @param p2z [m] z position 2 / Altitude 2
188 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
190 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
)
192 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char buf
[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
];
194 _mav_put_float(buf
, 0, p1x
);
195 _mav_put_float(buf
, 4, p1y
);
196 _mav_put_float(buf
, 8, p1z
);
197 _mav_put_float(buf
, 12, p2x
);
198 _mav_put_float(buf
, 16, p2y
);
199 _mav_put_float(buf
, 20, p2z
);
200 _mav_put_uint8_t(buf
, 24, frame
);
202 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, buf
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
204 mavlink_safety_allowed_area_t packet
;
211 packet
.frame
= frame
;
213 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, (const char *)&packet
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
218 * @brief Send a safety_allowed_area message
219 * @param chan MAVLink channel to send the message
220 * @param struct The MAVLink struct to serialize
222 static inline void mavlink_msg_safety_allowed_area_send_struct(mavlink_channel_t chan
, const mavlink_safety_allowed_area_t
* safety_allowed_area
)
224 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
225 mavlink_msg_safety_allowed_area_send(chan
, 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
);
227 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, (const char *)safety_allowed_area
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
231 #if MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
233 This varient of _send() can be used to save stack space by re-using
234 memory from the receive buffer. The caller provides a
235 mavlink_message_t which is the size of a full mavlink message. This
236 is usually the receive buffer for the channel, and allows a reply to an
237 incoming message with minimum stack space usage.
239 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
)
241 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242 char *buf
= (char *)msgbuf
;
243 _mav_put_float(buf
, 0, p1x
);
244 _mav_put_float(buf
, 4, p1y
);
245 _mav_put_float(buf
, 8, p1z
);
246 _mav_put_float(buf
, 12, p2x
);
247 _mav_put_float(buf
, 16, p2y
);
248 _mav_put_float(buf
, 20, p2z
);
249 _mav_put_uint8_t(buf
, 24, frame
);
251 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, buf
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
253 mavlink_safety_allowed_area_t
*packet
= (mavlink_safety_allowed_area_t
*)msgbuf
;
260 packet
->frame
= frame
;
262 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, (const char *)packet
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
269 // MESSAGE SAFETY_ALLOWED_AREA UNPACKING
273 * @brief Get field frame from safety_allowed_area message
275 * @return Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
277 static inline uint8_t mavlink_msg_safety_allowed_area_get_frame(const mavlink_message_t
* msg
)
279 return _MAV_RETURN_uint8_t(msg
, 24);
283 * @brief Get field p1x from safety_allowed_area message
285 * @return [m] x position 1 / Latitude 1
287 static inline float mavlink_msg_safety_allowed_area_get_p1x(const mavlink_message_t
* msg
)
289 return _MAV_RETURN_float(msg
, 0);
293 * @brief Get field p1y from safety_allowed_area message
295 * @return [m] y position 1 / Longitude 1
297 static inline float mavlink_msg_safety_allowed_area_get_p1y(const mavlink_message_t
* msg
)
299 return _MAV_RETURN_float(msg
, 4);
303 * @brief Get field p1z from safety_allowed_area message
305 * @return [m] z position 1 / Altitude 1
307 static inline float mavlink_msg_safety_allowed_area_get_p1z(const mavlink_message_t
* msg
)
309 return _MAV_RETURN_float(msg
, 8);
313 * @brief Get field p2x from safety_allowed_area message
315 * @return [m] x position 2 / Latitude 2
317 static inline float mavlink_msg_safety_allowed_area_get_p2x(const mavlink_message_t
* msg
)
319 return _MAV_RETURN_float(msg
, 12);
323 * @brief Get field p2y from safety_allowed_area message
325 * @return [m] y position 2 / Longitude 2
327 static inline float mavlink_msg_safety_allowed_area_get_p2y(const mavlink_message_t
* msg
)
329 return _MAV_RETURN_float(msg
, 16);
333 * @brief Get field p2z from safety_allowed_area message
335 * @return [m] z position 2 / Altitude 2
337 static inline float mavlink_msg_safety_allowed_area_get_p2z(const mavlink_message_t
* msg
)
339 return _MAV_RETURN_float(msg
, 20);
343 * @brief Decode a safety_allowed_area message into a struct
345 * @param msg The message to decode
346 * @param safety_allowed_area C-struct to decode the message contents into
348 static inline void mavlink_msg_safety_allowed_area_decode(const mavlink_message_t
* msg
, mavlink_safety_allowed_area_t
* safety_allowed_area
)
350 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
351 safety_allowed_area
->p1x
= mavlink_msg_safety_allowed_area_get_p1x(msg
);
352 safety_allowed_area
->p1y
= mavlink_msg_safety_allowed_area_get_p1y(msg
);
353 safety_allowed_area
->p1z
= mavlink_msg_safety_allowed_area_get_p1z(msg
);
354 safety_allowed_area
->p2x
= mavlink_msg_safety_allowed_area_get_p2x(msg
);
355 safety_allowed_area
->p2y
= mavlink_msg_safety_allowed_area_get_p2y(msg
);
356 safety_allowed_area
->p2z
= mavlink_msg_safety_allowed_area_get_p2z(msg
);
357 safety_allowed_area
->frame
= mavlink_msg_safety_allowed_area_get_frame(msg
);
359 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
? msg
->len
: MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
;
360 memset(safety_allowed_area
, 0, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
361 memcpy(safety_allowed_area
, _MAV_PAYLOAD(msg
), len
);