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