4#define MAVLINK_MSG_ID_CAN_FRAME 386
16#define MAVLINK_MSG_ID_CAN_FRAME_LEN 16
17#define MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN 16
18#define MAVLINK_MSG_ID_386_LEN 16
19#define MAVLINK_MSG_ID_386_MIN_LEN 16
21#define MAVLINK_MSG_ID_CAN_FRAME_CRC 132
22#define MAVLINK_MSG_ID_386_CRC 132
24#define MAVLINK_MSG_CAN_FRAME_FIELD_DATA_LEN 8
26#if MAVLINK_COMMAND_24BIT
27#define MAVLINK_MESSAGE_INFO_CAN_FRAME {
31 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0
, 4
, offsetof(mavlink_can_frame_t, target_system) },
32 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0
, 5
, offsetof(mavlink_can_frame_t, target_component) },
33 { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0
, 6
, offsetof(mavlink_can_frame_t, bus) },
34 { "len", NULL, MAVLINK_TYPE_UINT8_T, 0
, 7
, offsetof(mavlink_can_frame_t, len) },
35 { "id", NULL, MAVLINK_TYPE_UINT32_T, 0
, 0
, offsetof(mavlink_can_frame_t, id) },
36 { "data", NULL, MAVLINK_TYPE_UINT8_T, 8
, 8
, offsetof(mavlink_can_frame_t, data) },
38}
40#define MAVLINK_MESSAGE_INFO_CAN_FRAME {
43 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0
, 4
, offsetof(mavlink_can_frame_t, target_system) },
44 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0
, 5
, offsetof(mavlink_can_frame_t, target_component) },
45 { "bus", NULL, MAVLINK_TYPE_UINT8_T, 0
, 6
, offsetof(mavlink_can_frame_t, bus) },
46 { "len", NULL, MAVLINK_TYPE_UINT8_T, 0
, 7
, offsetof(mavlink_can_frame_t, len) },
47 { "id", NULL, MAVLINK_TYPE_UINT32_T, 0
, 0
, offsetof(mavlink_can_frame_t, id) },
48 { "data", NULL, MAVLINK_TYPE_UINT8_T, 8
, 8
, offsetof(mavlink_can_frame_t, data) },
50}
54
55
56
57
58
59
60
61
62
63
64
65
66
67static inline uint16_t mavlink_msg_can_frame_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 len, uint32_t id,
const uint8_t *data)
70#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
72 _mav_put_uint32_t(buf, 0, id);
73 _mav_put_uint8_t(buf, 4, target_system);
74 _mav_put_uint8_t(buf, 5, target_component);
75 _mav_put_uint8_t(buf, 6, bus);
76 _mav_put_uint8_t(buf, 7, len);
77 _mav_put_uint8_t_array(buf, 8, data, 8);
80 mavlink_can_frame_t packet;
82 packet.target_system = target_system;
83 packet.target_component = target_component;
86 mav_array_memcpy(packet.data, data,
sizeof(uint8_t)*8);
87 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAN_FRAME_LEN);
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109static inline uint16_t mavlink_msg_can_frame_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 len, uint32_t id,
const uint8_t *data)
112#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
114 _mav_put_uint32_t(buf, 0, id);
115 _mav_put_uint8_t(buf, 4, target_system);
116 _mav_put_uint8_t(buf, 5, target_component);
117 _mav_put_uint8_t(buf, 6, bus);
118 _mav_put_uint8_t(buf, 7, len);
119 _mav_put_uint8_t_array(buf, 8, data, 8);
122 mavlink_can_frame_t packet;
124 packet.target_system = target_system;
125 packet.target_component = target_component;
128 mav_array_memcpy(packet.data, data,
sizeof(uint8_t)*8);
129 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAN_FRAME_LEN);
134 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC);
141
142
143
144
145
146
147
148
149
150
151
152
153
154static inline uint16_t mavlink_msg_can_frame_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 len,uint32_t id,
const uint8_t *data)
158#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
160 _mav_put_uint32_t(buf, 0, id);
161 _mav_put_uint8_t(buf, 4, target_system);
162 _mav_put_uint8_t(buf, 5, target_component);
163 _mav_put_uint8_t(buf, 6, bus);
164 _mav_put_uint8_t(buf, 7, len);
165 _mav_put_uint8_t_array(buf, 8, data, 8);
168 mavlink_can_frame_t packet;
170 packet.target_system = target_system;
171 packet.target_component = target_component;
174 mav_array_memcpy(packet.data, data,
sizeof(uint8_t)*8);
175 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAN_FRAME_LEN);
183
184
185
186
187
188
189
190static inline uint16_t mavlink_msg_can_frame_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
const mavlink_can_frame_t* can_frame)
192 return mavlink_msg_can_frame_pack(system_id, component_id, msg, can_frame->target_system, can_frame->target_component, can_frame->bus, can_frame->len, can_frame->id, can_frame->data);
196
197
198
199
200
201
202
203
204static inline uint16_t mavlink_msg_can_frame_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg,
const mavlink_can_frame_t* can_frame)
206 return mavlink_msg_can_frame_pack_chan(system_id, component_id, chan, msg, can_frame->target_system, can_frame->target_component, can_frame->bus, can_frame->len, can_frame->id, can_frame->data);
210
211
212
213
214
215
216
217
218static inline uint16_t mavlink_msg_can_frame_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg,
const mavlink_can_frame_t* can_frame)
220 return mavlink_msg_can_frame_pack_status(system_id, component_id, _status, msg, can_frame->target_system, can_frame->target_component, can_frame->bus, can_frame->len, can_frame->id, can_frame->data);
224
225
226
227
228
229
230
231
232
233
234#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
236static inline void mavlink_msg_can_frame_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t len, uint32_t id,
const uint8_t *data)
238#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
239 char buf[MAVLINK_MSG_ID_CAN_FRAME_LEN];
240 _mav_put_uint32_t(buf, 0, id);
241 _mav_put_uint8_t(buf, 4, target_system);
242 _mav_put_uint8_t(buf, 5, target_component);
243 _mav_put_uint8_t(buf, 6, bus);
244 _mav_put_uint8_t(buf, 7, len);
245 _mav_put_uint8_t_array(buf, 8, data, 8);
246 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FRAME, buf, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC);
248 mavlink_can_frame_t packet;
250 packet.target_system = target_system;
251 packet.target_component = target_component;
254 mav_array_memcpy(packet.data, data,
sizeof(uint8_t)*8);
255 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FRAME, (
const char *)&packet, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC);
260
261
262
263
264static inline void mavlink_msg_can_frame_send_struct(mavlink_channel_t chan,
const mavlink_can_frame_t* can_frame)
266#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
267 mavlink_msg_can_frame_send(chan, can_frame->target_system, can_frame->target_component, can_frame->bus, can_frame->len, can_frame->id, can_frame->data);
269 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FRAME, (
const char *)can_frame, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC);
273#if MAVLINK_MSG_ID_CAN_FRAME_LEN <= MAVLINK_MAX_PAYLOAD_LEN
275
276
277
278
279
280
281static inline void mavlink_msg_can_frame_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t bus, uint8_t len, uint32_t id,
const uint8_t *data)
283#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
284 char *buf = (
char *)msgbuf;
285 _mav_put_uint32_t(buf, 0, id);
286 _mav_put_uint8_t(buf, 4, target_system);
287 _mav_put_uint8_t(buf, 5, target_component);
288 _mav_put_uint8_t(buf, 6, bus);
289 _mav_put_uint8_t(buf, 7, len);
290 _mav_put_uint8_t_array(buf, 8, data, 8);
291 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FRAME, buf, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC);
293 mavlink_can_frame_t *packet = (mavlink_can_frame_t *)msgbuf;
295 packet->target_system = target_system;
296 packet->target_component = target_component;
299 mav_array_memcpy(packet->data, data,
sizeof(uint8_t)*8);
300 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAN_FRAME, (
const char *)packet, MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN, MAVLINK_MSG_ID_CAN_FRAME_LEN, MAVLINK_MSG_ID_CAN_FRAME_CRC);
311
312
313
314
315static inline uint8_t mavlink_msg_can_frame_get_target_system(
const mavlink_message_t* msg)
317 return _MAV_RETURN_uint8_t(msg, 4);
321
322
323
324
325static inline uint8_t mavlink_msg_can_frame_get_target_component(
const mavlink_message_t* msg)
327 return _MAV_RETURN_uint8_t(msg, 5);
331
332
333
334
335static inline uint8_t mavlink_msg_can_frame_get_bus(
const mavlink_message_t* msg)
337 return _MAV_RETURN_uint8_t(msg, 6);
341
342
343
344
345static inline uint8_t mavlink_msg_can_frame_get_len(
const mavlink_message_t* msg)
347 return _MAV_RETURN_uint8_t(msg, 7);
351
352
353
354
355static inline uint32_t mavlink_msg_can_frame_get_id(
const mavlink_message_t* msg)
357 return _MAV_RETURN_uint32_t(msg, 0);
361
362
363
364
365static inline uint16_t mavlink_msg_can_frame_get_data(
const mavlink_message_t* msg, uint8_t *data)
367 return _MAV_RETURN_uint8_t_array(msg, data, 8, 8);
371
372
373
374
375
376static inline void mavlink_msg_can_frame_decode(
const mavlink_message_t* msg, mavlink_can_frame_t* can_frame)
378#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
379 can_frame->id = mavlink_msg_can_frame_get_id(msg);
380 can_frame->target_system = mavlink_msg_can_frame_get_target_system(msg);
381 can_frame->target_component = mavlink_msg_can_frame_get_target_component(msg);
382 can_frame->bus = mavlink_msg_can_frame_get_bus(msg);
383 can_frame->len = mavlink_msg_can_frame_get_len(msg);
384 mavlink_msg_can_frame_get_data(msg, can_frame->data);
386 uint8_t len = msg->len < MAVLINK_MSG_ID_CAN_FRAME_LEN? msg->len : MAVLINK_MSG_ID_CAN_FRAME_LEN;
387 memset(can_frame, 0, MAVLINK_MSG_ID_CAN_FRAME_LEN);
388 memcpy(can_frame, _MAV_PAYLOAD(msg), len);
#define MAVLINK_MSG_ID_CAN_FRAME_LEN
Definition: mavlink_msg_can_frame.h:16
#define MAVLINK_MSG_ID_CAN_FRAME_CRC
Definition: mavlink_msg_can_frame.h:21
#define MAVLINK_MSG_ID_CAN_FRAME
Definition: mavlink_msg_can_frame.h:4
#define MAVLINK_MSG_ID_CAN_FRAME_MIN_LEN
Definition: mavlink_msg_can_frame.h:17
Definition: mavlink_msg_can_frame.h:7
uint8_t target_component
Definition: mavlink_msg_can_frame.h:10
uint8_t bus
Definition: mavlink_msg_can_frame.h:11
uint8_t len
Definition: mavlink_msg_can_frame.h:12
uint32_t id
Definition: mavlink_msg_can_frame.h:8
uint8_t target_system
Definition: mavlink_msg_can_frame.h:9