source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_change_operator_control.h @ 75

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

Change the version of mavlink generated messages and rename it to include

File size: 14.8 KB
Line 
1// MESSAGE CHANGE_OPERATOR_CONTROL PACKING
2
3#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL 5
4
5typedef struct MAVLINK_PACKED __mavlink_change_operator_control_t
6{
7 uint8_t target_system; /*< System the GCS requests control for*/
8 uint8_t control_request; /*< 0: request control of this MAV, 1: Release control of this MAV*/
9 uint8_t version; /*< 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.*/
10 char passkey[25]; /*< Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"*/
11} mavlink_change_operator_control_t;
12
13#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN 28
14#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN 28
15#define MAVLINK_MSG_ID_5_LEN 28
16#define MAVLINK_MSG_ID_5_MIN_LEN 28
17
18#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC 217
19#define MAVLINK_MSG_ID_5_CRC 217
20
21#define MAVLINK_MSG_CHANGE_OPERATOR_CONTROL_FIELD_PASSKEY_LEN 25
22
23#if MAVLINK_COMMAND_24BIT
24#define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL { \
25        5, \
26        "CHANGE_OPERATOR_CONTROL", \
27        4, \
28        {  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_t, target_system) }, \
29         { "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_t, control_request) }, \
30         { "version", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_t, version) }, \
31         { "passkey", NULL, MAVLINK_TYPE_CHAR, 25, 3, offsetof(mavlink_change_operator_control_t, passkey) }, \
32         } \
33}
34#else
35#define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL { \
36        "CHANGE_OPERATOR_CONTROL", \
37        4, \
38        {  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_t, target_system) }, \
39         { "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_t, control_request) }, \
40         { "version", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_t, version) }, \
41         { "passkey", NULL, MAVLINK_TYPE_CHAR, 25, 3, offsetof(mavlink_change_operator_control_t, passkey) }, \
42         } \
43}
44#endif
45
46/**
47 * @brief Pack a change_operator_control message
48 * @param system_id ID of this system
49 * @param component_id ID of this component (e.g. 200 for IMU)
50 * @param msg The MAVLink message to compress the data into
51 *
52 * @param target_system System the GCS requests control for
53 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
54 * @param version 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
55 * @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
56 * @return length of the message in bytes (excluding serial stream start sign)
57 */
58static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
59                                                       uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
60{
61#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
62        char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN];
63        _mav_put_uint8_t(buf, 0, target_system);
64        _mav_put_uint8_t(buf, 1, control_request);
65        _mav_put_uint8_t(buf, 2, version);
66        _mav_put_char_array(buf, 3, passkey, 25);
67        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
68#else
69        mavlink_change_operator_control_t packet;
70        packet.target_system = target_system;
71        packet.control_request = control_request;
72        packet.version = version;
73        mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
74        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
75#endif
76
77        msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
78    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
79}
80
81/**
82 * @brief Pack a change_operator_control message on a channel
83 * @param system_id ID of this system
84 * @param component_id ID of this component (e.g. 200 for IMU)
85 * @param chan The MAVLink channel this message will be sent over
86 * @param msg The MAVLink message to compress the data into
87 * @param target_system System the GCS requests control for
88 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
89 * @param version 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
90 * @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
91 * @return length of the message in bytes (excluding serial stream start sign)
92 */
93static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
94                                                           mavlink_message_t* msg,
95                                                           uint8_t target_system,uint8_t control_request,uint8_t version,const char *passkey)
96{
97#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
98        char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN];
99        _mav_put_uint8_t(buf, 0, target_system);
100        _mav_put_uint8_t(buf, 1, control_request);
101        _mav_put_uint8_t(buf, 2, version);
102        _mav_put_char_array(buf, 3, passkey, 25);
103        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
104#else
105        mavlink_change_operator_control_t packet;
106        packet.target_system = target_system;
107        packet.control_request = control_request;
108        packet.version = version;
109        mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
110        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
111#endif
112
113        msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
114    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
115}
116
117/**
118 * @brief Encode a change_operator_control struct
119 *
120 * @param system_id ID of this system
121 * @param component_id ID of this component (e.g. 200 for IMU)
122 * @param msg The MAVLink message to compress the data into
123 * @param change_operator_control C-struct to read the message contents from
124 */
125static inline uint16_t mavlink_msg_change_operator_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_change_operator_control_t* change_operator_control)
126{
127        return mavlink_msg_change_operator_control_pack(system_id, component_id, msg, change_operator_control->target_system, change_operator_control->control_request, change_operator_control->version, change_operator_control->passkey);
128}
129
130/**
131 * @brief Encode a change_operator_control struct on a channel
132 *
133 * @param system_id ID of this system
134 * @param component_id ID of this component (e.g. 200 for IMU)
135 * @param chan The MAVLink channel this message will be sent over
136 * @param msg The MAVLink message to compress the data into
137 * @param change_operator_control C-struct to read the message contents from
138 */
139static inline uint16_t mavlink_msg_change_operator_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_change_operator_control_t* change_operator_control)
140{
141        return mavlink_msg_change_operator_control_pack_chan(system_id, component_id, chan, msg, change_operator_control->target_system, change_operator_control->control_request, change_operator_control->version, change_operator_control->passkey);
142}
143
144/**
145 * @brief Send a change_operator_control message
146 * @param chan MAVLink channel to send the message
147 *
148 * @param target_system System the GCS requests control for
149 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
150 * @param version 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
151 * @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
152 */
153#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
154
155static inline void mavlink_msg_change_operator_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
156{
157#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
158        char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN];
159        _mav_put_uint8_t(buf, 0, target_system);
160        _mav_put_uint8_t(buf, 1, control_request);
161        _mav_put_uint8_t(buf, 2, version);
162        _mav_put_char_array(buf, 3, passkey, 25);
163    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
164#else
165        mavlink_change_operator_control_t packet;
166        packet.target_system = target_system;
167        packet.control_request = control_request;
168        packet.version = version;
169        mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
170    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
171#endif
172}
173
174/**
175 * @brief Send a change_operator_control message
176 * @param chan MAVLink channel to send the message
177 * @param struct The MAVLink struct to serialize
178 */
179static inline void mavlink_msg_change_operator_control_send_struct(mavlink_channel_t chan, const mavlink_change_operator_control_t* change_operator_control)
180{
181#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182    mavlink_msg_change_operator_control_send(chan, change_operator_control->target_system, change_operator_control->control_request, change_operator_control->version, change_operator_control->passkey);
183#else
184    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)change_operator_control, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
185#endif
186}
187
188#if MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
189/*
190  This varient of _send() can be used to save stack space by re-using
191  memory from the receive buffer.  The caller provides a
192  mavlink_message_t which is the size of a full mavlink message. This
193  is usually the receive buffer for the channel, and allows a reply to an
194  incoming message with minimum stack space usage.
195 */
196static inline void mavlink_msg_change_operator_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
197{
198#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
199        char *buf = (char *)msgbuf;
200        _mav_put_uint8_t(buf, 0, target_system);
201        _mav_put_uint8_t(buf, 1, control_request);
202        _mav_put_uint8_t(buf, 2, version);
203        _mav_put_char_array(buf, 3, passkey, 25);
204    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
205#else
206        mavlink_change_operator_control_t *packet = (mavlink_change_operator_control_t *)msgbuf;
207        packet->target_system = target_system;
208        packet->control_request = control_request;
209        packet->version = version;
210        mav_array_memcpy(packet->passkey, passkey, sizeof(char)*25);
211    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC);
212#endif
213}
214#endif
215
216#endif
217
218// MESSAGE CHANGE_OPERATOR_CONTROL UNPACKING
219
220
221/**
222 * @brief Get field target_system from change_operator_control message
223 *
224 * @return System the GCS requests control for
225 */
226static inline uint8_t mavlink_msg_change_operator_control_get_target_system(const mavlink_message_t* msg)
227{
228        return _MAV_RETURN_uint8_t(msg,  0);
229}
230
231/**
232 * @brief Get field control_request from change_operator_control message
233 *
234 * @return 0: request control of this MAV, 1: Release control of this MAV
235 */
236static inline uint8_t mavlink_msg_change_operator_control_get_control_request(const mavlink_message_t* msg)
237{
238        return _MAV_RETURN_uint8_t(msg,  1);
239}
240
241/**
242 * @brief Get field version from change_operator_control message
243 *
244 * @return 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
245 */
246static inline uint8_t mavlink_msg_change_operator_control_get_version(const mavlink_message_t* msg)
247{
248        return _MAV_RETURN_uint8_t(msg,  2);
249}
250
251/**
252 * @brief Get field passkey from change_operator_control message
253 *
254 * @return Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
255 */
256static inline uint16_t mavlink_msg_change_operator_control_get_passkey(const mavlink_message_t* msg, char *passkey)
257{
258        return _MAV_RETURN_char_array(msg, passkey, 25,  3);
259}
260
261/**
262 * @brief Decode a change_operator_control message into a struct
263 *
264 * @param msg The message to decode
265 * @param change_operator_control C-struct to decode the message contents into
266 */
267static inline void mavlink_msg_change_operator_control_decode(const mavlink_message_t* msg, mavlink_change_operator_control_t* change_operator_control)
268{
269#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
270        change_operator_control->target_system = mavlink_msg_change_operator_control_get_target_system(msg);
271        change_operator_control->control_request = mavlink_msg_change_operator_control_get_control_request(msg);
272        change_operator_control->version = mavlink_msg_change_operator_control_get_version(msg);
273        mavlink_msg_change_operator_control_get_passkey(msg, change_operator_control->passkey);
274#else
275        uint8_t len = msg->len < MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN;
276        memset(change_operator_control, 0, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
277        memcpy(change_operator_control, _MAV_PAYLOAD(msg), len);
278#endif
279}
Note: See TracBrowser for help on using the repository browser.