diff --git a/Classes/BuschJaegerCallView.h b/Classes/BuschJaegerCallView.h index 4fd85957e..bb4a11e8a 100644 --- a/Classes/BuschJaegerCallView.h +++ b/Classes/BuschJaegerCallView.h @@ -24,11 +24,13 @@ #import "UIDigitButton.h" #import "UIHangUpButton.h" #import "LinphoneManager.h" -#import "UILightButton.h" +#import "UIToggleButton.h" #import "VideoZoomHandler.h" @interface BuschJaegerCallView : UIViewController { @private + LinphoneChatRoom *chatRoom; + LinphoneCall *currentCall; VideoZoomHandler* videoZoomHandler; } diff --git a/Classes/BuschJaegerCallView.m b/Classes/BuschJaegerCallView.m index 0e87edaf2..42701c07c 100644 --- a/Classes/BuschJaegerCallView.m +++ b/Classes/BuschJaegerCallView.m @@ -39,6 +39,35 @@ #pragma mark - View lifecycle +- (void)initBuschJaegerCallView { + currentCall = NULL; + chatRoom = NULL; +} + +- (id)init { + self = [super init]; + if(self != NULL) { + [self initBuschJaegerCallView]; + } + return self; +} + +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if(self != NULL) { + [self initBuschJaegerCallView]; + } + return self; +} + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if(self != NULL) { + [self initBuschJaegerCallView]; + } + return self; +} + - (void)dealloc { [videoView release]; [takeCallButton release]; @@ -55,6 +84,9 @@ [super dealloc]; } + +#pragma mark - ViewController Functions + - (void)viewDidLoad { [super viewDidLoad]; @@ -214,6 +246,24 @@ return; } + // Update chatroom + if(currentCall != linphone_core_get_current_call([LinphoneManager getLc])) { + if(currentCall != NULL) { + linphone_chat_room_destroy(chatRoom); + chatRoom = NULL; + } + currentCall = linphone_core_get_current_call([LinphoneManager getLc]); + if(currentCall != NULL) { + char *address = linphone_call_get_remote_address_as_string(currentCall); + if(address != NULL) { + chatRoom = linphone_core_create_chat_room([LinphoneManager getLc], address); + ms_free(address); + } + } + [openDoorButton setChatRoom:chatRoom]; + [lightsButton setChatRoom:chatRoom]; + } + [microButton update]; switch (state) { diff --git a/Classes/BuschJaegerCallView.xib b/Classes/BuschJaegerCallView.xib index cdc1cb975..60a2ec23f 100644 --- a/Classes/BuschJaegerCallView.xib +++ b/Classes/BuschJaegerCallView.xib @@ -1,14 +1,14 @@ - 1296 - 11E53 - 2549 - 1138.47 + 1536 + 11G56 + 2840 + 1138.51 569.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1498 + 1926 IBProxyObject @@ -41,7 +41,6 @@ -2147483374 {320, 480} - _NS:196 @@ -55,7 +54,6 @@ 289 {{266, 20}, {34, 34}} - _NS:9 NO @@ -97,7 +95,6 @@ 292 {73, 58} - _NS:225 @@ -122,7 +119,6 @@ -2147483356 {73, 58} - _NS:225 @@ -144,7 +140,6 @@ 292 {{207, 0}, {73, 58}} - _NS:225 @@ -171,7 +166,6 @@ -2147483356 {{207, 0}, {73, 58}} - _NS:225 NO @@ -193,7 +187,6 @@ 292 {{73, 0}, {67, 58}} - _NS:225 @@ -220,7 +213,6 @@ 292 {{140, 0}, {67, 58}} - _NS:225 @@ -250,7 +242,6 @@ {{20, 399}, {280, 58}} - _NS:196 @@ -265,7 +256,6 @@ 274 {320, 42} - _NS:9 NO @@ -298,7 +288,6 @@ {320, 42} - _NS:9 @@ -310,7 +299,6 @@ {{0, 20}, {320, 480}} - @@ -576,142 +564,12 @@ 91 - - - - BuschJaegerCallView - UIViewController - - id - id - - - - onSnapshotClick: - id - - - takeCall: - id - - - - UILabel - UIHangUpButton - UIHangUpButton - UIView - UIDigitButton - UIToggleButton - UIDigitButton - UIButton - UIButton - UIView - - - - contactLabel - UILabel - - - declineButton - UIHangUpButton - - - endOrRejectCallButton - UIHangUpButton - - - incomingView - UIView - - - lightsButton - UIDigitButton - - - microButton - UIToggleButton - - - openDoorButton - UIDigitButton - - - snapshotButton - UIButton - - - takeCallButton - UIButton - - - videoView - UIView - - - - IBProjectSource - ./Classes/BuschJaegerCallView.h - - - - UIDigitButton - UILongTouchButton - - addressField - UITextField - - - addressField - - addressField - UITextField - - - - IBProjectSource - ./Classes/UIDigitButton.h - - - - UIHangUpButton - UIButton - - IBProjectSource - ./Classes/UIHangUpButton.h - - - - UILongTouchButton - UIButton - - IBProjectSource - ./Classes/UILongTouchButton.h - - - - UIMicroButton - UIToggleButton - - IBProjectSource - ./Classes/UIMicroButton.h - - - - UIToggleButton - UIButton - - IBProjectSource - ./Classes/UIToggleButton.h - - - - + 0 IBCocoaTouchFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - + YES 3 @@ -728,6 +586,6 @@ {16, 16} {44, 34} - 1498 + 1926 diff --git a/Classes/LinphoneUI/UIDigitButton.h b/Classes/LinphoneUI/UIDigitButton.h index 4b7d9f0e4..526240275 100644 --- a/Classes/LinphoneUI/UIDigitButton.h +++ b/Classes/LinphoneUI/UIDigitButton.h @@ -20,11 +20,13 @@ #import #import "UILongTouchButton.h" +#import "linphonecore.h" @interface UIDigitButton : UILongTouchButton { } +@property (nonatomic, assign) LinphoneChatRoom *chatRoom; @property (nonatomic, retain) IBOutlet UITextField* addressField; @property char digit; @property bool dtmf; diff --git a/Classes/LinphoneUI/UIDigitButton.m b/Classes/LinphoneUI/UIDigitButton.m index 3f84c0ee6..8d96e89e9 100644 --- a/Classes/LinphoneUI/UIDigitButton.m +++ b/Classes/LinphoneUI/UIDigitButton.m @@ -26,12 +26,14 @@ @synthesize dtmf; @synthesize digit; @synthesize addressField; +@synthesize chatRoom; #pragma mark - Lifecycle Functions - (void)initUIDigitButton { dtmf = FALSE; + chatRoom = NULL; [self addTarget:self action:@selector(touchDown:) forControlEvents:UIControlEventTouchDown]; [self addTarget:self action:@selector(touchUp:) forControlEvents:UIControlEventTouchUpInside|UIControlEventTouchUpOutside]; } @@ -78,7 +80,11 @@ [addressField setText:newAddress]; linphone_core_play_dtmf([LinphoneManager getLc], digit, -1); } else { - linphone_core_send_dtmf([LinphoneManager getLc], digit); + if(chatRoom == NULL) { + linphone_core_send_dtmf([LinphoneManager getLc], digit); + } else { + linphone_chat_room_send_message(chatRoom, [[NSString stringWithFormat:@"%c", digit] UTF8String]); + } linphone_core_play_dtmf([LinphoneManager getLc], digit, 100); } } diff --git a/Classes/LinphoneUI/UILightButton.h b/Classes/LinphoneUI/UILightButton.h deleted file mode 100644 index 439a85951..000000000 --- a/Classes/LinphoneUI/UILightButton.h +++ /dev/null @@ -1,33 +0,0 @@ -/* UILightButton.h - * - * Copyright (C) 2012 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 "UIToggleButton.h" -#include "linphonecore.h" - - -@interface UILightButton : UIToggleButton { -@public - LinphoneChatRoom* chatRoom; - -} - -- (void)send; - -@end - diff --git a/Classes/LinphoneUI/UILightButton.m b/Classes/LinphoneUI/UILightButton.m deleted file mode 100644 index 600525393..000000000 --- a/Classes/LinphoneUI/UILightButton.m +++ /dev/null @@ -1,46 +0,0 @@ -/* UILightButton.m - * - * Copyright (C) 2012 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 "UILightButton.h" -#import "LinphoneManager.h" - -@implementation UILightButton - -- (void)send { - LinphoneCall *call=linphone_core_get_current_call([LinphoneManager getLc]); - if (call && linphone_call_get_state(call)==LinphoneCallStreamsRunning) { - linphone_core_send_dtmf([LinphoneManager getLc],'2'); - } else if (chatRoom) { - linphone_chat_room_send_message(chatRoom, "2"); - } -} - -- (void)onOn { - [self send]; -} - -- (void)onOff { - [self send]; -} - -- (bool)isInitialStateOn { - return FALSE; -} - -@end diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index f00f52bec..595e0fbd7 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -215,8 +215,6 @@ D37CD31A15E21E330028869A /* BuschJaegerSettingsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D37CD30815E21E330028869A /* BuschJaegerSettingsView.xib */; }; D37CD31B15E21E330028869A /* BuschJaegerUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = D37CD30A15E21E330028869A /* BuschJaegerUtils.m */; }; D37CD31C15E21E330028869A /* BuschJaegerUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = D37CD30A15E21E330028869A /* BuschJaegerUtils.m */; }; - D37CD32115E21E520028869A /* UILightButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D37CD32015E21E520028869A /* UILightButton.m */; }; - D37CD32215E21E520028869A /* UILightButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D37CD32015E21E520028869A /* UILightButton.m */; }; D37CD32815E220620028869A /* buschjaeger_icon_57.png in Resources */ = {isa = PBXBuildFile; fileRef = D37CD32315E220620028869A /* buschjaeger_icon_57.png */; }; D37CD32915E220620028869A /* buschjaeger_icon_57.png in Resources */ = {isa = PBXBuildFile; fileRef = D37CD32315E220620028869A /* buschjaeger_icon_57.png */; }; D37CD32A15E220620028869A /* buschjaeger_icon_57@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D37CD32415E220620028869A /* buschjaeger_icon_57@2x.png */; }; @@ -653,8 +651,6 @@ D37CD30815E21E330028869A /* BuschJaegerSettingsView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BuschJaegerSettingsView.xib; sourceTree = ""; }; D37CD30915E21E330028869A /* BuschJaegerUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BuschJaegerUtils.h; sourceTree = ""; }; D37CD30A15E21E330028869A /* BuschJaegerUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BuschJaegerUtils.m; sourceTree = ""; }; - D37CD31F15E21E520028869A /* UILightButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILightButton.h; sourceTree = ""; }; - D37CD32015E21E520028869A /* UILightButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UILightButton.m; sourceTree = ""; }; D37CD32315E220620028869A /* buschjaeger_icon_57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = buschjaeger_icon_57.png; path = Resources/buschjaeger_icon_57.png; sourceTree = ""; }; D37CD32415E220620028869A /* buschjaeger_icon_57@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "buschjaeger_icon_57@2x.png"; path = "Resources/buschjaeger_icon_57@2x.png"; sourceTree = ""; }; D37CD32515E220620028869A /* buschjaeger_icon_72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = buschjaeger_icon_72.png; path = Resources/buschjaeger_icon_72.png; sourceTree = ""; }; @@ -1121,8 +1117,6 @@ D3FE9F4815E790D70024F3E4 /* UIHistoryDetailsCell.h */, D3FE9F4915E790D80024F3E4 /* UIHistoryDetailsCell.m */, D3FE9F4A15E790D80024F3E4 /* UIHistoryDetailsCell.xib */, - D37CD31F15E21E520028869A /* UILightButton.h */, - D37CD32015E21E520028869A /* UILightButton.m */, D3E84F3C15B018A600420DAC /* UILinphone.h */, D380800415C28A7A005BE9BC /* UILinphone.m */, D32409C1158B49A600C8C119 /* UILongTouchButton.h */, @@ -1754,7 +1748,6 @@ D37CD31115E21E330028869A /* BuschJaegerConfiguration.m in Sources */, D37CD31715E21E330028869A /* BuschJaegerSettingsView.m in Sources */, D37CD31B15E21E330028869A /* BuschJaegerUtils.m in Sources */, - D37CD32115E21E520028869A /* UILightButton.m in Sources */, D37CD35315E22A470028869A /* OutdoorStation.m in Sources */, D37CD38015E22B700028869A /* BuschJaegerWelcomeView.m in Sources */, D37CD38715E22C020028869A /* BuschJaegerMainView.m in Sources */, @@ -1811,7 +1804,6 @@ D37CD31215E21E330028869A /* BuschJaegerConfiguration.m in Sources */, D37CD31815E21E330028869A /* BuschJaegerSettingsView.m in Sources */, D37CD31C15E21E330028869A /* BuschJaegerUtils.m in Sources */, - D37CD32215E21E520028869A /* UILightButton.m in Sources */, D37CD35415E22A470028869A /* OutdoorStation.m in Sources */, D37CD38115E22B700028869A /* BuschJaegerWelcomeView.m in Sources */, D37CD38815E22C020028869A /* BuschJaegerMainView.m in Sources */,