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