enable debug console if sentence #1234# is typed

This commit is contained in:
jehan monnier 2010-02-24 04:20:04 +01:00
parent 689514f408
commit b849e03a97
4 changed files with 36 additions and 10 deletions

View file

@ -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];

View file

@ -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 <UIApplicationDelegate,LinphoneManagerDelegate,UIActionSheetDelegate> {
@ -60,6 +62,7 @@
IBOutlet PhoneViewController* myPhoneViewController;
CallHistoryTableViewController* myCallHistoryTableViewController;
FavoriteTableViewController* myFavoriteTableViewController;
MoreViewController* myMoreViewController;
ContactPickerDelegate* myContactPickerDelegate;
FirstLoginViewController* myFirstLoginViewController;

View file

@ -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
*/

View file

@ -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);