Edzelf / ESP32-Radio

Internet radio based on ESP32, VS1053 and a TFT screen.
GNU General Public License v3.0
990 stars 228 forks source link

void listNetworks() - WiFi.SSID ( i ) + String ( "|" ) ; not supported by the ESP32 Libs #115

Open ats3788 opened 6 years ago

ats3788 commented 6 years ago

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() ;

uint8_t encryptionType;
int32_t RSSI;
uint8_t* BSSID;
int32_t channel;

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 ( "|" ) ;

} dbgprint ( "End of list" ) ; }

Edzelf commented 6 years ago

You are looking at the wrong source code that does not belong to the ESP32 version of the radio.