Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / mavlink / v1.0 / common / mavlink_msg_change_operator_control.h
blobb519dcd4d19b8b4b71ac8c0300e5184904c57150
1 // MESSAGE CHANGE_OPERATOR_CONTROL PACKING
3 #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL 5
5 typedef struct __mavlink_change_operator_control_t {
6 uint8_t target_system; ///< System the GCS requests control for
7 uint8_t control_request; ///< 0: request control of this MAV, 1: Release control of this MAV
8 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.
9 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 "!?,.-"
10 } mavlink_change_operator_control_t;
12 #define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN 28
13 #define MAVLINK_MSG_ID_5_LEN 28
15 #define MAVLINK_MSG_CHANGE_OPERATOR_CONTROL_FIELD_PASSKEY_LEN 25
17 #define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL \
18 { \
19 "CHANGE_OPERATOR_CONTROL", \
20 4, \
21 { \
22 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_t, target_system) }, \
23 { "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_t, control_request) }, \
24 { "version", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_t, version) }, \
25 { "passkey", NULL, MAVLINK_TYPE_CHAR, 25, 3, offsetof(mavlink_change_operator_control_t, passkey) }, \
26 } \
30 /**
31 * @brief Pack a change_operator_control message
32 * @param system_id ID of this system
33 * @param component_id ID of this component (e.g. 200 for IMU)
34 * @param msg The MAVLink message to compress the data into
36 * @param target_system System the GCS requests control for
37 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
38 * @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.
39 * @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 "!?,.-"
40 * @return length of the message in bytes (excluding serial stream start sign)
42 static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg,
43 uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
45 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
46 char buf[28];
47 _mav_put_uint8_t(buf, 0, target_system);
48 _mav_put_uint8_t(buf, 1, control_request);
49 _mav_put_uint8_t(buf, 2, version);
50 _mav_put_char_array(buf, 3, passkey, 25);
51 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 28);
52 #else
53 mavlink_change_operator_control_t packet;
54 packet.target_system = target_system;
55 packet.control_request = control_request;
56 packet.version = version;
57 mav_array_memcpy(packet.passkey, passkey, sizeof(char) * 25);
58 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 28);
59 #endif
61 msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
62 return mavlink_finalize_message(msg, system_id, component_id, 28, 217);
65 /**
66 * @brief Pack a change_operator_control message on a channel
67 * @param system_id ID of this system
68 * @param component_id ID of this component (e.g. 200 for IMU)
69 * @param chan The MAVLink channel this message was sent over
70 * @param msg The MAVLink message to compress the data into
71 * @param target_system System the GCS requests control for
72 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
73 * @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.
74 * @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 "!?,.-"
75 * @return length of the message in bytes (excluding serial stream start sign)
77 static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
78 mavlink_message_t *msg,
79 uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
81 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
82 char buf[28];
83 _mav_put_uint8_t(buf, 0, target_system);
84 _mav_put_uint8_t(buf, 1, control_request);
85 _mav_put_uint8_t(buf, 2, version);
86 _mav_put_char_array(buf, 3, passkey, 25);
87 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 28);
88 #else
89 mavlink_change_operator_control_t packet;
90 packet.target_system = target_system;
91 packet.control_request = control_request;
92 packet.version = version;
93 mav_array_memcpy(packet.passkey, passkey, sizeof(char) * 25);
94 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 28);
95 #endif
97 msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
98 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 28, 217);
102 * @brief Encode a change_operator_control struct into a message
104 * @param system_id ID of this system
105 * @param component_id ID of this component (e.g. 200 for IMU)
106 * @param msg The MAVLink message to compress the data into
107 * @param change_operator_control C-struct to read the message contents from
109 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)
111 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);
115 * @brief Send a change_operator_control message
116 * @param chan MAVLink channel to send the message
118 * @param target_system System the GCS requests control for
119 * @param control_request 0: request control of this MAV, 1: Release control of this MAV
120 * @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.
121 * @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 "!?,.-"
123 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
125 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)
127 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
128 char buf[28];
129 _mav_put_uint8_t(buf, 0, target_system);
130 _mav_put_uint8_t(buf, 1, control_request);
131 _mav_put_uint8_t(buf, 2, version);
132 _mav_put_char_array(buf, 3, passkey, 25);
133 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, 28, 217);
134 #else
135 mavlink_change_operator_control_t packet;
136 packet.target_system = target_system;
137 packet.control_request = control_request;
138 packet.version = version;
139 mav_array_memcpy(packet.passkey, passkey, sizeof(char) * 25);
140 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)&packet, 28, 217);
141 #endif
144 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
146 // MESSAGE CHANGE_OPERATOR_CONTROL UNPACKING
150 * @brief Get field target_system from change_operator_control message
152 * @return System the GCS requests control for
154 static inline uint8_t mavlink_msg_change_operator_control_get_target_system(const mavlink_message_t *msg)
156 return _MAV_RETURN_uint8_t(msg, 0);
160 * @brief Get field control_request from change_operator_control message
162 * @return 0: request control of this MAV, 1: Release control of this MAV
164 static inline uint8_t mavlink_msg_change_operator_control_get_control_request(const mavlink_message_t *msg)
166 return _MAV_RETURN_uint8_t(msg, 1);
170 * @brief Get field version from change_operator_control message
172 * @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.
174 static inline uint8_t mavlink_msg_change_operator_control_get_version(const mavlink_message_t *msg)
176 return _MAV_RETURN_uint8_t(msg, 2);
180 * @brief Get field passkey from change_operator_control message
182 * @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 "!?,.-"
184 static inline uint16_t mavlink_msg_change_operator_control_get_passkey(const mavlink_message_t *msg, char *passkey)
186 return _MAV_RETURN_char_array(msg, passkey, 25, 3);
190 * @brief Decode a change_operator_control message into a struct
192 * @param msg The message to decode
193 * @param change_operator_control C-struct to decode the message contents into
195 static inline void mavlink_msg_change_operator_control_decode(const mavlink_message_t *msg, mavlink_change_operator_control_t *change_operator_control)
197 #if MAVLINK_NEED_BYTE_SWAP
198 change_operator_control->target_system = mavlink_msg_change_operator_control_get_target_system(msg);
199 change_operator_control->control_request = mavlink_msg_change_operator_control_get_control_request(msg);
200 change_operator_control->version = mavlink_msg_change_operator_control_get_version(msg);
201 mavlink_msg_change_operator_control_get_passkey(msg, change_operator_control->passkey);
202 #else
203 memcpy(change_operator_control, _MAV_PAYLOAD(msg), 28);
204 #endif