37
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2004,2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: It provides implementation for the CPhoneBlacklistAnim class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <e32base.h>
|
|
22 |
#include <mmtsy_names.h>
|
|
23 |
#include "phoneanimdllstd.h"
|
|
24 |
#include "cphoneblacklistanim.h"
|
|
25 |
|
|
26 |
// CONSTANTS
|
|
27 |
// Amount of retries to be performed.
|
|
28 |
const TInt KPhoneRetryCount = 7;
|
|
29 |
|
|
30 |
// Timeout in microseconds
|
|
31 |
const TInt KPhoneRetryTimeout = 100000;
|
|
32 |
|
|
33 |
// MODULE DATA STRUCTURES
|
|
34 |
/**
|
|
35 |
* Active object for clearing nlacklist.
|
|
36 |
*
|
|
37 |
* @since 2.0
|
|
38 |
*/
|
|
39 |
class CPhoneBlacklistAnim::CClearBlacklist
|
|
40 |
: public CActive
|
|
41 |
{
|
|
42 |
public: // Constructors and destructors.
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Constructor.
|
|
46 |
*/
|
|
47 |
/*****************************************************
|
|
48 |
* Series 60 Customer / ETel
|
|
49 |
* Series 60 ETel API
|
|
50 |
*****************************************************/
|
|
51 |
CClearBlacklist( RMmCustomAPI& aCustom );
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Destructor.
|
|
55 |
*/
|
|
56 |
~CClearBlacklist();
|
|
57 |
|
|
58 |
public: // New functions
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Clear blacklist.
|
|
62 |
*/
|
|
63 |
void Clear();
|
|
64 |
|
|
65 |
protected:
|
|
66 |
|
|
67 |
/**
|
|
68 |
* From CActive, handles completion of request.
|
|
69 |
*/
|
|
70 |
void RunL();
|
|
71 |
|
|
72 |
/**
|
|
73 |
* From CActive, cancels pending request.
|
|
74 |
*/
|
|
75 |
void DoCancel();
|
|
76 |
|
|
77 |
private:
|
|
78 |
|
|
79 |
// Ref to custom API.
|
|
80 |
/*****************************************************
|
|
81 |
* Series 60 Customer / ETel
|
|
82 |
* Series 60 ETel API
|
|
83 |
*****************************************************/
|
|
84 |
RMmCustomAPI& iCustom;
|
|
85 |
|
|
86 |
};
|
|
87 |
|
|
88 |
// ================= MEMBER FUNCTIONS =======================
|
|
89 |
|
|
90 |
// ---------------------------------------------------------
|
|
91 |
// CPhoneBlacklistAnim::CPhoneBlacklistAnim
|
|
92 |
// ---------------------------------------------------------
|
|
93 |
//
|
|
94 |
CPhoneBlacklistAnim::CPhoneBlacklistAnim()
|
|
95 |
{
|
|
96 |
}
|
|
97 |
|
|
98 |
// ---------------------------------------------------------
|
|
99 |
// CPhoneBlacklistAnim::~CPhoneBlacklistAnim
|
|
100 |
// ---------------------------------------------------------
|
|
101 |
//
|
|
102 |
/*****************************************************
|
|
103 |
* Series 60 Customer / ETel
|
|
104 |
* Series 60 ETel API
|
|
105 |
*****************************************************/
|
|
106 |
CPhoneBlacklistAnim::~CPhoneBlacklistAnim()
|
|
107 |
{
|
|
108 |
if ( iFunctions )
|
|
109 |
{
|
|
110 |
iFunctions->GetRawEvents( EFalse );
|
|
111 |
}
|
|
112 |
|
|
113 |
delete iActive;
|
|
114 |
|
|
115 |
iCustom.Close();
|
|
116 |
iPhone.Close();
|
|
117 |
iServer.Close();
|
|
118 |
}
|
|
119 |
|
|
120 |
// ---------------------------------------------------------
|
|
121 |
// CPhoneBlacklistAnim::CommandReplyL
|
|
122 |
//
|
|
123 |
// Reply to command. Always returns KErrNone.
|
|
124 |
// Defined as pure virtual in baseclass, not actually needed
|
|
125 |
// here.
|
|
126 |
// ---------------------------------------------------------
|
|
127 |
//
|
|
128 |
TInt CPhoneBlacklistAnim::CommandReplyL( TInt /*aOpcode*/, TAny* /*aArgs*/ )
|
|
129 |
{
|
|
130 |
return KErrNone;
|
|
131 |
}
|
|
132 |
|
|
133 |
// ---------------------------------------------------------
|
|
134 |
// CPhoneBlacklistAnim::Command
|
|
135 |
//
|
|
136 |
// Command handling, only one command supported.
|
|
137 |
// ---------------------------------------------------------
|
|
138 |
//
|
|
139 |
void CPhoneBlacklistAnim::Command( TInt aOpcode, TAny* /*aArgs*/ )
|
|
140 |
{
|
|
141 |
switch ( aOpcode )
|
|
142 |
{
|
|
143 |
case ECancelBlackList:
|
|
144 |
iClearBlacklistOnNextEvent = ETrue;
|
|
145 |
break;
|
|
146 |
case EClearBlackListNow:
|
|
147 |
iActive->Clear();
|
|
148 |
break;
|
|
149 |
default:
|
|
150 |
break;
|
|
151 |
}
|
|
152 |
};
|
|
153 |
|
|
154 |
// ---------------------------------------------------------
|
|
155 |
// CPhoneBlacklistAnim::Animate
|
|
156 |
//
|
|
157 |
// Defined as pure virtual in base class, so empty
|
|
158 |
// implementation.
|
|
159 |
// ---------------------------------------------------------
|
|
160 |
//
|
|
161 |
void CPhoneBlacklistAnim::Animate( TDateTime* /*aDateTime*/ )
|
|
162 |
{
|
|
163 |
}
|
|
164 |
|
|
165 |
// ---------------------------------------------------------
|
|
166 |
// CPhoneBlacklistAnim::ConstructL
|
|
167 |
//
|
|
168 |
// Construction.
|
|
169 |
// Activates also request to get all key events.
|
|
170 |
// ---------------------------------------------------------
|
|
171 |
//
|
|
172 |
/*****************************************************
|
|
173 |
* Series 60 Customer / ETel
|
|
174 |
* Series 60 ETel API
|
|
175 |
*****************************************************/
|
|
176 |
/*****************************************************
|
|
177 |
* Series 60 Customer / TSY
|
|
178 |
* Needs customer TSY implementation
|
|
179 |
*****************************************************/
|
|
180 |
void CPhoneBlacklistAnim::ConstructL( TAny* /*aArgs*/, TBool /*aHasFocus*/ )
|
|
181 |
{
|
|
182 |
// Connect to ETel.
|
|
183 |
TInt err = KErrNone;
|
|
184 |
{
|
|
185 |
for ( TInt a = 0 ; a < KPhoneRetryCount ; a++ )
|
|
186 |
{
|
|
187 |
err = iServer.Connect();
|
|
188 |
|
|
189 |
if ( err == KErrNone )
|
|
190 |
{
|
|
191 |
break;
|
|
192 |
}
|
|
193 |
|
|
194 |
User::After( KPhoneRetryTimeout );
|
|
195 |
}
|
|
196 |
|
|
197 |
User::LeaveIfError( err );
|
|
198 |
}
|
|
199 |
|
|
200 |
// Load TSY module.
|
|
201 |
err = iServer.LoadPhoneModule( KMmTsyModuleName );
|
|
202 |
if ( err != KErrAlreadyExists )
|
|
203 |
{
|
|
204 |
// LoadPhoneModule may return also KErrAlreadyExists
|
|
205 |
// if some other is already loaded the tsy module.
|
|
206 |
// And that is not an error.
|
|
207 |
User::LeaveIfError( err );
|
|
208 |
}
|
|
209 |
|
|
210 |
// Open phone and custom API.
|
|
211 |
User::LeaveIfError( iPhone.Open( iServer, KMmTsyPhoneName ) );
|
|
212 |
User::LeaveIfError( iCustom.Open( iPhone ) );
|
|
213 |
|
|
214 |
iActive = new ( ELeave ) CClearBlacklist( iCustom );
|
|
215 |
|
|
216 |
iFunctions->GetRawEvents( ETrue );
|
|
217 |
}
|
|
218 |
|
|
219 |
// ---------------------------------------------------------
|
|
220 |
// CPhoneBlacklistAnim::Redraw
|
|
221 |
//
|
|
222 |
// Not needed. No UI.
|
|
223 |
// Defined as pure virtual in baseclass, not actually needed
|
|
224 |
// here.
|
|
225 |
// ---------------------------------------------------------
|
|
226 |
//
|
|
227 |
void CPhoneBlacklistAnim::Redraw()
|
|
228 |
{
|
|
229 |
}
|
|
230 |
|
|
231 |
// ---------------------------------------------------------
|
|
232 |
// CPhoneBlacklistAnim::FocusChanged
|
|
233 |
//
|
|
234 |
// Not needed. No UI.
|
|
235 |
// Defined as pure virtual in baseclass, not actually needed
|
|
236 |
// here.
|
|
237 |
// ---------------------------------------------------------
|
|
238 |
//
|
|
239 |
void CPhoneBlacklistAnim::FocusChanged( TBool /*aState*/ )
|
|
240 |
{
|
|
241 |
}
|
|
242 |
|
|
243 |
// ---------------------------------------------------------
|
|
244 |
// CPhoneBlacklistAnim::OfferRawEvent
|
|
245 |
//
|
|
246 |
// Handle key event.
|
|
247 |
// ---------------------------------------------------------
|
|
248 |
//
|
|
249 |
TBool CPhoneBlacklistAnim::OfferRawEvent( const TRawEvent& aRawEvent )
|
|
250 |
{
|
|
251 |
if ( aRawEvent.Type() == TRawEvent::EKeyDown ||
|
|
252 |
aRawEvent.Type() == TRawEvent::EButton1Down )
|
|
253 |
{
|
|
254 |
if ( iClearBlacklistOnNextEvent )
|
|
255 |
{
|
|
256 |
iClearBlacklistOnNextEvent = EFalse;
|
|
257 |
iActive->Clear();
|
|
258 |
}
|
|
259 |
}
|
|
260 |
return EFalse;
|
|
261 |
}
|
|
262 |
|
|
263 |
// ---------------------------------------------------------
|
|
264 |
// CPhoneBlacklistAnim::CClearBlacklist::CClearBlacklist
|
|
265 |
// ---------------------------------------------------------
|
|
266 |
//
|
|
267 |
CPhoneBlacklistAnim::CClearBlacklist::CClearBlacklist(
|
|
268 |
RMmCustomAPI& aCustom )
|
|
269 |
: CActive( CActive::EPriorityStandard ),
|
|
270 |
iCustom( aCustom )
|
|
271 |
{
|
|
272 |
CActiveScheduler::Add( this );
|
|
273 |
}
|
|
274 |
|
|
275 |
// ---------------------------------------------------------
|
|
276 |
// CPhoneBlacklistAnim::CClearBlacklist::~CClearBlacklist
|
|
277 |
// ---------------------------------------------------------
|
|
278 |
//
|
|
279 |
CPhoneBlacklistAnim::CClearBlacklist::~CClearBlacklist()
|
|
280 |
{
|
|
281 |
Cancel();
|
|
282 |
}
|
|
283 |
|
|
284 |
// ---------------------------------------------------------
|
|
285 |
// CPhoneBlacklistAnim::CClearBlacklist::Clear
|
|
286 |
//
|
|
287 |
// Clear blacklist asynchronously.
|
|
288 |
// ---------------------------------------------------------
|
|
289 |
//
|
|
290 |
/*****************************************************
|
|
291 |
* Series 60 Customer / ETel
|
|
292 |
* Series 60 ETel API
|
|
293 |
*****************************************************/
|
|
294 |
void CPhoneBlacklistAnim::CClearBlacklist::Clear()
|
|
295 |
{
|
|
296 |
Cancel();
|
|
297 |
|
|
298 |
iCustom.ClearCallBlackList( iStatus );
|
|
299 |
SetActive();
|
|
300 |
}
|
|
301 |
|
|
302 |
// ---------------------------------------------------------
|
|
303 |
// CPhoneBlacklistAnim::CClearBlacklist::RunL
|
|
304 |
//
|
|
305 |
// This is called when blacklist clearing completes.
|
|
306 |
// Empty implementation, as nothing needs to be done.
|
|
307 |
// ---------------------------------------------------------
|
|
308 |
//
|
|
309 |
void CPhoneBlacklistAnim::CClearBlacklist::RunL()
|
|
310 |
{
|
|
311 |
}
|
|
312 |
|
|
313 |
// ---------------------------------------------------------
|
|
314 |
// CPhoneBlacklistAnim::CClearBlacklist::DoCancel
|
|
315 |
//
|
|
316 |
// Cancels pending request.
|
|
317 |
// ---------------------------------------------------------
|
|
318 |
//
|
|
319 |
/*****************************************************
|
|
320 |
* Series 60 Customer / ETel
|
|
321 |
* Series 60 ETel API
|
|
322 |
*****************************************************/
|
|
323 |
void CPhoneBlacklistAnim::CClearBlacklist::DoCancel()
|
|
324 |
{
|
|
325 |
iCustom.CancelAsyncRequest(
|
|
326 |
ECustomClearCallBlackListIPC );
|
|
327 |
}
|
|
328 |
|
|
329 |
// End of File
|