Skip to content

ESP8266WiFi extended functions #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 22, 2015
Merged

ESP8266WiFi extended functions #300

merged 5 commits into from
May 22, 2015

Conversation

Links2004
Copy link
Collaborator

ESP8266WiFi extended functions

begin changes
allow setting BSSID/MAC and Channel of an AP for faster connection (#261)
now checks if ssid and passphrase to big
selecting Wifi mode in better way (fix for #28)

ESP8266WiFiMulti uses the new functions to auto select best AP even in a multi AP WiFi network (more the one AP has same SSID)

add new functions to get current Connected AP:
uint8_t * BSSID(void);
int32_t Channel(void);

add new functions to get infos from scanned networks:
uint8_t * BSSID(uint8_t networkItem);
int32_t Channel(uint8_t networkItem);
bool isHidden(uint8_t networkItem);
bool getNetworkInfo(uint8_t networkItem, const char** ssid, uint8_t * encryptionType, int32_t * RSSI, uint8_t ** BSSID, int32_t * channel, bool * isHidden);

igrr and others added 5 commits May 21, 2015 10:56
 - begin changes
     allow setting BSSID/MAC and Channel of an AP for faster connection (#261)
     now checks if ssid and passphrase to big
     selecting Wifi mode in better way (fix for #28)

 - ESP8266WiFiMulti uses the new functions to auto select best AP even in a multi AP WiFi network (more the one AP has same SSID)

 - add new functions to get current Connected AP:
     uint8_t * BSSID(void);
     int32_t Channel(void);

 - add new functions to get infos from scanned networks:
     uint8_t * BSSID(uint8_t networkItem);
     int32_t Channel(uint8_t networkItem);
     bool isHidden(uint8_t networkItem);
     bool getNetworkInfo(uint8_t networkItem, const char** ssid, uint8_t * encryptionType, int32_t * RSSI, uint8_t ** BSSID, int32_t * channel, bool * isHidden);
@igrr igrr merged commit 3c7f046 into esp8266:esp8266 May 22, 2015
@kgolding
Copy link

Have just cloned and build from source 1.6.5, loaded the WiFiScan example and I get the following error when I try to compile:

WiFiScan.ino: In function 'void loop()':
WiFiScan:38: error: 'class ESP8266WiFiClass' has no member named 'BSSID'
'class ESP8266WiFiClass' has no member named 'BSSID'

@stozk
Copy link

stozk commented May 27, 2015

Same here, can't use the BSSID atm.

@igrr
Copy link
Member

igrr commented May 27, 2015

Also check if you have the board manager package installed. You need to uninstall it if you have because it overrides any cores bundled with the app.

@igrr
Copy link
Member

igrr commented May 27, 2015

Let me try some telepathy... did you replace Serial.print(WiFi.RSSI(i)); with Serial.print(WiFi.BSSID(i)); in your sketch? This is not valid code...

@kgolding
Copy link

igrr yes! Sorry!

@Links2004
Copy link
Collaborator Author

have add some functions to get the MAC / BSSID as string.
Links2004@877aa5a

@kgolding
Copy link

For those like I who want to convert the WiFi.BSSID() result to a string, I've created the following function (inspired by @Links2004 functions):

String bssidToString(uint8_t *bssid) {
  char mac[18] = {0};
  sprintf(mac,"%02X:%02X:%02X:%02X:%02X:%02X", bssid[0],  bssid[1],  bssid[2], bssid[3], bssid[4], bssid[5]);
  return String(mac);
}

This can be called using:

Serial.print(bssidToString(WiFi.BSSID(i)));

@keegho
Copy link

keegho commented Jan 15, 2017

@kgolding great function. Best answer. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants