|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Telephony Multimedia Service |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TMSDTMFPROVIDER_H |
|
19 #define TMSDTMFPROVIDER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <etelmm.h> |
|
23 #include <rmmcustomapi.h> |
|
24 #include "tmsdtmfobserver.h" |
|
25 |
|
26 namespace TMS { |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class TMSEtelDtmfMonitor; |
|
30 class TMSEtelDtmfStopMonitor; |
|
31 |
|
32 /** |
|
33 * TMSDTMFProvider class |
|
34 * Makes asynchronic request to ETel interface according to given request type. |
|
35 * Provides canceling via CActive::Cancel(). |
|
36 */ |
|
37 class TMSDTMFProvider : public CActive |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Two phased constructing of the DTMF provider instance. |
|
43 * @param aPhone mobile phone handle |
|
44 * @param aMmCustom custom API handle for special DTMF event |
|
45 * monitoring. |
|
46 * @return the DTMF provider instance |
|
47 */ |
|
48 static TMSDTMFProvider* NewL(); |
|
49 |
|
50 /** |
|
51 * C++ default destructor |
|
52 */ |
|
53 virtual ~TMSDTMFProvider(); |
|
54 |
|
55 /** |
|
56 * HandleDTMFEvents. |
|
57 * @param aEvent Event type |
|
58 * @param aError Error code |
|
59 * @param aTone Character |
|
60 */ |
|
61 void NotifyDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent aEvent, |
|
62 const TInt aError, const TChar aTone); |
|
63 |
|
64 // from base class MCCPDTMFProvider |
|
65 /** |
|
66 * Cancels asynchronous DTMF string sending. |
|
67 * @return KErrNone if succesfull, otherwise another system wide error code |
|
68 */ |
|
69 TInt CancelDtmfStringSending(); |
|
70 |
|
71 /** |
|
72 * Starts the transmission of a single DTMF tone across a |
|
73 * connected and active call. |
|
74 * @param aTone Tone to be played. |
|
75 * @return KErrNone if succesfull, otherwise another system wide error code |
|
76 */ |
|
77 TInt StartDtmfTone(const TChar aTone); |
|
78 |
|
79 /** |
|
80 * Stops playing current DTMF tone. |
|
81 * @return KErrNone if succesfull, otherwise another system wide error code |
|
82 */ |
|
83 TInt StopDtmfTone(); |
|
84 |
|
85 /** |
|
86 * Plays DTMF string. |
|
87 * @param aString String to be played. |
|
88 * @return KErrNone if succesfull, otherwise another system wide error code |
|
89 * KErrArgument if the specified string contains illegal DTMF characters |
|
90 */ |
|
91 TInt SendDtmfToneString(const TDesC& aString); |
|
92 |
|
93 /** |
|
94 * Continue or cancel sending DTMF string which was stopped with 'w' |
|
95 * character in string. |
|
96 * @param aContinue ETrue if sending of the DTMF string should continue, |
|
97 * EFalse if the rest of the DTMF string is to be discarded. |
|
98 * @return KErrNone if succesfull, otherwise another system wide error code |
|
99 */ |
|
100 TInt ContinueDtmfStringSending(const TBool aContinue); |
|
101 |
|
102 /** |
|
103 * Add an observer for DTMF related events. |
|
104 * Plug-in dependent feature if duplicates or more than one observers |
|
105 * are allowed or not. Currently CCE will set only one observer. |
|
106 * @param aObserver Observer |
|
107 * @leave system error if observer adding fails |
|
108 */ |
|
109 void AddObserverL(const TMSDTMFObserver& aObserver); |
|
110 |
|
111 /** |
|
112 * Remove an observer. |
|
113 * @param aObserver Observer |
|
114 * @return KErrNone if removed succesfully. KErrNotFound if observer was |
|
115 * not found. Any other system error depending on the error. |
|
116 */ |
|
117 TInt RemoveObserver(const TMSDTMFObserver& aObserver); |
|
118 |
|
119 // from base class CActive |
|
120 protected: |
|
121 /** |
|
122 * From CActive |
|
123 * RunL |
|
124 */ |
|
125 void RunL(); |
|
126 |
|
127 /** |
|
128 * From CActive |
|
129 * Cancels the monitor |
|
130 */ |
|
131 void DoCancel(); |
|
132 |
|
133 private: |
|
134 /** |
|
135 * Constructs the requester. |
|
136 * |
|
137 * @param aPhone handle to ETel phone |
|
138 * @param aMmCustom custom API handle |
|
139 */ |
|
140 TMSDTMFProvider(); |
|
141 |
|
142 /** |
|
143 * Constructing the provider in the second phase. |
|
144 */ |
|
145 void ConstructL(); |
|
146 |
|
147 private: |
|
148 /** |
|
149 * DTMF event observer. |
|
150 */ |
|
151 RPointerArray<TMSDTMFObserver> iObservers; |
|
152 |
|
153 /** |
|
154 * ETel phone handle for DTMF functionality. |
|
155 */ |
|
156 RMobilePhone iPhone; |
|
157 |
|
158 /** |
|
159 * Monitor for DTMF events and changes. |
|
160 * Own. |
|
161 */ |
|
162 TMSEtelDtmfMonitor* iMonitor; |
|
163 |
|
164 /** |
|
165 * Monitor for DTMF stopping. |
|
166 * Own. |
|
167 */ |
|
168 TMSEtelDtmfStopMonitor* iStopMonitor; |
|
169 |
|
170 /** |
|
171 * Custom API reference. |
|
172 */ |
|
173 RMmCustomAPI iMmCustom; |
|
174 |
|
175 RTelServer iServer; |
|
176 TBuf<25> iTsyname; |
|
177 }; |
|
178 |
|
179 } //namespace TMS |
|
180 |
|
181 #endif //TMSDTMFPROVIDER_H |