Skip to content

Commit 9f2c32d

Browse files
committed
Added missing encryptionType function
Former-commit-id: 6a1ca4b
1 parent 1b5db72 commit 9f2c32d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

libraries/WiFiS3/src/WiFi.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,21 @@ static uint8_t Encr2wl_enc(string e) {
421421
}
422422
}
423423

424+
425+
/* -------------------------------------------------------------------------- */
426+
uint8_t CWifi::encryptionType() {
427+
/* -------------------------------------------------------------------------- */
428+
scanNetworks();
429+
string myssid(SSID());
430+
for(unsigned int i = 0; i < access_points.size(); i++) {
431+
if(myssid == access_points[i].ssid) {
432+
return Encr2wl_enc(access_points[i].encryption_mode);
433+
}
434+
}
435+
return ENC_TYPE_UNKNOWN;
436+
}
437+
438+
424439
/* -------------------------------------------------------------------------- */
425440
uint8_t CWifi::encryptionType(uint8_t networkItem) {
426441
if(networkItem < access_points.size()) {
@@ -432,7 +447,7 @@ uint8_t CWifi::encryptionType(uint8_t networkItem) {
432447

433448
/* -------------------------------------------------------------------------- */
434449
uint8_t* CWifi::BSSID(uint8_t networkItem, uint8_t* bssid) {
435-
if(networkItem < access_points.size()) {
450+
if(networkItem < access_points.size()) {
436451
for(int i = 0; i < 6; i++) {
437452
*(bssid + i) = access_points[networkItem].uint_bssid[i];
438453
}

libraries/WiFiS3/src/WiFi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ class CWifi {
238238
239239
*/
240240
uint8_t encryptionType(uint8_t networkItem);
241+
uint8_t encryptionType();
241242

242243
uint8_t* BSSID(uint8_t networkItem, uint8_t* bssid);
243244
uint8_t channel(uint8_t networkItem);

0 commit comments

Comments
 (0)