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