|
1 // Copyright (c) 2005-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 #include "CSwap.h" |
|
18 |
|
19 /** |
|
20 Factory constructor. |
|
21 |
|
22 @param aController Pointer to MExecAsync object passed to constructor of |
|
23 CISVAPIBase |
|
24 @return Instance of CSwap class |
|
25 */ |
|
26 CSwap* CSwap::NewL(MExecAsync* aController) |
|
27 { |
|
28 CSwap* self = new(ELeave) CSwap(aController); |
|
29 CleanupStack::PushL(self); |
|
30 self->ConstructL(); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 /** |
|
36 Destructor. |
|
37 Cancels outstanding requests. |
|
38 */ |
|
39 CSwap::~CSwap() |
|
40 { |
|
41 Cancel(); |
|
42 } |
|
43 |
|
44 /** |
|
45 Swaps the two specified calls if the dynamic call capabilities allow it. |
|
46 |
|
47 @param aCallId1 ID of call to be swapped with aCallId2 |
|
48 @param aCallId2 ID of call to be swapped with aCallId1 |
|
49 */ |
|
50 void CSwap::DoStartRequestL(CTelephony::TCallId aCallId1, |
|
51 CTelephony::TCallId aCallId2) |
|
52 { |
|
53 _LIT(KDummyAnswerPanic, "CSignalInfo Get Method"); |
|
54 __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1)); |
|
55 iRequestNotify = EFalse; |
|
56 CTelephony::TCallCapsV1 callCapsV1; |
|
57 CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1); |
|
58 |
|
59 // Retrieves the dynamic call capabilities for calls you dialled or answered with CTelephony. |
|
60 iTelephony->GetCallDynamicCaps(aCallId1, callCapsV1Pckg); |
|
61 |
|
62 if( callCapsV1.iControlCaps & CTelephony::KCapsSwap) |
|
63 { |
|
64 // The call represented by aCallId1 can be swapped with iCallId2. |
|
65 iTelephony->Swap(iStatus, aCallId1, aCallId2); |
|
66 SetActive(); |
|
67 } |
|
68 else |
|
69 { |
|
70 // The calls cannot be swapped. |
|
71 } |
|
72 } |
|
73 |
|
74 /** |
|
75 Constructor. |
|
76 |
|
77 @param aController Pointer to an MExecAsync object passed to constructor of |
|
78 CISVAPIBase |
|
79 */ |
|
80 CSwap::CSwap(MExecAsync* aController) |
|
81 : CISVAPIAsync(aController, KSwap) |
|
82 { |
|
83 // Empty method |
|
84 } |
|
85 |
|
86 /** |
|
87 Second phase constructor. |
|
88 */ |
|
89 void CSwap::ConstructL() |
|
90 { |
|
91 // Empty method |
|
92 } |
|
93 |
|
94 /** |
|
95 Checks the status of the active object and calls ExampleComplete() to notify |
|
96 the menu object that the example has finished. |
|
97 */ |
|
98 void CSwap::RunL() |
|
99 { |
|
100 if(iStatus != KErrNone) |
|
101 { |
|
102 iConsole->Printf(KError); |
|
103 |
|
104 // Print the error status code |
|
105 iConsole->Printf(_L("Swap %d\n"), iStatus.Int()); |
|
106 } |
|
107 else |
|
108 { |
|
109 ExampleComplete(); |
|
110 } |
|
111 } |
|
112 |
|
113 /** |
|
114 Cancels asynchronous request to CTelephony::Swap(). |
|
115 */ |
|
116 void CSwap::DoCancel() |
|
117 { |
|
118 // Cancels an outstanding asynchronous request. |
|
119 iTelephony->CancelAsync(CTelephony::ESwapCancel); |
|
120 } |
|
121 |