RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_data_log.h
1#pragma once
2// MESSAGE DATA_LOG PACKING
3
4#define MAVLINK_MSG_ID_DATA_LOG 177
5
6MAVPACKED(
7typedef struct __mavlink_data_log_t {
8 float fl_1; /*< Log value 1 */
9 float fl_2; /*< Log value 2 */
10 float fl_3; /*< Log value 3 */
11 float fl_4; /*< Log value 4 */
12 float fl_5; /*< Log value 5 */
13 float fl_6; /*< Log value 6 */
14}) mavlink_data_log_t;
15
16#define MAVLINK_MSG_ID_DATA_LOG_LEN 24
17#define MAVLINK_MSG_ID_DATA_LOG_MIN_LEN 24
18#define MAVLINK_MSG_ID_177_LEN 24
19#define MAVLINK_MSG_ID_177_MIN_LEN 24
20
21#define MAVLINK_MSG_ID_DATA_LOG_CRC 167
22#define MAVLINK_MSG_ID_177_CRC 167
23
24
25
26#if MAVLINK_COMMAND_24BIT
27#define MAVLINK_MESSAGE_INFO_DATA_LOG { \
28 177, \
29 "DATA_LOG", \
30 6, \
31 { { "fl_1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_data_log_t, fl_1) }, \
32 { "fl_2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_data_log_t, fl_2) }, \
33 { "fl_3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_data_log_t, fl_3) }, \
34 { "fl_4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_data_log_t, fl_4) }, \
35 { "fl_5", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_data_log_t, fl_5) }, \
36 { "fl_6", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_data_log_t, fl_6) }, \
37 } \
38}
39#else
40#define MAVLINK_MESSAGE_INFO_DATA_LOG { \
41 "DATA_LOG", \
42 6, \
43 { { "fl_1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_data_log_t, fl_1) }, \
44 { "fl_2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_data_log_t, fl_2) }, \
45 { "fl_3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_data_log_t, fl_3) }, \
46 { "fl_4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_data_log_t, fl_4) }, \
47 { "fl_5", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_data_log_t, fl_5) }, \
48 { "fl_6", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_data_log_t, fl_6) }, \
49 } \
50}
51#endif
52
67static inline uint16_t mavlink_msg_data_log_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
68 float fl_1, float fl_2, float fl_3, float fl_4, float fl_5, float fl_6)
69{
70#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
71 char buf[MAVLINK_MSG_ID_DATA_LOG_LEN];
72 _mav_put_float(buf, 0, fl_1);
73 _mav_put_float(buf, 4, fl_2);
74 _mav_put_float(buf, 8, fl_3);
75 _mav_put_float(buf, 12, fl_4);
76 _mav_put_float(buf, 16, fl_5);
77 _mav_put_float(buf, 20, fl_6);
78
79 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA_LOG_LEN);
80#else
81 mavlink_data_log_t packet;
82 packet.fl_1 = fl_1;
83 packet.fl_2 = fl_2;
84 packet.fl_3 = fl_3;
85 packet.fl_4 = fl_4;
86 packet.fl_5 = fl_5;
87 packet.fl_6 = fl_6;
88
89 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA_LOG_LEN);
90#endif
91
92 msg->msgid = MAVLINK_MSG_ID_DATA_LOG;
93 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA_LOG_MIN_LEN, MAVLINK_MSG_ID_DATA_LOG_LEN, MAVLINK_MSG_ID_DATA_LOG_CRC);
94}
95
110static inline uint16_t mavlink_msg_data_log_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
111 mavlink_message_t* msg,
112 float fl_1,float fl_2,float fl_3,float fl_4,float fl_5,float fl_6)
113{
114#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
115 char buf[MAVLINK_MSG_ID_DATA_LOG_LEN];
116 _mav_put_float(buf, 0, fl_1);
117 _mav_put_float(buf, 4, fl_2);
118 _mav_put_float(buf, 8, fl_3);
119 _mav_put_float(buf, 12, fl_4);
120 _mav_put_float(buf, 16, fl_5);
121 _mav_put_float(buf, 20, fl_6);
122
123 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA_LOG_LEN);
124#else
125 mavlink_data_log_t packet;
126 packet.fl_1 = fl_1;
127 packet.fl_2 = fl_2;
128 packet.fl_3 = fl_3;
129 packet.fl_4 = fl_4;
130 packet.fl_5 = fl_5;
131 packet.fl_6 = fl_6;
132
133 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA_LOG_LEN);
134#endif
135
136 msg->msgid = MAVLINK_MSG_ID_DATA_LOG;
137 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA_LOG_MIN_LEN, MAVLINK_MSG_ID_DATA_LOG_LEN, MAVLINK_MSG_ID_DATA_LOG_CRC);
138}
139
148static inline uint16_t mavlink_msg_data_log_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_data_log_t* data_log)
149{
150 return mavlink_msg_data_log_pack(system_id, component_id, msg, data_log->fl_1, data_log->fl_2, data_log->fl_3, data_log->fl_4, data_log->fl_5, data_log->fl_6);
151}
152
162static inline uint16_t mavlink_msg_data_log_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_data_log_t* data_log)
163{
164 return mavlink_msg_data_log_pack_chan(system_id, component_id, chan, msg, data_log->fl_1, data_log->fl_2, data_log->fl_3, data_log->fl_4, data_log->fl_5, data_log->fl_6);
165}
166
178#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179
180static inline void mavlink_msg_data_log_send(mavlink_channel_t chan, float fl_1, float fl_2, float fl_3, float fl_4, float fl_5, float fl_6)
181{
182#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 char buf[MAVLINK_MSG_ID_DATA_LOG_LEN];
184 _mav_put_float(buf, 0, fl_1);
185 _mav_put_float(buf, 4, fl_2);
186 _mav_put_float(buf, 8, fl_3);
187 _mav_put_float(buf, 12, fl_4);
188 _mav_put_float(buf, 16, fl_5);
189 _mav_put_float(buf, 20, fl_6);
190
191 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_LOG, buf, MAVLINK_MSG_ID_DATA_LOG_MIN_LEN, MAVLINK_MSG_ID_DATA_LOG_LEN, MAVLINK_MSG_ID_DATA_LOG_CRC);
192#else
193 mavlink_data_log_t packet;
194 packet.fl_1 = fl_1;
195 packet.fl_2 = fl_2;
196 packet.fl_3 = fl_3;
197 packet.fl_4 = fl_4;
198 packet.fl_5 = fl_5;
199 packet.fl_6 = fl_6;
200
201 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_LOG, (const char *)&packet, MAVLINK_MSG_ID_DATA_LOG_MIN_LEN, MAVLINK_MSG_ID_DATA_LOG_LEN, MAVLINK_MSG_ID_DATA_LOG_CRC);
202#endif
203}
204
210static inline void mavlink_msg_data_log_send_struct(mavlink_channel_t chan, const mavlink_data_log_t* data_log)
211{
212#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
213 mavlink_msg_data_log_send(chan, data_log->fl_1, data_log->fl_2, data_log->fl_3, data_log->fl_4, data_log->fl_5, data_log->fl_6);
214#else
215 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_LOG, (const char *)data_log, MAVLINK_MSG_ID_DATA_LOG_MIN_LEN, MAVLINK_MSG_ID_DATA_LOG_LEN, MAVLINK_MSG_ID_DATA_LOG_CRC);
216#endif
217}
218
219#if MAVLINK_MSG_ID_DATA_LOG_LEN <= MAVLINK_MAX_PAYLOAD_LEN
220/*
221 This varient of _send() can be used to save stack space by re-using
222 memory from the receive buffer. The caller provides a
223 mavlink_message_t which is the size of a full mavlink message. This
224 is usually the receive buffer for the channel, and allows a reply to an
225 incoming message with minimum stack space usage.
226 */
227static inline void mavlink_msg_data_log_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float fl_1, float fl_2, float fl_3, float fl_4, float fl_5, float fl_6)
228{
229#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
230 char *buf = (char *)msgbuf;
231 _mav_put_float(buf, 0, fl_1);
232 _mav_put_float(buf, 4, fl_2);
233 _mav_put_float(buf, 8, fl_3);
234 _mav_put_float(buf, 12, fl_4);
235 _mav_put_float(buf, 16, fl_5);
236 _mav_put_float(buf, 20, fl_6);
237
238 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_LOG, buf, MAVLINK_MSG_ID_DATA_LOG_MIN_LEN, MAVLINK_MSG_ID_DATA_LOG_LEN, MAVLINK_MSG_ID_DATA_LOG_CRC);
239#else
240 mavlink_data_log_t *packet = (mavlink_data_log_t *)msgbuf;
241 packet->fl_1 = fl_1;
242 packet->fl_2 = fl_2;
243 packet->fl_3 = fl_3;
244 packet->fl_4 = fl_4;
245 packet->fl_5 = fl_5;
246 packet->fl_6 = fl_6;
247
248 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_LOG, (const char *)packet, MAVLINK_MSG_ID_DATA_LOG_MIN_LEN, MAVLINK_MSG_ID_DATA_LOG_LEN, MAVLINK_MSG_ID_DATA_LOG_CRC);
249#endif
250}
251#endif
252
253#endif
254
255// MESSAGE DATA_LOG UNPACKING
256
257
263static inline float mavlink_msg_data_log_get_fl_1(const mavlink_message_t* msg)
264{
265 return _MAV_RETURN_float(msg, 0);
266}
267
273static inline float mavlink_msg_data_log_get_fl_2(const mavlink_message_t* msg)
274{
275 return _MAV_RETURN_float(msg, 4);
276}
277
283static inline float mavlink_msg_data_log_get_fl_3(const mavlink_message_t* msg)
284{
285 return _MAV_RETURN_float(msg, 8);
286}
287
293static inline float mavlink_msg_data_log_get_fl_4(const mavlink_message_t* msg)
294{
295 return _MAV_RETURN_float(msg, 12);
296}
297
303static inline float mavlink_msg_data_log_get_fl_5(const mavlink_message_t* msg)
304{
305 return _MAV_RETURN_float(msg, 16);
306}
307
313static inline float mavlink_msg_data_log_get_fl_6(const mavlink_message_t* msg)
314{
315 return _MAV_RETURN_float(msg, 20);
316}
317
324static inline void mavlink_msg_data_log_decode(const mavlink_message_t* msg, mavlink_data_log_t* data_log)
325{
326#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
327 data_log->fl_1 = mavlink_msg_data_log_get_fl_1(msg);
328 data_log->fl_2 = mavlink_msg_data_log_get_fl_2(msg);
329 data_log->fl_3 = mavlink_msg_data_log_get_fl_3(msg);
330 data_log->fl_4 = mavlink_msg_data_log_get_fl_4(msg);
331 data_log->fl_5 = mavlink_msg_data_log_get_fl_5(msg);
332 data_log->fl_6 = mavlink_msg_data_log_get_fl_6(msg);
333#else
334 uint8_t len = msg->len < MAVLINK_MSG_ID_DATA_LOG_LEN? msg->len : MAVLINK_MSG_ID_DATA_LOG_LEN;
335 memset(data_log, 0, MAVLINK_MSG_ID_DATA_LOG_LEN);
336 memcpy(data_log, _MAV_PAYLOAD(msg), len);
337#endif
338}