User | Revision | Line number | New contents of line |
bhepp |
0:28183cc7963f
|
1
|
// MESSAGE STATUSTEXT PACKING
|
bhepp |
0:28183cc7963f
|
2
|
|
bhepp |
0:28183cc7963f
|
3
|
#define MAVLINK_MSG_ID_STATUSTEXT 253
|
bhepp |
0:28183cc7963f
|
4
|
|
bhepp |
0:28183cc7963f
|
5
|
typedef struct __mavlink_statustext_t
|
bhepp |
0:28183cc7963f
|
6
|
{
|
bhepp |
0:28183cc7963f
|
7
|
uint8_t severity; /*< Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY.*/
|
bhepp |
0:28183cc7963f
|
8
|
char text[50]; /*< Status text message, without null termination character*/
|
bhepp |
0:28183cc7963f
|
9
|
} mavlink_statustext_t;
|
bhepp |
0:28183cc7963f
|
10
|
|
bhepp |
0:28183cc7963f
|
11
|
#define MAVLINK_MSG_ID_STATUSTEXT_LEN 51
|
bhepp |
0:28183cc7963f
|
12
|
#define MAVLINK_MSG_ID_253_LEN 51
|
bhepp |
0:28183cc7963f
|
13
|
|
bhepp |
0:28183cc7963f
|
14
|
#define MAVLINK_MSG_ID_STATUSTEXT_CRC 83
|
bhepp |
0:28183cc7963f
|
15
|
#define MAVLINK_MSG_ID_253_CRC 83
|
bhepp |
0:28183cc7963f
|
16
|
|
bhepp |
0:28183cc7963f
|
17
|
#define MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN 50
|
bhepp |
0:28183cc7963f
|
18
|
|
bhepp |
0:28183cc7963f
|
19
|
#define MAVLINK_MESSAGE_INFO_STATUSTEXT { \
|
bhepp |
0:28183cc7963f
|
20
|
"STATUSTEXT", \
|
bhepp |
0:28183cc7963f
|
21
|
2, \
|
bhepp |
0:28183cc7963f
|
22
|
{ { "severity", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_statustext_t, severity) }, \
|
bhepp |
0:28183cc7963f
|
23
|
{ "text", NULL, MAVLINK_TYPE_CHAR, 50, 1, offsetof(mavlink_statustext_t, text) }, \
|
bhepp |
0:28183cc7963f
|
24
|
} \
|
bhepp |
0:28183cc7963f
|
25
|
}
|
bhepp |
0:28183cc7963f
|
26
|
|
bhepp |
0:28183cc7963f
|
27
|
|
bhepp |
0:28183cc7963f
|
28
|
/**
|
bhepp |
0:28183cc7963f
|
29
|
* @brief Pack a statustext message
|
bhepp |
0:28183cc7963f
|
30
|
* @param system_id ID of this system
|
bhepp |
0:28183cc7963f
|
31
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
bhepp |
0:28183cc7963f
|
32
|
* @param msg The MAVLink message to compress the data into
|
bhepp |
0:28183cc7963f
|
33
|
*
|
bhepp |
0:28183cc7963f
|
34
|
* @param severity Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY.
|
bhepp |
0:28183cc7963f
|
35
|
* @param text Status text message, without null termination character
|
bhepp |
0:28183cc7963f
|
36
|
* @return length of the message in bytes (excluding serial stream start sign)
|
bhepp |
0:28183cc7963f
|
37
|
*/
|
bhepp |
0:28183cc7963f
|
38
|
static inline uint16_t mavlink_msg_statustext_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
bhepp |
0:28183cc7963f
|
39
|
uint8_t severity, const char *text)
|
bhepp |
0:28183cc7963f
|
40
|
{
|
bhepp |
0:28183cc7963f
|
41
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
bhepp |
0:28183cc7963f
|
42
|
char buf[MAVLINK_MSG_ID_STATUSTEXT_LEN];
|
bhepp |
0:28183cc7963f
|
43
|
_mav_put_uint8_t(buf, 0, severity);
|
bhepp |
0:28183cc7963f
|
44
|
_mav_put_char_array(buf, 1, text, 50);
|
bhepp |
0:28183cc7963f
|
45
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
46
|
#else
|
bhepp |
0:28183cc7963f
|
47
|
mavlink_statustext_t packet;
|
bhepp |
0:28183cc7963f
|
48
|
packet.severity = severity;
|
bhepp |
0:28183cc7963f
|
49
|
mav_array_memcpy(packet.text, text, sizeof(char)*50);
|
bhepp |
0:28183cc7963f
|
50
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
51
|
#endif
|
bhepp |
0:28183cc7963f
|
52
|
|
bhepp |
0:28183cc7963f
|
53
|
msg->msgid = MAVLINK_MSG_ID_STATUSTEXT;
|
bhepp |
0:28183cc7963f
|
54
|
#if MAVLINK_CRC_EXTRA
|
bhepp |
0:28183cc7963f
|
55
|
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
|
bhepp |
0:28183cc7963f
|
56
|
#else
|
bhepp |
0:28183cc7963f
|
57
|
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
58
|
#endif
|
bhepp |
0:28183cc7963f
|
59
|
}
|
bhepp |
0:28183cc7963f
|
60
|
|
bhepp |
0:28183cc7963f
|
61
|
/**
|
bhepp |
0:28183cc7963f
|
62
|
* @brief Pack a statustext message on a channel
|
bhepp |
0:28183cc7963f
|
63
|
* @param system_id ID of this system
|
bhepp |
0:28183cc7963f
|
64
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
bhepp |
0:28183cc7963f
|
65
|
* @param chan The MAVLink channel this message will be sent over
|
bhepp |
0:28183cc7963f
|
66
|
* @param msg The MAVLink message to compress the data into
|
bhepp |
0:28183cc7963f
|
67
|
* @param severity Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY.
|
bhepp |
0:28183cc7963f
|
68
|
* @param text Status text message, without null termination character
|
bhepp |
0:28183cc7963f
|
69
|
* @return length of the message in bytes (excluding serial stream start sign)
|
bhepp |
0:28183cc7963f
|
70
|
*/
|
bhepp |
0:28183cc7963f
|
71
|
static inline uint16_t mavlink_msg_statustext_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
bhepp |
0:28183cc7963f
|
72
|
mavlink_message_t* msg,
|
bhepp |
0:28183cc7963f
|
73
|
uint8_t severity,const char *text)
|
bhepp |
0:28183cc7963f
|
74
|
{
|
bhepp |
0:28183cc7963f
|
75
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
bhepp |
0:28183cc7963f
|
76
|
char buf[MAVLINK_MSG_ID_STATUSTEXT_LEN];
|
bhepp |
0:28183cc7963f
|
77
|
_mav_put_uint8_t(buf, 0, severity);
|
bhepp |
0:28183cc7963f
|
78
|
_mav_put_char_array(buf, 1, text, 50);
|
bhepp |
0:28183cc7963f
|
79
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
80
|
#else
|
bhepp |
0:28183cc7963f
|
81
|
mavlink_statustext_t packet;
|
bhepp |
0:28183cc7963f
|
82
|
packet.severity = severity;
|
bhepp |
0:28183cc7963f
|
83
|
mav_array_memcpy(packet.text, text, sizeof(char)*50);
|
bhepp |
0:28183cc7963f
|
84
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
85
|
#endif
|
bhepp |
0:28183cc7963f
|
86
|
|
bhepp |
0:28183cc7963f
|
87
|
msg->msgid = MAVLINK_MSG_ID_STATUSTEXT;
|
bhepp |
0:28183cc7963f
|
88
|
#if MAVLINK_CRC_EXTRA
|
bhepp |
0:28183cc7963f
|
89
|
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
|
bhepp |
0:28183cc7963f
|
90
|
#else
|
bhepp |
0:28183cc7963f
|
91
|
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
92
|
#endif
|
bhepp |
0:28183cc7963f
|
93
|
}
|
bhepp |
0:28183cc7963f
|
94
|
|
bhepp |
0:28183cc7963f
|
95
|
/**
|
bhepp |
0:28183cc7963f
|
96
|
* @brief Encode a statustext struct
|
bhepp |
0:28183cc7963f
|
97
|
*
|
bhepp |
0:28183cc7963f
|
98
|
* @param system_id ID of this system
|
bhepp |
0:28183cc7963f
|
99
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
bhepp |
0:28183cc7963f
|
100
|
* @param msg The MAVLink message to compress the data into
|
bhepp |
0:28183cc7963f
|
101
|
* @param statustext C-struct to read the message contents from
|
bhepp |
0:28183cc7963f
|
102
|
*/
|
bhepp |
0:28183cc7963f
|
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)
|
bhepp |
0:28183cc7963f
|
104
|
{
|
bhepp |
0:28183cc7963f
|
105
|
return mavlink_msg_statustext_pack(system_id, component_id, msg, statustext->severity, statustext->text);
|
bhepp |
0:28183cc7963f
|
106
|
}
|
bhepp |
0:28183cc7963f
|
107
|
|
bhepp |
0:28183cc7963f
|
108
|
/**
|
bhepp |
0:28183cc7963f
|
109
|
* @brief Encode a statustext struct on a channel
|
bhepp |
0:28183cc7963f
|
110
|
*
|
bhepp |
0:28183cc7963f
|
111
|
* @param system_id ID of this system
|
bhepp |
0:28183cc7963f
|
112
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
bhepp |
0:28183cc7963f
|
113
|
* @param chan The MAVLink channel this message will be sent over
|
bhepp |
0:28183cc7963f
|
114
|
* @param msg The MAVLink message to compress the data into
|
bhepp |
0:28183cc7963f
|
115
|
* @param statustext C-struct to read the message contents from
|
bhepp |
0:28183cc7963f
|
116
|
*/
|
bhepp |
0:28183cc7963f
|
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)
|
bhepp |
0:28183cc7963f
|
118
|
{
|
bhepp |
0:28183cc7963f
|
119
|
return mavlink_msg_statustext_pack_chan(system_id, component_id, chan, msg, statustext->severity, statustext->text);
|
bhepp |
0:28183cc7963f
|
120
|
}
|
bhepp |
0:28183cc7963f
|
121
|
|
bhepp |
0:28183cc7963f
|
122
|
/**
|
bhepp |
0:28183cc7963f
|
123
|
* @brief Send a statustext message
|
bhepp |
0:28183cc7963f
|
124
|
* @param chan MAVLink channel to send the message
|
bhepp |
0:28183cc7963f
|
125
|
*
|
bhepp |
0:28183cc7963f
|
126
|
* @param severity Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY.
|
bhepp |
0:28183cc7963f
|
127
|
* @param text Status text message, without null termination character
|
bhepp |
0:28183cc7963f
|
128
|
*/
|
bhepp |
0:28183cc7963f
|
129
|
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
bhepp |
0:28183cc7963f
|
130
|
|
bhepp |
0:28183cc7963f
|
131
|
static inline void mavlink_msg_statustext_send(mavlink_channel_t chan, uint8_t severity, const char *text)
|
bhepp |
0:28183cc7963f
|
132
|
{
|
bhepp |
0:28183cc7963f
|
133
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
bhepp |
0:28183cc7963f
|
134
|
char buf[MAVLINK_MSG_ID_STATUSTEXT_LEN];
|
bhepp |
0:28183cc7963f
|
135
|
_mav_put_uint8_t(buf, 0, severity);
|
bhepp |
0:28183cc7963f
|
136
|
_mav_put_char_array(buf, 1, text, 50);
|
bhepp |
0:28183cc7963f
|
137
|
#if MAVLINK_CRC_EXTRA
|
bhepp |
0:28183cc7963f
|
138
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
|
bhepp |
0:28183cc7963f
|
139
|
#else
|
bhepp |
0:28183cc7963f
|
140
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
141
|
#endif
|
bhepp |
0:28183cc7963f
|
142
|
#else
|
bhepp |
0:28183cc7963f
|
143
|
mavlink_statustext_t packet;
|
bhepp |
0:28183cc7963f
|
144
|
packet.severity = severity;
|
bhepp |
0:28183cc7963f
|
145
|
mav_array_memcpy(packet.text, text, sizeof(char)*50);
|
bhepp |
0:28183cc7963f
|
146
|
#if MAVLINK_CRC_EXTRA
|
bhepp |
0:28183cc7963f
|
147
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)&packet, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
|
bhepp |
0:28183cc7963f
|
148
|
#else
|
bhepp |
0:28183cc7963f
|
149
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)&packet, MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
150
|
#endif
|
bhepp |
0:28183cc7963f
|
151
|
#endif
|
bhepp |
0:28183cc7963f
|
152
|
}
|
bhepp |
0:28183cc7963f
|
153
|
|
bhepp |
0:28183cc7963f
|
154
|
#if MAVLINK_MSG_ID_STATUSTEXT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
bhepp |
0:28183cc7963f
|
155
|
/*
|
bhepp |
0:28183cc7963f
|
156
|
This varient of _send() can be used to save stack space by re-using
|
bhepp |
0:28183cc7963f
|
157
|
memory from the receive buffer. The caller provides a
|
bhepp |
0:28183cc7963f
|
158
|
mavlink_message_t which is the size of a full mavlink message. This
|
bhepp |
0:28183cc7963f
|
159
|
is usually the receive buffer for the channel, and allows a reply to an
|
bhepp |
0:28183cc7963f
|
160
|
incoming message with minimum stack space usage.
|
bhepp |
0:28183cc7963f
|
161
|
*/
|
bhepp |
0:28183cc7963f
|
162
|
static inline void mavlink_msg_statustext_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t severity, const char *text)
|
bhepp |
0:28183cc7963f
|
163
|
{
|
bhepp |
0:28183cc7963f
|
164
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
bhepp |
0:28183cc7963f
|
165
|
char *buf = (char *)msgbuf;
|
bhepp |
0:28183cc7963f
|
166
|
_mav_put_uint8_t(buf, 0, severity);
|
bhepp |
0:28183cc7963f
|
167
|
_mav_put_char_array(buf, 1, text, 50);
|
bhepp |
0:28183cc7963f
|
168
|
#if MAVLINK_CRC_EXTRA
|
bhepp |
0:28183cc7963f
|
169
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
|
bhepp |
0:28183cc7963f
|
170
|
#else
|
bhepp |
0:28183cc7963f
|
171
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, buf, MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
172
|
#endif
|
bhepp |
0:28183cc7963f
|
173
|
#else
|
bhepp |
0:28183cc7963f
|
174
|
mavlink_statustext_t *packet = (mavlink_statustext_t *)msgbuf;
|
bhepp |
0:28183cc7963f
|
175
|
packet->severity = severity;
|
bhepp |
0:28183cc7963f
|
176
|
mav_array_memcpy(packet->text, text, sizeof(char)*50);
|
bhepp |
0:28183cc7963f
|
177
|
#if MAVLINK_CRC_EXTRA
|
bhepp |
0:28183cc7963f
|
178
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)packet, MAVLINK_MSG_ID_STATUSTEXT_LEN, MAVLINK_MSG_ID_STATUSTEXT_CRC);
|
bhepp |
0:28183cc7963f
|
179
|
#else
|
bhepp |
0:28183cc7963f
|
180
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)packet, MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
181
|
#endif
|
bhepp |
0:28183cc7963f
|
182
|
#endif
|
bhepp |
0:28183cc7963f
|
183
|
}
|
bhepp |
0:28183cc7963f
|
184
|
#endif
|
bhepp |
0:28183cc7963f
|
185
|
|
bhepp |
0:28183cc7963f
|
186
|
#endif
|
bhepp |
0:28183cc7963f
|
187
|
|
bhepp |
0:28183cc7963f
|
188
|
// MESSAGE STATUSTEXT UNPACKING
|
bhepp |
0:28183cc7963f
|
189
|
|
bhepp |
0:28183cc7963f
|
190
|
|
bhepp |
0:28183cc7963f
|
191
|
/**
|
bhepp |
0:28183cc7963f
|
192
|
* @brief Get field severity from statustext message
|
bhepp |
0:28183cc7963f
|
193
|
*
|
bhepp |
0:28183cc7963f
|
194
|
* @return Severity of status. Relies on the definitions within RFC-5424. See enum MAV_SEVERITY.
|
bhepp |
0:28183cc7963f
|
195
|
*/
|
bhepp |
0:28183cc7963f
|
196
|
static inline uint8_t mavlink_msg_statustext_get_severity(const mavlink_message_t* msg)
|
bhepp |
0:28183cc7963f
|
197
|
{
|
bhepp |
0:28183cc7963f
|
198
|
return _MAV_RETURN_uint8_t(msg, 0);
|
bhepp |
0:28183cc7963f
|
199
|
}
|
bhepp |
0:28183cc7963f
|
200
|
|
bhepp |
0:28183cc7963f
|
201
|
/**
|
bhepp |
0:28183cc7963f
|
202
|
* @brief Get field text from statustext message
|
bhepp |
0:28183cc7963f
|
203
|
*
|
bhepp |
0:28183cc7963f
|
204
|
* @return Status text message, without null termination character
|
bhepp |
0:28183cc7963f
|
205
|
*/
|
bhepp |
0:28183cc7963f
|
206
|
static inline uint16_t mavlink_msg_statustext_get_text(const mavlink_message_t* msg, char *text)
|
bhepp |
0:28183cc7963f
|
207
|
{
|
bhepp |
0:28183cc7963f
|
208
|
return _MAV_RETURN_char_array(msg, text, 50, 1);
|
bhepp |
0:28183cc7963f
|
209
|
}
|
bhepp |
0:28183cc7963f
|
210
|
|
bhepp |
0:28183cc7963f
|
211
|
/**
|
bhepp |
0:28183cc7963f
|
212
|
* @brief Decode a statustext message into a struct
|
bhepp |
0:28183cc7963f
|
213
|
*
|
bhepp |
0:28183cc7963f
|
214
|
* @param msg The message to decode
|
bhepp |
0:28183cc7963f
|
215
|
* @param statustext C-struct to decode the message contents into
|
bhepp |
0:28183cc7963f
|
216
|
*/
|
bhepp |
0:28183cc7963f
|
217
|
static inline void mavlink_msg_statustext_decode(const mavlink_message_t* msg, mavlink_statustext_t* statustext)
|
bhepp |
0:28183cc7963f
|
218
|
{
|
bhepp |
0:28183cc7963f
|
219
|
#if MAVLINK_NEED_BYTE_SWAP
|
bhepp |
0:28183cc7963f
|
220
|
statustext->severity = mavlink_msg_statustext_get_severity(msg);
|
bhepp |
0:28183cc7963f
|
221
|
mavlink_msg_statustext_get_text(msg, statustext->text);
|
bhepp |
0:28183cc7963f
|
222
|
#else
|
bhepp |
0:28183cc7963f
|
223
|
memcpy(statustext, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_STATUSTEXT_LEN);
|
bhepp |
0:28183cc7963f
|
224
|
#endif
|
bhepp |
0:28183cc7963f
|
225
|
}
|