Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_current_event_sequence.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE CURRENT_EVENT_SEQUENCE PACKING
3
4#define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE 411
5
6
8 uint16_t sequence; /*< Sequence number.*/
9 uint8_t flags; /*< Flag bitset.*/
10} mavlink_current_event_sequence_t;
11
12#define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN 3
13#define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN 3
14#define MAVLINK_MSG_ID_411_LEN 3
15#define MAVLINK_MSG_ID_411_MIN_LEN 3
16
17#define MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC 106
18#define MAVLINK_MSG_ID_411_CRC 106
19
20
21
22#if MAVLINK_COMMAND_24BIT
23#define MAVLINK_MESSAGE_INFO_CURRENT_EVENT_SEQUENCE {
24 411,
25 "CURRENT_EVENT_SEQUENCE",
26 2,
27 { { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_current_event_sequence_t, sequence) },
28 { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_current_event_sequence_t, flags) },
29 } \
30}
31#else
32#define MAVLINK_MESSAGE_INFO_CURRENT_EVENT_SEQUENCE {
33 "CURRENT_EVENT_SEQUENCE",
34 2,
35 { { "sequence", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_current_event_sequence_t, sequence) },
36 { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_current_event_sequence_t, flags) },
37 } \
38}
39#endif
40
41/**
42 * @brief Pack a current_event_sequence message
43 * @param system_id ID of this system
44 * @param component_id ID of this component (e.g. 200 for IMU)
45 * @param msg The MAVLink message to compress the data into
46 *
47 * @param sequence Sequence number.
48 * @param flags Flag bitset.
49 * @return length of the message in bytes (excluding serial stream start sign)
50 */
51MAVLINK_WIP
52static inline uint16_t mavlink_msg_current_event_sequence_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
53 uint16_t sequence, uint8_t flags)
54{
55#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
57 _mav_put_uint16_t(buf, 0, sequence);
58 _mav_put_uint8_t(buf, 2, flags);
59
60 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
61#else
62 mavlink_current_event_sequence_t packet;
63 packet.sequence = sequence;
64 packet.flags = flags;
65
66 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
67#endif
68
71}
72
73/**
74 * @brief Pack a current_event_sequence message
75 * @param system_id ID of this system
76 * @param component_id ID of this component (e.g. 200 for IMU)
77 * @param status MAVLink status structure
78 * @param msg The MAVLink message to compress the data into
79 *
80 * @param sequence Sequence number.
81 * @param flags Flag bitset.
82 * @return length of the message in bytes (excluding serial stream start sign)
83 */
84static inline uint16_t mavlink_msg_current_event_sequence_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
85 uint16_t sequence, uint8_t flags)
86{
87#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
89 _mav_put_uint16_t(buf, 0, sequence);
90 _mav_put_uint8_t(buf, 2, flags);
91
92 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
93#else
94 mavlink_current_event_sequence_t packet;
95 packet.sequence = sequence;
96 packet.flags = flags;
97
98 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
99#endif
100
102#if MAVLINK_CRC_EXTRA
103 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
104#else
105 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
106#endif
107}
108
109/**
110 * @brief Pack a current_event_sequence message on a channel
111 * @param system_id ID of this system
112 * @param component_id ID of this component (e.g. 200 for IMU)
113 * @param chan The MAVLink channel this message will be sent over
114 * @param msg The MAVLink message to compress the data into
115 * @param sequence Sequence number.
116 * @param flags Flag bitset.
117 * @return length of the message in bytes (excluding serial stream start sign)
118 */
119MAVLINK_WIP
120static inline uint16_t mavlink_msg_current_event_sequence_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
121 mavlink_message_t* msg,
122 uint16_t sequence,uint8_t flags)
123{
124#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
126 _mav_put_uint16_t(buf, 0, sequence);
127 _mav_put_uint8_t(buf, 2, flags);
128
129 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
130#else
131 mavlink_current_event_sequence_t packet;
132 packet.sequence = sequence;
133 packet.flags = flags;
134
135 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
136#endif
137
140}
141
142/**
143 * @brief Encode a current_event_sequence struct
144 *
145 * @param system_id ID of this system
146 * @param component_id ID of this component (e.g. 200 for IMU)
147 * @param msg The MAVLink message to compress the data into
148 * @param current_event_sequence C-struct to read the message contents from
149 */
150MAVLINK_WIP
151static inline uint16_t mavlink_msg_current_event_sequence_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_current_event_sequence_t* current_event_sequence)
152{
153 return mavlink_msg_current_event_sequence_pack(system_id, component_id, msg, current_event_sequence->sequence, current_event_sequence->flags);
154}
155
156/**
157 * @brief Encode a current_event_sequence struct on a channel
158 *
159 * @param system_id ID of this system
160 * @param component_id ID of this component (e.g. 200 for IMU)
161 * @param chan The MAVLink channel this message will be sent over
162 * @param msg The MAVLink message to compress the data into
163 * @param current_event_sequence C-struct to read the message contents from
164 */
165MAVLINK_WIP
166static inline uint16_t mavlink_msg_current_event_sequence_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_current_event_sequence_t* current_event_sequence)
167{
168 return mavlink_msg_current_event_sequence_pack_chan(system_id, component_id, chan, msg, current_event_sequence->sequence, current_event_sequence->flags);
169}
170
171/**
172 * @brief Encode a current_event_sequence struct with provided status structure
173 *
174 * @param system_id ID of this system
175 * @param component_id ID of this component (e.g. 200 for IMU)
176 * @param status MAVLink status structure
177 * @param msg The MAVLink message to compress the data into
178 * @param current_event_sequence C-struct to read the message contents from
179 */
180static inline uint16_t mavlink_msg_current_event_sequence_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_current_event_sequence_t* current_event_sequence)
181{
182 return mavlink_msg_current_event_sequence_pack_status(system_id, component_id, _status, msg, current_event_sequence->sequence, current_event_sequence->flags);
183}
184
185/**
186 * @brief Send a current_event_sequence message
187 * @param chan MAVLink channel to send the message
188 *
189 * @param sequence Sequence number.
190 * @param flags Flag bitset.
191 */
192#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
193
194MAVLINK_WIP
195static inline void mavlink_msg_current_event_sequence_send(mavlink_channel_t chan, uint16_t sequence, uint8_t flags)
196{
197#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
198 char buf[MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN];
199 _mav_put_uint16_t(buf, 0, sequence);
200 _mav_put_uint8_t(buf, 2, flags);
201
202 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
203#else
204 mavlink_current_event_sequence_t packet;
205 packet.sequence = sequence;
206 packet.flags = flags;
207
208 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, (const char *)&packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
209#endif
210}
211
212/**
213 * @brief Send a current_event_sequence message
214 * @param chan MAVLink channel to send the message
215 * @param struct The MAVLink struct to serialize
216 */
217MAVLINK_WIP
218static inline void mavlink_msg_current_event_sequence_send_struct(mavlink_channel_t chan, const mavlink_current_event_sequence_t* current_event_sequence)
219{
220#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
221 mavlink_msg_current_event_sequence_send(chan, current_event_sequence->sequence, current_event_sequence->flags);
222#else
223 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, (const char *)current_event_sequence, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
224#endif
225}
226
227#if MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
228/*
229 This variant of _send() can be used to save stack space by reusing
230 memory from the receive buffer. The caller provides a
231 mavlink_message_t which is the size of a full mavlink message. This
232 is usually the receive buffer for the channel, and allows a reply to an
233 incoming message with minimum stack space usage.
234 */
235MAVLINK_WIP
236static inline void mavlink_msg_current_event_sequence_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t sequence, uint8_t flags)
237{
238#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
239 char *buf = (char *)msgbuf;
240 _mav_put_uint16_t(buf, 0, sequence);
241 _mav_put_uint8_t(buf, 2, flags);
242
243 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, buf, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
244#else
245 mavlink_current_event_sequence_t *packet = (mavlink_current_event_sequence_t *)msgbuf;
246 packet->sequence = sequence;
247 packet->flags = flags;
248
249 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE, (const char *)packet, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_MIN_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_CRC);
250#endif
251}
252#endif
253
254#endif
255
256// MESSAGE CURRENT_EVENT_SEQUENCE UNPACKING
257
258
259/**
260 * @brief Get field sequence from current_event_sequence message
261 *
262 * @return Sequence number.
263 */
264MAVLINK_WIP
265static inline uint16_t mavlink_msg_current_event_sequence_get_sequence(const mavlink_message_t* msg)
266{
267 return _MAV_RETURN_uint16_t(msg, 0);
268}
269
270/**
271 * @brief Get field flags from current_event_sequence message
272 *
273 * @return Flag bitset.
274 */
275MAVLINK_WIP
276static inline uint8_t mavlink_msg_current_event_sequence_get_flags(const mavlink_message_t* msg)
277{
278 return _MAV_RETURN_uint8_t(msg, 2);
279}
280
281/**
282 * @brief Decode a current_event_sequence message into a struct
283 *
284 * @param msg The message to decode
285 * @param current_event_sequence C-struct to decode the message contents into
286 */
287MAVLINK_WIP
288static inline void mavlink_msg_current_event_sequence_decode(const mavlink_message_t* msg, mavlink_current_event_sequence_t* current_event_sequence)
289{
290#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
291 current_event_sequence->sequence = mavlink_msg_current_event_sequence_get_sequence(msg);
292 current_event_sequence->flags = mavlink_msg_current_event_sequence_get_flags(msg);
293#else
294 uint8_t len = msg->len < MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN? msg->len : MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN;
295 memset(current_event_sequence, 0, MAVLINK_MSG_ID_CURRENT_EVENT_SEQUENCE_LEN);
296 memcpy(current_event_sequence, _MAV_PAYLOAD(msg), len);
297#endif
298}