RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_led_control.h
1#pragma once
2// MESSAGE LED_CONTROL PACKING
3
4#define MAVLINK_MSG_ID_LED_CONTROL 186
5
6MAVPACKED(
7typedef struct __mavlink_led_control_t {
8 uint8_t target_system; /*< System ID*/
9 uint8_t target_component; /*< Component ID*/
10 uint8_t instance; /*< Instance (LED instance to control or 255 for all LEDs)*/
11 uint8_t pattern; /*< Pattern (see LED_PATTERN_ENUM)*/
12 uint8_t custom_len; /*< Custom Byte Length*/
13 uint8_t custom_bytes[24]; /*< Custom Bytes*/
14}) mavlink_led_control_t;
15
16#define MAVLINK_MSG_ID_LED_CONTROL_LEN 29
17#define MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN 29
18#define MAVLINK_MSG_ID_186_LEN 29
19#define MAVLINK_MSG_ID_186_MIN_LEN 29
20
21#define MAVLINK_MSG_ID_LED_CONTROL_CRC 72
22#define MAVLINK_MSG_ID_186_CRC 72
23
24#define MAVLINK_MSG_LED_CONTROL_FIELD_CUSTOM_BYTES_LEN 24
25
26#if MAVLINK_COMMAND_24BIT
27#define MAVLINK_MESSAGE_INFO_LED_CONTROL { \
28 186, \
29 "LED_CONTROL", \
30 6, \
31 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_led_control_t, target_system) }, \
32 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_led_control_t, target_component) }, \
33 { "instance", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_led_control_t, instance) }, \
34 { "pattern", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_led_control_t, pattern) }, \
35 { "custom_len", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_led_control_t, custom_len) }, \
36 { "custom_bytes", NULL, MAVLINK_TYPE_UINT8_T, 24, 5, offsetof(mavlink_led_control_t, custom_bytes) }, \
37 } \
38}
39#else
40#define MAVLINK_MESSAGE_INFO_LED_CONTROL { \
41 "LED_CONTROL", \
42 6, \
43 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_led_control_t, target_system) }, \
44 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_led_control_t, target_component) }, \
45 { "instance", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_led_control_t, instance) }, \
46 { "pattern", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_led_control_t, pattern) }, \
47 { "custom_len", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_led_control_t, custom_len) }, \
48 { "custom_bytes", NULL, MAVLINK_TYPE_UINT8_T, 24, 5, offsetof(mavlink_led_control_t, custom_bytes) }, \
49 } \
50}
51#endif
52
67static inline uint16_t mavlink_msg_led_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
68 uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes)
69{
70#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
71 char buf[MAVLINK_MSG_ID_LED_CONTROL_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, instance);
75 _mav_put_uint8_t(buf, 3, pattern);
76 _mav_put_uint8_t(buf, 4, custom_len);
77 _mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
78 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LED_CONTROL_LEN);
79#else
80 mavlink_led_control_t packet;
81 packet.target_system = target_system;
82 packet.target_component = target_component;
83 packet.instance = instance;
84 packet.pattern = pattern;
85 packet.custom_len = custom_len;
86 mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24);
87 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LED_CONTROL_LEN);
88#endif
89
90 msg->msgid = MAVLINK_MSG_ID_LED_CONTROL;
91 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
92}
93
108static inline uint16_t mavlink_msg_led_control_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 instance,uint8_t pattern,uint8_t custom_len,const uint8_t *custom_bytes)
111{
112#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
113 char buf[MAVLINK_MSG_ID_LED_CONTROL_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, instance);
117 _mav_put_uint8_t(buf, 3, pattern);
118 _mav_put_uint8_t(buf, 4, custom_len);
119 _mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
120 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LED_CONTROL_LEN);
121#else
122 mavlink_led_control_t packet;
123 packet.target_system = target_system;
124 packet.target_component = target_component;
125 packet.instance = instance;
126 packet.pattern = pattern;
127 packet.custom_len = custom_len;
128 mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24);
129 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LED_CONTROL_LEN);
130#endif
131
132 msg->msgid = MAVLINK_MSG_ID_LED_CONTROL;
133 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
134}
135
144static inline uint16_t mavlink_msg_led_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_led_control_t* led_control)
145{
146 return mavlink_msg_led_control_pack(system_id, component_id, msg, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes);
147}
148
158static inline uint16_t mavlink_msg_led_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_led_control_t* led_control)
159{
160 return mavlink_msg_led_control_pack_chan(system_id, component_id, chan, msg, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes);
161}
162
174#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
175
176static inline void mavlink_msg_led_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes)
177{
178#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
179 char buf[MAVLINK_MSG_ID_LED_CONTROL_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, instance);
183 _mav_put_uint8_t(buf, 3, pattern);
184 _mav_put_uint8_t(buf, 4, custom_len);
185 _mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
186 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, buf, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
187#else
188 mavlink_led_control_t packet;
189 packet.target_system = target_system;
190 packet.target_component = target_component;
191 packet.instance = instance;
192 packet.pattern = pattern;
193 packet.custom_len = custom_len;
194 mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24);
195 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
196#endif
197}
198
204static inline void mavlink_msg_led_control_send_struct(mavlink_channel_t chan, const mavlink_led_control_t* led_control)
205{
206#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
207 mavlink_msg_led_control_send(chan, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes);
208#else
209 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)led_control, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
210#endif
211}
212
213#if MAVLINK_MSG_ID_LED_CONTROL_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_led_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes)
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, instance);
228 _mav_put_uint8_t(buf, 3, pattern);
229 _mav_put_uint8_t(buf, 4, custom_len);
230 _mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
231 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, buf, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
232#else
233 mavlink_led_control_t *packet = (mavlink_led_control_t *)msgbuf;
234 packet->target_system = target_system;
235 packet->target_component = target_component;
236 packet->instance = instance;
237 packet->pattern = pattern;
238 packet->custom_len = custom_len;
239 mav_array_memcpy(packet->custom_bytes, custom_bytes, sizeof(uint8_t)*24);
240 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)packet, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
241#endif
242}
243#endif
244
245#endif
246
247// MESSAGE LED_CONTROL UNPACKING
248
249
255static inline uint8_t mavlink_msg_led_control_get_target_system(const mavlink_message_t* msg)
256{
257 return _MAV_RETURN_uint8_t(msg, 0);
258}
259
265static inline uint8_t mavlink_msg_led_control_get_target_component(const mavlink_message_t* msg)
266{
267 return _MAV_RETURN_uint8_t(msg, 1);
268}
269
275static inline uint8_t mavlink_msg_led_control_get_instance(const mavlink_message_t* msg)
276{
277 return _MAV_RETURN_uint8_t(msg, 2);
278}
279
285static inline uint8_t mavlink_msg_led_control_get_pattern(const mavlink_message_t* msg)
286{
287 return _MAV_RETURN_uint8_t(msg, 3);
288}
289
295static inline uint8_t mavlink_msg_led_control_get_custom_len(const mavlink_message_t* msg)
296{
297 return _MAV_RETURN_uint8_t(msg, 4);
298}
299
305static inline uint16_t mavlink_msg_led_control_get_custom_bytes(const mavlink_message_t* msg, uint8_t *custom_bytes)
306{
307 return _MAV_RETURN_uint8_t_array(msg, custom_bytes, 24, 5);
308}
309
316static inline void mavlink_msg_led_control_decode(const mavlink_message_t* msg, mavlink_led_control_t* led_control)
317{
318#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
319 led_control->target_system = mavlink_msg_led_control_get_target_system(msg);
320 led_control->target_component = mavlink_msg_led_control_get_target_component(msg);
321 led_control->instance = mavlink_msg_led_control_get_instance(msg);
322 led_control->pattern = mavlink_msg_led_control_get_pattern(msg);
323 led_control->custom_len = mavlink_msg_led_control_get_custom_len(msg);
324 mavlink_msg_led_control_get_custom_bytes(msg, led_control->custom_bytes);
325#else
326 uint8_t len = msg->len < MAVLINK_MSG_ID_LED_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_LED_CONTROL_LEN;
327 memset(led_control, 0, MAVLINK_MSG_ID_LED_CONTROL_LEN);
328 memcpy(led_control, _MAV_PAYLOAD(msg), len);
329#endif
330}