Use message instead of DTMF

This commit is contained in:
Yann Diorcet 2012-11-05 11:00:52 +01:00
parent 90c0ed39a7
commit e99237c441
8 changed files with 70 additions and 239 deletions

View file

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

View file

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

View file

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2549</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<int key="IBDocument.SystemTarget">1536</int>
<string key="IBDocument.SystemVersion">11G56</string>
<string key="IBDocument.InterfaceBuilderVersion">2840</string>
<string key="IBDocument.AppKitVersion">1138.51</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1498</string>
<string key="NS.object.0">1926</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
@ -41,7 +41,6 @@
<int key="NSvFlags">-2147483374</int>
<string key="NSFrameSize">{320, 480}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="935863454"/>
<string key="NSReuseIdentifierKey">_NS:196</string>
<object class="NSColor" key="IBUIBackgroundColor" id="732745065">
@ -55,7 +54,6 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{266, 20}, {34, 34}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="903884486"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
@ -97,7 +95,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrameSize">{73, 58}</string>
<reference key="NSSuperview" ref="903884486"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="842436331"/>
<string key="NSReuseIdentifierKey">_NS:225</string>
<object class="NSColor" key="IBUIBackgroundColor" id="666829842">
@ -122,7 +119,6 @@
<int key="NSvFlags">-2147483356</int>
<string key="NSFrameSize">{73, 58}</string>
<reference key="NSSuperview" ref="903884486"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1031602630"/>
<string key="NSReuseIdentifierKey">_NS:225</string>
<reference key="IBUIBackgroundColor" ref="666829842"/>
@ -144,7 +140,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{207, 0}, {73, 58}}</string>
<reference key="NSSuperview" ref="903884486"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="33985418"/>
<string key="NSReuseIdentifierKey">_NS:225</string>
<reference key="IBUIBackgroundColor" ref="666829842"/>
@ -171,7 +166,6 @@
<int key="NSvFlags">-2147483356</int>
<string key="NSFrame">{{207, 0}, {73, 58}}</string>
<reference key="NSSuperview" ref="903884486"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:225</string>
<reference key="IBUIBackgroundColor" ref="666829842"/>
<bool key="IBUIOpaque">NO</bool>
@ -193,7 +187,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{73, 0}, {67, 58}}</string>
<reference key="NSSuperview" ref="903884486"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="762727327"/>
<string key="NSReuseIdentifierKey">_NS:225</string>
<reference key="IBUIBackgroundColor" ref="666829842"/>
@ -220,7 +213,6 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{140, 0}, {67, 58}}</string>
<reference key="NSSuperview" ref="903884486"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="889522260"/>
<string key="NSReuseIdentifierKey">_NS:225</string>
<reference key="IBUIBackgroundColor" ref="666829842"/>
@ -250,7 +242,6 @@
</array>
<string key="NSFrame">{{20, 399}, {280, 58}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="910162139"/>
<string key="NSReuseIdentifierKey">_NS:196</string>
<reference key="IBUIBackgroundColor" ref="666829842"/>
@ -265,7 +256,6 @@
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{320, 42}</string>
<reference key="NSSuperview" ref="935863454"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="317702958"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
@ -298,7 +288,6 @@
</array>
<string key="NSFrameSize">{320, 42}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="810603278"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
@ -310,7 +299,6 @@
</array>
<string key="NSFrame">{{0, 20}, {320, 480}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1051556672"/>
<reference key="IBUIBackgroundColor" ref="732745065"/>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
@ -576,142 +564,12 @@
<nil key="sourceID"/>
<int key="maxID">91</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">BuschJaegerCallView</string>
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="onSnapshotClick:">id</string>
<string key="takeCall:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="onSnapshotClick:">
<string key="name">onSnapshotClick:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="takeCall:">
<string key="name">takeCall:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="contactLabel">UILabel</string>
<string key="declineButton">UIHangUpButton</string>
<string key="endOrRejectCallButton">UIHangUpButton</string>
<string key="incomingView">UIView</string>
<string key="lightsButton">UIDigitButton</string>
<string key="microButton">UIToggleButton</string>
<string key="openDoorButton">UIDigitButton</string>
<string key="snapshotButton">UIButton</string>
<string key="takeCallButton">UIButton</string>
<string key="videoView">UIView</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="contactLabel">
<string key="name">contactLabel</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo" key="declineButton">
<string key="name">declineButton</string>
<string key="candidateClassName">UIHangUpButton</string>
</object>
<object class="IBToOneOutletInfo" key="endOrRejectCallButton">
<string key="name">endOrRejectCallButton</string>
<string key="candidateClassName">UIHangUpButton</string>
</object>
<object class="IBToOneOutletInfo" key="incomingView">
<string key="name">incomingView</string>
<string key="candidateClassName">UIView</string>
</object>
<object class="IBToOneOutletInfo" key="lightsButton">
<string key="name">lightsButton</string>
<string key="candidateClassName">UIDigitButton</string>
</object>
<object class="IBToOneOutletInfo" key="microButton">
<string key="name">microButton</string>
<string key="candidateClassName">UIToggleButton</string>
</object>
<object class="IBToOneOutletInfo" key="openDoorButton">
<string key="name">openDoorButton</string>
<string key="candidateClassName">UIDigitButton</string>
</object>
<object class="IBToOneOutletInfo" key="snapshotButton">
<string key="name">snapshotButton</string>
<string key="candidateClassName">UIButton</string>
</object>
<object class="IBToOneOutletInfo" key="takeCallButton">
<string key="name">takeCallButton</string>
<string key="candidateClassName">UIButton</string>
</object>
<object class="IBToOneOutletInfo" key="videoView">
<string key="name">videoView</string>
<string key="candidateClassName">UIView</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/BuschJaegerCallView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIDigitButton</string>
<string key="superclassName">UILongTouchButton</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">addressField</string>
<string key="NS.object.0">UITextField</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">addressField</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">addressField</string>
<string key="candidateClassName">UITextField</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UIDigitButton.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIHangUpButton</string>
<string key="superclassName">UIButton</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UIHangUpButton.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UILongTouchButton</string>
<string key="superclassName">UIButton</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UILongTouchButton.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIMicroButton</string>
<string key="superclassName">UIToggleButton</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UIMicroButton.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIToggleButton</string>
<string key="superclassName">UIButton</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UIToggleButton.h</string>
</object>
</object>
</array>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
<real value="1536" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
@ -728,6 +586,6 @@
<string key="icon5.png">{16, 16}</string>
<string key="snapshot.png">{44, 34}</string>
</dictionary>
<string key="IBCocoaTouchPluginVersion">1498</string>
<string key="IBCocoaTouchPluginVersion">1926</string>
</data>
</archive>

View file

@ -20,11 +20,13 @@
#import <UIKit/UIKit.h>
#import "UILongTouchButton.h"
#import "linphonecore.h"
@interface UIDigitButton : UILongTouchButton<UILongTouchButtonDelegate> {
}
@property (nonatomic, assign) LinphoneChatRoom *chatRoom;
@property (nonatomic, retain) IBOutlet UITextField* addressField;
@property char digit;
@property bool dtmf;

View file

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

View file

@ -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<UIToggleButtonDelegate> {
@public
LinphoneChatRoom* chatRoom;
}
- (void)send;
@end

View file

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

View file

@ -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 = "<group>"; };
D37CD30915E21E330028869A /* BuschJaegerUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BuschJaegerUtils.h; sourceTree = "<group>"; };
D37CD30A15E21E330028869A /* BuschJaegerUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BuschJaegerUtils.m; sourceTree = "<group>"; };
D37CD31F15E21E520028869A /* UILightButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILightButton.h; sourceTree = "<group>"; };
D37CD32015E21E520028869A /* UILightButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UILightButton.m; sourceTree = "<group>"; };
D37CD32315E220620028869A /* buschjaeger_icon_57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = buschjaeger_icon_57.png; path = Resources/buschjaeger_icon_57.png; sourceTree = "<group>"; };
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 = "<group>"; };
D37CD32515E220620028869A /* buschjaeger_icon_72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = buschjaeger_icon_72.png; path = Resources/buschjaeger_icon_72.png; sourceTree = "<group>"; };
@ -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 */,