Skip to content

Commit

Permalink
Update WiFi scan docs (#8685)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Oct 10, 2022
1 parent 5c22dbc commit 7b2c627
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
26 changes: 26 additions & 0 deletions doc/esp8266wifi/scan-class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <scan-examples.rst>`__ 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 <scan-examples.rst>`__.
6 changes: 6 additions & 0 deletions doc/esp8266wifi/scan-examples.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiScan/WiFiScan.ino>`__.

Scan
~~~~

Expand Down

0 comments on commit 7b2c627

Please sign in to comment.