Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
356e738e
Unverified
Commit
356e738e
authored
May 15, 2024
by
Me No Dev
Committed by
GitHub
May 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for specifying a WPA2 EAP-TTLS phase 2 method to WiFi.begin (#9639)
parent
f6cbea13
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
libraries/WiFi/src/STA.cpp
libraries/WiFi/src/STA.cpp
+10
-2
libraries/WiFi/src/WiFiSTA.cpp
libraries/WiFi/src/WiFiSTA.cpp
+2
-2
libraries/WiFi/src/WiFiSTA.h
libraries/WiFi/src/WiFiSTA.h
+6
-4
No files found.
libraries/WiFi/src/STA.cpp
View file @
356e738e
...
...
@@ -433,7 +433,7 @@ bool STAClass::connect(const char *ssid, const char *passphrase, int32_t channel
*/
bool
STAClass
::
connect
(
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
tryConnect
const
char
*
client_crt
,
const
char
*
client_key
,
int
ttls_phase2_type
,
int
32_t
channel
,
const
uint8_t
*
bssid
,
bool
tryConnect
)
{
if
(
_esp_netif
==
NULL
)
{
log_e
(
"STA not started! You must call begin() first."
);
...
...
@@ -467,6 +467,14 @@ bool STAClass::connect(
return
false
;
}
if
(
ttls_phase2_type
>=
0
)
{
#if __has_include("esp_eap_client.h")
esp_eap_client_set_ttls_phase2_method
((
esp_eap_ttls_phase2_types
)
ttls_phase2_type
);
#else
esp_wifi_sta_wpa2_ent_set_ttls_phase2_method
((
esp_eap_ttls_phase2_types
)
ttls_phase2_type
);
#endif
}
if
(
ca_pem
)
{
#if __has_include("esp_eap_client.h")
esp_eap_client_set_ca_cert
((
uint8_t
*
)
ca_pem
,
strlen
(
ca_pem
));
...
...
@@ -503,7 +511,7 @@ bool STAClass::connect(
esp_wifi_sta_wpa2_ent_enable
();
//set config settings to enable function
#endif
return
connect
(
wpa2_ssid
,
NULL
,
0
,
NULL
,
tryConnect
);
//connect to wifi
return
connect
(
wpa2_ssid
,
NULL
,
channel
,
bssid
,
tryConnect
);
//connect to wifi
}
bool
STAClass
::
disconnect
(
bool
eraseap
,
unsigned
long
timeout
)
{
...
...
libraries/WiFi/src/WiFiSTA.cpp
View file @
356e738e
...
...
@@ -65,13 +65,13 @@ wl_status_t WiFiSTAClass::status() {
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
const
char
*
client_crt
,
const
char
*
client_key
,
int
ttls_phase2_type
,
int
32_t
channel
,
const
uint8_t
*
bssid
,
bool
connect
)
{
if
(
!
STA
.
begin
())
{
return
WL_CONNECT_FAILED
;
}
if
(
!
STA
.
connect
(
wpa2_ssid
,
method
,
wpa2_identity
,
wpa2_username
,
wpa2_password
,
ca_pem
,
client_crt
,
client_key
,
channel
,
bssid
,
connect
))
{
if
(
!
STA
.
connect
(
wpa2_ssid
,
method
,
wpa2_identity
,
wpa2_username
,
wpa2_password
,
ca_pem
,
client_crt
,
client_key
,
ttls_phase2_type
,
channel
,
bssid
,
connect
))
{
return
WL_CONNECT_FAILED
;
}
...
...
libraries/WiFi/src/WiFiSTA.h
View file @
356e738e
...
...
@@ -55,7 +55,8 @@ public:
bool
connect
(
const
char
*
ssid
,
const
char
*
passphrase
=
NULL
,
int32_t
channel
=
0
,
const
uint8_t
*
bssid
=
NULL
,
bool
connect
=
true
);
bool
connect
(
const
char
*
wpa2_ssid
,
wpa2_auth_method_t
method
,
const
char
*
wpa2_identity
=
NULL
,
const
char
*
wpa2_username
=
NULL
,
const
char
*
wpa2_password
=
NULL
,
const
char
*
ca_pem
=
NULL
,
const
char
*
client_crt
=
NULL
,
const
char
*
client_key
=
NULL
,
int32_t
channel
=
0
,
const
uint8_t
*
bssid
=
0
,
bool
connect
=
true
const
char
*
ca_pem
=
NULL
,
const
char
*
client_crt
=
NULL
,
const
char
*
client_key
=
NULL
,
int
ttls_phase2_type
=
-
1
,
int32_t
channel
=
0
,
const
uint8_t
*
bssid
=
0
,
bool
connect
=
true
);
bool
disconnect
(
bool
eraseap
=
false
,
unsigned
long
timeout
=
0
);
bool
reconnect
();
...
...
@@ -109,16 +110,17 @@ public:
wl_status_t
begin
(
const
char
*
wpa2_ssid
,
wpa2_auth_method_t
method
,
const
char
*
wpa2_identity
=
NULL
,
const
char
*
wpa2_username
=
NULL
,
const
char
*
wpa2_password
=
NULL
,
const
char
*
ca_pem
=
NULL
,
const
char
*
client_crt
=
NULL
,
const
char
*
client_key
=
NULL
,
int32_t
channel
=
0
,
const
uint8_t
*
bssid
=
0
,
bool
connect
=
true
const
char
*
ca_pem
=
NULL
,
const
char
*
client_crt
=
NULL
,
const
char
*
client_key
=
NULL
,
int
ttls_phase2_type
=
-
1
,
int32_t
channel
=
0
,
const
uint8_t
*
bssid
=
0
,
bool
connect
=
true
);
wl_status_t
begin
(
const
String
&
wpa2_ssid
,
wpa2_auth_method_t
method
,
const
String
&
wpa2_identity
=
(
const
char
*
)
NULL
,
const
String
&
wpa2_username
=
(
const
char
*
)
NULL
,
const
String
&
wpa2_password
=
(
const
char
*
)
NULL
,
const
String
&
ca_pem
=
(
const
char
*
)
NULL
,
const
String
&
client_crt
=
(
const
char
*
)
NULL
,
const
String
&
client_key
=
(
const
char
*
)
NULL
,
int32_t
channel
=
0
,
const
uint8_t
*
bssid
=
0
,
bool
connect
=
true
const
String
&
client_key
=
(
const
char
*
)
NULL
,
int
ttls_phase2_type
=
-
1
,
int
32_t
channel
=
0
,
const
uint8_t
*
bssid
=
0
,
bool
connect
=
true
)
{
return
begin
(
wpa2_ssid
.
c_str
(),
method
,
wpa2_identity
.
c_str
(),
wpa2_username
.
c_str
(),
wpa2_password
.
c_str
(),
ca_pem
.
c_str
(),
client_crt
.
c_str
(),
client_key
.
c_str
(),
channel
,
bssid
,
connect
ttls_phase2_type
,
channel
,
bssid
,
connect
);
}
wl_status_t
begin
(
const
char
*
ssid
,
const
char
*
passphrase
=
NULL
,
int32_t
channel
=
0
,
const
uint8_t
*
bssid
=
NULL
,
bool
connect
=
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment