Merge pull request #10476 from radiolinkW/RADIOLINKF722
[inav.git] / lib / main / MAVLink / common / mavlink_msg_change_operator_control.h
blob8fea8d7837295261cb4515c73cd066b12331c49f
1 #pragma once
2 // MESSAGE CHANGE_OPERATOR_CONTROL PACKING
4 #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL 5
7 typedef struct __mavlink_change_operator_control_t {
8 uint8_t target_system; /*< System the GCS requests control for*/
9 uint8_t control_request; /*< 0: request control of this MAV, 1: Release control of this MAV*/
10 uint8_t version; /*< [rad] 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.*/
11 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 "!?,.-"*/
12 } mavlink_change_operator_control_t;
14 #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN 28
15 #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN 28
16 #define MAVLINK_MSG_ID_5_LEN 28
17 #define MAVLINK_MSG_ID_5_MIN_LEN 28
19 #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC 217
20 #define MAVLINK_MSG_ID_5_CRC 217
22 #define MAVLINK_MSG_CHANGE_OPERATOR_CONTROL_FIELD_PASSKEY_LEN 25
24 #if MAVLINK_COMMAND_24BIT
25 #define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL { \
26 5, \
27 "CHANGE_OPERATOR_CONTROL", \
28 4, \
29 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_t, target_system) }, \
30 { "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_t, control_request) }, \
31 { "version", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_t, version) }, \
32 { "passkey", NULL, MAVLINK_TYPE_CHAR, 25, 3, offsetof(mavlink_change_operator_control_t, passkey) }, \
33 } \
35 #else
36 #define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL { \
37 "CHANGE_OPERATOR_CONTROL", \
38 4, \
39 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_t, target_system) }, \
40 { "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_t, control_request) }, \
41 { "version", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_t, version) }, \
42 { "passkey", NULL, MAVLINK_TYPE_CHAR, 25, 3, offsetof(mavlink_change_operator_control_t, passkey) }, \
43 } \
45 #endif
47 /**
48 * @brief Pack a change_operator_control message
49 * @param system_id ID of this system
50 * @param component_id ID of this component (e.g. 200 for IMU)
51 * @param msg The MAVLink message to compress the data into
53 * @param target_system System the GCS requests control for
54 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
55 * @param version [rad] 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.
56 * @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 "!?,.-"
57 * @return length of the message in bytes (excluding serial stream start sign)
59 static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
60 uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
62 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
63 char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN];
64 _mav_put_uint8_t(buf, 0, target_system);
65 _mav_put_uint8_t(buf, 1, control_request);
66 _mav_put_uint8_t(buf, 2, version);
67 _mav_put_char_array(buf, 3, passkey, 25);
68 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
69 #else
70 mavlink_change_operator_control_t packet;
71 packet.target_system = target_system;
72 packet.control_request = control_request;
73 packet.version = version;
74 mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
75 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
76 #endif
78 msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
79 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);
82 /**
83 * @brief Pack a change_operator_control message on a channel
84 * @param system_id ID of this system
85 * @param component_id ID of this component (e.g. 200 for IMU)
86 * @param chan The MAVLink channel this message will be sent over
87 * @param msg The MAVLink message to compress the data into
88 * @param target_system System the GCS requests control for
89 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
90 * @param version [rad] 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.
91 * @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 "!?,.-"
92 * @return length of the message in bytes (excluding serial stream start sign)
94 static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
95 mavlink_message_t* msg,
96 uint8_t target_system,uint8_t control_request,uint8_t version,const char *passkey)
98 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
99 char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN];
100 _mav_put_uint8_t(buf, 0, target_system);
101 _mav_put_uint8_t(buf, 1, control_request);
102 _mav_put_uint8_t(buf, 2, version);
103 _mav_put_char_array(buf, 3, passkey, 25);
104 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
105 #else
106 mavlink_change_operator_control_t packet;
107 packet.target_system = target_system;
108 packet.control_request = control_request;
109 packet.version = version;
110 mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
111 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
112 #endif
114 msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
115 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);
119 * @brief Encode a change_operator_control struct
121 * @param system_id ID of this system
122 * @param component_id ID of this component (e.g. 200 for IMU)
123 * @param msg The MAVLink message to compress the data into
124 * @param change_operator_control C-struct to read the message contents from
126 static 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)
128 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);
132 * @brief Encode a change_operator_control struct on a channel
134 * @param system_id ID of this system
135 * @param component_id ID of this component (e.g. 200 for IMU)
136 * @param chan The MAVLink channel this message will be sent over
137 * @param msg The MAVLink message to compress the data into
138 * @param change_operator_control C-struct to read the message contents from
140 static 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)
142 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);
146 * @brief Send a change_operator_control message
147 * @param chan MAVLink channel to send the message
149 * @param target_system System the GCS requests control for
150 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
151 * @param version [rad] 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.
152 * @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 "!?,.-"
154 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
156 static 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)
158 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
159 char buf[MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN];
160 _mav_put_uint8_t(buf, 0, target_system);
161 _mav_put_uint8_t(buf, 1, control_request);
162 _mav_put_uint8_t(buf, 2, version);
163 _mav_put_char_array(buf, 3, passkey, 25);
164 _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);
165 #else
166 mavlink_change_operator_control_t packet;
167 packet.target_system = target_system;
168 packet.control_request = control_request;
169 packet.version = version;
170 mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
171 _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);
172 #endif
176 * @brief Send a change_operator_control message
177 * @param chan MAVLink channel to send the message
178 * @param struct The MAVLink struct to serialize
180 static inline void mavlink_msg_change_operator_control_send_struct(mavlink_channel_t chan, const mavlink_change_operator_control_t* change_operator_control)
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 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);
184 #else
185 _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);
186 #endif
189 #if MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
191 This varient of _send() can be used to save stack space by re-using
192 memory from the receive buffer. The caller provides a
193 mavlink_message_t which is the size of a full mavlink message. This
194 is usually the receive buffer for the channel, and allows a reply to an
195 incoming message with minimum stack space usage.
197 static 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)
199 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
200 char *buf = (char *)msgbuf;
201 _mav_put_uint8_t(buf, 0, target_system);
202 _mav_put_uint8_t(buf, 1, control_request);
203 _mav_put_uint8_t(buf, 2, version);
204 _mav_put_char_array(buf, 3, passkey, 25);
205 _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);
206 #else
207 mavlink_change_operator_control_t *packet = (mavlink_change_operator_control_t *)msgbuf;
208 packet->target_system = target_system;
209 packet->control_request = control_request;
210 packet->version = version;
211 mav_array_memcpy(packet->passkey, passkey, sizeof(char)*25);
212 _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);
213 #endif
215 #endif
217 #endif
219 // MESSAGE CHANGE_OPERATOR_CONTROL UNPACKING
223 * @brief Get field target_system from change_operator_control message
225 * @return System the GCS requests control for
227 static inline uint8_t mavlink_msg_change_operator_control_get_target_system(const mavlink_message_t* msg)
229 return _MAV_RETURN_uint8_t(msg, 0);
233 * @brief Get field control_request from change_operator_control message
235 * @return 0: request control of this MAV, 1: Release control of this MAV
237 static inline uint8_t mavlink_msg_change_operator_control_get_control_request(const mavlink_message_t* msg)
239 return _MAV_RETURN_uint8_t(msg, 1);
243 * @brief Get field version from change_operator_control message
245 * @return [rad] 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.
247 static inline uint8_t mavlink_msg_change_operator_control_get_version(const mavlink_message_t* msg)
249 return _MAV_RETURN_uint8_t(msg, 2);
253 * @brief Get field passkey from change_operator_control message
255 * @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 "!?,.-"
257 static inline uint16_t mavlink_msg_change_operator_control_get_passkey(const mavlink_message_t* msg, char *passkey)
259 return _MAV_RETURN_char_array(msg, passkey, 25, 3);
263 * @brief Decode a change_operator_control message into a struct
265 * @param msg The message to decode
266 * @param change_operator_control C-struct to decode the message contents into
268 static inline void mavlink_msg_change_operator_control_decode(const mavlink_message_t* msg, mavlink_change_operator_control_t* change_operator_control)
270 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
271 change_operator_control->target_system = mavlink_msg_change_operator_control_get_target_system(msg);
272 change_operator_control->control_request = mavlink_msg_change_operator_control_get_control_request(msg);
273 change_operator_control->version = mavlink_msg_change_operator_control_get_version(msg);
274 mavlink_msg_change_operator_control_get_passkey(msg, change_operator_control->passkey);
275 #else
276 uint8_t len = msg->len < MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN;
277 memset(change_operator_control, 0, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
278 memcpy(change_operator_control, _MAV_PAYLOAD(msg), len);
279 #endif