mavlink_msg_change_operator_control.h
Go to the documentation of this file.
1 // MESSAGE CHANGE_OPERATOR_CONTROL PACKING
2 
3 #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL 5
4 
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 "!?,.-"*/
12 
13 #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN 28
14 #define MAVLINK_MSG_ID_5_LEN 28
15 
16 #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_CRC 217
17 #define MAVLINK_MSG_ID_5_CRC 217
18 
19 #define MAVLINK_MSG_CHANGE_OPERATOR_CONTROL_FIELD_PASSKEY_LEN 25
20 
21 #define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL { \
22  "CHANGE_OPERATOR_CONTROL", \
23  4, \
24  { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_t, target_system) }, \
25  { "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_t, control_request) }, \
26  { "version", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_t, version) }, \
27  { "passkey", NULL, MAVLINK_TYPE_CHAR, 25, 3, offsetof(mavlink_change_operator_control_t, passkey) }, \
28  } \
29 }
30 
31 
44 static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
45  uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
46 {
47 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
49  _mav_put_uint8_t(buf, 0, target_system);
50  _mav_put_uint8_t(buf, 1, control_request);
51  _mav_put_uint8_t(buf, 2, version);
52  _mav_put_char_array(buf, 3, passkey, 25);
54 #else
58  packet.version = version;
59  mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
61 #endif
62 
64 #if MAVLINK_CRC_EXTRA
66 #else
67  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
68 #endif
69 }
70 
83 static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
84  mavlink_message_t* msg,
85  uint8_t target_system,uint8_t control_request,uint8_t version,const char *passkey)
86 {
87 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
89  _mav_put_uint8_t(buf, 0, target_system);
90  _mav_put_uint8_t(buf, 1, control_request);
91  _mav_put_uint8_t(buf, 2, version);
92  _mav_put_char_array(buf, 3, passkey, 25);
94 #else
98  packet.version = version;
99  mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
101 #endif
102 
104 #if MAVLINK_CRC_EXTRA
106 #else
107  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
108 #endif
109 }
110 
119 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)
120 {
121  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);
122 }
123 
133 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)
134 {
135  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);
136 }
137 
147 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
148 
149 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)
150 {
151 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
155  _mav_put_uint8_t(buf, 2, version);
156  _mav_put_char_array(buf, 3, passkey, 25);
157 #if MAVLINK_CRC_EXTRA
159 #else
160  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
161 #endif
162 #else
164  packet.target_system = target_system;
166  packet.version = version;
167  mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
168 #if MAVLINK_CRC_EXTRA
170 #else
171  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
172 #endif
173 #endif
174 }
175 
176 #if MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
177 /*
178  This varient of _send() can be used to save stack space by re-using
179  memory from the receive buffer. The caller provides a
180  mavlink_message_t which is the size of a full mavlink message. This
181  is usually the receive buffer for the channel, and allows a reply to an
182  incoming message with minimum stack space usage.
183  */
184 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)
185 {
186 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
187  char *buf = (char *)msgbuf;
190  _mav_put_uint8_t(buf, 2, version);
191  _mav_put_char_array(buf, 3, passkey, 25);
192 #if MAVLINK_CRC_EXTRA
194 #else
195  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
196 #endif
197 #else
199  packet->target_system = target_system;
201  packet->version = version;
202  mav_array_memcpy(packet->passkey, passkey, sizeof(char)*25);
203 #if MAVLINK_CRC_EXTRA
205 #else
206  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)packet, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
207 #endif
208 #endif
209 }
210 #endif
211 
212 #endif
213 
214 // MESSAGE CHANGE_OPERATOR_CONTROL UNPACKING
215 
216 
222 static inline uint8_t mavlink_msg_change_operator_control_get_target_system(const mavlink_message_t* msg)
223 {
224  return _MAV_RETURN_uint8_t(msg, 0);
225 }
226 
232 static inline uint8_t mavlink_msg_change_operator_control_get_control_request(const mavlink_message_t* msg)
233 {
234  return _MAV_RETURN_uint8_t(msg, 1);
235 }
236 
242 static inline uint8_t mavlink_msg_change_operator_control_get_version(const mavlink_message_t* msg)
243 {
244  return _MAV_RETURN_uint8_t(msg, 2);
245 }
246 
252 static inline uint16_t mavlink_msg_change_operator_control_get_passkey(const mavlink_message_t* msg, char *passkey)
253 {
254  return _MAV_RETURN_char_array(msg, passkey, 25, 3);
255 }
256 
263 static inline void mavlink_msg_change_operator_control_decode(const mavlink_message_t* msg, mavlink_change_operator_control_t* change_operator_control)
264 {
265 #if MAVLINK_NEED_BYTE_SWAP
268  change_operator_control->version = mavlink_msg_change_operator_control_get_version(msg);
269  mavlink_msg_change_operator_control_get_passkey(msg, change_operator_control->passkey);
270 #else
271  memcpy(change_operator_control, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN);
272 #endif
273 }
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176
static uint16_t _MAV_RETURN_char_array(const mavlink_message_t *msg, char *value, uint8_t array_length, uint8_t wire_offset)
Definition: protocol.h:288
static void _mav_put_char_array(char *buf, uint8_t wire_offset, const char *b, uint8_t array_length)
Definition: protocol.h:188


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:46