@@ -153,88 +153,6 @@ wl_status_t WiFiSTAClass::status()
153153 return (wl_status_t )xEventGroupClearBits (_sta_status_group, 0 );
154154}
155155
156- /* *
157- * Start Wifi connection with a WPA2 Enterprise AP
158- * if passphrase is set the most secure supported mode will be automatically selected
159- * @param ssid const char* Pointer to the SSID string.
160- * @param method wpa2_method_t The authentication method of WPA2 (WPA2_AUTH_TLS, WPA2_AUTH_PEAP, WPA2_AUTH_TTLS)
161- * @param wpa2_identity const char* Pointer to the entity
162- * @param wpa2_username const char* Pointer to the username
163- * @param password const char * Pointer to the password.
164- * @param ca_pem const char* Pointer to a string with the contents of a .pem file with CA cert
165- * @param client_crt const char* Pointer to a string with the contents of a .crt file with client cert
166- * @param client_key const char* Pointer to a string with the contants of a .key file with client key
167- * @param bssid uint8_t[6] Optional. BSSID / MAC of AP
168- * @param channel Optional. Channel of AP
169- * @param connect Optional. call connect
170- * @return
171- */
172- wl_status_t WiFiSTAClass::begin (const char * wpa2_ssid, wpa2_auth_method_t method, const char * wpa2_identity, const char * wpa2_username, const char *wpa2_password, const char * ca_pem, const char * client_crt, const char * client_key, int32_t channel, const uint8_t * bssid, bool connect)
173- {
174- if (!WiFi.enableSTA (true )) {
175- log_e (" STA enable failed!" );
176- return WL_CONNECT_FAILED;
177- }
178-
179- if (!wpa2_ssid || *wpa2_ssid == 0x00 || strlen (wpa2_ssid) > 32 ) {
180- log_e (" SSID too long or missing!" );
181- return WL_CONNECT_FAILED;
182- }
183-
184- if (wpa2_identity && strlen (wpa2_identity) > 64 ) {
185- log_e (" identity too long!" );
186- return WL_CONNECT_FAILED;
187- }
188-
189- if (wpa2_username && strlen (wpa2_username) > 64 ) {
190- log_e (" username too long!" );
191- return WL_CONNECT_FAILED;
192- }
193-
194- if (wpa2_password && strlen (wpa2_password) > 64 ) {
195- log_e (" password too long!" );
196- }
197-
198- if (ca_pem) {
199- #if __has_include ("esp_eap_client.h")
200- esp_eap_client_set_ca_cert ((uint8_t *)ca_pem, strlen (ca_pem));
201- #else
202- esp_wifi_sta_wpa2_ent_set_ca_cert ((uint8_t *)ca_pem, strlen (ca_pem));
203- #endif
204- }
205-
206- if (client_crt) {
207- #if __has_include ("esp_eap_client.h")
208- esp_eap_client_set_certificate_and_key ((uint8_t *)client_crt, strlen (client_crt), (uint8_t *)client_key, strlen (client_key), NULL , 0 );
209- #else
210- esp_wifi_sta_wpa2_ent_set_cert_key ((uint8_t *)client_crt, strlen (client_crt), (uint8_t *)client_key, strlen (client_key), NULL , 0 );
211- #endif
212- }
213-
214- #if __has_include ("esp_eap_client.h")
215- esp_eap_client_set_identity ((uint8_t *)wpa2_identity, strlen (wpa2_identity));
216- #else
217- esp_wifi_sta_wpa2_ent_set_identity ((uint8_t *)wpa2_identity, strlen (wpa2_identity));
218- #endif
219- if (method == WPA2_AUTH_PEAP || method == WPA2_AUTH_TTLS) {
220- #if __has_include ("esp_eap_client.h")
221- esp_eap_client_set_username ((uint8_t *)wpa2_username, strlen (wpa2_username));
222- esp_eap_client_set_password ((uint8_t *)wpa2_password, strlen (wpa2_password));
223- #else
224- esp_wifi_sta_wpa2_ent_set_username ((uint8_t *)wpa2_username, strlen (wpa2_username));
225- esp_wifi_sta_wpa2_ent_set_password ((uint8_t *)wpa2_password, strlen (wpa2_password));
226- #endif
227- }
228- #if __has_include ("esp_eap_client.h")
229- esp_wifi_sta_enterprise_enable (); // set config settings to enable function
230- #else
231- esp_wifi_sta_wpa2_ent_enable (); // set config settings to enable function
232- #endif
233- WiFi.begin (wpa2_ssid); // connect to wifi
234-
235- return status ();
236- }
237-
238156/* *
239157 * Start Wifi connection
240158 * if passphrase is set the most secure supported mode will be automatically selected
0 commit comments