Wi-Fi
The WiFi class provides access to a Wi-Fi network interface. It is a subclass of the Network Interface Class Pattern.
import WiFi from "embedded:network/interface/wifi";Constructor
Section titled “Constructor”WiFi(options)
Section titled “WiFi(options)”Creates a new WiFi object instance.
WiFi(options)Parameters
Section titled “Parameters”options
An object of properties used to construct the class.
Instance Methods
Section titled “Instance Methods”scan(options)
Section titled “scan(options)”Initiates a scan for Wi-Fi base stations.
scan(options)Parameters
Section titled “Parameters”options
onFound(options)- A callback function invoked with information about an access point discovered by the scan.
onComplete()- A callback function invoked when the scan is complete.
Examples
Section titled “Examples”import WiFi from "embedded:network/interface/wifi";
const network = new WiFi();network.scan({ onFound(ap) { console.log(`Found SSID: ${ap.SSID}, RSSI: ${ap.RSSI}`); }, onComplete() { console.log("Scan complete"); }});