|
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 "CCallWaitingStatus.h" |
|
18 |
|
19 /** |
|
20 Factory constructor. |
|
21 @param aController Pointer to MExecAsync object passed to constructor of |
|
22 CISVAPIBase |
|
23 @return Instance of CFlightModeInfo class |
|
24 */ |
|
25 CCallWaitingStatus* CCallWaitingStatus::NewL(MExecAsync* aController) |
|
26 { |
|
27 CCallWaitingStatus* self = new(ELeave) CCallWaitingStatus(aController); |
|
28 CleanupStack::PushL(self); |
|
29 self->ConstructL(); |
|
30 CleanupStack::Pop(self); |
|
31 return self; |
|
32 } |
|
33 |
|
34 /** |
|
35 Destructor. |
|
36 Cancels outstanding requests. |
|
37 */ |
|
38 CCallWaitingStatus::~CCallWaitingStatus() |
|
39 { |
|
40 Cancel(); |
|
41 } |
|
42 |
|
43 /** |
|
44 Gets the call waiting status and stores it in the iCallWaitingStatusV1Pckg |
|
45 package. |
|
46 */ |
|
47 void CCallWaitingStatus::DoStartRequestL() |
|
48 { |
|
49 _LIT( KNotifyPanic, "CCallWaitingStatus Get Method" ); |
|
50 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 )); |
|
51 iRequestNotify = EFalse; |
|
52 |
|
53 // Interrogate the current status of the call waiting services. |
|
54 iTelephony->GetCallWaitingStatus(iStatus, iCallWaitingStatusV1Pckg); |
|
55 SetActive(); |
|
56 } |
|
57 |
|
58 /** |
|
59 Constructor. |
|
60 |
|
61 @param aController Pointer to an MExecAsync object passed to constructor of |
|
62 CISVAPIBase |
|
63 */ |
|
64 CCallWaitingStatus::CCallWaitingStatus(MExecAsync* aController) |
|
65 : CISVAPIAsync(aController, KCallWaitingStatus), |
|
66 iCallWaitingStatusV1Pckg(iCallWaitingStatusV1) |
|
67 { |
|
68 // Empty method |
|
69 } |
|
70 |
|
71 /** |
|
72 Second phase constructor. |
|
73 */ |
|
74 void CCallWaitingStatus::ConstructL() |
|
75 { |
|
76 // Empty method |
|
77 } |
|
78 |
|
79 /** |
|
80 Checks the status of the active object and prints the call waiting status to |
|
81 the console if there is no error. |
|
82 */ |
|
83 void CCallWaitingStatus::RunL() |
|
84 { |
|
85 if(iStatus != KErrNone) |
|
86 { |
|
87 iConsole->Printf(KError); |
|
88 |
|
89 // Print the error status code |
|
90 iConsole->Printf(_L("%d\n"), iStatus.Int()); |
|
91 } |
|
92 else |
|
93 { |
|
94 // Print the consol output message |
|
95 iConsole->Printf(KCallWaitingStatusMsg); |
|
96 switch(iCallWaitingStatusV1.iCallWaiting) |
|
97 { |
|
98 case CTelephony::EStatusActive: |
|
99 iConsole->Printf(_L("Call Waiting Provisioned\n")); |
|
100 ExampleNotify(); |
|
101 break; |
|
102 case CTelephony::ENotActive: |
|
103 case CTelephony::ENotProvisioned: |
|
104 case CTelephony::ENotAvailable: |
|
105 case CTelephony::EUnknown: |
|
106 iConsole->Printf(_L("Call Waiting Not Provisioned\n")); |
|
107 ExampleComplete(); |
|
108 break; |
|
109 } |
|
110 } |
|
111 } |
|
112 |
|
113 /** |
|
114 Cancels asynchronous request to CTelephony::GetCallWaitingStatus(). |
|
115 */ |
|
116 void CCallWaitingStatus::DoCancel() |
|
117 { |
|
118 // Cancels an outstanding asynchronous request. |
|
119 iTelephony->CancelAsync(CTelephony::EGetCallWaitingStatusCancel); |
|
120 } |