Can I turn Wi-Fi on and off programmatically and change the network? (Mac SDK)

Can I turn Wi-Fi on and off and change the network (WiFi) in the Mac SDK? If I can, could you post some code?

+4
source share
2 answers

There is no software API for configuring WiFi settings , but you can change most of them by running networksetup(8) (see the -setairportpower and -setairportnetwork ).

Change Looks like I missed the CoreWLAN framework mentioned by Antoine .

0
source

The CoreWLAN Framework seems to fit your needs. There is even sample code called CoreWLANWirelessManager

The CoreWLANWirelessManager application uses the CoreWLAN framework, which is the Objective-C public API for Mac OS X IEEE 802.11. It provides developers with an example of using the CoreWLAN API and performs the functions that the Framework provides. This functionality includes scanning for networks, requesting a wireless interface for static and dynamic parameters, switching an interface, changing channels, combining and accessing the appropriate system configuration settings for a given interface.

+7
source

All Articles