24
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
//INCLUDE FILES
|
|
19 |
#include "cmmdtmftsy.h"
|
|
20 |
#include <etelmmcs.h>
|
|
21 |
#include <ctsy/tflogger.h>
|
|
22 |
|
|
23 |
// include internal Tsy classes
|
|
24 |
#include "cmmphonetsy.h"
|
|
25 |
#include "cmmtsyreqhandlestore.h"
|
|
26 |
#include "cmmcalltsy.h"
|
|
27 |
#include "cmmcalllist.h"
|
|
28 |
#include <ctsy/pluginapi/cmmdatapackage.h>
|
|
29 |
|
|
30 |
// ======== MEMBER FUNCTIONS ========
|
|
31 |
|
|
32 |
CMmDtmfTsy::CMmDtmfTsy()
|
|
33 |
{
|
|
34 |
}
|
|
35 |
|
|
36 |
void CMmDtmfTsy::ConstructL()
|
|
37 |
{
|
|
38 |
iSendDTMFTonesCancelFlag = EFalse;
|
|
39 |
iDtmfType = EDtmfTypeUnknown;
|
|
40 |
|
|
41 |
//register dtmf tsy in the message manager
|
|
42 |
iMmPhone->MessageManager()->RegisterTsyObject(
|
|
43 |
CMmMessageManagerBase::EDtmfTsy, this );
|
|
44 |
}
|
|
45 |
|
|
46 |
CMmDtmfTsy* CMmDtmfTsy::NewL(
|
|
47 |
CMmPhoneTsy* aPhoneTsy ) // Pointer to PhoneTsy
|
|
48 |
{
|
|
49 |
CMmDtmfTsy* self = new ( ELeave ) CMmDtmfTsy;
|
|
50 |
|
|
51 |
// this cannot leave:
|
|
52 |
self->iMmPhone = aPhoneTsy;
|
|
53 |
CleanupStack::PushL( self );
|
|
54 |
self->ConstructL();
|
|
55 |
CleanupStack::Pop();
|
|
56 |
|
|
57 |
return self;
|
|
58 |
}
|
|
59 |
|
|
60 |
CMmDtmfTsy::~CMmDtmfTsy()
|
|
61 |
{
|
|
62 |
TFLOGSTRING("TSY: CMmDtmfTsy::~CMmDtmfTsy");
|
|
63 |
if (iMmPhone )
|
|
64 |
{
|
|
65 |
// deregister tsy object from message manager
|
|
66 |
iMmPhone->MessageManager()->DeregisterTsyObject(this);
|
|
67 |
}
|
|
68 |
iMmPhone = NULL;
|
|
69 |
iDTMFStringToContinue.Zero();
|
|
70 |
iRetDtmfCaps = NULL;
|
|
71 |
}
|
|
72 |
|
|
73 |
// ---------------------------------------------------------------------------
|
|
74 |
// CMmDtmfTsy::DoExtFuncL
|
|
75 |
// DTMF-specific functionality of CMmPhoneTsy::DoExtFuncL
|
|
76 |
// (other items were commented in a header).
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
TInt CMmDtmfTsy::DoExtFuncL(
|
|
80 |
const TTsyReqHandle aTsyReqHandle,
|
|
81 |
const TInt aIpc,
|
|
82 |
const TDataPackage& aPackage )
|
|
83 |
|
|
84 |
{
|
|
85 |
TInt ret = KErrNone;
|
|
86 |
TAny* dataPtr = aPackage.Ptr1();
|
|
87 |
TBool cont ( EFalse );
|
|
88 |
|
|
89 |
switch ( aIpc )
|
|
90 |
{
|
|
91 |
// supported DTMF features
|
|
92 |
|
|
93 |
// Get DTMF Caps
|
|
94 |
case EMobilePhoneGetDTMFCaps:
|
|
95 |
ret = GetDTMFCaps( aTsyReqHandle,
|
|
96 |
reinterpret_cast<TUint32*>( dataPtr ) );
|
|
97 |
break;
|
|
98 |
// Notify Change of DTMF Capabilities
|
|
99 |
case EMobilePhoneNotifyDTMFCapsChange:
|
|
100 |
ret = NotifyDTMFCapsChange(
|
|
101 |
reinterpret_cast<TUint32*>( dataPtr ) );
|
|
102 |
break;
|
|
103 |
// Send DTMF Tones
|
|
104 |
case EMobilePhoneSendDTMFTones:
|
|
105 |
ret = SendDTMFTonesL( aTsyReqHandle, aPackage.Des1u() );
|
|
106 |
break;
|
|
107 |
// Start DTMF Tone
|
|
108 |
case EMobilePhoneStartDTMFTone:
|
|
109 |
ret = StartDTMFToneL( aTsyReqHandle,
|
|
110 |
reinterpret_cast<TChar*>( dataPtr ) );
|
|
111 |
break;
|
|
112 |
// Stop DTMF Tone
|
|
113 |
case EMobilePhoneStopDTMFTone:
|
|
114 |
ret = StopDTMFToneL( aTsyReqHandle );
|
|
115 |
break;
|
|
116 |
// Notify Stop in DTMF String
|
|
117 |
case EMobilePhoneNotifyStopInDTMFString:
|
|
118 |
ret = NotifyStopInDTMFString();
|
|
119 |
break;
|
|
120 |
// Continue or Stop DTMF String Sending
|
|
121 |
case EMobilePhoneContinueDTMFStringSending:
|
|
122 |
cont = * ( reinterpret_cast<TBool*>( dataPtr ) );
|
|
123 |
ret = ContinueDTMFStringSendingL( aTsyReqHandle, cont );
|
|
124 |
break;
|
|
125 |
case EMobilePhoneNotifyDTMFEvent:
|
|
126 |
ret = NotifyDTMFEvent( reinterpret_cast<TInt*>( dataPtr ) );
|
|
127 |
break;
|
|
128 |
// not supported DTMF features
|
|
129 |
case EMobilePhoneReadDTMFTones:
|
|
130 |
ret = KErrNotSupported;
|
|
131 |
break;
|
|
132 |
// error case
|
|
133 |
default:
|
|
134 |
// this method should only be called for DTMF cases
|
|
135 |
ret = KErrArgument;
|
|
136 |
break;
|
|
137 |
}
|
|
138 |
|
|
139 |
return ret;
|
|
140 |
}
|
|
141 |
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
// CMmDtmfTsy::NotifyDtmfEvent
|
|
144 |
// Request for Notification of DTMF event received from client.
|
|
145 |
// ---------------------------------------------------------------------------
|
|
146 |
TInt CMmDtmfTsy::NotifyDTMFEvent( TInt* aInfo )
|
|
147 |
{
|
|
148 |
TFLOGSTRING("TSY: CMmDtmfTsy::NotifyDTMFEvent");
|
|
149 |
|
|
150 |
iDtmfInfo = aInfo; // save pointer to client data
|
|
151 |
|
|
152 |
// save handle type
|
|
153 |
iMmPhone->iReqHandleType = CMmPhoneTsy::EMultimodePhoneNotifyDtmfEvent;
|
|
154 |
|
|
155 |
return KErrNone;
|
|
156 |
}
|
|
157 |
|
|
158 |
// ---------------------------------------------------------------------------
|
|
159 |
// CMmDtmfTsy::CompleteNotifyDtmfEvent
|
|
160 |
// Notifies client that a DTMF event has occurred.
|
|
161 |
// ---------------------------------------------------------------------------
|
|
162 |
//
|
|
163 |
void CMmDtmfTsy::CompleteNotifyDTMFEvent( TInt aInfo )
|
|
164 |
{
|
|
165 |
TFLOGSTRING("TSY: CMmCustomTsy::CompleteNotifyDtmfEvent");
|
|
166 |
// reset request handle. Returns the deleted req handle.
|
|
167 |
TTsyReqHandle reqHandle =
|
|
168 |
iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
|
|
169 |
CMmPhoneTsy::EMultimodePhoneNotifyDtmfEvent );
|
|
170 |
|
|
171 |
// check if request was called
|
|
172 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
|
|
173 |
{
|
|
174 |
*iDtmfInfo = aInfo;
|
|
175 |
iDtmfInfo=NULL;
|
|
176 |
iMmPhone->ReqCompleted( reqHandle, KErrNone );
|
|
177 |
}
|
|
178 |
}
|
|
179 |
|
|
180 |
// ---------------------------------------------------------------------------
|
|
181 |
// CMmDtmfTsy::NotifyDTMFEventCancel
|
|
182 |
// Cancels a notification request.
|
|
183 |
// ---------------------------------------------------------------------------
|
|
184 |
TInt CMmDtmfTsy::NotifyDTMFEventCancel( const TTsyReqHandle aTsyReqHandle )
|
|
185 |
{
|
|
186 |
TFLOGSTRING("TSY: CMmDtmfTsy::NotifyDtmfEventCancel");
|
|
187 |
|
|
188 |
iDtmfInfo = NULL;
|
|
189 |
TTsyReqHandle reqHandle =
|
|
190 |
iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
|
|
191 |
CMmPhoneTsy::EMultimodePhoneNotifyDtmfEvent );
|
|
192 |
iMmPhone->ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
193 |
|
|
194 |
return KErrNone;
|
|
195 |
}
|
|
196 |
|
|
197 |
|
|
198 |
// ---------------------------------------------------------------------------
|
|
199 |
// CMmDtmfTsy::CancelService
|
|
200 |
// Cancels DTMF requests.
|
|
201 |
// (other items were commented in a header).
|
|
202 |
// ---------------------------------------------------------------------------
|
|
203 |
//
|
|
204 |
TInt CMmDtmfTsy::CancelService(
|
|
205 |
const TInt aIpc,
|
|
206 |
const TTsyReqHandle aTsyReqHandle )
|
|
207 |
{
|
|
208 |
TInt ret ( KErrNotSupported );
|
|
209 |
TInt trapError = KErrNone;
|
|
210 |
switch ( aIpc )
|
|
211 |
{
|
|
212 |
case EMobilePhoneNotifyDTMFCapsChange:
|
|
213 |
ret = NotifyDTMFCapsChangeCancel( aTsyReqHandle );
|
|
214 |
break;
|
|
215 |
case EMobilePhoneNotifyStopInDTMFString:
|
|
216 |
ret = NotifyStopInDTMFStringCancel( aTsyReqHandle );
|
|
217 |
break;
|
|
218 |
case EMobilePhoneSendDTMFTones:
|
|
219 |
// Note: it is silently ignored if SendDTMFTonesCancelL
|
|
220 |
// leaves here (it's just a cancellation)
|
|
221 |
TRAP( trapError,
|
|
222 |
ret = SendDTMFTonesCancelL();
|
|
223 |
);
|
|
224 |
if ( KErrNone != trapError )
|
|
225 |
{
|
|
226 |
return trapError;
|
|
227 |
}
|
|
228 |
break;
|
|
229 |
case EMobilePhoneNotifyDTMFEvent:
|
|
230 |
ret = NotifyDTMFEventCancel(aTsyReqHandle);
|
|
231 |
break;
|
|
232 |
// error case
|
|
233 |
default:
|
|
234 |
// this method should only be called for DTMF cases
|
|
235 |
ret = KErrArgument;
|
|
236 |
break;
|
|
237 |
}
|
|
238 |
|
|
239 |
return ret;
|
|
240 |
}
|
|
241 |
#ifndef USING_CTSY_DISPATCHER
|
|
242 |
// ---------------------------------------------------------------------------
|
|
243 |
// CMmDtmfTsy::Complete
|
|
244 |
// Completes the request due timer expiration.
|
|
245 |
// (other items were commented in a header).
|
|
246 |
// ---------------------------------------------------------------------------
|
|
247 |
//
|
|
248 |
void CMmDtmfTsy::Complete(
|
|
249 |
TInt aReqHandleType,
|
|
250 |
TInt )
|
|
251 |
{
|
|
252 |
switch( aReqHandleType )
|
|
253 |
{
|
|
254 |
// there is only one DTMF case with a defined timeout
|
|
255 |
case CMmPhoneTsy::EMultimodePhoneSendDTMFTones:
|
|
256 |
CompleteSendDTMFTones( KErrTimedOut );
|
|
257 |
break;
|
|
258 |
default:
|
|
259 |
// ignore
|
|
260 |
break;
|
|
261 |
}
|
|
262 |
}
|
|
263 |
#endif // USING_CTSY_DISPATCHER
|
|
264 |
|
|
265 |
// ---------------------------------------------------------------------------
|
|
266 |
// CMmDtmfTsy::GetDtmfType
|
|
267 |
// Returns value of internal attribute iDtmfType.
|
|
268 |
// (other items were commented in a header).
|
|
269 |
// ---------------------------------------------------------------------------
|
|
270 |
//
|
|
271 |
CMmDtmfTsy::TDtmfType CMmDtmfTsy::GetDtmfType()
|
|
272 |
{
|
|
273 |
return iDtmfType;
|
|
274 |
}
|
|
275 |
|
|
276 |
// ---------------------------------------------------------------------------
|
|
277 |
// CMmDtmfTsy::GetDTMFCaps
|
|
278 |
// This function returns the DTMF capabilities of the phone in
|
|
279 |
// the aCaps parameter. The DTMF capabilities can change
|
|
280 |
// dynamically for example when the call becomes active or is
|
|
281 |
// closed.
|
|
282 |
// (other items were commented in a header).
|
|
283 |
// ---------------------------------------------------------------------------
|
|
284 |
//
|
|
285 |
TInt CMmDtmfTsy::GetDTMFCaps(
|
|
286 |
const TTsyReqHandle aTsyReqHandle, // Tsy request handle
|
|
287 |
TUint32* aCaps ) // on return, contains the capabilities
|
|
288 |
{
|
|
289 |
//Set initial value for capabilities
|
|
290 |
*aCaps = 0;
|
|
291 |
//Get the number of active Calls in list of calls
|
|
292 |
TInt count = ActiveCalls();
|
|
293 |
//Search the Calls in call list and check if at least one call is active
|
|
294 |
if(count > 0)
|
|
295 |
{
|
|
296 |
*aCaps = RMobilePhone::KCapsSendDTMFString |
|
|
297 |
RMobilePhone::KCapsSendDTMFSingleTone;
|
|
298 |
}
|
|
299 |
|
|
300 |
// Complete the request
|
|
301 |
iMmPhone->ReqCompleted( aTsyReqHandle, KErrNone );
|
|
302 |
|
|
303 |
return KErrNone;
|
|
304 |
}
|
|
305 |
|
|
306 |
// ---------------------------------------------------------------------------
|
|
307 |
// CMmDtmfTsy::NotifyDTMFCapsChange
|
|
308 |
// This function is used to request notifications about changes
|
|
309 |
// in DTMF capabilities.
|
|
310 |
// (other items were commented in a header).
|
|
311 |
// ---------------------------------------------------------------------------
|
|
312 |
//
|
|
313 |
TInt CMmDtmfTsy::NotifyDTMFCapsChange(
|
|
314 |
TUint32* aCaps )
|
|
315 |
{
|
|
316 |
iRetDtmfCaps = aCaps;
|
|
317 |
iMmPhone->iReqHandleType = CMmPhoneTsy::EMultimodePhoneNotifyDTMFCaps;
|
|
318 |
|
|
319 |
return KErrNone;
|
|
320 |
}
|
|
321 |
|
|
322 |
// ---------------------------------------------------------------------------
|
|
323 |
// CMmDtmfTsy::NotifyDTMFCapsChangeCancel
|
|
324 |
// Cancels DTMF capabilities notification request.
|
|
325 |
// (other items were commented in a header).
|
|
326 |
// ---------------------------------------------------------------------------
|
|
327 |
//
|
|
328 |
TInt CMmDtmfTsy::NotifyDTMFCapsChangeCancel(
|
|
329 |
const TTsyReqHandle aTsyReqHandle )
|
|
330 |
{
|
|
331 |
iRetDtmfCaps = NULL;
|
|
332 |
iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
|
|
333 |
CMmPhoneTsy::EMultimodePhoneNotifyDTMFCaps );
|
|
334 |
iMmPhone->ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
335 |
|
|
336 |
return KErrNone;
|
|
337 |
}
|
|
338 |
|
|
339 |
// ---------------------------------------------------------------------------
|
|
340 |
// CMmDtmfTsy::CompleteNotifyDTMFCaps
|
|
341 |
// Notifies client about changes in DTMF capabilities if the
|
|
342 |
// client has requested DTMF change notifications.
|
|
343 |
// (other items were commented in a header).
|
|
344 |
// ---------------------------------------------------------------------------
|
|
345 |
//
|
|
346 |
void CMmDtmfTsy::CompleteNotifyDTMFCaps()
|
|
347 |
{
|
|
348 |
//reset req handle. Returns the deleted req handle
|
|
349 |
TTsyReqHandle reqHandle
|
|
350 |
= iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
|
|
351 |
CMmPhoneTsy::EMultimodePhoneNotifyDTMFCaps );
|
|
352 |
|
|
353 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
|
|
354 |
{
|
|
355 |
GetDTMFCaps( reqHandle, iRetDtmfCaps );
|
|
356 |
iRetDtmfCaps = NULL;
|
|
357 |
iMmPhone->ReqCompleted( reqHandle, KErrNone );
|
|
358 |
}
|
|
359 |
|
|
360 |
}
|
|
361 |
#ifndef USING_CTSY_DISPATCHER
|
|
362 |
// ---------------------------------------------------------------------------
|
|
363 |
// CMmDtmfTsy::SendDTMFTonesL
|
|
364 |
// Sends burst DTMF tones. The DTMF tones to be sent are given
|
|
365 |
// in the parameter and the DTMF string can contain one or more DTMF
|
|
366 |
// characters.
|
|
367 |
// (other items were commented in a header).
|
|
368 |
// ---------------------------------------------------------------------------
|
|
369 |
//
|
|
370 |
TInt CMmDtmfTsy::SendDTMFTonesL(
|
|
371 |
const TTsyReqHandle aTsyReqHandle, // Request handle
|
|
372 |
const TDesC* aTones ) // DTMF tone string to be sent
|
|
373 |
{
|
|
374 |
if( aTones->Length() == 0 )
|
|
375 |
{
|
|
376 |
return KErrArgument;
|
|
377 |
}
|
|
378 |
if( aTones->Length() > KDtmfStringMaxLength)
|
|
379 |
{
|
|
380 |
return KErrArgument;
|
|
381 |
}
|
|
382 |
//check if handle is not in use already
|
|
383 |
TTsyReqHandle sendDTMFTonesHandle = iMmPhone->iTsyReqHandleStore
|
|
384 |
->GetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
|
|
385 |
|
|
386 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown == sendDTMFTonesHandle )
|
|
387 |
{
|
|
388 |
// packed parameter for DOS call: tones
|
|
389 |
// Check if there is an active call
|
|
390 |
if(ActiveCalls() == 0)
|
|
391 |
{
|
|
392 |
return KErrEtelCallNotActive;
|
|
393 |
}
|
|
394 |
CMmDataPackage dataPackage;
|
|
395 |
dataPackage.PackData( const_cast<TDesC*>( aTones ) );
|
|
396 |
TInt ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
397 |
EMobilePhoneSendDTMFTones,
|
|
398 |
&dataPackage
|
|
399 |
);
|
|
400 |
// Save the type of the DTMF
|
|
401 |
iDtmfType = EDtmfTypeString;
|
|
402 |
|
|
403 |
if ( KErrNone != ret )
|
|
404 |
{
|
|
405 |
// DTMF string sending has failed
|
|
406 |
iMmPhone->ReqCompleted( aTsyReqHandle, ret );
|
|
407 |
}
|
|
408 |
else
|
|
409 |
{
|
|
410 |
iMmPhone->iReqHandleType =
|
|
411 |
CMmPhoneTsy::EMultimodePhoneSendDTMFTones;
|
|
412 |
}
|
|
413 |
|
|
414 |
return KErrNone;
|
|
415 |
}
|
|
416 |
else
|
|
417 |
{
|
|
418 |
return KErrServerBusy;
|
|
419 |
}
|
|
420 |
|
|
421 |
}
|
|
422 |
#endif // #ifndef USING_CTSY_DISPATCHER
|
|
423 |
// ---------------------------------------------------------------------------
|
|
424 |
// CMmDtmfTsy::CompleteSendDTMFTones
|
|
425 |
// This function should be called when DTMF string has been sent to
|
|
426 |
// the network. The function completes SendDTMFTones request to the
|
|
427 |
// client.
|
|
428 |
// (other items were commented in a header).
|
|
429 |
// ---------------------------------------------------------------------------
|
|
430 |
//
|
|
431 |
void CMmDtmfTsy::CompleteSendDTMFTones(
|
|
432 |
TInt aResult ) // error code
|
|
433 |
{
|
|
434 |
// Get req handle.
|
|
435 |
TTsyReqHandle reqHandle = iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
|
|
436 |
CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
|
|
437 |
|
|
438 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
|
|
439 |
{
|
|
440 |
iDTMFStringToContinue.Zero();
|
|
441 |
iMmPhone->ReqCompleted( reqHandle, aResult );
|
|
442 |
}
|
|
443 |
|
|
444 |
}
|
|
445 |
|
|
446 |
#ifndef USING_CTSY_DISPATCHER
|
|
447 |
// ---------------------------------------------------------------------------
|
|
448 |
// CMmDtmfTsy::SendDTMFTonesCancelL
|
|
449 |
// Cancels DTMF tone sending.
|
|
450 |
// (other items were commented in a header).
|
|
451 |
// ---------------------------------------------------------------------------
|
|
452 |
//
|
|
453 |
TInt CMmDtmfTsy::SendDTMFTonesCancelL()
|
|
454 |
{
|
|
455 |
TFLOGSTRING("TSY: CMmDtmfTsy::SendDTMFTonesCancel");
|
|
456 |
|
|
457 |
TTsyReqHandle sendDTMFTonesHandle =
|
|
458 |
iMmPhone->iTsyReqHandleStore->GetTsyReqHandle(
|
|
459 |
CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
|
|
460 |
|
|
461 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != sendDTMFTonesHandle )
|
|
462 |
{
|
|
463 |
// no packed parameter for DOS call
|
|
464 |
CMmDataPackage dummyPackage;
|
|
465 |
TInt ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
466 |
EMobilePhoneSendDTMFTonesCancel,
|
|
467 |
&dummyPackage
|
|
468 |
);
|
|
469 |
if ( KErrNone == ret )
|
|
470 |
{
|
|
471 |
// Set the DTMFTonesCancelFlag
|
|
472 |
iSendDTMFTonesCancelFlag = ETrue;
|
|
473 |
}
|
|
474 |
}
|
|
475 |
|
|
476 |
return KErrNone;
|
|
477 |
}
|
|
478 |
#endif // USING_CTSY_DISPATCHER
|
|
479 |
|
|
480 |
// ---------------------------------------------------------------------------
|
|
481 |
// CMmDtmfTsy::CompleteSendDTMFTonesCancel
|
|
482 |
// Complete cancel of sending DTMF tones.
|
|
483 |
// (other items were commented in a header).
|
|
484 |
// ---------------------------------------------------------------------------
|
|
485 |
//
|
|
486 |
void CMmDtmfTsy::CompleteSendDTMFTonesCancel(
|
|
487 |
TInt aResult )
|
|
488 |
{
|
|
489 |
TFLOGSTRING("TSY: CMmDtmfTsy::CompleteSendDTMFTonesCancel");
|
|
490 |
|
|
491 |
// Get req handle.
|
|
492 |
TTsyReqHandle reqHandle = iMmPhone->iTsyReqHandleStore->GetTsyReqHandle(
|
|
493 |
CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
|
|
494 |
|
|
495 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
|
|
496 |
{
|
|
497 |
// If cancel has not succeeded, just discard the message.
|
|
498 |
if ( iSendDTMFTonesCancelFlag )
|
|
499 |
{
|
|
500 |
// Cancel has succeeded. Complete original request and
|
|
501 |
// reset handle
|
|
502 |
iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
|
|
503 |
CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
|
|
504 |
|
|
505 |
iMmPhone->ReqCompleted( reqHandle, KErrCancel );
|
|
506 |
}
|
|
507 |
else
|
|
508 |
{
|
|
509 |
CompleteSendDTMFTones( aResult );
|
|
510 |
}
|
|
511 |
}
|
|
512 |
}
|
|
513 |
#ifndef USING_CTSY_DISPATCHER
|
|
514 |
// ---------------------------------------------------------------------------
|
|
515 |
// CMmDtmfTsy::StartDTMFToneL
|
|
516 |
// This function starts a single DTMF tone sending. The tone
|
|
517 |
// is played until it is stopped using StopDTMFTone method.
|
|
518 |
// (other items were commented in a header).
|
|
519 |
// ---------------------------------------------------------------------------
|
|
520 |
//
|
|
521 |
TInt CMmDtmfTsy::StartDTMFToneL(
|
|
522 |
const TTsyReqHandle aTsyReqHandle,
|
|
523 |
TChar* aTone )
|
|
524 |
{
|
|
525 |
TInt ret = KErrServerBusy;
|
|
526 |
|
|
527 |
// Check if request handle already exists
|
|
528 |
TTsyReqHandle startDtmftoneHandle =
|
|
529 |
iMmPhone->iTsyReqHandleStore->GetTsyReqHandle(
|
|
530 |
CMmPhoneTsy::EMultimodePhoneStartDTMFTone );
|
|
531 |
|
|
532 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != startDtmftoneHandle )
|
|
533 |
{
|
|
534 |
iMmPhone->ReqCompleted( aTsyReqHandle, ret );
|
|
535 |
}
|
|
536 |
else
|
|
537 |
{
|
|
538 |
|
|
539 |
ret = KErrUnknown;
|
|
540 |
// packed parameter for DOS call: tone
|
|
541 |
CMmDataPackage dataPackage;
|
|
542 |
dataPackage.PackData( aTone );
|
|
543 |
ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
544 |
EMobilePhoneStartDTMFTone,
|
|
545 |
&dataPackage
|
|
546 |
);
|
|
547 |
|
|
548 |
if ( KErrNone == ret )
|
|
549 |
{
|
|
550 |
// Save the type of the DTMF
|
|
551 |
iDtmfType = EDtmfTypeDigit;
|
|
552 |
}
|
|
553 |
|
|
554 |
iMmPhone->ReqCompleted( aTsyReqHandle, ret );
|
|
555 |
|
|
556 |
}
|
|
557 |
|
|
558 |
return KErrNone;
|
|
559 |
}
|
|
560 |
|
|
561 |
// ---------------------------------------------------------------------------
|
|
562 |
// CMmDtmfTsy::StopDTMFToneL
|
|
563 |
// Stops playing of a single DTMF tone.
|
|
564 |
// (other items were commented in a header).
|
|
565 |
// ---------------------------------------------------------------------------
|
|
566 |
//
|
|
567 |
TInt CMmDtmfTsy::StopDTMFToneL(
|
|
568 |
const TTsyReqHandle aTsyReqHandle )
|
|
569 |
{
|
|
570 |
TInt ret = KErrServerBusy;
|
|
571 |
|
|
572 |
// Check if request handle already exists
|
|
573 |
TTsyReqHandle stopDtmftoneHandle =
|
|
574 |
iMmPhone->iTsyReqHandleStore->GetTsyReqHandle(
|
|
575 |
CMmPhoneTsy::EMultimodePhoneStopDTMFTone );
|
|
576 |
|
|
577 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != stopDtmftoneHandle )
|
|
578 |
{
|
|
579 |
iMmPhone->ReqCompleted( aTsyReqHandle, ret );
|
|
580 |
}
|
|
581 |
else
|
|
582 |
{
|
|
583 |
// no packed parameter for DOS call
|
|
584 |
CMmDataPackage dummyPackage;
|
|
585 |
ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
586 |
EMobilePhoneStopDTMFTone,
|
|
587 |
&dummyPackage
|
|
588 |
);
|
|
589 |
|
|
590 |
if ( KErrNone == ret )
|
|
591 |
{
|
|
592 |
// Save the type of the DTMF
|
|
593 |
iDtmfType = EDtmfTypeDigit;
|
|
594 |
}
|
|
595 |
|
|
596 |
iMmPhone->ReqCompleted( aTsyReqHandle, ret );
|
|
597 |
}
|
|
598 |
|
|
599 |
return KErrNone;
|
|
600 |
}
|
|
601 |
#endif //USING_CTSY_DISPATCHER
|
|
602 |
// ---------------------------------------------------------------------------
|
|
603 |
// CMmDtmfTsy::NotifyStopInDTMFString
|
|
604 |
// Notifies the client when the phone has encountered a "w" char
|
|
605 |
// during the sending of a DTMF string.
|
|
606 |
// (other items were commented in a header).
|
|
607 |
// ---------------------------------------------------------------------------
|
|
608 |
//
|
|
609 |
TInt CMmDtmfTsy::NotifyStopInDTMFString()
|
|
610 |
{
|
|
611 |
TFLOGSTRING("TSY: CMmDtmfTsy::NotifyStopInDTMFString");
|
|
612 |
//Set TSY request handle type
|
|
613 |
iMmPhone->iReqHandleType =
|
|
614 |
CMmPhoneTsy::EMultimodePhoneNotifyStopInDTMFString;
|
|
615 |
|
|
616 |
return KErrNone;
|
|
617 |
}
|
|
618 |
|
|
619 |
// ---------------------------------------------------------------------------
|
|
620 |
// CMmDtmfTsy::NotifyStopInDTMFStringCancel
|
|
621 |
// Cancel NotifyStopInDTMFString request.
|
|
622 |
// (other items were commented in a header).
|
|
623 |
// ---------------------------------------------------------------------------
|
|
624 |
//
|
|
625 |
TInt CMmDtmfTsy::NotifyStopInDTMFStringCancel(
|
|
626 |
const TTsyReqHandle aTsyReqHandle )
|
|
627 |
{
|
|
628 |
iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
|
|
629 |
CMmPhoneTsy::EMultimodePhoneNotifyStopInDTMFString );
|
|
630 |
|
|
631 |
iMmPhone->ReqCompleted( aTsyReqHandle, KErrCancel );
|
|
632 |
|
|
633 |
return KErrNone;
|
|
634 |
}
|
|
635 |
|
|
636 |
// ---------------------------------------------------------------------------
|
|
637 |
// CMmDtmfTsy::CompleteNotifyStopInDTMFString
|
|
638 |
// Complete notify 'w' in DTMF string. This means that DTMF
|
|
639 |
// string sending is stopped until client calls ContinueDTMFStringSendingL.
|
|
640 |
// (other items were commented in a header).
|
|
641 |
// ---------------------------------------------------------------------------
|
|
642 |
//
|
|
643 |
void CMmDtmfTsy::CompleteNotifyStopInDTMFString(
|
|
644 |
CMmDataPackage* aDataPackage )
|
|
645 |
{
|
|
646 |
TFLOGSTRING("TSY: CMmDtmfTsy::CompleteNotifyStopInDTMFString");
|
|
647 |
// Reset req handle. Returns the deleted req handle
|
|
648 |
TTsyReqHandle reqHandle = iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
|
|
649 |
CMmPhoneTsy::EMultimodePhoneNotifyStopInDTMFString );
|
|
650 |
|
|
651 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
|
|
652 |
{
|
|
653 |
iDTMFStringToContinue.Zero();
|
|
654 |
//Unpack data
|
|
655 |
aDataPackage->UnPackData( iDTMFStringToContinue );
|
|
656 |
|
|
657 |
// Complete the client request
|
|
658 |
iMmPhone->ReqCompleted( reqHandle, KErrNone );
|
|
659 |
}
|
|
660 |
}
|
|
661 |
|
|
662 |
// ---------------------------------------------------------------------------
|
|
663 |
// CMmDtmfTsy::ContinueDTMFStringSendingL
|
|
664 |
// Continues or cancels the stopped DTMF string sending.
|
|
665 |
// (other items were commented in a header).
|
|
666 |
// ---------------------------------------------------------------------------
|
|
667 |
//
|
|
668 |
TInt CMmDtmfTsy::ContinueDTMFStringSendingL(
|
|
669 |
const TTsyReqHandle aTsyReqHandle,
|
|
670 |
TBool aContinue )
|
|
671 |
|
|
672 |
{
|
|
673 |
TFLOGSTRING2("TSY: CMmDtmfTsy::ContinueDTMFStringSendingL aContinue:%d",aContinue);
|
|
674 |
TInt ret( KErrNone );
|
|
675 |
|
|
676 |
TTsyReqHandle sendDTMFTonesHandle =
|
|
677 |
iMmPhone->iTsyReqHandleStore->GetTsyReqHandle(
|
|
678 |
CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
|
|
679 |
|
|
680 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != sendDTMFTonesHandle )
|
|
681 |
{
|
|
682 |
if ( 0 < iDTMFStringToContinue.Length() )
|
|
683 |
{
|
|
684 |
// Continue or cancel sending depending on the boolean value
|
|
685 |
if ( aContinue )
|
|
686 |
{
|
|
687 |
|
|
688 |
// Continue DTMF string sending
|
|
689 |
CMmDataPackage dataPackage;
|
|
690 |
// packed parameter for DOS call: tones to continue
|
|
691 |
dataPackage.PackData( &iDTMFStringToContinue );
|
|
692 |
ret = iMmPhone->MessageManager()->HandleRequestL(
|
|
693 |
EMobilePhoneContinueDTMFStringSending,
|
|
694 |
&dataPackage
|
|
695 |
);
|
|
696 |
}
|
|
697 |
else // Cancel sending
|
|
698 |
{
|
|
699 |
ret = KErrAbort;
|
|
700 |
}
|
|
701 |
}
|
|
702 |
else if ( 0 == iDTMFStringToContinue.Length() )
|
|
703 |
{
|
|
704 |
// Last character was a 'w' so do the cleanup and complete requ
|
|
705 |
CompleteSendDTMFTones( KErrNone );
|
|
706 |
}
|
|
707 |
else
|
|
708 |
{
|
|
709 |
// iDTMFStringToContinue is NULL
|
|
710 |
ret = KErrGeneral;
|
|
711 |
}
|
|
712 |
}
|
|
713 |
else
|
|
714 |
{
|
|
715 |
// DTMF sending not going on. Complete request
|
|
716 |
ret = KErrNotReady;
|
|
717 |
}
|
|
718 |
|
|
719 |
//Complete ContinueDTMFStringSending request
|
|
720 |
if ( KErrNone == ret || KErrAbort == ret )
|
|
721 |
{
|
|
722 |
// Complete continue request with KErrNone
|
|
723 |
iMmPhone->ReqCompleted( aTsyReqHandle, KErrNone );
|
|
724 |
}
|
|
725 |
else
|
|
726 |
{
|
|
727 |
// Complete continue request with error value
|
|
728 |
iMmPhone->ReqCompleted( aTsyReqHandle, ret );
|
|
729 |
}
|
|
730 |
|
|
731 |
//Error occurred or DTMF sending aborted
|
|
732 |
if ( KErrNone != ret )
|
|
733 |
{
|
|
734 |
iDTMFStringToContinue.Zero();
|
|
735 |
|
|
736 |
// Complete SendDTMFTones request if user cancelled DTMF sending
|
|
737 |
// or DTMF string sending failed,
|
|
738 |
if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown
|
|
739 |
!= sendDTMFTonesHandle )
|
|
740 |
{
|
|
741 |
// Reset SendDTMFTones request handle
|
|
742 |
iMmPhone->iTsyReqHandleStore->ResetTsyReqHandle(
|
|
743 |
CMmPhoneTsy::EMultimodePhoneSendDTMFTones );
|
|
744 |
|
|
745 |
// Client has cancelled DTMF sending or sending failed.
|
|
746 |
iMmPhone->ReqCompleted( sendDTMFTonesHandle, ret );
|
|
747 |
}
|
|
748 |
}
|
|
749 |
|
|
750 |
return KErrNone;
|
|
751 |
}
|
|
752 |
|
|
753 |
|
|
754 |
TInt CMmDtmfTsy::ActiveCalls() const
|
|
755 |
{
|
|
756 |
TInt ret = 0;
|
|
757 |
CMmCallList* list = iMmPhone->CallList();
|
|
758 |
//Get the number of Calls in list of calls
|
|
759 |
TInt count = list->GetNumberOfObjects();
|
|
760 |
for ( TInt i = 0; i < count; i++ )
|
|
761 |
{
|
|
762 |
CMmCallTsy* mmCall = list->GetMmCallByIndex( i );
|
|
763 |
if ( mmCall )
|
|
764 |
{
|
|
765 |
// get call status
|
|
766 |
RCall::TStatus callStatus = mmCall->Status();
|
|
767 |
if ( RCall::EStatusConnected == callStatus)
|
|
768 |
{
|
|
769 |
// get service type of call
|
|
770 |
RMobileCall::TMobileCallInfoV1 info;
|
|
771 |
RMobileCall::TMobileCallInfoV1Pckg infoPckg(info);
|
|
772 |
mmCall->FillMobileCallInfo(&infoPckg);
|
|
773 |
RMobilePhone::TMobileService callService = info.iService;
|
|
774 |
//If the call is a voice call
|
|
775 |
if ( (RMobilePhone::EVoiceService == callService) || (RMobilePhone::EAuxVoiceService == callService))
|
|
776 |
{
|
|
777 |
++ret;
|
|
778 |
}
|
|
779 |
}
|
|
780 |
}
|
|
781 |
}
|
|
782 |
return ret;
|
|
783 |
|
|
784 |
}
|
|
785 |
// End of File
|