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