Re: CoreWLAN Notifications
Re: CoreWLAN Notifications
- Subject: Re: CoreWLAN Notifications
- From: Terry Simons <email@hidden>
- Date: Sat, 12 Sep 2009 12:02:53 -0600
Hmm...
I tried that before sending my original E-mail and it wasn't working,
so I just tried it again to be sure and it's still not working. See
the below snippet.
When I hook up those events, I can hop SSIDs, turn off my AirPort
card, etc without any notifications seeming to be generated.
Here's the code in question:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
NSError *wirelessError = nil;
NSArray *intNames = [CWInterface supportedInterfaces];
CWInterface *wirelessInterface = [CWInterface interfaceWithName:@"en2"];
NSArray *scanData = [wirelessInterface
scanForNetworksWithParameters:nil error:&wirelessError];
NSLog(@"Supported Wireless Interfaces: %@", intNames);
NSLog(@"AirPort Handle: %@", wirelessInterface);
NSLog(@"%@", scanData);
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(processNotification:)
name:kCWPowerDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(processNotification:)
name:kCWSSIDDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(processNotification:)
name:kCWBSSIDDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(processNotification:)
name:kCWLinkDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(processNotification:)
name:kCWModeDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(processNotification:)
name:kCWCountryCodeDidChangeNotification
object:nil];
}
- (void) processNotification:(NSNotification *) notification {
NSLog(@"Got Notification");
On Sat, Sep 12, 2009 at 11:18 AM, Stephane Sudre <email@hidden> wrote:
>
> On Sep 12, 2009, at 6:49 PM, Terry Simons wrote:
>
>> Hi,
>>
>> I'm trying to hook up notifications with the new Snow Leopard CoreWLAN
>> APIs, but I'm not exactly sure how to go about doing that.
>>
>> The only information I've been able to track down is in the
>> CWGloabals.h file which defines the notifications and describes when
>> they're posted.
>>
>> For instance:
>>
>> /*!
>> * @const kCWLinkDidChangeNotification
>> * @discussion Posted when the link state of the CoreWLAN interface
>> changes. This notification does not contain a <i>userInfo</i>
>> dictionary.
>> */
>> extern NSString * const kCWLinkDidChangeNotification
>> __OSX_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_NA );
>>
>> There isn't any information about how to hook these notifications up,
>> and I can't find anything on the net yet about CoreWLAN.
>>
>> Any help is appreciated.
>
> [[NSNotificationCenter defaultCenter] addObserver:self
> selector:@selector(handleEventPosted:) name:kCWLinkDidChangeNotification
> object:nil];
>
>
>
_______________________________________________
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