How to use the node-wifi.getCurrentConnections function in node-wifi

To help you get started, we’ve selected a few node-wifi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github blahsd / snwe / app / js / require / modules / wifi.js View on Github external
updateStatus() {
    wifi.getCurrentConnections((err, currentConnections) => {
      try {
        if (currentConnections[0].ssid.length <= 1) {
          // Is connecting
          this.isOn = false;
          this.isConnected = false;
          this.isConnecting = true;
          this.network = "Connecting...";
        } else {
          this.isOn = true;
          this.isConnected = true;
          this.isConnecting = false;
          this.network = currentConnections[0].ssid;
        }
      } catch (e) {
        // If no currentConnections are returned, it must mean we're disconnected and not in the process of connecting to anything
        this.isOn = false;
github ruslang02 / atomos / apps / official / settings / sections / network-wlan.js View on Github external
async function listConnectedNetworks() {
		connectedList.innerHTML = "";
		connectedSSIDs = [];
		let networks = await wifi.getCurrentConnections().catch(err => {
			console.error(err);
			new Snackbar("We couldn't list connected networks, check console.");
		}) || [];
		for (const hs of networks) {
			connectedSSIDs.push(hs.ssid);
			let elem = document.createElement("div");
			let strength = Math.ceil(hs.quality / 25);
			elem.className = "rounded-0 flex-shrink-0 d-flex align-items-center text-left pb-2 pt-1 mb-0 px-3 " + (Shell.ui.darkMode ? " text-white border-secondary" : "");
			elem.icon = document.createElement("button");
			elem.icon.className = "mdi mdi-24px border-0 rounded-max text-white d-flex p-2 lh-24 my-1 mr-2 btn btn-primary mdi-wifi-strength-" + strength;
			elem.icon.onmouseup = () => {
				new Menu([{
					icon: "information-outline",
					label: "Properties",
					click() {
						Shell.showMessageBox({