Re: Detecting AirPort Power Enabled
Re: Detecting AirPort Power Enabled
- Subject: Re: Detecting AirPort Power Enabled
- From: Bill Cheeseman <email@hidden>
- Date: Wed, 30 Sep 2009 11:55:00 -0400
On Sep 30, 2009, at 8:41 AM, Allan Nathanson wrote:
On Sep 30, 2009, at 6:57 AM, Bill Cheeseman wrote:
I've written a Cocoa method using the System Configuration framework to detect whether the AirPort card is powered on. I first test the current network configuration set for a network interface of type kSCNetworkInterfaceTypeIEEE80211 (AirPort). Then, if one is present, I get its configuration dictionary and extract the value associated with its "PowerEnabled" key. A user is reporting that this returns nil because the dictionary does not contain a "PowerEnabled" key at all. I thought it was illegal for a kSCNetworkInterfaceTypeIEEE80211 interface to have a configuration dictionary that does NOT contain the "PowerEnabled" key, so i didn't test for nil.
1. Can a kSCNetworkInterfaceTypeIEEE80211 interface configuration dictionary lawfully omit a "PowerEnabled" key? Under what circumstances? Can anybody point me to documentation?
2. I'm doing this in an app that uses the Snow Leopard Core Location facility to detect (but not join) wi-fi hotspots. Am I correct in assuming that it could not detect wi-fi hotspots without (a) an IEEE80211 interface configuration dictionary (b) whose "PowerEnabled" key reports that the power is turned on?
The configuration dictionaries contain keys/values that specify and/or change the configuration. If a key/value is absent than a default value is assumed. For the "PowerEnabled" key, I believe that we assume that the AirPort interface should be enabled unless we see that it has explicitly been turned off.
Thanks, that explains the behavior my user is seeing.
A related question: In a pristine system where AirPort is set up but it has never been turned off and its advanced settings have never been changed, will the AirPort interface also have a nil configuration dictionary? Or is it always guaranteed to have a configuration dictionary if AirPort is on? (In other words, should I also assume AirPort is enabled if I find a nil configuration dictionary?)
--
Bill Cheeseman email@hidden
|
_______________________________________________
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