source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/mavlink_generated_messages/common/mavlink_msg_change_operator_control_ack.h @ 46

Last change on this file since 46 was 46, checked in by Thomas Fuhrmann, 5 years ago

Add the mavlink branch

File size: 12.4 KB
Line 
1// MESSAGE CHANGE_OPERATOR_CONTROL_ACK PACKING
2
3#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK 6
4
5MAVPACKED(
6typedef struct __mavlink_change_operator_control_ack_t {
7 uint8_t gcs_system_id; /*< ID of the GCS this message */
8 uint8_t control_request; /*< 0: request control of this MAV, 1: Release control of this MAV*/
9 uint8_t ack; /*< 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control*/
10}) mavlink_change_operator_control_ack_t;
11
12#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN 3
13#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN 3
14#define MAVLINK_MSG_ID_6_LEN 3
15#define MAVLINK_MSG_ID_6_MIN_LEN 3
16
17#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC 104
18#define MAVLINK_MSG_ID_6_CRC 104
19
20
21
22#if MAVLINK_COMMAND_24BIT
23#define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK { \
24        6, \
25        "CHANGE_OPERATOR_CONTROL_ACK", \
26        3, \
27        {  { "gcs_system_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_ack_t, gcs_system_id) }, \
28         { "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_ack_t, control_request) }, \
29         { "ack", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_ack_t, ack) }, \
30         } \
31}
32#else
33#define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK { \
34        "CHANGE_OPERATOR_CONTROL_ACK", \
35        3, \
36        {  { "gcs_system_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_ack_t, gcs_system_id) }, \
37         { "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_ack_t, control_request) }, \
38         { "ack", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_ack_t, ack) }, \
39         } \
40}
41#endif
42
43/**
44 * @brief Pack a change_operator_control_ack message
45 * @param system_id ID of this system
46 * @param component_id ID of this component (e.g. 200 for IMU)
47 * @param msg The MAVLink message to compress the data into
48 *
49 * @param gcs_system_id ID of the GCS this message
50 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
51 * @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
52 * @return length of the message in bytes (excluding serial stream start sign)
53 */
54static inline uint16_t mavlink_msg_change_operator_control_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
55                                                       uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
56{
57#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
58        char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN];
59        _mav_put_uint8_t(buf, 0, gcs_system_id);
60        _mav_put_uint8_t(buf, 1, control_request);
61        _mav_put_uint8_t(buf, 2, ack);
62
63        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
64#else
65        mavlink_change_operator_control_ack_t packet;
66        packet.gcs_system_id = gcs_system_id;
67        packet.control_request = control_request;
68        packet.ack = ack;
69
70        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
71#endif
72
73        msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
74    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
75}
76
77/**
78 * @brief Pack a change_operator_control_ack message on a channel
79 * @param system_id ID of this system
80 * @param component_id ID of this component (e.g. 200 for IMU)
81 * @param chan The MAVLink channel this message will be sent over
82 * @param msg The MAVLink message to compress the data into
83 * @param gcs_system_id ID of the GCS this message
84 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
85 * @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
86 * @return length of the message in bytes (excluding serial stream start sign)
87 */
88static inline uint16_t mavlink_msg_change_operator_control_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
89                                                           mavlink_message_t* msg,
90                                                           uint8_t gcs_system_id,uint8_t control_request,uint8_t ack)
91{
92#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
93        char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN];
94        _mav_put_uint8_t(buf, 0, gcs_system_id);
95        _mav_put_uint8_t(buf, 1, control_request);
96        _mav_put_uint8_t(buf, 2, ack);
97
98        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
99#else
100        mavlink_change_operator_control_ack_t packet;
101        packet.gcs_system_id = gcs_system_id;
102        packet.control_request = control_request;
103        packet.ack = ack;
104
105        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
106#endif
107
108        msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
109    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
110}
111
112/**
113 * @brief Encode a change_operator_control_ack struct
114 *
115 * @param system_id ID of this system
116 * @param component_id ID of this component (e.g. 200 for IMU)
117 * @param msg The MAVLink message to compress the data into
118 * @param change_operator_control_ack C-struct to read the message contents from
119 */
120static inline uint16_t mavlink_msg_change_operator_control_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_change_operator_control_ack_t* change_operator_control_ack)
121{
122        return mavlink_msg_change_operator_control_ack_pack(system_id, component_id, msg, change_operator_control_ack->gcs_system_id, change_operator_control_ack->control_request, change_operator_control_ack->ack);
123}
124
125/**
126 * @brief Encode a change_operator_control_ack struct on a channel
127 *
128 * @param system_id ID of this system
129 * @param component_id ID of this component (e.g. 200 for IMU)
130 * @param chan The MAVLink channel this message will be sent over
131 * @param msg The MAVLink message to compress the data into
132 * @param change_operator_control_ack C-struct to read the message contents from
133 */
134static inline uint16_t mavlink_msg_change_operator_control_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_change_operator_control_ack_t* change_operator_control_ack)
135{
136        return mavlink_msg_change_operator_control_ack_pack_chan(system_id, component_id, chan, msg, change_operator_control_ack->gcs_system_id, change_operator_control_ack->control_request, change_operator_control_ack->ack);
137}
138
139/**
140 * @brief Send a change_operator_control_ack message
141 * @param chan MAVLink channel to send the message
142 *
143 * @param gcs_system_id ID of the GCS this message
144 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
145 * @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
146 */
147#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
148
149static inline void mavlink_msg_change_operator_control_ack_send(mavlink_channel_t chan, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
150{
151#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
152        char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN];
153        _mav_put_uint8_t(buf, 0, gcs_system_id);
154        _mav_put_uint8_t(buf, 1, control_request);
155        _mav_put_uint8_t(buf, 2, ack);
156
157    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
158#else
159        mavlink_change_operator_control_ack_t packet;
160        packet.gcs_system_id = gcs_system_id;
161        packet.control_request = control_request;
162        packet.ack = ack;
163
164    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, (const char *)&packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
165#endif
166}
167
168/**
169 * @brief Send a change_operator_control_ack message
170 * @param chan MAVLink channel to send the message
171 * @param struct The MAVLink struct to serialize
172 */
173static inline void mavlink_msg_change_operator_control_ack_send_struct(mavlink_channel_t chan, const mavlink_change_operator_control_ack_t* change_operator_control_ack)
174{
175#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
176    mavlink_msg_change_operator_control_ack_send(chan, change_operator_control_ack->gcs_system_id, change_operator_control_ack->control_request, change_operator_control_ack->ack);
177#else
178    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, (const char *)change_operator_control_ack, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
179#endif
180}
181
182#if MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
183/*
184  This varient of _send() can be used to save stack space by re-using
185  memory from the receive buffer.  The caller provides a
186  mavlink_message_t which is the size of a full mavlink message. This
187  is usually the receive buffer for the channel, and allows a reply to an
188  incoming message with minimum stack space usage.
189 */
190static inline void mavlink_msg_change_operator_control_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
191{
192#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193        char *buf = (char *)msgbuf;
194        _mav_put_uint8_t(buf, 0, gcs_system_id);
195        _mav_put_uint8_t(buf, 1, control_request);
196        _mav_put_uint8_t(buf, 2, ack);
197
198    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
199#else
200        mavlink_change_operator_control_ack_t *packet = (mavlink_change_operator_control_ack_t *)msgbuf;
201        packet->gcs_system_id = gcs_system_id;
202        packet->control_request = control_request;
203        packet->ack = ack;
204
205    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, (const char *)packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_CRC);
206#endif
207}
208#endif
209
210#endif
211
212// MESSAGE CHANGE_OPERATOR_CONTROL_ACK UNPACKING
213
214
215/**
216 * @brief Get field gcs_system_id from change_operator_control_ack message
217 *
218 * @return ID of the GCS this message
219 */
220static inline uint8_t mavlink_msg_change_operator_control_ack_get_gcs_system_id(const mavlink_message_t* msg)
221{
222        return _MAV_RETURN_uint8_t(msg,  0);
223}
224
225/**
226 * @brief Get field control_request from change_operator_control_ack message
227 *
228 * @return 0: request control of this MAV, 1: Release control of this MAV
229 */
230static inline uint8_t mavlink_msg_change_operator_control_ack_get_control_request(const mavlink_message_t* msg)
231{
232        return _MAV_RETURN_uint8_t(msg,  1);
233}
234
235/**
236 * @brief Get field ack from change_operator_control_ack message
237 *
238 * @return 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
239 */
240static inline uint8_t mavlink_msg_change_operator_control_ack_get_ack(const mavlink_message_t* msg)
241{
242        return _MAV_RETURN_uint8_t(msg,  2);
243}
244
245/**
246 * @brief Decode a change_operator_control_ack message into a struct
247 *
248 * @param msg The message to decode
249 * @param change_operator_control_ack C-struct to decode the message contents into
250 */
251static inline void mavlink_msg_change_operator_control_ack_decode(const mavlink_message_t* msg, mavlink_change_operator_control_ack_t* change_operator_control_ack)
252{
253#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
254        change_operator_control_ack->gcs_system_id = mavlink_msg_change_operator_control_ack_get_gcs_system_id(msg);
255        change_operator_control_ack->control_request = mavlink_msg_change_operator_control_ack_get_control_request(msg);
256        change_operator_control_ack->ack = mavlink_msg_change_operator_control_ack_get_ack(msg);
257#else
258        uint8_t len = msg->len < MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN? msg->len : MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN;
259        memset(change_operator_control_ack, 0, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN);
260        memcpy(change_operator_control_ack, _MAV_PAYLOAD(msg), len);
261#endif
262}
Note: See TracBrowser for help on using the repository browser.