node-wifi
node-wifi copied to clipboard
Support hidden wifi on windows
Description
This PR add support for hidden wifis, wifis which do not broadcast there SSID, without breaking existing API usages.
Motivation and Context
Windows does not simply connect to wifis which do not broadcast their SSID (hidden wifis).
The additional flag <nonBroadcast>true</nonBroadcast>
in the profile xml file is required.
If the flag is set, this PR adds the nonBroadcast param to the profile xml config file and connects to the wifi. It also skips the scan for the given wifi because it will not appear in the wifi list, obviously.
This PR is related and should close #22 on Windows.
The missing configuration has been posted on Stackoverflow in this thread: https://stackoverflow.com/questions/69470100/connect-to-hidden-wifi-using-netsh-commands
Usage examples
Users can now provide an additional parameter to the connect()
method:
nodeWifi.connect({ssid: 'foo', password: 'bar', isHidden?: true})
the default of isHidden is false so that existing code should not break.
How Has This Been Tested?
The code has been tested on Windows 10 with a Wifi without SSID.
Types of changes
-
[x] New feature (non-breaking change which adds functionality)
-
[x] Refactorization (non-functional change which improve code readibility)