mavlink_msg_encapsulated_data.h
Go to the documentation of this file.
1 // MESSAGE ENCAPSULATED_DATA PACKING
2 
3 #define MAVLINK_MSG_ID_ENCAPSULATED_DATA 131
4 
6 {
7  uint16_t seqnr; /*< sequence number (starting with 0 on every transmission)*/
8  uint8_t data[253]; /*< image data bytes*/
10 
11 #define MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN 255
12 #define MAVLINK_MSG_ID_131_LEN 255
13 
14 #define MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC 223
15 #define MAVLINK_MSG_ID_131_CRC 223
16 
17 #define MAVLINK_MSG_ENCAPSULATED_DATA_FIELD_DATA_LEN 253
18 
19 #define MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA { \
20  "ENCAPSULATED_DATA", \
21  2, \
22  { { "seqnr", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_encapsulated_data_t, seqnr) }, \
23  { "data", NULL, MAVLINK_TYPE_UINT8_T, 253, 2, offsetof(mavlink_encapsulated_data_t, data) }, \
24  } \
25 }
26 
27 
38 static inline uint16_t mavlink_msg_encapsulated_data_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
39  uint16_t seqnr, const uint8_t *data)
40 {
41 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
43  _mav_put_uint16_t(buf, 0, seqnr);
44  _mav_put_uint8_t_array(buf, 2, data, 253);
46 #else
48  packet.seqnr = seqnr;
49  mav_array_memcpy(packet.data, data, sizeof(uint8_t)*253);
51 #endif
52 
54 #if MAVLINK_CRC_EXTRA
56 #else
57  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
58 #endif
59 }
60 
71 static inline uint16_t mavlink_msg_encapsulated_data_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
72  mavlink_message_t* msg,
73  uint16_t seqnr,const uint8_t *data)
74 {
75 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
77  _mav_put_uint16_t(buf, 0, seqnr);
78  _mav_put_uint8_t_array(buf, 2, data, 253);
80 #else
82  packet.seqnr = seqnr;
83  mav_array_memcpy(packet.data, data, sizeof(uint8_t)*253);
85 #endif
86 
88 #if MAVLINK_CRC_EXTRA
90 #else
91  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
92 #endif
93 }
94 
103 static inline uint16_t mavlink_msg_encapsulated_data_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_encapsulated_data_t* encapsulated_data)
104 {
105  return mavlink_msg_encapsulated_data_pack(system_id, component_id, msg, encapsulated_data->seqnr, encapsulated_data->data);
106 }
107 
117 static inline uint16_t mavlink_msg_encapsulated_data_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_encapsulated_data_t* encapsulated_data)
118 {
119  return mavlink_msg_encapsulated_data_pack_chan(system_id, component_id, chan, msg, encapsulated_data->seqnr, encapsulated_data->data);
120 }
121 
129 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
130 
131 static inline void mavlink_msg_encapsulated_data_send(mavlink_channel_t chan, uint16_t seqnr, const uint8_t *data)
132 {
133 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
135  _mav_put_uint16_t(buf, 0, seqnr);
136  _mav_put_uint8_t_array(buf, 2, data, 253);
137 #if MAVLINK_CRC_EXTRA
139 #else
140  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, buf, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
141 #endif
142 #else
144  packet.seqnr = seqnr;
145  mav_array_memcpy(packet.data, data, sizeof(uint8_t)*253);
146 #if MAVLINK_CRC_EXTRA
147  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, (const char *)&packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC);
148 #else
149  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, (const char *)&packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
150 #endif
151 #endif
152 }
153 
154 #if MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
155 /*
156  This varient of _send() can be used to save stack space by re-using
157  memory from the receive buffer. The caller provides a
158  mavlink_message_t which is the size of a full mavlink message. This
159  is usually the receive buffer for the channel, and allows a reply to an
160  incoming message with minimum stack space usage.
161  */
162 static inline void mavlink_msg_encapsulated_data_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t seqnr, const uint8_t *data)
163 {
164 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165  char *buf = (char *)msgbuf;
166  _mav_put_uint16_t(buf, 0, seqnr);
167  _mav_put_uint8_t_array(buf, 2, data, 253);
168 #if MAVLINK_CRC_EXTRA
170 #else
171  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, buf, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
172 #endif
173 #else
175  packet->seqnr = seqnr;
176  mav_array_memcpy(packet->data, data, sizeof(uint8_t)*253);
177 #if MAVLINK_CRC_EXTRA
178  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, (const char *)packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN, MAVLINK_MSG_ID_ENCAPSULATED_DATA_CRC);
179 #else
180  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ENCAPSULATED_DATA, (const char *)packet, MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
181 #endif
182 #endif
183 }
184 #endif
185 
186 #endif
187 
188 // MESSAGE ENCAPSULATED_DATA UNPACKING
189 
190 
196 static inline uint16_t mavlink_msg_encapsulated_data_get_seqnr(const mavlink_message_t* msg)
197 {
198  return _MAV_RETURN_uint16_t(msg, 0);
199 }
200 
206 static inline uint16_t mavlink_msg_encapsulated_data_get_data(const mavlink_message_t* msg, uint8_t *data)
207 {
208  return _MAV_RETURN_uint8_t_array(msg, data, 253, 2);
209 }
210 
217 static inline void mavlink_msg_encapsulated_data_decode(const mavlink_message_t* msg, mavlink_encapsulated_data_t* encapsulated_data)
218 {
219 #if MAVLINK_NEED_BYTE_SWAP
220  encapsulated_data->seqnr = mavlink_msg_encapsulated_data_get_seqnr(msg);
221  mavlink_msg_encapsulated_data_get_data(msg, encapsulated_data->data);
222 #else
223  memcpy(encapsulated_data, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ENCAPSULATED_DATA_LEN);
224 #endif
225 }
static void _mav_put_uint8_t_array(char *buf, uint8_t wire_offset, const uint8_t *b, uint8_t array_length)
Definition: protocol.h:197
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176
static uint16_t _MAV_RETURN_uint8_t_array(const mavlink_message_t *msg, uint8_t *value, uint8_t array_length, uint8_t wire_offset)
Definition: protocol.h:295
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145


rosflight
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 20:00:12