Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_link_node_status.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE LINK_NODE_STATUS PACKING
3
4#define MAVLINK_MSG_ID_LINK_NODE_STATUS 8
5
6
8 uint64_t timestamp; /*< [ms] Timestamp (time since system boot).*/
9 uint32_t tx_rate; /*< [bytes/s] Transmit rate*/
10 uint32_t rx_rate; /*< [bytes/s] Receive rate*/
11 uint32_t messages_sent; /*< Messages sent*/
12 uint32_t messages_received; /*< Messages received (estimated from counting seq)*/
13 uint32_t messages_lost; /*< Messages lost (estimated from counting seq)*/
14 uint16_t rx_parse_err; /*< [bytes] Number of bytes that could not be parsed correctly.*/
15 uint16_t tx_overflows; /*< [bytes] Transmit buffer overflows. This number wraps around as it reaches UINT16_MAX*/
16 uint16_t rx_overflows; /*< [bytes] Receive buffer overflows. This number wraps around as it reaches UINT16_MAX*/
17 uint8_t tx_buf; /*< [%] Remaining free transmit buffer space*/
18 uint8_t rx_buf; /*< [%] Remaining free receive buffer space*/
19} mavlink_link_node_status_t;
20
21#define MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN 36
22#define MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN 36
23#define MAVLINK_MSG_ID_8_LEN 36
24#define MAVLINK_MSG_ID_8_MIN_LEN 36
25
26#define MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC 117
27#define MAVLINK_MSG_ID_8_CRC 117
28
29
30
31#if MAVLINK_COMMAND_24BIT
32#define MAVLINK_MESSAGE_INFO_LINK_NODE_STATUS {
33 8,
34 "LINK_NODE_STATUS",
35 11,
36 { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_link_node_status_t, timestamp) },
37 { "tx_buf", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_link_node_status_t, tx_buf) },
38 { "rx_buf", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_link_node_status_t, rx_buf) },
39 { "tx_rate", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_link_node_status_t, tx_rate) },
40 { "rx_rate", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_link_node_status_t, rx_rate) },
41 { "rx_parse_err", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_link_node_status_t, rx_parse_err) },
42 { "tx_overflows", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_link_node_status_t, tx_overflows) },
43 { "rx_overflows", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_link_node_status_t, rx_overflows) },
44 { "messages_sent", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_link_node_status_t, messages_sent) },
45 { "messages_received", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_link_node_status_t, messages_received) },
46 { "messages_lost", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_link_node_status_t, messages_lost) },
47 } \
48}
49#else
50#define MAVLINK_MESSAGE_INFO_LINK_NODE_STATUS {
51 "LINK_NODE_STATUS",
52 11,
53 { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_link_node_status_t, timestamp) },
54 { "tx_buf", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_link_node_status_t, tx_buf) },
55 { "rx_buf", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_link_node_status_t, rx_buf) },
56 { "tx_rate", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_link_node_status_t, tx_rate) },
57 { "rx_rate", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_link_node_status_t, rx_rate) },
58 { "rx_parse_err", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_link_node_status_t, rx_parse_err) },
59 { "tx_overflows", NULL, MAVLINK_TYPE_UINT16_T, 0, 30, offsetof(mavlink_link_node_status_t, tx_overflows) },
60 { "rx_overflows", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_link_node_status_t, rx_overflows) },
61 { "messages_sent", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_link_node_status_t, messages_sent) },
62 { "messages_received", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_link_node_status_t, messages_received) },
63 { "messages_lost", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_link_node_status_t, messages_lost) },
64 } \
65}
66#endif
67
68/**
69 * @brief Pack a link_node_status message
70 * @param system_id ID of this system
71 * @param component_id ID of this component (e.g. 200 for IMU)
72 * @param msg The MAVLink message to compress the data into
73 *
74 * @param timestamp [ms] Timestamp (time since system boot).
75 * @param tx_buf [%] Remaining free transmit buffer space
76 * @param rx_buf [%] Remaining free receive buffer space
77 * @param tx_rate [bytes/s] Transmit rate
78 * @param rx_rate [bytes/s] Receive rate
79 * @param rx_parse_err [bytes] Number of bytes that could not be parsed correctly.
80 * @param tx_overflows [bytes] Transmit buffer overflows. This number wraps around as it reaches UINT16_MAX
81 * @param rx_overflows [bytes] Receive buffer overflows. This number wraps around as it reaches UINT16_MAX
82 * @param messages_sent Messages sent
83 * @param messages_received Messages received (estimated from counting seq)
84 * @param messages_lost Messages lost (estimated from counting seq)
85 * @return length of the message in bytes (excluding serial stream start sign)
86 */
87MAVLINK_WIP
88static inline uint16_t mavlink_msg_link_node_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
89 uint64_t timestamp, uint8_t tx_buf, uint8_t rx_buf, uint32_t tx_rate, uint32_t rx_rate, uint16_t rx_parse_err, uint16_t tx_overflows, uint16_t rx_overflows, uint32_t messages_sent, uint32_t messages_received, uint32_t messages_lost)
90{
91#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
93 _mav_put_uint64_t(buf, 0, timestamp);
94 _mav_put_uint32_t(buf, 8, tx_rate);
95 _mav_put_uint32_t(buf, 12, rx_rate);
96 _mav_put_uint32_t(buf, 16, messages_sent);
97 _mav_put_uint32_t(buf, 20, messages_received);
98 _mav_put_uint32_t(buf, 24, messages_lost);
99 _mav_put_uint16_t(buf, 28, rx_parse_err);
100 _mav_put_uint16_t(buf, 30, tx_overflows);
101 _mav_put_uint16_t(buf, 32, rx_overflows);
102 _mav_put_uint8_t(buf, 34, tx_buf);
103 _mav_put_uint8_t(buf, 35, rx_buf);
104
105 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN);
106#else
107 mavlink_link_node_status_t packet;
108 packet.timestamp = timestamp;
109 packet.tx_rate = tx_rate;
110 packet.rx_rate = rx_rate;
111 packet.messages_sent = messages_sent;
112 packet.messages_received = messages_received;
113 packet.messages_lost = messages_lost;
114 packet.rx_parse_err = rx_parse_err;
115 packet.tx_overflows = tx_overflows;
116 packet.rx_overflows = rx_overflows;
117 packet.tx_buf = tx_buf;
118 packet.rx_buf = rx_buf;
119
120 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN);
121#endif
122
124 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC);
125}
126
127/**
128 * @brief Pack a link_node_status message
129 * @param system_id ID of this system
130 * @param component_id ID of this component (e.g. 200 for IMU)
131 * @param status MAVLink status structure
132 * @param msg The MAVLink message to compress the data into
133 *
134 * @param timestamp [ms] Timestamp (time since system boot).
135 * @param tx_buf [%] Remaining free transmit buffer space
136 * @param rx_buf [%] Remaining free receive buffer space
137 * @param tx_rate [bytes/s] Transmit rate
138 * @param rx_rate [bytes/s] Receive rate
139 * @param rx_parse_err [bytes] Number of bytes that could not be parsed correctly.
140 * @param tx_overflows [bytes] Transmit buffer overflows. This number wraps around as it reaches UINT16_MAX
141 * @param rx_overflows [bytes] Receive buffer overflows. This number wraps around as it reaches UINT16_MAX
142 * @param messages_sent Messages sent
143 * @param messages_received Messages received (estimated from counting seq)
144 * @param messages_lost Messages lost (estimated from counting seq)
145 * @return length of the message in bytes (excluding serial stream start sign)
146 */
147static inline uint16_t mavlink_msg_link_node_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
148 uint64_t timestamp, uint8_t tx_buf, uint8_t rx_buf, uint32_t tx_rate, uint32_t rx_rate, uint16_t rx_parse_err, uint16_t tx_overflows, uint16_t rx_overflows, uint32_t messages_sent, uint32_t messages_received, uint32_t messages_lost)
149{
150#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
152 _mav_put_uint64_t(buf, 0, timestamp);
153 _mav_put_uint32_t(buf, 8, tx_rate);
154 _mav_put_uint32_t(buf, 12, rx_rate);
155 _mav_put_uint32_t(buf, 16, messages_sent);
156 _mav_put_uint32_t(buf, 20, messages_received);
157 _mav_put_uint32_t(buf, 24, messages_lost);
158 _mav_put_uint16_t(buf, 28, rx_parse_err);
159 _mav_put_uint16_t(buf, 30, tx_overflows);
160 _mav_put_uint16_t(buf, 32, rx_overflows);
161 _mav_put_uint8_t(buf, 34, tx_buf);
162 _mav_put_uint8_t(buf, 35, rx_buf);
163
164 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN);
165#else
166 mavlink_link_node_status_t packet;
167 packet.timestamp = timestamp;
168 packet.tx_rate = tx_rate;
169 packet.rx_rate = rx_rate;
170 packet.messages_sent = messages_sent;
171 packet.messages_received = messages_received;
172 packet.messages_lost = messages_lost;
173 packet.rx_parse_err = rx_parse_err;
174 packet.tx_overflows = tx_overflows;
175 packet.rx_overflows = rx_overflows;
176 packet.tx_buf = tx_buf;
177 packet.rx_buf = rx_buf;
178
179 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN);
180#endif
181
183#if MAVLINK_CRC_EXTRA
184 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC);
185#else
186 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN);
187#endif
188}
189
190/**
191 * @brief Pack a link_node_status message on a channel
192 * @param system_id ID of this system
193 * @param component_id ID of this component (e.g. 200 for IMU)
194 * @param chan The MAVLink channel this message will be sent over
195 * @param msg The MAVLink message to compress the data into
196 * @param timestamp [ms] Timestamp (time since system boot).
197 * @param tx_buf [%] Remaining free transmit buffer space
198 * @param rx_buf [%] Remaining free receive buffer space
199 * @param tx_rate [bytes/s] Transmit rate
200 * @param rx_rate [bytes/s] Receive rate
201 * @param rx_parse_err [bytes] Number of bytes that could not be parsed correctly.
202 * @param tx_overflows [bytes] Transmit buffer overflows. This number wraps around as it reaches UINT16_MAX
203 * @param rx_overflows [bytes] Receive buffer overflows. This number wraps around as it reaches UINT16_MAX
204 * @param messages_sent Messages sent
205 * @param messages_received Messages received (estimated from counting seq)
206 * @param messages_lost Messages lost (estimated from counting seq)
207 * @return length of the message in bytes (excluding serial stream start sign)
208 */
209MAVLINK_WIP
210static inline uint16_t mavlink_msg_link_node_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
211 mavlink_message_t* msg,
212 uint64_t timestamp,uint8_t tx_buf,uint8_t rx_buf,uint32_t tx_rate,uint32_t rx_rate,uint16_t rx_parse_err,uint16_t tx_overflows,uint16_t rx_overflows,uint32_t messages_sent,uint32_t messages_received,uint32_t messages_lost)
213{
214#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
216 _mav_put_uint64_t(buf, 0, timestamp);
217 _mav_put_uint32_t(buf, 8, tx_rate);
218 _mav_put_uint32_t(buf, 12, rx_rate);
219 _mav_put_uint32_t(buf, 16, messages_sent);
220 _mav_put_uint32_t(buf, 20, messages_received);
221 _mav_put_uint32_t(buf, 24, messages_lost);
222 _mav_put_uint16_t(buf, 28, rx_parse_err);
223 _mav_put_uint16_t(buf, 30, tx_overflows);
224 _mav_put_uint16_t(buf, 32, rx_overflows);
225 _mav_put_uint8_t(buf, 34, tx_buf);
226 _mav_put_uint8_t(buf, 35, rx_buf);
227
228 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN);
229#else
230 mavlink_link_node_status_t packet;
231 packet.timestamp = timestamp;
232 packet.tx_rate = tx_rate;
233 packet.rx_rate = rx_rate;
234 packet.messages_sent = messages_sent;
235 packet.messages_received = messages_received;
236 packet.messages_lost = messages_lost;
237 packet.rx_parse_err = rx_parse_err;
238 packet.tx_overflows = tx_overflows;
239 packet.rx_overflows = rx_overflows;
240 packet.tx_buf = tx_buf;
241 packet.rx_buf = rx_buf;
242
243 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN);
244#endif
245
247 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC);
248}
249
250/**
251 * @brief Encode a link_node_status struct
252 *
253 * @param system_id ID of this system
254 * @param component_id ID of this component (e.g. 200 for IMU)
255 * @param msg The MAVLink message to compress the data into
256 * @param link_node_status C-struct to read the message contents from
257 */
258MAVLINK_WIP
259static inline uint16_t mavlink_msg_link_node_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_link_node_status_t* link_node_status)
260{
261 return mavlink_msg_link_node_status_pack(system_id, component_id, msg, link_node_status->timestamp, link_node_status->tx_buf, link_node_status->rx_buf, link_node_status->tx_rate, link_node_status->rx_rate, link_node_status->rx_parse_err, link_node_status->tx_overflows, link_node_status->rx_overflows, link_node_status->messages_sent, link_node_status->messages_received, link_node_status->messages_lost);
262}
263
264/**
265 * @brief Encode a link_node_status struct on a channel
266 *
267 * @param system_id ID of this system
268 * @param component_id ID of this component (e.g. 200 for IMU)
269 * @param chan The MAVLink channel this message will be sent over
270 * @param msg The MAVLink message to compress the data into
271 * @param link_node_status C-struct to read the message contents from
272 */
273MAVLINK_WIP
274static inline uint16_t mavlink_msg_link_node_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_link_node_status_t* link_node_status)
275{
276 return mavlink_msg_link_node_status_pack_chan(system_id, component_id, chan, msg, link_node_status->timestamp, link_node_status->tx_buf, link_node_status->rx_buf, link_node_status->tx_rate, link_node_status->rx_rate, link_node_status->rx_parse_err, link_node_status->tx_overflows, link_node_status->rx_overflows, link_node_status->messages_sent, link_node_status->messages_received, link_node_status->messages_lost);
277}
278
279/**
280 * @brief Encode a link_node_status struct with provided status structure
281 *
282 * @param system_id ID of this system
283 * @param component_id ID of this component (e.g. 200 for IMU)
284 * @param status MAVLink status structure
285 * @param msg The MAVLink message to compress the data into
286 * @param link_node_status C-struct to read the message contents from
287 */
288static inline uint16_t mavlink_msg_link_node_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_link_node_status_t* link_node_status)
289{
290 return mavlink_msg_link_node_status_pack_status(system_id, component_id, _status, msg, link_node_status->timestamp, link_node_status->tx_buf, link_node_status->rx_buf, link_node_status->tx_rate, link_node_status->rx_rate, link_node_status->rx_parse_err, link_node_status->tx_overflows, link_node_status->rx_overflows, link_node_status->messages_sent, link_node_status->messages_received, link_node_status->messages_lost);
291}
292
293/**
294 * @brief Send a link_node_status message
295 * @param chan MAVLink channel to send the message
296 *
297 * @param timestamp [ms] Timestamp (time since system boot).
298 * @param tx_buf [%] Remaining free transmit buffer space
299 * @param rx_buf [%] Remaining free receive buffer space
300 * @param tx_rate [bytes/s] Transmit rate
301 * @param rx_rate [bytes/s] Receive rate
302 * @param rx_parse_err [bytes] Number of bytes that could not be parsed correctly.
303 * @param tx_overflows [bytes] Transmit buffer overflows. This number wraps around as it reaches UINT16_MAX
304 * @param rx_overflows [bytes] Receive buffer overflows. This number wraps around as it reaches UINT16_MAX
305 * @param messages_sent Messages sent
306 * @param messages_received Messages received (estimated from counting seq)
307 * @param messages_lost Messages lost (estimated from counting seq)
308 */
309#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
310
311MAVLINK_WIP
312static inline void mavlink_msg_link_node_status_send(mavlink_channel_t chan, uint64_t timestamp, uint8_t tx_buf, uint8_t rx_buf, uint32_t tx_rate, uint32_t rx_rate, uint16_t rx_parse_err, uint16_t tx_overflows, uint16_t rx_overflows, uint32_t messages_sent, uint32_t messages_received, uint32_t messages_lost)
313{
314#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
315 char buf[MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN];
316 _mav_put_uint64_t(buf, 0, timestamp);
317 _mav_put_uint32_t(buf, 8, tx_rate);
318 _mav_put_uint32_t(buf, 12, rx_rate);
319 _mav_put_uint32_t(buf, 16, messages_sent);
320 _mav_put_uint32_t(buf, 20, messages_received);
321 _mav_put_uint32_t(buf, 24, messages_lost);
322 _mav_put_uint16_t(buf, 28, rx_parse_err);
323 _mav_put_uint16_t(buf, 30, tx_overflows);
324 _mav_put_uint16_t(buf, 32, rx_overflows);
325 _mav_put_uint8_t(buf, 34, tx_buf);
326 _mav_put_uint8_t(buf, 35, rx_buf);
327
328 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LINK_NODE_STATUS, buf, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC);
329#else
330 mavlink_link_node_status_t packet;
331 packet.timestamp = timestamp;
332 packet.tx_rate = tx_rate;
333 packet.rx_rate = rx_rate;
334 packet.messages_sent = messages_sent;
335 packet.messages_received = messages_received;
336 packet.messages_lost = messages_lost;
337 packet.rx_parse_err = rx_parse_err;
338 packet.tx_overflows = tx_overflows;
339 packet.rx_overflows = rx_overflows;
340 packet.tx_buf = tx_buf;
341 packet.rx_buf = rx_buf;
342
343 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LINK_NODE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC);
344#endif
345}
346
347/**
348 * @brief Send a link_node_status message
349 * @param chan MAVLink channel to send the message
350 * @param struct The MAVLink struct to serialize
351 */
352MAVLINK_WIP
353static inline void mavlink_msg_link_node_status_send_struct(mavlink_channel_t chan, const mavlink_link_node_status_t* link_node_status)
354{
355#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
356 mavlink_msg_link_node_status_send(chan, link_node_status->timestamp, link_node_status->tx_buf, link_node_status->rx_buf, link_node_status->tx_rate, link_node_status->rx_rate, link_node_status->rx_parse_err, link_node_status->tx_overflows, link_node_status->rx_overflows, link_node_status->messages_sent, link_node_status->messages_received, link_node_status->messages_lost);
357#else
358 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LINK_NODE_STATUS, (const char *)link_node_status, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC);
359#endif
360}
361
362#if MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
363/*
364 This variant of _send() can be used to save stack space by reusing
365 memory from the receive buffer. The caller provides a
366 mavlink_message_t which is the size of a full mavlink message. This
367 is usually the receive buffer for the channel, and allows a reply to an
368 incoming message with minimum stack space usage.
369 */
370MAVLINK_WIP
371static inline void mavlink_msg_link_node_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, uint8_t tx_buf, uint8_t rx_buf, uint32_t tx_rate, uint32_t rx_rate, uint16_t rx_parse_err, uint16_t tx_overflows, uint16_t rx_overflows, uint32_t messages_sent, uint32_t messages_received, uint32_t messages_lost)
372{
373#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
374 char *buf = (char *)msgbuf;
375 _mav_put_uint64_t(buf, 0, timestamp);
376 _mav_put_uint32_t(buf, 8, tx_rate);
377 _mav_put_uint32_t(buf, 12, rx_rate);
378 _mav_put_uint32_t(buf, 16, messages_sent);
379 _mav_put_uint32_t(buf, 20, messages_received);
380 _mav_put_uint32_t(buf, 24, messages_lost);
381 _mav_put_uint16_t(buf, 28, rx_parse_err);
382 _mav_put_uint16_t(buf, 30, tx_overflows);
383 _mav_put_uint16_t(buf, 32, rx_overflows);
384 _mav_put_uint8_t(buf, 34, tx_buf);
385 _mav_put_uint8_t(buf, 35, rx_buf);
386
387 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LINK_NODE_STATUS, buf, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC);
388#else
389 mavlink_link_node_status_t *packet = (mavlink_link_node_status_t *)msgbuf;
390 packet->timestamp = timestamp;
391 packet->tx_rate = tx_rate;
392 packet->rx_rate = rx_rate;
393 packet->messages_sent = messages_sent;
394 packet->messages_received = messages_received;
395 packet->messages_lost = messages_lost;
396 packet->rx_parse_err = rx_parse_err;
397 packet->tx_overflows = tx_overflows;
398 packet->rx_overflows = rx_overflows;
399 packet->tx_buf = tx_buf;
400 packet->rx_buf = rx_buf;
401
402 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LINK_NODE_STATUS, (const char *)packet, MAVLINK_MSG_ID_LINK_NODE_STATUS_MIN_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN, MAVLINK_MSG_ID_LINK_NODE_STATUS_CRC);
403#endif
404}
405#endif
406
407#endif
408
409// MESSAGE LINK_NODE_STATUS UNPACKING
410
411
412/**
413 * @brief Get field timestamp from link_node_status message
414 *
415 * @return [ms] Timestamp (time since system boot).
416 */
417MAVLINK_WIP
418static inline uint64_t mavlink_msg_link_node_status_get_timestamp(const mavlink_message_t* msg)
419{
420 return _MAV_RETURN_uint64_t(msg, 0);
421}
422
423/**
424 * @brief Get field tx_buf from link_node_status message
425 *
426 * @return [%] Remaining free transmit buffer space
427 */
428MAVLINK_WIP
429static inline uint8_t mavlink_msg_link_node_status_get_tx_buf(const mavlink_message_t* msg)
430{
431 return _MAV_RETURN_uint8_t(msg, 34);
432}
433
434/**
435 * @brief Get field rx_buf from link_node_status message
436 *
437 * @return [%] Remaining free receive buffer space
438 */
439MAVLINK_WIP
440static inline uint8_t mavlink_msg_link_node_status_get_rx_buf(const mavlink_message_t* msg)
441{
442 return _MAV_RETURN_uint8_t(msg, 35);
443}
444
445/**
446 * @brief Get field tx_rate from link_node_status message
447 *
448 * @return [bytes/s] Transmit rate
449 */
450MAVLINK_WIP
451static inline uint32_t mavlink_msg_link_node_status_get_tx_rate(const mavlink_message_t* msg)
452{
453 return _MAV_RETURN_uint32_t(msg, 8);
454}
455
456/**
457 * @brief Get field rx_rate from link_node_status message
458 *
459 * @return [bytes/s] Receive rate
460 */
461MAVLINK_WIP
462static inline uint32_t mavlink_msg_link_node_status_get_rx_rate(const mavlink_message_t* msg)
463{
464 return _MAV_RETURN_uint32_t(msg, 12);
465}
466
467/**
468 * @brief Get field rx_parse_err from link_node_status message
469 *
470 * @return [bytes] Number of bytes that could not be parsed correctly.
471 */
472MAVLINK_WIP
473static inline uint16_t mavlink_msg_link_node_status_get_rx_parse_err(const mavlink_message_t* msg)
474{
475 return _MAV_RETURN_uint16_t(msg, 28);
476}
477
478/**
479 * @brief Get field tx_overflows from link_node_status message
480 *
481 * @return [bytes] Transmit buffer overflows. This number wraps around as it reaches UINT16_MAX
482 */
483MAVLINK_WIP
484static inline uint16_t mavlink_msg_link_node_status_get_tx_overflows(const mavlink_message_t* msg)
485{
486 return _MAV_RETURN_uint16_t(msg, 30);
487}
488
489/**
490 * @brief Get field rx_overflows from link_node_status message
491 *
492 * @return [bytes] Receive buffer overflows. This number wraps around as it reaches UINT16_MAX
493 */
494MAVLINK_WIP
495static inline uint16_t mavlink_msg_link_node_status_get_rx_overflows(const mavlink_message_t* msg)
496{
497 return _MAV_RETURN_uint16_t(msg, 32);
498}
499
500/**
501 * @brief Get field messages_sent from link_node_status message
502 *
503 * @return Messages sent
504 */
505MAVLINK_WIP
506static inline uint32_t mavlink_msg_link_node_status_get_messages_sent(const mavlink_message_t* msg)
507{
508 return _MAV_RETURN_uint32_t(msg, 16);
509}
510
511/**
512 * @brief Get field messages_received from link_node_status message
513 *
514 * @return Messages received (estimated from counting seq)
515 */
516MAVLINK_WIP
517static inline uint32_t mavlink_msg_link_node_status_get_messages_received(const mavlink_message_t* msg)
518{
519 return _MAV_RETURN_uint32_t(msg, 20);
520}
521
522/**
523 * @brief Get field messages_lost from link_node_status message
524 *
525 * @return Messages lost (estimated from counting seq)
526 */
527MAVLINK_WIP
528static inline uint32_t mavlink_msg_link_node_status_get_messages_lost(const mavlink_message_t* msg)
529{
530 return _MAV_RETURN_uint32_t(msg, 24);
531}
532
533/**
534 * @brief Decode a link_node_status message into a struct
535 *
536 * @param msg The message to decode
537 * @param link_node_status C-struct to decode the message contents into
538 */
539MAVLINK_WIP
540static inline void mavlink_msg_link_node_status_decode(const mavlink_message_t* msg, mavlink_link_node_status_t* link_node_status)
541{
542#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
543 link_node_status->timestamp = mavlink_msg_link_node_status_get_timestamp(msg);
544 link_node_status->tx_rate = mavlink_msg_link_node_status_get_tx_rate(msg);
545 link_node_status->rx_rate = mavlink_msg_link_node_status_get_rx_rate(msg);
546 link_node_status->messages_sent = mavlink_msg_link_node_status_get_messages_sent(msg);
547 link_node_status->messages_received = mavlink_msg_link_node_status_get_messages_received(msg);
548 link_node_status->messages_lost = mavlink_msg_link_node_status_get_messages_lost(msg);
549 link_node_status->rx_parse_err = mavlink_msg_link_node_status_get_rx_parse_err(msg);
550 link_node_status->tx_overflows = mavlink_msg_link_node_status_get_tx_overflows(msg);
551 link_node_status->rx_overflows = mavlink_msg_link_node_status_get_rx_overflows(msg);
552 link_node_status->tx_buf = mavlink_msg_link_node_status_get_tx_buf(msg);
553 link_node_status->rx_buf = mavlink_msg_link_node_status_get_rx_buf(msg);
554#else
555 uint8_t len = msg->len < MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN? msg->len : MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN;
556 memset(link_node_status, 0, MAVLINK_MSG_ID_LINK_NODE_STATUS_LEN);
557 memcpy(link_node_status, _MAV_PAYLOAD(msg), len);
558#endif
559}