1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

WiFi.BSSID and scan result BSSID with parameter as other WiFi libraries (#9008)

This commit is contained in:
Juraj Andrássy 2023-11-04 23:29:06 +01:00 committed by GitHub
parent 1662248b39
commit 497dacc78f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 0 deletions

View File

@ -607,6 +607,18 @@ uint8_t* ESP8266WiFiSTAClass::BSSID(void) {
return reinterpret_cast<uint8_t*>(conf.bssid);
}
/**
* Fill the current bssid / mac associated with the network if configured
* @param bssid pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
* @return bssid uint8_t *
*/
uint8_t* ESP8266WiFiSTAClass::BSSID(uint8_t* bssid) {
struct station_config conf;
wifi_station_get_config(&conf);
memcpy(bssid, conf.bssid, WL_MAC_ADDR_LENGTH);
return bssid;
}
/**
* Return the current bssid / mac associated with the network if configured
* @return String bssid mac

View File

@ -79,6 +79,7 @@ class ESP8266WiFiSTAClass: public LwipIntf {
String psk() const;
uint8_t * BSSID();
uint8_t * BSSID(uint8_t* bssid);
String BSSIDstr();
int8_t RSSI();

View File

@ -259,6 +259,21 @@ uint8_t * ESP8266WiFiScanClass::BSSID(uint8_t i) {
return it->bssid;
}
/**
* fill MAC / BSSID of scanned wifi
* @param i specify from which network item want to get the information
* @param bssid pointer to uint8_t array with length WL_MAC_ADDR_LENGTH
* @return uint8_t * MAC / BSSID of scanned wifi
*/
uint8_t * ESP8266WiFiScanClass::BSSID(uint8_t i, uint8_t* bssid) {
struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i));
if(!it) {
return 0;
}
memcpy(bssid, it->bssid, WL_MAC_ADDR_LENGTH);
return bssid;
}
/**
* return MAC / BSSID of scanned wifi
* @param i specify from which network item want to get the information

View File

@ -48,6 +48,7 @@ class ESP8266WiFiScanClass {
uint8_t encryptionType(uint8_t networkItem);
int32_t RSSI(uint8_t networkItem);
uint8_t * BSSID(uint8_t networkItem);
uint8_t * BSSID(uint8_t networkItem, uint8_t* bssid);
String BSSIDstr(uint8_t networkItem);
int32_t channel(uint8_t networkItem);
bool isHidden(uint8_t networkItem);