1 | // MESSAGE LOG_ENTRY PACKING
|
---|
2 |
|
---|
3 | #define MAVLINK_MSG_ID_LOG_ENTRY 118
|
---|
4 |
|
---|
5 | typedef struct MAVLINK_PACKED __mavlink_log_entry_t
|
---|
6 | {
|
---|
7 | uint32_t time_utc; /*< UTC timestamp of log in seconds since 1970, or 0 if not available*/
|
---|
8 | uint32_t size; /*< Size of the log (may be approximate) in bytes*/
|
---|
9 | uint16_t id; /*< Log id*/
|
---|
10 | uint16_t num_logs; /*< Total number of logs*/
|
---|
11 | uint16_t last_log_num; /*< High log number*/
|
---|
12 | } mavlink_log_entry_t;
|
---|
13 |
|
---|
14 | #define MAVLINK_MSG_ID_LOG_ENTRY_LEN 14
|
---|
15 | #define MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN 14
|
---|
16 | #define MAVLINK_MSG_ID_118_LEN 14
|
---|
17 | #define MAVLINK_MSG_ID_118_MIN_LEN 14
|
---|
18 |
|
---|
19 | #define MAVLINK_MSG_ID_LOG_ENTRY_CRC 56
|
---|
20 | #define MAVLINK_MSG_ID_118_CRC 56
|
---|
21 |
|
---|
22 |
|
---|
23 |
|
---|
24 | #if MAVLINK_COMMAND_24BIT
|
---|
25 | #define MAVLINK_MESSAGE_INFO_LOG_ENTRY { \
|
---|
26 | 118, \
|
---|
27 | "LOG_ENTRY", \
|
---|
28 | 5, \
|
---|
29 | { { "time_utc", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_log_entry_t, time_utc) }, \
|
---|
30 | { "size", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_log_entry_t, size) }, \
|
---|
31 | { "id", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_log_entry_t, id) }, \
|
---|
32 | { "num_logs", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_log_entry_t, num_logs) }, \
|
---|
33 | { "last_log_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_log_entry_t, last_log_num) }, \
|
---|
34 | } \
|
---|
35 | }
|
---|
36 | #else
|
---|
37 | #define MAVLINK_MESSAGE_INFO_LOG_ENTRY { \
|
---|
38 | "LOG_ENTRY", \
|
---|
39 | 5, \
|
---|
40 | { { "time_utc", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_log_entry_t, time_utc) }, \
|
---|
41 | { "size", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_log_entry_t, size) }, \
|
---|
42 | { "id", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_log_entry_t, id) }, \
|
---|
43 | { "num_logs", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_log_entry_t, num_logs) }, \
|
---|
44 | { "last_log_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_log_entry_t, last_log_num) }, \
|
---|
45 | } \
|
---|
46 | }
|
---|
47 | #endif
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * @brief Pack a log_entry 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 id Log id
|
---|
56 | * @param num_logs Total number of logs
|
---|
57 | * @param last_log_num High log number
|
---|
58 | * @param time_utc UTC timestamp of log in seconds since 1970, or 0 if not available
|
---|
59 | * @param size Size of the log (may be approximate) in bytes
|
---|
60 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
61 | */
|
---|
62 | static inline uint16_t mavlink_msg_log_entry_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
63 | uint16_t id, uint16_t num_logs, uint16_t last_log_num, uint32_t time_utc, uint32_t size)
|
---|
64 | {
|
---|
65 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
66 | char buf[MAVLINK_MSG_ID_LOG_ENTRY_LEN];
|
---|
67 | _mav_put_uint32_t(buf, 0, time_utc);
|
---|
68 | _mav_put_uint32_t(buf, 4, size);
|
---|
69 | _mav_put_uint16_t(buf, 8, id);
|
---|
70 | _mav_put_uint16_t(buf, 10, num_logs);
|
---|
71 | _mav_put_uint16_t(buf, 12, last_log_num);
|
---|
72 |
|
---|
73 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_ENTRY_LEN);
|
---|
74 | #else
|
---|
75 | mavlink_log_entry_t packet;
|
---|
76 | packet.time_utc = time_utc;
|
---|
77 | packet.size = size;
|
---|
78 | packet.id = id;
|
---|
79 | packet.num_logs = num_logs;
|
---|
80 | packet.last_log_num = last_log_num;
|
---|
81 |
|
---|
82 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_ENTRY_LEN);
|
---|
83 | #endif
|
---|
84 |
|
---|
85 | msg->msgid = MAVLINK_MSG_ID_LOG_ENTRY;
|
---|
86 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN, MAVLINK_MSG_ID_LOG_ENTRY_LEN, MAVLINK_MSG_ID_LOG_ENTRY_CRC);
|
---|
87 | }
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * @brief Pack a log_entry 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 id Log id
|
---|
96 | * @param num_logs Total number of logs
|
---|
97 | * @param last_log_num High log number
|
---|
98 | * @param time_utc UTC timestamp of log in seconds since 1970, or 0 if not available
|
---|
99 | * @param size Size of the log (may be approximate) in bytes
|
---|
100 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
101 | */
|
---|
102 | static inline uint16_t mavlink_msg_log_entry_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
103 | mavlink_message_t* msg,
|
---|
104 | uint16_t id,uint16_t num_logs,uint16_t last_log_num,uint32_t time_utc,uint32_t size)
|
---|
105 | {
|
---|
106 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
107 | char buf[MAVLINK_MSG_ID_LOG_ENTRY_LEN];
|
---|
108 | _mav_put_uint32_t(buf, 0, time_utc);
|
---|
109 | _mav_put_uint32_t(buf, 4, size);
|
---|
110 | _mav_put_uint16_t(buf, 8, id);
|
---|
111 | _mav_put_uint16_t(buf, 10, num_logs);
|
---|
112 | _mav_put_uint16_t(buf, 12, last_log_num);
|
---|
113 |
|
---|
114 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOG_ENTRY_LEN);
|
---|
115 | #else
|
---|
116 | mavlink_log_entry_t packet;
|
---|
117 | packet.time_utc = time_utc;
|
---|
118 | packet.size = size;
|
---|
119 | packet.id = id;
|
---|
120 | packet.num_logs = num_logs;
|
---|
121 | packet.last_log_num = last_log_num;
|
---|
122 |
|
---|
123 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOG_ENTRY_LEN);
|
---|
124 | #endif
|
---|
125 |
|
---|
126 | msg->msgid = MAVLINK_MSG_ID_LOG_ENTRY;
|
---|
127 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN, MAVLINK_MSG_ID_LOG_ENTRY_LEN, MAVLINK_MSG_ID_LOG_ENTRY_CRC);
|
---|
128 | }
|
---|
129 |
|
---|
130 | /**
|
---|
131 | * @brief Encode a log_entry 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_entry C-struct to read the message contents from
|
---|
137 | */
|
---|
138 | static inline uint16_t mavlink_msg_log_entry_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_log_entry_t* log_entry)
|
---|
139 | {
|
---|
140 | return mavlink_msg_log_entry_pack(system_id, component_id, msg, log_entry->id, log_entry->num_logs, log_entry->last_log_num, log_entry->time_utc, log_entry->size);
|
---|
141 | }
|
---|
142 |
|
---|
143 | /**
|
---|
144 | * @brief Encode a log_entry 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_entry C-struct to read the message contents from
|
---|
151 | */
|
---|
152 | static inline uint16_t mavlink_msg_log_entry_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_log_entry_t* log_entry)
|
---|
153 | {
|
---|
154 | return mavlink_msg_log_entry_pack_chan(system_id, component_id, chan, msg, log_entry->id, log_entry->num_logs, log_entry->last_log_num, log_entry->time_utc, log_entry->size);
|
---|
155 | }
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * @brief Send a log_entry message
|
---|
159 | * @param chan MAVLink channel to send the message
|
---|
160 | *
|
---|
161 | * @param id Log id
|
---|
162 | * @param num_logs Total number of logs
|
---|
163 | * @param last_log_num High log number
|
---|
164 | * @param time_utc UTC timestamp of log in seconds since 1970, or 0 if not available
|
---|
165 | * @param size Size of the log (may be approximate) in bytes
|
---|
166 | */
|
---|
167 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
168 |
|
---|
169 | static inline void mavlink_msg_log_entry_send(mavlink_channel_t chan, uint16_t id, uint16_t num_logs, uint16_t last_log_num, uint32_t time_utc, uint32_t size)
|
---|
170 | {
|
---|
171 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
172 | char buf[MAVLINK_MSG_ID_LOG_ENTRY_LEN];
|
---|
173 | _mav_put_uint32_t(buf, 0, time_utc);
|
---|
174 | _mav_put_uint32_t(buf, 4, size);
|
---|
175 | _mav_put_uint16_t(buf, 8, id);
|
---|
176 | _mav_put_uint16_t(buf, 10, num_logs);
|
---|
177 | _mav_put_uint16_t(buf, 12, last_log_num);
|
---|
178 |
|
---|
179 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_ENTRY, buf, MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN, MAVLINK_MSG_ID_LOG_ENTRY_LEN, MAVLINK_MSG_ID_LOG_ENTRY_CRC);
|
---|
180 | #else
|
---|
181 | mavlink_log_entry_t packet;
|
---|
182 | packet.time_utc = time_utc;
|
---|
183 | packet.size = size;
|
---|
184 | packet.id = id;
|
---|
185 | packet.num_logs = num_logs;
|
---|
186 | packet.last_log_num = last_log_num;
|
---|
187 |
|
---|
188 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_ENTRY, (const char *)&packet, MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN, MAVLINK_MSG_ID_LOG_ENTRY_LEN, MAVLINK_MSG_ID_LOG_ENTRY_CRC);
|
---|
189 | #endif
|
---|
190 | }
|
---|
191 |
|
---|
192 | /**
|
---|
193 | * @brief Send a log_entry message
|
---|
194 | * @param chan MAVLink channel to send the message
|
---|
195 | * @param struct The MAVLink struct to serialize
|
---|
196 | */
|
---|
197 | static inline void mavlink_msg_log_entry_send_struct(mavlink_channel_t chan, const mavlink_log_entry_t* log_entry)
|
---|
198 | {
|
---|
199 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
200 | mavlink_msg_log_entry_send(chan, log_entry->id, log_entry->num_logs, log_entry->last_log_num, log_entry->time_utc, log_entry->size);
|
---|
201 | #else
|
---|
202 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_ENTRY, (const char *)log_entry, MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN, MAVLINK_MSG_ID_LOG_ENTRY_LEN, MAVLINK_MSG_ID_LOG_ENTRY_CRC);
|
---|
203 | #endif
|
---|
204 | }
|
---|
205 |
|
---|
206 | #if MAVLINK_MSG_ID_LOG_ENTRY_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 | */
|
---|
214 | static inline void mavlink_msg_log_entry_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t id, uint16_t num_logs, uint16_t last_log_num, uint32_t time_utc, uint32_t size)
|
---|
215 | {
|
---|
216 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
217 | char *buf = (char *)msgbuf;
|
---|
218 | _mav_put_uint32_t(buf, 0, time_utc);
|
---|
219 | _mav_put_uint32_t(buf, 4, size);
|
---|
220 | _mav_put_uint16_t(buf, 8, id);
|
---|
221 | _mav_put_uint16_t(buf, 10, num_logs);
|
---|
222 | _mav_put_uint16_t(buf, 12, last_log_num);
|
---|
223 |
|
---|
224 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_ENTRY, buf, MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN, MAVLINK_MSG_ID_LOG_ENTRY_LEN, MAVLINK_MSG_ID_LOG_ENTRY_CRC);
|
---|
225 | #else
|
---|
226 | mavlink_log_entry_t *packet = (mavlink_log_entry_t *)msgbuf;
|
---|
227 | packet->time_utc = time_utc;
|
---|
228 | packet->size = size;
|
---|
229 | packet->id = id;
|
---|
230 | packet->num_logs = num_logs;
|
---|
231 | packet->last_log_num = last_log_num;
|
---|
232 |
|
---|
233 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOG_ENTRY, (const char *)packet, MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN, MAVLINK_MSG_ID_LOG_ENTRY_LEN, MAVLINK_MSG_ID_LOG_ENTRY_CRC);
|
---|
234 | #endif
|
---|
235 | }
|
---|
236 | #endif
|
---|
237 |
|
---|
238 | #endif
|
---|
239 |
|
---|
240 | // MESSAGE LOG_ENTRY UNPACKING
|
---|
241 |
|
---|
242 |
|
---|
243 | /**
|
---|
244 | * @brief Get field id from log_entry message
|
---|
245 | *
|
---|
246 | * @return Log id
|
---|
247 | */
|
---|
248 | static inline uint16_t mavlink_msg_log_entry_get_id(const mavlink_message_t* msg)
|
---|
249 | {
|
---|
250 | return _MAV_RETURN_uint16_t(msg, 8);
|
---|
251 | }
|
---|
252 |
|
---|
253 | /**
|
---|
254 | * @brief Get field num_logs from log_entry message
|
---|
255 | *
|
---|
256 | * @return Total number of logs
|
---|
257 | */
|
---|
258 | static inline uint16_t mavlink_msg_log_entry_get_num_logs(const mavlink_message_t* msg)
|
---|
259 | {
|
---|
260 | return _MAV_RETURN_uint16_t(msg, 10);
|
---|
261 | }
|
---|
262 |
|
---|
263 | /**
|
---|
264 | * @brief Get field last_log_num from log_entry message
|
---|
265 | *
|
---|
266 | * @return High log number
|
---|
267 | */
|
---|
268 | static inline uint16_t mavlink_msg_log_entry_get_last_log_num(const mavlink_message_t* msg)
|
---|
269 | {
|
---|
270 | return _MAV_RETURN_uint16_t(msg, 12);
|
---|
271 | }
|
---|
272 |
|
---|
273 | /**
|
---|
274 | * @brief Get field time_utc from log_entry message
|
---|
275 | *
|
---|
276 | * @return UTC timestamp of log in seconds since 1970, or 0 if not available
|
---|
277 | */
|
---|
278 | static inline uint32_t mavlink_msg_log_entry_get_time_utc(const mavlink_message_t* msg)
|
---|
279 | {
|
---|
280 | return _MAV_RETURN_uint32_t(msg, 0);
|
---|
281 | }
|
---|
282 |
|
---|
283 | /**
|
---|
284 | * @brief Get field size from log_entry message
|
---|
285 | *
|
---|
286 | * @return Size of the log (may be approximate) in bytes
|
---|
287 | */
|
---|
288 | static inline uint32_t mavlink_msg_log_entry_get_size(const mavlink_message_t* msg)
|
---|
289 | {
|
---|
290 | return _MAV_RETURN_uint32_t(msg, 4);
|
---|
291 | }
|
---|
292 |
|
---|
293 | /**
|
---|
294 | * @brief Decode a log_entry message into a struct
|
---|
295 | *
|
---|
296 | * @param msg The message to decode
|
---|
297 | * @param log_entry C-struct to decode the message contents into
|
---|
298 | */
|
---|
299 | static inline void mavlink_msg_log_entry_decode(const mavlink_message_t* msg, mavlink_log_entry_t* log_entry)
|
---|
300 | {
|
---|
301 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
302 | log_entry->time_utc = mavlink_msg_log_entry_get_time_utc(msg);
|
---|
303 | log_entry->size = mavlink_msg_log_entry_get_size(msg);
|
---|
304 | log_entry->id = mavlink_msg_log_entry_get_id(msg);
|
---|
305 | log_entry->num_logs = mavlink_msg_log_entry_get_num_logs(msg);
|
---|
306 | log_entry->last_log_num = mavlink_msg_log_entry_get_last_log_num(msg);
|
---|
307 | #else
|
---|
308 | uint8_t len = msg->len < MAVLINK_MSG_ID_LOG_ENTRY_LEN? msg->len : MAVLINK_MSG_ID_LOG_ENTRY_LEN;
|
---|
309 | memset(log_entry, 0, MAVLINK_MSG_ID_LOG_ENTRY_LEN);
|
---|
310 | memcpy(log_entry, _MAV_PAYLOAD(msg), len);
|
---|
311 | #endif
|
---|
312 | }
|
---|