-->
Page 1 of 4

List hidden AP

PostPosted: Tue Dec 08, 2015 9:28 am
by Vincent Lê
Hi,

I'm considering switching from NodeMCU to Arduino ESP, due to memory management.

Before that, I have a capital question: is it possible to list AP with hidden ssid?

I've tried this code: https://www.arduino.cc/en/Tutorial/ScanNetworks, and it doesn't list all the AP, just the APs with ssid.

What would be the equivalent of the NodeMCU code:
Code: Select allfunction listap(t) -- (SSID : Authmode, RSSI, BSSID, Channel)
     print("\n\t\t\tSSID\t\t\t\t\tBSSID\t\t\t  RSSI\t\tAUTHMODE\t\tCHANNEL")
      for bssid,v in pairs(t) do
       local ssid, rssi, authmode, channel = string.match(v, "([^,]+),([^,]+),([^,]+),([^,]*)")
        print(string.format("%32.s",ssid).."\t"..bssid.."\t  "..rssi.."\t\t"..authmode.."\t\t\t"..channel)
      end
  end
 scan_cfg={}
 scan_cfg.show_hidden=1
 wifi.sta.getap(scan_cfg, 1, listap)

Re: List hidden AP

PostPosted: Tue Dec 08, 2015 10:50 am
by martinayotte
In the ESP8266WiFi.h, there is the function getNetworkInfo() which I presume allows you to get info for hidden AP.

Code: Select all    /**
     * loads all infos from a scanned wifi in to the ptr parameters
     * @param networkItem uint8_t
     * @param ssid  const char**
     * @param encryptionType uint8_t *
     * @param RSSI int32_t *
     * @param BSSID uint8_t **
     * @param channel int32_t *
     * @param isHidden bool *
     * @return (true if ok)
     */
    bool getNetworkInfo(uint8_t networkItem, String &ssid, uint8_t &encryptionType, int32_t &RSSI, uint8_t* &BSSID, int32_t &channel, bool &isHidden);

Re: List hidden AP

PostPosted: Tue Dec 15, 2015 9:25 am
by Vincent Lê
I will need more infos here.

Maybe I'm very unfamiliar with Arduino, but is this the only docs on Wifi library?

Can you just help me? How do I use this getNetworkInfo() function? And where can I find a doc describing whether WiFi.scanNetworks() returns all BSSID AP or just AP with a SSID?

I've tried unsuccessfully this code:
Code: Select allSerial.print(ESP8266WiFi.getNetWorkInfo(thisNet));

Re: List hidden AP

PostPosted: Tue Dec 15, 2015 9:59 am
by martinayotte
First, the link you provided, https://www.arduino.cc/en/Reference/WiFiScanNetworks, has nothing to do with ESPs, it is a library for Wifi Shield of Arduino, so completely different chip.
As I've mentioned, the Wifi class for ESP is in ESP8266WiFi.h file.
The way to use getNetworkInfo() function should be looks like :
Code: Select allString ssid;
uint8_t encryptionType;
int32_t RSSI;
uint8_t* BSSID;
int32_t channel;
bool isHidden;
int netcount = WiFi.scanNetworks();
for (int n = 0; n < netcount; n++) {
  WiFi.getNetworkInfo(n, ssid, encryptionType, RSSI, BSSID, channel, isHidden);
  Serial.println(String("SSID : ") + ssid);
  Serial.println(String("encryptionType : ") + encryptionType);
  Serial.println(String("RSSI : ") + RSSI);
  Serial.println(String("Channel : ") + channel);
  Serial.println(String("Hidden : ") + isHidden);
}