|
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 #include "CDialCall.h" |
|
17 |
|
18 /** |
|
19 Factory constructor. |
|
20 |
|
21 @param aController Pointer to MExecAsync object passed to constructor of |
|
22 CISVAPIBase |
|
23 @return Instance of CDialCall class |
|
24 */ |
|
25 CDialCall* CDialCall::NewL(MExecAsync* aController) |
|
26 { |
|
27 CDialCall* self = new(ELeave) CDialCall(aController); |
|
28 CleanupStack::PushL(self); |
|
29 self->ConstructL(); |
|
30 CleanupStack::Pop(self); |
|
31 return self; |
|
32 } |
|
33 |
|
34 /** |
|
35 Destructor. Cancels any outstanding requests. |
|
36 */ |
|
37 CDialCall::~CDialCall() |
|
38 { |
|
39 Cancel(); |
|
40 } |
|
41 |
|
42 /** |
|
43 Sets the required parameters and starts dialling the call. |
|
44 |
|
45 @param aNumber Phone number to dial. |
|
46 */ |
|
47 void CDialCall::DoStartRequestL(const TDesC& aNumber) |
|
48 { |
|
49 CTelephony::TCallParamsV1 callParams; |
|
50 callParams.iIdRestrict = CTelephony::ESendMyId; |
|
51 CTelephony::TCallParamsV1Pckg callParamsPckg(callParams); |
|
52 |
|
53 iConsole->Printf(_L("Dialling ")); |
|
54 |
|
55 // Print the number to dial |
|
56 iConsole->Printf(aNumber); |
|
57 iConsole->Printf(KNewLine); |
|
58 |
|
59 // Dial a new call to specified phone number |
|
60 iTelephony->DialNewCall(iStatus, callParamsPckg, aNumber, iCallId); |
|
61 SetActive(); |
|
62 } |
|
63 |
|
64 /** |
|
65 Constructor. |
|
66 |
|
67 @param aController Pointer to MExecAsync object passed to constructor of CISVAPIBase |
|
68 */ |
|
69 CDialCall::CDialCall(MExecAsync* aController) |
|
70 : CISVAPIAsync(aController, KDialCall) |
|
71 { |
|
72 // Empty method |
|
73 } |
|
74 |
|
75 /** |
|
76 Second phase constructor. |
|
77 */ |
|
78 void CDialCall::ConstructL() |
|
79 { |
|
80 // Empty method |
|
81 } |
|
82 |
|
83 /** |
|
84 Checks status of the active object and displays output to console if |
|
85 there is no error. |
|
86 */ |
|
87 void CDialCall::RunL() |
|
88 { |
|
89 if(iStatus != KErrNone) |
|
90 { |
|
91 // Return error |
|
92 iConsole->Printf(KError); |
|
93 |
|
94 // Print error status code |
|
95 iConsole->Printf(_L("%d\n"), iStatus.Int()); |
|
96 } |
|
97 else |
|
98 { |
|
99 // Print 'Dialling' if there is no error |
|
100 iConsole->Printf(_L("Dialling...\n")); |
|
101 ExampleComplete(); |
|
102 } |
|
103 } |
|
104 |
|
105 /** |
|
106 Cancels asynchronous request to CTelephony::DialNewCall(). |
|
107 */ |
|
108 void CDialCall::DoCancel() |
|
109 { |
|
110 // Cancels an outstanding asynchronous request. |
|
111 iTelephony->CancelAsync(CTelephony::EDialNewCallCancel); |
|
112 } |