From bbc6d0a58feeb6c03e3bb358752607ef7b0924e5 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Mon, 10 Oct 2022 16:56:35 +0300 Subject: [PATCH] Update WiFi scan docs --- doc/esp8266wifi/scan-class.rst | 26 ++++++++++++++++++++++++++ doc/esp8266wifi/scan-examples.rst | 6 ++++++ 2 files changed, 32 insertions(+) diff --git a/doc/esp8266wifi/scan-class.rst b/doc/esp8266wifi/scan-class.rst index eb94de8aad..4629a97a94 100644 --- a/doc/esp8266wifi/scan-class.rst +++ b/doc/esp8266wifi/scan-class.rst @@ -236,3 +236,29 @@ The ``networkItem`` is a zero based index of network discovered during scan. All 6: UPC Wi-Free, Ch:11 (-79dBm) For code samples please refer to separate section with `examples `__ dedicated specifically to the Scan Class. + +getScanInfoByIndex +^^^^^^^^^^^^^^^^^^ + +Similar to the ``getNetworkInfo``, but instead returns a pointer to the Nth ``bss_info`` structure which is internally used by the NONOS SDK. + +.. code:: cpp + + WiFi.getScanInfoByIndex(networkItem) + +The ``networkItem`` is a zero based index of network discovered during scan. Function will return ``nullptr`` when ``networkItem`` is greater than the number of networks in the scan result or when there are no scan results available. + +.. code:: cpp + + auto n = WiFi.scanNetworks(false, true); + if (n <= 0) { + // scan failed or there are no results + return; + } + + for (int i = 0; i < n; i++) + const auto* info = WiFi.getScanInfoByIndex(i) + // ... use the raw data from the bss_info structure ... + } + +See ``tools/sdk/include/user_interface.h`` for all available fields and `examples `__. diff --git a/doc/esp8266wifi/scan-examples.rst b/doc/esp8266wifi/scan-examples.rst index 4ad4777507..d05d258f72 100644 --- a/doc/esp8266wifi/scan-examples.rst +++ b/doc/esp8266wifi/scan-examples.rst @@ -1,5 +1,11 @@ :orphan: +IDE example +^^^^^^^^^^^ + +- For the currently installed Core, see Arduino IDE > *Examples* > *ESP8266WiFi* > *WiFiScan*. +- For the latest development version, see `WiFiScan.ino `__. + Scan ~~~~