OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Implements a WLAN API binding for CoreWLAN, as available on OSX 10.6 | 5 // Implements a WLAN API binding for CoreWLAN, as available on OSX 10.6 |
6 | 6 |
7 #include "chrome/browser/geolocation/wifi_data_provider_mac.h" | 7 #include "chrome/browser/geolocation/wifi_data_provider_mac.h" |
8 | 8 |
9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
10 #import <Foundation/Foundation.h> | 10 #import <Foundation/Foundation.h> |
(...skipping 11 matching lines...) Expand all Loading... | |
22 | 22 |
23 @interface CWInterface : NSObject | 23 @interface CWInterface : NSObject |
24 + (CWInterface*)interface; | 24 + (CWInterface*)interface; |
25 + (CWInterface*)interfaceWithName:(NSString*)name; | 25 + (CWInterface*)interfaceWithName:(NSString*)name; |
26 + (NSArray*)supportedInterfaces; | 26 + (NSArray*)supportedInterfaces; |
27 - (NSArray*)scanForNetworksWithParameters:(NSDictionary*)parameters | 27 - (NSArray*)scanForNetworksWithParameters:(NSDictionary*)parameters |
28 error:(NSError**)error; | 28 error:(NSError**)error; |
29 @end | 29 @end |
30 | 30 |
31 @interface CWNetwork : NSObject <NSCopying, NSCoding> | 31 @interface CWNetwork : NSObject <NSCopying, NSCoding> |
32 @property(readonly) NSString* ssid; | 32 @property (nonatomic, readonly) NSString* ssid; |
33 @property(readonly) NSString* bssid; | 33 @property (nonatomic, readonly) NSString* bssid; |
34 @property(readonly) NSData* bssidData; | 34 @property (nonatomic, readonly) NSData* bssidData; |
35 @property(readonly) NSNumber* securityMode; | 35 @property (nonatomic, readonly) NSNumber* securityMode; |
36 @property(readonly) NSNumber* phyMode; | 36 @property (nonatomic, readonly) NSNumber* phyMode; |
37 @property(readonly) NSNumber* channel; | 37 @property (nonatomic, readonly) NSNumber* channel; |
38 @property(readonly) NSNumber* rssi; | 38 @property (nonatomic, readonly) NSNumber* rssi; |
39 @property(readonly) NSNumber* noise; | 39 @property (nonatomic, readonly) NSNumber* noise; |
40 @property(readonly) NSData* ieData; | 40 @property (nonatomic, readonly) NSData* ieData; |
41 @property(readonly) BOOL isIBSS; | 41 @property (nonatomic, readonly) BOOL isIBSS; |
joth
2010/06/15 18:44:25
quick sanity check - as mentioned in the comment t
Mark Mentovai
2010/06/15 19:30:04
joth wrote:
| |
42 - (BOOL)isEqualToNetwork:(CWNetwork*)network; | 42 - (BOOL)isEqualToNetwork:(CWNetwork*)network; |
43 @end | 43 @end |
44 | 44 |
45 class CoreWlanApi : public WifiDataProviderCommon::WlanApiInterface { | 45 class CoreWlanApi : public WifiDataProviderCommon::WlanApiInterface { |
46 public: | 46 public: |
47 CoreWlanApi() {} | 47 CoreWlanApi() {} |
48 | 48 |
49 // Must be called before any other interface method. Will return false if the | 49 // Must be called before any other interface method. Will return false if the |
50 // CoreWLAN framework cannot be initialized (e.g. running on pre-10.6 OSX), | 50 // CoreWLAN framework cannot be initialized (e.g. running on pre-10.6 OSX), |
51 // in which case no other method may be called. | 51 // in which case no other method may be called. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 [supported_interfaces count] > interface_error_count; | 153 [supported_interfaces count] > interface_error_count; |
154 } | 154 } |
155 | 155 |
156 WifiDataProviderCommon::WlanApiInterface* NewCoreWlanApi() { | 156 WifiDataProviderCommon::WlanApiInterface* NewCoreWlanApi() { |
157 scoped_ptr<CoreWlanApi> self(new CoreWlanApi); | 157 scoped_ptr<CoreWlanApi> self(new CoreWlanApi); |
158 if (self->Init()) | 158 if (self->Init()) |
159 return self.release(); | 159 return self.release(); |
160 | 160 |
161 return NULL; | 161 return NULL; |
162 } | 162 } |
OLD | NEW |