source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_log_request_data.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

File size: 12.4 KB
Line 
1// MESSAGE LOG_REQUEST_DATA PACKING
2
3#define MAVLINK_MSG_ID_LOG_REQUEST_DATA 119
4
5typedef struct MAVLINK_PACKED __mavlink_log_request_data_t
6{
7 uint32_t ofs; /*< Offset into the log*/
8 uint32_t count; /*< Number of bytes*/
9 uint16_t id; /*< Log id (from LOG_ENTRY reply)*/
10 uint8_t target_system; /*< System ID*/
11 uint8_t target_component; /*< Component ID*/
12} mavlink_log_request_data_t;
13
14#define MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN 12
15#define MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN 12
16#define MAVLINK_MSG_ID_119_LEN 12
17#define MAVLINK_MSG_ID_119_MIN_LEN 12
18
19#define MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC 116
20#define MAVLINK_MSG_ID_119_CRC 116
21
22
23
24#if MAVLINK_COMMAND_24BIT
25#define MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA { \
26 119, \
27 "LOG_REQUEST_DATA", \
28 5, \
29 { { "ofs", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_log_request_data_t, ofs) }, \
30 { "count", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_log_request_data_t, count) }, \
31 { "id", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_log_request_data_t, id) }, \
32 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_log_request_data_t, target_system) }, \
33 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_log_request_data_t, target_component) }, \
34 } \
35}
36#else
37#define MAVLINK_MESSAGE_INFO_LOG_REQUEST_DATA { \
38 "LOG_REQUEST_DATA", \
39 5, \
40 { { "ofs", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_log_request_data_t, ofs) }, \
41 { "count", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_log_request_data_t, count) }, \
42 { "id", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_log_request_data_t, id) }, \
43 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_log_request_data_t, target_system) }, \
44 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_log_request_data_t, target_component) }, \
45 } \
46}
47#endif
48
49/**
50 * @brief Pack a log_request_data message
51 * @param system_id ID of this system
52 * @param component_id ID of this component (e.g. 200 for IMU)
53 * @param msg The MAVLink message to compress the data into
54 *
55 * @param target_system System ID
56 * @param target_component Component ID
57 * @param id Log id (from LOG_ENTRY reply)
58 * @param ofs Offset into the log
59 * @param count Number of bytes
60 * @return length of the message in bytes (excluding serial stream start sign)
61 */
62static inline uint16_t mavlink_msg_log_request_data_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
63 uint8_t target_system, uint8_t target_component, uint16_t id, uint32_t ofs, uint32_t count)
64{
65#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
66 char buf[MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN];
67 _mav_put_uint32_t(buf, 0, ofs);
68 _mav_put_uint32_t(buf, 4, count);
69 _mav_put_uint16_t(buf, 8, id);
70 _mav_put_uint8_t(buf, 10, target_system);
71 _mav_put_uint8_t(buf, 11, target_component);
72
73 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
74#else
75 mavlink_log_request_data_t packet;
76 packet.ofs = ofs;
77 packet.count = count;
78 packet.id = id;
79 packet.target_system = target_system;
80 packet.target_component = target_component;
81
82 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
83#endif
84
85 msg->msgid = MAVLINK_MSG_ID_LOG_REQUEST_DATA;
86 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
87}
88
89/**
90 * @brief Pack a log_request_data message on a channel
91 * @param system_id ID of this system
92 * @param component_id ID of this component (e.g. 200 for IMU)
93 * @param chan The MAVLink channel this message will be sent over
94 * @param msg The MAVLink message to compress the data into
95 * @param target_system System ID
96 * @param target_component Component ID
97 * @param id Log id (from LOG_ENTRY reply)
98 * @param ofs Offset into the log
99 * @param count Number of bytes
100 * @return length of the message in bytes (excluding serial stream start sign)
101 */
102static inline uint16_t mavlink_msg_log_request_data_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
103 mavlink_message_t* msg,
104 uint8_t target_system,uint8_t target_component,uint16_t id,uint32_t ofs,uint32_t count)
105{
106#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
107 char buf[MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN];
108 _mav_put_uint32_t(buf, 0, ofs);
109 _mav_put_uint32_t(buf, 4, count);
110 _mav_put_uint16_t(buf, 8, id);
111 _mav_put_uint8_t(buf, 10, target_system);
112 _mav_put_uint8_t(buf, 11, target_component);
113
114 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
115#else
116 mavlink_log_request_data_t packet;
117 packet.ofs = ofs;
118 packet.count = count;
119 packet.id = id;
120 packet.target_system = target_system;
121 packet.target_component = target_component;
122
123 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
124#endif
125
126 msg->msgid = MAVLINK_MSG_ID_LOG_REQUEST_DATA;
127 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
128}
129
130/**
131 * @brief Encode a log_request_data struct
132 *
133 * @param system_id ID of this system
134 * @param component_id ID of this component (e.g. 200 for IMU)
135 * @param msg The MAVLink message to compress the data into
136 * @param log_request_data C-struct to read the message contents from
137 */
138static inline uint16_t mavlink_msg_log_request_data_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_log_request_data_t* log_request_data)
139{
140 return mavlink_msg_log_request_data_pack(system_id, component_id, msg, log_request_data->target_system, log_request_data->target_component, log_request_data->id, log_request_data->ofs, log_request_data->count);
141}
142
143/**
144 * @brief Encode a log_request_data struct on a channel
145 *
146 * @param system_id ID of this system
147 * @param component_id ID of this component (e.g. 200 for IMU)
148 * @param chan The MAVLink channel this message will be sent over
149 * @param msg The MAVLink message to compress the data into
150 * @param log_request_data C-struct to read the message contents from
151 */
152static inline uint16_t mavlink_msg_log_request_data_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_log_request_data_t* log_request_data)
153{
154 return mavlink_msg_log_request_data_pack_chan(system_id, component_id, chan, msg, log_request_data->target_system, log_request_data->target_component, log_request_data->id, log_request_data->ofs, log_request_data->count);
155}
156
157/**
158 * @brief Send a log_request_data 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 id Log id (from LOG_ENTRY reply)
164 * @param ofs Offset into the log
165 * @param count Number of bytes
166 */
167#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
168
169static inline void mavlink_msg_log_request_data_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t id, uint32_t ofs, uint32_t count)
170{
171#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
172 char buf[MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN];
173 _mav_put_uint32_t(buf, 0, ofs);
174 _mav_put_uint32_t(buf, 4, count);
175 _mav_put_uint16_t(buf, 8, id);
176 _mav_put_uint8_t(buf, 10, target_system);
177 _mav_put_uint8_t(buf, 11, target_component);
178
179 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
180#else
181 mavlink_log_request_data_t packet;
182 packet.ofs = ofs;
183 packet.count = count;
184 packet.id = id;
185 packet.target_system = target_system;
186 packet.target_component = target_component;
187
188 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, (const char *)&packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
189#endif
190}
191
192/**
193 * @brief Send a log_request_data message
194 * @param chan MAVLink channel to send the message
195 * @param struct The MAVLink struct to serialize
196 */
197static inline void mavlink_msg_log_request_data_send_struct(mavlink_channel_t chan, const mavlink_log_request_data_t* log_request_data)
198{
199#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
200 mavlink_msg_log_request_data_send(chan, log_request_data->target_system, log_request_data->target_component, log_request_data->id, log_request_data->ofs, log_request_data->count);
201#else
202 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, (const char *)log_request_data, MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
203#endif
204}
205
206#if MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
207/*
208 This varient of _send() can be used to save stack space by re-using
209 memory from the receive buffer. The caller provides a
210 mavlink_message_t which is the size of a full mavlink message. This
211 is usually the receive buffer for the channel, and allows a reply to an
212 incoming message with minimum stack space usage.
213 */
214static inline void mavlink_msg_log_request_data_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t id, uint32_t ofs, uint32_t count)
215{
216#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
217 char *buf = (char *)msgbuf;
218 _mav_put_uint32_t(buf, 0, ofs);
219 _mav_put_uint32_t(buf, 4, count);
220 _mav_put_uint16_t(buf, 8, id);
221 _mav_put_uint8_t(buf, 10, target_system);
222 _mav_put_uint8_t(buf, 11, target_component);
223
224 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, buf, MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
225#else
226 mavlink_log_request_data_t *packet = (mavlink_log_request_data_t *)msgbuf;
227 packet->ofs = ofs;
228 packet->count = count;
229 packet->id = id;
230 packet->target_system = target_system;
231 packet->target_component = target_component;
232
233 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_REQUEST_DATA, (const char *)packet, MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN, MAVLINK_MSG_ID_LOG_REQUEST_DATA_CRC);
234#endif
235}
236#endif
237
238#endif
239
240// MESSAGE LOG_REQUEST_DATA UNPACKING
241
242
243/**
244 * @brief Get field target_system from log_request_data message
245 *
246 * @return System ID
247 */
248static inline uint8_t mavlink_msg_log_request_data_get_target_system(const mavlink_message_t* msg)
249{
250 return _MAV_RETURN_uint8_t(msg, 10);
251}
252
253/**
254 * @brief Get field target_component from log_request_data message
255 *
256 * @return Component ID
257 */
258static inline uint8_t mavlink_msg_log_request_data_get_target_component(const mavlink_message_t* msg)
259{
260 return _MAV_RETURN_uint8_t(msg, 11);
261}
262
263/**
264 * @brief Get field id from log_request_data message
265 *
266 * @return Log id (from LOG_ENTRY reply)
267 */
268static inline uint16_t mavlink_msg_log_request_data_get_id(const mavlink_message_t* msg)
269{
270 return _MAV_RETURN_uint16_t(msg, 8);
271}
272
273/**
274 * @brief Get field ofs from log_request_data message
275 *
276 * @return Offset into the log
277 */
278static inline uint32_t mavlink_msg_log_request_data_get_ofs(const mavlink_message_t* msg)
279{
280 return _MAV_RETURN_uint32_t(msg, 0);
281}
282
283/**
284 * @brief Get field count from log_request_data message
285 *
286 * @return Number of bytes
287 */
288static inline uint32_t mavlink_msg_log_request_data_get_count(const mavlink_message_t* msg)
289{
290 return _MAV_RETURN_uint32_t(msg, 4);
291}
292
293/**
294 * @brief Decode a log_request_data message into a struct
295 *
296 * @param msg The message to decode
297 * @param log_request_data C-struct to decode the message contents into
298 */
299static inline void mavlink_msg_log_request_data_decode(const mavlink_message_t* msg, mavlink_log_request_data_t* log_request_data)
300{
301#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
302 log_request_data->ofs = mavlink_msg_log_request_data_get_ofs(msg);
303 log_request_data->count = mavlink_msg_log_request_data_get_count(msg);
304 log_request_data->id = mavlink_msg_log_request_data_get_id(msg);
305 log_request_data->target_system = mavlink_msg_log_request_data_get_target_system(msg);
306 log_request_data->target_component = mavlink_msg_log_request_data_get_target_component(msg);
307#else
308 uint8_t len = msg->len < MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN? msg->len : MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN;
309 memset(log_request_data, 0, MAVLINK_MSG_ID_LOG_REQUEST_DATA_LEN);
310 memcpy(log_request_data, _MAV_PAYLOAD(msg), len);
311#endif
312}
Note: See TracBrowser for help on using the repository browser.