1 | // MESSAGE RADIO_STATUS PACKING |
---|
2 | |
---|
3 | #define MAVLINK_MSG_ID_RADIO_STATUS 109 |
---|
4 | |
---|
5 | MAVPACKED( |
---|
6 | typedef struct __mavlink_radio_status_t { |
---|
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*/ |
---|
14 | }) mavlink_radio_status_t; |
---|
15 | |
---|
16 | #define MAVLINK_MSG_ID_RADIO_STATUS_LEN 9 |
---|
17 | #define MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN 9 |
---|
18 | #define MAVLINK_MSG_ID_109_LEN 9 |
---|
19 | #define MAVLINK_MSG_ID_109_MIN_LEN 9 |
---|
20 | |
---|
21 | #define MAVLINK_MSG_ID_RADIO_STATUS_CRC 185 |
---|
22 | #define MAVLINK_MSG_ID_109_CRC 185 |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | #if MAVLINK_COMMAND_24BIT |
---|
27 | #define MAVLINK_MESSAGE_INFO_RADIO_STATUS { \ |
---|
28 | 109, \ |
---|
29 | "RADIO_STATUS", \ |
---|
30 | 7, \ |
---|
31 | { { "rxerrors", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_radio_status_t, rxerrors) }, \ |
---|
32 | { "fixed", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_radio_status_t, fixed) }, \ |
---|
33 | { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_radio_status_t, rssi) }, \ |
---|
34 | { "remrssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_radio_status_t, remrssi) }, \ |
---|
35 | { "txbuf", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_radio_status_t, txbuf) }, \ |
---|
36 | { "noise", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_radio_status_t, noise) }, \ |
---|
37 | { "remnoise", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radio_status_t, remnoise) }, \ |
---|
38 | } \ |
---|
39 | } |
---|
40 | #else |
---|
41 | #define MAVLINK_MESSAGE_INFO_RADIO_STATUS { \ |
---|
42 | "RADIO_STATUS", \ |
---|
43 | 7, \ |
---|
44 | { { "rxerrors", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_radio_status_t, rxerrors) }, \ |
---|
45 | { "fixed", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_radio_status_t, fixed) }, \ |
---|
46 | { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_radio_status_t, rssi) }, \ |
---|
47 | { "remrssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_radio_status_t, remrssi) }, \ |
---|
48 | { "txbuf", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_radio_status_t, txbuf) }, \ |
---|
49 | { "noise", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_radio_status_t, noise) }, \ |
---|
50 | { "remnoise", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_radio_status_t, remnoise) }, \ |
---|
51 | } \ |
---|
52 | } |
---|
53 | #endif |
---|
54 | |
---|
55 | /** |
---|
56 | * @brief Pack a radio_status message |
---|
57 | * @param system_id ID of this system |
---|
58 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
59 | * @param msg The MAVLink message to compress the data into |
---|
60 | * |
---|
61 | * @param rssi Local signal strength |
---|
62 | * @param remrssi Remote signal strength |
---|
63 | * @param txbuf Remaining free buffer space in percent. |
---|
64 | * @param noise Background noise level |
---|
65 | * @param remnoise Remote background noise level |
---|
66 | * @param rxerrors Receive errors |
---|
67 | * @param fixed Count of error corrected packets |
---|
68 | * @return length of the message in bytes (excluding serial stream start sign) |
---|
69 | */ |
---|
70 | static inline uint16_t mavlink_msg_radio_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
---|
71 | uint8_t rssi, uint8_t remrssi, uint8_t txbuf, uint8_t noise, uint8_t remnoise, uint16_t rxerrors, uint16_t fixed) |
---|
72 | { |
---|
73 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
74 | char buf[MAVLINK_MSG_ID_RADIO_STATUS_LEN]; |
---|
75 | _mav_put_uint16_t(buf, 0, rxerrors); |
---|
76 | _mav_put_uint16_t(buf, 2, fixed); |
---|
77 | _mav_put_uint8_t(buf, 4, rssi); |
---|
78 | _mav_put_uint8_t(buf, 5, remrssi); |
---|
79 | _mav_put_uint8_t(buf, 6, txbuf); |
---|
80 | _mav_put_uint8_t(buf, 7, noise); |
---|
81 | _mav_put_uint8_t(buf, 8, remnoise); |
---|
82 | |
---|
83 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN); |
---|
84 | #else |
---|
85 | mavlink_radio_status_t packet; |
---|
86 | packet.rxerrors = rxerrors; |
---|
87 | packet.fixed = fixed; |
---|
88 | packet.rssi = rssi; |
---|
89 | packet.remrssi = remrssi; |
---|
90 | packet.txbuf = txbuf; |
---|
91 | packet.noise = noise; |
---|
92 | packet.remnoise = remnoise; |
---|
93 | |
---|
94 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN); |
---|
95 | #endif |
---|
96 | |
---|
97 | msg->msgid = MAVLINK_MSG_ID_RADIO_STATUS; |
---|
98 | 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); |
---|
99 | } |
---|
100 | |
---|
101 | /** |
---|
102 | * @brief Pack a radio_status message on a channel |
---|
103 | * @param system_id ID of this system |
---|
104 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
105 | * @param chan The MAVLink channel this message will be sent over |
---|
106 | * @param msg The MAVLink message to compress the data into |
---|
107 | * @param rssi Local signal strength |
---|
108 | * @param remrssi Remote signal strength |
---|
109 | * @param txbuf Remaining free buffer space in percent. |
---|
110 | * @param noise Background noise level |
---|
111 | * @param remnoise Remote background noise level |
---|
112 | * @param rxerrors Receive errors |
---|
113 | * @param fixed Count of error corrected packets |
---|
114 | * @return length of the message in bytes (excluding serial stream start sign) |
---|
115 | */ |
---|
116 | static inline uint16_t mavlink_msg_radio_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
---|
117 | mavlink_message_t* msg, |
---|
118 | uint8_t rssi,uint8_t remrssi,uint8_t txbuf,uint8_t noise,uint8_t remnoise,uint16_t rxerrors,uint16_t fixed) |
---|
119 | { |
---|
120 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
121 | char buf[MAVLINK_MSG_ID_RADIO_STATUS_LEN]; |
---|
122 | _mav_put_uint16_t(buf, 0, rxerrors); |
---|
123 | _mav_put_uint16_t(buf, 2, fixed); |
---|
124 | _mav_put_uint8_t(buf, 4, rssi); |
---|
125 | _mav_put_uint8_t(buf, 5, remrssi); |
---|
126 | _mav_put_uint8_t(buf, 6, txbuf); |
---|
127 | _mav_put_uint8_t(buf, 7, noise); |
---|
128 | _mav_put_uint8_t(buf, 8, remnoise); |
---|
129 | |
---|
130 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RADIO_STATUS_LEN); |
---|
131 | #else |
---|
132 | mavlink_radio_status_t packet; |
---|
133 | packet.rxerrors = rxerrors; |
---|
134 | packet.fixed = fixed; |
---|
135 | packet.rssi = rssi; |
---|
136 | packet.remrssi = remrssi; |
---|
137 | packet.txbuf = txbuf; |
---|
138 | packet.noise = noise; |
---|
139 | packet.remnoise = remnoise; |
---|
140 | |
---|
141 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RADIO_STATUS_LEN); |
---|
142 | #endif |
---|
143 | |
---|
144 | msg->msgid = MAVLINK_MSG_ID_RADIO_STATUS; |
---|
145 | 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); |
---|
146 | } |
---|
147 | |
---|
148 | /** |
---|
149 | * @brief Encode a radio_status struct |
---|
150 | * |
---|
151 | * @param system_id ID of this system |
---|
152 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
153 | * @param msg The MAVLink message to compress the data into |
---|
154 | * @param radio_status C-struct to read the message contents from |
---|
155 | */ |
---|
156 | 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) |
---|
157 | { |
---|
158 | 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); |
---|
159 | } |
---|
160 | |
---|
161 | /** |
---|
162 | * @brief Encode a radio_status struct on a channel |
---|
163 | * |
---|
164 | * @param system_id ID of this system |
---|
165 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
166 | * @param chan The MAVLink channel this message will be sent over |
---|
167 | * @param msg The MAVLink message to compress the data into |
---|
168 | * @param radio_status C-struct to read the message contents from |
---|
169 | */ |
---|
170 | 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) |
---|
171 | { |
---|
172 | 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); |
---|
173 | } |
---|
174 | |
---|
175 | /** |
---|
176 | * @brief Send a radio_status message |
---|
177 | * @param chan MAVLink channel to send the message |
---|
178 | * |
---|
179 | * @param rssi Local signal strength |
---|
180 | * @param remrssi Remote signal strength |
---|
181 | * @param txbuf Remaining free buffer space in percent. |
---|
182 | * @param noise Background noise level |
---|
183 | * @param remnoise Remote background noise level |
---|
184 | * @param rxerrors Receive errors |
---|
185 | * @param fixed Count of error corrected packets |
---|
186 | */ |
---|
187 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
---|
188 | |
---|
189 | 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) |
---|
190 | { |
---|
191 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
192 | char buf[MAVLINK_MSG_ID_RADIO_STATUS_LEN]; |
---|
193 | _mav_put_uint16_t(buf, 0, rxerrors); |
---|
194 | _mav_put_uint16_t(buf, 2, fixed); |
---|
195 | _mav_put_uint8_t(buf, 4, rssi); |
---|
196 | _mav_put_uint8_t(buf, 5, remrssi); |
---|
197 | _mav_put_uint8_t(buf, 6, txbuf); |
---|
198 | _mav_put_uint8_t(buf, 7, noise); |
---|
199 | _mav_put_uint8_t(buf, 8, remnoise); |
---|
200 | |
---|
201 | _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); |
---|
202 | #else |
---|
203 | mavlink_radio_status_t packet; |
---|
204 | packet.rxerrors = rxerrors; |
---|
205 | packet.fixed = fixed; |
---|
206 | packet.rssi = rssi; |
---|
207 | packet.remrssi = remrssi; |
---|
208 | packet.txbuf = txbuf; |
---|
209 | packet.noise = noise; |
---|
210 | packet.remnoise = remnoise; |
---|
211 | |
---|
212 | _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); |
---|
213 | #endif |
---|
214 | } |
---|
215 | |
---|
216 | /** |
---|
217 | * @brief Send a radio_status message |
---|
218 | * @param chan MAVLink channel to send the message |
---|
219 | * @param struct The MAVLink struct to serialize |
---|
220 | */ |
---|
221 | static inline void mavlink_msg_radio_status_send_struct(mavlink_channel_t chan, const mavlink_radio_status_t* radio_status) |
---|
222 | { |
---|
223 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
224 | 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); |
---|
225 | #else |
---|
226 | _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); |
---|
227 | #endif |
---|
228 | } |
---|
229 | |
---|
230 | #if MAVLINK_MSG_ID_RADIO_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN |
---|
231 | /* |
---|
232 | This varient of _send() can be used to save stack space by re-using |
---|
233 | memory from the receive buffer. The caller provides a |
---|
234 | mavlink_message_t which is the size of a full mavlink message. This |
---|
235 | is usually the receive buffer for the channel, and allows a reply to an |
---|
236 | incoming message with minimum stack space usage. |
---|
237 | */ |
---|
238 | 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) |
---|
239 | { |
---|
240 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
241 | char *buf = (char *)msgbuf; |
---|
242 | _mav_put_uint16_t(buf, 0, rxerrors); |
---|
243 | _mav_put_uint16_t(buf, 2, fixed); |
---|
244 | _mav_put_uint8_t(buf, 4, rssi); |
---|
245 | _mav_put_uint8_t(buf, 5, remrssi); |
---|
246 | _mav_put_uint8_t(buf, 6, txbuf); |
---|
247 | _mav_put_uint8_t(buf, 7, noise); |
---|
248 | _mav_put_uint8_t(buf, 8, remnoise); |
---|
249 | |
---|
250 | _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); |
---|
251 | #else |
---|
252 | mavlink_radio_status_t *packet = (mavlink_radio_status_t *)msgbuf; |
---|
253 | packet->rxerrors = rxerrors; |
---|
254 | packet->fixed = fixed; |
---|
255 | packet->rssi = rssi; |
---|
256 | packet->remrssi = remrssi; |
---|
257 | packet->txbuf = txbuf; |
---|
258 | packet->noise = noise; |
---|
259 | packet->remnoise = remnoise; |
---|
260 | |
---|
261 | _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); |
---|
262 | #endif |
---|
263 | } |
---|
264 | #endif |
---|
265 | |
---|
266 | #endif |
---|
267 | |
---|
268 | // MESSAGE RADIO_STATUS UNPACKING |
---|
269 | |
---|
270 | |
---|
271 | /** |
---|
272 | * @brief Get field rssi from radio_status message |
---|
273 | * |
---|
274 | * @return Local signal strength |
---|
275 | */ |
---|
276 | static inline uint8_t mavlink_msg_radio_status_get_rssi(const mavlink_message_t* msg) |
---|
277 | { |
---|
278 | return _MAV_RETURN_uint8_t(msg, 4); |
---|
279 | } |
---|
280 | |
---|
281 | /** |
---|
282 | * @brief Get field remrssi from radio_status message |
---|
283 | * |
---|
284 | * @return Remote signal strength |
---|
285 | */ |
---|
286 | static inline uint8_t mavlink_msg_radio_status_get_remrssi(const mavlink_message_t* msg) |
---|
287 | { |
---|
288 | return _MAV_RETURN_uint8_t(msg, 5); |
---|
289 | } |
---|
290 | |
---|
291 | /** |
---|
292 | * @brief Get field txbuf from radio_status message |
---|
293 | * |
---|
294 | * @return Remaining free buffer space in percent. |
---|
295 | */ |
---|
296 | static inline uint8_t mavlink_msg_radio_status_get_txbuf(const mavlink_message_t* msg) |
---|
297 | { |
---|
298 | return _MAV_RETURN_uint8_t(msg, 6); |
---|
299 | } |
---|
300 | |
---|
301 | /** |
---|
302 | * @brief Get field noise from radio_status message |
---|
303 | * |
---|
304 | * @return Background noise level |
---|
305 | */ |
---|
306 | static inline uint8_t mavlink_msg_radio_status_get_noise(const mavlink_message_t* msg) |
---|
307 | { |
---|
308 | return _MAV_RETURN_uint8_t(msg, 7); |
---|
309 | } |
---|
310 | |
---|
311 | /** |
---|
312 | * @brief Get field remnoise from radio_status message |
---|
313 | * |
---|
314 | * @return Remote background noise level |
---|
315 | */ |
---|
316 | static inline uint8_t mavlink_msg_radio_status_get_remnoise(const mavlink_message_t* msg) |
---|
317 | { |
---|
318 | return _MAV_RETURN_uint8_t(msg, 8); |
---|
319 | } |
---|
320 | |
---|
321 | /** |
---|
322 | * @brief Get field rxerrors from radio_status message |
---|
323 | * |
---|
324 | * @return Receive errors |
---|
325 | */ |
---|
326 | static inline uint16_t mavlink_msg_radio_status_get_rxerrors(const mavlink_message_t* msg) |
---|
327 | { |
---|
328 | return _MAV_RETURN_uint16_t(msg, 0); |
---|
329 | } |
---|
330 | |
---|
331 | /** |
---|
332 | * @brief Get field fixed from radio_status message |
---|
333 | * |
---|
334 | * @return Count of error corrected packets |
---|
335 | */ |
---|
336 | static inline uint16_t mavlink_msg_radio_status_get_fixed(const mavlink_message_t* msg) |
---|
337 | { |
---|
338 | return _MAV_RETURN_uint16_t(msg, 2); |
---|
339 | } |
---|
340 | |
---|
341 | /** |
---|
342 | * @brief Decode a radio_status message into a struct |
---|
343 | * |
---|
344 | * @param msg The message to decode |
---|
345 | * @param radio_status C-struct to decode the message contents into |
---|
346 | */ |
---|
347 | static inline void mavlink_msg_radio_status_decode(const mavlink_message_t* msg, mavlink_radio_status_t* radio_status) |
---|
348 | { |
---|
349 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
350 | radio_status->rxerrors = mavlink_msg_radio_status_get_rxerrors(msg); |
---|
351 | radio_status->fixed = mavlink_msg_radio_status_get_fixed(msg); |
---|
352 | radio_status->rssi = mavlink_msg_radio_status_get_rssi(msg); |
---|
353 | radio_status->remrssi = mavlink_msg_radio_status_get_remrssi(msg); |
---|
354 | radio_status->txbuf = mavlink_msg_radio_status_get_txbuf(msg); |
---|
355 | radio_status->noise = mavlink_msg_radio_status_get_noise(msg); |
---|
356 | radio_status->remnoise = mavlink_msg_radio_status_get_remnoise(msg); |
---|
357 | #else |
---|
358 | uint8_t len = msg->len < MAVLINK_MSG_ID_RADIO_STATUS_LEN? msg->len : MAVLINK_MSG_ID_RADIO_STATUS_LEN; |
---|
359 | memset(radio_status, 0, MAVLINK_MSG_ID_RADIO_STATUS_LEN); |
---|
360 | memcpy(radio_status, _MAV_PAYLOAD(msg), len); |
---|
361 | #endif |
---|
362 | } |
---|