diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index 03cfe21d7..ed90e8d1b 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -168,6 +168,11 @@ [self performSelector:@selector(doKeyZeroLongPress) withObject:nil afterDelay:0.5]; } else if (sender == hash) { newAddress = [address.text stringByAppendingString:@"#"]; + if ([newAddress isEqualToString:@"#1234#"]) { + //enable debug mode + [self.linphoneDelegate enableDebug:true]; + } + } else if (sender == back) { if ([address.text length] >0) { newAddress = [address.text substringToIndex: [address.text length]-1]; diff --git a/Classes/linphoneAppDelegate.h b/Classes/linphoneAppDelegate.h index 322c938a4..7b5636bf8 100644 --- a/Classes/linphoneAppDelegate.h +++ b/Classes/linphoneAppDelegate.h @@ -38,6 +38,7 @@ -(void) resetConfig; -(void) doRegister; -(void) kickOffNetworkConnection; +-(void) enableDebug:(bool) value; -(LinphoneCore*) getLinphoneCore; @@ -51,6 +52,7 @@ @class CallHistoryTableViewController; @class FavoriteTableViewController; @class FirstLoginViewController; +@class MoreViewController; @interface linphoneAppDelegate : NSObject { @@ -60,6 +62,7 @@ IBOutlet PhoneViewController* myPhoneViewController; CallHistoryTableViewController* myCallHistoryTableViewController; FavoriteTableViewController* myFavoriteTableViewController; + MoreViewController* myMoreViewController; ContactPickerDelegate* myContactPickerDelegate; FirstLoginViewController* myFirstLoginViewController; diff --git a/Classes/linphoneAppDelegate.m b/Classes/linphoneAppDelegate.m index 73821d801..3da626173 100644 --- a/Classes/linphoneAppDelegate.m +++ b/Classes/linphoneAppDelegate.m @@ -190,12 +190,12 @@ LinphoneCoreVTable linphone_iphone_vtable = { myPeoplePickerController.tabBarItem = [(UIViewController*)[myTabBarController.viewControllers objectAtIndex:CONTACTS_TAB_INDEX] tabBarItem]; //more tab - MoreViewController *moreViewController = [[MoreViewController alloc] initWithNibName:@"MoreViewController" bundle:[NSBundle mainBundle]]; + myMoreViewController = [[MoreViewController alloc] initWithNibName:@"MoreViewController" bundle:[NSBundle mainBundle]]; if (isDebug) { - [moreViewController enableLogView]; + [myMoreViewController enableLogView]; } - [moreViewController setLinphoneDelegate:self]; - UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:moreViewController]; + [myMoreViewController setLinphoneDelegate:self]; + UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:myMoreViewController]; [aNavigationController.navigationBar setTintColor:[UIColor lightGrayColor]]; //copy tab bar item aNavigationController.tabBarItem = [(UIViewController*)[myTabBarController.viewControllers objectAtIndex:MORE_TAB_INDEX] tabBarItem]; @@ -257,6 +257,18 @@ LinphoneCoreVTable linphone_iphone_vtable = { [super dealloc]; } +-(void) enableDebug:(bool) value { + isDebug = value; + if (isDebug) { + //redirect all traces to the iphone log framework + linphone_core_enable_logs_with_cb(linphone_iphone_log_handler); + } + else { + linphone_core_disable_logs(); + } + linphone_iphone_tunneling_enable_logs (isDebug); + [myMoreViewController enableLogView]; +} /************* *lib linphone init method */ diff --git a/Classes/tunnel.cc b/Classes/tunnel.cc index 2e9060315..c29546503 100644 --- a/Classes/tunnel.cc +++ b/Classes/tunnel.cc @@ -105,6 +105,15 @@ static RtpTransport audio_transport={ audio_recvfrom }; +extern "C" void linphone_iphone_tunneling_enable_logs(bool value) { + if (value) { + SetLogHandler(&linphone_iphone_log_handler); + SetLogLevel(AXTUNNEL_ERROR|AXTUNNEL_WARN); + } else { + SetLogLevel(0); + } + +} extern "C" void linphone_iphone_tunneling_init(const char* ip1 ,const char* ip2 @@ -112,12 +121,9 @@ extern "C" void linphone_iphone_tunneling_init(const char* ip1 ,bool isDebug ,void (*cb)(bool connected, void *data) ,void* userdata) { - if (isDebug) { - SetLogHandler(&linphone_iphone_log_handler); - SetLogLevel(AXTUNNEL_ERROR|AXTUNNEL_WARN); - } else { - SetLogLevel(0); - } + + linphone_iphone_tunneling_enable_logs (isDebug); + linphone_iphone_tun = new TunnelClient(); linphone_iphone_tun->addServer(ip1, port); linphone_iphone_tun->addServer(ip2, port);