int32_t WiFiScanClass::channel(uint8_t i) { wifi_ap_record_t* it = reinterpret_cast<wifi_ap_record_t*>(_getScanInfoByIndex(i)); if(!it) { return 0; } return it->primary; }
/** * return MAC / BSSID of scanned wifi * @param i specify from which network item want to get the information * @return uint8_t * MAC / BSSID of scanned wifi */ uint8_t * WiFiScanClass::BSSID(uint8_t i) { wifi_ap_record_t* it = reinterpret_cast<wifi_ap_record_t*>(_getScanInfoByIndex(i)); if(!it) { return 0; } return it->bssid; }
/** * Return the encryption type of the networks discovered during the scanNetworks * @param i specify from which network item want to get the information * @return encryption type (enum wl_enc_type) of the specified item on the networks scanned list */ wifi_auth_mode_t WiFiScanClass::encryptionType(uint8_t i) { wifi_ap_record_t* it = reinterpret_cast<wifi_ap_record_t*>(_getScanInfoByIndex(i)); if(!it) { return WIFI_AUTH_OPEN; } return it->authmode; }
/** * Return the RSSI of the networks discovered during the scanNetworks * @param i specify from which network item want to get the information * @return signed value of RSSI of the specified item on the networks scanned list */ int32_t WiFiScanClass::RSSI(uint8_t i) { wifi_ap_record_t* it = reinterpret_cast<wifi_ap_record_t*>(_getScanInfoByIndex(i)); if(!it) { return 0; } return it->rssi; }
int32_t ESP8266WiFiClass::RSSI(uint8_t i) { struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i)); if (!it) return 0; return it->rssi; }
/** * Return the SSID discovered during the network scan. * @param i specify from which network item want to get the information * @return ssid string of the specified item on the networks scanned list */ String WiFiScanClass::SSID(uint8_t i) { wifi_ap_record_t* it = reinterpret_cast<wifi_ap_record_t*>(_getScanInfoByIndex(i)); if(!it) { return String(); } return String(reinterpret_cast<const char*>(it->ssid)); }
bool ESP8266WiFiClass::isHidden(uint8_t i) { struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i)); if (!it) return false; return (it->is_hidden != 0); }
uint8_t * ESP8266WiFiClass::BSSID(uint8_t i) { struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i)); if (!it) return 0; return it->bssid; }
const char* ESP8266WiFiClass::SSID(uint8_t i) { struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i)); if (!it) return 0; return reinterpret_cast<const char*>(it->ssid); }
/** * return MAC / BSSID of scanned wifi * @param i specify from which network item want to get the information * @return String MAC / BSSID of scanned wifi */ String WiFiScanClass::BSSIDstr(uint8_t i) { char mac[18] = { 0 }; wifi_ap_record_t* it = reinterpret_cast<wifi_ap_record_t*>(_getScanInfoByIndex(i)); if(!it) { return String(); } sprintf(mac, "%02X:%02X:%02X:%02X:%02X:%02X", it->bssid[0], it->bssid[1], it->bssid[2], it->bssid[3], it->bssid[4], it->bssid[5]); return String(mac); }
String ESP8266WiFiClass::BSSIDstr(uint8_t i) { char mac[18] = {0}; struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i)); if (!it) return String(""); sprintf(mac,"%02X:%02X:%02X:%02X:%02X:%02X", it->bssid[0], it->bssid[1], it->bssid[2], it->bssid[3], it->bssid[4], it->bssid[5]); return String(mac); }
/** * 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 * * @return (true if ok) */ bool WiFiScanClass::getNetworkInfo(uint8_t i, String &ssid, uint8_t &encType, int32_t &rssi, uint8_t* &bssid, int32_t &channel) { wifi_ap_record_t* it = reinterpret_cast<wifi_ap_record_t*>(_getScanInfoByIndex(i)); if(!it) { return false; } ssid = (const char*) it->ssid; encType = it->authmode; rssi = it->rssi; bssid = it->bssid; channel = it->primary; return true; }
bool ESP8266WiFiClass::getNetworkInfo(uint8_t i, String &ssid, uint8_t &encType, int32_t &rssi, uint8_t* &bssid, int32_t &channel, bool &isHidden) { struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i)); if (!it) return false; ssid = (const char*)it->ssid; encType = encryptionType(i); rssi = it->rssi; bssid = it->bssid; // move ptr channel = it->channel; isHidden = (it->is_hidden != 0); return true; }
uint8_t ESP8266WiFiClass::encryptionType(uint8_t i) { struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i)); if (!it) return -1; int authmode = it->authmode; if (authmode == AUTH_OPEN) return ENC_TYPE_NONE; if (authmode == AUTH_WEP) return ENC_TYPE_WEP; if (authmode == AUTH_WPA_PSK) return ENC_TYPE_TKIP; if (authmode == AUTH_WPA2_PSK) return ENC_TYPE_CCMP; if (authmode == AUTH_WPA_WPA2_PSK) return ENC_TYPE_AUTO; return -1; }