|
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 "CHold.h" |
|
18 |
|
19 /** |
|
20 Factory constructor. |
|
21 |
|
22 @param aController Pointer to MExecAsync object passed to constructor of |
|
23 CISVAPIBase |
|
24 @return Instance of CHold class |
|
25 */ |
|
26 CHold* CHold::NewL(MExecAsync* aController) |
|
27 { |
|
28 CHold* self = new(ELeave) CHold(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 CHold::~CHold() |
|
40 { |
|
41 Cancel(); |
|
42 } |
|
43 |
|
44 /** |
|
45 Holds a call if the dynamic capabilities allow it. |
|
46 |
|
47 @param aCallId The identifier of the call to put on hold |
|
48 */ |
|
49 void CHold::DoStartRequestL(CTelephony::TCallId aCallId) |
|
50 { |
|
51 _LIT(KDummyAnswerPanic, "CHold Get Method"); |
|
52 __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1)); |
|
53 iRequestNotify = EFalse; |
|
54 CTelephony::TCallCapsV1 callCapsV1; |
|
55 CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1); |
|
56 |
|
57 // Retrieves the dynamic call capabilities for calls you dialled |
|
58 iTelephony->GetCallDynamicCaps(aCallId, callCapsV1Pckg); |
|
59 |
|
60 if( callCapsV1.iControlCaps & CTelephony::KCapsHold ) |
|
61 { |
|
62 // The call represented by aCallId can be put on hold. |
|
63 iTelephony->Hold(iStatus, aCallId); |
|
64 SetActive(); |
|
65 } |
|
66 else if (callCapsV1.iControlCaps & CTelephony::KCapsSwap) |
|
67 { |
|
68 // Can't hold the active call. |
|
69 } |
|
70 } |
|
71 |
|
72 /** |
|
73 Default constructor. |
|
74 |
|
75 @param aController Pointer to an MExecAsync object passed to constructor of |
|
76 CISVAPIBase |
|
77 */ |
|
78 CHold::CHold(MExecAsync* aController) |
|
79 : CISVAPIAsync(aController, KHold) |
|
80 { |
|
81 // Empty method |
|
82 } |
|
83 |
|
84 /** |
|
85 Second phase constructor. |
|
86 */ |
|
87 void CHold::ConstructL() |
|
88 { |
|
89 // Empty method |
|
90 } |
|
91 |
|
92 /** |
|
93 Checks the status of the active object and calls ExampleComplete() to notify |
|
94 the menu object that the example has finished. |
|
95 */ |
|
96 void CHold::RunL() |
|
97 { |
|
98 if(iStatus != KErrNone) |
|
99 { |
|
100 iConsole->Printf(KError); |
|
101 |
|
102 // Print the error status code |
|
103 iConsole->Printf(_L("%d\n"), iStatus.Int()); |
|
104 } |
|
105 else |
|
106 { |
|
107 ExampleComplete(); |
|
108 } |
|
109 } |
|
110 |
|
111 /** |
|
112 Cancels asynchronous request to CTelephony::Hold() |
|
113 */ |
|
114 void CHold::DoCancel() |
|
115 { |
|
116 // Cancels an outstanding asynchronous request. |
|
117 iTelephony->CancelAsync(CTelephony::EHoldCancel); |
|
118 } |
|
119 |