Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_safety_allowed_area.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE SAFETY_ALLOWED_AREA PACKING
3
4#define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA 55
5
6
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 frame; /*< Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.*/
15} mavlink_safety_allowed_area_t;
16
17#define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN 25
18#define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN 25
19#define MAVLINK_MSG_ID_55_LEN 25
20#define MAVLINK_MSG_ID_55_MIN_LEN 25
21
22#define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC 3
23#define MAVLINK_MSG_ID_55_CRC 3
24
25
26
27#if MAVLINK_COMMAND_24BIT
28#define MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA {
29 55,
30 "SAFETY_ALLOWED_AREA",
31 7,
32 { { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_allowed_area_t, frame) },
33 { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_allowed_area_t, p1x) },
34 { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_allowed_area_t, p1y) },
35 { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_allowed_area_t, p1z) },
36 { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_allowed_area_t, p2x) },
37 { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_allowed_area_t, p2y) },
38 { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_allowed_area_t, p2z) },
39 } \
40}
41#else
42#define MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA {
43 "SAFETY_ALLOWED_AREA",
44 7,
45 { { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_allowed_area_t, frame) },
46 { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_allowed_area_t, p1x) },
47 { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_allowed_area_t, p1y) },
48 { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_allowed_area_t, p1z) },
49 { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_allowed_area_t, p2x) },
50 { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_allowed_area_t, p2y) },
51 { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_allowed_area_t, p2z) },
52 } \
53}
54#endif
55
56/**
57 * @brief Pack a safety_allowed_area message
58 * @param system_id ID of this system
59 * @param component_id ID of this component (e.g. 200 for IMU)
60 * @param msg The MAVLink message to compress the data into
61 *
62 * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
63 * @param p1x [m] x position 1 / Latitude 1
64 * @param p1y [m] y position 1 / Longitude 1
65 * @param p1z [m] z position 1 / Altitude 1
66 * @param p2x [m] x position 2 / Latitude 2
67 * @param p2y [m] y position 2 / Longitude 2
68 * @param p2z [m] z position 2 / Altitude 2
69 * @return length of the message in bytes (excluding serial stream start sign)
70 */
71static inline uint16_t mavlink_msg_safety_allowed_area_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72 uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
73{
74#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
76 _mav_put_float(buf, 0, p1x);
77 _mav_put_float(buf, 4, p1y);
78 _mav_put_float(buf, 8, p1z);
79 _mav_put_float(buf, 12, p2x);
80 _mav_put_float(buf, 16, p2y);
81 _mav_put_float(buf, 20, p2z);
82 _mav_put_uint8_t(buf, 24, frame);
83
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
85#else
86 mavlink_safety_allowed_area_t packet;
87 packet.p1x = p1x;
88 packet.p1y = p1y;
89 packet.p1z = p1z;
90 packet.p2x = p2x;
91 packet.p2y = p2y;
92 packet.p2z = p2z;
93 packet.frame = frame;
94
95 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
96#endif
97
100}
101
102/**
103 * @brief Pack a safety_allowed_area message
104 * @param system_id ID of this system
105 * @param component_id ID of this component (e.g. 200 for IMU)
106 * @param status MAVLink status structure
107 * @param msg The MAVLink message to compress the data into
108 *
109 * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
110 * @param p1x [m] x position 1 / Latitude 1
111 * @param p1y [m] y position 1 / Longitude 1
112 * @param p1z [m] z position 1 / Altitude 1
113 * @param p2x [m] x position 2 / Latitude 2
114 * @param p2y [m] y position 2 / Longitude 2
115 * @param p2z [m] z position 2 / Altitude 2
116 * @return length of the message in bytes (excluding serial stream start sign)
117 */
118static inline uint16_t mavlink_msg_safety_allowed_area_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
119 uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
120{
121#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
123 _mav_put_float(buf, 0, p1x);
124 _mav_put_float(buf, 4, p1y);
125 _mav_put_float(buf, 8, p1z);
126 _mav_put_float(buf, 12, p2x);
127 _mav_put_float(buf, 16, p2y);
128 _mav_put_float(buf, 20, p2z);
129 _mav_put_uint8_t(buf, 24, frame);
130
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
132#else
133 mavlink_safety_allowed_area_t packet;
134 packet.p1x = p1x;
135 packet.p1y = p1y;
136 packet.p1z = p1z;
137 packet.p2x = p2x;
138 packet.p2y = p2y;
139 packet.p2z = p2z;
140 packet.frame = frame;
141
142 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
143#endif
144
146#if MAVLINK_CRC_EXTRA
147 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC);
148#else
149 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
150#endif
151}
152
153/**
154 * @brief Pack a safety_allowed_area message 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 frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
160 * @param p1x [m] x position 1 / Latitude 1
161 * @param p1y [m] y position 1 / Longitude 1
162 * @param p1z [m] z position 1 / Altitude 1
163 * @param p2x [m] x position 2 / Latitude 2
164 * @param p2y [m] y position 2 / Longitude 2
165 * @param p2z [m] z position 2 / Altitude 2
166 * @return length of the message in bytes (excluding serial stream start sign)
167 */
168static inline uint16_t mavlink_msg_safety_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
169 mavlink_message_t* msg,
170 uint8_t frame,float p1x,float p1y,float p1z,float p2x,float p2y,float p2z)
171{
172#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
174 _mav_put_float(buf, 0, p1x);
175 _mav_put_float(buf, 4, p1y);
176 _mav_put_float(buf, 8, p1z);
177 _mav_put_float(buf, 12, p2x);
178 _mav_put_float(buf, 16, p2y);
179 _mav_put_float(buf, 20, p2z);
180 _mav_put_uint8_t(buf, 24, frame);
181
182 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
183#else
184 mavlink_safety_allowed_area_t packet;
185 packet.p1x = p1x;
186 packet.p1y = p1y;
187 packet.p1z = p1z;
188 packet.p2x = p2x;
189 packet.p2y = p2y;
190 packet.p2z = p2z;
191 packet.frame = frame;
192
193 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
194#endif
195
197 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC);
198}
199
200/**
201 * @brief Encode a safety_allowed_area struct
202 *
203 * @param system_id ID of this system
204 * @param component_id ID of this component (e.g. 200 for IMU)
205 * @param msg The MAVLink message to compress the data into
206 * @param safety_allowed_area C-struct to read the message contents from
207 */
208static 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)
209{
210 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);
211}
212
213/**
214 * @brief Encode a safety_allowed_area struct on a channel
215 *
216 * @param system_id ID of this system
217 * @param component_id ID of this component (e.g. 200 for IMU)
218 * @param chan The MAVLink channel this message will be sent over
219 * @param msg The MAVLink message to compress the data into
220 * @param safety_allowed_area C-struct to read the message contents from
221 */
222static 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)
223{
224 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);
225}
226
227/**
228 * @brief Encode a safety_allowed_area struct with provided status structure
229 *
230 * @param system_id ID of this system
231 * @param component_id ID of this component (e.g. 200 for IMU)
232 * @param status MAVLink status structure
233 * @param msg The MAVLink message to compress the data into
234 * @param safety_allowed_area C-struct to read the message contents from
235 */
236static inline uint16_t mavlink_msg_safety_allowed_area_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_safety_allowed_area_t* safety_allowed_area)
237{
238 return mavlink_msg_safety_allowed_area_pack_status(system_id, component_id, _status, 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);
239}
240
241/**
242 * @brief Send a safety_allowed_area message
243 * @param chan MAVLink channel to send the message
244 *
245 * @param frame Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
246 * @param p1x [m] x position 1 / Latitude 1
247 * @param p1y [m] y position 1 / Longitude 1
248 * @param p1z [m] z position 1 / Altitude 1
249 * @param p2x [m] x position 2 / Latitude 2
250 * @param p2y [m] y position 2 / Longitude 2
251 * @param p2z [m] z position 2 / Altitude 2
252 */
253#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
254
255static 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)
256{
257#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
258 char buf[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN];
259 _mav_put_float(buf, 0, p1x);
260 _mav_put_float(buf, 4, p1y);
261 _mav_put_float(buf, 8, p1z);
262 _mav_put_float(buf, 12, p2x);
263 _mav_put_float(buf, 16, p2y);
264 _mav_put_float(buf, 20, p2z);
265 _mav_put_uint8_t(buf, 24, frame);
266
267 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC);
268#else
269 mavlink_safety_allowed_area_t packet;
270 packet.p1x = p1x;
271 packet.p1y = p1y;
272 packet.p1z = p1z;
273 packet.p2x = p2x;
274 packet.p2y = p2y;
275 packet.p2z = p2z;
276 packet.frame = frame;
277
278 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, (const char *)&packet, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC);
279#endif
280}
281
282/**
283 * @brief Send a safety_allowed_area message
284 * @param chan MAVLink channel to send the message
285 * @param struct The MAVLink struct to serialize
286 */
287static inline void mavlink_msg_safety_allowed_area_send_struct(mavlink_channel_t chan, const mavlink_safety_allowed_area_t* safety_allowed_area)
288{
289#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
290 mavlink_msg_safety_allowed_area_send(chan, 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);
291#else
292 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, (const char *)safety_allowed_area, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC);
293#endif
294}
295
296#if MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
297/*
298 This variant of _send() can be used to save stack space by reusing
299 memory from the receive buffer. The caller provides a
300 mavlink_message_t which is the size of a full mavlink message. This
301 is usually the receive buffer for the channel, and allows a reply to an
302 incoming message with minimum stack space usage.
303 */
304static 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)
305{
306#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
307 char *buf = (char *)msgbuf;
308 _mav_put_float(buf, 0, p1x);
309 _mav_put_float(buf, 4, p1y);
310 _mav_put_float(buf, 8, p1z);
311 _mav_put_float(buf, 12, p2x);
312 _mav_put_float(buf, 16, p2y);
313 _mav_put_float(buf, 20, p2z);
314 _mav_put_uint8_t(buf, 24, frame);
315
316 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC);
317#else
318 mavlink_safety_allowed_area_t *packet = (mavlink_safety_allowed_area_t *)msgbuf;
319 packet->p1x = p1x;
320 packet->p1y = p1y;
321 packet->p1z = p1z;
322 packet->p2x = p2x;
323 packet->p2y = p2y;
324 packet->p2z = p2z;
325 packet->frame = frame;
326
327 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA, (const char *)packet, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC);
328#endif
329}
330#endif
331
332#endif
333
334// MESSAGE SAFETY_ALLOWED_AREA UNPACKING
335
336
337/**
338 * @brief Get field frame from safety_allowed_area message
339 *
340 * @return Coordinate frame. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.
341 */
342static inline uint8_t mavlink_msg_safety_allowed_area_get_frame(const mavlink_message_t* msg)
343{
344 return _MAV_RETURN_uint8_t(msg, 24);
345}
346
347/**
348 * @brief Get field p1x from safety_allowed_area message
349 *
350 * @return [m] x position 1 / Latitude 1
351 */
352static inline float mavlink_msg_safety_allowed_area_get_p1x(const mavlink_message_t* msg)
353{
354 return _MAV_RETURN_float(msg, 0);
355}
356
357/**
358 * @brief Get field p1y from safety_allowed_area message
359 *
360 * @return [m] y position 1 / Longitude 1
361 */
362static inline float mavlink_msg_safety_allowed_area_get_p1y(const mavlink_message_t* msg)
363{
364 return _MAV_RETURN_float(msg, 4);
365}
366
367/**
368 * @brief Get field p1z from safety_allowed_area message
369 *
370 * @return [m] z position 1 / Altitude 1
371 */
372static inline float mavlink_msg_safety_allowed_area_get_p1z(const mavlink_message_t* msg)
373{
374 return _MAV_RETURN_float(msg, 8);
375}
376
377/**
378 * @brief Get field p2x from safety_allowed_area message
379 *
380 * @return [m] x position 2 / Latitude 2
381 */
382static inline float mavlink_msg_safety_allowed_area_get_p2x(const mavlink_message_t* msg)
383{
384 return _MAV_RETURN_float(msg, 12);
385}
386
387/**
388 * @brief Get field p2y from safety_allowed_area message
389 *
390 * @return [m] y position 2 / Longitude 2
391 */
392static inline float mavlink_msg_safety_allowed_area_get_p2y(const mavlink_message_t* msg)
393{
394 return _MAV_RETURN_float(msg, 16);
395}
396
397/**
398 * @brief Get field p2z from safety_allowed_area message
399 *
400 * @return [m] z position 2 / Altitude 2
401 */
402static inline float mavlink_msg_safety_allowed_area_get_p2z(const mavlink_message_t* msg)
403{
404 return _MAV_RETURN_float(msg, 20);
405}
406
407/**
408 * @brief Decode a safety_allowed_area message into a struct
409 *
410 * @param msg The message to decode
411 * @param safety_allowed_area C-struct to decode the message contents into
412 */
413static inline void mavlink_msg_safety_allowed_area_decode(const mavlink_message_t* msg, mavlink_safety_allowed_area_t* safety_allowed_area)
414{
415#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
416 safety_allowed_area->p1x = mavlink_msg_safety_allowed_area_get_p1x(msg);
417 safety_allowed_area->p1y = mavlink_msg_safety_allowed_area_get_p1y(msg);
418 safety_allowed_area->p1z = mavlink_msg_safety_allowed_area_get_p1z(msg);
419 safety_allowed_area->p2x = mavlink_msg_safety_allowed_area_get_p2x(msg);
420 safety_allowed_area->p2y = mavlink_msg_safety_allowed_area_get_p2y(msg);
421 safety_allowed_area->p2z = mavlink_msg_safety_allowed_area_get_p2z(msg);
422 safety_allowed_area->frame = mavlink_msg_safety_allowed_area_get_frame(msg);
423#else
424 uint8_t len = msg->len < MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN? msg->len : MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN;
425 memset(safety_allowed_area, 0, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
426 memcpy(safety_allowed_area, _MAV_PAYLOAD(msg), len);
427#endif
428}