NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_onboard_health.h
Go to the documentation of this file.
1 // MESSAGE ONBOARD_HEALTH PACKING
2 
3 #define MAVLINK_MSG_ID_ONBOARD_HEALTH 206
4 
6 {
7  uint32_t uptime;
8  float ram_total;
9  float swap_total;
10  float disk_total;
11  float temp;
12  float voltage;
15  uint16_t cpu_freq;
16  uint8_t cpu_load;
17  uint8_t ram_usage;
18  uint8_t swap_usage;
19  int8_t disk_health;
20  uint8_t disk_usage;
22 
23 #define MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN 39
24 #define MAVLINK_MSG_ID_206_LEN 39
25 
26 #define MAVLINK_MSG_ID_ONBOARD_HEALTH_CRC 19
27 #define MAVLINK_MSG_ID_206_CRC 19
28 
29 
30 
31 #define MAVLINK_MESSAGE_INFO_ONBOARD_HEALTH { \
32  "ONBOARD_HEALTH", \
33  14, \
34  { { "uptime", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_onboard_health_t, uptime) }, \
35  { "ram_total", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_onboard_health_t, ram_total) }, \
36  { "swap_total", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_onboard_health_t, swap_total) }, \
37  { "disk_total", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_onboard_health_t, disk_total) }, \
38  { "temp", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_onboard_health_t, temp) }, \
39  { "voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_onboard_health_t, voltage) }, \
40  { "network_load_in", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_onboard_health_t, network_load_in) }, \
41  { "network_load_out", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_onboard_health_t, network_load_out) }, \
42  { "cpu_freq", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_onboard_health_t, cpu_freq) }, \
43  { "cpu_load", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_onboard_health_t, cpu_load) }, \
44  { "ram_usage", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_onboard_health_t, ram_usage) }, \
45  { "swap_usage", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_onboard_health_t, swap_usage) }, \
46  { "disk_health", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_onboard_health_t, disk_health) }, \
47  { "disk_usage", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_onboard_health_t, disk_usage) }, \
48  } \
49 }
50 
51 
74 static inline uint16_t mavlink_msg_onboard_health_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
75  uint32_t uptime, uint16_t cpu_freq, uint8_t cpu_load, uint8_t ram_usage, float ram_total, uint8_t swap_usage, float swap_total, int8_t disk_health, uint8_t disk_usage, float disk_total, float temp, float voltage, float network_load_in, float network_load_out)
76 {
77 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
79  _mav_put_uint32_t(buf, 0, uptime);
80  _mav_put_float(buf, 4, ram_total);
81  _mav_put_float(buf, 8, swap_total);
82  _mav_put_float(buf, 12, disk_total);
83  _mav_put_float(buf, 16, temp);
84  _mav_put_float(buf, 20, voltage);
85  _mav_put_float(buf, 24, network_load_in);
86  _mav_put_float(buf, 28, network_load_out);
87  _mav_put_uint16_t(buf, 32, cpu_freq);
88  _mav_put_uint8_t(buf, 34, cpu_load);
89  _mav_put_uint8_t(buf, 35, ram_usage);
90  _mav_put_uint8_t(buf, 36, swap_usage);
91  _mav_put_int8_t(buf, 37, disk_health);
92  _mav_put_uint8_t(buf, 38, disk_usage);
93 
95 #else
97  packet.uptime = uptime;
98  packet.ram_total = ram_total;
99  packet.swap_total = swap_total;
100  packet.disk_total = disk_total;
101  packet.temp = temp;
102  packet.voltage = voltage;
103  packet.network_load_in = network_load_in;
104  packet.network_load_out = network_load_out;
105  packet.cpu_freq = cpu_freq;
106  packet.cpu_load = cpu_load;
107  packet.ram_usage = ram_usage;
108  packet.swap_usage = swap_usage;
109  packet.disk_health = disk_health;
110  packet.disk_usage = disk_usage;
111 
113 #endif
114 
115  msg->msgid = MAVLINK_MSG_ID_ONBOARD_HEALTH;
116 #if MAVLINK_CRC_EXTRA
118 #else
119  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN);
120 #endif
121 }
122 
145 static inline uint16_t mavlink_msg_onboard_health_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
146  mavlink_message_t* msg,
147  uint32_t uptime,uint16_t cpu_freq,uint8_t cpu_load,uint8_t ram_usage,float ram_total,uint8_t swap_usage,float swap_total,int8_t disk_health,uint8_t disk_usage,float disk_total,float temp,float voltage,float network_load_in,float network_load_out)
148 {
149 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
151  _mav_put_uint32_t(buf, 0, uptime);
152  _mav_put_float(buf, 4, ram_total);
153  _mav_put_float(buf, 8, swap_total);
154  _mav_put_float(buf, 12, disk_total);
155  _mav_put_float(buf, 16, temp);
156  _mav_put_float(buf, 20, voltage);
157  _mav_put_float(buf, 24, network_load_in);
158  _mav_put_float(buf, 28, network_load_out);
159  _mav_put_uint16_t(buf, 32, cpu_freq);
160  _mav_put_uint8_t(buf, 34, cpu_load);
161  _mav_put_uint8_t(buf, 35, ram_usage);
162  _mav_put_uint8_t(buf, 36, swap_usage);
163  _mav_put_int8_t(buf, 37, disk_health);
164  _mav_put_uint8_t(buf, 38, disk_usage);
165 
167 #else
169  packet.uptime = uptime;
170  packet.ram_total = ram_total;
171  packet.swap_total = swap_total;
172  packet.disk_total = disk_total;
173  packet.temp = temp;
174  packet.voltage = voltage;
175  packet.network_load_in = network_load_in;
176  packet.network_load_out = network_load_out;
177  packet.cpu_freq = cpu_freq;
178  packet.cpu_load = cpu_load;
179  packet.ram_usage = ram_usage;
180  packet.swap_usage = swap_usage;
181  packet.disk_health = disk_health;
182  packet.disk_usage = disk_usage;
183 
185 #endif
186 
187  msg->msgid = MAVLINK_MSG_ID_ONBOARD_HEALTH;
188 #if MAVLINK_CRC_EXTRA
190 #else
191  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN);
192 #endif
193 }
194 
203 static inline uint16_t mavlink_msg_onboard_health_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_onboard_health_t* onboard_health)
204 {
205  return mavlink_msg_onboard_health_pack(system_id, component_id, msg, onboard_health->uptime, onboard_health->cpu_freq, onboard_health->cpu_load, onboard_health->ram_usage, onboard_health->ram_total, onboard_health->swap_usage, onboard_health->swap_total, onboard_health->disk_health, onboard_health->disk_usage, onboard_health->disk_total, onboard_health->temp, onboard_health->voltage, onboard_health->network_load_in, onboard_health->network_load_out);
206 }
207 
217 static inline uint16_t mavlink_msg_onboard_health_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_onboard_health_t* onboard_health)
218 {
219  return mavlink_msg_onboard_health_pack_chan(system_id, component_id, chan, msg, onboard_health->uptime, onboard_health->cpu_freq, onboard_health->cpu_load, onboard_health->ram_usage, onboard_health->ram_total, onboard_health->swap_usage, onboard_health->swap_total, onboard_health->disk_health, onboard_health->disk_usage, onboard_health->disk_total, onboard_health->temp, onboard_health->voltage, onboard_health->network_load_in, onboard_health->network_load_out);
220 }
221 
241 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
242 
243 static inline void mavlink_msg_onboard_health_send(mavlink_channel_t chan, uint32_t uptime, uint16_t cpu_freq, uint8_t cpu_load, uint8_t ram_usage, float ram_total, uint8_t swap_usage, float swap_total, int8_t disk_health, uint8_t disk_usage, float disk_total, float temp, float voltage, float network_load_in, float network_load_out)
244 {
245 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
247  _mav_put_uint32_t(buf, 0, uptime);
248  _mav_put_float(buf, 4, ram_total);
249  _mav_put_float(buf, 8, swap_total);
250  _mav_put_float(buf, 12, disk_total);
251  _mav_put_float(buf, 16, temp);
252  _mav_put_float(buf, 20, voltage);
253  _mav_put_float(buf, 24, network_load_in);
254  _mav_put_float(buf, 28, network_load_out);
255  _mav_put_uint16_t(buf, 32, cpu_freq);
256  _mav_put_uint8_t(buf, 34, cpu_load);
257  _mav_put_uint8_t(buf, 35, ram_usage);
258  _mav_put_uint8_t(buf, 36, swap_usage);
259  _mav_put_int8_t(buf, 37, disk_health);
260  _mav_put_uint8_t(buf, 38, disk_usage);
261 
262 #if MAVLINK_CRC_EXTRA
264 #else
265  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_HEALTH, buf, MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN);
266 #endif
267 #else
269  packet.uptime = uptime;
270  packet.ram_total = ram_total;
271  packet.swap_total = swap_total;
272  packet.disk_total = disk_total;
273  packet.temp = temp;
274  packet.voltage = voltage;
275  packet.network_load_in = network_load_in;
276  packet.network_load_out = network_load_out;
277  packet.cpu_freq = cpu_freq;
278  packet.cpu_load = cpu_load;
279  packet.ram_usage = ram_usage;
280  packet.swap_usage = swap_usage;
281  packet.disk_health = disk_health;
282  packet.disk_usage = disk_usage;
283 
284 #if MAVLINK_CRC_EXTRA
285  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_HEALTH, (const char *)&packet, MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN, MAVLINK_MSG_ID_ONBOARD_HEALTH_CRC);
286 #else
287  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_HEALTH, (const char *)&packet, MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN);
288 #endif
289 #endif
290 }
291 
292 #if MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN <= MAVLINK_MAX_PAYLOAD_LEN
293 /*
294  This varient of _send() can be used to save stack space by re-using
295  memory from the receive buffer. The caller provides a
296  mavlink_message_t which is the size of a full mavlink message. This
297  is usually the receive buffer for the channel, and allows a reply to an
298  incoming message with minimum stack space usage.
299  */
300 static inline void mavlink_msg_onboard_health_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t uptime, uint16_t cpu_freq, uint8_t cpu_load, uint8_t ram_usage, float ram_total, uint8_t swap_usage, float swap_total, int8_t disk_health, uint8_t disk_usage, float disk_total, float temp, float voltage, float network_load_in, float network_load_out)
301 {
302 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
303  char *buf = (char *)msgbuf;
304  _mav_put_uint32_t(buf, 0, uptime);
305  _mav_put_float(buf, 4, ram_total);
306  _mav_put_float(buf, 8, swap_total);
307  _mav_put_float(buf, 12, disk_total);
308  _mav_put_float(buf, 16, temp);
309  _mav_put_float(buf, 20, voltage);
310  _mav_put_float(buf, 24, network_load_in);
311  _mav_put_float(buf, 28, network_load_out);
312  _mav_put_uint16_t(buf, 32, cpu_freq);
313  _mav_put_uint8_t(buf, 34, cpu_load);
314  _mav_put_uint8_t(buf, 35, ram_usage);
315  _mav_put_uint8_t(buf, 36, swap_usage);
316  _mav_put_int8_t(buf, 37, disk_health);
317  _mav_put_uint8_t(buf, 38, disk_usage);
318 
319 #if MAVLINK_CRC_EXTRA
321 #else
322  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_HEALTH, buf, MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN);
323 #endif
324 #else
326  packet->uptime = uptime;
327  packet->ram_total = ram_total;
328  packet->swap_total = swap_total;
329  packet->disk_total = disk_total;
330  packet->temp = temp;
331  packet->voltage = voltage;
332  packet->network_load_in = network_load_in;
333  packet->network_load_out = network_load_out;
334  packet->cpu_freq = cpu_freq;
335  packet->cpu_load = cpu_load;
336  packet->ram_usage = ram_usage;
337  packet->swap_usage = swap_usage;
338  packet->disk_health = disk_health;
339  packet->disk_usage = disk_usage;
340 
341 #if MAVLINK_CRC_EXTRA
342  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_HEALTH, (const char *)packet, MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN, MAVLINK_MSG_ID_ONBOARD_HEALTH_CRC);
343 #else
344  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ONBOARD_HEALTH, (const char *)packet, MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN);
345 #endif
346 #endif
347 }
348 #endif
349 
350 #endif
351 
352 // MESSAGE ONBOARD_HEALTH UNPACKING
353 
354 
360 static inline uint32_t mavlink_msg_onboard_health_get_uptime(const mavlink_message_t* msg)
361 {
362  return _MAV_RETURN_uint32_t(msg, 0);
363 }
364 
370 static inline uint16_t mavlink_msg_onboard_health_get_cpu_freq(const mavlink_message_t* msg)
371 {
372  return _MAV_RETURN_uint16_t(msg, 32);
373 }
374 
380 static inline uint8_t mavlink_msg_onboard_health_get_cpu_load(const mavlink_message_t* msg)
381 {
382  return _MAV_RETURN_uint8_t(msg, 34);
383 }
384 
390 static inline uint8_t mavlink_msg_onboard_health_get_ram_usage(const mavlink_message_t* msg)
391 {
392  return _MAV_RETURN_uint8_t(msg, 35);
393 }
394 
400 static inline float mavlink_msg_onboard_health_get_ram_total(const mavlink_message_t* msg)
401 {
402  return _MAV_RETURN_float(msg, 4);
403 }
404 
410 static inline uint8_t mavlink_msg_onboard_health_get_swap_usage(const mavlink_message_t* msg)
411 {
412  return _MAV_RETURN_uint8_t(msg, 36);
413 }
414 
420 static inline float mavlink_msg_onboard_health_get_swap_total(const mavlink_message_t* msg)
421 {
422  return _MAV_RETURN_float(msg, 8);
423 }
424 
430 static inline int8_t mavlink_msg_onboard_health_get_disk_health(const mavlink_message_t* msg)
431 {
432  return _MAV_RETURN_int8_t(msg, 37);
433 }
434 
440 static inline uint8_t mavlink_msg_onboard_health_get_disk_usage(const mavlink_message_t* msg)
441 {
442  return _MAV_RETURN_uint8_t(msg, 38);
443 }
444 
450 static inline float mavlink_msg_onboard_health_get_disk_total(const mavlink_message_t* msg)
451 {
452  return _MAV_RETURN_float(msg, 12);
453 }
454 
460 static inline float mavlink_msg_onboard_health_get_temp(const mavlink_message_t* msg)
461 {
462  return _MAV_RETURN_float(msg, 16);
463 }
464 
470 static inline float mavlink_msg_onboard_health_get_voltage(const mavlink_message_t* msg)
471 {
472  return _MAV_RETURN_float(msg, 20);
473 }
474 
480 static inline float mavlink_msg_onboard_health_get_network_load_in(const mavlink_message_t* msg)
481 {
482  return _MAV_RETURN_float(msg, 24);
483 }
484 
490 static inline float mavlink_msg_onboard_health_get_network_load_out(const mavlink_message_t* msg)
491 {
492  return _MAV_RETURN_float(msg, 28);
493 }
494 
501 static inline void mavlink_msg_onboard_health_decode(const mavlink_message_t* msg, mavlink_onboard_health_t* onboard_health)
502 {
503 #if MAVLINK_NEED_BYTE_SWAP
504  onboard_health->uptime = mavlink_msg_onboard_health_get_uptime(msg);
505  onboard_health->ram_total = mavlink_msg_onboard_health_get_ram_total(msg);
506  onboard_health->swap_total = mavlink_msg_onboard_health_get_swap_total(msg);
507  onboard_health->disk_total = mavlink_msg_onboard_health_get_disk_total(msg);
508  onboard_health->temp = mavlink_msg_onboard_health_get_temp(msg);
509  onboard_health->voltage = mavlink_msg_onboard_health_get_voltage(msg);
510  onboard_health->network_load_in = mavlink_msg_onboard_health_get_network_load_in(msg);
511  onboard_health->network_load_out = mavlink_msg_onboard_health_get_network_load_out(msg);
512  onboard_health->cpu_freq = mavlink_msg_onboard_health_get_cpu_freq(msg);
513  onboard_health->cpu_load = mavlink_msg_onboard_health_get_cpu_load(msg);
514  onboard_health->ram_usage = mavlink_msg_onboard_health_get_ram_usage(msg);
515  onboard_health->swap_usage = mavlink_msg_onboard_health_get_swap_usage(msg);
516  onboard_health->disk_health = mavlink_msg_onboard_health_get_disk_health(msg);
517  onboard_health->disk_usage = mavlink_msg_onboard_health_get_disk_usage(msg);
518 #else
519  memcpy(onboard_health, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ONBOARD_HEALTH_LEN);
520 #endif
521 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:145
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:238
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:134
#define _MAV_RETURN_int8_t(msg, wire_offset)
Definition: protocol.h:237
#define _mav_put_int8_t(buf, wire_offset, b)
Definition: protocol.h:135
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:141