Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WiFi scan docs #8685

Merged
merged 2 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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