RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_wifi_config_ap.h
1#pragma once
2// MESSAGE WIFI_CONFIG_AP PACKING
3
4#define MAVLINK_MSG_ID_WIFI_CONFIG_AP 299
5
6MAVPACKED(
7typedef struct __mavlink_wifi_config_ap_t {
8 char ssid[32]; /*< Name of Wi-Fi network (SSID). Leave it blank to leave it unchanged.*/
9 char password[64]; /*< Password. Leave it blank for an open AP.*/
10}) mavlink_wifi_config_ap_t;
11
12#define MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN 96
13#define MAVLINK_MSG_ID_WIFI_CONFIG_AP_MIN_LEN 96
14#define MAVLINK_MSG_ID_299_LEN 96
15#define MAVLINK_MSG_ID_299_MIN_LEN 96
16
17#define MAVLINK_MSG_ID_WIFI_CONFIG_AP_CRC 19
18#define MAVLINK_MSG_ID_299_CRC 19
19
20#define MAVLINK_MSG_WIFI_CONFIG_AP_FIELD_SSID_LEN 32
21#define MAVLINK_MSG_WIFI_CONFIG_AP_FIELD_PASSWORD_LEN 64
22
23#if MAVLINK_COMMAND_24BIT
24#define MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP { \
25 299, \
26 "WIFI_CONFIG_AP", \
27 2, \
28 { { "ssid", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_wifi_config_ap_t, ssid) }, \
29 { "password", NULL, MAVLINK_TYPE_CHAR, 64, 32, offsetof(mavlink_wifi_config_ap_t, password) }, \
30 } \
31}
32#else
33#define MAVLINK_MESSAGE_INFO_WIFI_CONFIG_AP { \
34 "WIFI_CONFIG_AP", \
35 2, \
36 { { "ssid", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_wifi_config_ap_t, ssid) }, \
37 { "password", NULL, MAVLINK_TYPE_CHAR, 64, 32, offsetof(mavlink_wifi_config_ap_t, password) }, \
38 } \
39}
40#endif
41
42/**
43 * @brief Pack a wifi_config_ap message
44 * @param system_id ID of this system
45 * @param component_id ID of this component (e.g. 200 for IMU)
46 * @param msg The MAVLink message to compress the data into
47 *
48 * @param ssid Name of Wi-Fi network (SSID). Leave it blank to leave it unchanged.
49 * @param password Password. Leave it blank for an open AP.
50 * @return length of the message in bytes (excluding serial stream start sign)
51 */
52static inline uint16_t mavlink_msg_wifi_config_ap_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
53 const char *ssid, const char *password)
54{
55#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
56 char buf[MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN];
57
58 _mav_put_char_array(buf, 0, ssid, 32);
59 _mav_put_char_array(buf, 32, password, 64);
60 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN);
61#else
62 mavlink_wifi_config_ap_t packet;
63
64 mav_array_memcpy(packet.ssid, ssid, sizeof(char)*32);
65 mav_array_memcpy(packet.password, password, sizeof(char)*64);
66 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN);
67#endif
68
69 msg->msgid = MAVLINK_MSG_ID_WIFI_CONFIG_AP;
70 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);
71}
72
73/**
74 * @brief Pack a wifi_config_ap message on a channel
75 * @param system_id ID of this system
76 * @param component_id ID of this component (e.g. 200 for IMU)
77 * @param chan The MAVLink channel this message will be sent over
78 * @param msg The MAVLink message to compress the data into
79 * @param ssid Name of Wi-Fi network (SSID). Leave it blank to leave it unchanged.
80 * @param password Password. Leave it blank for an open AP.
81 * @return length of the message in bytes (excluding serial stream start sign)
82 */
83static inline uint16_t mavlink_msg_wifi_config_ap_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
84 mavlink_message_t* msg,
85 const char *ssid,const char *password)
86{
87#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
88 char buf[MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN];
89
90 _mav_put_char_array(buf, 0, ssid, 32);
91 _mav_put_char_array(buf, 32, password, 64);
92 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN);
93#else
94 mavlink_wifi_config_ap_t packet;
95
96 mav_array_memcpy(packet.ssid, ssid, sizeof(char)*32);
97 mav_array_memcpy(packet.password, password, sizeof(char)*64);
98 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN);
99#endif
100
101 msg->msgid = MAVLINK_MSG_ID_WIFI_CONFIG_AP;
102 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);
103}
104
105/**
106 * @brief Encode a wifi_config_ap struct
107 *
108 * @param system_id ID of this system
109 * @param component_id ID of this component (e.g. 200 for IMU)
110 * @param msg The MAVLink message to compress the data into
111 * @param wifi_config_ap C-struct to read the message contents from
112 */
113static 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)
114{
115 return mavlink_msg_wifi_config_ap_pack(system_id, component_id, msg, wifi_config_ap->ssid, wifi_config_ap->password);
116}
117
118/**
119 * @brief Encode a wifi_config_ap struct on a channel
120 *
121 * @param system_id ID of this system
122 * @param component_id ID of this component (e.g. 200 for IMU)
123 * @param chan The MAVLink channel this message will be sent over
124 * @param msg The MAVLink message to compress the data into
125 * @param wifi_config_ap C-struct to read the message contents from
126 */
127static 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)
128{
129 return mavlink_msg_wifi_config_ap_pack_chan(system_id, component_id, chan, msg, wifi_config_ap->ssid, wifi_config_ap->password);
130}
131
132/**
133 * @brief Send a wifi_config_ap message
134 * @param chan MAVLink channel to send the message
135 *
136 * @param ssid Name of Wi-Fi network (SSID). Leave it blank to leave it unchanged.
137 * @param password Password. Leave it blank for an open AP.
138 */
139#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
140
141static inline void mavlink_msg_wifi_config_ap_send(mavlink_channel_t chan, const char *ssid, const char *password)
142{
143#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
144 char buf[MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN];
145
146 _mav_put_char_array(buf, 0, ssid, 32);
147 _mav_put_char_array(buf, 32, password, 64);
148 _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);
149#else
150 mavlink_wifi_config_ap_t packet;
151
152 mav_array_memcpy(packet.ssid, ssid, sizeof(char)*32);
153 mav_array_memcpy(packet.password, password, sizeof(char)*64);
154 _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);
155#endif
156}
157
158/**
159 * @brief Send a wifi_config_ap message
160 * @param chan MAVLink channel to send the message
161 * @param struct The MAVLink struct to serialize
162 */
163static inline void mavlink_msg_wifi_config_ap_send_struct(mavlink_channel_t chan, const mavlink_wifi_config_ap_t* wifi_config_ap)
164{
165#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
166 mavlink_msg_wifi_config_ap_send(chan, wifi_config_ap->ssid, wifi_config_ap->password);
167#else
168 _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);
169#endif
170}
171
172#if MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN <= MAVLINK_MAX_PAYLOAD_LEN
173/*
174 This varient of _send() can be used to save stack space by re-using
175 memory from the receive buffer. The caller provides a
176 mavlink_message_t which is the size of a full mavlink message. This
177 is usually the receive buffer for the channel, and allows a reply to an
178 incoming message with minimum stack space usage.
179 */
180static inline void mavlink_msg_wifi_config_ap_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const char *ssid, const char *password)
181{
182#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 char *buf = (char *)msgbuf;
184
185 _mav_put_char_array(buf, 0, ssid, 32);
186 _mav_put_char_array(buf, 32, password, 64);
187 _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);
188#else
189 mavlink_wifi_config_ap_t *packet = (mavlink_wifi_config_ap_t *)msgbuf;
190
191 mav_array_memcpy(packet->ssid, ssid, sizeof(char)*32);
192 mav_array_memcpy(packet->password, password, sizeof(char)*64);
193 _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);
194#endif
195}
196#endif
197
198#endif
199
200// MESSAGE WIFI_CONFIG_AP UNPACKING
201
202
203/**
204 * @brief Get field ssid from wifi_config_ap message
205 *
206 * @return Name of Wi-Fi network (SSID). Leave it blank to leave it unchanged.
207 */
208static inline uint16_t mavlink_msg_wifi_config_ap_get_ssid(const mavlink_message_t* msg, char *ssid)
209{
210 return _MAV_RETURN_char_array(msg, ssid, 32, 0);
211}
212
213/**
214 * @brief Get field password from wifi_config_ap message
215 *
216 * @return Password. Leave it blank for an open AP.
217 */
218static inline uint16_t mavlink_msg_wifi_config_ap_get_password(const mavlink_message_t* msg, char *password)
219{
220 return _MAV_RETURN_char_array(msg, password, 64, 32);
221}
222
223/**
224 * @brief Decode a wifi_config_ap message into a struct
225 *
226 * @param msg The message to decode
227 * @param wifi_config_ap C-struct to decode the message contents into
228 */
229static inline void mavlink_msg_wifi_config_ap_decode(const mavlink_message_t* msg, mavlink_wifi_config_ap_t* wifi_config_ap)
230{
231#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
232 mavlink_msg_wifi_config_ap_get_ssid(msg, wifi_config_ap->ssid);
233 mavlink_msg_wifi_config_ap_get_password(msg, wifi_config_ap->password);
234#else
235 uint8_t len = msg->len < MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN? msg->len : MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN;
236 memset(wifi_config_ap, 0, MAVLINK_MSG_ID_WIFI_CONFIG_AP_LEN);
237 memcpy(wifi_config_ap, _MAV_PAYLOAD(msg), len);
238#endif
239}