Preferred Networks
Preferred Networks
- Subject: Preferred Networks
- From: Howard Shere <email@hidden>
- Date: Thu, 28 Apr 2011 09:35:17 -0400
- Acceptlanguage: en-US
- Thread-topic: Preferred Networks
I am trying to write an app for my building which will programmatically add preferred network SSIDs so that my machine will find wifi when I am anywhere in the building.
I have a list of the SSIDs and I have gotten this to work with the command:
/usr/sbin/networksetup -addpreferredwirelessnetworkatindex Airport WIIFI_AP_100 0 WPA2
I also see that I can use CoreWLAN to do this, but that is 10.6 only and I want this to run on 10.5 as well.
I have written code which will do this using the System Configuration Framework, but that code is not behaving as I expect. I use SCDynamicStoreCopyValue to get the current Airport Dictionary, make my changes and then write them back with SCDynamicStoreSetValue. I get no error when I call this and calling SCError returns the success result, but I don't see the new preferred network in my network system preferences (even after logging out and rebooting). However, when I run my app again the new preferred network is in the list I get back from SCDynamicStoreCopyValue. When i turn the airport on it does not find the network with the SSID that I added.
I can use the command line to do what I need to do, but I'd rather do it in the code.
The other issue is that if i have 100 of these new entries I'd like to control the order in the list for all of them together. Is there a way with any of the 3 mechanisms to add one entry which contains many SSIDs? Is there some other way to do this?
Thanks!
Howard Shere
Software Sculptor
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden