mavlink_msg_statustext.h
Go to the documentation of this file.
1 // MESSAGE STATUSTEXT PACKING
2 
3 #define MAVLINK_MSG_ID_STATUSTEXT 253
4 
5 typedef struct __mavlink_statustext_t
6 {
7  uint8_t severity; /*< Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY.*/
8  char text[50]; /*< Status text message, without null termination character*/
10 
11 #define MAVLINK_MSG_ID_STATUSTEXT_LEN 51
12 #define MAVLINK_MSG_ID_253_LEN 51
13 
14 #define MAVLINK_MSG_ID_STATUSTEXT_CRC 83
15 #define MAVLINK_MSG_ID_253_CRC 83
16 
17 #define MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN 50
18 
19 #define MAVLINK_MESSAGE_INFO_STATUSTEXT { \
20  "STATUSTEXT", \
21  2, \
22  { { "severity", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_statustext_t, severity) }, \
23  { "text", NULL, MAVLINK_TYPE_CHAR, 50, 1, offsetof(mavlink_statustext_t, text) }, \
24  } \
25 }
26 
27 
38 static inline uint16_t mavlink_msg_statustext_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
39  uint8_t severity, const char *text)
40 {
41 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
43  _mav_put_uint8_t(buf, 0, severity);
44  _mav_put_char_array(buf, 1, text, 50);
46 #else
47  mavlink_statustext_t packet;
48  packet.severity = severity;
49  mav_array_memcpy(packet.text, text, sizeof(char)*50);
51 #endif
52 
53  msg->msgid = MAVLINK_MSG_ID_STATUSTEXT;
54 #if MAVLINK_CRC_EXTRA
56 #else
57  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_STATUSTEXT_LEN);
58 #endif
59 }
60 
71 static inline uint16_t mavlink_msg_statustext_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
72  mavlink_message_t* msg,
73  uint8_t severity,const char *text)
74 {
75 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
77  _mav_put_uint8_t(buf, 0, severity);
78  _mav_put_char_array(buf, 1, text, 50);
80 #else
81  mavlink_statustext_t packet;
82  packet.severity = severity;
83  mav_array_memcpy(packet.text, text, sizeof(char)*50);
85 #endif
86 
87  msg->msgid = MAVLINK_MSG_ID_STATUSTEXT;
88 #if MAVLINK_CRC_EXTRA
90 #else
91  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_STATUSTEXT_LEN);
92 #endif
93 }
94 
103 static inline uint16_t mavlink_msg_statustext_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_statustext_t* statustext)
104 {
105  return mavlink_msg_statustext_pack(system_id, component_id, msg, statustext->severity, statustext->text);
106 }
107 
117 static inline uint16_t mavlink_msg_statustext_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_statustext_t* statustext)
118 {
119  return mavlink_msg_statustext_pack_chan(system_id, component_id, chan, msg, statustext->severity, statustext->text);
120 }
121 
129 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
130 
131 static inline void mavlink_msg_statustext_send(mavlink_channel_t chan, uint8_t severity, const char *text)
132 {
133 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
135  _mav_put_uint8_t(buf, 0, severity);
136  _mav_put_char_array(buf, 1, text, 50);
137 #if MAVLINK_CRC_EXTRA
138  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
139 #else
140  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN);
141 #endif
142 #else
143  mavlink_statustext_t packet;
144  packet.severity = severity;
145  mav_array_memcpy(packet.text, text, sizeof(char)*50);
146 #if MAVLINK_CRC_EXTRA
147  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)&packet, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
148 #else
149  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)&packet, MAVLINK_MSG_ID_STATUSTEXT_LEN);
150 #endif
151 #endif
152 }
153 
154 #if MAVLINK_MSG_ID_STATUSTEXT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
155 /*
156  This varient of _send() can be used to save stack space by re-using
157  memory from the receive buffer. The caller provides a
158  mavlink_message_t which is the size of a full mavlink message. This
159  is usually the receive buffer for the channel, and allows a reply to an
160  incoming message with minimum stack space usage.
161  */
162 static inline void mavlink_msg_statustext_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t severity, const char *text)
163 {
164 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165  char *buf = (char *)msgbuf;
166  _mav_put_uint8_t(buf, 0, severity);
167  _mav_put_char_array(buf, 1, text, 50);
168 #if MAVLINK_CRC_EXTRA
169  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
170 #else
171  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN);
172 #endif
173 #else
174  mavlink_statustext_t *packet = (mavlink_statustext_t *)msgbuf;
175  packet->severity = severity;
176  mav_array_memcpy(packet->text, text, sizeof(char)*50);
177 #if MAVLINK_CRC_EXTRA
178  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)packet, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
179 #else
180  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)packet, MAVLINK_MSG_ID_STATUSTEXT_LEN);
181 #endif
182 #endif
183 }
184 #endif
185 
186 #endif
187 
188 // MESSAGE STATUSTEXT UNPACKING
189 
190 
196 static inline uint8_t mavlink_msg_statustext_get_severity(const mavlink_message_t* msg)
197 {
198  return _MAV_RETURN_uint8_t(msg, 0);
199 }
200 
206 static inline uint16_t mavlink_msg_statustext_get_text(const mavlink_message_t* msg, char *text)
207 {
208  return _MAV_RETURN_char_array(msg, text, 50, 1);
209 }
210 
217 static inline void mavlink_msg_statustext_decode(const mavlink_message_t* msg, mavlink_statustext_t* statustext)
218 {
219 #if MAVLINK_NEED_BYTE_SWAP
221  mavlink_msg_statustext_get_text(msg, statustext->text);
222 #else
223  memcpy(statustext, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_STATUSTEXT_LEN);
224 #endif
225 }
#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
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176
static uint16_t _MAV_RETURN_char_array(const mavlink_message_t *msg, char *value, uint8_t array_length, uint8_t wire_offset)
Definition: protocol.h:288
static void _mav_put_char_array(char *buf, uint8_t wire_offset, const char *b, uint8_t array_length)
Definition: protocol.h:188


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