NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_flexifunction_buffer_function.h
Go to the documentation of this file.
1 // MESSAGE FLEXIFUNCTION_BUFFER_FUNCTION PACKING
2 
3 #define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION 152
4 
6 {
7  uint16_t func_index;
8  uint16_t func_count;
9  uint16_t data_address;
10  uint16_t data_size;
11  uint8_t target_system;
12  uint8_t target_component;
13  int8_t data[48];
15 
16 #define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN 58
17 #define MAVLINK_MSG_ID_152_LEN 58
18 
19 #define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC 101
20 #define MAVLINK_MSG_ID_152_CRC 101
21 
22 #define MAVLINK_MSG_FLEXIFUNCTION_BUFFER_FUNCTION_FIELD_DATA_LEN 48
23 
24 #define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_BUFFER_FUNCTION { \
25  "FLEXIFUNCTION_BUFFER_FUNCTION", \
26  7, \
27  { { "func_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_buffer_function_t, func_index) }, \
28  { "func_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_flexifunction_buffer_function_t, func_count) }, \
29  { "data_address", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_flexifunction_buffer_function_t, data_address) }, \
30  { "data_size", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_flexifunction_buffer_function_t, data_size) }, \
31  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_flexifunction_buffer_function_t, target_system) }, \
32  { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_flexifunction_buffer_function_t, target_component) }, \
33  { "data", NULL, MAVLINK_TYPE_INT8_T, 48, 10, offsetof(mavlink_flexifunction_buffer_function_t, data) }, \
34  } \
35 }
36 
37 
53 static inline uint16_t mavlink_msg_flexifunction_buffer_function_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54  uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t func_count, uint16_t data_address, uint16_t data_size, const int8_t *data)
55 {
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
58  _mav_put_uint16_t(buf, 0, func_index);
59  _mav_put_uint16_t(buf, 2, func_count);
60  _mav_put_uint16_t(buf, 4, data_address);
61  _mav_put_uint16_t(buf, 6, data_size);
62  _mav_put_uint8_t(buf, 8, target_system);
63  _mav_put_uint8_t(buf, 9, target_component);
64  _mav_put_int8_t_array(buf, 10, data, 48);
66 #else
68  packet.func_index = func_index;
69  packet.func_count = func_count;
70  packet.data_address = data_address;
71  packet.data_size = data_size;
72  packet.target_system = target_system;
73  packet.target_component = target_component;
74  mav_array_memcpy(packet.data, data, sizeof(int8_t)*48);
76 #endif
77 
79 #if MAVLINK_CRC_EXTRA
81 #else
83 #endif
84 }
85 
101 static inline uint16_t mavlink_msg_flexifunction_buffer_function_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
102  mavlink_message_t* msg,
103  uint8_t target_system,uint8_t target_component,uint16_t func_index,uint16_t func_count,uint16_t data_address,uint16_t data_size,const int8_t *data)
104 {
105 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
107  _mav_put_uint16_t(buf, 0, func_index);
108  _mav_put_uint16_t(buf, 2, func_count);
109  _mav_put_uint16_t(buf, 4, data_address);
110  _mav_put_uint16_t(buf, 6, data_size);
111  _mav_put_uint8_t(buf, 8, target_system);
112  _mav_put_uint8_t(buf, 9, target_component);
113  _mav_put_int8_t_array(buf, 10, data, 48);
115 #else
117  packet.func_index = func_index;
118  packet.func_count = func_count;
119  packet.data_address = data_address;
120  packet.data_size = data_size;
121  packet.target_system = target_system;
122  packet.target_component = target_component;
123  mav_array_memcpy(packet.data, data, sizeof(int8_t)*48);
125 #endif
126 
128 #if MAVLINK_CRC_EXTRA
130 #else
131  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN);
132 #endif
133 }
134 
143 static inline uint16_t mavlink_msg_flexifunction_buffer_function_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_buffer_function_t* flexifunction_buffer_function)
144 {
145  return mavlink_msg_flexifunction_buffer_function_pack(system_id, component_id, msg, flexifunction_buffer_function->target_system, flexifunction_buffer_function->target_component, flexifunction_buffer_function->func_index, flexifunction_buffer_function->func_count, flexifunction_buffer_function->data_address, flexifunction_buffer_function->data_size, flexifunction_buffer_function->data);
146 }
147 
157 static inline uint16_t mavlink_msg_flexifunction_buffer_function_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flexifunction_buffer_function_t* flexifunction_buffer_function)
158 {
159  return mavlink_msg_flexifunction_buffer_function_pack_chan(system_id, component_id, chan, msg, flexifunction_buffer_function->target_system, flexifunction_buffer_function->target_component, flexifunction_buffer_function->func_index, flexifunction_buffer_function->func_count, flexifunction_buffer_function->data_address, flexifunction_buffer_function->data_size, flexifunction_buffer_function->data);
160 }
161 
174 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
175 
176 static inline void mavlink_msg_flexifunction_buffer_function_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t func_count, uint16_t data_address, uint16_t data_size, const int8_t *data)
177 {
178 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
180  _mav_put_uint16_t(buf, 0, func_index);
181  _mav_put_uint16_t(buf, 2, func_count);
182  _mav_put_uint16_t(buf, 4, data_address);
183  _mav_put_uint16_t(buf, 6, data_size);
184  _mav_put_uint8_t(buf, 8, target_system);
185  _mav_put_uint8_t(buf, 9, target_component);
186  _mav_put_int8_t_array(buf, 10, data, 48);
187 #if MAVLINK_CRC_EXTRA
189 #else
191 #endif
192 #else
194  packet.func_index = func_index;
195  packet.func_count = func_count;
196  packet.data_address = data_address;
197  packet.data_size = data_size;
198  packet.target_system = target_system;
199  packet.target_component = target_component;
200  mav_array_memcpy(packet.data, data, sizeof(int8_t)*48);
201 #if MAVLINK_CRC_EXTRA
203 #else
204  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN);
205 #endif
206 #endif
207 }
208 
209 #if MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
210 /*
211  This varient of _send() can be used to save stack space by re-using
212  memory from the receive buffer. The caller provides a
213  mavlink_message_t which is the size of a full mavlink message. This
214  is usually the receive buffer for the channel, and allows a reply to an
215  incoming message with minimum stack space usage.
216  */
217 static inline void mavlink_msg_flexifunction_buffer_function_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t func_index, uint16_t func_count, uint16_t data_address, uint16_t data_size, const int8_t *data)
218 {
219 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
220  char *buf = (char *)msgbuf;
221  _mav_put_uint16_t(buf, 0, func_index);
222  _mav_put_uint16_t(buf, 2, func_count);
223  _mav_put_uint16_t(buf, 4, data_address);
224  _mav_put_uint16_t(buf, 6, data_size);
225  _mav_put_uint8_t(buf, 8, target_system);
226  _mav_put_uint8_t(buf, 9, target_component);
227  _mav_put_int8_t_array(buf, 10, data, 48);
228 #if MAVLINK_CRC_EXTRA
230 #else
232 #endif
233 #else
235  packet->func_index = func_index;
236  packet->func_count = func_count;
237  packet->data_address = data_address;
238  packet->data_size = data_size;
239  packet->target_system = target_system;
240  packet->target_component = target_component;
241  mav_array_memcpy(packet->data, data, sizeof(int8_t)*48);
242 #if MAVLINK_CRC_EXTRA
244 #else
245  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN);
246 #endif
247 #endif
248 }
249 #endif
250 
251 #endif
252 
253 // MESSAGE FLEXIFUNCTION_BUFFER_FUNCTION UNPACKING
254 
255 
261 static inline uint8_t mavlink_msg_flexifunction_buffer_function_get_target_system(const mavlink_message_t* msg)
262 {
263  return _MAV_RETURN_uint8_t(msg, 8);
264 }
265 
271 static inline uint8_t mavlink_msg_flexifunction_buffer_function_get_target_component(const mavlink_message_t* msg)
272 {
273  return _MAV_RETURN_uint8_t(msg, 9);
274 }
275 
281 static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_func_index(const mavlink_message_t* msg)
282 {
283  return _MAV_RETURN_uint16_t(msg, 0);
284 }
285 
291 static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_func_count(const mavlink_message_t* msg)
292 {
293  return _MAV_RETURN_uint16_t(msg, 2);
294 }
295 
301 static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_data_address(const mavlink_message_t* msg)
302 {
303  return _MAV_RETURN_uint16_t(msg, 4);
304 }
305 
311 static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_data_size(const mavlink_message_t* msg)
312 {
313  return _MAV_RETURN_uint16_t(msg, 6);
314 }
315 
321 static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_data(const mavlink_message_t* msg, int8_t *data)
322 {
323  return _MAV_RETURN_int8_t_array(msg, data, 48, 10);
324 }
325 
332 static inline void mavlink_msg_flexifunction_buffer_function_decode(const mavlink_message_t* msg, mavlink_flexifunction_buffer_function_t* flexifunction_buffer_function)
333 {
334 #if MAVLINK_NEED_BYTE_SWAP
335  flexifunction_buffer_function->func_index = mavlink_msg_flexifunction_buffer_function_get_func_index(msg);
336  flexifunction_buffer_function->func_count = mavlink_msg_flexifunction_buffer_function_get_func_count(msg);
337  flexifunction_buffer_function->data_address = mavlink_msg_flexifunction_buffer_function_get_data_address(msg);
338  flexifunction_buffer_function->data_size = mavlink_msg_flexifunction_buffer_function_get_data_size(msg);
339  flexifunction_buffer_function->target_system = mavlink_msg_flexifunction_buffer_function_get_target_system(msg);
340  flexifunction_buffer_function->target_component = mavlink_msg_flexifunction_buffer_function_get_target_component(msg);
341  mavlink_msg_flexifunction_buffer_function_get_data(msg, flexifunction_buffer_function->data);
342 #else
343  memcpy(flexifunction_buffer_function, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN);
344 #endif
345 }
#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
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139
uint16_t data
Definition: config.c:91