RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_flexifunction_buffer_function.h
1#pragma once
2// MESSAGE FLEXIFUNCTION_BUFFER_FUNCTION PACKING
3
4#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION 152
5
6MAVPACKED(
7typedef struct __mavlink_flexifunction_buffer_function_t {
8 uint16_t func_index; /*< Function index*/
9 uint16_t func_count; /*< Total count of functions*/
10 uint16_t data_address; /*< Address in the flexifunction data, Set to 0xFFFF to use address in target memory*/
11 uint16_t data_size; /*< Size of the */
12 uint8_t target_system; /*< System ID*/
13 uint8_t target_component; /*< Component ID*/
14 int8_t data[48]; /*< Settings data*/
15}) mavlink_flexifunction_buffer_function_t;
16
17#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN 58
18#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN 58
19#define MAVLINK_MSG_ID_152_LEN 58
20#define MAVLINK_MSG_ID_152_MIN_LEN 58
21
22#define MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC 101
23#define MAVLINK_MSG_ID_152_CRC 101
24
25#define MAVLINK_MSG_FLEXIFUNCTION_BUFFER_FUNCTION_FIELD_DATA_LEN 48
26
27#if MAVLINK_COMMAND_24BIT
28#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_BUFFER_FUNCTION { \
29 152, \
30 "FLEXIFUNCTION_BUFFER_FUNCTION", \
31 7, \
32 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_flexifunction_buffer_function_t, target_system) }, \
33 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_flexifunction_buffer_function_t, target_component) }, \
34 { "func_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_buffer_function_t, func_index) }, \
35 { "func_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_flexifunction_buffer_function_t, func_count) }, \
36 { "data_address", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_flexifunction_buffer_function_t, data_address) }, \
37 { "data_size", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_flexifunction_buffer_function_t, data_size) }, \
38 { "data", NULL, MAVLINK_TYPE_INT8_T, 48, 10, offsetof(mavlink_flexifunction_buffer_function_t, data) }, \
39 } \
40}
41#else
42#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_BUFFER_FUNCTION { \
43 "FLEXIFUNCTION_BUFFER_FUNCTION", \
44 7, \
45 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_flexifunction_buffer_function_t, target_system) }, \
46 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_flexifunction_buffer_function_t, target_component) }, \
47 { "func_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_flexifunction_buffer_function_t, func_index) }, \
48 { "func_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_flexifunction_buffer_function_t, func_count) }, \
49 { "data_address", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_flexifunction_buffer_function_t, data_address) }, \
50 { "data_size", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_flexifunction_buffer_function_t, data_size) }, \
51 { "data", NULL, MAVLINK_TYPE_INT8_T, 48, 10, offsetof(mavlink_flexifunction_buffer_function_t, data) }, \
52 } \
53}
54#endif
55
56/**
57 * @brief Pack a flexifunction_buffer_function message
58 * @param system_id ID of this system
59 * @param component_id ID of this component (e.g. 200 for IMU)
60 * @param msg The MAVLink message to compress the data into
61 *
62 * @param target_system System ID
63 * @param target_component Component ID
64 * @param func_index Function index
65 * @param func_count Total count of functions
66 * @param data_address Address in the flexifunction data, Set to 0xFFFF to use address in target memory
67 * @param data_size Size of the
68 * @param data Settings data
69 * @return length of the message in bytes (excluding serial stream start sign)
70 */
71static inline uint16_t mavlink_msg_flexifunction_buffer_function_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72 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)
73{
74#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
75 char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN];
76 _mav_put_uint16_t(buf, 0, func_index);
77 _mav_put_uint16_t(buf, 2, func_count);
78 _mav_put_uint16_t(buf, 4, data_address);
79 _mav_put_uint16_t(buf, 6, data_size);
80 _mav_put_uint8_t(buf, 8, target_system);
81 _mav_put_uint8_t(buf, 9, target_component);
82 _mav_put_int8_t_array(buf, 10, data, 48);
83 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN);
84#else
85 mavlink_flexifunction_buffer_function_t packet;
86 packet.func_index = func_index;
87 packet.func_count = func_count;
88 packet.data_address = data_address;
89 packet.data_size = data_size;
90 packet.target_system = target_system;
91 packet.target_component = target_component;
92 mav_array_memcpy(packet.data, data, sizeof(int8_t)*48);
93 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN);
94#endif
95
96 msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION;
97 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC);
98}
99
100/**
101 * @brief Pack a flexifunction_buffer_function message on a channel
102 * @param system_id ID of this system
103 * @param component_id ID of this component (e.g. 200 for IMU)
104 * @param chan The MAVLink channel this message will be sent over
105 * @param msg The MAVLink message to compress the data into
106 * @param target_system System ID
107 * @param target_component Component ID
108 * @param func_index Function index
109 * @param func_count Total count of functions
110 * @param data_address Address in the flexifunction data, Set to 0xFFFF to use address in target memory
111 * @param data_size Size of the
112 * @param data Settings data
113 * @return length of the message in bytes (excluding serial stream start sign)
114 */
115static inline uint16_t mavlink_msg_flexifunction_buffer_function_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
116 mavlink_message_t* msg,
117 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)
118{
119#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
120 char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN];
121 _mav_put_uint16_t(buf, 0, func_index);
122 _mav_put_uint16_t(buf, 2, func_count);
123 _mav_put_uint16_t(buf, 4, data_address);
124 _mav_put_uint16_t(buf, 6, data_size);
125 _mav_put_uint8_t(buf, 8, target_system);
126 _mav_put_uint8_t(buf, 9, target_component);
127 _mav_put_int8_t_array(buf, 10, data, 48);
128 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN);
129#else
130 mavlink_flexifunction_buffer_function_t packet;
131 packet.func_index = func_index;
132 packet.func_count = func_count;
133 packet.data_address = data_address;
134 packet.data_size = data_size;
135 packet.target_system = target_system;
136 packet.target_component = target_component;
137 mav_array_memcpy(packet.data, data, sizeof(int8_t)*48);
138 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN);
139#endif
140
141 msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION;
142 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC);
143}
144
145/**
146 * @brief Encode a flexifunction_buffer_function struct
147 *
148 * @param system_id ID of this system
149 * @param component_id ID of this component (e.g. 200 for IMU)
150 * @param msg The MAVLink message to compress the data into
151 * @param flexifunction_buffer_function C-struct to read the message contents from
152 */
153static 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)
154{
155 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);
156}
157
158/**
159 * @brief Encode a flexifunction_buffer_function struct on a channel
160 *
161 * @param system_id ID of this system
162 * @param component_id ID of this component (e.g. 200 for IMU)
163 * @param chan The MAVLink channel this message will be sent over
164 * @param msg The MAVLink message to compress the data into
165 * @param flexifunction_buffer_function C-struct to read the message contents from
166 */
167static 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)
168{
169 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);
170}
171
172/**
173 * @brief Send a flexifunction_buffer_function message
174 * @param chan MAVLink channel to send the message
175 *
176 * @param target_system System ID
177 * @param target_component Component ID
178 * @param func_index Function index
179 * @param func_count Total count of functions
180 * @param data_address Address in the flexifunction data, Set to 0xFFFF to use address in target memory
181 * @param data_size Size of the
182 * @param data Settings data
183 */
184#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
185
186static 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)
187{
188#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
189 char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN];
190 _mav_put_uint16_t(buf, 0, func_index);
191 _mav_put_uint16_t(buf, 2, func_count);
192 _mav_put_uint16_t(buf, 4, data_address);
193 _mav_put_uint16_t(buf, 6, data_size);
194 _mav_put_uint8_t(buf, 8, target_system);
195 _mav_put_uint8_t(buf, 9, target_component);
196 _mav_put_int8_t_array(buf, 10, data, 48);
197 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC);
198#else
199 mavlink_flexifunction_buffer_function_t packet;
200 packet.func_index = func_index;
201 packet.func_count = func_count;
202 packet.data_address = data_address;
203 packet.data_size = data_size;
204 packet.target_system = target_system;
205 packet.target_component = target_component;
206 mav_array_memcpy(packet.data, data, sizeof(int8_t)*48);
207 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC);
208#endif
209}
210
211/**
212 * @brief Send a flexifunction_buffer_function message
213 * @param chan MAVLink channel to send the message
214 * @param struct The MAVLink struct to serialize
215 */
216static inline void mavlink_msg_flexifunction_buffer_function_send_struct(mavlink_channel_t chan, const mavlink_flexifunction_buffer_function_t* flexifunction_buffer_function)
217{
218#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
219 mavlink_msg_flexifunction_buffer_function_send(chan, 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);
220#else
221 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, (const char *)flexifunction_buffer_function, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC);
222#endif
223}
224
225#if MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
226/*
227 This varient of _send() can be used to save stack space by re-using
228 memory from the receive buffer. The caller provides a
229 mavlink_message_t which is the size of a full mavlink message. This
230 is usually the receive buffer for the channel, and allows a reply to an
231 incoming message with minimum stack space usage.
232 */
233static 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)
234{
235#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
236 char *buf = (char *)msgbuf;
237 _mav_put_uint16_t(buf, 0, func_index);
238 _mav_put_uint16_t(buf, 2, func_count);
239 _mav_put_uint16_t(buf, 4, data_address);
240 _mav_put_uint16_t(buf, 6, data_size);
241 _mav_put_uint8_t(buf, 8, target_system);
242 _mav_put_uint8_t(buf, 9, target_component);
243 _mav_put_int8_t_array(buf, 10, data, 48);
244 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC);
245#else
246 mavlink_flexifunction_buffer_function_t *packet = (mavlink_flexifunction_buffer_function_t *)msgbuf;
247 packet->func_index = func_index;
248 packet->func_count = func_count;
249 packet->data_address = data_address;
250 packet->data_size = data_size;
251 packet->target_system = target_system;
252 packet->target_component = target_component;
253 mav_array_memcpy(packet->data, data, sizeof(int8_t)*48);
254 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_CRC);
255#endif
256}
257#endif
258
259#endif
260
261// MESSAGE FLEXIFUNCTION_BUFFER_FUNCTION UNPACKING
262
263
264/**
265 * @brief Get field target_system from flexifunction_buffer_function message
266 *
267 * @return System ID
268 */
269static inline uint8_t mavlink_msg_flexifunction_buffer_function_get_target_system(const mavlink_message_t* msg)
270{
271 return _MAV_RETURN_uint8_t(msg, 8);
272}
273
274/**
275 * @brief Get field target_component from flexifunction_buffer_function message
276 *
277 * @return Component ID
278 */
279static inline uint8_t mavlink_msg_flexifunction_buffer_function_get_target_component(const mavlink_message_t* msg)
280{
281 return _MAV_RETURN_uint8_t(msg, 9);
282}
283
284/**
285 * @brief Get field func_index from flexifunction_buffer_function message
286 *
287 * @return Function index
288 */
289static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_func_index(const mavlink_message_t* msg)
290{
291 return _MAV_RETURN_uint16_t(msg, 0);
292}
293
294/**
295 * @brief Get field func_count from flexifunction_buffer_function message
296 *
297 * @return Total count of functions
298 */
299static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_func_count(const mavlink_message_t* msg)
300{
301 return _MAV_RETURN_uint16_t(msg, 2);
302}
303
304/**
305 * @brief Get field data_address from flexifunction_buffer_function message
306 *
307 * @return Address in the flexifunction data, Set to 0xFFFF to use address in target memory
308 */
309static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_data_address(const mavlink_message_t* msg)
310{
311 return _MAV_RETURN_uint16_t(msg, 4);
312}
313
314/**
315 * @brief Get field data_size from flexifunction_buffer_function message
316 *
317 * @return Size of the
318 */
319static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_data_size(const mavlink_message_t* msg)
320{
321 return _MAV_RETURN_uint16_t(msg, 6);
322}
323
324/**
325 * @brief Get field data from flexifunction_buffer_function message
326 *
327 * @return Settings data
328 */
329static inline uint16_t mavlink_msg_flexifunction_buffer_function_get_data(const mavlink_message_t* msg, int8_t *data)
330{
331 return _MAV_RETURN_int8_t_array(msg, data, 48, 10);
332}
333
334/**
335 * @brief Decode a flexifunction_buffer_function message into a struct
336 *
337 * @param msg The message to decode
338 * @param flexifunction_buffer_function C-struct to decode the message contents into
339 */
340static inline void mavlink_msg_flexifunction_buffer_function_decode(const mavlink_message_t* msg, mavlink_flexifunction_buffer_function_t* flexifunction_buffer_function)
341{
342#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
343 flexifunction_buffer_function->func_index = mavlink_msg_flexifunction_buffer_function_get_func_index(msg);
344 flexifunction_buffer_function->func_count = mavlink_msg_flexifunction_buffer_function_get_func_count(msg);
345 flexifunction_buffer_function->data_address = mavlink_msg_flexifunction_buffer_function_get_data_address(msg);
346 flexifunction_buffer_function->data_size = mavlink_msg_flexifunction_buffer_function_get_data_size(msg);
347 flexifunction_buffer_function->target_system = mavlink_msg_flexifunction_buffer_function_get_target_system(msg);
348 flexifunction_buffer_function->target_component = mavlink_msg_flexifunction_buffer_function_get_target_component(msg);
349 mavlink_msg_flexifunction_buffer_function_get_data(msg, flexifunction_buffer_function->data);
350#else
351 uint8_t len = msg->len < MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN? msg->len : MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN;
352 memset(flexifunction_buffer_function, 0, MAVLINK_MSG_ID_FLEXIFUNCTION_BUFFER_FUNCTION_LEN);
353 memcpy(flexifunction_buffer_function, _MAV_PAYLOAD(msg), len);
354#endif
355}