RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_mag_cal_progress.h
1#pragma once
2// MESSAGE MAG_CAL_PROGRESS PACKING
3
4#define MAVLINK_MSG_ID_MAG_CAL_PROGRESS 191
5
6MAVPACKED(
7typedef struct __mavlink_mag_cal_progress_t {
8 float direction_x; /*< Body frame direction vector for display*/
9 float direction_y; /*< Body frame direction vector for display*/
10 float direction_z; /*< Body frame direction vector for display*/
11 uint8_t compass_id; /*< Compass being calibrated*/
12 uint8_t cal_mask; /*< Bitmask of compasses being calibrated*/
13 uint8_t cal_status; /*< Status (see MAG_CAL_STATUS enum)*/
14 uint8_t attempt; /*< Attempt number*/
15 uint8_t completion_pct; /*< Completion percentage*/
16 uint8_t completion_mask[10]; /*< Bitmask of sphere sections (see http://en.wikipedia.org/wiki/Geodesic_grid)*/
17}) mavlink_mag_cal_progress_t;
18
19#define MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN 27
20#define MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN 27
21#define MAVLINK_MSG_ID_191_LEN 27
22#define MAVLINK_MSG_ID_191_MIN_LEN 27
23
24#define MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC 92
25#define MAVLINK_MSG_ID_191_CRC 92
26
27#define MAVLINK_MSG_MAG_CAL_PROGRESS_FIELD_COMPLETION_MASK_LEN 10
28
29#if MAVLINK_COMMAND_24BIT
30#define MAVLINK_MESSAGE_INFO_MAG_CAL_PROGRESS { \
31 191, \
32 "MAG_CAL_PROGRESS", \
33 9, \
34 { { "compass_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mag_cal_progress_t, compass_id) }, \
35 { "cal_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mag_cal_progress_t, cal_mask) }, \
36 { "cal_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mag_cal_progress_t, cal_status) }, \
37 { "attempt", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_mag_cal_progress_t, attempt) }, \
38 { "completion_pct", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_mag_cal_progress_t, completion_pct) }, \
39 { "completion_mask", NULL, MAVLINK_TYPE_UINT8_T, 10, 17, offsetof(mavlink_mag_cal_progress_t, completion_mask) }, \
40 { "direction_x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mag_cal_progress_t, direction_x) }, \
41 { "direction_y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mag_cal_progress_t, direction_y) }, \
42 { "direction_z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mag_cal_progress_t, direction_z) }, \
43 } \
44}
45#else
46#define MAVLINK_MESSAGE_INFO_MAG_CAL_PROGRESS { \
47 "MAG_CAL_PROGRESS", \
48 9, \
49 { { "compass_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mag_cal_progress_t, compass_id) }, \
50 { "cal_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mag_cal_progress_t, cal_mask) }, \
51 { "cal_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mag_cal_progress_t, cal_status) }, \
52 { "attempt", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_mag_cal_progress_t, attempt) }, \
53 { "completion_pct", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_mag_cal_progress_t, completion_pct) }, \
54 { "completion_mask", NULL, MAVLINK_TYPE_UINT8_T, 10, 17, offsetof(mavlink_mag_cal_progress_t, completion_mask) }, \
55 { "direction_x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_mag_cal_progress_t, direction_x) }, \
56 { "direction_y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mag_cal_progress_t, direction_y) }, \
57 { "direction_z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mag_cal_progress_t, direction_z) }, \
58 } \
59}
60#endif
61
79static inline uint16_t mavlink_msg_mag_cal_progress_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
80 uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t attempt, uint8_t completion_pct, const uint8_t *completion_mask, float direction_x, float direction_y, float direction_z)
81{
82#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
83 char buf[MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN];
84 _mav_put_float(buf, 0, direction_x);
85 _mav_put_float(buf, 4, direction_y);
86 _mav_put_float(buf, 8, direction_z);
87 _mav_put_uint8_t(buf, 12, compass_id);
88 _mav_put_uint8_t(buf, 13, cal_mask);
89 _mav_put_uint8_t(buf, 14, cal_status);
90 _mav_put_uint8_t(buf, 15, attempt);
91 _mav_put_uint8_t(buf, 16, completion_pct);
92 _mav_put_uint8_t_array(buf, 17, completion_mask, 10);
93 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
94#else
95 mavlink_mag_cal_progress_t packet;
96 packet.direction_x = direction_x;
97 packet.direction_y = direction_y;
98 packet.direction_z = direction_z;
99 packet.compass_id = compass_id;
100 packet.cal_mask = cal_mask;
101 packet.cal_status = cal_status;
102 packet.attempt = attempt;
103 packet.completion_pct = completion_pct;
104 mav_array_memcpy(packet.completion_mask, completion_mask, sizeof(uint8_t)*10);
105 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
106#endif
107
108 msg->msgid = MAVLINK_MSG_ID_MAG_CAL_PROGRESS;
109 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC);
110}
111
129static inline uint16_t mavlink_msg_mag_cal_progress_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
130 mavlink_message_t* msg,
131 uint8_t compass_id,uint8_t cal_mask,uint8_t cal_status,uint8_t attempt,uint8_t completion_pct,const uint8_t *completion_mask,float direction_x,float direction_y,float direction_z)
132{
133#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
134 char buf[MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN];
135 _mav_put_float(buf, 0, direction_x);
136 _mav_put_float(buf, 4, direction_y);
137 _mav_put_float(buf, 8, direction_z);
138 _mav_put_uint8_t(buf, 12, compass_id);
139 _mav_put_uint8_t(buf, 13, cal_mask);
140 _mav_put_uint8_t(buf, 14, cal_status);
141 _mav_put_uint8_t(buf, 15, attempt);
142 _mav_put_uint8_t(buf, 16, completion_pct);
143 _mav_put_uint8_t_array(buf, 17, completion_mask, 10);
144 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
145#else
146 mavlink_mag_cal_progress_t packet;
147 packet.direction_x = direction_x;
148 packet.direction_y = direction_y;
149 packet.direction_z = direction_z;
150 packet.compass_id = compass_id;
151 packet.cal_mask = cal_mask;
152 packet.cal_status = cal_status;
153 packet.attempt = attempt;
154 packet.completion_pct = completion_pct;
155 mav_array_memcpy(packet.completion_mask, completion_mask, sizeof(uint8_t)*10);
156 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
157#endif
158
159 msg->msgid = MAVLINK_MSG_ID_MAG_CAL_PROGRESS;
160 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC);
161}
162
171static inline uint16_t mavlink_msg_mag_cal_progress_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mag_cal_progress_t* mag_cal_progress)
172{
173 return mavlink_msg_mag_cal_progress_pack(system_id, component_id, msg, mag_cal_progress->compass_id, mag_cal_progress->cal_mask, mag_cal_progress->cal_status, mag_cal_progress->attempt, mag_cal_progress->completion_pct, mag_cal_progress->completion_mask, mag_cal_progress->direction_x, mag_cal_progress->direction_y, mag_cal_progress->direction_z);
174}
175
185static inline uint16_t mavlink_msg_mag_cal_progress_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mag_cal_progress_t* mag_cal_progress)
186{
187 return mavlink_msg_mag_cal_progress_pack_chan(system_id, component_id, chan, msg, mag_cal_progress->compass_id, mag_cal_progress->cal_mask, mag_cal_progress->cal_status, mag_cal_progress->attempt, mag_cal_progress->completion_pct, mag_cal_progress->completion_mask, mag_cal_progress->direction_x, mag_cal_progress->direction_y, mag_cal_progress->direction_z);
188}
189
204#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
205
206static inline void mavlink_msg_mag_cal_progress_send(mavlink_channel_t chan, uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t attempt, uint8_t completion_pct, const uint8_t *completion_mask, float direction_x, float direction_y, float direction_z)
207{
208#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
209 char buf[MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN];
210 _mav_put_float(buf, 0, direction_x);
211 _mav_put_float(buf, 4, direction_y);
212 _mav_put_float(buf, 8, direction_z);
213 _mav_put_uint8_t(buf, 12, compass_id);
214 _mav_put_uint8_t(buf, 13, cal_mask);
215 _mav_put_uint8_t(buf, 14, cal_status);
216 _mav_put_uint8_t(buf, 15, attempt);
217 _mav_put_uint8_t(buf, 16, completion_pct);
218 _mav_put_uint8_t_array(buf, 17, completion_mask, 10);
219 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, buf, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC);
220#else
221 mavlink_mag_cal_progress_t packet;
222 packet.direction_x = direction_x;
223 packet.direction_y = direction_y;
224 packet.direction_z = direction_z;
225 packet.compass_id = compass_id;
226 packet.cal_mask = cal_mask;
227 packet.cal_status = cal_status;
228 packet.attempt = attempt;
229 packet.completion_pct = completion_pct;
230 mav_array_memcpy(packet.completion_mask, completion_mask, sizeof(uint8_t)*10);
231 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, (const char *)&packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC);
232#endif
233}
234
240static inline void mavlink_msg_mag_cal_progress_send_struct(mavlink_channel_t chan, const mavlink_mag_cal_progress_t* mag_cal_progress)
241{
242#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
243 mavlink_msg_mag_cal_progress_send(chan, mag_cal_progress->compass_id, mag_cal_progress->cal_mask, mag_cal_progress->cal_status, mag_cal_progress->attempt, mag_cal_progress->completion_pct, mag_cal_progress->completion_mask, mag_cal_progress->direction_x, mag_cal_progress->direction_y, mag_cal_progress->direction_z);
244#else
245 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, (const char *)mag_cal_progress, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC);
246#endif
247}
248
249#if MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
250/*
251 This varient of _send() can be used to save stack space by re-using
252 memory from the receive buffer. The caller provides a
253 mavlink_message_t which is the size of a full mavlink message. This
254 is usually the receive buffer for the channel, and allows a reply to an
255 incoming message with minimum stack space usage.
256 */
257static inline void mavlink_msg_mag_cal_progress_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t compass_id, uint8_t cal_mask, uint8_t cal_status, uint8_t attempt, uint8_t completion_pct, const uint8_t *completion_mask, float direction_x, float direction_y, float direction_z)
258{
259#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
260 char *buf = (char *)msgbuf;
261 _mav_put_float(buf, 0, direction_x);
262 _mav_put_float(buf, 4, direction_y);
263 _mav_put_float(buf, 8, direction_z);
264 _mav_put_uint8_t(buf, 12, compass_id);
265 _mav_put_uint8_t(buf, 13, cal_mask);
266 _mav_put_uint8_t(buf, 14, cal_status);
267 _mav_put_uint8_t(buf, 15, attempt);
268 _mav_put_uint8_t(buf, 16, completion_pct);
269 _mav_put_uint8_t_array(buf, 17, completion_mask, 10);
270 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, buf, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC);
271#else
272 mavlink_mag_cal_progress_t *packet = (mavlink_mag_cal_progress_t *)msgbuf;
273 packet->direction_x = direction_x;
274 packet->direction_y = direction_y;
275 packet->direction_z = direction_z;
276 packet->compass_id = compass_id;
277 packet->cal_mask = cal_mask;
278 packet->cal_status = cal_status;
279 packet->attempt = attempt;
280 packet->completion_pct = completion_pct;
281 mav_array_memcpy(packet->completion_mask, completion_mask, sizeof(uint8_t)*10);
282 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MAG_CAL_PROGRESS, (const char *)packet, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_MIN_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_CRC);
283#endif
284}
285#endif
286
287#endif
288
289// MESSAGE MAG_CAL_PROGRESS UNPACKING
290
291
297static inline uint8_t mavlink_msg_mag_cal_progress_get_compass_id(const mavlink_message_t* msg)
298{
299 return _MAV_RETURN_uint8_t(msg, 12);
300}
301
307static inline uint8_t mavlink_msg_mag_cal_progress_get_cal_mask(const mavlink_message_t* msg)
308{
309 return _MAV_RETURN_uint8_t(msg, 13);
310}
311
317static inline uint8_t mavlink_msg_mag_cal_progress_get_cal_status(const mavlink_message_t* msg)
318{
319 return _MAV_RETURN_uint8_t(msg, 14);
320}
321
327static inline uint8_t mavlink_msg_mag_cal_progress_get_attempt(const mavlink_message_t* msg)
328{
329 return _MAV_RETURN_uint8_t(msg, 15);
330}
331
337static inline uint8_t mavlink_msg_mag_cal_progress_get_completion_pct(const mavlink_message_t* msg)
338{
339 return _MAV_RETURN_uint8_t(msg, 16);
340}
341
347static inline uint16_t mavlink_msg_mag_cal_progress_get_completion_mask(const mavlink_message_t* msg, uint8_t *completion_mask)
348{
349 return _MAV_RETURN_uint8_t_array(msg, completion_mask, 10, 17);
350}
351
357static inline float mavlink_msg_mag_cal_progress_get_direction_x(const mavlink_message_t* msg)
358{
359 return _MAV_RETURN_float(msg, 0);
360}
361
367static inline float mavlink_msg_mag_cal_progress_get_direction_y(const mavlink_message_t* msg)
368{
369 return _MAV_RETURN_float(msg, 4);
370}
371
377static inline float mavlink_msg_mag_cal_progress_get_direction_z(const mavlink_message_t* msg)
378{
379 return _MAV_RETURN_float(msg, 8);
380}
381
388static inline void mavlink_msg_mag_cal_progress_decode(const mavlink_message_t* msg, mavlink_mag_cal_progress_t* mag_cal_progress)
389{
390#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
391 mag_cal_progress->direction_x = mavlink_msg_mag_cal_progress_get_direction_x(msg);
392 mag_cal_progress->direction_y = mavlink_msg_mag_cal_progress_get_direction_y(msg);
393 mag_cal_progress->direction_z = mavlink_msg_mag_cal_progress_get_direction_z(msg);
394 mag_cal_progress->compass_id = mavlink_msg_mag_cal_progress_get_compass_id(msg);
395 mag_cal_progress->cal_mask = mavlink_msg_mag_cal_progress_get_cal_mask(msg);
396 mag_cal_progress->cal_status = mavlink_msg_mag_cal_progress_get_cal_status(msg);
397 mag_cal_progress->attempt = mavlink_msg_mag_cal_progress_get_attempt(msg);
398 mag_cal_progress->completion_pct = mavlink_msg_mag_cal_progress_get_completion_pct(msg);
399 mavlink_msg_mag_cal_progress_get_completion_mask(msg, mag_cal_progress->completion_mask);
400#else
401 uint8_t len = msg->len < MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN? msg->len : MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN;
402 memset(mag_cal_progress, 0, MAVLINK_MSG_ID_MAG_CAL_PROGRESS_LEN);
403 memcpy(mag_cal_progress, _MAV_PAYLOAD(msg), len);
404#endif
405}