From fc530ed0578510addc280770e092b4cb2b8f7947 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 24 Oct 2011 11:28:49 +0200 Subject: [PATCH] Pause SIP call when audio is interrupted by OS (on incoming GSM call for instance) The SIP call is automatically resumed when audio is available. --- Classes/AdvancedPhoneViewController.m | 8 + Classes/IncallViewController.h | 2 + Classes/IncallViewController.m | 7 + Classes/IncallViewController.xib | 994 +++++++++++------------ Classes/LinphoneUI/LinphoneManager.m | 8 +- Classes/LinphoneUI/LinphoneUIDelegates.h | 1 + Classes/LinphoneUI/UILinphone.h | 1 + Classes/LinphoneUI/UIPauseResumeButton.h | 28 + Classes/LinphoneUI/UIPauseResumeButton.m | 69 ++ Classes/PhoneViewController.m | 4 + 10 files changed, 596 insertions(+), 526 deletions(-) create mode 100644 Classes/LinphoneUI/UIPauseResumeButton.h create mode 100644 Classes/LinphoneUI/UIPauseResumeButton.m diff --git a/Classes/AdvancedPhoneViewController.m b/Classes/AdvancedPhoneViewController.m index 40801743b..9f5c3f633 100644 --- a/Classes/AdvancedPhoneViewController.m +++ b/Classes/AdvancedPhoneViewController.m @@ -51,6 +51,8 @@ } -(void) displayIncallFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { + [self presentModalViewController:mIncallViewController animated:true]; + [super displayIncallFromUI:viewCtrl forUser:username withDisplayName:displayName]; @@ -65,6 +67,12 @@ [mIncallViewController displayStatus:message]; } +-(void) updateUIFromLinphoneState:(UIViewController*) viewCtrl { + [super updateUIFromLinphoneState:viewCtrl]; + + [mIncallViewController updateUIFromLinphoneState:viewCtrl]; +} + - (void)dealloc { [mIncallViewController release]; [super dealloc]; diff --git a/Classes/IncallViewController.h b/Classes/IncallViewController.h index 51d0869f9..fd783733e 100644 --- a/Classes/IncallViewController.h +++ b/Classes/IncallViewController.h @@ -35,6 +35,7 @@ UIHangUpButton* endCtrl; UIButton* dialer; UIMuteButton* mute; + UIPauseResumeButton* pause; UISpeakerButton* speaker; UIButton* contacts; @@ -74,6 +75,7 @@ @property (nonatomic, retain) IBOutlet UIButton* endCtrl; @property (nonatomic, retain) IBOutlet UIButton* dialer; @property (nonatomic, retain) IBOutlet UIButton* mute; +@property (nonatomic, retain) IBOutlet UIButton* pause; @property (nonatomic, retain) IBOutlet UIButton* speaker; @property (nonatomic, retain) IBOutlet UIButton* contacts; diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m index ba06c0292..c3a7464e9 100644 --- a/Classes/IncallViewController.m +++ b/Classes/IncallViewController.m @@ -35,6 +35,7 @@ @synthesize endCtrl; @synthesize close; @synthesize mute; +@synthesize pause; @synthesize dialer; @synthesize speaker; @synthesize contacts; @@ -70,6 +71,7 @@ [super viewDidLoad]; //Controls [mute initWithOnImage:[UIImage imageNamed:@"mic_muted.png"] offImage:[UIImage imageNamed:@"mic_active.png"] ]; + [pause initWithOnImage:[UIImage imageNamed:@"resumecall.png"] offImage:[UIImage imageNamed:@"pausecall.png"] ]; [speaker initWithOnImage:[UIImage imageNamed:@"Speaker-32-on.png"] offImage:[UIImage imageNamed:@"Speaker-32-off.png"] ]; @@ -127,6 +129,11 @@ [callDuration stop]; [self dismissModalViewControllerAnimated:true]; } +-(void) updateUIFromLinphoneState:(UIViewController *)viewCtrl { + [mute reset]; + [pause reset]; +} + - (IBAction)doAction:(id)sender { if (sender == dialer) { diff --git a/Classes/IncallViewController.xib b/Classes/IncallViewController.xib index 74b79c19f..a2b4e804e 100644 --- a/Classes/IncallViewController.xib +++ b/Classes/IncallViewController.xib @@ -2,30 +2,29 @@ 784 - 10J567 - 823 - 1038.35 - 462.00 + 11C74 + 1938 + 1138.23 + 567.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 + 933 - + YES - + IBUIViewController + IBUIButton + IBUIView + IBUILabel + IBProxyObject YES com.apple.InterfaceBuilder.IBCocoaTouchPlugin - YES - - YES - - - YES - + PluginDependencyRecalculationVersion + YES @@ -48,6 +47,8 @@ 292 {320, 55} + + NO YES NO @@ -61,12 +62,23 @@ 1 17 1 + + 1 + 17 + + + Helvetica + 17 + 16 + 292 {{31, 63}, {61, 21}} + + NO YES NO @@ -76,12 +88,16 @@ 1 10 + + 292 {{239, 63}, {65, 21}} + + NO YES NO @@ -91,12 +107,16 @@ 1 10 + + 292 {{31, 347}, {258, 21}} + + NO YES NO @@ -106,27 +126,26 @@ 1 10 + + - + - 292 + -2147483356 YES - - + + 292 - {{0, 61}, {82, 52}} - + {{30, 258}, {80, 65}} + + + NO NO IBCocoaTouchFramework 0 0 - - Helvetica-Bold - 15 - 16 - 3 MQA @@ -139,109 +158,326 @@ 3 MC41AA - - NSImage - mic_active.png - - - - NSImage - mic_muted.png - - - - - - 292 - {{6, 261}, {258, 52}} - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - 1 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - + NSImage stopcall-red.png + + Helvetica-Bold + Helvetica + 2 + 15 + + + Helvetica-Bold + 15 + 16 + - - + + 292 - {{92, 121}, {82, 52}} - + {{170, 266}, {72, 37}} + + + NO NO IBCocoaTouchFramework 0 0 - + 1 + close 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - NSImage - contact-orange.png - + + - - + + 292 - {{93, 61}, {82, 52}} - + {{90, 184}, {82, 52}} + + + NO NO IBCocoaTouchFramework 0 0 - + 1 + 0 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - NSImage - dialer-orange.png - + + - - + + 292 - {{181, 61}, {82, 52}} - + {{0, 9}, {82, 52}} + + + NO NO IBCocoaTouchFramework 0 0 - + 1 + 1 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - NSImage - Speaker-32-off.png + + + + + + 292 + {{90, 9}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + 2 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + 292 + {{180, 9}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + 3 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + 292 + {{0, 69}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + 4 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + 292 + {{90, 69}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + 5 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + 292 + {{180, 69}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + 6 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + 292 + {{0, 124}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + 7 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + 292 + {{90, 124}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + 8 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + 292 + {{180, 124}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + 9 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + 292 + {{0, 184}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + * + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + + 292 + {{180, 184}, {82, 52}} + + + + NO + NO + IBCocoaTouchFramework + 0 + 0 + 1 + # + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + {{25, 110}, {270, 317}} + + 3 MSAwAA @@ -253,293 +489,173 @@ NO IBCocoaTouchFramework - + - -2147483356 + 292 YES - - + + 292 - {{30, 258}, {80, 65}} - + {{0, 61}, {82, 52}} + + + NO NO IBCocoaTouchFramework 0 0 - 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - + + NSImage + mic_active.png + + + + NSImage + mic_muted.png + + + + - - + + 292 - {{170, 266}, {72, 37}} - + {{0, 121}, {82, 52}} + + + NO NO IBCocoaTouchFramework 0 0 - - 1 - close 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + NSImage + pausecall.png + + + + + - - + + 292 - {{90, 184}, {82, 52}} - + {{6, 261}, {258, 52}} + + + NO NO IBCocoaTouchFramework 0 0 - 1 - 0 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + - - + + 292 - {{0, 9}, {82, 52}} - + {{90, 115}, {82, 52}} + + + NO NO IBCocoaTouchFramework 0 0 - - 1 - 1 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + NSImage + contact-orange.png + + + - - + + 292 - {{90, 9}, {82, 52}} - + {{93, 61}, {82, 52}} + + + NO NO IBCocoaTouchFramework 0 0 - - 1 - 2 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + NSImage + dialer-orange.png + + + - - + + 292 - {{180, 9}, {82, 52}} - + {{181, 61}, {82, 52}} + + + NO NO IBCocoaTouchFramework 0 0 - - 1 - 3 1 MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - 292 - {{0, 69}, {82, 52}} - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - 1 - 4 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + NSImage + Speaker-32-off.png - - - - - 292 - {{90, 69}, {82, 52}} - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - 1 - 5 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{180, 69}, {82, 52}} - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - 1 - 6 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{0, 124}, {82, 52}} - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - 1 - 7 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{90, 124}, {82, 52}} - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - 1 - 8 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{180, 124}, {82, 52}} - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - 1 - 9 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{0, 184}, {82, 52}} - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - 1 - * - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{180, 184}, {82, 52}} - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - 1 - # - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - + + {{25, 110}, {270, 317}} + + 3 MSAwAA @@ -550,8 +666,10 @@ IBCocoaTouchFramework - {320, 460} + {{0, 20}, {320, 460}} + + 1 MC44MDAwMDAwMTE5IDAuODAwMDAwMDExOSAwLjgwMDAwMDAxMTkAA @@ -561,6 +679,7 @@ + 1 1 IBCocoaTouchFramework @@ -778,6 +897,23 @@ 99 + + + pause + + + + 105 + + + + doAction: + + + 7 + + 103 + doAction: @@ -796,22 +932,15 @@ 101 - - - doAction: - - - 7 - - 103 - YES 0 - + + YES + @@ -841,10 +970,10 @@ YES - + @@ -875,8 +1004,9 @@ - + + controls @@ -1024,6 +1154,12 @@ status + + 104 + + + pauseresume + @@ -1031,8 +1167,12 @@ YES -1.CustomClassName + -1.IBPluginDependency -2.CustomClassName + -2.IBPluginDependency 10.IBPluginDependency + 104.CustomClassName + 104.IBPluginDependency 11.IBPluginDependency 12.CustomClassName 12.IBPluginDependency @@ -1044,7 +1184,6 @@ 17.IBPluginDependency 18.CustomClassName 18.IBPluginDependency - 2.IBEditorWindowLastContentRect 2.IBPluginDependency 26.IBPluginDependency 27.IBPluginDependency @@ -1081,9 +1220,13 @@ YES IncallViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIPauseResumeButton + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIDuration com.apple.InterfaceBuilder.IBCocoaTouchPlugin UISpeakerButton @@ -1094,7 +1237,6 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIHangUpButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{14, 634}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -1132,20 +1274,16 @@ YES - - YES - + YES - - YES - + - 103 + 105 @@ -1183,6 +1321,7 @@ nine one padSubView + pause peerName peerNumber seven @@ -1211,6 +1350,7 @@ UIButton UIButton UIView + UIButton UILabel UILabel UIButton @@ -1242,6 +1382,7 @@ nine one padSubView + pause peerName peerNumber seven @@ -1315,6 +1456,10 @@ padSubView UIView + + pause + UIButton + peerName UILabel @@ -1359,7 +1504,7 @@ IBProjectSource - Classes/IncallViewController.h + ./Classes/IncallViewController.h @@ -1367,7 +1512,7 @@ UIButton IBProjectSource - Classes/LinphoneUI/UIDigitButton.h + ./Classes/UIDigitButton.h @@ -1375,7 +1520,7 @@ UILabel IBProjectSource - Classes/LinphoneUI/UIDuration.h + ./Classes/UIDuration.h @@ -1383,7 +1528,7 @@ UIButton IBProjectSource - Classes/LinphoneUI/UIHangUpButton.h + ./Classes/UIHangUpButton.h @@ -1391,7 +1536,15 @@ UIToggleButton IBProjectSource - Classes/LinphoneUI/UIMuteButton.h + ./Classes/UIMuteButton.h + + + + UIPauseResumeButton + UIToggleButton + + IBProjectSource + ./Classes/UIPauseResumeButton.h @@ -1399,223 +1552,15 @@ UIToggleButton IBProjectSource - Classes/LinphoneUI/UISpeakerButton.h + ./Classes/UISpeakerButton.h UIToggleButton UIButton - - mActionHandler - id - - - mActionHandler - - mActionHandler - id - - IBProjectSource - Classes/LinphoneUI/UIToggleButton.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h + ./Classes/UIToggleButton.h @@ -1628,14 +1573,13 @@ com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 YES - ../linphone.xcodeproj 3 YES @@ -1646,6 +1590,7 @@ dialer-orange.png mic_active.png mic_muted.png + pausecall.png stopcall-red.png @@ -1653,11 +1598,12 @@ {32, 32} {25, 23} {25, 24} - {32, 32} - {32, 32} + {20, 20} + {20, 20} + {25, 23} {62, 54} - 132 + 933 diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index 546aa78dd..af401c7a0 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -790,11 +790,15 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach } -(void) endInterruption { - const MSList* c = linphone_core_get_calls(theLinphoneCore); ms_message("Sound interruption ended!"); + const MSList* c = linphone_core_get_calls(theLinphoneCore); + if (c) { + ms_message("Auto resuming call"); linphone_core_resume_call(theLinphoneCore, (LinphoneCall*) c->data); - } + } + + [callDelegate updateUIFromLinphoneState:mCurrentViewController]; } @end diff --git a/Classes/LinphoneUI/LinphoneUIDelegates.h b/Classes/LinphoneUI/LinphoneUIDelegates.h index f1e97c906..081139167 100644 --- a/Classes/LinphoneUI/LinphoneUIDelegates.h +++ b/Classes/LinphoneUI/LinphoneUIDelegates.h @@ -25,6 +25,7 @@ -(void) displayCallInProgressFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName; -(void) displayIncomingCallNotigicationFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName; -(void) displayIncallFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName; +-(void) updateUIFromLinphoneState:(UIViewController*) viewCtrl; //status reporting -(void) displayStatus:(NSString*) message; @end diff --git a/Classes/LinphoneUI/UILinphone.h b/Classes/LinphoneUI/UILinphone.h index dae985a8b..49938a8f7 100644 --- a/Classes/LinphoneUI/UILinphone.h +++ b/Classes/LinphoneUI/UILinphone.h @@ -26,3 +26,4 @@ #import "UIDuration.h" #import "UIEraseButton.h" #import "LinphoneUIDelegates.h" +#import "UIPauseResumeButton.h" diff --git a/Classes/LinphoneUI/UIPauseResumeButton.h b/Classes/LinphoneUI/UIPauseResumeButton.h new file mode 100644 index 000000000..fe5a80e30 --- /dev/null +++ b/Classes/LinphoneUI/UIPauseResumeButton.h @@ -0,0 +1,28 @@ +/* UIMuteButton.h + * + * Copyright (C) 2011 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import +#import "UIToggleButton.h" + + +@interface UIPauseResumeButton : UIToggleButton { + +} + +@end diff --git a/Classes/LinphoneUI/UIPauseResumeButton.m b/Classes/LinphoneUI/UIPauseResumeButton.m new file mode 100644 index 000000000..9cd47f8ac --- /dev/null +++ b/Classes/LinphoneUI/UIPauseResumeButton.m @@ -0,0 +1,69 @@ +/* UIMuteButton.m + * + * Copyright (C) 2011 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#import "UIPauseResumeButton.h" +#include "LinphoneManager.h" + + +@implementation UIPauseResumeButton + + + +-(void) onOn { + LinphoneCall* c = linphone_core_get_current_call([LinphoneManager getLc]); + if (c) { + linphone_core_pause_call([LinphoneManager getLc], c); + } +} +-(void) onOff { + const MSList* c = linphone_core_get_calls([LinphoneManager getLc]); + if (c) { + linphone_core_resume_call([LinphoneManager getLc], (LinphoneCall*) c->data); + } +} +-(bool) isInitialStateOn { + @try { + const MSList* c = linphone_core_get_calls([LinphoneManager getLc]); + + if (c) { + return linphone_call_get_state((LinphoneCall*)c->data) == LinphoneCallPaused; + } else { + + return false; + } + } @catch(NSException* e) { + //not ready yet + return false; + } + +} + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code. +} +*/ + +- (void)dealloc { + [super dealloc]; +} + + +@end diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index 0580b1f20..6b49a18f0 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -234,6 +234,10 @@ [status setText:message]; } +-(void) updateUIFromLinphoneState:(UIViewController*) viewCtrl { + [mute reset]; +} + -(void) displayIncomingCallNotigicationFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName {