- Timestamp:
- Sep 15, 2017 5:32:08 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m
r5628 r5649 28 28 29 29 #import "ipjsuaViewController.h" 30 #import "Reachability.h" 30 31 31 32 @implementation ipjsuaAppDelegate … … 40 41 static char **restartArgv; 41 42 static int restartArgc; 43 Reachability *internetReach; 44 45 - (void) updateWithReachability: (Reachability *)curReach 46 { 47 NetworkStatus netStatus = [curReach currentReachabilityStatus]; 48 BOOL connectionRequired = [curReach connectionRequired]; 49 switch (netStatus) { 50 case NotReachable: 51 PJ_LOG(3,("", "Access Not Available..")); 52 connectionRequired= NO; 53 break; 54 case ReachableViaWiFi: 55 PJ_LOG(3,("", "Reachable WiFi..")); 56 break; 57 case ReachableViaWWAN: 58 PJ_LOG(3,("", "Reachable WWAN..")); 59 break; 60 } 61 if (connectionRequired) { 62 PJ_LOG(3,("", "Connection Required")); 63 } 64 } 65 66 /* Called by Reachability whenever status changes. */ 67 - (void)reachabilityChanged: (NSNotification *)note 68 { 69 Reachability* curReach = [note object]; 70 NSParameterAssert([curReach isKindOfClass: [Reachability class]]); 71 PJ_LOG(3,("", "reachability changed..")); 72 [self updateWithReachability: curReach]; 73 74 if ([curReach currentReachabilityStatus] != NotReachable && 75 ![curReach connectionRequired]) 76 { 77 pjsua_ip_change_param param; 78 pjsua_ip_change_param_default(¶m); 79 pjsua_handle_ip_change(¶m); 80 } 81 } 82 42 83 43 84 void displayLog(const char *msg, int len) … … 155 196 self.window.rootViewController = self.viewController; 156 197 [self.window makeKeyAndVisible]; 198 199 /* Observe the kNetworkReachabilityChangedNotification. When that 200 * notification is posted, the method "reachabilityChanged" will be called. 201 */ 202 [[NSNotificationCenter defaultCenter] addObserver: self 203 selector: @selector(reachabilityChanged:) 204 name: kReachabilityChangedNotification object: nil]; 205 206 internetReach = [Reachability reachabilityForInternetConnection]; 207 [internetReach startNotifier]; 208 [self updateWithReachability: internetReach]; 157 209 158 210 app = self;
Note: See TracChangeset
for help on using the changeset viewer.