Skip to content

Commit 7b2c627

Browse files
authored
Update WiFi scan docs (#8685)
1 parent 5c22dbc commit 7b2c627

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

doc/esp8266wifi/scan-class.rst

+26
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,29 @@ The ``networkItem`` is a zero based index of network discovered during scan. All
236236
6: UPC Wi-Free, Ch:11 (-79dBm)
237237

238238
For code samples please refer to separate section with `examples <scan-examples.rst>`__ dedicated specifically to the Scan Class.
239+
240+
getScanInfoByIndex
241+
^^^^^^^^^^^^^^^^^^
242+
243+
Similar to the ``getNetworkInfo``, but instead returns a pointer to the Nth ``bss_info`` structure which is internally used by the NONOS SDK.
244+
245+
.. code:: cpp
246+
247+
WiFi.getScanInfoByIndex(networkItem)
248+
249+
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.
250+
251+
.. code:: cpp
252+
253+
auto n = WiFi.scanNetworks(false, true);
254+
if (n <= 0) {
255+
// scan failed or there are no results
256+
return;
257+
}
258+
259+
for (int i = 0; i < n; i++)
260+
const auto* info = WiFi.getScanInfoByIndex(i)
261+
// ... use the raw data from the bss_info structure ...
262+
}
263+
264+
See ``tools/sdk/include/user_interface.h`` for all available fields and `examples <scan-examples.rst>`__.

doc/esp8266wifi/scan-examples.rst

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
:orphan:
22

3+
IDE example
4+
^^^^^^^^^^^
5+
6+
- For the currently installed Core, see Arduino IDE > *Examples* > *ESP8266WiFi* > *WiFiScan*.
7+
- For the latest development version, see `WiFiScan.ino <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiScan/WiFiScan.ino>`__.
8+
39
Scan
410
~~~~
511

0 commit comments

Comments
 (0)