|
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 "CHangup.h" |
|
17 |
|
18 /** |
|
19 Factory constructor. |
|
20 @param aController Pointer to MExecAsync object passed to constructor of |
|
21 CISVAPIBase |
|
22 @return Instance of CHangup class |
|
23 */ |
|
24 CHangup* CHangup::NewL(MExecAsync* aController) |
|
25 { |
|
26 CHangup* self = new(ELeave) CHangup(aController); |
|
27 CleanupStack::PushL(self); |
|
28 self->ConstructL(); |
|
29 CleanupStack::Pop(self); |
|
30 return self; |
|
31 } |
|
32 |
|
33 /** |
|
34 Destructor. |
|
35 Cancels outstanding requests. |
|
36 */ |
|
37 CHangup::~CHangup() |
|
38 { |
|
39 Cancel(); |
|
40 } |
|
41 |
|
42 /** |
|
43 Hangs up call specified in aCallId. |
|
44 @param aCallId Call ID of call to hang up |
|
45 */ |
|
46 void CHangup::DoStartRequestL(CTelephony::TCallId aCallId) |
|
47 { |
|
48 // Hangs up a call. |
|
49 iTelephony->Hangup(iStatus, aCallId); |
|
50 SetActive(); |
|
51 } |
|
52 |
|
53 /** |
|
54 Constructor. |
|
55 @param aController Pointer to MExecAsync object passed to constructor of CISVAPIBase |
|
56 */ |
|
57 CHangup::CHangup(MExecAsync* aController) |
|
58 : CISVAPIAsync(aController, KHangup) |
|
59 { |
|
60 // Empty method |
|
61 } |
|
62 |
|
63 /** |
|
64 Second phase constructor. |
|
65 */ |
|
66 void CHangup::ConstructL() |
|
67 { |
|
68 // Empty method |
|
69 } |
|
70 |
|
71 /** |
|
72 Checks the status of the active object and if there is no error, |
|
73 tells the user via the console that the call has been hung up. |
|
74 */ |
|
75 void CHangup::RunL() |
|
76 { |
|
77 if(iStatus != KErrNone) |
|
78 { |
|
79 iConsole->Printf(KError); |
|
80 |
|
81 // Print error status code |
|
82 iConsole->Printf(_L("%d\n"), iStatus.Int()); |
|
83 } |
|
84 else |
|
85 { |
|
86 // Print output to console if there is no error |
|
87 iConsole->Printf(_L("CLICK\n")); |
|
88 ExampleComplete(); |
|
89 } |
|
90 } |
|
91 |
|
92 /** |
|
93 Cancels asynchronous request to CTelephony::Hangup() |
|
94 */ |
|
95 void CHangup::DoCancel() |
|
96 { |
|
97 // Cancels an outstanding asynchronous request. |
|
98 iTelephony->CancelAsync(CTelephony::EHangupCancel); |
|
99 } |