1 // MESSAGE AUTH_KEY PACKING
3 #define MAVLINK_MSG_ID_AUTH_KEY 7
5 typedef struct __mavlink_auth_key_t
{
9 #define MAVLINK_MSG_ID_AUTH_KEY_LEN 32
10 #define MAVLINK_MSG_ID_7_LEN 32
12 #define MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN 32
14 #define MAVLINK_MESSAGE_INFO_AUTH_KEY \
19 { "key", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_auth_key_t, key) }, \
25 * @brief Pack a auth_key message
26 * @param system_id ID of this system
27 * @param component_id ID of this component (e.g. 200 for IMU)
28 * @param msg The MAVLink message to compress the data into
31 * @return length of the message in bytes (excluding serial stream start sign)
33 static inline uint16_t mavlink_msg_auth_key_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
*msg
,
36 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
39 _mav_put_char_array(buf
, 0, key
, 32);
40 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, 32);
42 mavlink_auth_key_t packet
;
44 mav_array_memcpy(packet
.key
, key
, sizeof(char) * 32);
45 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, 32);
48 msg
->msgid
= MAVLINK_MSG_ID_AUTH_KEY
;
49 return mavlink_finalize_message(msg
, system_id
, component_id
, 32, 119);
53 * @brief Pack a auth_key message on a channel
54 * @param system_id ID of this system
55 * @param component_id ID of this component (e.g. 200 for IMU)
56 * @param chan The MAVLink channel this message was sent over
57 * @param msg The MAVLink message to compress the data into
59 * @return length of the message in bytes (excluding serial stream start sign)
61 static inline uint16_t mavlink_msg_auth_key_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
62 mavlink_message_t
*msg
,
65 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
68 _mav_put_char_array(buf
, 0, key
, 32);
69 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, 32);
71 mavlink_auth_key_t packet
;
73 mav_array_memcpy(packet
.key
, key
, sizeof(char) * 32);
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, 32);
77 msg
->msgid
= MAVLINK_MSG_ID_AUTH_KEY
;
78 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, 32, 119);
82 * @brief Encode a auth_key struct into a message
84 * @param system_id ID of this system
85 * @param component_id ID of this component (e.g. 200 for IMU)
86 * @param msg The MAVLink message to compress the data into
87 * @param auth_key C-struct to read the message contents from
89 static inline uint16_t mavlink_msg_auth_key_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
*msg
, const mavlink_auth_key_t
*auth_key
)
91 return mavlink_msg_auth_key_pack(system_id
, component_id
, msg
, auth_key
->key
);
95 * @brief Send a auth_key message
96 * @param chan MAVLink channel to send the message
100 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
102 static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan
, const char *key
)
104 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
107 _mav_put_char_array(buf
, 0, key
, 32);
108 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_AUTH_KEY
, buf
, 32, 119);
110 mavlink_auth_key_t packet
;
112 mav_array_memcpy(packet
.key
, key
, sizeof(char) * 32);
113 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_AUTH_KEY
, (const char *)&packet
, 32, 119);
119 // MESSAGE AUTH_KEY UNPACKING
123 * @brief Get field key from auth_key message
127 static inline uint16_t mavlink_msg_auth_key_get_key(const mavlink_message_t
*msg
, char *key
)
129 return _MAV_RETURN_char_array(msg
, key
, 32, 0);
133 * @brief Decode a auth_key message into a struct
135 * @param msg The message to decode
136 * @param auth_key C-struct to decode the message contents into
138 static inline void mavlink_msg_auth_key_decode(const mavlink_message_t
*msg
, mavlink_auth_key_t
*auth_key
)
140 #if MAVLINK_NEED_BYTE_SWAP
141 mavlink_msg_auth_key_get_key(msg
, auth_key
->key
);
143 memcpy(auth_key
, _MAV_PAYLOAD(msg
), 32);