Closed buildscientist closed 3 years ago
Scan & Connect managers have default name for wifi dev name wlan0
because it is default interface for most of linux distros. But there is an option to customize, like line of code you provided.
Reason of global singleton Scan & Connect managers is to make code simple and have an access to same instance from different places of code (singleton in other words)
It is a good point to take ability to create multiple instances of managers, I will add new methods like wifi.NewConnectManager('wlan0') and wifi.NewScanManager('wlan0')
The scan & connect managers both hardcode the wifi dev name to
wlan0
unless the developer overrides the device name prior to calling theScan()
orConnect()
methods.Following your code example one would need to do the following:
Is there any reason why the Scan/Connect manager define global vars with a pre-instantiated struct setting the wifi uDev name? I think it would make more sense to require the developer to create a reference to their own Scan/Connect managers. Consider a case where the system using this library has multiple wifi devices.