Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the missing Mac disconnect functionality #99

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

xavier7179
Copy link

@xavier7179 xavier7179 commented Nov 24, 2019

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

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

- Added a mac-disconnect function (based on wifi-control), which makes possible to disconnect from the actual network without running 'root' commands
- Configs expanded to handle the possibility of waiting a fixed time between the two OSX required command
@Fokir
Copy link

Fokir commented Jun 12, 2020

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

@xavier7179
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants