Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_logging_ack.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE LOGGING_ACK PACKING
3
4#define MAVLINK_MSG_ID_LOGGING_ACK 268
5
6
7typedef struct __mavlink_logging_ack_t {
8 uint16_t sequence; /*< sequence number (must match the one in LOGGING_DATA_ACKED)*/
9 uint8_t target_system; /*< system ID of the target*/
10 uint8_t target_component; /*< component ID of the target*/
11} mavlink_logging_ack_t;
12
13#define MAVLINK_MSG_ID_LOGGING_ACK_LEN 4
14#define MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN 4
15#define MAVLINK_MSG_ID_268_LEN 4
16#define MAVLINK_MSG_ID_268_MIN_LEN 4
17
18#define MAVLINK_MSG_ID_LOGGING_ACK_CRC 14
19#define MAVLINK_MSG_ID_268_CRC 14
20
21
22
23#if MAVLINK_COMMAND_24BIT
24#define MAVLINK_MESSAGE_INFO_LOGGING_ACK {
25 268,
26 "LOGGING_ACK",
27 3,
28 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_logging_ack_t, target_system) },
29 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_logging_ack_t, target_component) },
30 { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_logging_ack_t, sequence) },
31 } \
32}
33#else
34#define MAVLINK_MESSAGE_INFO_LOGGING_ACK {
35 "LOGGING_ACK",
36 3,
37 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_logging_ack_t, target_system) },
38 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_logging_ack_t, target_component) },
39 { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_logging_ack_t, sequence) },
40 } \
41}
42#endif
43
44/**
45 * @brief Pack a logging_ack message
46 * @param system_id ID of this system
47 * @param component_id ID of this component (e.g. 200 for IMU)
48 * @param msg The MAVLink message to compress the data into
49 *
50 * @param target_system system ID of the target
51 * @param target_component component ID of the target
52 * @param sequence sequence number (must match the one in LOGGING_DATA_ACKED)
53 * @return length of the message in bytes (excluding serial stream start sign)
54 */
55static inline uint16_t mavlink_msg_logging_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
56 uint8_t target_system, uint8_t target_component, uint16_t sequence)
57{
58#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
60 _mav_put_uint16_t(buf, 0, sequence);
61 _mav_put_uint8_t(buf, 2, target_system);
62 _mav_put_uint8_t(buf, 3, target_component);
63
64 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOGGING_ACK_LEN);
65#else
66 mavlink_logging_ack_t packet;
67 packet.sequence = sequence;
68 packet.target_system = target_system;
69 packet.target_component = target_component;
70
71 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOGGING_ACK_LEN);
72#endif
73
74 msg->msgid = MAVLINK_MSG_ID_LOGGING_ACK;
75 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN, MAVLINK_MSG_ID_LOGGING_ACK_CRC);
76}
77
78/**
79 * @brief Pack a logging_ack message
80 * @param system_id ID of this system
81 * @param component_id ID of this component (e.g. 200 for IMU)
82 * @param status MAVLink status structure
83 * @param msg The MAVLink message to compress the data into
84 *
85 * @param target_system system ID of the target
86 * @param target_component component ID of the target
87 * @param sequence sequence number (must match the one in LOGGING_DATA_ACKED)
88 * @return length of the message in bytes (excluding serial stream start sign)
89 */
90static inline uint16_t mavlink_msg_logging_ack_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
91 uint8_t target_system, uint8_t target_component, uint16_t sequence)
92{
93#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
95 _mav_put_uint16_t(buf, 0, sequence);
96 _mav_put_uint8_t(buf, 2, target_system);
97 _mav_put_uint8_t(buf, 3, target_component);
98
99 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOGGING_ACK_LEN);
100#else
101 mavlink_logging_ack_t packet;
102 packet.sequence = sequence;
103 packet.target_system = target_system;
104 packet.target_component = target_component;
105
106 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOGGING_ACK_LEN);
107#endif
108
109 msg->msgid = MAVLINK_MSG_ID_LOGGING_ACK;
110#if MAVLINK_CRC_EXTRA
111 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN, MAVLINK_MSG_ID_LOGGING_ACK_CRC);
112#else
113 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN);
114#endif
115}
116
117/**
118 * @brief Pack a logging_ack message on a channel
119 * @param system_id ID of this system
120 * @param component_id ID of this component (e.g. 200 for IMU)
121 * @param chan The MAVLink channel this message will be sent over
122 * @param msg The MAVLink message to compress the data into
123 * @param target_system system ID of the target
124 * @param target_component component ID of the target
125 * @param sequence sequence number (must match the one in LOGGING_DATA_ACKED)
126 * @return length of the message in bytes (excluding serial stream start sign)
127 */
128static inline uint16_t mavlink_msg_logging_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
129 mavlink_message_t* msg,
130 uint8_t target_system,uint8_t target_component,uint16_t sequence)
131{
132#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
134 _mav_put_uint16_t(buf, 0, sequence);
135 _mav_put_uint8_t(buf, 2, target_system);
136 _mav_put_uint8_t(buf, 3, target_component);
137
138 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOGGING_ACK_LEN);
139#else
140 mavlink_logging_ack_t packet;
141 packet.sequence = sequence;
142 packet.target_system = target_system;
143 packet.target_component = target_component;
144
145 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOGGING_ACK_LEN);
146#endif
147
148 msg->msgid = MAVLINK_MSG_ID_LOGGING_ACK;
149 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN, MAVLINK_MSG_ID_LOGGING_ACK_CRC);
150}
151
152/**
153 * @brief Encode a logging_ack struct
154 *
155 * @param system_id ID of this system
156 * @param component_id ID of this component (e.g. 200 for IMU)
157 * @param msg The MAVLink message to compress the data into
158 * @param logging_ack C-struct to read the message contents from
159 */
160static inline uint16_t mavlink_msg_logging_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_logging_ack_t* logging_ack)
161{
162 return mavlink_msg_logging_ack_pack(system_id, component_id, msg, logging_ack->target_system, logging_ack->target_component, logging_ack->sequence);
163}
164
165/**
166 * @brief Encode a logging_ack struct on a channel
167 *
168 * @param system_id ID of this system
169 * @param component_id ID of this component (e.g. 200 for IMU)
170 * @param chan The MAVLink channel this message will be sent over
171 * @param msg The MAVLink message to compress the data into
172 * @param logging_ack C-struct to read the message contents from
173 */
174static inline uint16_t mavlink_msg_logging_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_logging_ack_t* logging_ack)
175{
176 return mavlink_msg_logging_ack_pack_chan(system_id, component_id, chan, msg, logging_ack->target_system, logging_ack->target_component, logging_ack->sequence);
177}
178
179/**
180 * @brief Encode a logging_ack struct with provided status structure
181 *
182 * @param system_id ID of this system
183 * @param component_id ID of this component (e.g. 200 for IMU)
184 * @param status MAVLink status structure
185 * @param msg The MAVLink message to compress the data into
186 * @param logging_ack C-struct to read the message contents from
187 */
188static inline uint16_t mavlink_msg_logging_ack_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_logging_ack_t* logging_ack)
189{
190 return mavlink_msg_logging_ack_pack_status(system_id, component_id, _status, msg, logging_ack->target_system, logging_ack->target_component, logging_ack->sequence);
191}
192
193/**
194 * @brief Send a logging_ack message
195 * @param chan MAVLink channel to send the message
196 *
197 * @param target_system system ID of the target
198 * @param target_component component ID of the target
199 * @param sequence sequence number (must match the one in LOGGING_DATA_ACKED)
200 */
201#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
202
203static inline void mavlink_msg_logging_ack_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t sequence)
204{
205#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
206 char buf[MAVLINK_MSG_ID_LOGGING_ACK_LEN];
207 _mav_put_uint16_t(buf, 0, sequence);
208 _mav_put_uint8_t(buf, 2, target_system);
209 _mav_put_uint8_t(buf, 3, target_component);
210
211 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOGGING_ACK, buf, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN, MAVLINK_MSG_ID_LOGGING_ACK_CRC);
212#else
213 mavlink_logging_ack_t packet;
214 packet.sequence = sequence;
215 packet.target_system = target_system;
216 packet.target_component = target_component;
217
218 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOGGING_ACK, (const char *)&packet, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN, MAVLINK_MSG_ID_LOGGING_ACK_CRC);
219#endif
220}
221
222/**
223 * @brief Send a logging_ack message
224 * @param chan MAVLink channel to send the message
225 * @param struct The MAVLink struct to serialize
226 */
227static inline void mavlink_msg_logging_ack_send_struct(mavlink_channel_t chan, const mavlink_logging_ack_t* logging_ack)
228{
229#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
230 mavlink_msg_logging_ack_send(chan, logging_ack->target_system, logging_ack->target_component, logging_ack->sequence);
231#else
232 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOGGING_ACK, (const char *)logging_ack, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN, MAVLINK_MSG_ID_LOGGING_ACK_CRC);
233#endif
234}
235
236#if MAVLINK_MSG_ID_LOGGING_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
237/*
238 This variant of _send() can be used to save stack space by reusing
239 memory from the receive buffer. The caller provides a
240 mavlink_message_t which is the size of a full mavlink message. This
241 is usually the receive buffer for the channel, and allows a reply to an
242 incoming message with minimum stack space usage.
243 */
244static inline void mavlink_msg_logging_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t sequence)
245{
246#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
247 char *buf = (char *)msgbuf;
248 _mav_put_uint16_t(buf, 0, sequence);
249 _mav_put_uint8_t(buf, 2, target_system);
250 _mav_put_uint8_t(buf, 3, target_component);
251
252 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOGGING_ACK, buf, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN, MAVLINK_MSG_ID_LOGGING_ACK_CRC);
253#else
254 mavlink_logging_ack_t *packet = (mavlink_logging_ack_t *)msgbuf;
255 packet->sequence = sequence;
256 packet->target_system = target_system;
257 packet->target_component = target_component;
258
259 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOGGING_ACK, (const char *)packet, MAVLINK_MSG_ID_LOGGING_ACK_MIN_LEN, MAVLINK_MSG_ID_LOGGING_ACK_LEN, MAVLINK_MSG_ID_LOGGING_ACK_CRC);
260#endif
261}
262#endif
263
264#endif
265
266// MESSAGE LOGGING_ACK UNPACKING
267
268
269/**
270 * @brief Get field target_system from logging_ack message
271 *
272 * @return system ID of the target
273 */
274static inline uint8_t mavlink_msg_logging_ack_get_target_system(const mavlink_message_t* msg)
275{
276 return _MAV_RETURN_uint8_t(msg, 2);
277}
278
279/**
280 * @brief Get field target_component from logging_ack message
281 *
282 * @return component ID of the target
283 */
284static inline uint8_t mavlink_msg_logging_ack_get_target_component(const mavlink_message_t* msg)
285{
286 return _MAV_RETURN_uint8_t(msg, 3);
287}
288
289/**
290 * @brief Get field sequence from logging_ack message
291 *
292 * @return sequence number (must match the one in LOGGING_DATA_ACKED)
293 */
294static inline uint16_t mavlink_msg_logging_ack_get_sequence(const mavlink_message_t* msg)
295{
296 return _MAV_RETURN_uint16_t(msg, 0);
297}
298
299/**
300 * @brief Decode a logging_ack message into a struct
301 *
302 * @param msg The message to decode
303 * @param logging_ack C-struct to decode the message contents into
304 */
305static inline void mavlink_msg_logging_ack_decode(const mavlink_message_t* msg, mavlink_logging_ack_t* logging_ack)
306{
307#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
308 logging_ack->sequence = mavlink_msg_logging_ack_get_sequence(msg);
309 logging_ack->target_system = mavlink_msg_logging_ack_get_target_system(msg);
310 logging_ack->target_component = mavlink_msg_logging_ack_get_target_component(msg);
311#else
312 uint8_t len = msg->len < MAVLINK_MSG_ID_LOGGING_ACK_LEN? msg->len : MAVLINK_MSG_ID_LOGGING_ACK_LEN;
313 memset(logging_ack, 0, MAVLINK_MSG_ID_LOGGING_ACK_LEN);
314 memcpy(logging_ack, _MAV_PAYLOAD(msg), len);
315#endif
316}