Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_radio_status.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE RADIO_STATUS PACKING
3
4#define MAVLINK_MSG_ID_RADIO_STATUS 109
5
6
8 uint16_t rxerrors; /*< Count of radio packet receive errors (since boot).*/
9 uint16_t fixed; /*< Count of error corrected radio packets (since boot).*/
10 uint8_t rssi; /*< Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.*/
11 uint8_t remrssi; /*< Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.*/
12 uint8_t txbuf; /*< [%] Remaining free transmitter buffer space.*/
13 uint8_t noise; /*< Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.*/
14 uint8_t remnoise; /*< Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.*/
15} mavlink_radio_status_t;
16
17#define MAVLINK_MSG_ID_RADIO_STATUS_LEN 9
18#define MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN 9
19#define MAVLINK_MSG_ID_109_LEN 9
20#define MAVLINK_MSG_ID_109_MIN_LEN 9
21
22#define MAVLINK_MSG_ID_RADIO_STATUS_CRC 185
23#define MAVLINK_MSG_ID_109_CRC 185
24
25
26
27#if MAVLINK_COMMAND_24BIT
28#define MAVLINK_MESSAGE_INFO_RADIO_STATUS {
29 109,
30 "RADIO_STATUS",
31 7,
32 { { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_radio_status_t, rssi) },
33 { "remrssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_radio_status_t, remrssi) },
34 { "txbuf", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_radio_status_t, txbuf) },
35 { "noise", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_radio_status_t, noise) },
36 { "remnoise", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radio_status_t, remnoise) },
37 { "rxerrors", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_radio_status_t, rxerrors) },
38 { "fixed", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_radio_status_t, fixed) },
39 } \
40}
41#else
42#define MAVLINK_MESSAGE_INFO_RADIO_STATUS {
43 "RADIO_STATUS",
44 7,
45 { { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_radio_status_t, rssi) },
46 { "remrssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_radio_status_t, remrssi) },
47 { "txbuf", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_radio_status_t, txbuf) },
48 { "noise", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_radio_status_t, noise) },
49 { "remnoise", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radio_status_t, remnoise) },
50 { "rxerrors", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_radio_status_t, rxerrors) },
51 { "fixed", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_radio_status_t, fixed) },
52 } \
53}
54#endif
55
56/**
57 * @brief Pack a radio_status message
58 * @param system_id ID of this system
59 * @param component_id ID of this component (e.g. 200 for IMU)
60 * @param msg The MAVLink message to compress the data into
61 *
62 * @param rssi Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.
63 * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.
64 * @param txbuf [%] Remaining free transmitter buffer space.
65 * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.
66 * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.
67 * @param rxerrors Count of radio packet receive errors (since boot).
68 * @param fixed Count of error corrected radio packets (since boot).
69 * @return length of the message in bytes (excluding serial stream start sign)
70 */
71static inline uint16_t mavlink_msg_radio_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72 uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed)
73{
74#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
76 _mav_put_uint16_t(buf, 0, rxerrors);
77 _mav_put_uint16_t(buf, 2, fixed);
78 _mav_put_uint8_t(buf, 4, rssi);
79 _mav_put_uint8_t(buf, 5, remrssi);
80 _mav_put_uint8_t(buf, 6, txbuf);
81 _mav_put_uint8_t(buf, 7, noise);
82 _mav_put_uint8_t(buf, 8, remnoise);
83
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
85#else
86 mavlink_radio_status_t packet;
87 packet.rxerrors = rxerrors;
88 packet.fixed = fixed;
89 packet.rssi = rssi;
90 packet.remrssi = remrssi;
91 packet.txbuf = txbuf;
92 packet.noise = noise;
93 packet.remnoise = remnoise;
94
95 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
96#endif
97
98 msg->msgid = MAVLINK_MSG_ID_RADIO_STATUS;
99 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
100}
101
102/**
103 * @brief Pack a radio_status message
104 * @param system_id ID of this system
105 * @param component_id ID of this component (e.g. 200 for IMU)
106 * @param status MAVLink status structure
107 * @param msg The MAVLink message to compress the data into
108 *
109 * @param rssi Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.
110 * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.
111 * @param txbuf [%] Remaining free transmitter buffer space.
112 * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.
113 * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.
114 * @param rxerrors Count of radio packet receive errors (since boot).
115 * @param fixed Count of error corrected radio packets (since boot).
116 * @return length of the message in bytes (excluding serial stream start sign)
117 */
118static inline uint16_t mavlink_msg_radio_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
119 uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed)
120{
121#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
123 _mav_put_uint16_t(buf, 0, rxerrors);
124 _mav_put_uint16_t(buf, 2, fixed);
125 _mav_put_uint8_t(buf, 4, rssi);
126 _mav_put_uint8_t(buf, 5, remrssi);
127 _mav_put_uint8_t(buf, 6, txbuf);
128 _mav_put_uint8_t(buf, 7, noise);
129 _mav_put_uint8_t(buf, 8, remnoise);
130
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
132#else
133 mavlink_radio_status_t packet;
134 packet.rxerrors = rxerrors;
135 packet.fixed = fixed;
136 packet.rssi = rssi;
137 packet.remrssi = remrssi;
138 packet.txbuf = txbuf;
139 packet.noise = noise;
140 packet.remnoise = remnoise;
141
142 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
143#endif
144
145 msg->msgid = MAVLINK_MSG_ID_RADIO_STATUS;
146#if MAVLINK_CRC_EXTRA
147 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
148#else
149 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
150#endif
151}
152
153/**
154 * @brief Pack a radio_status message on a channel
155 * @param system_id ID of this system
156 * @param component_id ID of this component (e.g. 200 for IMU)
157 * @param chan The MAVLink channel this message will be sent over
158 * @param msg The MAVLink message to compress the data into
159 * @param rssi Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.
160 * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.
161 * @param txbuf [%] Remaining free transmitter buffer space.
162 * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.
163 * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.
164 * @param rxerrors Count of radio packet receive errors (since boot).
165 * @param fixed Count of error corrected radio packets (since boot).
166 * @return length of the message in bytes (excluding serial stream start sign)
167 */
168static inline uint16_t mavlink_msg_radio_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
169 mavlink_message_t* msg,
170 uint8_t rssi,uint8_t remrssi,uint8_t txbuf,uint8_t noise,uint8_t remnoise,uint16_t rxerrors,uint16_t fixed)
171{
172#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
174 _mav_put_uint16_t(buf, 0, rxerrors);
175 _mav_put_uint16_t(buf, 2, fixed);
176 _mav_put_uint8_t(buf, 4, rssi);
177 _mav_put_uint8_t(buf, 5, remrssi);
178 _mav_put_uint8_t(buf, 6, txbuf);
179 _mav_put_uint8_t(buf, 7, noise);
180 _mav_put_uint8_t(buf, 8, remnoise);
181
182 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
183#else
184 mavlink_radio_status_t packet;
185 packet.rxerrors = rxerrors;
186 packet.fixed = fixed;
187 packet.rssi = rssi;
188 packet.remrssi = remrssi;
189 packet.txbuf = txbuf;
190 packet.noise = noise;
191 packet.remnoise = remnoise;
192
193 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
194#endif
195
196 msg->msgid = MAVLINK_MSG_ID_RADIO_STATUS;
197 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
198}
199
200/**
201 * @brief Encode a radio_status struct
202 *
203 * @param system_id ID of this system
204 * @param component_id ID of this component (e.g. 200 for IMU)
205 * @param msg The MAVLink message to compress the data into
206 * @param radio_status C-struct to read the message contents from
207 */
208static inline uint16_t mavlink_msg_radio_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_radio_status_t* radio_status)
209{
210 return mavlink_msg_radio_status_pack(system_id, component_id, msg, radio_status->rssi, radio_status->remrssi, radio_status->txbuf, radio_status->noise, radio_status->remnoise, radio_status->rxerrors, radio_status->fixed);
211}
212
213/**
214 * @brief Encode a radio_status struct on a channel
215 *
216 * @param system_id ID of this system
217 * @param component_id ID of this component (e.g. 200 for IMU)
218 * @param chan The MAVLink channel this message will be sent over
219 * @param msg The MAVLink message to compress the data into
220 * @param radio_status C-struct to read the message contents from
221 */
222static inline uint16_t mavlink_msg_radio_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_radio_status_t* radio_status)
223{
224 return mavlink_msg_radio_status_pack_chan(system_id, component_id, chan, msg, radio_status->rssi, radio_status->remrssi, radio_status->txbuf, radio_status->noise, radio_status->remnoise, radio_status->rxerrors, radio_status->fixed);
225}
226
227/**
228 * @brief Encode a radio_status struct with provided status structure
229 *
230 * @param system_id ID of this system
231 * @param component_id ID of this component (e.g. 200 for IMU)
232 * @param status MAVLink status structure
233 * @param msg The MAVLink message to compress the data into
234 * @param radio_status C-struct to read the message contents from
235 */
236static inline uint16_t mavlink_msg_radio_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_radio_status_t* radio_status)
237{
238 return mavlink_msg_radio_status_pack_status(system_id, component_id, _status, msg, radio_status->rssi, radio_status->remrssi, radio_status->txbuf, radio_status->noise, radio_status->remnoise, radio_status->rxerrors, radio_status->fixed);
239}
240
241/**
242 * @brief Send a radio_status message
243 * @param chan MAVLink channel to send the message
244 *
245 * @param rssi Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.
246 * @param remrssi Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.
247 * @param txbuf [%] Remaining free transmitter buffer space.
248 * @param noise Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.
249 * @param remnoise Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.
250 * @param rxerrors Count of radio packet receive errors (since boot).
251 * @param fixed Count of error corrected radio packets (since boot).
252 */
253#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
254
255static inline void mavlink_msg_radio_status_send(mavlink_channel_t chan, uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed)
256{
257#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
258 char buf[MAVLINK_MSG_ID_RADIO_STATUS_LEN];
259 _mav_put_uint16_t(buf, 0, rxerrors);
260 _mav_put_uint16_t(buf, 2, fixed);
261 _mav_put_uint8_t(buf, 4, rssi);
262 _mav_put_uint8_t(buf, 5, remrssi);
263 _mav_put_uint8_t(buf, 6, txbuf);
264 _mav_put_uint8_t(buf, 7, noise);
265 _mav_put_uint8_t(buf, 8, remnoise);
266
267 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, buf, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
268#else
269 mavlink_radio_status_t packet;
270 packet.rxerrors = rxerrors;
271 packet.fixed = fixed;
272 packet.rssi = rssi;
273 packet.remrssi = remrssi;
274 packet.txbuf = txbuf;
275 packet.noise = noise;
276 packet.remnoise = remnoise;
277
278 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)&packet, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
279#endif
280}
281
282/**
283 * @brief Send a radio_status message
284 * @param chan MAVLink channel to send the message
285 * @param struct The MAVLink struct to serialize
286 */
287static inline void mavlink_msg_radio_status_send_struct(mavlink_channel_t chan, const mavlink_radio_status_t* radio_status)
288{
289#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
290 mavlink_msg_radio_status_send(chan, radio_status->rssi, radio_status->remrssi, radio_status->txbuf, radio_status->noise, radio_status->remnoise, radio_status->rxerrors, radio_status->fixed);
291#else
292 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)radio_status, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
293#endif
294}
295
296#if MAVLINK_MSG_ID_RADIO_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
297/*
298 This variant of _send() can be used to save stack space by reusing
299 memory from the receive buffer. The caller provides a
300 mavlink_message_t which is the size of a full mavlink message. This
301 is usually the receive buffer for the channel, and allows a reply to an
302 incoming message with minimum stack space usage.
303 */
304static inline void mavlink_msg_radio_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed)
305{
306#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
307 char *buf = (char *)msgbuf;
308 _mav_put_uint16_t(buf, 0, rxerrors);
309 _mav_put_uint16_t(buf, 2, fixed);
310 _mav_put_uint8_t(buf, 4, rssi);
311 _mav_put_uint8_t(buf, 5, remrssi);
312 _mav_put_uint8_t(buf, 6, txbuf);
313 _mav_put_uint8_t(buf, 7, noise);
314 _mav_put_uint8_t(buf, 8, remnoise);
315
316 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, buf, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
317#else
318 mavlink_radio_status_t *packet = (mavlink_radio_status_t *)msgbuf;
319 packet->rxerrors = rxerrors;
320 packet->fixed = fixed;
321 packet->rssi = rssi;
322 packet->remrssi = remrssi;
323 packet->txbuf = txbuf;
324 packet->noise = noise;
325 packet->remnoise = remnoise;
326
327 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)packet, MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
328#endif
329}
330#endif
331
332#endif
333
334// MESSAGE RADIO_STATUS UNPACKING
335
336
337/**
338 * @brief Get field rssi from radio_status message
339 *
340 * @return Local (message sender) received signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.
341 */
342static inline uint8_t mavlink_msg_radio_status_get_rssi(const mavlink_message_t* msg)
343{
344 return _MAV_RETURN_uint8_t(msg, 4);
345}
346
347/**
348 * @brief Get field remrssi from radio_status message
349 *
350 * @return Remote (message receiver) signal strength indication in device-dependent units/scale. Values: [0-254], UINT8_MAX: invalid/unknown.
351 */
352static inline uint8_t mavlink_msg_radio_status_get_remrssi(const mavlink_message_t* msg)
353{
354 return _MAV_RETURN_uint8_t(msg, 5);
355}
356
357/**
358 * @brief Get field txbuf from radio_status message
359 *
360 * @return [%] Remaining free transmitter buffer space.
361 */
362static inline uint8_t mavlink_msg_radio_status_get_txbuf(const mavlink_message_t* msg)
363{
364 return _MAV_RETURN_uint8_t(msg, 6);
365}
366
367/**
368 * @brief Get field noise from radio_status message
369 *
370 * @return Local background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.
371 */
372static inline uint8_t mavlink_msg_radio_status_get_noise(const mavlink_message_t* msg)
373{
374 return _MAV_RETURN_uint8_t(msg, 7);
375}
376
377/**
378 * @brief Get field remnoise from radio_status message
379 *
380 * @return Remote background noise level. These are device dependent RSSI values (scale as approx 2x dB on SiK radios). Values: [0-254], UINT8_MAX: invalid/unknown.
381 */
382static inline uint8_t mavlink_msg_radio_status_get_remnoise(const mavlink_message_t* msg)
383{
384 return _MAV_RETURN_uint8_t(msg, 8);
385}
386
387/**
388 * @brief Get field rxerrors from radio_status message
389 *
390 * @return Count of radio packet receive errors (since boot).
391 */
392static inline uint16_t mavlink_msg_radio_status_get_rxerrors(const mavlink_message_t* msg)
393{
394 return _MAV_RETURN_uint16_t(msg, 0);
395}
396
397/**
398 * @brief Get field fixed from radio_status message
399 *
400 * @return Count of error corrected radio packets (since boot).
401 */
402static inline uint16_t mavlink_msg_radio_status_get_fixed(const mavlink_message_t* msg)
403{
404 return _MAV_RETURN_uint16_t(msg, 2);
405}
406
407/**
408 * @brief Decode a radio_status message into a struct
409 *
410 * @param msg The message to decode
411 * @param radio_status C-struct to decode the message contents into
412 */
413static inline void mavlink_msg_radio_status_decode(const mavlink_message_t* msg, mavlink_radio_status_t* radio_status)
414{
415#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
416 radio_status->rxerrors = mavlink_msg_radio_status_get_rxerrors(msg);
417 radio_status->fixed = mavlink_msg_radio_status_get_fixed(msg);
418 radio_status->rssi = mavlink_msg_radio_status_get_rssi(msg);
419 radio_status->remrssi = mavlink_msg_radio_status_get_remrssi(msg);
420 radio_status->txbuf = mavlink_msg_radio_status_get_txbuf(msg);
421 radio_status->noise = mavlink_msg_radio_status_get_noise(msg);
422 radio_status->remnoise = mavlink_msg_radio_status_get_remnoise(msg);
423#else
424 uint8_t len = msg->len < MAVLINK_MSG_ID_RADIO_STATUS_LEN? msg->len : MAVLINK_MSG_ID_RADIO_STATUS_LEN;
425 memset(radio_status, 0, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
426 memcpy(radio_status, _MAV_PAYLOAD(msg), len);
427#endif
428}