diff options
author | Siqi LIU <me@siqi.fr> | 2013-08-18 00:09:13 +0800 |
---|---|---|
committer | Siqi LIU <me@siqi.fr> | 2013-08-18 15:22:14 +0800 |
commit | 483d4c06c5b88949c5f0e12c9c8b3b4e88132e86 (patch) | |
tree | 90189cc813ed46214f86493bbb72d198999f285e /ios | |
parent | 3c5369840cf305ca92f4c04cc914b14b76c81562 (diff) |
move fetchSSIDInfo to model as a static method
Change-Id: I636cc3e9204db2247c74256e00abee8fdfdaee97
Diffstat (limited to 'ios')
-rw-r--r-- | ios/iosremote/iosremote/Communication/CommunicationManager.h | 9 | ||||
-rw-r--r-- | ios/iosremote/iosremote/Communication/CommunicationManager.m | 33 |
2 files changed, 42 insertions, 0 deletions
diff --git a/ios/iosremote/iosremote/Communication/CommunicationManager.h b/ios/iosremote/iosremote/Communication/CommunicationManager.h index 76c719e6dceb..fdd2a1448513 100644 --- a/ios/iosremote/iosremote/Communication/CommunicationManager.h +++ b/ios/iosremote/iosremote/Communication/CommunicationManager.h @@ -67,6 +67,12 @@ enum SearchState : NSInteger { SEARCHING }; +typedef enum { + NotReachable = 0, + ReachableViaWiFi, + ReachableViaWWAN +} NetworkStatus; + @interface CommunicationManager : NSObject - (id) initWithExistingServers; @@ -76,6 +82,9 @@ enum SearchState : NSInteger { AtAddress:(NSString*)addr; - (void) removeServerAtIndex:(NSUInteger)index; +- (NetworkStatus) currentReachabilityStatus; ++ (id)fetchSSIDInfo; + @property ConnectionState state; @property SearchState searchState; @property (nonatomic, strong) id delegate; diff --git a/ios/iosremote/iosremote/Communication/CommunicationManager.m b/ios/iosremote/iosremote/Communication/CommunicationManager.m index 23bfb81a2f4b..e2b3e19f2fe2 100644 --- a/ios/iosremote/iosremote/Communication/CommunicationManager.m +++ b/ios/iosremote/iosremote/Communication/CommunicationManager.m @@ -17,6 +17,8 @@ #import "MainSplitViewController.h" #import "serverList_vc.h" #import <dispatch/dispatch.h> +#import <SystemConfiguration/SystemConfiguration.h> +#import <SystemConfiguration/CaptiveNetwork.h> #define ExistingServersKey @"CommunicationManager.ExistingServers" @@ -46,6 +48,16 @@ return sharedComManager; } ++ (id)fetchSSIDInfo { + NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces(); + id info = nil; + for (NSString *ifnam in ifs) { + info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam); + NSLog(@"%@ => %@", ifnam, info); + if (info && [info count]) { break; } + } + return info; +} - (void) connectionStatusHandler:(NSNotification *)note { @@ -190,4 +202,25 @@ [[NSUserDefaults standardUserDefaults] synchronize]; } +#pragma mark - +// +//- (NetworkStatus) currentReachabilityStatus +//{ +// NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef"); +// NetworkStatus retVal = NotReachable; +// SCNetworkReachabilityFlags flags; +// if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) +// { +// if(localWiFiRef) +// { +// retVal = [self localWiFiStatusForFlags: flags]; +// } +// else +// { +// retVal = [self networkStatusForFlags: flags]; +// } +// } +// return retVal; +//} + @end |