Skip to content

Commit d7b5bb1

Browse files
authored
Guard WPA Enterprise support (#10616)
* Guard WPA Enterprise support * guard `WIFI_ENTERPRISE_SUPPORT` * wrong part guarded * fix guard start and end * add guard enterprise
1 parent f5ce3f7 commit d7b5bb1

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

libraries/WiFi/src/STA.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ bool STAClass::connect(const char *ssid, const char *passphrase, int32_t channel
421421
return true;
422422
}
423423

424+
#if CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT
424425
/**
425426
* Start Wifi connection with a WPA2 Enterprise AP
426427
* if passphrase is set the most secure supported mode will be automatically selected
@@ -519,6 +520,7 @@ bool STAClass::connect(
519520

520521
return connect(wpa2_ssid, NULL, channel, bssid, tryConnect); //connect to wifi
521522
}
523+
#endif /* CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT */
522524

523525
bool STAClass::disconnect(bool eraseap, unsigned long timeout) {
524526
if (eraseap) {

libraries/WiFi/src/WiFiSTA.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ wl_status_t WiFiSTAClass::status() {
6363
return STA.status();
6464
}
6565

66+
#if CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT
6667
wl_status_t WiFiSTAClass::begin(
6768
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,
6869
const char *client_crt, const char *client_key, int ttls_phase2_type, int32_t channel, const uint8_t *bssid, bool connect
@@ -77,6 +78,7 @@ wl_status_t WiFiSTAClass::begin(
7778

7879
return STA.status();
7980
}
81+
#endif /* CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT */
8082

8183
wl_status_t WiFiSTAClass::begin(const char *ssid, const char *passphrase, int32_t channel, const uint8_t *bssid, bool connect) {
8284
if (!STA.begin()) {

libraries/WiFi/src/WiFiSTA.h

+5
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ class STAClass : public NetworkInterface {
5454

5555
bool connect();
5656
bool connect(const char *ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t *bssid = NULL, bool connect = true);
57+
#if CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT
5758
bool connect(
5859
const char *wpa2_ssid, wpa2_auth_method_t method, const char *wpa2_identity = NULL, const char *wpa2_username = NULL, const char *wpa2_password = NULL,
5960
const char *ca_pem = NULL, const char *client_crt = NULL, const char *client_key = NULL, int ttls_phase2_type = -1, int32_t channel = 0,
6061
const uint8_t *bssid = 0, bool connect = true
6162
);
63+
#endif /* CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT */
6264
bool disconnect(bool eraseap = false, unsigned long timeout = 0);
6365
bool reconnect();
6466
bool erase();
@@ -109,6 +111,7 @@ class WiFiSTAClass {
109111
public:
110112
STAClass STA;
111113

114+
#if CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT
112115
wl_status_t begin(
113116
const char *wpa2_ssid, wpa2_auth_method_t method, const char *wpa2_identity = NULL, const char *wpa2_username = NULL, const char *wpa2_password = NULL,
114117
const char *ca_pem = NULL, const char *client_crt = NULL, const char *client_key = NULL, int ttls_phase2_type = -1, int32_t channel = 0,
@@ -124,6 +127,8 @@ class WiFiSTAClass {
124127
ttls_phase2_type, channel, bssid, connect
125128
);
126129
}
130+
#endif /* CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT */
131+
127132
wl_status_t begin(const char *ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t *bssid = NULL, bool connect = true);
128133
wl_status_t begin(const String &ssid, const String &passphrase = (const char *)NULL, int32_t channel = 0, const uint8_t *bssid = NULL, bool connect = true) {
129134
return begin(ssid.c_str(), passphrase.c_str(), channel, bssid, connect);

0 commit comments

Comments
 (0)