Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE SAFETY_SET_ALLOWED_AREA PACKING
2
 
3
#define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA 54
4
 
5
typedef struct __mavlink_safety_set_allowed_area_t
6
{
7
 float p1x; ///< x position 1 / Latitude 1
8
 float p1y; ///< y position 1 / Longitude 1
9
 float p1z; ///< z position 1 / Altitude 1
10
 float p2x; ///< x position 2 / Latitude 2
11
 float p2y; ///< y position 2 / Longitude 2
12
 float p2z; ///< z position 2 / Altitude 2
13
 uint8_t target_system; ///< System ID
14
 uint8_t target_component; ///< Component ID
15
 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.
16
} mavlink_safety_set_allowed_area_t;
17
 
18
#define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN 27
19
#define MAVLINK_MSG_ID_54_LEN 27
20
 
21
 
22
 
23
#define MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA { \
24
        "SAFETY_SET_ALLOWED_AREA", \
25
        9, \
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
         } \
36
}
37
 
38
 
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
44
 *
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)
55
 */
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)
58
{
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);
70
 
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;
83
 
84
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 27);
85
#endif
86
 
87
        msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA;
88
        return mavlink_finalize_message(msg, system_id, component_id, 27, 15);
89
}
90
 
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)
107
 */
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)
111
{
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);
123
 
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;
136
 
137
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 27);
138
#endif
139
 
140
        msg->msgid = MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA;
141
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 27, 15);
142
}
143
 
144
/**
145
 * @brief Encode a safety_set_allowed_area struct into a message
146
 *
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
151
 */
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)
153
{
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);
155
}
156
 
157
/**
158
 * @brief Send a safety_set_allowed_area message
159
 * @param chan MAVLink channel to send the message
160
 *
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
170
 */
171
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
172
 
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)
174
{
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);
186
 
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;
199
 
200
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char *)&packet, 27, 15);
201
#endif
202
}
203
 
204
#endif
205
 
206
// MESSAGE SAFETY_SET_ALLOWED_AREA UNPACKING
207
 
208
 
209
/**
210
 * @brief Get field target_system from safety_set_allowed_area message
211
 *
212
 * @return System ID
213
 */
214
static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_system(const mavlink_message_t* msg)
215
{
216
        return _MAV_RETURN_uint8_t(msg,  24);
217
}
218
 
219
/**
220
 * @brief Get field target_component from safety_set_allowed_area message
221
 *
222
 * @return Component ID
223
 */
224
static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_component(const mavlink_message_t* msg)
225
{
226
        return _MAV_RETURN_uint8_t(msg,  25);
227
}
228
 
229
/**
230
 * @brief Get field frame from safety_set_allowed_area message
231
 *
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.
233
 */
234
static inline uint8_t mavlink_msg_safety_set_allowed_area_get_frame(const mavlink_message_t* msg)
235
{
236
        return _MAV_RETURN_uint8_t(msg,  26);
237
}
238
 
239
/**
240
 * @brief Get field p1x from safety_set_allowed_area message
241
 *
242
 * @return x position 1 / Latitude 1
243
 */
244
static inline float mavlink_msg_safety_set_allowed_area_get_p1x(const mavlink_message_t* msg)
245
{
246
        return _MAV_RETURN_float(msg,  0);
247
}
248
 
249
/**
250
 * @brief Get field p1y from safety_set_allowed_area message
251
 *
252
 * @return y position 1 / Longitude 1
253
 */
254
static inline float mavlink_msg_safety_set_allowed_area_get_p1y(const mavlink_message_t* msg)
255
{
256
        return _MAV_RETURN_float(msg,  4);
257
}
258
 
259
/**
260
 * @brief Get field p1z from safety_set_allowed_area message
261
 *
262
 * @return z position 1 / Altitude 1
263
 */
264
static inline float mavlink_msg_safety_set_allowed_area_get_p1z(const mavlink_message_t* msg)
265
{
266
        return _MAV_RETURN_float(msg,  8);
267
}
268
 
269
/**
270
 * @brief Get field p2x from safety_set_allowed_area message
271
 *
272
 * @return x position 2 / Latitude 2
273
 */
274
static inline float mavlink_msg_safety_set_allowed_area_get_p2x(const mavlink_message_t* msg)
275
{
276
        return _MAV_RETURN_float(msg,  12);
277
}
278
 
279
/**
280
 * @brief Get field p2y from safety_set_allowed_area message
281
 *
282
 * @return y position 2 / Longitude 2
283
 */
284
static inline float mavlink_msg_safety_set_allowed_area_get_p2y(const mavlink_message_t* msg)
285
{
286
        return _MAV_RETURN_float(msg,  16);
287
}
288
 
289
/**
290
 * @brief Get field p2z from safety_set_allowed_area message
291
 *
292
 * @return z position 2 / Altitude 2
293
 */
294
static inline float mavlink_msg_safety_set_allowed_area_get_p2z(const mavlink_message_t* msg)
295
{
296
        return _MAV_RETURN_float(msg,  20);
297
}
298
 
299
/**
300
 * @brief Decode a safety_set_allowed_area message into a struct
301
 *
302
 * @param msg The message to decode
303
 * @param safety_set_allowed_area C-struct to decode the message contents into
304
 */
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)
306
{
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
320
}