Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_response_event_error.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE RESPONSE_EVENT_ERROR PACKING
3
4#define MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR 413
5
6
8 uint16_t sequence; /*< Sequence number.*/
9 uint16_t sequence_oldest_available; /*< Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT.*/
10 uint8_t target_system; /*< System ID*/
11 uint8_t target_component; /*< Component ID*/
12 uint8_t reason; /*< Error reason.*/
13} mavlink_response_event_error_t;
14
15#define MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN 7
16#define MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN 7
17#define MAVLINK_MSG_ID_413_LEN 7
18#define MAVLINK_MSG_ID_413_MIN_LEN 7
19
20#define MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC 77
21#define MAVLINK_MSG_ID_413_CRC 77
22
23
24
25#if MAVLINK_COMMAND_24BIT
26#define MAVLINK_MESSAGE_INFO_RESPONSE_EVENT_ERROR {
27 413,
28 "RESPONSE_EVENT_ERROR",
29 5,
30 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_response_event_error_t, target_system) },
31 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_response_event_error_t, target_component) },
32 { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_response_event_error_t, sequence) },
33 { "sequence_oldest_available", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_response_event_error_t, sequence_oldest_available) },
34 { "reason", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_response_event_error_t, reason) },
35 } \
36}
37#else
38#define MAVLINK_MESSAGE_INFO_RESPONSE_EVENT_ERROR {
39 "RESPONSE_EVENT_ERROR",
40 5,
41 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_response_event_error_t, target_system) },
42 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_response_event_error_t, target_component) },
43 { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_response_event_error_t, sequence) },
44 { "sequence_oldest_available", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_response_event_error_t, sequence_oldest_available) },
45 { "reason", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_response_event_error_t, reason) },
46 } \
47}
48#endif
49
50/**
51 * @brief Pack a response_event_error message
52 * @param system_id ID of this system
53 * @param component_id ID of this component (e.g. 200 for IMU)
54 * @param msg The MAVLink message to compress the data into
55 *
56 * @param target_system System ID
57 * @param target_component Component ID
58 * @param sequence Sequence number.
59 * @param sequence_oldest_available Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT.
60 * @param reason Error reason.
61 * @return length of the message in bytes (excluding serial stream start sign)
62 */
63MAVLINK_WIP
64static inline uint16_t mavlink_msg_response_event_error_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
65 uint8_t target_system, uint8_t target_component, uint16_t sequence, uint16_t sequence_oldest_available, uint8_t reason)
66{
67#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
69 _mav_put_uint16_t(buf, 0, sequence);
70 _mav_put_uint16_t(buf, 2, sequence_oldest_available);
71 _mav_put_uint8_t(buf, 4, target_system);
72 _mav_put_uint8_t(buf, 5, target_component);
73 _mav_put_uint8_t(buf, 6, reason);
74
75 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN);
76#else
77 mavlink_response_event_error_t packet;
78 packet.sequence = sequence;
79 packet.sequence_oldest_available = sequence_oldest_available;
80 packet.target_system = target_system;
81 packet.target_component = target_component;
82 packet.reason = reason;
83
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN);
85#endif
86
89}
90
91/**
92 * @brief Pack a response_event_error message
93 * @param system_id ID of this system
94 * @param component_id ID of this component (e.g. 200 for IMU)
95 * @param status MAVLink status structure
96 * @param msg The MAVLink message to compress the data into
97 *
98 * @param target_system System ID
99 * @param target_component Component ID
100 * @param sequence Sequence number.
101 * @param sequence_oldest_available Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT.
102 * @param reason Error reason.
103 * @return length of the message in bytes (excluding serial stream start sign)
104 */
105static inline uint16_t mavlink_msg_response_event_error_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
106 uint8_t target_system, uint8_t target_component, uint16_t sequence, uint16_t sequence_oldest_available, uint8_t reason)
107{
108#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
110 _mav_put_uint16_t(buf, 0, sequence);
111 _mav_put_uint16_t(buf, 2, sequence_oldest_available);
112 _mav_put_uint8_t(buf, 4, target_system);
113 _mav_put_uint8_t(buf, 5, target_component);
114 _mav_put_uint8_t(buf, 6, reason);
115
116 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN);
117#else
118 mavlink_response_event_error_t packet;
119 packet.sequence = sequence;
120 packet.sequence_oldest_available = sequence_oldest_available;
121 packet.target_system = target_system;
122 packet.target_component = target_component;
123 packet.reason = reason;
124
125 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN);
126#endif
127
129#if MAVLINK_CRC_EXTRA
130 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC);
131#else
132 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN);
133#endif
134}
135
136/**
137 * @brief Pack a response_event_error message on a channel
138 * @param system_id ID of this system
139 * @param component_id ID of this component (e.g. 200 for IMU)
140 * @param chan The MAVLink channel this message will be sent over
141 * @param msg The MAVLink message to compress the data into
142 * @param target_system System ID
143 * @param target_component Component ID
144 * @param sequence Sequence number.
145 * @param sequence_oldest_available Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT.
146 * @param reason Error reason.
147 * @return length of the message in bytes (excluding serial stream start sign)
148 */
149MAVLINK_WIP
150static inline uint16_t mavlink_msg_response_event_error_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
151 mavlink_message_t* msg,
152 uint8_t target_system,uint8_t target_component,uint16_t sequence,uint16_t sequence_oldest_available,uint8_t reason)
153{
154#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
156 _mav_put_uint16_t(buf, 0, sequence);
157 _mav_put_uint16_t(buf, 2, sequence_oldest_available);
158 _mav_put_uint8_t(buf, 4, target_system);
159 _mav_put_uint8_t(buf, 5, target_component);
160 _mav_put_uint8_t(buf, 6, reason);
161
162 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN);
163#else
164 mavlink_response_event_error_t packet;
165 packet.sequence = sequence;
166 packet.sequence_oldest_available = sequence_oldest_available;
167 packet.target_system = target_system;
168 packet.target_component = target_component;
169 packet.reason = reason;
170
171 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN);
172#endif
173
175 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC);
176}
177
178/**
179 * @brief Encode a response_event_error struct
180 *
181 * @param system_id ID of this system
182 * @param component_id ID of this component (e.g. 200 for IMU)
183 * @param msg The MAVLink message to compress the data into
184 * @param response_event_error C-struct to read the message contents from
185 */
186MAVLINK_WIP
187static inline uint16_t mavlink_msg_response_event_error_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_response_event_error_t* response_event_error)
188{
189 return mavlink_msg_response_event_error_pack(system_id, component_id, msg, response_event_error->target_system, response_event_error->target_component, response_event_error->sequence, response_event_error->sequence_oldest_available, response_event_error->reason);
190}
191
192/**
193 * @brief Encode a response_event_error struct on a channel
194 *
195 * @param system_id ID of this system
196 * @param component_id ID of this component (e.g. 200 for IMU)
197 * @param chan The MAVLink channel this message will be sent over
198 * @param msg The MAVLink message to compress the data into
199 * @param response_event_error C-struct to read the message contents from
200 */
201MAVLINK_WIP
202static inline uint16_t mavlink_msg_response_event_error_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_response_event_error_t* response_event_error)
203{
204 return mavlink_msg_response_event_error_pack_chan(system_id, component_id, chan, msg, response_event_error->target_system, response_event_error->target_component, response_event_error->sequence, response_event_error->sequence_oldest_available, response_event_error->reason);
205}
206
207/**
208 * @brief Encode a response_event_error struct with provided status structure
209 *
210 * @param system_id ID of this system
211 * @param component_id ID of this component (e.g. 200 for IMU)
212 * @param status MAVLink status structure
213 * @param msg The MAVLink message to compress the data into
214 * @param response_event_error C-struct to read the message contents from
215 */
216static inline uint16_t mavlink_msg_response_event_error_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_response_event_error_t* response_event_error)
217{
218 return mavlink_msg_response_event_error_pack_status(system_id, component_id, _status, msg, response_event_error->target_system, response_event_error->target_component, response_event_error->sequence, response_event_error->sequence_oldest_available, response_event_error->reason);
219}
220
221/**
222 * @brief Send a response_event_error message
223 * @param chan MAVLink channel to send the message
224 *
225 * @param target_system System ID
226 * @param target_component Component ID
227 * @param sequence Sequence number.
228 * @param sequence_oldest_available Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT.
229 * @param reason Error reason.
230 */
231#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
232
233MAVLINK_WIP
234static inline void mavlink_msg_response_event_error_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t sequence, uint16_t sequence_oldest_available, uint8_t reason)
235{
236#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
237 char buf[MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN];
238 _mav_put_uint16_t(buf, 0, sequence);
239 _mav_put_uint16_t(buf, 2, sequence_oldest_available);
240 _mav_put_uint8_t(buf, 4, target_system);
241 _mav_put_uint8_t(buf, 5, target_component);
242 _mav_put_uint8_t(buf, 6, reason);
243
244 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR, buf, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC);
245#else
246 mavlink_response_event_error_t packet;
247 packet.sequence = sequence;
248 packet.sequence_oldest_available = sequence_oldest_available;
249 packet.target_system = target_system;
250 packet.target_component = target_component;
251 packet.reason = reason;
252
253 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR, (const char *)&packet, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC);
254#endif
255}
256
257/**
258 * @brief Send a response_event_error message
259 * @param chan MAVLink channel to send the message
260 * @param struct The MAVLink struct to serialize
261 */
262MAVLINK_WIP
263static inline void mavlink_msg_response_event_error_send_struct(mavlink_channel_t chan, const mavlink_response_event_error_t* response_event_error)
264{
265#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
266 mavlink_msg_response_event_error_send(chan, response_event_error->target_system, response_event_error->target_component, response_event_error->sequence, response_event_error->sequence_oldest_available, response_event_error->reason);
267#else
268 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR, (const char *)response_event_error, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC);
269#endif
270}
271
272#if MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN <= MAVLINK_MAX_PAYLOAD_LEN
273/*
274 This variant of _send() can be used to save stack space by reusing
275 memory from the receive buffer. The caller provides a
276 mavlink_message_t which is the size of a full mavlink message. This
277 is usually the receive buffer for the channel, and allows a reply to an
278 incoming message with minimum stack space usage.
279 */
280MAVLINK_WIP
281static inline void mavlink_msg_response_event_error_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t sequence, uint16_t sequence_oldest_available, uint8_t reason)
282{
283#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
284 char *buf = (char *)msgbuf;
285 _mav_put_uint16_t(buf, 0, sequence);
286 _mav_put_uint16_t(buf, 2, sequence_oldest_available);
287 _mav_put_uint8_t(buf, 4, target_system);
288 _mav_put_uint8_t(buf, 5, target_component);
289 _mav_put_uint8_t(buf, 6, reason);
290
291 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR, buf, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC);
292#else
293 mavlink_response_event_error_t *packet = (mavlink_response_event_error_t *)msgbuf;
294 packet->sequence = sequence;
295 packet->sequence_oldest_available = sequence_oldest_available;
296 packet->target_system = target_system;
297 packet->target_component = target_component;
298 packet->reason = reason;
299
300 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR, (const char *)packet, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_MIN_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_CRC);
301#endif
302}
303#endif
304
305#endif
306
307// MESSAGE RESPONSE_EVENT_ERROR UNPACKING
308
309
310/**
311 * @brief Get field target_system from response_event_error message
312 *
313 * @return System ID
314 */
315MAVLINK_WIP
316static inline uint8_t mavlink_msg_response_event_error_get_target_system(const mavlink_message_t* msg)
317{
318 return _MAV_RETURN_uint8_t(msg, 4);
319}
320
321/**
322 * @brief Get field target_component from response_event_error message
323 *
324 * @return Component ID
325 */
326MAVLINK_WIP
327static inline uint8_t mavlink_msg_response_event_error_get_target_component(const mavlink_message_t* msg)
328{
329 return _MAV_RETURN_uint8_t(msg, 5);
330}
331
332/**
333 * @brief Get field sequence from response_event_error message
334 *
335 * @return Sequence number.
336 */
337MAVLINK_WIP
338static inline uint16_t mavlink_msg_response_event_error_get_sequence(const mavlink_message_t* msg)
339{
340 return _MAV_RETURN_uint16_t(msg, 0);
341}
342
343/**
344 * @brief Get field sequence_oldest_available from response_event_error message
345 *
346 * @return Oldest Sequence number that is still available after the sequence set in REQUEST_EVENT.
347 */
348MAVLINK_WIP
349static inline uint16_t mavlink_msg_response_event_error_get_sequence_oldest_available(const mavlink_message_t* msg)
350{
351 return _MAV_RETURN_uint16_t(msg, 2);
352}
353
354/**
355 * @brief Get field reason from response_event_error message
356 *
357 * @return Error reason.
358 */
359MAVLINK_WIP
360static inline uint8_t mavlink_msg_response_event_error_get_reason(const mavlink_message_t* msg)
361{
362 return _MAV_RETURN_uint8_t(msg, 6);
363}
364
365/**
366 * @brief Decode a response_event_error message into a struct
367 *
368 * @param msg The message to decode
369 * @param response_event_error C-struct to decode the message contents into
370 */
371MAVLINK_WIP
372static inline void mavlink_msg_response_event_error_decode(const mavlink_message_t* msg, mavlink_response_event_error_t* response_event_error)
373{
374#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
375 response_event_error->sequence = mavlink_msg_response_event_error_get_sequence(msg);
376 response_event_error->sequence_oldest_available = mavlink_msg_response_event_error_get_sequence_oldest_available(msg);
377 response_event_error->target_system = mavlink_msg_response_event_error_get_target_system(msg);
378 response_event_error->target_component = mavlink_msg_response_event_error_get_target_component(msg);
379 response_event_error->reason = mavlink_msg_response_event_error_get_reason(msg);
380#else
381 uint8_t len = msg->len < MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN? msg->len : MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN;
382 memset(response_event_error, 0, MAVLINK_MSG_ID_RESPONSE_EVENT_ERROR_LEN);
383 memcpy(response_event_error, _MAV_PAYLOAD(msg), len);
384#endif
385}