|
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 "CDialCall.h" |
|
18 |
|
19 /** |
|
20 Factory constructor. |
|
21 |
|
22 @param aController Pointer to MExecAsync object passed to constructor of |
|
23 CISVAPIBase |
|
24 @return Instance of CDialCall class |
|
25 */ |
|
26 CDialCall* CDialCall::NewL(MExecAsync* aController) |
|
27 { |
|
28 CDialCall* self = new(ELeave) CDialCall(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 CDialCall::~CDialCall() |
|
40 { |
|
41 Cancel(); |
|
42 } |
|
43 |
|
44 /** |
|
45 Makes a call to aNumber. |
|
46 |
|
47 @param aNumber The number to dial |
|
48 */ |
|
49 void CDialCall::DoStartRequestL(const TDesC& aNumber) |
|
50 { |
|
51 CTelephony::TCallParamsV1 callParams; |
|
52 callParams.iIdRestrict = CTelephony::ESendMyId; |
|
53 CTelephony::TCallParamsV1Pckg callParamsPckg(callParams); |
|
54 iConsole->Printf(_L("Dialling ")); |
|
55 |
|
56 // Print the number to dial |
|
57 iConsole->Printf(aNumber); |
|
58 iConsole->Printf(KNewLine); |
|
59 |
|
60 // Initiates a new call. |
|
61 iTelephony->DialNewCall(iStatus, callParamsPckg, aNumber, iCallId); |
|
62 SetActive(); |
|
63 } |
|
64 |
|
65 /** |
|
66 Constructor. |
|
67 |
|
68 @param aController Pointer to an MExecAsync object passed to constructor of |
|
69 CISVAPIBase |
|
70 */ |
|
71 CDialCall::CDialCall(MExecAsync* aController) |
|
72 : CISVAPIAsync(aController, KDialCall) |
|
73 { |
|
74 // Empty method |
|
75 } |
|
76 |
|
77 /** |
|
78 Second phase constructor. |
|
79 */ |
|
80 void CDialCall::ConstructL() |
|
81 { |
|
82 // Empty method |
|
83 } |
|
84 |
|
85 /** |
|
86 Checks the status of the active object and calls ExampleComplete() to notify |
|
87 the menu object that the example has finished. |
|
88 */ |
|
89 void CDialCall::RunL() |
|
90 { |
|
91 if(iStatus != KErrNone) |
|
92 { |
|
93 iConsole->Printf(KError); |
|
94 |
|
95 // Print the error status code |
|
96 iConsole->Printf(_L("%d\n"), iStatus.Int()); |
|
97 } |
|
98 else |
|
99 { |
|
100 ExampleComplete(); |
|
101 } |
|
102 } |
|
103 |
|
104 /** |
|
105 Cancels asynchronous request to CTelephony::DialNewCall() |
|
106 */ |
|
107 void CDialCall::DoCancel() |
|
108 { |
|
109 // Cancels an outstanding asynchronous request |
|
110 iTelephony->CancelAsync(CTelephony::EDialNewCallCancel); |
|
111 } |