1 /* |
|
2 * Copyright (c) 2002-2008 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: This file contains the implementation of CPEDtmfHandling class |
|
15 * member functions. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "cpedtmfhandling.h" |
|
22 #include "cpecallhandling.h" |
|
23 |
|
24 #include <pevirtualengine.h> |
|
25 #include <talogger.h> |
|
26 #include <featmgr.h> |
|
27 #include <mccedtmfinterface.h> |
|
28 #include <ccce.h> |
|
29 |
|
30 |
|
31 // EXTERNAL DATA STRUCTURES |
|
32 // None. |
|
33 |
|
34 // EXTERNAL FUNCTION PROTOTYPES |
|
35 // None. |
|
36 |
|
37 // CONSTANTS |
|
38 // None. |
|
39 |
|
40 // MACROS |
|
41 // None. |
|
42 |
|
43 // LOCAL CONSTANTS AND MACROS |
|
44 // None. |
|
45 |
|
46 // MODULE DATA STRUCTURES |
|
47 // None. |
|
48 |
|
49 // LOCAL FUNCTION PROTOTYPES |
|
50 // None. |
|
51 |
|
52 // FORWARD DECLARATIONS |
|
53 // None. |
|
54 |
|
55 |
|
56 // ==================== LOCAL FUNCTIONS ==================== |
|
57 // None. |
|
58 |
|
59 // ================= MEMBER FUNCTIONS ======================= |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CPEDtmfHandling::NewL |
|
63 // Two-phased constructor. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 EXPORT_C CPEDtmfHandling* CPEDtmfHandling::NewL( |
|
67 CPECallHandling& aOwner, |
|
68 MCCEDtmfInterface& aDtmfInterface ) |
|
69 { |
|
70 TEFLOGSTRING( KTAOBJECT, "CALL CPEDtmfHandling::NewL start." ); |
|
71 CPEDtmfHandling* self = new ( ELeave ) CPEDtmfHandling( aOwner, |
|
72 aDtmfInterface ); |
|
73 CleanupStack::PushL( self ); |
|
74 self->ConstructL(); |
|
75 CleanupStack::Pop( self ); |
|
76 |
|
77 TEFLOGSTRING( KTAOBJECT, "CALL CPEDtmfHandling::NewL complete." ); |
|
78 return self; |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CPEDtmfHandling::~CPEDtmfHandling |
|
83 // Destructor. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 EXPORT_C CPEDtmfHandling::~CPEDtmfHandling() |
|
87 { |
|
88 TEFLOGSTRING( KTAOBJECT, "CALL CPEDtmfHandling::~CPEDtmfHandling start." ); |
|
89 TEFLOGSTRING( KTAOBJECT, "CALL CPEDtmfHandling::~CPEDtmfHandling complete." ); |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CPEDtmfHandling::CPEDtmfHandling |
|
94 // C++ default constructor can NOT contain any code, that |
|
95 // might leave. |
|
96 // ----------------------------------------------------------------------------- |
|
97 |
|
98 EXPORT_C CPEDtmfHandling::CPEDtmfHandling( |
|
99 CPECallHandling& aOwner, |
|
100 MCCEDtmfInterface& aDtmfInterface |
|
101 ) : iOwner( aOwner ), |
|
102 iDtmfInterface( aDtmfInterface ) |
|
103 { |
|
104 TEFLOGSTRING( KTAOBJECT, "CALL CPEDtmfHandling::CPEDtmfHandling start." ); |
|
105 iDtmfInterface.SetObserver( *this ); |
|
106 TEFLOGSTRING( KTAOBJECT, "CALL CPEDtmfHandling::CPEDtmfHandling complete." ); |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CPEDtmfHandling::ConstructL |
|
111 // Symbian 2nd phase constructor can leave. |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C void CPEDtmfHandling::ConstructL() |
|
115 { |
|
116 TEFLOGSTRING( KTAOBJECT, "CALL CPEDtmfHandling::ConstructL start." ); |
|
117 TEFLOGSTRING( KTAOBJECT, "CALL CPEDtmfHandling::ConstructL complete." ); |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CPEDtmfHandling::CancelDtmfString |
|
122 // Method cancels the ongoing DTMF tones string sending. |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 void CPEDtmfHandling::CancelDtmfString() |
|
126 { |
|
127 TEFLOGSTRING( KTAMESOUT, "CALL CPEDtmfHandling::CancelDtmfString" ); |
|
128 iDtmfInterface.CancelDtmfStringSending(); |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CPEDtmfHandling::ContinueDtmfSending |
|
133 // Continue the sending of a DTMF string when it was stopped by the use of |
|
134 // 'w' char in the string. |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 void CPEDtmfHandling::ContinueDtmfSending() |
|
138 { |
|
139 TEFLOGSTRING( KTAMESOUT, |
|
140 "CALL CPEDtmfHandling::ContinueDtmfSending, EPEMessageContinuingDTMFSending" ); |
|
141 iOwner.SendMessage( MEngineMonitor::EPEMessageContinuingDTMFSending ); |
|
142 TEFLOGSTRING( KTAREQOUT, |
|
143 "CALL CPEDtmfHandling::ContinueDtmfSending > MCCEDtmfInterface::ContinueStringSending( ETrue )" ); |
|
144 TInt errorCode = iDtmfInterface.ContinueStringSending( ETrue ); |
|
145 TEFLOGSTRING2( KTAREQEND, |
|
146 "CALL CPEDtmfHandling::ContinueDtmfSending > MCCEDtmfInterface::ContinueStringSending( ETrue ); errorCode = %d", errorCode ); |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CPEDtmfHandling::SendDtmfString |
|
151 // Starts sending of DTMF tones string. |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 TInt CPEDtmfHandling::SendDtmfString( |
|
155 const TDesC& aTones ) |
|
156 { |
|
157 TEFLOGSTRING( KTAREQOUT, |
|
158 "CALL CPEDtmfHandling::SendDtmfString > MCCEDtmfInterface::SendDtmfToneString()" ); |
|
159 TInt errorCode = iDtmfInterface.SendDtmfToneString( aTones ); |
|
160 TEFLOGSTRING2( KTAREQEND, |
|
161 "CALL CPEDtmfHandling::SendDtmfString > MCCEDtmfInterface::SendDtmfToneString(); errorCode = %d" |
|
162 , errorCode ); |
|
163 if( errorCode == KErrNone ) |
|
164 { |
|
165 iOwner.SendMessage( MEngineMonitor::EPEMessageSendingDTMF ); |
|
166 } |
|
167 return errorCode; |
|
168 } |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // CPEDtmfHandling::StartDtmfTone |
|
172 // Starts the transmission of a single DTMF tone across a connected and active |
|
173 // voice call. |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 TInt CPEDtmfHandling::StartDtmfTone( |
|
177 const TChar& aTone ) const |
|
178 { |
|
179 TEFLOGSTRING( KTAREQOUT, |
|
180 "CALL CPEDtmfHandling::StartDtmfTone > MCCEDtmfInterface::StartDtmfTone()" ); |
|
181 TInt errorCode = iDtmfInterface.StartDtmfTone( aTone ); |
|
182 TEFLOGSTRING2( KTAREQEND, |
|
183 "CALL CPEDtmfHandling::StartDtmfTone > MCCEDtmfInterface::StartDtmfTone(); errorCode = %d", errorCode ); |
|
184 return errorCode; |
|
185 } |
|
186 |
|
187 // ----------------------------------------------------------------------------- |
|
188 // CPEDtmfHandling::StopDtmfSending |
|
189 // Cancels dtmf sending after 'w'-characte |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 void CPEDtmfHandling::StopDtmfSending() |
|
193 { |
|
194 TEFLOGSTRING( KTAREQEND, |
|
195 "CALL CPEDtmfHandling::StopDtmfSending > MCCEDtmfInterface::CancelDtmfStringSending()" ); |
|
196 iDtmfInterface.CancelDtmfStringSending(); |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CPEDtmfHandling::StopDtmfTone |
|
201 // Stops the transmission of a single DTMF tone, which had previously been |
|
202 // started by use of the StartDTMFTone function member, across a connected |
|
203 // and active voice call. |
|
204 // ----------------------------------------------------------------------------- |
|
205 // |
|
206 TInt CPEDtmfHandling::StopDtmfTone() const |
|
207 { |
|
208 TEFLOGSTRING( KTAREQOUT, |
|
209 "CALL CPEDtmfHandling::StopDtmfTone > MCCEDtmfInterface::StopDtmfTone()" ); |
|
210 TInt errorCode = iDtmfInterface.StopDtmfTone(); |
|
211 TEFLOGSTRING2( KTAREQEND, |
|
212 "CALL PEDtmfHandling::StopDtmfTone > MCCEDtmfInterface::StopDtmfTone(), errorCode = %d" |
|
213 , errorCode ); |
|
214 return errorCode; |
|
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // CPEDtmfHandling::HandleDtmfEvent |
|
219 // From MCCEDtmfObserver. |
|
220 // All the occurred DTMF events are notified through this interface. |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 EXPORT_C void CPEDtmfHandling::HandleDTMFEvent( |
|
224 const MCCEDtmfObserver::TCCEDtmfEvent aEvent, |
|
225 const TInt aError, |
|
226 const TChar /*aTone*/ ) |
|
227 { |
|
228 TEFLOGSTRING3( KTAMESIN, |
|
229 "CALL CPEDtmfHandling::HandleDtmfEvent: aEvent %d, aError %d", |
|
230 aEvent, |
|
231 aError ); |
|
232 |
|
233 switch( aEvent ) |
|
234 { |
|
235 case ECCEDtmfUnknown: |
|
236 iOwner.SendErrorMessage( KPECallIdNotUsed, KErrUnknown ); |
|
237 break; |
|
238 |
|
239 case ECCEDtmfManualStart: |
|
240 case ECCEDtmfSequenceStart: |
|
241 // Handled in audio handling |
|
242 break; |
|
243 |
|
244 case ECCEDtmfManualStop: |
|
245 case ECCEDtmfSequenceStop: |
|
246 // Handled in audio handling |
|
247 break; |
|
248 |
|
249 case ECCEDtmfManualAbort: |
|
250 case ECCEDtmfSequenceAbort: |
|
251 iOwner.SendMessage( MEngineMonitor::EPEMessageDTMFSendingAborted ); |
|
252 break; |
|
253 |
|
254 case ECCEDtmfStopInDtmfString: |
|
255 iOwner.SendMessage( MEngineMonitor::EPEMessageStoppedDTMF ); |
|
256 break; |
|
257 |
|
258 case ECCEDtmfStringSendingCompleted: |
|
259 iOwner.SendMessage( MEngineMonitor::EPEMessageSentDTMF ); |
|
260 break; |
|
261 |
|
262 default: |
|
263 TEFLOGSTRING( KTAERROR, |
|
264 "CALL CPEDtmfHandling::HandleDtmfEvent: NOT HANDLED ENUM VALUE" ); |
|
265 break; |
|
266 } |
|
267 |
|
268 if( aError != KErrNone && |
|
269 !( aEvent == ECCEDtmfStringSendingCompleted && aError == KErrEtelCallNotActive ) ) |
|
270 { |
|
271 iOwner.SendErrorMessage( KPECallIdNotUsed, aError ); |
|
272 } |
|
273 } |
|
274 |
|
275 // ================= OTHER EXPORTED FUNCTIONS =============================== |
|
276 // None. |
|
277 |
|
278 // End of File |
|