RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_flexifunction_set.h
1#pragma once
2// MESSAGE FLEXIFUNCTION_SET PACKING
3
4#define MAVLINK_MSG_ID_FLEXIFUNCTION_SET 150
5
6MAVPACKED(
7typedef struct __mavlink_flexifunction_set_t {
8 uint8_t target_system; /*< System ID*/
9 uint8_t target_component; /*< Component ID*/
10}) mavlink_flexifunction_set_t;
11
12#define MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN 2
13#define MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN 2
14#define MAVLINK_MSG_ID_150_LEN 2
15#define MAVLINK_MSG_ID_150_MIN_LEN 2
16
17#define MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC 181
18#define MAVLINK_MSG_ID_150_CRC 181
19
20
21
22#if MAVLINK_COMMAND_24BIT
23#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_SET { \
24 150, \
25 "FLEXIFUNCTION_SET", \
26 2, \
27 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_flexifunction_set_t, target_system) }, \
28 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_flexifunction_set_t, target_component) }, \
29 } \
30}
31#else
32#define MAVLINK_MESSAGE_INFO_FLEXIFUNCTION_SET { \
33 "FLEXIFUNCTION_SET", \
34 2, \
35 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_flexifunction_set_t, target_system) }, \
36 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_flexifunction_set_t, target_component) }, \
37 } \
38}
39#endif
40
51static inline uint16_t mavlink_msg_flexifunction_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
52 uint8_t target_system, uint8_t target_component)
53{
54#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
55 char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN];
56 _mav_put_uint8_t(buf, 0, target_system);
57 _mav_put_uint8_t(buf, 1, target_component);
58
59 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN);
60#else
61 mavlink_flexifunction_set_t packet;
62 packet.target_system = target_system;
63 packet.target_component = target_component;
64
65 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN);
66#endif
67
68 msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_SET;
69 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC);
70}
71
82static inline uint16_t mavlink_msg_flexifunction_set_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
83 mavlink_message_t* msg,
84 uint8_t target_system,uint8_t target_component)
85{
86#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN];
88 _mav_put_uint8_t(buf, 0, target_system);
89 _mav_put_uint8_t(buf, 1, target_component);
90
91 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN);
92#else
93 mavlink_flexifunction_set_t packet;
94 packet.target_system = target_system;
95 packet.target_component = target_component;
96
97 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN);
98#endif
99
100 msg->msgid = MAVLINK_MSG_ID_FLEXIFUNCTION_SET;
101 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC);
102}
103
112static inline uint16_t mavlink_msg_flexifunction_set_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_flexifunction_set_t* flexifunction_set)
113{
114 return mavlink_msg_flexifunction_set_pack(system_id, component_id, msg, flexifunction_set->target_system, flexifunction_set->target_component);
115}
116
126static inline uint16_t mavlink_msg_flexifunction_set_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_flexifunction_set_t* flexifunction_set)
127{
128 return mavlink_msg_flexifunction_set_pack_chan(system_id, component_id, chan, msg, flexifunction_set->target_system, flexifunction_set->target_component);
129}
130
138#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
139
140static inline void mavlink_msg_flexifunction_set_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component)
141{
142#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf[MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN];
144 _mav_put_uint8_t(buf, 0, target_system);
145 _mav_put_uint8_t(buf, 1, target_component);
146
147 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC);
148#else
149 mavlink_flexifunction_set_t packet;
150 packet.target_system = target_system;
151 packet.target_component = target_component;
152
153 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET, (const char *)&packet, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC);
154#endif
155}
156
162static inline void mavlink_msg_flexifunction_set_send_struct(mavlink_channel_t chan, const mavlink_flexifunction_set_t* flexifunction_set)
163{
164#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 mavlink_msg_flexifunction_set_send(chan, flexifunction_set->target_system, flexifunction_set->target_component);
166#else
167 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET, (const char *)flexifunction_set, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC);
168#endif
169}
170
171#if MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
172/*
173 This varient of _send() can be used to save stack space by re-using
174 memory from the receive buffer. The caller provides a
175 mavlink_message_t which is the size of a full mavlink message. This
176 is usually the receive buffer for the channel, and allows a reply to an
177 incoming message with minimum stack space usage.
178 */
179static inline void mavlink_msg_flexifunction_set_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component)
180{
181#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 char *buf = (char *)msgbuf;
183 _mav_put_uint8_t(buf, 0, target_system);
184 _mav_put_uint8_t(buf, 1, target_component);
185
186 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET, buf, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC);
187#else
188 mavlink_flexifunction_set_t *packet = (mavlink_flexifunction_set_t *)msgbuf;
189 packet->target_system = target_system;
190 packet->target_component = target_component;
191
192 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FLEXIFUNCTION_SET, (const char *)packet, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_MIN_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_CRC);
193#endif
194}
195#endif
196
197#endif
198
199// MESSAGE FLEXIFUNCTION_SET UNPACKING
200
201
207static inline uint8_t mavlink_msg_flexifunction_set_get_target_system(const mavlink_message_t* msg)
208{
209 return _MAV_RETURN_uint8_t(msg, 0);
210}
211
217static inline uint8_t mavlink_msg_flexifunction_set_get_target_component(const mavlink_message_t* msg)
218{
219 return _MAV_RETURN_uint8_t(msg, 1);
220}
221
228static inline void mavlink_msg_flexifunction_set_decode(const mavlink_message_t* msg, mavlink_flexifunction_set_t* flexifunction_set)
229{
230#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
231 flexifunction_set->target_system = mavlink_msg_flexifunction_set_get_target_system(msg);
232 flexifunction_set->target_component = mavlink_msg_flexifunction_set_get_target_component(msg);
233#else
234 uint8_t len = msg->len < MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN? msg->len : MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN;
235 memset(flexifunction_set, 0, MAVLINK_MSG_ID_FLEXIFUNCTION_SET_LEN);
236 memcpy(flexifunction_set, _MAV_PAYLOAD(msg), len);
237#endif
238}