before merging master
[inav.git] / lib / main / MAVLink / common / mavlink_msg_safety_set_allowed_area.h
blobeca9b274f7016a3b2634588866a435c9729086b8
1 #pragma once
2 // MESSAGE SAFETY_SET_ALLOWED_AREA PACKING
4 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA 54
7 typedef struct __mavlink_safety_set_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 target_system; /*< System ID*/
15 uint8_t target_component; /*< Component ID*/
16 uint8_t frame; /*< Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.*/
17 } mavlink_safety_set_allowed_area_t;
19 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN 27
20 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN 27
21 #define MAVLINK_MSG_ID_54_LEN 27
22 #define MAVLINK_MSG_ID_54_MIN_LEN 27
24 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC 15
25 #define MAVLINK_MSG_ID_54_CRC 15
29 #if MAVLINK_COMMAND_24BIT
30 #define MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA { \
31 54, \
32 "SAFETY_SET_ALLOWED_AREA", \
33 9, \
34 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_set_allowed_area_t, target_system) }, \
35 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_safety_set_allowed_area_t, target_component) }, \
36 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_safety_set_allowed_area_t, frame) }, \
37 { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_set_allowed_area_t, p1x) }, \
38 { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_set_allowed_area_t, p1y) }, \
39 { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_set_allowed_area_t, p1z) }, \
40 { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_set_allowed_area_t, p2x) }, \
41 { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_set_allowed_area_t, p2y) }, \
42 { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_set_allowed_area_t, p2z) }, \
43 } \
45 #else
46 #define MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA { \
47 "SAFETY_SET_ALLOWED_AREA", \
48 9, \
49 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_set_allowed_area_t, target_system) }, \
50 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_safety_set_allowed_area_t, target_component) }, \
51 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_safety_set_allowed_area_t, frame) }, \
52 { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_set_allowed_area_t, p1x) }, \
53 { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_set_allowed_area_t, p1y) }, \
54 { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_set_allowed_area_t, p1z) }, \
55 { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_set_allowed_area_t, p2x) }, \
56 { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_set_allowed_area_t, p2y) }, \
57 { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_set_allowed_area_t, p2z) }, \
58 } \
60 #endif
62 /**
63 * @brief Pack a safety_set_allowed_area message
64 * @param system_id ID of this system
65 * @param component_id ID of this component (e.g. 200 for IMU)
66 * @param msg The MAVLink message to compress the data into
68 * @param target_system System ID
69 * @param target_component Component ID
70 * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
71 * @param p1x [m] x position 1 / Latitude 1
72 * @param p1y [m] y position 1 / Longitude 1
73 * @param p1z [m] z position 1 / Altitude 1
74 * @param p2x [m] x position 2 / Latitude 2
75 * @param p2y [m] y position 2 / Longitude 2
76 * @param p2z [m] z position 2 / Altitude 2
77 * @return length of the message in bytes (excluding serial stream start sign)
79 static inline uint16_t mavlink_msg_safety_set_allowed_area_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
80 uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
82 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
83 char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN];
84 _mav_put_float(buf, 0, p1x);
85 _mav_put_float(buf, 4, p1y);
86 _mav_put_float(buf, 8, p1z);
87 _mav_put_float(buf, 12, p2x);
88 _mav_put_float(buf, 16, p2y);
89 _mav_put_float(buf, 20, p2z);
90 _mav_put_uint8_t(buf, 24, target_system);
91 _mav_put_uint8_t(buf, 25, target_component);
92 _mav_put_uint8_t(buf, 26, frame);
94 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
95 #else
96 mavlink_safety_set_allowed_area_t packet;
97 packet.p1x = p1x;
98 packet.p1y = p1y;
99 packet.p1z = p1z;
100 packet.p2x = p2x;
101 packet.p2y = p2y;
102 packet.p2z = p2z;
103 packet.target_system = target_system;
104 packet.target_component = target_component;
105 packet.frame = frame;
107 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
108 #endif
110 msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA;
111 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
115 * @brief Pack a safety_set_allowed_area message on a channel
116 * @param system_id ID of this system
117 * @param component_id ID of this component (e.g. 200 for IMU)
118 * @param chan The MAVLink channel this message will be sent over
119 * @param msg The MAVLink message to compress the data into
120 * @param target_system System ID
121 * @param target_component Component ID
122 * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
123 * @param p1x [m] x position 1 / Latitude 1
124 * @param p1y [m] y position 1 / Longitude 1
125 * @param p1z [m] z position 1 / Altitude 1
126 * @param p2x [m] x position 2 / Latitude 2
127 * @param p2y [m] y position 2 / Longitude 2
128 * @param p2z [m] z position 2 / Altitude 2
129 * @return length of the message in bytes (excluding serial stream start sign)
131 static inline uint16_t mavlink_msg_safety_set_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
132 mavlink_message_t* msg,
133 uint8_t target_system,uint8_t target_component,uint8_t frame,float p1x,float p1y,float p1z,float p2x,float p2y,float p2z)
135 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
136 char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN];
137 _mav_put_float(buf, 0, p1x);
138 _mav_put_float(buf, 4, p1y);
139 _mav_put_float(buf, 8, p1z);
140 _mav_put_float(buf, 12, p2x);
141 _mav_put_float(buf, 16, p2y);
142 _mav_put_float(buf, 20, p2z);
143 _mav_put_uint8_t(buf, 24, target_system);
144 _mav_put_uint8_t(buf, 25, target_component);
145 _mav_put_uint8_t(buf, 26, frame);
147 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
148 #else
149 mavlink_safety_set_allowed_area_t packet;
150 packet.p1x = p1x;
151 packet.p1y = p1y;
152 packet.p1z = p1z;
153 packet.p2x = p2x;
154 packet.p2y = p2y;
155 packet.p2z = p2z;
156 packet.target_system = target_system;
157 packet.target_component = target_component;
158 packet.frame = frame;
160 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
161 #endif
163 msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA;
164 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
168 * @brief Encode a safety_set_allowed_area struct
170 * @param system_id ID of this system
171 * @param component_id ID of this component (e.g. 200 for IMU)
172 * @param msg The MAVLink message to compress the data into
173 * @param safety_set_allowed_area C-struct to read the message contents from
175 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)
177 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);
181 * @brief Encode a safety_set_allowed_area struct on a channel
183 * @param system_id ID of this system
184 * @param component_id ID of this component (e.g. 200 for IMU)
185 * @param chan The MAVLink channel this message will be sent over
186 * @param msg The MAVLink message to compress the data into
187 * @param safety_set_allowed_area C-struct to read the message contents from
189 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)
191 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);
195 * @brief Send a safety_set_allowed_area message
196 * @param chan MAVLink channel to send the message
198 * @param target_system System ID
199 * @param target_component Component ID
200 * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
201 * @param p1x [m] x position 1 / Latitude 1
202 * @param p1y [m] y position 1 / Longitude 1
203 * @param p1z [m] z position 1 / Altitude 1
204 * @param p2x [m] x position 2 / Latitude 2
205 * @param p2y [m] y position 2 / Longitude 2
206 * @param p2z [m] z position 2 / Altitude 2
208 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
210 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)
212 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
213 char buf[MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN];
214 _mav_put_float(buf, 0, p1x);
215 _mav_put_float(buf, 4, p1y);
216 _mav_put_float(buf, 8, p1z);
217 _mav_put_float(buf, 12, p2x);
218 _mav_put_float(buf, 16, p2y);
219 _mav_put_float(buf, 20, p2z);
220 _mav_put_uint8_t(buf, 24, target_system);
221 _mav_put_uint8_t(buf, 25, target_component);
222 _mav_put_uint8_t(buf, 26, frame);
224 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
225 #else
226 mavlink_safety_set_allowed_area_t packet;
227 packet.p1x = p1x;
228 packet.p1y = p1y;
229 packet.p1z = p1z;
230 packet.p2x = p2x;
231 packet.p2y = p2y;
232 packet.p2z = p2z;
233 packet.target_system = target_system;
234 packet.target_component = target_component;
235 packet.frame = frame;
237 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char *)&packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
238 #endif
242 * @brief Send a safety_set_allowed_area message
243 * @param chan MAVLink channel to send the message
244 * @param struct The MAVLink struct to serialize
246 static inline void mavlink_msg_safety_set_allowed_area_send_struct(mavlink_channel_t chan, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area)
248 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
249 mavlink_msg_safety_set_allowed_area_send(chan, 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);
250 #else
251 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char *)safety_set_allowed_area, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
252 #endif
255 #if MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
257 This varient of _send() can be used to save stack space by re-using
258 memory from the receive buffer. The caller provides a
259 mavlink_message_t which is the size of a full mavlink message. This
260 is usually the receive buffer for the channel, and allows a reply to an
261 incoming message with minimum stack space usage.
263 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)
265 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
266 char *buf = (char *)msgbuf;
267 _mav_put_float(buf, 0, p1x);
268 _mav_put_float(buf, 4, p1y);
269 _mav_put_float(buf, 8, p1z);
270 _mav_put_float(buf, 12, p2x);
271 _mav_put_float(buf, 16, p2y);
272 _mav_put_float(buf, 20, p2z);
273 _mav_put_uint8_t(buf, 24, target_system);
274 _mav_put_uint8_t(buf, 25, target_component);
275 _mav_put_uint8_t(buf, 26, frame);
277 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
278 #else
279 mavlink_safety_set_allowed_area_t *packet = (mavlink_safety_set_allowed_area_t *)msgbuf;
280 packet->p1x = p1x;
281 packet->p1y = p1y;
282 packet->p1z = p1z;
283 packet->p2x = p2x;
284 packet->p2y = p2y;
285 packet->p2z = p2z;
286 packet->target_system = target_system;
287 packet->target_component = target_component;
288 packet->frame = frame;
290 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char *)packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC);
291 #endif
293 #endif
295 #endif
297 // MESSAGE SAFETY_SET_ALLOWED_AREA UNPACKING
301 * @brief Get field target_system from safety_set_allowed_area message
303 * @return System ID
305 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_system(const mavlink_message_t* msg)
307 return _MAV_RETURN_uint8_t(msg, 24);
311 * @brief Get field target_component from safety_set_allowed_area message
313 * @return Component ID
315 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_component(const mavlink_message_t* msg)
317 return _MAV_RETURN_uint8_t(msg, 25);
321 * @brief Get field frame from safety_set_allowed_area message
323 * @return Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
325 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_frame(const mavlink_message_t* msg)
327 return _MAV_RETURN_uint8_t(msg, 26);
331 * @brief Get field p1x from safety_set_allowed_area message
333 * @return [m] x position 1 / Latitude 1
335 static inline float mavlink_msg_safety_set_allowed_area_get_p1x(const mavlink_message_t* msg)
337 return _MAV_RETURN_float(msg, 0);
341 * @brief Get field p1y from safety_set_allowed_area message
343 * @return [m] y position 1 / Longitude 1
345 static inline float mavlink_msg_safety_set_allowed_area_get_p1y(const mavlink_message_t* msg)
347 return _MAV_RETURN_float(msg, 4);
351 * @brief Get field p1z from safety_set_allowed_area message
353 * @return [m] z position 1 / Altitude 1
355 static inline float mavlink_msg_safety_set_allowed_area_get_p1z(const mavlink_message_t* msg)
357 return _MAV_RETURN_float(msg, 8);
361 * @brief Get field p2x from safety_set_allowed_area message
363 * @return [m] x position 2 / Latitude 2
365 static inline float mavlink_msg_safety_set_allowed_area_get_p2x(const mavlink_message_t* msg)
367 return _MAV_RETURN_float(msg, 12);
371 * @brief Get field p2y from safety_set_allowed_area message
373 * @return [m] y position 2 / Longitude 2
375 static inline float mavlink_msg_safety_set_allowed_area_get_p2y(const mavlink_message_t* msg)
377 return _MAV_RETURN_float(msg, 16);
381 * @brief Get field p2z from safety_set_allowed_area message
383 * @return [m] z position 2 / Altitude 2
385 static inline float mavlink_msg_safety_set_allowed_area_get_p2z(const mavlink_message_t* msg)
387 return _MAV_RETURN_float(msg, 20);
391 * @brief Decode a safety_set_allowed_area message into a struct
393 * @param msg The message to decode
394 * @param safety_set_allowed_area C-struct to decode the message contents into
396 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)
398 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
399 safety_set_allowed_area->p1x = mavlink_msg_safety_set_allowed_area_get_p1x(msg);
400 safety_set_allowed_area->p1y = mavlink_msg_safety_set_allowed_area_get_p1y(msg);
401 safety_set_allowed_area->p1z = mavlink_msg_safety_set_allowed_area_get_p1z(msg);
402 safety_set_allowed_area->p2x = mavlink_msg_safety_set_allowed_area_get_p2x(msg);
403 safety_set_allowed_area->p2y = mavlink_msg_safety_set_allowed_area_get_p2y(msg);
404 safety_set_allowed_area->p2z = mavlink_msg_safety_set_allowed_area_get_p2z(msg);
405 safety_set_allowed_area->target_system = mavlink_msg_safety_set_allowed_area_get_target_system(msg);
406 safety_set_allowed_area->target_component = mavlink_msg_safety_set_allowed_area_get_target_component(msg);
407 safety_set_allowed_area->frame = mavlink_msg_safety_set_allowed_area_get_frame(msg);
408 #else
409 uint8_t len = msg->len < MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN? msg->len : MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN;
410 memset(safety_set_allowed_area, 0, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
411 memcpy(safety_set_allowed_area, _MAV_PAYLOAD(msg), len);
412 #endif