NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_data96.h
Go to the documentation of this file.
1 // MESSAGE DATA96 PACKING
2 
3 #define MAVLINK_MSG_ID_DATA96 172
4 
5 typedef struct __mavlink_data96_t
6 {
7  uint8_t type;
8  uint8_t len;
9  uint8_t data[96];
11 
12 #define MAVLINK_MSG_ID_DATA96_LEN 98
13 #define MAVLINK_MSG_ID_172_LEN 98
14 
15 #define MAVLINK_MSG_ID_DATA96_CRC 22
16 #define MAVLINK_MSG_ID_172_CRC 22
17 
18 #define MAVLINK_MSG_DATA96_FIELD_DATA_LEN 96
19 
20 #define MAVLINK_MESSAGE_INFO_DATA96 { \
21  "DATA96", \
22  3, \
23  { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_data96_t, type) }, \
24  { "len", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_data96_t, len) }, \
25  { "data", NULL, MAVLINK_TYPE_UINT8_T, 96, 2, offsetof(mavlink_data96_t, data) }, \
26  } \
27 }
28 
29 
41 static inline uint16_t mavlink_msg_data96_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
42  uint8_t type, uint8_t len, const uint8_t *data)
43 {
44 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
45  char buf[MAVLINK_MSG_ID_DATA96_LEN];
46  _mav_put_uint8_t(buf, 0, type);
47  _mav_put_uint8_t(buf, 1, len);
48  _mav_put_uint8_t_array(buf, 2, data, 96);
50 #else
51  mavlink_data96_t packet;
52  packet.type = type;
53  packet.len = len;
54  mav_array_memcpy(packet.data, data, sizeof(uint8_t)*96);
56 #endif
57 
58  msg->msgid = MAVLINK_MSG_ID_DATA96;
59 #if MAVLINK_CRC_EXTRA
61 #else
62  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA96_LEN);
63 #endif
64 }
65 
77 static inline uint16_t mavlink_msg_data96_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
78  mavlink_message_t* msg,
79  uint8_t type,uint8_t len,const uint8_t *data)
80 {
81 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
82  char buf[MAVLINK_MSG_ID_DATA96_LEN];
83  _mav_put_uint8_t(buf, 0, type);
84  _mav_put_uint8_t(buf, 1, len);
85  _mav_put_uint8_t_array(buf, 2, data, 96);
87 #else
88  mavlink_data96_t packet;
89  packet.type = type;
90  packet.len = len;
91  mav_array_memcpy(packet.data, data, sizeof(uint8_t)*96);
93 #endif
94 
95  msg->msgid = MAVLINK_MSG_ID_DATA96;
96 #if MAVLINK_CRC_EXTRA
97  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC);
98 #else
99  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA96_LEN);
100 #endif
101 }
102 
111 static inline uint16_t mavlink_msg_data96_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_data96_t* data96)
112 {
113  return mavlink_msg_data96_pack(system_id, component_id, msg, data96->type, data96->len, data96->data);
114 }
115 
125 static inline uint16_t mavlink_msg_data96_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_data96_t* data96)
126 {
127  return mavlink_msg_data96_pack_chan(system_id, component_id, chan, msg, data96->type, data96->len, data96->data);
128 }
129 
138 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
139 
140 static inline void mavlink_msg_data96_send(mavlink_channel_t chan, uint8_t type, uint8_t len, const uint8_t *data)
141 {
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143  char buf[MAVLINK_MSG_ID_DATA96_LEN];
144  _mav_put_uint8_t(buf, 0, type);
145  _mav_put_uint8_t(buf, 1, len);
146  _mav_put_uint8_t_array(buf, 2, data, 96);
147 #if MAVLINK_CRC_EXTRA
148  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, buf, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC);
149 #else
150  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, buf, MAVLINK_MSG_ID_DATA96_LEN);
151 #endif
152 #else
153  mavlink_data96_t packet;
154  packet.type = type;
155  packet.len = len;
156  mav_array_memcpy(packet.data, data, sizeof(uint8_t)*96);
157 #if MAVLINK_CRC_EXTRA
158  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, (const char *)&packet, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC);
159 #else
160  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, (const char *)&packet, MAVLINK_MSG_ID_DATA96_LEN);
161 #endif
162 #endif
163 }
164 
165 #if MAVLINK_MSG_ID_DATA96_LEN <= MAVLINK_MAX_PAYLOAD_LEN
166 /*
167  This varient of _send() can be used to save stack space by re-using
168  memory from the receive buffer. The caller provides a
169  mavlink_message_t which is the size of a full mavlink message. This
170  is usually the receive buffer for the channel, and allows a reply to an
171  incoming message with minimum stack space usage.
172  */
173 static inline void mavlink_msg_data96_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t type, uint8_t len, const uint8_t *data)
174 {
175 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
176  char *buf = (char *)msgbuf;
177  _mav_put_uint8_t(buf, 0, type);
178  _mav_put_uint8_t(buf, 1, len);
179  _mav_put_uint8_t_array(buf, 2, data, 96);
180 #if MAVLINK_CRC_EXTRA
181  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, buf, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC);
182 #else
183  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, buf, MAVLINK_MSG_ID_DATA96_LEN);
184 #endif
185 #else
186  mavlink_data96_t *packet = (mavlink_data96_t *)msgbuf;
187  packet->type = type;
188  packet->len = len;
189  mav_array_memcpy(packet->data, data, sizeof(uint8_t)*96);
190 #if MAVLINK_CRC_EXTRA
191  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, (const char *)packet, MAVLINK_MSG_ID_DATA96_LEN, MAVLINK_MSG_ID_DATA96_CRC);
192 #else
193  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA96, (const char *)packet, MAVLINK_MSG_ID_DATA96_LEN);
194 #endif
195 #endif
196 }
197 #endif
198 
199 #endif
200 
201 // MESSAGE DATA96 UNPACKING
202 
203 
209 static inline uint8_t mavlink_msg_data96_get_type(const mavlink_message_t* msg)
210 {
211  return _MAV_RETURN_uint8_t(msg, 0);
212 }
213 
219 static inline uint8_t mavlink_msg_data96_get_len(const mavlink_message_t* msg)
220 {
221  return _MAV_RETURN_uint8_t(msg, 1);
222 }
223 
229 static inline uint16_t mavlink_msg_data96_get_data(const mavlink_message_t* msg, uint8_t *data)
230 {
231  return _MAV_RETURN_uint8_t_array(msg, data, 96, 2);
232 }
233 
240 static inline void mavlink_msg_data96_decode(const mavlink_message_t* msg, mavlink_data96_t* data96)
241 {
242 #if MAVLINK_NEED_BYTE_SWAP
243  data96->type = mavlink_msg_data96_get_type(msg);
244  data96->len = mavlink_msg_data96_get_len(msg);
245  mavlink_msg_data96_get_data(msg, data96->data);
246 #else
247  memcpy(data96, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_DATA96_LEN);
248 #endif
249 }
uint8_t type
Definition: fat_standard.h:67
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:238
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:134
uint16_t data
Definition: config.c:91