I'm just a beginner in "C" but
is in "ESP32" SDK
this the proper way to detect WiFi Networks ?
because S = WiFi.SSID ( i ); is not supported anymore with the ESP32
only S = WiFi.SSID():
//**
// L I S T N E T W O R K S *
//**
// List the available networks and select the strongest.
// Acceptable networks are those who have a "SSID.pw" file in the SPIFFS.
// SSIDs of available networks will be saved for use in webinterface. *
//**
void listNetworks()
{
wifi_auth_mode_t encryption ; // TKIP(WPA), WEP, etc.
const char* acceptable ; // Netwerk is acceptable for connection
int i ; // Loop control
String ssid ; // Search string in anetworks
dbgprint ( "Scan Networks" ) ; // Scan for nearby networks
int numSsid = WiFi.scanNetworks() ;
dbgprint ( "Scan completed" ) ;
if ( numSsid <= 0 )
{
dbgprint ( "Couldn't get a wifi connection" ) ;
return ;
}
// print the list of networks seen:
dbgprint ( "Number of available networks: %d",
numSsid ) ;
// Print the network number and name for each network found and
for ( i = 0 ; i < numSsid ; i++ )
{
WiFi.getNetworkInfo(i, ssid, encryptionType, RSSI, BSSID, channel);
acceptable = "" ; // Assume not acceptable
if ( anetworks.indexOf ( ssid ) >= 0 ) // Is this SSID acceptable?
{
acceptable = "Acceptable" ;
}
encryption = WiFi.encryptionType ( i ) ;
dbgprint ( "%2d - %-25s Signal: %3d dBm, Encryption %4s, %s",
i + 1, ssid.c_str(), RSSI,
getEncryptionType ( encryption ),
acceptable ) ;
// Remember this network for later use
networks += ssid + String ( "|" ) ;
I'm just a beginner in "C" but is in "ESP32" SDK this the proper way to detect WiFi Networks ? because S = WiFi.SSID ( i ); is not supported anymore with the ESP32 only S = WiFi.SSID():
//** // L I S T N E T W O R K S * //** // List the available networks and select the strongest. // Acceptable networks are those who have a "SSID.pw" file in the SPIFFS. // SSIDs of available networks will be saved for use in webinterface. * //** void listNetworks() { wifi_auth_mode_t encryption ; // TKIP(WPA), WEP, etc. const char* acceptable ; // Netwerk is acceptable for connection int i ; // Loop control String ssid ; // Search string in anetworks
dbgprint ( "Scan Networks" ) ; // Scan for nearby networks int numSsid = WiFi.scanNetworks() ;
dbgprint ( "Scan completed" ) ; if ( numSsid <= 0 ) { dbgprint ( "Couldn't get a wifi connection" ) ; return ; } // print the list of networks seen: dbgprint ( "Number of available networks: %d", numSsid ) ; // Print the network number and name for each network found and for ( i = 0 ; i < numSsid ; i++ ) {
} dbgprint ( "End of list" ) ; }