|
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 "CCallForwardingStatus.h" |
|
18 |
|
19 /** |
|
20 Factory constructor. |
|
21 |
|
22 @param aController Pointer to MExecAsync object passed to constructor of |
|
23 CISVAPIBase |
|
24 @return Instance of CCallForwardingStatus class |
|
25 */ |
|
26 CCallForwardingStatus* CCallForwardingStatus::NewL(MExecAsync* aController) |
|
27 { |
|
28 CCallForwardingStatus* self = new(ELeave) CCallForwardingStatus(aController); |
|
29 CleanupStack::PushL(self); |
|
30 self->ConstructL(); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 /** |
|
36 Cancels outstanding requests. |
|
37 */ |
|
38 CCallForwardingStatus::~CCallForwardingStatus() |
|
39 { |
|
40 Cancel(); |
|
41 } |
|
42 |
|
43 /** |
|
44 Retrieves the current forwarding status. |
|
45 */ |
|
46 void CCallForwardingStatus::DoStartRequestL() |
|
47 { |
|
48 _LIT( KNotifyPanic, "CCallForwardingStatus Get Method" ); |
|
49 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 )); |
|
50 iRequestNotify = EFalse; |
|
51 if (iSecondCondition) |
|
52 { |
|
53 iSecondCondition = EFalse; |
|
54 CTelephony::TCallForwardingCondition condition2; |
|
55 condition2 = CTelephony::ECallForwardingUnconditional; |
|
56 |
|
57 // Interrogates the current status of the call forwarding services for first condition. |
|
58 iTelephony->GetCallForwardingStatus(iStatus, |
|
59 condition2, |
|
60 iCallForwardingStatus2V1Pckg); |
|
61 } |
|
62 else |
|
63 { |
|
64 iSecondCondition = ETrue; |
|
65 CTelephony::TCallForwardingCondition condition1; |
|
66 condition1 = CTelephony::ECallForwardingNoReply; |
|
67 |
|
68 // Interrogates the current status of the call forwarding services for second condition |
|
69 iTelephony->GetCallForwardingStatus(iStatus, |
|
70 condition1, |
|
71 iCallForwardingStatus1V1Pckg); |
|
72 } |
|
73 SetActive(); |
|
74 } |
|
75 |
|
76 /** |
|
77 Constructor. |
|
78 |
|
79 @param aController Pointer to an MExecAsync object passed to constructor of |
|
80 CISVAPIBase |
|
81 */ |
|
82 CCallForwardingStatus::CCallForwardingStatus(MExecAsync* aController) |
|
83 : CISVAPIAsync(aController, KCallForwardingStatus), |
|
84 iCallForwardingStatus1V1Pckg(iCallForwardingStatus1V1), |
|
85 iCallForwardingStatus2V1Pckg(iCallForwardingStatus2V1) |
|
86 { |
|
87 // Empty method |
|
88 } |
|
89 |
|
90 /** |
|
91 Second phase constructor. |
|
92 */ |
|
93 void CCallForwardingStatus::ConstructL() |
|
94 { |
|
95 iSecondCondition = EFalse; |
|
96 } |
|
97 |
|
98 /** |
|
99 Checks the status of the active object and displays the current call forwarding |
|
100 status if there is no error. |
|
101 */ |
|
102 void CCallForwardingStatus::RunL() |
|
103 { |
|
104 if(iStatus != KErrNone) |
|
105 { |
|
106 iConsole->Printf(KError); |
|
107 |
|
108 // Print the error status code |
|
109 iConsole->Printf(_L("%d\n"), iStatus.Int()); |
|
110 } |
|
111 else |
|
112 { |
|
113 if (!iSecondCondition) |
|
114 { |
|
115 iConsole->Printf(KCallForwardingStatusMsg); |
|
116 switch(iCallForwardingStatus1V1.iCallForwarding) |
|
117 { |
|
118 case CTelephony::EStatusActive: |
|
119 iConsole->Printf(_L("Call forwarding status 1 is active.\n")); |
|
120 break; |
|
121 case CTelephony::ENotActive: |
|
122 iConsole->Printf(_L("Call forwarding status 2 is not active.\n")); |
|
123 break; |
|
124 case CTelephony::ENotProvisioned: |
|
125 iConsole->Printf(_L("Call forwarding status 3 is not provisioned.\n")); |
|
126 break; |
|
127 case CTelephony::ENotAvailable: |
|
128 iConsole->Printf(_L("Call forwarding status 4 is not available.\n")); |
|
129 break; |
|
130 case CTelephony::EUnknown: |
|
131 default: |
|
132 iConsole->Printf(_L("Call forwarding status 5 is unknown.\n")); |
|
133 break; |
|
134 } |
|
135 switch(iCallForwardingStatus2V1.iCallForwarding) |
|
136 { |
|
137 case CTelephony::EStatusActive: |
|
138 iConsole->Printf(_L("Call forwarding status 2 is active.\n")); |
|
139 break; |
|
140 case CTelephony::ENotActive: |
|
141 iConsole->Printf(_L("Call forwarding status 2 is not active.\n")); |
|
142 break; |
|
143 case CTelephony::ENotProvisioned: |
|
144 iConsole->Printf(_L("Call forwarding status 2 is not provisioned.\n")); |
|
145 break; |
|
146 case CTelephony::ENotAvailable: |
|
147 iConsole->Printf(_L("Call forwarding status 2 is not available.\n")); |
|
148 break; |
|
149 case CTelephony::EUnknown: |
|
150 default: |
|
151 iConsole->Printf(_L("Call forwarding status 2 is unknown.\n")); |
|
152 break; |
|
153 } |
|
154 ExampleComplete(); |
|
155 } |
|
156 else |
|
157 { |
|
158 ExampleNotify(); |
|
159 } |
|
160 } |
|
161 } |
|
162 |
|
163 /** |
|
164 Cancels the asynchronous call to CTelephony::GetCallForwardingStatus(). |
|
165 */ |
|
166 void CCallForwardingStatus::DoCancel() |
|
167 { |
|
168 // Cancels an outstanding asynchronous request. |
|
169 iTelephony->CancelAsync(CTelephony::EGetCallForwardingStatusCancel); |
|
170 } |
|
171 |