1 // MESSAGE SAFETY_SET_ALLOWED_AREA PACKING
3 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA 54
5 typedef struct __mavlink_safety_set_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 target_system
; ///< System ID
14 uint8_t target_component
; ///< Component ID
15 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.
16 } mavlink_safety_set_allowed_area_t
;
18 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN 27
19 #define MAVLINK_MSG_ID_54_LEN 27
21 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC 15
22 #define MAVLINK_MSG_ID_54_CRC 15
26 #define MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA { \
27 "SAFETY_SET_ALLOWED_AREA", \
29 { { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_set_allowed_area_t, p1x) }, \
30 { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_set_allowed_area_t, p1y) }, \
31 { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_set_allowed_area_t, p1z) }, \
32 { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_set_allowed_area_t, p2x) }, \
33 { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_set_allowed_area_t, p2y) }, \
34 { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_set_allowed_area_t, p2z) }, \
35 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_set_allowed_area_t, target_system) }, \
36 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_safety_set_allowed_area_t, target_component) }, \
37 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_safety_set_allowed_area_t, frame) }, \
43 * @brief Pack a safety_set_allowed_area message
44 * @param system_id ID of this system
45 * @param component_id ID of this component (e.g. 200 for IMU)
46 * @param msg The MAVLink message to compress the data into
48 * @param target_system System ID
49 * @param target_component Component ID
50 * @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.
51 * @param p1x x position 1 / Latitude 1
52 * @param p1y y position 1 / Longitude 1
53 * @param p1z z position 1 / Altitude 1
54 * @param p2x x position 2 / Latitude 2
55 * @param p2y y position 2 / Longitude 2
56 * @param p2z z position 2 / Altitude 2
57 * @return length of the message in bytes (excluding serial stream start sign)
59 static inline uint16_t mavlink_msg_safety_set_allowed_area_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
60 uint8_t target_system
, uint8_t target_component
, uint8_t frame
, float p1x
, float p1y
, float p1z
, float p2x
, float p2y
, float p2z
)
62 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
63 char buf
[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
];
64 _mav_put_float(buf
, 0, p1x
);
65 _mav_put_float(buf
, 4, p1y
);
66 _mav_put_float(buf
, 8, p1z
);
67 _mav_put_float(buf
, 12, p2x
);
68 _mav_put_float(buf
, 16, p2y
);
69 _mav_put_float(buf
, 20, p2z
);
70 _mav_put_uint8_t(buf
, 24, target_system
);
71 _mav_put_uint8_t(buf
, 25, target_component
);
72 _mav_put_uint8_t(buf
, 26, frame
);
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);
76 mavlink_safety_set_allowed_area_t packet
;
83 packet
.target_system
= target_system
;
84 packet
.target_component
= target_component
;
87 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);
90 msg
->msgid
= MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
;
92 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC
);
94 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);
99 * @brief Pack a safety_set_allowed_area message on a channel
100 * @param system_id ID of this system
101 * @param component_id ID of this component (e.g. 200 for IMU)
102 * @param chan The MAVLink channel this message will be sent over
103 * @param msg The MAVLink message to compress the data into
104 * @param target_system System ID
105 * @param target_component Component ID
106 * @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.
107 * @param p1x x position 1 / Latitude 1
108 * @param p1y y position 1 / Longitude 1
109 * @param p1z z position 1 / Altitude 1
110 * @param p2x x position 2 / Latitude 2
111 * @param p2y y position 2 / Longitude 2
112 * @param p2z z position 2 / Altitude 2
113 * @return length of the message in bytes (excluding serial stream start sign)
115 static inline uint16_t mavlink_msg_safety_set_allowed_area_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
116 mavlink_message_t
* msg
,
117 uint8_t target_system
,uint8_t target_component
,uint8_t frame
,float p1x
,float p1y
,float p1z
,float p2x
,float p2y
,float p2z
)
119 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
120 char buf
[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
];
121 _mav_put_float(buf
, 0, p1x
);
122 _mav_put_float(buf
, 4, p1y
);
123 _mav_put_float(buf
, 8, p1z
);
124 _mav_put_float(buf
, 12, p2x
);
125 _mav_put_float(buf
, 16, p2y
);
126 _mav_put_float(buf
, 20, p2z
);
127 _mav_put_uint8_t(buf
, 24, target_system
);
128 _mav_put_uint8_t(buf
, 25, target_component
);
129 _mav_put_uint8_t(buf
, 26, frame
);
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);
133 mavlink_safety_set_allowed_area_t packet
;
140 packet
.target_system
= target_system
;
141 packet
.target_component
= target_component
;
142 packet
.frame
= frame
;
144 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);
147 msg
->msgid
= MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
;
148 #if MAVLINK_CRC_EXTRA
149 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC
);
151 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);
156 * @brief Encode a safety_set_allowed_area struct
158 * @param system_id ID of this system
159 * @param component_id ID of this component (e.g. 200 for IMU)
160 * @param msg The MAVLink message to compress the data into
161 * @param safety_set_allowed_area C-struct to read the message contents from
163 static inline uint16_t mavlink_msg_safety_set_allowed_area_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_safety_set_allowed_area_t
* safety_set_allowed_area
)
165 return mavlink_msg_safety_set_allowed_area_pack(system_id
, component_id
, msg
, safety_set_allowed_area
->target_system
, safety_set_allowed_area
->target_component
, safety_set_allowed_area
->frame
, safety_set_allowed_area
->p1x
, safety_set_allowed_area
->p1y
, safety_set_allowed_area
->p1z
, safety_set_allowed_area
->p2x
, safety_set_allowed_area
->p2y
, safety_set_allowed_area
->p2z
);
169 * @brief Encode a safety_set_allowed_area struct on a channel
171 * @param system_id ID of this system
172 * @param component_id ID of this component (e.g. 200 for IMU)
173 * @param chan The MAVLink channel this message will be sent over
174 * @param msg The MAVLink message to compress the data into
175 * @param safety_set_allowed_area C-struct to read the message contents from
177 static inline uint16_t mavlink_msg_safety_set_allowed_area_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_safety_set_allowed_area_t
* safety_set_allowed_area
)
179 return mavlink_msg_safety_set_allowed_area_pack_chan(system_id
, component_id
, chan
, msg
, safety_set_allowed_area
->target_system
, safety_set_allowed_area
->target_component
, safety_set_allowed_area
->frame
, safety_set_allowed_area
->p1x
, safety_set_allowed_area
->p1y
, safety_set_allowed_area
->p1z
, safety_set_allowed_area
->p2x
, safety_set_allowed_area
->p2y
, safety_set_allowed_area
->p2z
);
183 * @brief Send a safety_set_allowed_area message
184 * @param chan MAVLink channel to send the message
186 * @param target_system System ID
187 * @param target_component Component ID
188 * @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.
189 * @param p1x x position 1 / Latitude 1
190 * @param p1y y position 1 / Longitude 1
191 * @param p1z z position 1 / Altitude 1
192 * @param p2x x position 2 / Latitude 2
193 * @param p2y y position 2 / Longitude 2
194 * @param p2z z position 2 / Altitude 2
196 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
198 static inline void mavlink_msg_safety_set_allowed_area_send(mavlink_channel_t chan
, uint8_t target_system
, uint8_t target_component
, uint8_t frame
, float p1x
, float p1y
, float p1z
, float p2x
, float p2y
, float p2z
)
200 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
201 char buf
[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
];
202 _mav_put_float(buf
, 0, p1x
);
203 _mav_put_float(buf
, 4, p1y
);
204 _mav_put_float(buf
, 8, p1z
);
205 _mav_put_float(buf
, 12, p2x
);
206 _mav_put_float(buf
, 16, p2y
);
207 _mav_put_float(buf
, 20, p2z
);
208 _mav_put_uint8_t(buf
, 24, target_system
);
209 _mav_put_uint8_t(buf
, 25, target_component
);
210 _mav_put_uint8_t(buf
, 26, frame
);
212 #if MAVLINK_CRC_EXTRA
213 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
, buf
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC
);
215 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
, buf
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);
218 mavlink_safety_set_allowed_area_t packet
;
225 packet
.target_system
= target_system
;
226 packet
.target_component
= target_component
;
227 packet
.frame
= frame
;
229 #if MAVLINK_CRC_EXTRA
230 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
, (const char *)&packet
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC
);
232 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
, (const char *)&packet
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);
237 #if MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
239 This varient of _send() can be used to save stack space by re-using
240 memory from the receive buffer. The caller provides a
241 mavlink_message_t which is the size of a full mavlink message. This
242 is usually the receive buffer for the channel, and allows a reply to an
243 incoming message with minimum stack space usage.
245 static inline void mavlink_msg_safety_set_allowed_area_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint8_t target_system
, uint8_t target_component
, uint8_t frame
, float p1x
, float p1y
, float p1z
, float p2x
, float p2y
, float p2z
)
247 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
248 char *buf
= (char *)msgbuf
;
249 _mav_put_float(buf
, 0, p1x
);
250 _mav_put_float(buf
, 4, p1y
);
251 _mav_put_float(buf
, 8, p1z
);
252 _mav_put_float(buf
, 12, p2x
);
253 _mav_put_float(buf
, 16, p2y
);
254 _mav_put_float(buf
, 20, p2z
);
255 _mav_put_uint8_t(buf
, 24, target_system
);
256 _mav_put_uint8_t(buf
, 25, target_component
);
257 _mav_put_uint8_t(buf
, 26, frame
);
259 #if MAVLINK_CRC_EXTRA
260 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
, buf
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC
);
262 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
, buf
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);
265 mavlink_safety_set_allowed_area_t
*packet
= (mavlink_safety_set_allowed_area_t
*)msgbuf
;
272 packet
->target_system
= target_system
;
273 packet
->target_component
= target_component
;
274 packet
->frame
= frame
;
276 #if MAVLINK_CRC_EXTRA
277 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
, (const char *)packet
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC
);
279 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA
, (const char *)packet
, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);
287 // MESSAGE SAFETY_SET_ALLOWED_AREA UNPACKING
291 * @brief Get field target_system from safety_set_allowed_area message
295 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_system(const mavlink_message_t
* msg
)
297 return _MAV_RETURN_uint8_t(msg
, 24);
301 * @brief Get field target_component from safety_set_allowed_area message
303 * @return Component ID
305 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_component(const mavlink_message_t
* msg
)
307 return _MAV_RETURN_uint8_t(msg
, 25);
311 * @brief Get field frame from safety_set_allowed_area message
313 * @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.
315 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_frame(const mavlink_message_t
* msg
)
317 return _MAV_RETURN_uint8_t(msg
, 26);
321 * @brief Get field p1x from safety_set_allowed_area message
323 * @return x position 1 / Latitude 1
325 static inline float mavlink_msg_safety_set_allowed_area_get_p1x(const mavlink_message_t
* msg
)
327 return _MAV_RETURN_float(msg
, 0);
331 * @brief Get field p1y from safety_set_allowed_area message
333 * @return y position 1 / Longitude 1
335 static inline float mavlink_msg_safety_set_allowed_area_get_p1y(const mavlink_message_t
* msg
)
337 return _MAV_RETURN_float(msg
, 4);
341 * @brief Get field p1z from safety_set_allowed_area message
343 * @return z position 1 / Altitude 1
345 static inline float mavlink_msg_safety_set_allowed_area_get_p1z(const mavlink_message_t
* msg
)
347 return _MAV_RETURN_float(msg
, 8);
351 * @brief Get field p2x from safety_set_allowed_area message
353 * @return x position 2 / Latitude 2
355 static inline float mavlink_msg_safety_set_allowed_area_get_p2x(const mavlink_message_t
* msg
)
357 return _MAV_RETURN_float(msg
, 12);
361 * @brief Get field p2y from safety_set_allowed_area message
363 * @return y position 2 / Longitude 2
365 static inline float mavlink_msg_safety_set_allowed_area_get_p2y(const mavlink_message_t
* msg
)
367 return _MAV_RETURN_float(msg
, 16);
371 * @brief Get field p2z from safety_set_allowed_area message
373 * @return z position 2 / Altitude 2
375 static inline float mavlink_msg_safety_set_allowed_area_get_p2z(const mavlink_message_t
* msg
)
377 return _MAV_RETURN_float(msg
, 20);
381 * @brief Decode a safety_set_allowed_area message into a struct
383 * @param msg The message to decode
384 * @param safety_set_allowed_area C-struct to decode the message contents into
386 static inline void mavlink_msg_safety_set_allowed_area_decode(const mavlink_message_t
* msg
, mavlink_safety_set_allowed_area_t
* safety_set_allowed_area
)
388 #if MAVLINK_NEED_BYTE_SWAP
389 safety_set_allowed_area
->p1x
= mavlink_msg_safety_set_allowed_area_get_p1x(msg
);
390 safety_set_allowed_area
->p1y
= mavlink_msg_safety_set_allowed_area_get_p1y(msg
);
391 safety_set_allowed_area
->p1z
= mavlink_msg_safety_set_allowed_area_get_p1z(msg
);
392 safety_set_allowed_area
->p2x
= mavlink_msg_safety_set_allowed_area_get_p2x(msg
);
393 safety_set_allowed_area
->p2y
= mavlink_msg_safety_set_allowed_area_get_p2y(msg
);
394 safety_set_allowed_area
->p2z
= mavlink_msg_safety_set_allowed_area_get_p2z(msg
);
395 safety_set_allowed_area
->target_system
= mavlink_msg_safety_set_allowed_area_get_target_system(msg
);
396 safety_set_allowed_area
->target_component
= mavlink_msg_safety_set_allowed_area_get_target_component(msg
);
397 safety_set_allowed_area
->frame
= mavlink_msg_safety_set_allowed_area_get_frame(msg
);
399 memcpy(safety_set_allowed_area
, _MAV_PAYLOAD(msg
), MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN
);