Description
working in a project i noted that the WIFI api is different and i thought to open an issue if you would like to fix it, all the resources are here:
BSSID official API
site: https://www.arduino.cc/en/Reference/WiFiBSSID
code: https://github.com/arduino-libraries/WiFi/blob/master/src/WiFi.cpp#L189
ESP32
BSSID: https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/src/WiFiSTA.cpp#L521 and https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/src/WiFiScan.cpp#L234
solution: something like you did for the macAddress where there are two function with the same name, so if i pass a parameter to macAddress i will fill the array if not i will receive a String:
uint8_t* WiFiSTAClass::macAddress(uint8_t* mac)
{
if(WiFiGenericClass::getMode() != WIFI_MODE_NULL){
esp_wifi_get_mac(WIFI_IF_STA, mac);
}
else{
esp_read_mac(mac, ESP_MAC_WIFI_STA);
}
return mac;
}
String WiFiSTAClass::macAddress(void)
{
uint8_t mac[6];
char macStr[18] = { 0 };
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
esp_read_mac(mac, ESP_MAC_WIFI_STA);
}
else{
esp_wifi_get_mac(WIFI_IF_STA, mac);
}
sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
return String(macStr);
}
The same could be done with the BSSID, if i pass a parameter (which now is not possibile while it should be) i will fill the array; and if i just call I will get a String. Also this will make the behaviour between BSSID and macAddress the same while now is not.
EDIT: also note that arduino functions return an array which have to be read from 5 to 0, see here while esp32 from 0 to 5 bringing to more incompatibility of code