How to use the node-wifi.connect 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 jeeliz / jetsonjs / server / wrappers / WifiNetworkManager.js View on Github external
const connect=(networkDetails, callback)=>{
	// Connect to a network
	wifi.connect(networkDetails, (err) => {
	    if (err) {
	        console.log('WARNING in Wifi.js - connect(): connection fails', err.message)
	  		callback(err, false)
	  		return
	    }
	    console.log('INFO in Wifi.js - connect() : connected successfully')
	    get_status((err, status)=>{
	    	if (err) {
	    		callback(err, false)
	    	} else {
	    		save_config(networkDetails, callback.bind(null,false, status))
	    	}
	    })
	})
}
github ruslang02 / atomos / apps / official / settings / sections / network-wlan.js View on Github external
again = false;
						return;
					}
					const pass = document.querySelector("message-box input");
					await wifi.connect({
						ssid: hs.ssid,
						password: pass.value
					}).catch(err => {
						//console.error(err);
						again = true;
						elem.click();
					});
					listConnectedNetworks().then(listNetworks);
					again = false;
				} else {
					await wifi.connect({
						ssid: hs.ssid
					}).catch(console.error);
					listConnectedNetworks().then(listNetworks);
				}
			};
			elem.className = "rounded-0 flex-shrink-0 border-top border-bottom-0 border-left-0 border-right-0 d-flex align-items-center text-left py-2 mb-0 btn px-3 " + (Shell.ui.darkMode ? "btn-dark border-secondary" : "btn-white");
github ruslang02 / atomos / apps / official / settings / sections / network-wlan.js View on Github external
message.append(message.lead, message.pass);
					let button = await Shell.showMessageBox({
						title: "Passphrase required",
						icon: "wifi-strength-lock-outline",
						message: message,
						cancelId: 0,
						buttons: ["Cancel", "<i class="mdi mdi-fingerprint mdi-18px lh-18 d-inline-flex align-text-top"></i> Connect"],
						defaultId: 1,
						iconBG: "var(--orange)"
					});
					if (button === "Cancel") {
						again = false;
						return;
					}
					const pass = document.querySelector("message-box input");
					await wifi.connect({
						ssid: hs.ssid,
						password: pass.value
					}).catch(err =&gt; {
						//console.error(err);
						again = true;
						elem.click();
					});
					listConnectedNetworks().then(listNetworks);
					again = false;
				} else {
					await wifi.connect({
						ssid: hs.ssid
					}).catch(console.error);
					listConnectedNetworks().then(listNetworks);
				}
			};