NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 {
10  uint16_t load;
11  uint16_t voltage_battery;
12  int16_t current_battery;
13  uint16_t drop_rate_comm;
14  uint16_t errors_comm;
15  uint16_t errors_count1;
16  uint16_t errors_count2;
17  uint16_t errors_count3;
18  uint16_t errors_count4;
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,
72  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)
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;
93  packet.onboard_control_sensors_present = onboard_control_sensors_present;
94  packet.onboard_control_sensors_enabled = onboard_control_sensors_enabled;
95  packet.onboard_control_sensors_health = onboard_control_sensors_health;
96  packet.load = load;
97  packet.voltage_battery = voltage_battery;
98  packet.current_battery = current_battery;
99  packet.drop_rate_comm = drop_rate_comm;
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;
105  packet.battery_remaining = battery_remaining;
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,
141  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)
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;
162  packet.onboard_control_sensors_present = onboard_control_sensors_present;
163  packet.onboard_control_sensors_enabled = onboard_control_sensors_enabled;
164  packet.onboard_control_sensors_health = onboard_control_sensors_health;
165  packet.load = load;
166  packet.voltage_battery = voltage_battery;
167  packet.current_battery = current_battery;
168  packet.drop_rate_comm = drop_rate_comm;
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;
174  packet.battery_remaining = battery_remaining;
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
238  _mav_put_uint32_t(buf, 0, onboard_control_sensors_present);
239  _mav_put_uint32_t(buf, 4, onboard_control_sensors_enabled);
240  _mav_put_uint32_t(buf, 8, onboard_control_sensors_health);
241  _mav_put_uint16_t(buf, 12, load);
242  _mav_put_uint16_t(buf, 14, voltage_battery);
243  _mav_put_int16_t(buf, 16, current_battery);
244  _mav_put_uint16_t(buf, 18, drop_rate_comm);
245  _mav_put_uint16_t(buf, 20, errors_comm);
246  _mav_put_uint16_t(buf, 22, errors_count1);
247  _mav_put_uint16_t(buf, 24, errors_count2);
248  _mav_put_uint16_t(buf, 26, errors_count3);
249  _mav_put_uint16_t(buf, 28, errors_count4);
250  _mav_put_int8_t(buf, 30, battery_remaining);
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;
259  packet.onboard_control_sensors_present = onboard_control_sensors_present;
260  packet.onboard_control_sensors_enabled = onboard_control_sensors_enabled;
261  packet.onboard_control_sensors_health = onboard_control_sensors_health;
262  packet.load = load;
263  packet.voltage_battery = voltage_battery;
264  packet.current_battery = current_battery;
265  packet.drop_rate_comm = drop_rate_comm;
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;
271  packet.battery_remaining = battery_remaining;
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;
293  _mav_put_uint32_t(buf, 0, onboard_control_sensors_present);
294  _mav_put_uint32_t(buf, 4, onboard_control_sensors_enabled);
295  _mav_put_uint32_t(buf, 8, onboard_control_sensors_health);
296  _mav_put_uint16_t(buf, 12, load);
297  _mav_put_uint16_t(buf, 14, voltage_battery);
298  _mav_put_int16_t(buf, 16, current_battery);
299  _mav_put_uint16_t(buf, 18, drop_rate_comm);
300  _mav_put_uint16_t(buf, 20, errors_comm);
301  _mav_put_uint16_t(buf, 22, errors_count1);
302  _mav_put_uint16_t(buf, 24, errors_count2);
303  _mav_put_uint16_t(buf, 26, errors_count3);
304  _mav_put_uint16_t(buf, 28, errors_count4);
305  _mav_put_int8_t(buf, 30, battery_remaining);
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;
314  packet->onboard_control_sensors_present = onboard_control_sensors_present;
315  packet->onboard_control_sensors_enabled = onboard_control_sensors_enabled;
316  packet->onboard_control_sensors_health = onboard_control_sensors_health;
317  packet->load = load;
318  packet->voltage_battery = voltage_battery;
319  packet->current_battery = current_battery;
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;
326  packet->battery_remaining = battery_remaining;
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
481  sys_status->onboard_control_sensors_present = mavlink_msg_sys_status_get_onboard_control_sensors_present(msg);
482  sys_status->onboard_control_sensors_enabled = mavlink_msg_sys_status_get_onboard_control_sensors_enabled(msg);
483  sys_status->onboard_control_sensors_health = mavlink_msg_sys_status_get_onboard_control_sensors_health(msg);
484  sys_status->load = mavlink_msg_sys_status_get_load(msg);
485  sys_status->voltage_battery = mavlink_msg_sys_status_get_voltage_battery(msg);
486  sys_status->current_battery = mavlink_msg_sys_status_get_current_battery(msg);
487  sys_status->drop_rate_comm = mavlink_msg_sys_status_get_drop_rate_comm(msg);
488  sys_status->errors_comm = mavlink_msg_sys_status_get_errors_comm(msg);
489  sys_status->errors_count1 = mavlink_msg_sys_status_get_errors_count1(msg);
490  sys_status->errors_count2 = mavlink_msg_sys_status_get_errors_count2(msg);
491  sys_status->errors_count3 = mavlink_msg_sys_status_get_errors_count3(msg);
492  sys_status->errors_count4 = mavlink_msg_sys_status_get_errors_count4(msg);
493  sys_status->battery_remaining = mavlink_msg_sys_status_get_battery_remaining(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: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_int16_t(buf, wire_offset, b)
Definition: protocol.h:140
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:141