mavlink_msg_sys_status.h
Go to the documentation of this file.
1 // MESSAGE SYS_STATUS PACKING
2 
3 #define MAVLINK_MSG_ID_SYS_STATUS 1
4 
5 typedef struct __mavlink_sys_status_t
6 {
7  uint32_t onboard_control_sensors_present; /*< Bitmask showing which onboard controllers and sensors are present. Value of 0: not present. Value of 1: present. Indices defined by ENUM MAV_SYS_STATUS_SENSOR*/
8  uint32_t onboard_control_sensors_enabled; /*< Bitmask showing which onboard controllers and sensors are enabled: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR*/
9  uint32_t onboard_control_sensors_health; /*< Bitmask showing which onboard controllers and sensors are operational or have an error: Value of 0: not enabled. Value of 1: enabled. Indices defined by ENUM MAV_SYS_STATUS_SENSOR*/
10  uint16_t load; /*< Maximum usage in percent of the mainloop time, (0%: 0, 100%: 1000) should be always below 1000*/
11  uint16_t voltage_battery; /*< Battery voltage, in millivolts (1 = 1 millivolt)*/
12  int16_t current_battery; /*< Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current*/
13  uint16_t drop_rate_comm; /*< Communication drops in percent, (0%: 0, 100%: 10'000), (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV)*/
14  uint16_t errors_comm; /*< Communication errors (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV)*/
15  uint16_t errors_count1; /*< Autopilot-specific errors*/
16  uint16_t errors_count2; /*< Autopilot-specific errors*/
17  uint16_t errors_count3; /*< Autopilot-specific errors*/
18  uint16_t errors_count4; /*< Autopilot-specific errors*/
19  int8_t battery_remaining; /*< Remaining battery energy: (0%: 0, 100%: 100), -1: autopilot estimate the remaining battery*/
21 
22 #define MAVLINK_MSG_ID_SYS_STATUS_LEN 31
23 #define MAVLINK_MSG_ID_1_LEN 31
24 
25 #define MAVLINK_MSG_ID_SYS_STATUS_CRC 124
26 #define MAVLINK_MSG_ID_1_CRC 124
27 
28 
29 
30 #define MAVLINK_MESSAGE_INFO_SYS_STATUS { \
31  "SYS_STATUS", \
32  13, \
33  { { "onboard_control_sensors_present", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_sys_status_t, onboard_control_sensors_present) }, \
34  { "onboard_control_sensors_enabled", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_sys_status_t, onboard_control_sensors_enabled) }, \
35  { "onboard_control_sensors_health", "0x%04x", MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_sys_status_t, onboard_control_sensors_health) }, \
36  { "load", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_sys_status_t, load) }, \
37  { "voltage_battery", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_sys_status_t, voltage_battery) }, \
38  { "current_battery", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_sys_status_t, current_battery) }, \
39  { "drop_rate_comm", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_sys_status_t, drop_rate_comm) }, \
40  { "errors_comm", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_sys_status_t, errors_comm) }, \
41  { "errors_count1", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_sys_status_t, errors_count1) }, \
42  { "errors_count2", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_sys_status_t, errors_count2) }, \
43  { "errors_count3", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_sys_status_t, errors_count3) }, \
44  { "errors_count4", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_sys_status_t, errors_count4) }, \
45  { "battery_remaining", NULL, MAVLINK_TYPE_INT8_T, 0, 30, offsetof(mavlink_sys_status_t, battery_remaining) }, \
46  } \
47 }
48 
49 
71 static inline uint16_t mavlink_msg_sys_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
73 {
74 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
76  _mav_put_uint32_t(buf, 0, onboard_control_sensors_present);
77  _mav_put_uint32_t(buf, 4, onboard_control_sensors_enabled);
78  _mav_put_uint32_t(buf, 8, onboard_control_sensors_health);
79  _mav_put_uint16_t(buf, 12, load);
80  _mav_put_uint16_t(buf, 14, voltage_battery);
81  _mav_put_int16_t(buf, 16, current_battery);
82  _mav_put_uint16_t(buf, 18, drop_rate_comm);
83  _mav_put_uint16_t(buf, 20, errors_comm);
84  _mav_put_uint16_t(buf, 22, errors_count1);
85  _mav_put_uint16_t(buf, 24, errors_count2);
86  _mav_put_uint16_t(buf, 26, errors_count3);
87  _mav_put_uint16_t(buf, 28, errors_count4);
88  _mav_put_int8_t(buf, 30, battery_remaining);
89 
91 #else
92  mavlink_sys_status_t packet;
96  packet.load = load;
100  packet.errors_comm = errors_comm;
101  packet.errors_count1 = errors_count1;
102  packet.errors_count2 = errors_count2;
103  packet.errors_count3 = errors_count3;
104  packet.errors_count4 = errors_count4;
106 
108 #endif
109 
110  msg->msgid = MAVLINK_MSG_ID_SYS_STATUS;
111 #if MAVLINK_CRC_EXTRA
113 #else
114  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SYS_STATUS_LEN);
115 #endif
116 }
117 
139 static inline uint16_t mavlink_msg_sys_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
140  mavlink_message_t* msg,
142 {
143 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
145  _mav_put_uint32_t(buf, 0, onboard_control_sensors_present);
146  _mav_put_uint32_t(buf, 4, onboard_control_sensors_enabled);
147  _mav_put_uint32_t(buf, 8, onboard_control_sensors_health);
148  _mav_put_uint16_t(buf, 12, load);
149  _mav_put_uint16_t(buf, 14, voltage_battery);
150  _mav_put_int16_t(buf, 16, current_battery);
151  _mav_put_uint16_t(buf, 18, drop_rate_comm);
152  _mav_put_uint16_t(buf, 20, errors_comm);
153  _mav_put_uint16_t(buf, 22, errors_count1);
154  _mav_put_uint16_t(buf, 24, errors_count2);
155  _mav_put_uint16_t(buf, 26, errors_count3);
156  _mav_put_uint16_t(buf, 28, errors_count4);
157  _mav_put_int8_t(buf, 30, battery_remaining);
158 
160 #else
161  mavlink_sys_status_t packet;
165  packet.load = load;
169  packet.errors_comm = errors_comm;
170  packet.errors_count1 = errors_count1;
171  packet.errors_count2 = errors_count2;
172  packet.errors_count3 = errors_count3;
173  packet.errors_count4 = errors_count4;
175 
177 #endif
178 
179  msg->msgid = MAVLINK_MSG_ID_SYS_STATUS;
180 #if MAVLINK_CRC_EXTRA
182 #else
183  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SYS_STATUS_LEN);
184 #endif
185 }
186 
195 static inline uint16_t mavlink_msg_sys_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sys_status_t* sys_status)
196 {
197  return mavlink_msg_sys_status_pack(system_id, component_id, msg, sys_status->onboard_control_sensors_present, sys_status->onboard_control_sensors_enabled, sys_status->onboard_control_sensors_health, sys_status->load, sys_status->voltage_battery, sys_status->current_battery, sys_status->battery_remaining, sys_status->drop_rate_comm, sys_status->errors_comm, sys_status->errors_count1, sys_status->errors_count2, sys_status->errors_count3, sys_status->errors_count4);
198 }
199 
209 static inline uint16_t mavlink_msg_sys_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sys_status_t* sys_status)
210 {
211  return mavlink_msg_sys_status_pack_chan(system_id, component_id, chan, msg, sys_status->onboard_control_sensors_present, sys_status->onboard_control_sensors_enabled, sys_status->onboard_control_sensors_health, sys_status->load, sys_status->voltage_battery, sys_status->current_battery, sys_status->battery_remaining, sys_status->drop_rate_comm, sys_status->errors_comm, sys_status->errors_count1, sys_status->errors_count2, sys_status->errors_count3, sys_status->errors_count4);
212 }
213 
232 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
233 
234 static inline void mavlink_msg_sys_status_send(mavlink_channel_t chan, uint32_t onboard_control_sensors_present, uint32_t onboard_control_sensors_enabled, uint32_t onboard_control_sensors_health, uint16_t load, uint16_t voltage_battery, int16_t current_battery, int8_t battery_remaining, uint16_t drop_rate_comm, uint16_t errors_comm, uint16_t errors_count1, uint16_t errors_count2, uint16_t errors_count3, uint16_t errors_count4)
235 {
236 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
241  _mav_put_uint16_t(buf, 12, load);
245  _mav_put_uint16_t(buf, 20, errors_comm);
249  _mav_put_uint16_t(buf, 28, errors_count4);
251 
252 #if MAVLINK_CRC_EXTRA
253  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, buf, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC);
254 #else
255  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, buf, MAVLINK_MSG_ID_SYS_STATUS_LEN);
256 #endif
257 #else
258  mavlink_sys_status_t packet;
262  packet.load = load;
266  packet.errors_comm = errors_comm;
267  packet.errors_count1 = errors_count1;
268  packet.errors_count2 = errors_count2;
269  packet.errors_count3 = errors_count3;
270  packet.errors_count4 = errors_count4;
272 
273 #if MAVLINK_CRC_EXTRA
274  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, (const char *)&packet, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC);
275 #else
276  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, (const char *)&packet, MAVLINK_MSG_ID_SYS_STATUS_LEN);
277 #endif
278 #endif
279 }
280 
281 #if MAVLINK_MSG_ID_SYS_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
282 /*
283  This varient of _send() can be used to save stack space by re-using
284  memory from the receive buffer. The caller provides a
285  mavlink_message_t which is the size of a full mavlink message. This
286  is usually the receive buffer for the channel, and allows a reply to an
287  incoming message with minimum stack space usage.
288  */
289 static inline void mavlink_msg_sys_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t onboard_control_sensors_present, uint32_t onboard_control_sensors_enabled, uint32_t onboard_control_sensors_health, uint16_t load, uint16_t voltage_battery, int16_t current_battery, int8_t battery_remaining, uint16_t drop_rate_comm, uint16_t errors_comm, uint16_t errors_count1, uint16_t errors_count2, uint16_t errors_count3, uint16_t errors_count4)
290 {
291 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
292  char *buf = (char *)msgbuf;
296  _mav_put_uint16_t(buf, 12, load);
300  _mav_put_uint16_t(buf, 20, errors_comm);
304  _mav_put_uint16_t(buf, 28, errors_count4);
306 
307 #if MAVLINK_CRC_EXTRA
308  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, buf, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC);
309 #else
310  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, buf, MAVLINK_MSG_ID_SYS_STATUS_LEN);
311 #endif
312 #else
313  mavlink_sys_status_t *packet = (mavlink_sys_status_t *)msgbuf;
317  packet->load = load;
320  packet->drop_rate_comm = drop_rate_comm;
321  packet->errors_comm = errors_comm;
322  packet->errors_count1 = errors_count1;
323  packet->errors_count2 = errors_count2;
324  packet->errors_count3 = errors_count3;
325  packet->errors_count4 = errors_count4;
327 
328 #if MAVLINK_CRC_EXTRA
329  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, (const char *)packet, MAVLINK_MSG_ID_SYS_STATUS_LEN, MAVLINK_MSG_ID_SYS_STATUS_CRC);
330 #else
331  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SYS_STATUS, (const char *)packet, MAVLINK_MSG_ID_SYS_STATUS_LEN);
332 #endif
333 #endif
334 }
335 #endif
336 
337 #endif
338 
339 // MESSAGE SYS_STATUS UNPACKING
340 
341 
347 static inline uint32_t mavlink_msg_sys_status_get_onboard_control_sensors_present(const mavlink_message_t* msg)
348 {
349  return _MAV_RETURN_uint32_t(msg, 0);
350 }
351 
357 static inline uint32_t mavlink_msg_sys_status_get_onboard_control_sensors_enabled(const mavlink_message_t* msg)
358 {
359  return _MAV_RETURN_uint32_t(msg, 4);
360 }
361 
367 static inline uint32_t mavlink_msg_sys_status_get_onboard_control_sensors_health(const mavlink_message_t* msg)
368 {
369  return _MAV_RETURN_uint32_t(msg, 8);
370 }
371 
377 static inline uint16_t mavlink_msg_sys_status_get_load(const mavlink_message_t* msg)
378 {
379  return _MAV_RETURN_uint16_t(msg, 12);
380 }
381 
387 static inline uint16_t mavlink_msg_sys_status_get_voltage_battery(const mavlink_message_t* msg)
388 {
389  return _MAV_RETURN_uint16_t(msg, 14);
390 }
391 
397 static inline int16_t mavlink_msg_sys_status_get_current_battery(const mavlink_message_t* msg)
398 {
399  return _MAV_RETURN_int16_t(msg, 16);
400 }
401 
407 static inline int8_t mavlink_msg_sys_status_get_battery_remaining(const mavlink_message_t* msg)
408 {
409  return _MAV_RETURN_int8_t(msg, 30);
410 }
411 
417 static inline uint16_t mavlink_msg_sys_status_get_drop_rate_comm(const mavlink_message_t* msg)
418 {
419  return _MAV_RETURN_uint16_t(msg, 18);
420 }
421 
427 static inline uint16_t mavlink_msg_sys_status_get_errors_comm(const mavlink_message_t* msg)
428 {
429  return _MAV_RETURN_uint16_t(msg, 20);
430 }
431 
437 static inline uint16_t mavlink_msg_sys_status_get_errors_count1(const mavlink_message_t* msg)
438 {
439  return _MAV_RETURN_uint16_t(msg, 22);
440 }
441 
447 static inline uint16_t mavlink_msg_sys_status_get_errors_count2(const mavlink_message_t* msg)
448 {
449  return _MAV_RETURN_uint16_t(msg, 24);
450 }
451 
457 static inline uint16_t mavlink_msg_sys_status_get_errors_count3(const mavlink_message_t* msg)
458 {
459  return _MAV_RETURN_uint16_t(msg, 26);
460 }
461 
467 static inline uint16_t mavlink_msg_sys_status_get_errors_count4(const mavlink_message_t* msg)
468 {
469  return _MAV_RETURN_uint16_t(msg, 28);
470 }
471 
478 static inline void mavlink_msg_sys_status_decode(const mavlink_message_t* msg, mavlink_sys_status_t* sys_status)
479 {
480 #if MAVLINK_NEED_BYTE_SWAP
484  sys_status->load = mavlink_msg_sys_status_get_load(msg);
494 #else
495  memcpy(sys_status, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SYS_STATUS_LEN);
496 #endif
497 }
#define _MAV_RETURN_int8_t(msg, wire_offset)
Definition: protocol.h:243
#define _mav_put_int8_t(buf, wire_offset, b)
Definition: protocol.h:141
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145
#define _mav_put_int16_t(buf, wire_offset, b)
Definition: protocol.h:146
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:147


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:25