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 |
//INCLUDES
|
|
19 |
#include "cmmvoicelinetsy.h"
|
|
20 |
#include "cmmphonetsy.h"
|
|
21 |
#include "cmmvoicecalltsy.h"
|
|
22 |
#include "cmmcallextinterface.h"
|
|
23 |
#include "cmmlinelist.h"
|
|
24 |
#include "cmmcalllist.h"
|
|
25 |
#include "cmmtsyreqhandlestore.h"
|
|
26 |
#include <ctsy/pluginapi/cmmdatapackage.h>
|
|
27 |
#include <ctsy/pluginapi/mtelephonyaudiocontrol.h>
|
|
28 |
|
|
29 |
// ======== MEMBER FUNCTIONS ========
|
|
30 |
|
|
31 |
CMmVoiceLineTsy::CMmVoiceLineTsy()
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
void CMmVoiceLineTsy::ConstructL()
|
|
36 |
{
|
|
37 |
TFLOGSTRING("TSY: CMmVoiceLineTsy::ConstructL");
|
|
38 |
CMmLineTsy::ConstructL();
|
|
39 |
}
|
|
40 |
|
|
41 |
CMmVoiceLineTsy* CMmVoiceLineTsy::NewL(
|
|
42 |
CMmPhoneTsy* aMmPhone,
|
|
43 |
RMobilePhone::TMobileService aMode,
|
|
44 |
const TDesC& aName,
|
|
45 |
CMmMessageManagerBase* aMessageManager,
|
|
46 |
MTelephonyAudioControl* aTelephonyAudioControl )
|
|
47 |
{
|
|
48 |
TFLOGSTRING2("TSY: CMmVoiceLineTsy::NewL, Voice line %S created", &aName);
|
|
49 |
CMmVoiceLineTsy* mmLineTsy = NULL;
|
|
50 |
|
|
51 |
if ( aMmPhone != NULL && ( aMode == RMobilePhone::EVoiceService
|
|
52 |
|| aMode == RMobilePhone::EAuxVoiceService ) )
|
|
53 |
{
|
|
54 |
mmLineTsy = new ( ELeave ) CMmVoiceLineTsy();
|
|
55 |
CleanupClosePushL( *mmLineTsy );
|
|
56 |
mmLineTsy->iMmPhone = aMmPhone;
|
|
57 |
mmLineTsy->iLineName = aName;
|
|
58 |
mmLineTsy->iLineMode = aMode;
|
|
59 |
mmLineTsy->iMessageManager = aMessageManager;
|
|
60 |
mmLineTsy->iTelephonyAudioControl = aTelephonyAudioControl;
|
|
61 |
mmLineTsy->ConstructL();
|
|
62 |
CleanupStack::Pop();
|
|
63 |
}
|
|
64 |
return mmLineTsy;
|
|
65 |
}
|
|
66 |
|
|
67 |
CMmVoiceLineTsy::~CMmVoiceLineTsy()
|
|
68 |
{
|
|
69 |
TFLOGSTRING2("TSY: CMmVoiceLineTsy::~CMmVoiceLineTsy. Line name: %S", \
|
|
70 |
&iLineName);
|
|
71 |
}
|
|
72 |
|
|
73 |
// ---------------------------------------------------------------------------
|
|
74 |
// CMmVoiceLineTsy::OpenNewObjectL
|
|
75 |
// This method creates a new name for a call and opens a new call. This method
|
|
76 |
// is called when the client uses RCall::OpenNewCall method. Currently the
|
|
77 |
// maximum number of opened calls from tsy is 20.
|
|
78 |
// (other items were commented in a header).
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
CTelObject* CMmVoiceLineTsy::OpenNewObjectL(
|
|
82 |
TDes& aNewName )
|
|
83 |
{
|
|
84 |
CMmVoiceCallTsy* mmCall = NULL;
|
|
85 |
|
|
86 |
//Logic here to prevent creation of unlimited amount of call objects
|
|
87 |
//by clients. The proposed maximum amount of call objects is 20:
|
|
88 |
//
|
|
89 |
// - 2 voice call object (1 for each line for incoming calls
|
|
90 |
// - 1 data call object (for incoming data call)
|
|
91 |
// - 1 emergency call object
|
|
92 |
// - 1+7 call objects for Confence call (max number of CC participants)
|
|
93 |
// - phonebook 1
|
|
94 |
// - javaphone 1
|
|
95 |
// - WTA 1
|
|
96 |
// - voice mail box 1
|
|
97 |
// - csd 1
|
|
98 |
// - fax 1
|
|
99 |
// - 3rd party 2
|
|
100 |
//
|
|
101 |
|
|
102 |
//Incoming calls can not be created if the maximum number is exceeded!
|
|
103 |
if ( KMaxNumberOfCallObjectsFromTsy
|
|
104 |
> iMmPhone->CallList()->GetNumberOfObjects() )
|
|
105 |
{
|
|
106 |
CreateNewCallName( aNewName );
|
|
107 |
mmCall = CMmVoiceCallTsy::NewL( iMmPhone, this, iLineMode, aNewName,
|
|
108 |
iMessageManager, iTelephonyAudioControl );
|
|
109 |
|
|
110 |
iNameOfLastCallAdded = aNewName;
|
|
111 |
|
|
112 |
// Add the new call to the list of calls
|
|
113 |
TInt ret = iMmPhone->CallList()->AddObject( mmCall );
|
|
114 |
if ( KErrNone != ret )
|
|
115 |
{
|
|
116 |
//If call cannot be added to CallList -> leave with KErrNoMemory
|
|
117 |
//CallList has to have information about every call.
|
|
118 |
mmCall->Close();
|
|
119 |
mmCall = NULL;
|
|
120 |
User::Leave( KErrNoMemory );
|
|
121 |
}
|
|
122 |
else
|
|
123 |
{
|
|
124 |
CompleteNotifyCallAdded( aNewName );
|
|
125 |
}
|
|
126 |
}
|
|
127 |
else
|
|
128 |
{
|
|
129 |
User::Leave( KErrAccessDenied );
|
|
130 |
}
|
|
131 |
|
|
132 |
return mmCall;
|
|
133 |
}
|
|
134 |
|
|
135 |
// ---------------------------------------------------------------------------
|
|
136 |
// CMmVoiceLineTsy::InitInternalAttributesL
|
|
137 |
// Initialises miscellaneous internal attributes.
|
|
138 |
// (other items were commented in a header).
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
//
|
|
141 |
void CMmVoiceLineTsy::InitInternalAttributesL()
|
|
142 |
{
|
|
143 |
CMmLineTsy::InitInternalAttributesL();
|
|
144 |
|
|
145 |
// The line supports voice connections.
|
|
146 |
iLineCaps.iFlags = RLine::KCapsVoice | RLine::KCapsEventIncomingCall;
|
|
147 |
|
|
148 |
if( RMobilePhone::EAuxVoiceService == iLineMode )
|
|
149 |
{
|
|
150 |
iLineCaps.iFlags |= RMobileLine::KCapsAuxVoice;
|
|
151 |
}
|
|
152 |
|
|
153 |
//flag for swap handling
|
|
154 |
iSwapStatus = EStatusSwapNotRequested;
|
|
155 |
}
|
|
156 |
|
|
157 |
// ---------------------------------------------------------------------------
|
|
158 |
// CMmVoiceLineTsy::CreateCallObjectForIncomingCall
|
|
159 |
// This function creates and stores a Call object that is used for a incoming
|
|
160 |
// call.
|
|
161 |
// (other items were commented in a header).
|
|
162 |
// ---------------------------------------------------------------------------
|
|
163 |
//
|
|
164 |
TInt CMmVoiceLineTsy::CreateCallObjectForIncomingCall()
|
|
165 |
{
|
|
166 |
TInt trapError( KErrNone );
|
|
167 |
TInt result( CMmPhoneTsy::EMultimodePhoneOutOfMemory );
|
|
168 |
|
|
169 |
if ( !iCallForIncomingCall )
|
|
170 |
{
|
|
171 |
TName newName;
|
|
172 |
CreateNewCallName( newName );
|
|
173 |
|
|
174 |
TRAP( trapError,
|
|
175 |
iCallForIncomingCall = CMmVoiceCallTsy::NewL(
|
|
176 |
iMmPhone, this, iLineMode, newName, iMessageManager,
|
|
177 |
iTelephonyAudioControl );
|
|
178 |
);
|
|
179 |
|
|
180 |
if ( trapError == KErrNone )
|
|
181 |
{
|
|
182 |
iNameOfLastCallAdded = newName;
|
|
183 |
// Don't add the new call to the list of calls yet. Will be
|
|
184 |
// Added when incoming call has been received...
|
|
185 |
result = KErrNone;
|
|
186 |
}
|
|
187 |
}
|
|
188 |
return result;
|
|
189 |
}
|
|
190 |
|
|
191 |
// ---------------------------------------------------------------------------
|
|
192 |
// CMmVoiceLineTsy::CreateGhostCallObject
|
|
193 |
// This method creates a Call object for the Ghost call. A ghost call is a
|
|
194 |
// call that has been initiated bypassing the ETel.
|
|
195 |
// (other items were commented in a header).
|
|
196 |
// ---------------------------------------------------------------------------
|
|
197 |
//
|
|
198 |
CMmCallTsy* CMmVoiceLineTsy::CreateGhostCallObject(
|
|
199 |
TInt aCallId,
|
|
200 |
RMobilePhone::TMobileService,
|
|
201 |
RMobileCall::TMobileCallStatus aCallStatus )
|
|
202 |
{
|
|
203 |
TInt trapError( KErrNone );
|
|
204 |
|
|
205 |
TName newName;
|
|
206 |
CreateNewCallName( newName );
|
|
207 |
CMmVoiceCallTsy* mmCall = NULL;
|
|
208 |
|
|
209 |
TRAP( trapError, ( mmCall = CMmVoiceCallTsy::NewL( iMmPhone,
|
|
210 |
this, iLineMode, newName, iMessageManager,
|
|
211 |
iTelephonyAudioControl ) ) );
|
|
212 |
|
|
213 |
if ( KErrNone == trapError && NULL != mmCall )
|
|
214 |
{
|
|
215 |
//set call ID
|
|
216 |
mmCall->SetCallId( aCallId );
|
|
217 |
//set call status
|
|
218 |
if( aCallStatus >= RMobileCall::EStatusDialling )
|
|
219 |
{
|
|
220 |
//Status is allways set to dialing. If call is alredy
|
|
221 |
//e.g. connecting, missed status changes are simulated.
|
|
222 |
mmCall->SetCallStatus(
|
|
223 |
RCall::EStatusDialling, RMobileCall::EStatusDialling );
|
|
224 |
}
|
|
225 |
//set call caps
|
|
226 |
mmCall->SetCallCaps( RCall::KCapsVoice | RCall::KCapsHangUp );
|
|
227 |
//set call direction to MO call
|
|
228 |
mmCall->SetCallDirection( RMobileCall::EMobileOriginated );
|
|
229 |
//set flag indicating that this is a ghost call
|
|
230 |
mmCall->SetGhostCall( ETrue );
|
|
231 |
//save name of the last added call
|
|
232 |
iNameOfLastCallAdded = mmCall->CallName();
|
|
233 |
}
|
|
234 |
return mmCall;
|
|
235 |
}
|
|
236 |
|
|
237 |
// ---------------------------------------------------------------------------
|
|
238 |
// CMmVoiceLineTsy::CompleteNotifyIncomingCall
|
|
239 |
// This method notifies clients about incoming call. Basic information: one
|
|
240 |
// Call object is allocated in the boot-up for incoming call. When an incoming
|
|
241 |
// call occurs the call object will be given to the client that answers the
|
|
242 |
// call. Therefore TSY creates a new call object for the next incoming call.
|
|
243 |
// In case of out of memory situation, the next incoming call cannot be
|
|
244 |
// received! General error message about OutOfMemory situation is sent to the
|
|
245 |
// client.
|
|
246 |
// (other items were commented in a header).
|
|
247 |
// ---------------------------------------------------------------------------
|
|
248 |
//
|
|
249 |
void CMmVoiceLineTsy::CompleteNotifyIncomingCall(
|
|
250 |
CMmDataPackage* aDataPackage )
|
|
251 |
{
|
|
252 |
TInt callId( -1 );
|
|
253 |
RMobilePhone::TMobileService callMode( RMobilePhone::EVoiceService );
|
|
254 |
|
|
255 |
CCallDataPackage* callDataPackage =
|
|
256 |
reinterpret_cast<CCallDataPackage*>(aDataPackage);
|
|
257 |
|
|
258 |
callDataPackage->GetCallIdAndMode( callId, callMode );
|
|
259 |
|
|
260 |
TFLOGSTRING3("TSY: CMmVoiceLineTsy::CompleteNotifyIncomingCall - Line \
|
|
261 |
name: %S, Call id: %d", &iLineName, callId );
|
|
262 |
|
|
263 |
//reset req handle. Returns the deleted req handle
|
|
264 |
TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
|
|
265 |
EMultimodeLineNotifyIncomingCall );
|
|
266 |
|
|
267 |
CMmVoiceCallTsy* mmCall = NULL;
|
|
268 |
|
|
269 |
// Check if notification is requested
|
|
270 |
if ( EMultimodeLineReqHandleUnknown != reqHandle )
|
|
271 |
{
|
|
272 |
mmCall = reinterpret_cast<CMmVoiceCallTsy*>(
|
|
273 |
CallObjectForIncomingCall() );
|
|
274 |
|
|
275 |
if ( mmCall )
|
|
276 |
{
|
|
277 |
// Add the new call to the list of calls
|
|
278 |
TInt ret = iMmPhone->CallList()->AddObject( mmCall );
|
|
279 |
|
|
280 |
if ( KErrNone == ret )
|
|
281 |
{
|
|
282 |
//set flag indicating that this is a unowned incoming call
|
|
283 |
mmCall->SetUnownedCallObjectFlag( ETrue );
|
|
284 |
//set call ID
|
|
285 |
mmCall->SetCallId( callId );
|
|
286 |
// Set call direction to EMobileTerminated
|
|
287 |
mmCall->SetCallDirection( RMobileCall::EMobileTerminated );
|
|
288 |
|
|
289 |
// Add answer capability and remove dial capability to
|
|
290 |
// existing call capabilities
|
|
291 |
TUint32 callCaps = mmCall->CallCaps();
|
|
292 |
callCaps |= RCall::KCapsAnswer;
|
|
293 |
callCaps &= ~RCall::KCapsDial;
|
|
294 |
mmCall->SetCallCaps( callCaps );
|
|
295 |
|
|
296 |
//set data to gsm extension
|
|
297 |
//( direction added because not uppdated in messagehandler)
|
|
298 |
mmCall->ActiveCallExtension()->SetMobileCallData(
|
|
299 |
aDataPackage, RMobileCall::EMobileTerminated );
|
|
300 |
|
|
301 |
iNameOfCallForAnswering = mmCall->CallName();
|
|
302 |
iNumCalls++;
|
|
303 |
|
|
304 |
*iRetIncomingCallName = mmCall->CallName();
|
|
305 |
iCallForIncomingCall = NULL;
|
|
306 |
ReqCompleted( reqHandle, KErrNone );
|
|
307 |
|
|
308 |
// Create and store a new Call Object for incoming call.
|
|
309 |
CreateCallObjectForIncomingCall();
|
|
310 |
}
|
|
311 |
else
|
|
312 |
{
|
|
313 |
//call object could not be added to the call list. Incoming
|
|
314 |
//call cannot be received.
|
|
315 |
ReqCompleted( reqHandle, KErrNoMemory );
|
|
316 |
}
|
|
317 |
}
|
|
318 |
else
|
|
319 |
{
|
|
320 |
//call object could not be get. Incoming call cannot be received.
|
|
321 |
//General error message about OutOfMemory situation has been sent
|
|
322 |
//to the client.
|
|
323 |
ReqCompleted( reqHandle, KErrNoMemory );
|
|
324 |
}
|
|
325 |
}
|
|
326 |
}
|
|
327 |
|
|
328 |
// ---------------------------------------------------------------------------
|
|
329 |
// CMmVoiceLineTsy::CompleteNotifyDiallingStatus
|
|
330 |
// This method notifies line that a call has entered Dialling state. It means
|
|
331 |
// that Call ID should be saved and in case of ghost call a new call object
|
|
332 |
// should be created.
|
|
333 |
// (other items were commented in a header).
|
|
334 |
// ---------------------------------------------------------------------------
|
|
335 |
//
|
|
336 |
void CMmVoiceLineTsy::CompleteNotifyDiallingStatus(
|
|
337 |
CMmDataPackage* aDataPackage )
|
|
338 |
{
|
|
339 |
TFLOGSTRING("TSY: CMmVoiceLineTsy::CompleteNotifyDiallingStatus");
|
|
340 |
TInt callId( -1 );
|
|
341 |
TBool ghostCall( EFalse );
|
|
342 |
RMobilePhone::TMobileService callMode( RMobilePhone::EVoiceService );
|
|
343 |
|
|
344 |
CCallDataPackage* callData =
|
|
345 |
reinterpret_cast<CCallDataPackage*>(aDataPackage);
|
|
346 |
|
|
347 |
callData->GetCallIdAndMode( callId, callMode );
|
|
348 |
|
|
349 |
CMmVoiceCallTsy* mmCall = reinterpret_cast<CMmVoiceCallTsy*>(
|
|
350 |
iMmPhone->CallList()->GetMmCallByMode( callMode ) );
|
|
351 |
|
|
352 |
if ( NULL == mmCall )
|
|
353 |
{
|
|
354 |
TFLOGSTRING("TSY: CMmVoiceLineTsy::CompleteNotifyDiallingStatus - \
|
|
355 |
GhostCall");
|
|
356 |
ghostCall = ETrue;
|
|
357 |
}
|
|
358 |
else
|
|
359 |
{
|
|
360 |
TBool result( EFalse );
|
|
361 |
TBool resultNoFdnCheck( EFalse );
|
|
362 |
TBool resultISV( EFalse );
|
|
363 |
|
|
364 |
//now we have to check, if this is a ghost call
|
|
365 |
result = mmCall->IsServiceLocallyRequested(
|
|
366 |
CMmCallTsy::EMultimodeCallDial );
|
|
367 |
|
|
368 |
//now we have to check, if this is a ghost call
|
|
369 |
resultNoFdnCheck = mmCall->IsServiceLocallyRequested(
|
|
370 |
CMmCallTsy::EMultimodeCallDialNoFdnCheck );
|
|
371 |
//now we have to check, if this is a ghost call (3rd party )
|
|
372 |
resultISV = mmCall->IsServiceLocallyRequested(
|
|
373 |
CMmCallTsy::EMultimodeCallDialISV );
|
|
374 |
|
|
375 |
if ( ( !result ) && ( !resultISV ) && ( !resultNoFdnCheck ) )
|
|
376 |
{
|
|
377 |
result = mmCall->IsServiceLocallyRequested(
|
|
378 |
CMmCallTsy::EMultimodeMobileCallDialEmergencyCall );
|
|
379 |
}
|
|
380 |
|
|
381 |
if ( result || resultNoFdnCheck || resultISV )
|
|
382 |
{
|
|
383 |
TFLOGSTRING("TSY: CMmVoiceLineTsy::CompleteNotifyDiallingStatus - Not Emergency call");
|
|
384 |
for ( TInt i = 0; i < iMmPhone->CallList()->GetNumberOfObjects();
|
|
385 |
i++ )
|
|
386 |
{
|
|
387 |
mmCall = reinterpret_cast<CMmVoiceCallTsy*>(
|
|
388 |
iMmPhone->CallList()->GetMmCallByIndex(i) );
|
|
389 |
if ( ( ( mmCall->CallId() == 0 ) || ( mmCall->CallId() == -1 ))
|
|
390 |
&& ( mmCall->ServiceRequested(
|
|
391 |
CMmCallTsy::EMultimodeCallDial )
|
|
392 |
|| mmCall->ServiceRequested(
|
|
393 |
CMmCallTsy::EMultimodeMobileCallDialEmergencyCall )
|
|
394 |
|| ( mmCall->ServiceRequested(
|
|
395 |
CMmCallTsy::EMultimodeCallDialISV ) )
|
|
396 |
|| ( mmCall->ServiceRequested(
|
|
397 |
CMmCallTsy::EMultimodeCallDialNoFdnCheck ) ) ) )
|
|
398 |
{
|
|
399 |
mmCall->SetCallId( callId );
|
|
400 |
TFLOGSTRING2("TSY: CMmVoiceLineTsy::CompleteNotifyDiallingStatus - mmCall SetCallId: %d", callId);
|
|
401 |
mmCall->CompleteNotifyMobileCallInfoChange(
|
|
402 |
aDataPackage );
|
|
403 |
break;
|
|
404 |
}
|
|
405 |
}
|
|
406 |
}
|
|
407 |
else
|
|
408 |
{
|
|
409 |
TFLOGSTRING("TSY: CMmVoiceLineTsy::CompleteNotifyDiallingStatus - \
|
|
410 |
Dial not found");
|
|
411 |
ghostCall = ETrue;
|
|
412 |
}
|
|
413 |
}
|
|
414 |
//Ghost call handling starts here
|
|
415 |
if ( ghostCall )
|
|
416 |
{
|
|
417 |
//complete call added notification directly from here
|
|
418 |
CompleteNotifyAddBypassingCall( aDataPackage );
|
|
419 |
}
|
|
420 |
}
|
|
421 |
|
|
422 |
// ---------------------------------------------------------------------------
|
|
423 |
// CMmVoiceLineTsy::IsSwapReady
|
|
424 |
// Contains the logic for determining if a Swap request is ready
|
|
425 |
// (other items were commented in a header).
|
|
426 |
// ---------------------------------------------------------------------------
|
|
427 |
//
|
|
428 |
TBool CMmVoiceLineTsy::IsSwapReady(
|
|
429 |
RMobileCall::TMobileCallStatus aCallStatus )
|
|
430 |
{
|
|
431 |
TBool ret( EFalse );
|
|
432 |
CMmVoiceLineTsy* otherVoiceLine = NULL;
|
|
433 |
|
|
434 |
CMmLineList* lineList = iMmPhone->LineList();
|
|
435 |
TInt numberOfObjectsInLineList = lineList->GetNumberOfObjects();
|
|
436 |
RMobilePhone::TMobileService lineMode(
|
|
437 |
RMobilePhone::EServiceUnspecified );
|
|
438 |
|
|
439 |
//Required by ALS. We have to check what is the status of calls at the
|
|
440 |
//other line. This for loop find the other voice line (primary or aux).
|
|
441 |
for ( TInt i = 0; i < numberOfObjectsInLineList; i++ )
|
|
442 |
{
|
|
443 |
CMmVoiceLineTsy* line = reinterpret_cast<CMmVoiceLineTsy*>(
|
|
444 |
lineList->GetMmLineByIndex( i ) );
|
|
445 |
|
|
446 |
if ( line != this && line != NULL )
|
|
447 |
{
|
|
448 |
lineMode = line->LineMode();
|
|
449 |
if ( ( lineMode == RMobilePhone::EVoiceService ) ||
|
|
450 |
( lineMode == RMobilePhone::EAuxVoiceService ) )
|
|
451 |
{
|
|
452 |
otherVoiceLine = line;
|
|
453 |
break;
|
|
454 |
}
|
|
455 |
}
|
|
456 |
}
|
|
457 |
|
|
458 |
CMmCallList* callList = iMmPhone->CallList();
|
|
459 |
TInt numberOfObjectsInCallList = callList->GetNumberOfObjects();
|
|
460 |
CMmVoiceCallTsy* mmCall = NULL;
|
|
461 |
|
|
462 |
//is TSY still waiting both hold and connected status indications
|
|
463 |
if ( EWaitingHoldAndResumeOk == iSwapStatus )
|
|
464 |
{
|
|
465 |
//TSY is still waiting both hold and connected status indications
|
|
466 |
if ( RMobileCall::EStatusHold == aCallStatus )
|
|
467 |
{
|
|
468 |
//hold status indication received
|
|
469 |
//-> still waiting connected status indication
|
|
470 |
iSwapStatus = EWaitingResumeOk;
|
|
471 |
}
|
|
472 |
else if ( RMobileCall::EStatusConnected == aCallStatus )
|
|
473 |
{
|
|
474 |
//connected status indication received
|
|
475 |
//-> still waiting hold status indication
|
|
476 |
iSwapStatus = EWaitingHoldOk;
|
|
477 |
}
|
|
478 |
}
|
|
479 |
//swap handling is going on.
|
|
480 |
else if ( ( EWaitingResumeOk == iSwapStatus &&
|
|
481 |
RMobileCall::EStatusConnected == aCallStatus ) ||
|
|
482 |
( EWaitingHoldOk == iSwapStatus &&
|
|
483 |
RMobileCall::EStatusHold == aCallStatus ) )
|
|
484 |
{
|
|
485 |
//find the call object from which the swap was requested.
|
|
486 |
for ( TInt i = 0; i < numberOfObjectsInCallList; i++ )
|
|
487 |
{
|
|
488 |
mmCall = reinterpret_cast<CMmVoiceCallTsy*>(
|
|
489 |
callList->GetMmCallByIndex(i) );
|
|
490 |
if ( mmCall->ServiceRequested(
|
|
491 |
CMmCallTsy::EMultimodeMobileCallSwap ) )
|
|
492 |
{
|
|
493 |
//complete swap request when the correct object has been found
|
|
494 |
mmCall->CompleteSwap( KErrNone );
|
|
495 |
break;
|
|
496 |
}
|
|
497 |
}
|
|
498 |
//clear swap status.
|
|
499 |
iSwapStatus = EStatusSwapNotRequested;
|
|
500 |
//return value indicating that Swap was completed.
|
|
501 |
ret = ETrue;
|
|
502 |
}
|
|
503 |
//swap handling is going on. This the case where the calls to be swapped
|
|
504 |
//are opened different lines (primary and aux).
|
|
505 |
else if ( otherVoiceLine )
|
|
506 |
{
|
|
507 |
if ( ( EWaitingResumeOk == otherVoiceLine->SwapStatus() &&
|
|
508 |
RMobileCall::EStatusConnected == aCallStatus ) ||
|
|
509 |
( EWaitingHoldOk == otherVoiceLine->SwapStatus() &&
|
|
510 |
RMobileCall::EStatusHold == aCallStatus ) )
|
|
511 |
{
|
|
512 |
CMmCallList* callList = iMmPhone->CallList();
|
|
513 |
TInt numberOfObjectsInCallList = callList->GetNumberOfObjects();
|
|
514 |
CMmVoiceCallTsy* mmCall = NULL;
|
|
515 |
//find the call object from which the swap was requested.
|
|
516 |
for ( TInt i = 0; i < numberOfObjectsInCallList; i++ )
|
|
517 |
{
|
|
518 |
mmCall = reinterpret_cast<CMmVoiceCallTsy*>(
|
|
519 |
callList->GetMmCallByIndex(i) );
|
|
520 |
if ( mmCall->ServiceRequested(
|
|
521 |
CMmCallTsy::EMultimodeMobileCallSwap ) )
|
|
522 |
{
|
|
523 |
//complete swap request when the correct object has found
|
|
524 |
mmCall->CompleteSwap( KErrNone );
|
|
525 |
break;
|
|
526 |
}
|
|
527 |
}
|
|
528 |
//clear swap status.
|
|
529 |
iSwapStatus = EStatusSwapNotRequested;
|
|
530 |
//clear swap status also from the aux line
|
|
531 |
otherVoiceLine->SetSwapStatus( EStatusSwapNotRequested );
|
|
532 |
|
|
533 |
//return value indicating that Swap was completed.
|
|
534 |
ret = ETrue;
|
|
535 |
}
|
|
536 |
}
|
|
537 |
|
|
538 |
if ( numberOfObjectsInCallList==1 && !otherVoiceLine )
|
|
539 |
{
|
|
540 |
|
|
541 |
// Swapping a single call.
|
|
542 |
mmCall = reinterpret_cast<CMmVoiceCallTsy*>(
|
|
543 |
callList->GetMmCallByIndex(0) );
|
|
544 |
if ( mmCall->ServiceRequested(
|
|
545 |
CMmCallTsy::EMultimodeMobileCallSwap ) )
|
|
546 |
{
|
|
547 |
// Complete swap request when the correct object has been found
|
|
548 |
mmCall->CompleteSwap( KErrNone );
|
|
549 |
}
|
|
550 |
ret = ETrue;
|
|
551 |
}
|
|
552 |
|
|
553 |
return ret;
|
|
554 |
}
|
|
555 |
|
|
556 |
// ---------------------------------------------------------------------------
|
|
557 |
// CMmVoiceLineTsy::SetSwapStatus
|
|
558 |
// Sets status of Swap. This can be used by call objects opened from this line
|
|
559 |
// (other items were commented in a header).
|
|
560 |
// ---------------------------------------------------------------------------
|
|
561 |
//
|
|
562 |
void CMmVoiceLineTsy::SetSwapStatus(
|
|
563 |
CMmVoiceLineTsy::TSwapStatus aSwapStatus )
|
|
564 |
{
|
|
565 |
iSwapStatus = aSwapStatus;
|
|
566 |
}
|
|
567 |
|
|
568 |
// ---------------------------------------------------------------------------
|
|
569 |
// CMmVoiceLineTsy::SwapStatus
|
|
570 |
// Return status of Swap for this Line. This can be used by call objects
|
|
571 |
// opened from this line.
|
|
572 |
// (other items were commented in a header).
|
|
573 |
// ---------------------------------------------------------------------------
|
|
574 |
//
|
|
575 |
CMmVoiceLineTsy::TSwapStatus CMmVoiceLineTsy::SwapStatus() const
|
|
576 |
{
|
|
577 |
return iSwapStatus;
|
|
578 |
}
|
|
579 |
|
|
580 |
// End of File
|