RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_safety_set_allowed_area.h
1#pragma once
2// MESSAGE SAFETY_SET_ALLOWED_AREA PACKING
3
4#define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA 54
5
6MAVPACKED(
7typedef struct __mavlink_safety_set_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 target_system; /*< System ID*/
15 uint8_t target_component; /*< Component ID*/
16 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.*/
17}) mavlink_safety_set_allowed_area_t;
18
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
23
24#define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC 15
25#define MAVLINK_MSG_ID_54_CRC 15
26
27
28
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 } \
44}
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 } \
59}
60#endif
61
79static 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)
81{
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);
93
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;
106
107 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
108#endif
109
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);
112}
113
131static 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)
134{
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);
146
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;
159
160 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
161#endif
162
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);
165}
166
175static 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)
176{
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);
178}
179
189static 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)
190{
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);
192}
193
208#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
209
210static 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)
211{
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);
223
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;
236
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
239}
240
246static 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)
247{
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
253}
254
255#if MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
256/*
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.
262 */
263static 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)
264{
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);
276
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;
289
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
292}
293#endif
294
295#endif
296
297// MESSAGE SAFETY_SET_ALLOWED_AREA UNPACKING
298
299
305static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_system(const mavlink_message_t* msg)
306{
307 return _MAV_RETURN_uint8_t(msg, 24);
308}
309
315static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_component(const mavlink_message_t* msg)
316{
317 return _MAV_RETURN_uint8_t(msg, 25);
318}
319
325static inline uint8_t mavlink_msg_safety_set_allowed_area_get_frame(const mavlink_message_t* msg)
326{
327 return _MAV_RETURN_uint8_t(msg, 26);
328}
329
335static inline float mavlink_msg_safety_set_allowed_area_get_p1x(const mavlink_message_t* msg)
336{
337 return _MAV_RETURN_float(msg, 0);
338}
339
345static inline float mavlink_msg_safety_set_allowed_area_get_p1y(const mavlink_message_t* msg)
346{
347 return _MAV_RETURN_float(msg, 4);
348}
349
355static inline float mavlink_msg_safety_set_allowed_area_get_p1z(const mavlink_message_t* msg)
356{
357 return _MAV_RETURN_float(msg, 8);
358}
359
365static inline float mavlink_msg_safety_set_allowed_area_get_p2x(const mavlink_message_t* msg)
366{
367 return _MAV_RETURN_float(msg, 12);
368}
369
375static inline float mavlink_msg_safety_set_allowed_area_get_p2y(const mavlink_message_t* msg)
376{
377 return _MAV_RETURN_float(msg, 16);
378}
379
385static inline float mavlink_msg_safety_set_allowed_area_get_p2z(const mavlink_message_t* msg)
386{
387 return _MAV_RETURN_float(msg, 20);
388}
389
396static inline void mavlink_msg_safety_set_allowed_area_decode(const mavlink_message_t* msg, mavlink_safety_set_allowed_area_t* safety_set_allowed_area)
397{
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
413}