Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / mavlink / v1.0 / common / mavlink_msg_safety_allowed_area.h
blob55d050af4bf0cf85840142fd609148e8b5eb9516
1 // MESSAGE SAFETY_ALLOWED_AREA PACKING
3 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA 55
5 typedef struct __mavlink_safety_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 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.
13 } mavlink_safety_allowed_area_t;
15 #define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN 25
16 #define MAVLINK_MSG_ID_55_LEN 25
19 #define MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA \
20 { \
21 "SAFETY_ALLOWED_AREA", \
22 7, \
23 { \
24 { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_allowed_area_t, p1x) }, \
25 { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_allowed_area_t, p1y) }, \
26 { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_allowed_area_t, p1z) }, \
27 { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_allowed_area_t, p2x) }, \
28 { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_allowed_area_t, p2y) }, \
29 { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_allowed_area_t, p2z) }, \
30 { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_allowed_area_t, frame) }, \
31 } \
35 /**
36 * @brief Pack a safety_allowed_area message
37 * @param system_id ID of this system
38 * @param component_id ID of this component (e.g. 200 for IMU)
39 * @param msg The MAVLink message to compress the data into
41 * @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.
42 * @param p1x x position 1 / Latitude 1
43 * @param p1y y position 1 / Longitude 1
44 * @param p1z z position 1 / Altitude 1
45 * @param p2x x position 2 / Latitude 2
46 * @param p2y y position 2 / Longitude 2
47 * @param p2z z position 2 / Altitude 2
48 * @return length of the message in bytes (excluding serial stream start sign)
50 static inline uint16_t mavlink_msg_safety_allowed_area_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg,
51 uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
53 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
54 char buf[25];
55 _mav_put_float(buf, 0, p1x);
56 _mav_put_float(buf, 4, p1y);
57 _mav_put_float(buf, 8, p1z);
58 _mav_put_float(buf, 12, p2x);
59 _mav_put_float(buf, 16, p2y);
60 _mav_put_float(buf, 20, p2z);
61 _mav_put_uint8_t(buf, 24, frame);
63 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 25);
64 #else
65 mavlink_safety_allowed_area_t packet;
66 packet.p1x = p1x;
67 packet.p1y = p1y;
68 packet.p1z = p1z;
69 packet.p2x = p2x;
70 packet.p2y = p2y;
71 packet.p2z = p2z;
72 packet.frame = frame;
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 25);
75 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
77 msg->msgid = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA;
78 return mavlink_finalize_message(msg, system_id, component_id, 25, 3);
81 /**
82 * @brief Pack a safety_allowed_area message on a channel
83 * @param system_id ID of this system
84 * @param component_id ID of this component (e.g. 200 for IMU)
85 * @param chan The MAVLink channel this message was sent over
86 * @param msg The MAVLink message to compress the data into
87 * @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.
88 * @param p1x x position 1 / Latitude 1
89 * @param p1y y position 1 / Longitude 1
90 * @param p1z z position 1 / Altitude 1
91 * @param p2x x position 2 / Latitude 2
92 * @param p2y y position 2 / Longitude 2
93 * @param p2z z position 2 / Altitude 2
94 * @return length of the message in bytes (excluding serial stream start sign)
96 static inline uint16_t mavlink_msg_safety_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
97 mavlink_message_t *msg,
98 uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
100 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
101 char buf[25];
102 _mav_put_float(buf, 0, p1x);
103 _mav_put_float(buf, 4, p1y);
104 _mav_put_float(buf, 8, p1z);
105 _mav_put_float(buf, 12, p2x);
106 _mav_put_float(buf, 16, p2y);
107 _mav_put_float(buf, 20, p2z);
108 _mav_put_uint8_t(buf, 24, frame);
110 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 25);
111 #else
112 mavlink_safety_allowed_area_t packet;
113 packet.p1x = p1x;
114 packet.p1y = p1y;
115 packet.p1z = p1z;
116 packet.p2x = p2x;
117 packet.p2y = p2y;
118 packet.p2z = p2z;
119 packet.frame = frame;
121 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 25);
122 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
124 msg->msgid = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA;
125 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 25, 3);
129 * @brief Encode a safety_allowed_area struct into a message
131 * @param system_id ID of this system
132 * @param component_id ID of this component (e.g. 200 for IMU)
133 * @param msg The MAVLink message to compress the data into
134 * @param safety_allowed_area C-struct to read the message contents from
136 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)
138 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);
142 * @brief Send a safety_allowed_area message
143 * @param chan MAVLink channel to send the message
145 * @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.
146 * @param p1x x position 1 / Latitude 1
147 * @param p1y y position 1 / Longitude 1
148 * @param p1z z position 1 / Altitude 1
149 * @param p2x x position 2 / Latitude 2
150 * @param p2y y position 2 / Longitude 2
151 * @param p2z z position 2 / Altitude 2
153 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
155 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)
157 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
158 char buf[25];
159 _mav_put_float(buf, 0, p1x);
160 _mav_put_float(buf, 4, p1y);
161 _mav_put_float(buf, 8, p1z);
162 _mav_put_float(buf, 12, p2x);
163 _mav_put_float(buf, 16, p2y);
164 _mav_put_float(buf, 20, p2z);
165 _mav_put_uint8_t(buf, 24, frame);
167 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, buf, 25, 3);
168 #else
169 mavlink_safety_allowed_area_t packet;
170 packet.p1x = p1x;
171 packet.p1y = p1y;
172 packet.p1z = p1z;
173 packet.p2x = p2x;
174 packet.p2y = p2y;
175 packet.p2z = p2z;
176 packet.frame = frame;
178 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, (const char *)&packet, 25, 3);
179 #endif // if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
184 // MESSAGE SAFETY_ALLOWED_AREA UNPACKING
188 * @brief Get field frame from safety_allowed_area message
190 * @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.
192 static inline uint8_t mavlink_msg_safety_allowed_area_get_frame(const mavlink_message_t *msg)
194 return _MAV_RETURN_uint8_t(msg, 24);
198 * @brief Get field p1x from safety_allowed_area message
200 * @return x position 1 / Latitude 1
202 static inline float mavlink_msg_safety_allowed_area_get_p1x(const mavlink_message_t *msg)
204 return _MAV_RETURN_float(msg, 0);
208 * @brief Get field p1y from safety_allowed_area message
210 * @return y position 1 / Longitude 1
212 static inline float mavlink_msg_safety_allowed_area_get_p1y(const mavlink_message_t *msg)
214 return _MAV_RETURN_float(msg, 4);
218 * @brief Get field p1z from safety_allowed_area message
220 * @return z position 1 / Altitude 1
222 static inline float mavlink_msg_safety_allowed_area_get_p1z(const mavlink_message_t *msg)
224 return _MAV_RETURN_float(msg, 8);
228 * @brief Get field p2x from safety_allowed_area message
230 * @return x position 2 / Latitude 2
232 static inline float mavlink_msg_safety_allowed_area_get_p2x(const mavlink_message_t *msg)
234 return _MAV_RETURN_float(msg, 12);
238 * @brief Get field p2y from safety_allowed_area message
240 * @return y position 2 / Longitude 2
242 static inline float mavlink_msg_safety_allowed_area_get_p2y(const mavlink_message_t *msg)
244 return _MAV_RETURN_float(msg, 16);
248 * @brief Get field p2z from safety_allowed_area message
250 * @return z position 2 / Altitude 2
252 static inline float mavlink_msg_safety_allowed_area_get_p2z(const mavlink_message_t *msg)
254 return _MAV_RETURN_float(msg, 20);
258 * @brief Decode a safety_allowed_area message into a struct
260 * @param msg The message to decode
261 * @param safety_allowed_area C-struct to decode the message contents into
263 static inline void mavlink_msg_safety_allowed_area_decode(const mavlink_message_t *msg, mavlink_safety_allowed_area_t *safety_allowed_area)
265 #if MAVLINK_NEED_BYTE_SWAP
266 safety_allowed_area->p1x = mavlink_msg_safety_allowed_area_get_p1x(msg);
267 safety_allowed_area->p1y = mavlink_msg_safety_allowed_area_get_p1y(msg);
268 safety_allowed_area->p1z = mavlink_msg_safety_allowed_area_get_p1z(msg);
269 safety_allowed_area->p2x = mavlink_msg_safety_allowed_area_get_p2x(msg);
270 safety_allowed_area->p2y = mavlink_msg_safety_allowed_area_get_p2y(msg);
271 safety_allowed_area->p2z = mavlink_msg_safety_allowed_area_get_p2z(msg);
272 safety_allowed_area->frame = mavlink_msg_safety_allowed_area_get_frame(msg);
273 #else
274 memcpy(safety_allowed_area, _MAV_PAYLOAD(msg), 25);
275 #endif