Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / mavlink / v1.0 / common / mavlink_msg_safety_set_allowed_area.h
blob3e03e2a7c6cbce4b204eb75e04c1e77c1bbfcb3f
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 {
6 float p1x; ///< x position 1 / Latitude 1
7 float p1y; ///< y position 1 / Longitude 1
8 float p1z; ///< z position 1 / Altitude 1
9 float p2x; ///< x position 2 / Latitude 2
10 float p2y; ///< y position 2 / Longitude 2
11 float p2z; ///< z position 2 / Altitude 2
12 uint8_t target_system; ///< System ID
13 uint8_t target_component; ///< Component ID
14 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 } mavlink_safety_set_allowed_area_t;
17 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN 27
18 #define MAVLINK_MSG_ID_54_LEN 27
21 #define MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA \
22 { \
23 "SAFETY_SET_ALLOWED_AREA", \
24 9, \
25 { \
26 { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_set_allowed_area_t, p1x) }, \
27 { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_set_allowed_area_t, p1y) }, \
28 { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_set_allowed_area_t, p1z) }, \
29 { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_set_allowed_area_t, p2x) }, \
30 { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_set_allowed_area_t, p2y) }, \
31 { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_set_allowed_area_t, p2z) }, \
32 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_set_allowed_area_t, target_system) }, \
33 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_safety_set_allowed_area_t, target_component) }, \
34 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_safety_set_allowed_area_t, frame) }, \
35 } \
39 /**
40 * @brief Pack a safety_set_allowed_area message
41 * @param system_id ID of this system
42 * @param component_id ID of this component (e.g. 200 for IMU)
43 * @param msg The MAVLink message to compress the data into
45 * @param target_system System ID
46 * @param target_component Component ID
47 * @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.
48 * @param p1x x position 1 / Latitude 1
49 * @param p1y y position 1 / Longitude 1
50 * @param p1z z position 1 / Altitude 1
51 * @param p2x x position 2 / Latitude 2
52 * @param p2y y position 2 / Longitude 2
53 * @param p2z z position 2 / Altitude 2
54 * @return length of the message in bytes (excluding serial stream start sign)
56 static inline uint16_t mavlink_msg_safety_set_allowed_area_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg,
57 uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
59 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
60 char buf[27];
61 _mav_put_float(buf, 0, p1x);
62 _mav_put_float(buf, 4, p1y);
63 _mav_put_float(buf, 8, p1z);
64 _mav_put_float(buf, 12, p2x);
65 _mav_put_float(buf, 16, p2y);
66 _mav_put_float(buf, 20, p2z);
67 _mav_put_uint8_t(buf, 24, target_system);
68 _mav_put_uint8_t(buf, 25, target_component);
69 _mav_put_uint8_t(buf, 26, frame);
71 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 27);
72 #else
73 mavlink_safety_set_allowed_area_t packet;
74 packet.p1x = p1x;
75 packet.p1y = p1y;
76 packet.p1z = p1z;
77 packet.p2x = p2x;
78 packet.p2y = p2y;
79 packet.p2z = p2z;
80 packet.target_system = target_system;
81 packet.target_component = target_component;
82 packet.frame = frame;
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 27);
85 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA;
88 return mavlink_finalize_message(msg, system_id, component_id, 27, 15);
91 /**
92 * @brief Pack a safety_set_allowed_area message on a channel
93 * @param system_id ID of this system
94 * @param component_id ID of this component (e.g. 200 for IMU)
95 * @param chan The MAVLink channel this message was sent over
96 * @param msg The MAVLink message to compress the data into
97 * @param target_system System ID
98 * @param target_component Component ID
99 * @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.
100 * @param p1x x position 1 / Latitude 1
101 * @param p1y y position 1 / Longitude 1
102 * @param p1z z position 1 / Altitude 1
103 * @param p2x x position 2 / Latitude 2
104 * @param p2y y position 2 / Longitude 2
105 * @param p2z z position 2 / Altitude 2
106 * @return length of the message in bytes (excluding serial stream start sign)
108 static inline uint16_t mavlink_msg_safety_set_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
109 mavlink_message_t *msg,
110 uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
112 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
113 char buf[27];
114 _mav_put_float(buf, 0, p1x);
115 _mav_put_float(buf, 4, p1y);
116 _mav_put_float(buf, 8, p1z);
117 _mav_put_float(buf, 12, p2x);
118 _mav_put_float(buf, 16, p2y);
119 _mav_put_float(buf, 20, p2z);
120 _mav_put_uint8_t(buf, 24, target_system);
121 _mav_put_uint8_t(buf, 25, target_component);
122 _mav_put_uint8_t(buf, 26, frame);
124 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 27);
125 #else
126 mavlink_safety_set_allowed_area_t packet;
127 packet.p1x = p1x;
128 packet.p1y = p1y;
129 packet.p1z = p1z;
130 packet.p2x = p2x;
131 packet.p2y = p2y;
132 packet.p2z = p2z;
133 packet.target_system = target_system;
134 packet.target_component = target_component;
135 packet.frame = frame;
137 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 27);
138 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
140 msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA;
141 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 27, 15);
145 * @brief Encode a safety_set_allowed_area struct into a message
147 * @param system_id ID of this system
148 * @param component_id ID of this component (e.g. 200 for IMU)
149 * @param msg The MAVLink message to compress the data into
150 * @param safety_set_allowed_area C-struct to read the message contents from
152 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)
154 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);
158 * @brief Send a safety_set_allowed_area message
159 * @param chan MAVLink channel to send the message
161 * @param target_system System ID
162 * @param target_component Component ID
163 * @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.
164 * @param p1x x position 1 / Latitude 1
165 * @param p1y y position 1 / Longitude 1
166 * @param p1z z position 1 / Altitude 1
167 * @param p2x x position 2 / Latitude 2
168 * @param p2y y position 2 / Longitude 2
169 * @param p2z z position 2 / Altitude 2
171 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
173 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)
175 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
176 char buf[27];
177 _mav_put_float(buf, 0, p1x);
178 _mav_put_float(buf, 4, p1y);
179 _mav_put_float(buf, 8, p1z);
180 _mav_put_float(buf, 12, p2x);
181 _mav_put_float(buf, 16, p2y);
182 _mav_put_float(buf, 20, p2z);
183 _mav_put_uint8_t(buf, 24, target_system);
184 _mav_put_uint8_t(buf, 25, target_component);
185 _mav_put_uint8_t(buf, 26, frame);
187 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, buf, 27, 15);
188 #else
189 mavlink_safety_set_allowed_area_t packet;
190 packet.p1x = p1x;
191 packet.p1y = p1y;
192 packet.p1z = p1z;
193 packet.p2x = p2x;
194 packet.p2y = p2y;
195 packet.p2z = p2z;
196 packet.target_system = target_system;
197 packet.target_component = target_component;
198 packet.frame = frame;
200 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char *)&packet, 27, 15);
201 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
204 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
206 // MESSAGE SAFETY_SET_ALLOWED_AREA UNPACKING
210 * @brief Get field target_system from safety_set_allowed_area message
212 * @return System ID
214 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_system(const mavlink_message_t *msg)
216 return _MAV_RETURN_uint8_t(msg, 24);
220 * @brief Get field target_component from safety_set_allowed_area message
222 * @return Component ID
224 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_component(const mavlink_message_t *msg)
226 return _MAV_RETURN_uint8_t(msg, 25);
230 * @brief Get field frame from safety_set_allowed_area message
232 * @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.
234 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_frame(const mavlink_message_t *msg)
236 return _MAV_RETURN_uint8_t(msg, 26);
240 * @brief Get field p1x from safety_set_allowed_area message
242 * @return x position 1 / Latitude 1
244 static inline float mavlink_msg_safety_set_allowed_area_get_p1x(const mavlink_message_t *msg)
246 return _MAV_RETURN_float(msg, 0);
250 * @brief Get field p1y from safety_set_allowed_area message
252 * @return y position 1 / Longitude 1
254 static inline float mavlink_msg_safety_set_allowed_area_get_p1y(const mavlink_message_t *msg)
256 return _MAV_RETURN_float(msg, 4);
260 * @brief Get field p1z from safety_set_allowed_area message
262 * @return z position 1 / Altitude 1
264 static inline float mavlink_msg_safety_set_allowed_area_get_p1z(const mavlink_message_t *msg)
266 return _MAV_RETURN_float(msg, 8);
270 * @brief Get field p2x from safety_set_allowed_area message
272 * @return x position 2 / Latitude 2
274 static inline float mavlink_msg_safety_set_allowed_area_get_p2x(const mavlink_message_t *msg)
276 return _MAV_RETURN_float(msg, 12);
280 * @brief Get field p2y from safety_set_allowed_area message
282 * @return y position 2 / Longitude 2
284 static inline float mavlink_msg_safety_set_allowed_area_get_p2y(const mavlink_message_t *msg)
286 return _MAV_RETURN_float(msg, 16);
290 * @brief Get field p2z from safety_set_allowed_area message
292 * @return z position 2 / Altitude 2
294 static inline float mavlink_msg_safety_set_allowed_area_get_p2z(const mavlink_message_t *msg)
296 return _MAV_RETURN_float(msg, 20);
300 * @brief Decode a safety_set_allowed_area message into a struct
302 * @param msg The message to decode
303 * @param safety_set_allowed_area C-struct to decode the message contents into
305 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)
307 #if MAVLINK_NEED_BYTE_SWAP
308 safety_set_allowed_area->p1x = mavlink_msg_safety_set_allowed_area_get_p1x(msg);
309 safety_set_allowed_area->p1y = mavlink_msg_safety_set_allowed_area_get_p1y(msg);
310 safety_set_allowed_area->p1z = mavlink_msg_safety_set_allowed_area_get_p1z(msg);
311 safety_set_allowed_area->p2x = mavlink_msg_safety_set_allowed_area_get_p2x(msg);
312 safety_set_allowed_area->p2y = mavlink_msg_safety_set_allowed_area_get_p2y(msg);
313 safety_set_allowed_area->p2z = mavlink_msg_safety_set_allowed_area_get_p2z(msg);
314 safety_set_allowed_area->target_system = mavlink_msg_safety_set_allowed_area_get_target_system(msg);
315 safety_set_allowed_area->target_component = mavlink_msg_safety_set_allowed_area_get_target_component(msg);
316 safety_set_allowed_area->frame = mavlink_msg_safety_set_allowed_area_get_frame(msg);
317 #else
318 memcpy(safety_set_allowed_area, _MAV_PAYLOAD(msg), 27);
319 #endif