Skip to content

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";

Creates a new WiFi object instance.

WiFi(options)

options

An object of properties used to construct the class.

Initiates a scan for Wi-Fi base stations.

scan(options)

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.

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");
}
});

Wi-Fi Network Interface