Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_wifi_config_ap.h
blobf5abc2473b2abbe2c282e8aec2bfd7f9b0f390aa
1 #pragma once
2 // MESSAGE WIFI_CONFIG_AP PACKING
4 #define MAVLINK_MSG_ID_WIFI_CONFIG_AP 299
7 typedef struct __mavlink_wifi_config_ap_t {
8 char ssid[32]; /*< Name of Wi-Fi network (SSID). Blank to leave it unchanged when setting. Current SSID when sent back as a response.*/
9 char password[64]; /*< Password. Blank for an open AP. MD5 hash when message is sent back as a response.*/
10 int8_t mode; /*< WiFi Mode.*/
11 int8_t response; /*< Message acceptance response (sent back to GS).*/
12 } mavlink_wifi_config_ap_t;
14 #define MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN 98
15 #define MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN 96
16 #define MAVLINK_MSG_ID_299_LEN 98
17 #define MAVLINK_MSG_ID_299_MIN_LEN 96
19 #define MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC 19
20 #define MAVLINK_MSG_ID_299_CRC 19
22 #define MAVLINK_MSG_WIFI_CONFIG_AP_FIELD_SSID_LEN 32
23 #define MAVLINK_MSG_WIFI_CONFIG_AP_FIELD_PASSWORD_LEN 64
25 #if MAVLINK_COMMAND_24BIT
26 #define MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP { \
27 299, \
28 "WIFI_CONFIG_AP", \
29 4, \
30 { { "ssid", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_wifi_config_ap_t, ssid) }, \
31 { "password", NULL, MAVLINK_TYPE_CHAR, 64, 32, offsetof(mavlink_wifi_config_ap_t, password) }, \
32 { "mode", NULL, MAVLINK_TYPE_INT8_T, 0, 96, offsetof(mavlink_wifi_config_ap_t, mode) }, \
33 { "response", NULL, MAVLINK_TYPE_INT8_T, 0, 97, offsetof(mavlink_wifi_config_ap_t, response) }, \
34 } \
36 #else
37 #define MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP { \
38 "WIFI_CONFIG_AP", \
39 4, \
40 { { "ssid", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_wifi_config_ap_t, ssid) }, \
41 { "password", NULL, MAVLINK_TYPE_CHAR, 64, 32, offsetof(mavlink_wifi_config_ap_t, password) }, \
42 { "mode", NULL, MAVLINK_TYPE_INT8_T, 0, 96, offsetof(mavlink_wifi_config_ap_t, mode) }, \
43 { "response", NULL, MAVLINK_TYPE_INT8_T, 0, 97, offsetof(mavlink_wifi_config_ap_t, response) }, \
44 } \
46 #endif
48 /**
49 * @brief Pack a wifi_config_ap message
50 * @param system_id ID of this system
51 * @param component_id ID of this component (e.g. 200 for IMU)
52 * @param msg The MAVLink message to compress the data into
54 * @param ssid Name of Wi-Fi network (SSID). Blank to leave it unchanged when setting. Current SSID when sent back as a response.
55 * @param password Password. Blank for an open AP. MD5 hash when message is sent back as a response.
56 * @param mode WiFi Mode.
57 * @param response Message acceptance response (sent back to GS).
58 * @return length of the message in bytes (excluding serial stream start sign)
60 static inline uint16_t mavlink_msg_wifi_config_ap_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
61 const char *ssid, const char *password, int8_t mode, int8_t response)
63 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
64 char buf[MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN];
65 _mav_put_int8_t(buf, 96, mode);
66 _mav_put_int8_t(buf, 97, response);
67 _mav_put_char_array(buf, 0, ssid, 32);
68 _mav_put_char_array(buf, 32, password, 64);
69 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN);
70 #else
71 mavlink_wifi_config_ap_t packet;
72 packet.mode = mode;
73 packet.response = response;
74 mav_array_memcpy(packet.ssid, ssid, sizeof(char)*32);
75 mav_array_memcpy(packet.password, password, sizeof(char)*64);
76 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN);
77 #endif
79 msg->msgid = MAVLINK_MSG_ID_WIFI_CONFIG_AP;
80 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC);
83 /**
84 * @brief Pack a wifi_config_ap message on a channel
85 * @param system_id ID of this system
86 * @param component_id ID of this component (e.g. 200 for IMU)
87 * @param chan The MAVLink channel this message will be sent over
88 * @param msg The MAVLink message to compress the data into
89 * @param ssid Name of Wi-Fi network (SSID). Blank to leave it unchanged when setting. Current SSID when sent back as a response.
90 * @param password Password. Blank for an open AP. MD5 hash when message is sent back as a response.
91 * @param mode WiFi Mode.
92 * @param response Message acceptance response (sent back to GS).
93 * @return length of the message in bytes (excluding serial stream start sign)
95 static inline uint16_t mavlink_msg_wifi_config_ap_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
96 mavlink_message_t* msg,
97 const char *ssid,const char *password,int8_t mode,int8_t response)
99 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
100 char buf[MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN];
101 _mav_put_int8_t(buf, 96, mode);
102 _mav_put_int8_t(buf, 97, response);
103 _mav_put_char_array(buf, 0, ssid, 32);
104 _mav_put_char_array(buf, 32, password, 64);
105 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN);
106 #else
107 mavlink_wifi_config_ap_t packet;
108 packet.mode = mode;
109 packet.response = response;
110 mav_array_memcpy(packet.ssid, ssid, sizeof(char)*32);
111 mav_array_memcpy(packet.password, password, sizeof(char)*64);
112 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN);
113 #endif
115 msg->msgid = MAVLINK_MSG_ID_WIFI_CONFIG_AP;
116 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC);
120 * @brief Encode a wifi_config_ap struct
122 * @param system_id ID of this system
123 * @param component_id ID of this component (e.g. 200 for IMU)
124 * @param msg The MAVLink message to compress the data into
125 * @param wifi_config_ap C-struct to read the message contents from
127 static inline uint16_t mavlink_msg_wifi_config_ap_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_wifi_config_ap_t* wifi_config_ap)
129 return mavlink_msg_wifi_config_ap_pack(system_id, component_id, msg, wifi_config_ap->ssid, wifi_config_ap->password, wifi_config_ap->mode, wifi_config_ap->response);
133 * @brief Encode a wifi_config_ap struct on a channel
135 * @param system_id ID of this system
136 * @param component_id ID of this component (e.g. 200 for IMU)
137 * @param chan The MAVLink channel this message will be sent over
138 * @param msg The MAVLink message to compress the data into
139 * @param wifi_config_ap C-struct to read the message contents from
141 static inline uint16_t mavlink_msg_wifi_config_ap_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_wifi_config_ap_t* wifi_config_ap)
143 return mavlink_msg_wifi_config_ap_pack_chan(system_id, component_id, chan, msg, wifi_config_ap->ssid, wifi_config_ap->password, wifi_config_ap->mode, wifi_config_ap->response);
147 * @brief Send a wifi_config_ap message
148 * @param chan MAVLink channel to send the message
150 * @param ssid Name of Wi-Fi network (SSID). Blank to leave it unchanged when setting. Current SSID when sent back as a response.
151 * @param password Password. Blank for an open AP. MD5 hash when message is sent back as a response.
152 * @param mode WiFi Mode.
153 * @param response Message acceptance response (sent back to GS).
155 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
157 static inline void mavlink_msg_wifi_config_ap_send(mavlink_channel_t chan, const char *ssid, const char *password, int8_t mode, int8_t response)
159 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
160 char buf[MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN];
161 _mav_put_int8_t(buf, 96, mode);
162 _mav_put_int8_t(buf, 97, response);
163 _mav_put_char_array(buf, 0, ssid, 32);
164 _mav_put_char_array(buf, 32, password, 64);
165 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIFI_CONFIG_AP, buf, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC);
166 #else
167 mavlink_wifi_config_ap_t packet;
168 packet.mode = mode;
169 packet.response = response;
170 mav_array_memcpy(packet.ssid, ssid, sizeof(char)*32);
171 mav_array_memcpy(packet.password, password, sizeof(char)*64);
172 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIFI_CONFIG_AP, (const char *)&packet, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC);
173 #endif
177 * @brief Send a wifi_config_ap message
178 * @param chan MAVLink channel to send the message
179 * @param struct The MAVLink struct to serialize
181 static inline void mavlink_msg_wifi_config_ap_send_struct(mavlink_channel_t chan, const mavlink_wifi_config_ap_t* wifi_config_ap)
183 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184 mavlink_msg_wifi_config_ap_send(chan, wifi_config_ap->ssid, wifi_config_ap->password, wifi_config_ap->mode, wifi_config_ap->response);
185 #else
186 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIFI_CONFIG_AP, (const char *)wifi_config_ap, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC);
187 #endif
190 #if MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN <= MAVLINK_MAX_PAYLOAD_LEN
192 This varient of _send() can be used to save stack space by re-using
193 memory from the receive buffer. The caller provides a
194 mavlink_message_t which is the size of a full mavlink message. This
195 is usually the receive buffer for the channel, and allows a reply to an
196 incoming message with minimum stack space usage.
198 static inline void mavlink_msg_wifi_config_ap_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const char *ssid, const char *password, int8_t mode, int8_t response)
200 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
201 char *buf = (char *)msgbuf;
202 _mav_put_int8_t(buf, 96, mode);
203 _mav_put_int8_t(buf, 97, response);
204 _mav_put_char_array(buf, 0, ssid, 32);
205 _mav_put_char_array(buf, 32, password, 64);
206 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIFI_CONFIG_AP, buf, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC);
207 #else
208 mavlink_wifi_config_ap_t *packet = (mavlink_wifi_config_ap_t *)msgbuf;
209 packet->mode = mode;
210 packet->response = response;
211 mav_array_memcpy(packet->ssid, ssid, sizeof(char)*32);
212 mav_array_memcpy(packet->password, password, sizeof(char)*64);
213 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WIFI_CONFIG_AP, (const char *)packet, MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN, MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC);
214 #endif
216 #endif
218 #endif
220 // MESSAGE WIFI_CONFIG_AP UNPACKING
224 * @brief Get field ssid from wifi_config_ap message
226 * @return Name of Wi-Fi network (SSID). Blank to leave it unchanged when setting. Current SSID when sent back as a response.
228 static inline uint16_t mavlink_msg_wifi_config_ap_get_ssid(const mavlink_message_t* msg, char *ssid)
230 return _MAV_RETURN_char_array(msg, ssid, 32, 0);
234 * @brief Get field password from wifi_config_ap message
236 * @return Password. Blank for an open AP. MD5 hash when message is sent back as a response.
238 static inline uint16_t mavlink_msg_wifi_config_ap_get_password(const mavlink_message_t* msg, char *password)
240 return _MAV_RETURN_char_array(msg, password, 64, 32);
244 * @brief Get field mode from wifi_config_ap message
246 * @return WiFi Mode.
248 static inline int8_t mavlink_msg_wifi_config_ap_get_mode(const mavlink_message_t* msg)
250 return _MAV_RETURN_int8_t(msg, 96);
254 * @brief Get field response from wifi_config_ap message
256 * @return Message acceptance response (sent back to GS).
258 static inline int8_t mavlink_msg_wifi_config_ap_get_response(const mavlink_message_t* msg)
260 return _MAV_RETURN_int8_t(msg, 97);
264 * @brief Decode a wifi_config_ap message into a struct
266 * @param msg The message to decode
267 * @param wifi_config_ap C-struct to decode the message contents into
269 static inline void mavlink_msg_wifi_config_ap_decode(const mavlink_message_t* msg, mavlink_wifi_config_ap_t* wifi_config_ap)
271 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
272 mavlink_msg_wifi_config_ap_get_ssid(msg, wifi_config_ap->ssid);
273 mavlink_msg_wifi_config_ap_get_password(msg, wifi_config_ap->password);
274 wifi_config_ap->mode = mavlink_msg_wifi_config_ap_get_mode(msg);
275 wifi_config_ap->response = mavlink_msg_wifi_config_ap_get_response(msg);
276 #else
277 uint8_t len = msg->len < MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN? msg->len : MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN;
278 memset(wifi_config_ap, 0, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN);
279 memcpy(wifi_config_ap, _MAV_PAYLOAD(msg), len);
280 #endif