|
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 "CCallWaitingStatus.h" |
|
17 |
|
18 /** |
|
19 Factory constructor. |
|
20 |
|
21 @param aController Pointer to MExecAsync object passed to constructor of |
|
22 CISVAPIBase |
|
23 @return Instance of CCallWaitingStatus 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 Default 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 Prints information about the current call waiting status if the request |
|
81 completed without error. |
|
82 */ |
|
83 void CCallWaitingStatus::RunL() |
|
84 { |
|
85 // Print Battery Info |
|
86 if(iStatus != KErrNone) |
|
87 { |
|
88 iConsole->Printf(KError); |
|
89 |
|
90 // Print the error status code |
|
91 iConsole->Printf(_L("%d\n"), iStatus.Int()); |
|
92 } |
|
93 else |
|
94 { |
|
95 // Print the console output message if there is no error |
|
96 iConsole->Printf(KCallWaitingStatusMsg); |
|
97 switch(iCallWaitingStatusV1.iCallWaiting) |
|
98 { |
|
99 case CTelephony::EStatusActive: |
|
100 iConsole->Printf(_L("Call waiting status is active.\n")); |
|
101 break; |
|
102 case CTelephony::ENotActive: |
|
103 iConsole->Printf(_L("Call waiting status is not active.\n")); |
|
104 break; |
|
105 case CTelephony::ENotProvisioned: |
|
106 iConsole->Printf(_L("Call waiting status is not provisioned.\n")); |
|
107 break; |
|
108 case CTelephony::ENotAvailable: |
|
109 iConsole->Printf(_L("Call waiting status is not available.\n")); |
|
110 break; |
|
111 case CTelephony::EUnknown: |
|
112 default: |
|
113 iConsole->Printf(_L("Call waiting status is unknown.\n")); |
|
114 break; |
|
115 } |
|
116 } |
|
117 ExampleComplete(); |
|
118 } |
|
119 |
|
120 /** |
|
121 Cancels asynchronous request to CTelephony::GetCallWaitingStatus(). |
|
122 */ |
|
123 void CCallWaitingStatus::DoCancel() |
|
124 { |
|
125 // Cancels an outstanding asynchronous request |
|
126 iTelephony->CancelAsync(CTelephony::EGetCallWaitingStatusCancel); |
|
127 } |
|
128 |