RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_safety_allowed_area.h
1#pragma once
2// MESSAGE SAFETY_ALLOWED_AREA PACKING
3
4#define MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA 55
5
6MAVPACKED(
7typedef struct __mavlink_safety_allowed_area_t {
8 float p1x; /*< x position 1 / Latitude 1*/
9 float p1y; /*< y position 1 / Longitude 1*/
10 float p1z; /*< z position 1 / Altitude 1*/
11 float p2x; /*< x position 2 / Latitude 2*/
12 float p2y; /*< y position 2 / Longitude 2*/
13 float p2z; /*< z position 2 / Altitude 2*/
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_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
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
75 char buf[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN];
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
98 msg->msgid = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA;
99 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_CRC);
100}
101
117static inline uint16_t mavlink_msg_safety_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
118 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
122 char buf[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN];
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
145 msg->msgid = MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA;
146 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);
147}
148
157static 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)
158{
159 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);
160}
161
171static 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)
172{
173 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);
174}
175
188#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
189
190static 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)
191{
192#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char buf[MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN];
194 _mav_put_float(buf, 0, p1x);
195 _mav_put_float(buf, 4, p1y);
196 _mav_put_float(buf, 8, p1z);
197 _mav_put_float(buf, 12, p2x);
198 _mav_put_float(buf, 16, p2y);
199 _mav_put_float(buf, 20, p2z);
200 _mav_put_uint8_t(buf, 24, frame);
201
202 _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);
203#else
204 mavlink_safety_allowed_area_t packet;
205 packet.p1x = p1x;
206 packet.p1y = p1y;
207 packet.p1z = p1z;
208 packet.p2x = p2x;
209 packet.p2y = p2y;
210 packet.p2z = p2z;
211 packet.frame = frame;
212
213 _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);
214#endif
215}
216
222static inline void mavlink_msg_safety_allowed_area_send_struct(mavlink_channel_t chan, const mavlink_safety_allowed_area_t* safety_allowed_area)
223{
224#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
225 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);
226#else
227 _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);
228#endif
229}
230
231#if MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
232/*
233 This varient of _send() can be used to save stack space by re-using
234 memory from the receive buffer. The caller provides a
235 mavlink_message_t which is the size of a full mavlink message. This
236 is usually the receive buffer for the channel, and allows a reply to an
237 incoming message with minimum stack space usage.
238 */
239static 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)
240{
241#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242 char *buf = (char *)msgbuf;
243 _mav_put_float(buf, 0, p1x);
244 _mav_put_float(buf, 4, p1y);
245 _mav_put_float(buf, 8, p1z);
246 _mav_put_float(buf, 12, p2x);
247 _mav_put_float(buf, 16, p2y);
248 _mav_put_float(buf, 20, p2z);
249 _mav_put_uint8_t(buf, 24, frame);
250
251 _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);
252#else
253 mavlink_safety_allowed_area_t *packet = (mavlink_safety_allowed_area_t *)msgbuf;
254 packet->p1x = p1x;
255 packet->p1y = p1y;
256 packet->p1z = p1z;
257 packet->p2x = p2x;
258 packet->p2y = p2y;
259 packet->p2z = p2z;
260 packet->frame = frame;
261
262 _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);
263#endif
264}
265#endif
266
267#endif
268
269// MESSAGE SAFETY_ALLOWED_AREA UNPACKING
270
271
277static inline uint8_t mavlink_msg_safety_allowed_area_get_frame(const mavlink_message_t* msg)
278{
279 return _MAV_RETURN_uint8_t(msg, 24);
280}
281
287static inline float mavlink_msg_safety_allowed_area_get_p1x(const mavlink_message_t* msg)
288{
289 return _MAV_RETURN_float(msg, 0);
290}
291
297static inline float mavlink_msg_safety_allowed_area_get_p1y(const mavlink_message_t* msg)
298{
299 return _MAV_RETURN_float(msg, 4);
300}
301
307static inline float mavlink_msg_safety_allowed_area_get_p1z(const mavlink_message_t* msg)
308{
309 return _MAV_RETURN_float(msg, 8);
310}
311
317static inline float mavlink_msg_safety_allowed_area_get_p2x(const mavlink_message_t* msg)
318{
319 return _MAV_RETURN_float(msg, 12);
320}
321
327static inline float mavlink_msg_safety_allowed_area_get_p2y(const mavlink_message_t* msg)
328{
329 return _MAV_RETURN_float(msg, 16);
330}
331
337static inline float mavlink_msg_safety_allowed_area_get_p2z(const mavlink_message_t* msg)
338{
339 return _MAV_RETURN_float(msg, 20);
340}
341
348static inline void mavlink_msg_safety_allowed_area_decode(const mavlink_message_t* msg, mavlink_safety_allowed_area_t* safety_allowed_area)
349{
350#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
351 safety_allowed_area->p1x = mavlink_msg_safety_allowed_area_get_p1x(msg);
352 safety_allowed_area->p1y = mavlink_msg_safety_allowed_area_get_p1y(msg);
353 safety_allowed_area->p1z = mavlink_msg_safety_allowed_area_get_p1z(msg);
354 safety_allowed_area->p2x = mavlink_msg_safety_allowed_area_get_p2x(msg);
355 safety_allowed_area->p2y = mavlink_msg_safety_allowed_area_get_p2y(msg);
356 safety_allowed_area->p2z = mavlink_msg_safety_allowed_area_get_p2z(msg);
357 safety_allowed_area->frame = mavlink_msg_safety_allowed_area_get_frame(msg);
358#else
359 uint8_t len = msg->len < MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN? msg->len : MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN;
360 memset(safety_allowed_area, 0, MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_LEN);
361 memcpy(safety_allowed_area, _MAV_PAYLOAD(msg), len);
362#endif
363}