1 // MESSAGE SAFETY_ALLOWED_AREA PACKING
3 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA 55
5 typedef struct __mavlink_safety_allowed_area_t
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.
14 } mavlink_safety_allowed_area_t
;
16 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN 25
17 #define MAVLINK_MSG_ID_55_LEN 25
19 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC 3
20 #define MAVLINK_MSG_ID_55_CRC 3
24 #define MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA { \
25 "SAFETY_ALLOWED_AREA", \
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) }, \
39 * @brief Pack a safety_allowed_area message
40 * @param system_id ID of this system
41 * @param component_id ID of this component (e.g. 200 for IMU)
42 * @param msg The MAVLink message to compress the data into
44 * @param 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.
45 * @param p1x x position 1 / Latitude 1
46 * @param p1y y position 1 / Longitude 1
47 * @param p1z z position 1 / Altitude 1
48 * @param p2x x position 2 / Latitude 2
49 * @param p2y y position 2 / Longitude 2
50 * @param p2z z position 2 / Altitude 2
51 * @return length of the message in bytes (excluding serial stream start sign)
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
)
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
57 char buf
[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
];
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
);
66 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
68 mavlink_safety_allowed_area_t packet
;
77 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
80 msg
->msgid
= MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
;
82 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
84 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
89 * @brief Pack a safety_allowed_area message on a channel
90 * @param system_id ID of this system
91 * @param component_id ID of this component (e.g. 200 for IMU)
92 * @param chan The MAVLink channel this message will be sent over
93 * @param msg The MAVLink message to compress the data into
94 * @param 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.
95 * @param p1x x position 1 / Latitude 1
96 * @param p1y y position 1 / Longitude 1
97 * @param p1z z position 1 / Altitude 1
98 * @param p2x x position 2 / Latitude 2
99 * @param p2y y position 2 / Longitude 2
100 * @param p2z z position 2 / Altitude 2
101 * @return length of the message in bytes (excluding serial stream start sign)
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
)
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
108 char buf
[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
];
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
);
117 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
119 mavlink_safety_allowed_area_t packet
;
126 packet
.frame
= frame
;
128 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
131 msg
->msgid
= MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
;
132 #if MAVLINK_CRC_EXTRA
133 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
135 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
140 * @brief Encode a safety_allowed_area struct
142 * @param system_id ID of this system
143 * @param component_id ID of this component (e.g. 200 for IMU)
144 * @param msg The MAVLink message to compress the data into
145 * @param safety_allowed_area C-struct to read the message contents from
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
)
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
);
153 * @brief Encode a safety_allowed_area struct on a channel
155 * @param system_id ID of this system
156 * @param component_id ID of this component (e.g. 200 for IMU)
157 * @param chan The MAVLink channel this message will be sent over
158 * @param msg The MAVLink message to compress the data into
159 * @param safety_allowed_area C-struct to read the message contents from
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
)
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
);
167 * @brief Send a safety_allowed_area message
168 * @param chan MAVLink channel to send the message
170 * @param 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.
171 * @param p1x x position 1 / Latitude 1
172 * @param p1y y position 1 / Longitude 1
173 * @param p1z z position 1 / Altitude 1
174 * @param p2x x position 2 / Latitude 2
175 * @param p2y y position 2 / Longitude 2
176 * @param p2z z position 2 / Altitude 2
178 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
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
)
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 char buf
[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
];
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
);
192 #if MAVLINK_CRC_EXTRA
193 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, buf
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
195 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, buf
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
198 mavlink_safety_allowed_area_t packet
;
205 packet
.frame
= frame
;
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
);
210 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, (const char *)&packet
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
215 #if MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
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.
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
)
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
);
235 #if MAVLINK_CRC_EXTRA
236 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, buf
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC
);
238 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, buf
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
241 mavlink_safety_allowed_area_t
*packet
= (mavlink_safety_allowed_area_t
*)msgbuf
;
248 packet
->frame
= frame
;
250 #if MAVLINK_CRC_EXTRA
251 _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
);
253 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA
, (const char *)packet
, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);
261 // MESSAGE SAFETY_ALLOWED_AREA UNPACKING
265 * @brief Get field frame from safety_allowed_area message
267 * @return 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.
269 static inline uint8_t mavlink_msg_safety_allowed_area_get_frame(const mavlink_message_t
* msg
)
271 return _MAV_RETURN_uint8_t(msg
, 24);
275 * @brief Get field p1x from safety_allowed_area message
277 * @return x position 1 / Latitude 1
279 static inline float mavlink_msg_safety_allowed_area_get_p1x(const mavlink_message_t
* msg
)
281 return _MAV_RETURN_float(msg
, 0);
285 * @brief Get field p1y from safety_allowed_area message
287 * @return y position 1 / Longitude 1
289 static inline float mavlink_msg_safety_allowed_area_get_p1y(const mavlink_message_t
* msg
)
291 return _MAV_RETURN_float(msg
, 4);
295 * @brief Get field p1z from safety_allowed_area message
297 * @return z position 1 / Altitude 1
299 static inline float mavlink_msg_safety_allowed_area_get_p1z(const mavlink_message_t
* msg
)
301 return _MAV_RETURN_float(msg
, 8);
305 * @brief Get field p2x from safety_allowed_area message
307 * @return x position 2 / Latitude 2
309 static inline float mavlink_msg_safety_allowed_area_get_p2x(const mavlink_message_t
* msg
)
311 return _MAV_RETURN_float(msg
, 12);
315 * @brief Get field p2y from safety_allowed_area message
317 * @return y position 2 / Longitude 2
319 static inline float mavlink_msg_safety_allowed_area_get_p2y(const mavlink_message_t
* msg
)
321 return _MAV_RETURN_float(msg
, 16);
325 * @brief Get field p2z from safety_allowed_area message
327 * @return z position 2 / Altitude 2
329 static inline float mavlink_msg_safety_allowed_area_get_p2z(const mavlink_message_t
* msg
)
331 return _MAV_RETURN_float(msg
, 20);
335 * @brief Decode a safety_allowed_area message into a struct
337 * @param msg The message to decode
338 * @param safety_allowed_area C-struct to decode the message contents into
340 static inline void mavlink_msg_safety_allowed_area_decode(const mavlink_message_t
* msg
, mavlink_safety_allowed_area_t
* safety_allowed_area
)
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
);
351 memcpy(safety_allowed_area
, _MAV_PAYLOAD(msg
), MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN
);