node-wifi icon indicating copy to clipboard operation
node-wifi copied to clipboard

Added the missing Mac disconnect functionality

Open xavier7179 opened this issue 5 years ago • 2 comments

Description

I added a disconnect function by using CLI functions that do not require to be root. Those functions turn off the wifi first and, after an optional delay, turn it on again. Since disconnecting from a network or a device properly may require a delay, I included a sleep function to do it without generating a Promise, like a setTimeout would do.

Motivation and Context

On Mac the disconnect was a missed functionality.

Usage examples

const WiFiControl = require('node-wifi');

WiFiControl.init({ iface: null, debug: true, delay: 5 // delay in seconds }); //.... WiFiControll.disconnect();

How Has This Been Tested?

I tested it on OSX version 10.14.6.

Types of changes

  • [x] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to change)

xavier7179 avatar Nov 24 '19 18:11 xavier7179

These edits do not lead to the desired result, since after turning off and on the wifi module there will be an automatic connection to the priority access point

MacOs Catalina 10.15.5

Fokir avatar Jun 12 '20 10:06 Fokir

MacOs Catalina 10.15.5 when I released it, there was no version 10.15.5, and there was no automatic re-connection on my version. Nevertheless, I hope it is a start make it better and fully working, because otherwise on mac without this functionality, in a real application, the lib is almost worthless.

xavier7179 avatar Jun 12 '20 12:06 xavier7179