mavlink_msg_radio_status.h
Go to the documentation of this file.
1 // MESSAGE RADIO_STATUS PACKING
2 
3 #define MAVLINK_MSG_ID_RADIO_STATUS 109
4 
6 {
7  uint16_t rxerrors; /*< Receive errors*/
8  uint16_t fixed; /*< Count of error corrected packets*/
9  uint8_t rssi; /*< Local signal strength*/
10  uint8_t remrssi; /*< Remote signal strength*/
11  uint8_t txbuf; /*< Remaining free buffer space in percent.*/
12  uint8_t noise; /*< Background noise level*/
13  uint8_t remnoise; /*< Remote background noise level*/
15 
16 #define MAVLINK_MSG_ID_RADIO_STATUS_LEN 9
17 #define MAVLINK_MSG_ID_109_LEN 9
18 
19 #define MAVLINK_MSG_ID_RADIO_STATUS_CRC 185
20 #define MAVLINK_MSG_ID_109_CRC 185
21 
22 
23 
24 #define MAVLINK_MESSAGE_INFO_RADIO_STATUS { \
25  "RADIO_STATUS", \
26  7, \
27  { { "rxerrors", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_radio_status_t, rxerrors) }, \
28  { "fixed", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_radio_status_t, fixed) }, \
29  { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_radio_status_t, rssi) }, \
30  { "remrssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_radio_status_t, remrssi) }, \
31  { "txbuf", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_radio_status_t, txbuf) }, \
32  { "noise", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_radio_status_t, noise) }, \
33  { "remnoise", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radio_status_t, remnoise) }, \
34  } \
35 }
36 
37 
53 static inline uint16_t mavlink_msg_radio_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54  uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed)
55 {
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
58  _mav_put_uint16_t(buf, 0, rxerrors);
59  _mav_put_uint16_t(buf, 2, fixed);
60  _mav_put_uint8_t(buf, 4, rssi);
61  _mav_put_uint8_t(buf, 5, remrssi);
62  _mav_put_uint8_t(buf, 6, txbuf);
63  _mav_put_uint8_t(buf, 7, noise);
64  _mav_put_uint8_t(buf, 8, remnoise);
65 
67 #else
69  packet.rxerrors = rxerrors;
70  packet.fixed = fixed;
71  packet.rssi = rssi;
72  packet.remrssi = remrssi;
73  packet.txbuf = txbuf;
74  packet.noise = noise;
75  packet.remnoise = remnoise;
76 
78 #endif
79 
80  msg->msgid = MAVLINK_MSG_ID_RADIO_STATUS;
81 #if MAVLINK_CRC_EXTRA
83 #else
84  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
85 #endif
86 }
87 
103 static inline uint16_t mavlink_msg_radio_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104  mavlink_message_t* msg,
105  uint8_t rssi,uint8_t remrssi,uint8_t txbuf,uint8_t noise,uint8_t remnoise,uint16_t rxerrors,uint16_t fixed)
106 {
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
109  _mav_put_uint16_t(buf, 0, rxerrors);
110  _mav_put_uint16_t(buf, 2, fixed);
111  _mav_put_uint8_t(buf, 4, rssi);
112  _mav_put_uint8_t(buf, 5, remrssi);
113  _mav_put_uint8_t(buf, 6, txbuf);
114  _mav_put_uint8_t(buf, 7, noise);
115  _mav_put_uint8_t(buf, 8, remnoise);
116 
118 #else
119  mavlink_radio_status_t packet;
120  packet.rxerrors = rxerrors;
121  packet.fixed = fixed;
122  packet.rssi = rssi;
123  packet.remrssi = remrssi;
124  packet.txbuf = txbuf;
125  packet.noise = noise;
126  packet.remnoise = remnoise;
127 
129 #endif
130 
131  msg->msgid = MAVLINK_MSG_ID_RADIO_STATUS;
132 #if MAVLINK_CRC_EXTRA
134 #else
135  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
136 #endif
137 }
138 
147 static 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)
148 {
149  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);
150 }
151 
161 static 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)
162 {
163  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);
164 }
165 
178 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179 
180 static 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)
181 {
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184  _mav_put_uint16_t(buf, 0, rxerrors);
185  _mav_put_uint16_t(buf, 2, fixed);
186  _mav_put_uint8_t(buf, 4, rssi);
187  _mav_put_uint8_t(buf, 5, remrssi);
188  _mav_put_uint8_t(buf, 6, txbuf);
189  _mav_put_uint8_t(buf, 7, noise);
190  _mav_put_uint8_t(buf, 8, remnoise);
191 
192 #if MAVLINK_CRC_EXTRA
194 #else
195  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
196 #endif
197 #else
198  mavlink_radio_status_t packet;
199  packet.rxerrors = rxerrors;
200  packet.fixed = fixed;
201  packet.rssi = rssi;
202  packet.remrssi = remrssi;
203  packet.txbuf = txbuf;
204  packet.noise = noise;
205  packet.remnoise = remnoise;
206 
207 #if MAVLINK_CRC_EXTRA
208  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)&packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
209 #else
210  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)&packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
211 #endif
212 #endif
213 }
214 
215 #if MAVLINK_MSG_ID_RADIO_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
216 /*
217  This varient of _send() can be used to save stack space by re-using
218  memory from the receive buffer. The caller provides a
219  mavlink_message_t which is the size of a full mavlink message. This
220  is usually the receive buffer for the channel, and allows a reply to an
221  incoming message with minimum stack space usage.
222  */
223 static 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)
224 {
225 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226  char *buf = (char *)msgbuf;
227  _mav_put_uint16_t(buf, 0, rxerrors);
228  _mav_put_uint16_t(buf, 2, fixed);
229  _mav_put_uint8_t(buf, 4, rssi);
230  _mav_put_uint8_t(buf, 5, remrssi);
231  _mav_put_uint8_t(buf, 6, txbuf);
232  _mav_put_uint8_t(buf, 7, noise);
233  _mav_put_uint8_t(buf, 8, remnoise);
234 
235 #if MAVLINK_CRC_EXTRA
237 #else
238  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
239 #endif
240 #else
242  packet->rxerrors = rxerrors;
243  packet->fixed = fixed;
244  packet->rssi = rssi;
245  packet->remrssi = remrssi;
246  packet->txbuf = txbuf;
247  packet->noise = noise;
248  packet->remnoise = remnoise;
249 
250 #if MAVLINK_CRC_EXTRA
251  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN, MAVLINK_MSG_ID_RADIO_STATUS_CRC);
252 #else
253  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RADIO_STATUS, (const char *)packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN);
254 #endif
255 #endif
256 }
257 #endif
258 
259 #endif
260 
261 // MESSAGE RADIO_STATUS UNPACKING
262 
263 
269 static inline uint8_t mavlink_msg_radio_status_get_rssi(const mavlink_message_t* msg)
270 {
271  return _MAV_RETURN_uint8_t(msg, 4);
272 }
273 
279 static inline uint8_t mavlink_msg_radio_status_get_remrssi(const mavlink_message_t* msg)
280 {
281  return _MAV_RETURN_uint8_t(msg, 5);
282 }
283 
289 static inline uint8_t mavlink_msg_radio_status_get_txbuf(const mavlink_message_t* msg)
290 {
291  return _MAV_RETURN_uint8_t(msg, 6);
292 }
293 
299 static inline uint8_t mavlink_msg_radio_status_get_noise(const mavlink_message_t* msg)
300 {
301  return _MAV_RETURN_uint8_t(msg, 7);
302 }
303 
309 static inline uint8_t mavlink_msg_radio_status_get_remnoise(const mavlink_message_t* msg)
310 {
311  return _MAV_RETURN_uint8_t(msg, 8);
312 }
313 
319 static inline uint16_t mavlink_msg_radio_status_get_rxerrors(const mavlink_message_t* msg)
320 {
321  return _MAV_RETURN_uint16_t(msg, 0);
322 }
323 
329 static inline uint16_t mavlink_msg_radio_status_get_fixed(const mavlink_message_t* msg)
330 {
331  return _MAV_RETURN_uint16_t(msg, 2);
332 }
333 
340 static inline void mavlink_msg_radio_status_decode(const mavlink_message_t* msg, mavlink_radio_status_t* radio_status)
341 {
342 #if MAVLINK_NEED_BYTE_SWAP
343  radio_status->rxerrors = mavlink_msg_radio_status_get_rxerrors(msg);
344  radio_status->fixed = mavlink_msg_radio_status_get_fixed(msg);
345  radio_status->rssi = mavlink_msg_radio_status_get_rssi(msg);
346  radio_status->remrssi = mavlink_msg_radio_status_get_remrssi(msg);
347  radio_status->txbuf = mavlink_msg_radio_status_get_txbuf(msg);
348  radio_status->noise = mavlink_msg_radio_status_get_noise(msg);
349  radio_status->remnoise = mavlink_msg_radio_status_get_remnoise(msg);
350 #else
351  memcpy(radio_status, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_RADIO_STATUS_LEN);
352 #endif
353 }
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145


rosflight
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 20:00:13