|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Engine to fetch the logos |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <aknnotewrappers.h> |
|
20 |
|
21 #include "irlogodownloadengine.h" |
|
22 #include "irnetworkcontroller.h" |
|
23 #include "ircachemgmt.h" |
|
24 #include "irhttprequestdata.h" |
|
25 #include "irdebug.h" |
|
26 #include "irdataproviderconstants.h" |
|
27 #include "iractivenetworkobserver.h" |
|
28 |
|
29 |
|
30 _LIT(KLogoX, "?x="); |
|
31 _LIT(KLogoY, "&y="); |
|
32 const TInt KPresetsArrayMaxLength = 50; |
|
33 const TInt KLogoSize = 59; |
|
34 const TInt KParameterSize = 12; |
|
35 const TInt KTen = 10; |
|
36 const TInt KCacheAvailable = 4; |
|
37 const TInt KLogo = 4; |
|
38 const TInt KStatusOK = 200; |
|
39 const TInt KStatusMultipleChoices = 300; |
|
40 const TInt KStatusNotModified = 304; |
|
41 const TInt KStatusGatewayTimeout = 504; |
|
42 |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // CIRLogoDownloadEngine::NewL() |
|
46 // Creates instance of CIRLogoDownloadEngine. |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CIRLogoDownloadEngine* CIRLogoDownloadEngine::NewL() |
|
50 { |
|
51 IRLOG_DEBUG( "CIRLogoDownloadEngine::NewL - Entering" ); |
|
52 CIRLogoDownloadEngine* self = new ( ELeave ) CIRLogoDownloadEngine(); |
|
53 CleanupStack::PushL( self ); |
|
54 self->ConstructL(); |
|
55 CleanupStack::Pop( self ); |
|
56 IRLOG_DEBUG( "CIRLogoDownloadEngine::NewL - Exiting" ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CIRLogoDownloadEngine::CIRLogoDownloadEngine() |
|
62 // Standard C++ constructor |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CIRLogoDownloadEngine::CIRLogoDownloadEngine() |
|
66 { |
|
67 IRLOG_DEBUG( "CIRLogoDownloadEngine::CIRLogoDownloadEngine " ); |
|
68 //code here, if needed |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CIRLogoDownloadEngine::~CIRLogoDownloadEngine() |
|
73 // Destructs instance of CIRLogoDownloadEngine. |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 EXPORT_C CIRLogoDownloadEngine::~CIRLogoDownloadEngine() |
|
77 { |
|
78 IRLOG_DEBUG( "CIRLogoDownloadEngine::~CIRLogoDownloadEngine - Entering" ); |
|
79 if ( iReqBody ) |
|
80 { |
|
81 delete iReqBody; |
|
82 iReqBody = NULL; |
|
83 } |
|
84 if ( iRespBody ) |
|
85 { |
|
86 delete iRespBody; |
|
87 iRespBody = NULL; |
|
88 } |
|
89 CancelTransaction(); |
|
90 // remove E32USER-CBase-66 |
|
91 #ifdef _DEBUG |
|
92 TRAP_IGNORE( iLogoSession.Close() ); |
|
93 #else |
|
94 iLogoSession.Close(); |
|
95 #endif |
|
96 |
|
97 if ( iCopyPreset ) |
|
98 { |
|
99 delete iCopyPreset; |
|
100 } |
|
101 if ( iCacheTempPreset ) |
|
102 { |
|
103 delete iCacheTempPreset; |
|
104 } |
|
105 if ( iTempPreset ) |
|
106 { |
|
107 delete iTempPreset; |
|
108 } |
|
109 if ( iPresetArray ) |
|
110 { |
|
111 iPresetArray->ResetAndDestroy(); |
|
112 } |
|
113 delete iPresetArray; |
|
114 if ( iObserverArray ) |
|
115 { |
|
116 delete iObserverArray; |
|
117 iObserverArray = NULL; |
|
118 } |
|
119 if ( iReqFromArray ) |
|
120 { |
|
121 delete iReqFromArray; |
|
122 iReqFromArray = NULL; |
|
123 } |
|
124 if ( iCachePresetArray ) |
|
125 { |
|
126 iCachePresetArray->ResetAndDestroy(); |
|
127 } |
|
128 delete iCachePresetArray; |
|
129 if ( iCacheObserverArray ) |
|
130 { |
|
131 delete iCacheObserverArray; |
|
132 iCacheObserverArray = NULL; |
|
133 } |
|
134 if ( iCacheReqFromArray ) |
|
135 { |
|
136 delete iCacheReqFromArray; |
|
137 iCacheReqFromArray = NULL; |
|
138 } |
|
139 if ( iIRNetworkControllerHandle ) |
|
140 { |
|
141 iIRNetworkControllerHandle->DeleteActiveNetworkObserver( *this ); |
|
142 iIRNetworkControllerHandle->Close(); |
|
143 } |
|
144 if ( iCache ) |
|
145 { |
|
146 iCache->RemoveObserver( this ); |
|
147 iCache->Close(); |
|
148 } |
|
149 if ( iResponseHeaders ) |
|
150 { |
|
151 delete iResponseHeaders; |
|
152 } |
|
153 IRLOG_DEBUG( "CIRLogoDownloadEngine::~CIRLogoDownloadEngine - Exiting" ); |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // CIRLogoDownloadEngine::ConstructL() |
|
158 // 2nd phase construction |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 void CIRLogoDownloadEngine::ConstructL() |
|
162 { |
|
163 IRLOG_DEBUG( "CIRLogoDownloadEngine::ConstructL - Entering" ); |
|
164 iPresetArray = new( ELeave ) CArrayPtrFlat<CIRIsdsPreset>( |
|
165 KPresetsArrayMaxLength ); |
|
166 iObserverArray = new( ELeave ) CArrayPtrFlat<MLogoDownloadObserver>( |
|
167 KPresetsArrayMaxLength ); |
|
168 iReqFromArray = new( ELeave ) CArrayFixFlat<TInt>( |
|
169 KPresetsArrayMaxLength ); |
|
170 iCachePresetArray = new( ELeave ) CArrayPtrFlat<CIRIsdsPreset>( |
|
171 KPresetsArrayMaxLength ); |
|
172 iCacheObserverArray = new( ELeave ) CArrayPtrFlat<MLogoDownloadObserver>( |
|
173 KPresetsArrayMaxLength ); |
|
174 iCacheReqFromArray = new( ELeave ) CArrayFixFlat<TInt>( |
|
175 KPresetsArrayMaxLength ); |
|
176 iPresetArrayPos = 0; |
|
177 iReqFromArrayPos = 0; |
|
178 iObserverArrayPos = 0; |
|
179 iCachePresetArrayPos = 0; |
|
180 iCacheReqFromArrayPos = 0; |
|
181 iCacheObserverArrayPos = 0; |
|
182 iImageIndex = 0; //using temporarily till the isds provides urls |
|
183 |
|
184 iPresetModifiedStatus = EFalse; |
|
185 iFirstTime = ETrue; |
|
186 iIRNetworkControllerHandle = CIRNetworkController::OpenL(); |
|
187 iIRNetworkControllerHandle->RegisterActiveNetworkObserverL( *this ); |
|
188 iCache = CIRCacheMgmt::OpenL( *this ); |
|
189 iCache->AddObserverL( this ); |
|
190 iResponseHeaders = new ( ELeave ) CIRHttpResponseData; |
|
191 //change to use the new session for logo downloading |
|
192 TRAPD( LeaveValue, iLogoSession.OpenL() ); |
|
193 if ( LeaveValue != KErrNone ) |
|
194 { |
|
195 // Most common error; no access point configured, and session creation |
|
196 // leaves with KErrNotFound. |
|
197 // Load a string from the resource file and add the error code to string |
|
198 User::Leave( LeaveValue ); |
|
199 } |
|
200 IRLOG_DEBUG( "CIRLogoDownloadEngine::ConstructL - Exiting" ); |
|
201 } |
|
202 |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // CIRLogoDownloadEngine::IsRunning() |
|
206 // To know the status of downloading logo |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 EXPORT_C TBool CIRLogoDownloadEngine::IsRunning() const |
|
210 { |
|
211 IRLOG_DEBUG( "CIRLogoDownloadEngine::IsRunning" ); |
|
212 return iRunning; |
|
213 } |
|
214 |
|
215 |
|
216 // --------------------------------------------------------------------------- |
|
217 // CIRLogoDownloadEngine::SetHeaderL() |
|
218 // to set the headers of the http transaction |
|
219 // --------------------------------------------------------------------------- |
|
220 // |
|
221 void CIRLogoDownloadEngine::SetHeaderL( RHTTPHeaders aHeaders, |
|
222 TInt aHdrField, const TDesC8& aHdrValue ) const |
|
223 { |
|
224 IRLOG_DEBUG( "CIRLogoDownloadEngine::SetHeaderL - Entering" ); |
|
225 RStringF valStr = iLogoSession.StringPool().OpenFStringL( aHdrValue ); |
|
226 CleanupClosePushL( valStr ); |
|
227 THTTPHdrVal val( valStr ); |
|
228 aHeaders.SetFieldL( iLogoSession.StringPool().StringF( aHdrField, |
|
229 RHTTPSession::GetTable() ), val ); |
|
230 CleanupStack::PopAndDestroy( &valStr ); // valStr |
|
231 IRLOG_DEBUG( "CIRLogoDownloadEngine::SetHeaderL - Exiting" ); |
|
232 } |
|
233 |
|
234 // --------------------------------------------------------------------------- |
|
235 // CIRLogoDownloadEngine::SendRequestL() |
|
236 // API is called from the SearchResultsView for to download logo |
|
237 // while doing Add to Favorites |
|
238 // --------------------------------------------------------------------------- |
|
239 // |
|
240 EXPORT_C void CIRLogoDownloadEngine::SendRequestL( CIRIsdsPreset* aPreset, |
|
241 TInt aXValue, TInt aYValue ) |
|
242 { |
|
243 IRLOG_DEBUG( "CIRLogoDownloadEngine::SendRequestL - Entering" ); |
|
244 if ( !iCheckingCache ) |
|
245 { |
|
246 ++iImageIndex; |
|
247 iCheckingCache = ETrue; |
|
248 iCacheReqFrom = 0; |
|
249 if ( iCacheTempPreset ) |
|
250 { |
|
251 delete iCacheTempPreset; |
|
252 } |
|
253 iCacheTempPreset = NULL; |
|
254 iCacheTempPreset = CIRIsdsPreset::NewL(); |
|
255 *iCacheTempPreset = *aPreset; |
|
256 |
|
257 if ( iCacheTempPreset->GetImgUrl().Length() != 0 ) |
|
258 { |
|
259 if ( ( aXValue > 0 ) && ( aYValue > 0 ) ) |
|
260 { |
|
261 //Append the parameters(width,height) of the logo size to imgUrl |
|
262 TInt size = iCacheTempPreset->GetImgUrl().Length() |
|
263 + KParameterSize; |
|
264 RBuf urlWithSize; |
|
265 CleanupClosePushL(urlWithSize); |
|
266 urlWithSize.CreateL( size ); |
|
267 urlWithSize.Copy( iCacheTempPreset->GetImgUrl() ); |
|
268 urlWithSize.Append( KLogoX ); |
|
269 urlWithSize.AppendNum( aXValue ); |
|
270 urlWithSize.Append( KLogoY ); |
|
271 urlWithSize.AppendNum( aYValue ); |
|
272 |
|
273 //set the imgUrl with parameters to the preset |
|
274 iCacheTempPreset->SetImgUrlL( urlWithSize ); |
|
275 CleanupStack::PopAndDestroy(); |
|
276 } |
|
277 //This method checks whether the logo is available |
|
278 // for the request made |
|
279 iForceGet = EFalse; |
|
280 CheckCacheForLogoL( 0 ); |
|
281 } |
|
282 else |
|
283 { |
|
284 //imgUrl doesnt exist in the Preset |
|
285 iCheckingCache = EFalse; |
|
286 return; |
|
287 } |
|
288 |
|
289 iCheckingCache = EFalse; |
|
290 if ( !iLogoCached ) |
|
291 { |
|
292 FetchLogoDataL( iCacheTempPreset ); |
|
293 } |
|
294 } |
|
295 else |
|
296 { |
|
297 CIRIsdsPreset* tempPreset; |
|
298 tempPreset = CIRIsdsPreset::NewL(); |
|
299 CleanupStack::PushL(tempPreset); |
|
300 *tempPreset = *aPreset; |
|
301 if ( tempPreset->GetImgUrl().Length() != 0 ) |
|
302 { |
|
303 if ( ( aXValue > 0 ) && ( aYValue > 0 ) ) |
|
304 { |
|
305 //Append the parameters(width,height) of the logo size to imgUrl |
|
306 TInt size = tempPreset->GetImgUrl().Length() + KParameterSize; |
|
307 RBuf urlWithSize; |
|
308 CleanupClosePushL(urlWithSize); |
|
309 urlWithSize.CreateL( size ); |
|
310 urlWithSize.Copy( tempPreset->GetImgUrl() ); |
|
311 urlWithSize.Append( KLogoX ); |
|
312 urlWithSize.AppendNum( aXValue ); |
|
313 urlWithSize.Append( KLogoY ); |
|
314 urlWithSize.AppendNum( aYValue ); |
|
315 |
|
316 //set the imgUrl with parameters to the preset |
|
317 tempPreset->SetImgUrlL( urlWithSize ); |
|
318 CleanupStack::PopAndDestroy(); |
|
319 } |
|
320 } |
|
321 iCachePresetArray->AppendL( tempPreset ); |
|
322 iCacheReqFromArray->AppendL( 0 ); |
|
323 CleanupStack::PopAndDestroy(); |
|
324 } |
|
325 IRLOG_DEBUG( "CIRLogoDownloadEngine::SendRequestL - Exiting" ); |
|
326 } |
|
327 |
|
328 |
|
329 EXPORT_C TBool CIRLogoDownloadEngine::IsLogoCachedL( |
|
330 CIRIsdsPreset* aPreset, TInt aXValue, TInt aYValue ) |
|
331 { |
|
332 TInt cached = 0; |
|
333 |
|
334 if(iCacheTempPreset) |
|
335 { |
|
336 delete iCacheTempPreset; |
|
337 iCacheTempPreset = NULL; |
|
338 } |
|
339 |
|
340 iCacheTempPreset = CIRIsdsPreset::NewL(); |
|
341 *iCacheTempPreset = *aPreset; |
|
342 iCacheReqMade = EFalse; |
|
343 |
|
344 if (iCacheTempPreset->GetImgUrl().Length() != 0) |
|
345 { |
|
346 if ((aXValue > 0) && (aYValue > 0)) |
|
347 { |
|
348 //Append the parameters(width,height) of the logo size to imgUrl |
|
349 TInt size = iCacheTempPreset->GetImgUrl().Length() + KParameterSize; |
|
350 RBuf urlWithSize; |
|
351 CleanupClosePushL(urlWithSize); |
|
352 urlWithSize.CreateL(size); |
|
353 urlWithSize.Copy(iCacheTempPreset->GetImgUrl()); |
|
354 urlWithSize.Append(KLogoX); |
|
355 urlWithSize.AppendNum(aXValue); |
|
356 urlWithSize.Append(KLogoY); |
|
357 urlWithSize.AppendNum(aYValue); |
|
358 |
|
359 //set the imgUrl with parameters to the preset |
|
360 iCacheTempPreset->SetImgUrlL(urlWithSize); |
|
361 CleanupStack::PopAndDestroy(); |
|
362 } |
|
363 } |
|
364 |
|
365 iCache->CheckCacheL(KLogo,iCacheTempPreset->GetImgUrl(),EFalse,cached); |
|
366 |
|
367 return (CIRCacheMgmt::ECacheUseable == cached)?ETrue:EFalse; |
|
368 } |
|
369 // --------------------------------------------------------------------------- |
|
370 // CIRLogoDownloadEngine::SendRequestL() |
|
371 // API is called from several views for to download logo |
|
372 // --------------------------------------------------------------------------- |
|
373 // |
|
374 EXPORT_C void CIRLogoDownloadEngine::SendRequestL( CIRIsdsPreset* aPreset, |
|
375 MLogoDownloadObserver* aLogoHandle, |
|
376 TInt aNPVReq, TInt aXValue, TInt aYValue ) |
|
377 { |
|
378 IRLOG_DEBUG( "CIRLogoDownloadEngine::SendRequestL - Entering" ); |
|
379 if ( aPreset->GetChannelType() == 0 ) |
|
380 { |
|
381 aLogoHandle->PresetLogoDownloadedL( aPreset ); |
|
382 } |
|
383 else if ( !iCheckingCache ) |
|
384 { |
|
385 ++iImageIndex; |
|
386 iCheckingCache = ETrue; |
|
387 if ( aNPVReq == 2 ) |
|
388 { |
|
389 iCacheReqFrom = 2; |
|
390 } |
|
391 else |
|
392 { |
|
393 iCacheReqFrom = 1; |
|
394 } |
|
395 |
|
396 if ( iCacheTempPreset ) |
|
397 { |
|
398 delete iCacheTempPreset; |
|
399 iCacheTempPreset = NULL; |
|
400 } |
|
401 iCacheTempPreset = CIRIsdsPreset::NewL(); |
|
402 *iCacheTempPreset = *aPreset; |
|
403 iCacheTempLogoHandle = aLogoHandle; |
|
404 |
|
405 if ( iCacheTempPreset->GetImgUrl().Length() != 0 ) |
|
406 { |
|
407 if ( ( aXValue > 0 ) && ( aYValue > 0 ) ) |
|
408 { |
|
409 //Append the parameters(width,height) of the logo size to imgUrl |
|
410 TInt size = iCacheTempPreset->GetImgUrl().Length() |
|
411 + KParameterSize; |
|
412 RBuf urlWithSize; |
|
413 CleanupClosePushL(urlWithSize); |
|
414 urlWithSize.CreateL( size ); |
|
415 urlWithSize.Copy( iCacheTempPreset->GetImgUrl() ); |
|
416 urlWithSize.Append( KLogoX ); |
|
417 urlWithSize.AppendNum( aXValue ); |
|
418 urlWithSize.Append( KLogoY ); |
|
419 urlWithSize.AppendNum( aYValue ); |
|
420 |
|
421 //set the imgUrl with parameters to the preset |
|
422 iCacheTempPreset->SetImgUrlL( urlWithSize ); |
|
423 CleanupStack::PopAndDestroy(); |
|
424 } |
|
425 if ( iCacheReqFrom == 1 || iCacheReqFrom == 2 ) |
|
426 { |
|
427 //This method checks whether the logo is available |
|
428 // for the request made |
|
429 iForceGet = EFalse; |
|
430 CheckCacheForLogoL( 0 ); |
|
431 } |
|
432 /* else if(iCacheReqFrom==2) |
|
433 { |
|
434 //the request has come from NowPlayingView(NPV) |
|
435 //dont check for logo availability in cache |
|
436 //download the logo freshly |
|
437 iLogoCached=EFalse; |
|
438 } |
|
439 */ } |
|
440 else |
|
441 { |
|
442 //imgUrl doesnt exist in the Preset |
|
443 iCheckingCache = EFalse; |
|
444 return; |
|
445 } |
|
446 |
|
447 iCheckingCache = EFalse; |
|
448 if ( !iLogoCached ) |
|
449 { |
|
450 FetchLogoDataL( iCacheTempPreset, aLogoHandle, iCacheReqFrom ); |
|
451 } |
|
452 } |
|
453 else |
|
454 { |
|
455 CIRIsdsPreset* tempPreset; |
|
456 tempPreset = CIRIsdsPreset::NewL(); |
|
457 CleanupStack::PushL(tempPreset); |
|
458 *tempPreset = *aPreset; |
|
459 if ( tempPreset->GetImgUrl().Length() != 0 ) |
|
460 { |
|
461 if ( ( aXValue > 0 ) && ( aYValue > 0 ) ) |
|
462 { |
|
463 //Append the parameters(width,height) of the logo size to imgUrl |
|
464 TInt size = tempPreset->GetImgUrl().Length() + KParameterSize; |
|
465 RBuf urlWithSize; |
|
466 CleanupClosePushL(urlWithSize); |
|
467 urlWithSize.CreateL( size ); |
|
468 urlWithSize.Copy( tempPreset->GetImgUrl() ); |
|
469 urlWithSize.Append( KLogoX ); |
|
470 urlWithSize.AppendNum( aXValue ); |
|
471 urlWithSize.Append( KLogoY ); |
|
472 urlWithSize.AppendNum( aYValue ); |
|
473 |
|
474 //set the imgUrl with parameters to the preset |
|
475 tempPreset->SetImgUrlL( urlWithSize ); |
|
476 CleanupStack::PopAndDestroy(); |
|
477 } |
|
478 } |
|
479 iCachePresetArray->AppendL( tempPreset ); |
|
480 iCacheObserverArray->AppendL( aLogoHandle ); |
|
481 if ( aNPVReq == 2 ) |
|
482 { |
|
483 iCacheReqFromArray->AppendL( 2 ); |
|
484 } |
|
485 else |
|
486 { |
|
487 iCacheReqFromArray->AppendL( 1 ); |
|
488 } |
|
489 CleanupStack::PopAndDestroy(); |
|
490 } |
|
491 IRLOG_DEBUG( "CIRLogoDownloadEngine::SendRequestL - Exiting" ); |
|
492 } |
|
493 |
|
494 // --------------------------------------------------------------------------- |
|
495 // CIRLogoDownloadEngine::GetCacheLogoL() |
|
496 // takes the url as a parameter and returns the logo data which is in cache |
|
497 // this API is called form the search results for to display logo on the view |
|
498 // --------------------------------------------------------------------------- |
|
499 // |
|
500 EXPORT_C void CIRLogoDownloadEngine::GetCacheLogoL( const TDesC& aUrl, |
|
501 TInt& aStatus ) |
|
502 { |
|
503 IRLOG_DEBUG( "CIRLogoDownloadEngine::GetCacheLogoL - Entering" ); |
|
504 iSendingLogo = 2; |
|
505 iResult = 0; |
|
506 iForceGet = EFalse; |
|
507 //2 means, this API is called for the search results view |
|
508 iCacheReqMade = ETrue; |
|
509 iCache->CheckCacheL( KLogo, aUrl, iForceGet, iResult ); |
|
510 aStatus = iResult; |
|
511 IRLOG_DEBUG( "CIRLogoDownloadEngine::GetCacheLogoL - Exiting" ); |
|
512 |
|
513 } |
|
514 |
|
515 // --------------------------------------------------------------------------- |
|
516 // CIRLogoDownloadEngine::SendCacheLogo() |
|
517 // sends the logo which is cached |
|
518 // --------------------------------------------------------------------------- |
|
519 // |
|
520 EXPORT_C TDesC8& CIRLogoDownloadEngine::SendCacheLogo() |
|
521 { |
|
522 IRLOG_DEBUG( "CIRLogoDownloadEngine::SendCacheLogo" ); |
|
523 return iCache->iLogoData; |
|
524 } |
|
525 |
|
526 // --------------------------------------------------------------------------- |
|
527 // CIRLogoDownloadEngine::FetchLogoDataL() |
|
528 // API is used to download logo from isds/internet |
|
529 // called in the API SendRequestL(CIRIsdsPreset* aPreset) |
|
530 // --------------------------------------------------------------------------- |
|
531 // |
|
532 void CIRLogoDownloadEngine::FetchLogoDataL( CIRIsdsPreset* aPreset ) |
|
533 { |
|
534 IRLOG_DEBUG( "CIRLogoDownloadEngine::FetchLogoDataL - Entering" ); |
|
535 if ( !iRunning ) |
|
536 { |
|
537 //which means the request came from SearchView |
|
538 // while doing Add to Favorite |
|
539 iTempReqFrom = 0; |
|
540 if ( iReqBody ) |
|
541 { |
|
542 delete iReqBody; |
|
543 iReqBody = NULL; |
|
544 } |
|
545 if ( iRespBody ) |
|
546 { |
|
547 delete iRespBody; |
|
548 iRespBody = NULL; |
|
549 } |
|
550 if ( iTempPreset ) |
|
551 { |
|
552 delete iTempPreset; |
|
553 iTempPreset = NULL; |
|
554 } |
|
555 iTempPreset = CIRIsdsPreset::NewL(); |
|
556 *iTempPreset = *aPreset; |
|
557 if ( iTempPreset->GetImgUrl().Length() != 0 ) |
|
558 { |
|
559 IssueLogoDownloadRequestL(); |
|
560 } |
|
561 else /*ImgUrl doesnt exist in the iTempPreset*/ |
|
562 { |
|
563 //simply ignore it |
|
564 } |
|
565 } |
|
566 else |
|
567 { |
|
568 CIRIsdsPreset* tempPreset; |
|
569 tempPreset = CIRIsdsPreset::NewL(); |
|
570 CleanupStack::PushL( tempPreset ); |
|
571 *tempPreset = *aPreset; |
|
572 iPresetArray->AppendL( tempPreset ); |
|
573 CleanupStack::Pop( tempPreset ); |
|
574 iReqFromArray->AppendL( 0 ); |
|
575 } |
|
576 IRLOG_DEBUG( "CIRLogoDownloadEngine::FetchLogoDataL - Exiting" ); |
|
577 } |
|
578 |
|
579 |
|
580 // --------------------------------------------------------------------------- |
|
581 // CIRLogoDownloadEngine::FetchLogoDataL() |
|
582 // API is used to download logo from isds/internet |
|
583 // called in the API SendRequestL()) |
|
584 // --------------------------------------------------------------------------- |
|
585 // |
|
586 void CIRLogoDownloadEngine::FetchLogoDataL( CIRIsdsPreset* aPreset, |
|
587 MLogoDownloadObserver* aLogoHandle, TInt aNPVReq ) |
|
588 { |
|
589 IRLOG_DEBUG( "CIRLogoDownloadEngine::FetchLogoDataL - Entering" ); |
|
590 if ( !iRunning ) |
|
591 { |
|
592 if ( aNPVReq == 2 ) |
|
593 { |
|
594 //which means the request came from NowPlayingView |
|
595 iTempReqFrom = 2; |
|
596 } |
|
597 else |
|
598 { |
|
599 //which means the request came from other than NowPlayingView |
|
600 iTempReqFrom = 1; |
|
601 } |
|
602 |
|
603 iTempLogoHandle = aLogoHandle; |
|
604 if ( iReqBody ) |
|
605 { |
|
606 delete iReqBody; |
|
607 iReqBody = NULL; |
|
608 } |
|
609 if ( iRespBody ) |
|
610 { |
|
611 delete iRespBody; |
|
612 iRespBody = NULL; |
|
613 } |
|
614 if ( iTempPreset ) |
|
615 { |
|
616 delete iTempPreset; |
|
617 iTempPreset = NULL; |
|
618 } |
|
619 iTempPreset = CIRIsdsPreset::NewL(); |
|
620 *iTempPreset = *aPreset; |
|
621 if ( iTempPreset->GetImgUrl().Length() != 0 ) |
|
622 { |
|
623 IssueLogoDownloadRequestL(); |
|
624 } |
|
625 else /*ImgUrl doesnt exist in the iTempPreset*/ |
|
626 { |
|
627 //simply ignore it |
|
628 } |
|
629 } |
|
630 else |
|
631 { |
|
632 CIRIsdsPreset* tempPreset; |
|
633 tempPreset = CIRIsdsPreset::NewL(); |
|
634 CleanupStack::PushL( tempPreset ); |
|
635 *tempPreset = *aPreset; |
|
636 iPresetArray->AppendL( tempPreset ); |
|
637 CleanupStack::Pop( tempPreset ); |
|
638 iObserverArray->AppendL( aLogoHandle ); |
|
639 if ( aNPVReq == 2 ) |
|
640 { |
|
641 iReqFromArray->AppendL( 2 ); |
|
642 } |
|
643 else |
|
644 { |
|
645 iReqFromArray->AppendL( 1 ); |
|
646 } |
|
647 } |
|
648 IRLOG_DEBUG( "CIRLogoDownloadEngine::FetchLogoDataL - Exiting" ); |
|
649 } |
|
650 |
|
651 // --------------------------------------------------------------------------- |
|
652 // CIRLogoDownloadEngine::CheckCacheForLogoL() |
|
653 // Checks the cache whether the logo is available or not |
|
654 // --------------------------------------------------------------------------- |
|
655 // |
|
656 void CIRLogoDownloadEngine::CheckCacheForLogoL( TInt aValue ) |
|
657 { |
|
658 IRLOG_DEBUG( "CIRLogoDownloadEngine::CheckCacheForLogoL - Entering" ); |
|
659 iSendingLogo = aValue; |
|
660 iResult = 0; |
|
661 //0 means, this API is called for the usecase of checking cache |
|
662 if ( iSendingLogo == 0 ) |
|
663 { |
|
664 iCacheReqMade = ETrue; |
|
665 iCache->CheckCacheL( KLogo, iCacheTempPreset->GetImgUrl(), iForceGet, |
|
666 iResult ); |
|
667 } |
|
668 //1 means, this API is called for the usecase of downloading logo |
|
669 else if ( iSendingLogo == 1 ) |
|
670 { |
|
671 iCacheReqMade = ETrue; |
|
672 iCache->CheckCacheL( KLogo, iTempPreset->GetImgUrl(), iForceGet, |
|
673 iResult ); |
|
674 } |
|
675 if ( ( iResult == 0 ) )//not available in the cache |
|
676 { |
|
677 iLogoCached = EFalse; |
|
678 iIsConditionalGET = EFalse; |
|
679 } |
|
680 else if ( iResult == -1 )//cache is stale/not useable |
|
681 { |
|
682 iLogoCached = EFalse; |
|
683 iIsConditionalGET = ETrue; |
|
684 } |
|
685 else if ( iResult == 1 )//cache is useable |
|
686 { |
|
687 iLogoCached = ETrue; |
|
688 } |
|
689 IRLOG_DEBUG( "CIRLogoDownloadEngine::CheckCacheForLogoL - Exiting" ); |
|
690 } |
|
691 |
|
692 |
|
693 // --------------------------------------------------------------------------- |
|
694 // CIRLogoDownloadEngine::IssueLogoDownloadRequest() |
|
695 // submits the transaction for to download the logo |
|
696 // --------------------------------------------------------------------------- |
|
697 // |
|
698 void CIRLogoDownloadEngine::IssueLogoDownloadRequestL() |
|
699 { |
|
700 IRLOG_DEBUG( "CIRLogoDownloadEngine::IssueLogoDownloadRequestL - Entering" ); |
|
701 //This piece of code is for selecting the access point which is already |
|
702 //set at the begining of the application. To download the logo the same |
|
703 //accesse point will be used. |
|
704 if ( !iIRNetworkControllerHandle->GetNetworkStatus() ) |
|
705 { |
|
706 iIRNetworkControllerHandle->ChooseAccessPointL(); |
|
707 iLogoRequestPending = ETrue; |
|
708 } |
|
709 else |
|
710 { |
|
711 if ( iFirstTime ) |
|
712 { |
|
713 iLogoSession.Close(); |
|
714 TRAPD( LeaveValue, iLogoSession.OpenL() ); |
|
715 if ( LeaveValue != KErrNone ) |
|
716 { |
|
717 // Most common error; no access point configured, and session |
|
718 // creation leaves with KErrNotFound. Load a string from the |
|
719 // resource file and add the error code to string |
|
720 User::Leave( LeaveValue ); |
|
721 } |
|
722 // Set the HTTP connection properties |
|
723 RStringPool strP = iLogoSession.StringPool(); |
|
724 RHTTPConnectionInfo connInfo = iLogoSession.ConnectionInfo(); |
|
725 // RSocketServ Handle |
|
726 connInfo.SetPropertyL( strP.StringF( HTTP::EHttpSocketServ, RHTTPSession::GetTable() ), |
|
727 THTTPHdrVal( iIRNetworkControllerHandle->GetIRSocketServer().Handle() ) ); |
|
728 |
|
729 // RConnection Handle |
|
730 TInt connPtr = REINTERPRET_CAST( TInt, &( iIRNetworkControllerHandle->GetIRConnection() ) ); |
|
731 connInfo.SetPropertyL( strP.StringF( HTTP::EHttpSocketConnection, RHTTPSession::GetTable() ), |
|
732 THTTPHdrVal( connPtr ) ); |
|
733 |
|
734 // HTTP Version ( Specify that i am using HTTP/1.1 |
|
735 connInfo.SetPropertyL( strP.StringF( HTTP::EVersion, RHTTPSession::GetTable() ), |
|
736 THTTPHdrVal( strP.StringF( HTTP::EHttp11, RHTTPSession::GetTable() ) ) ); |
|
737 |
|
738 // Set RHttpSession into NetworkController for logo byte counter |
|
739 iIRNetworkControllerHandle->RegisterLogoDataTransferTrackerL( |
|
740 iLogoSession ); |
|
741 |
|
742 iFirstTime = EFalse; |
|
743 } |
|
744 |
|
745 HBufC8* buffertmp = HBufC8::NewLC( iTempPreset->GetImgUrl().Length() |
|
746 + 1 ); |
|
747 TPtr8 buffertmpPtr( buffertmp->Des() ); |
|
748 buffertmpPtr.Copy( iTempPreset->GetImgUrl() ); |
|
749 |
|
750 TUriParser8 uri; |
|
751 uri.Parse( buffertmpPtr ); |
|
752 RStringF method = iLogoSession.StringPool().StringF( HTTP::EGET, |
|
753 RHTTPSession::GetTable() ); |
|
754 iTransaction = iLogoSession.OpenTransactionL( uri, *this, method ); |
|
755 RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection(); |
|
756 // Set the User-Agent header to UAProf string |
|
757 SetHeaderL( hdr, HTTP::EUserAgent, |
|
758 iIRNetworkControllerHandle->GetUAProfString()->Des() ); |
|
759 // If KAccept include "image/jpeg", we can't get correct content of |
|
760 // png file from server |
|
761 _LIT8(KAccept,"image/png,image/gif"); |
|
762 SetHeaderL( hdr, HTTP::EAccept, KAccept ); |
|
763 SetHeaderL( hdr, HTTP::EAcceptLanguage, KAcceptLanguage ); |
|
764 |
|
765 if ( iIsConditionalGET ) |
|
766 { |
|
767 RStringF valStr = iLogoSession.StringPool().OpenFStringL( iETag ); |
|
768 CleanupClosePushL( valStr ); |
|
769 THTTPHdrVal val( valStr ); |
|
770 hdr.SetFieldL( iLogoSession.StringPool().StringF(HTTP::EIfNoneMatch, RHTTPSession::GetTable() ), |
|
771 val ); |
|
772 CleanupStack::PopAndDestroy( &valStr ); // valStr |
|
773 } |
|
774 CleanupStack::PopAndDestroy( buffertmp ); // buffertmp |
|
775 |
|
776 //setting the member variable to zero |
|
777 iRespBodySize = 0; |
|
778 iTransaction.SubmitL(); |
|
779 |
|
780 iRunning = ETrue; |
|
781 iLogoRequestPending = ETrue; |
|
782 iState = ESendingEvent; |
|
783 } |
|
784 IRLOG_DEBUG( "CIRLogoDownloadEngine::IssueLogoDownloadRequestL - Exiting" ); |
|
785 } |
|
786 |
|
787 // --------------------------------------------------------------------------- |
|
788 // CIRLogoDownloadEngine::CancelTransaction() |
|
789 // cancels the current transaction |
|
790 // --------------------------------------------------------------------------- |
|
791 // |
|
792 EXPORT_C void CIRLogoDownloadEngine::CancelTransaction() |
|
793 { |
|
794 IRLOG_DEBUG( "CIRLogoDownloadEngine::CancelTransaction - Entering" ); |
|
795 if ( !iRunning ) |
|
796 { |
|
797 return; |
|
798 } |
|
799 iTransaction.Close(); |
|
800 iRunning = EFalse; |
|
801 IRLOG_DEBUG( "CIRLogoDownloadEngine::CancelTransaction - Exiting" ); |
|
802 } |
|
803 |
|
804 |
|
805 // ---------------------------------------------------------------------------------- |
|
806 // CIRLogoDownloadEngine::SendPresetWithLogoL() |
|
807 // sends the preset with logo to the requestors |
|
808 // ---------------------------------------------------------------------------------- |
|
809 // |
|
810 EXPORT_C void CIRLogoDownloadEngine::SendPresetWithLogoL() |
|
811 { |
|
812 IRLOG_DEBUG( "CIRLogoDownloadEngine::SendPresetWithLogoL - Entering" ); |
|
813 //Logo has downloaded, so update the status of the variable iLogoRequestPending |
|
814 iLogoRequestPending = EFalse; |
|
815 //Remove the imgUrl with parameters from the Preset |
|
816 //now set imgUrl without parameters in to the Preset |
|
817 TInt sizeImgUrlWithPar = iTempPreset->GetImgUrl().Length(); |
|
818 TBool hasParameters = EFalse; |
|
819 RBuf urlWithPar; |
|
820 CleanupClosePushL(urlWithPar); |
|
821 urlWithPar.CreateL( sizeImgUrlWithPar ); |
|
822 urlWithPar.Copy( iTempPreset->GetImgUrl() ); |
|
823 RBuf tempBuf; |
|
824 CleanupClosePushL(tempBuf); |
|
825 tempBuf.CreateL( sizeImgUrlWithPar ); |
|
826 |
|
827 TLex urlLex( urlWithPar ); |
|
828 for ( ; !urlLex.Eos(); ) |
|
829 { |
|
830 tempBuf.Zero(); |
|
831 while ( urlLex.Peek() != '?' && !urlLex.Eos() ) |
|
832 { |
|
833 tempBuf.Append( urlLex.Get() ); |
|
834 } |
|
835 if ( urlLex.Peek() == '?' ) |
|
836 { |
|
837 hasParameters = ETrue; |
|
838 } |
|
839 urlLex.Inc(); |
|
840 } |
|
841 |
|
842 RBuf imgUrl; |
|
843 CleanupClosePushL(imgUrl); |
|
844 if ( hasParameters ) |
|
845 { |
|
846 //let say urlWithPar has the value http://www.logos.com/images/test.pngx=100&y=100 |
|
847 //now the tempBuf contains the value x=100&y=100 |
|
848 TInt sizeUrlParameters = tempBuf.Length(); |
|
849 sizeUrlParameters++; // now this integer contains the size of x=100&y=100 |
|
850 TInt sizeImgUrl = sizeImgUrlWithPar - sizeUrlParameters; |
|
851 |
|
852 //Create a buffer to store the imgUrl without parameters |
|
853 imgUrl.CreateL( sizeImgUrl ); |
|
854 imgUrl.Copy( urlWithPar.Left( sizeImgUrl ) ); |
|
855 iTempPreset->SetImgUrlL( imgUrl ); |
|
856 } |
|
857 else |
|
858 { |
|
859 //nothing to be done |
|
860 //the imgUrl present in the preset is correct, no need to change anything |
|
861 } |
|
862 |
|
863 //set the downloaded logo to the preset with the API SetLogoData() |
|
864 iTempPreset->SetLogoDataL( *iRespBody ); |
|
865 //which means the request came from SearchView while doing Add to Favorite |
|
866 if ( iTempReqFrom == 0 ) |
|
867 { |
|
868 iPresetModifiedStatus = ETrue; |
|
869 } |
|
870 //which menas the request came from a view other than NowPlayingView |
|
871 else if ( iTempReqFrom == 1 ) |
|
872 { |
|
873 iTempLogoHandle->PresetLogoDownloadedL( iTempPreset ); |
|
874 } |
|
875 //which menas the request came from NowPlayingView |
|
876 else if ( iTempReqFrom == 2 ) |
|
877 { |
|
878 //(1)logo has downloaded freshly |
|
879 //(2)send the logo to the NPV through PresetLogoDownloadedL |
|
880 //(3)check whether the preset exists in favdb; if so replace that with new logo |
|
881 iTempLogoHandle->PresetLogoDownloadedL( iTempPreset ); |
|
882 //iFavDb->ReplacePresetL(*iTempPreset) |
|
883 } |
|
884 |
|
885 iTempPreset->SetImgUrlL( urlWithPar ); |
|
886 //Cache the newly downloaded logo |
|
887 iCache->CacheLogoL( *iRespBody, iTempPreset->GetImgUrl(), |
|
888 *iResponseHeaders ); |
|
889 |
|
890 CleanupStack::PopAndDestroy(3); |
|
891 |
|
892 iRunning = EFalse; |
|
893 iState = EIdle; |
|
894 IRLOG_DEBUG( "CIRLogoDownloadEngine::SendPresetWithLogoL - Exiting" ); |
|
895 } |
|
896 |
|
897 // --------------------------------------------------------------------------- |
|
898 // CIRLogoDownloadEngine::MHFRunL()) |
|
899 // callback API from MHTTPTransactionCallback |
|
900 // --------------------------------------------------------------------------- |
|
901 // |
|
902 void CIRLogoDownloadEngine::MHFRunL( RHTTPTransaction aTransaction, |
|
903 const THTTPEvent& aEvent ) |
|
904 { |
|
905 IRLOG_DEBUG( "CIRLogoDownloadEngine::MHFRunL - Entering" ); |
|
906 switch ( aEvent.iStatus ) |
|
907 { |
|
908 case THTTPEvent::EGotResponseHeaders: |
|
909 { |
|
910 RHTTPResponse resp = aTransaction.Response(); |
|
911 TInt status = resp.StatusCode(); |
|
912 iRespCode = status; |
|
913 ExtractResponseHeadersL( aTransaction ); |
|
914 if ( status >= KStatusOK && status < KStatusMultipleChoices ) |
|
915 { |
|
916 THTTPHdrVal headerValue( 0 ); |
|
917 RHTTPHeaders headers = resp.GetHeaderCollection(); |
|
918 TInt error = headers.GetField( iLogoSession.StringPool().StringF( |
|
919 HTTP::EContentLength, |
|
920 RHTTPSession::GetTable() ), 0, headerValue ); |
|
921 iRespBodySize = 0; |
|
922 if ( KErrNone == error ) |
|
923 { |
|
924 iRespBodySize = headerValue.Int(); |
|
925 } |
|
926 iRespBody = HBufC8::NewL( iRespBodySize + 1 ); |
|
927 } |
|
928 //304 means, the content has not modified |
|
929 else if ( status == KStatusNotModified ) |
|
930 { |
|
931 if ( iIsConditionalGET ) |
|
932 { |
|
933 iIsConditionalGET = EFalse; |
|
934 iRunning = EFalse; |
|
935 //update the trust period |
|
936 //no problem if it leaves |
|
937 TRAP_IGNORE( iCache->UpdateTrustPeriodL( KLogo, iTempPreset->GetImgUrl(), *iResponseHeaders)) |
|
938 //do a forced get because the data is notmodifed in isds and |
|
939 //trustable |
|
940 iForceGet = ETrue; |
|
941 CheckCacheForLogoL( 1 ); |
|
942 } |
|
943 } |
|
944 else if ( status == KStatusGatewayTimeout ) |
|
945 { |
|
946 //implementation, if needed |
|
947 CancelTransaction(); |
|
948 if ( iTempReqFrom == 0 ) |
|
949 { |
|
950 //do nothing |
|
951 } |
|
952 else |
|
953 { |
|
954 iTempLogoHandle->PresetLogoDownloadError( iTempPreset ); |
|
955 } |
|
956 ManagePresetArrayIndexL(); |
|
957 } |
|
958 } |
|
959 break; |
|
960 case THTTPEvent::EGotResponseBodyData: |
|
961 { |
|
962 MHTTPDataSupplier* body = aTransaction.Response().Body(); |
|
963 TPtrC8 dataChunk; |
|
964 body->GetNextDataPart( dataChunk ); |
|
965 if ( iRespBodySize > 0 ) |
|
966 { |
|
967 iRespBody->Des().Append( (const TDesC8&)dataChunk ); |
|
968 } |
|
969 else if ( iRespBody ) |
|
970 { |
|
971 //which means the body of the response has come |
|
972 //but in the response headers Content-Length is missing |
|
973 //for this usecase realloc the iRespBody with the data received |
|
974 HBufC8* buffertmp = HBufC8::NewLC( dataChunk.Length() + 1 ); |
|
975 TPtr8 buffertmpPtr( buffertmp->Des() ); |
|
976 buffertmpPtr.Copy( (const TDesC8&)dataChunk ); |
|
977 |
|
978 TInt tempSize; |
|
979 tempSize = iRespBody->Length() + dataChunk.Length(); |
|
980 |
|
981 iRespBody = iRespBody->ReAllocL( tempSize ); |
|
982 TPtr8 ibufferPtr( iRespBody->Des() ); |
|
983 ibufferPtr.Append( buffertmpPtr ); |
|
984 |
|
985 CleanupStack::PopAndDestroy( buffertmp ); // buffertmp |
|
986 } |
|
987 body->ReleaseData(); |
|
988 } |
|
989 break; |
|
990 case THTTPEvent::EResponseComplete: |
|
991 { |
|
992 //No implementation |
|
993 } |
|
994 break; |
|
995 case THTTPEvent::ESucceeded: |
|
996 { |
|
997 iTransaction.Close(); |
|
998 if ( iIsConditionalGET ) |
|
999 { |
|
1000 iIsConditionalGET = EFalse; |
|
1001 } |
|
1002 |
|
1003 iRunning = EFalse; |
|
1004 //set the downloaded logo in the preset and send it back to the requestor |
|
1005 SendPresetWithLogoL(); |
|
1006 ManagePresetArrayIndexL(); |
|
1007 } |
|
1008 break; |
|
1009 |
|
1010 case THTTPEvent::EFailed: |
|
1011 { |
|
1012 aTransaction.Close(); |
|
1013 iRunning = EFalse; |
|
1014 iState = EIdle; |
|
1015 //304 means, the content has not modified |
|
1016 if ( iRespCode == KStatusNotModified ) |
|
1017 { |
|
1018 //do nothing; |
|
1019 } |
|
1020 else |
|
1021 { |
|
1022 if ( iTempReqFrom == 0 ) |
|
1023 { |
|
1024 //do nothing |
|
1025 } |
|
1026 else |
|
1027 { |
|
1028 iTempLogoHandle->PresetLogoDownloadError( iTempPreset ); |
|
1029 } |
|
1030 } |
|
1031 ManagePresetArrayIndexL(); |
|
1032 } |
|
1033 break; |
|
1034 default: |
|
1035 |
|
1036 if ( aEvent.iStatus < 0 ) |
|
1037 { |
|
1038 aTransaction.Close(); |
|
1039 iRunning = EFalse; |
|
1040 iState = EIdle; |
|
1041 if ( iTempReqFrom == 0 ) |
|
1042 { |
|
1043 //do nothing |
|
1044 } |
|
1045 else |
|
1046 { |
|
1047 iTempLogoHandle->PresetLogoDownloadError( iTempPreset ); |
|
1048 } |
|
1049 ManagePresetArrayIndexL(); |
|
1050 } |
|
1051 break; |
|
1052 } |
|
1053 IRLOG_DEBUG( "CIRLogoDownloadEngine::MHFRunL - Exiting" ); |
|
1054 } |
|
1055 |
|
1056 // --------------------------------------------------------------------------- |
|
1057 // CIRLogoDownloadEngine::MHFRunError() |
|
1058 // callback API from MHTTPTransactionCallback |
|
1059 // --------------------------------------------------------------------------- |
|
1060 // |
|
1061 TInt CIRLogoDownloadEngine::MHFRunError( TInt /*aError*/, |
|
1062 RHTTPTransaction aTransaction, const THTTPEvent& /*aEvent*/) |
|
1063 { |
|
1064 IRLOG_DEBUG( "CIRLogoDownloadEngine::MHFRunError - Entering" ); |
|
1065 aTransaction.Close(); |
|
1066 iRunning = EFalse; |
|
1067 iState = EIdle; |
|
1068 if ( iIsConditionalGET ) |
|
1069 { |
|
1070 iIsConditionalGET = EFalse; |
|
1071 } |
|
1072 if ( iTempReqFrom == 0 ) |
|
1073 { |
|
1074 //do nothing |
|
1075 } |
|
1076 else |
|
1077 { |
|
1078 iTempLogoHandle->PresetLogoDownloadError( iTempPreset ); |
|
1079 } |
|
1080 TRAP_IGNORE(ManagePresetArrayIndexL()) |
|
1081 IRLOG_DEBUG( "CIRLogoDownloadEngine::MHFRunError - Exiting" ); |
|
1082 return KErrNone; |
|
1083 } |
|
1084 |
|
1085 // --------------------------------------------------------------------------- |
|
1086 // CIRLogoDownloadEngine::GetNextDataPart(TPtrC8& aDataPart) |
|
1087 // callback API from MHTTPDataSupplier |
|
1088 // --------------------------------------------------------------------------- |
|
1089 TBool CIRLogoDownloadEngine::GetNextDataPart( TPtrC8& aDataPart ) |
|
1090 { |
|
1091 IRLOG_DEBUG( "CIRLogoDownloadEngine::GetNextDataPart - Entering" ); |
|
1092 aDataPart.Length(); |
|
1093 iReqBody->Length(); |
|
1094 aDataPart.Set( *iReqBody ); |
|
1095 IRLOG_DEBUG( "CIRLogoDownloadEngine::GetNextDataPart - Exiting" ); |
|
1096 return ETrue; |
|
1097 } |
|
1098 |
|
1099 // --------------------------------------------------------------------------- |
|
1100 // CIRLogoDownloadEngine::ReleaseData() |
|
1101 // callback API from MHTTPDataSupplier |
|
1102 // --------------------------------------------------------------------------- |
|
1103 void CIRLogoDownloadEngine::ReleaseData() |
|
1104 { |
|
1105 IRLOG_DEBUG( "CIRLogoDownloadEngine::ReleaseData" ); |
|
1106 //No implementaion |
|
1107 } |
|
1108 |
|
1109 // --------------------------------------------------------------------------- |
|
1110 // CIRLogoDownloadEngine::Reset() |
|
1111 // callback API from MHTTPDataSupplier |
|
1112 // --------------------------------------------------------------------------- |
|
1113 TInt CIRLogoDownloadEngine::Reset() |
|
1114 { |
|
1115 IRLOG_DEBUG( "CIRLogoDownloadEngine::Reset" ); |
|
1116 return KErrNone; |
|
1117 } |
|
1118 |
|
1119 // -------------------------------------------------------------------- |
|
1120 // CIRLogoDownloadEngine::OverallDataSize() |
|
1121 // callback API from MHTTPDataSupplier |
|
1122 // -------------------------------------------------------------------- |
|
1123 TInt CIRLogoDownloadEngine::OverallDataSize() |
|
1124 { |
|
1125 IRLOG_DEBUG( "CIRLogoDownloadEngine::OverallDataSize" ); |
|
1126 return iReqBody->Length(); |
|
1127 } |
|
1128 |
|
1129 // --------------------------------------------------------------------------- |
|
1130 // CIRLogoDownloadEngine::ExtractResponseHeadersL() |
|
1131 // Used to Extract the response headers. |
|
1132 // --------------------------------------------------------------------------- |
|
1133 // |
|
1134 void CIRLogoDownloadEngine::ExtractResponseHeadersL( |
|
1135 const RHTTPTransaction& aTransaction ) |
|
1136 { |
|
1137 IRLOG_DEBUG( "CIRHttpDataProvider::ExtractResponseHeadersL - Entering" ); |
|
1138 RHTTPResponse response = aTransaction.Response(); |
|
1139 RHTTPHeaders respHeader = response.GetHeaderCollection(); |
|
1140 THTTPHdrFieldIter iterator = respHeader.Fields(); |
|
1141 RStringPool httpStringPool = aTransaction.Session().StringPool(); |
|
1142 iterator.First(); |
|
1143 HBufC8 *headerField = HBufC8::NewLC( KMaxHeaderNameLength |
|
1144 + KMaxHeaderValueLength ); |
|
1145 HBufC8 *fieldValBuf = HBufC8::NewLC( KMaxHeaderValueLength ); |
|
1146 while ( iterator.AtEnd() == EFalse ) |
|
1147 { |
|
1148 RStringTokenF fieldName = iterator(); |
|
1149 RStringF fieldNameStr = httpStringPool.StringF( fieldName ); |
|
1150 THTTPHdrVal fieldVal; |
|
1151 if ( respHeader.GetField( fieldNameStr, 0, fieldVal ) == KErrNone ) |
|
1152 { |
|
1153 const TDesC8 &fieldNameDesC = fieldNameStr.DesC(); |
|
1154 headerField->Des().Copy( |
|
1155 fieldNameDesC.Left( KMaxHeaderNameLength ) ); |
|
1156 fieldValBuf->Des().Zero(); |
|
1157 switch ( fieldVal.Type() ) |
|
1158 { |
|
1159 // the value is an integer |
|
1160 //lint restore -e747:Significant prototype |
|
1161 //coercion (arg. no. 1) int to long long : |
|
1162 case THTTPHdrVal::KTIntVal: |
|
1163 fieldValBuf->Des().Num( fieldVal.Int() ); |
|
1164 break; |
|
1165 // the value is a case-insensitive string |
|
1166 case THTTPHdrVal::KStrFVal: |
|
1167 { |
|
1168 RStringF fieldValStr = httpStringPool.StringF( |
|
1169 fieldVal.StrF() ); |
|
1170 const TDesC8 &fieldValDesC = fieldValStr.DesC(); |
|
1171 fieldValBuf->Des().Copy( fieldValDesC.Left( |
|
1172 KMaxHeaderValueLength ) ); |
|
1173 } |
|
1174 break; |
|
1175 // the value is a case-sensitive string |
|
1176 case THTTPHdrVal::KStrVal: |
|
1177 { |
|
1178 RString fieldValStr = httpStringPool.String( |
|
1179 fieldVal.Str() ); |
|
1180 const TDesC8 &fieldValDesC = fieldValStr.DesC(); |
|
1181 fieldValBuf->Des().Copy( fieldValDesC.Left( |
|
1182 KMaxHeaderValueLength ) ); |
|
1183 } |
|
1184 break; |
|
1185 // the value is a date/time |
|
1186 case THTTPHdrVal::KDateVal: |
|
1187 { |
|
1188 TDateTime date = fieldVal.DateTime(); |
|
1189 TTime t( date ); |
|
1190 // if ( iSetNonUAProfUserAgent ) |
|
1191 // { |
|
1192 HttpDateHeaderReceived( *headerField, t ); |
|
1193 // } |
|
1194 } |
|
1195 break; |
|
1196 // the value is type is unknown |
|
1197 default: |
|
1198 break; |
|
1199 } |
|
1200 // Display HTTP header field name and value |
|
1201 headerField->Des().Append( KDPColon ); |
|
1202 headerField->Des().Append( *fieldValBuf ); |
|
1203 HttpHeaderReceived( *headerField ); |
|
1204 } |
|
1205 ++iterator; |
|
1206 } |
|
1207 |
|
1208 CleanupStack::PopAndDestroy( fieldValBuf ); |
|
1209 CleanupStack::PopAndDestroy( headerField ); |
|
1210 IRLOG_DEBUG( "CIRLogoDownloadEngine::ExtractResponseHeadersL - Exiting." ); |
|
1211 } |
|
1212 |
|
1213 // --------------------------------------------------------------------------- |
|
1214 // CIRLogoDownloadEngine::HttpHeaderReceived() |
|
1215 // indicate that an HTTP header is received. |
|
1216 // --------------------------------------------------------------------------- |
|
1217 // |
|
1218 void CIRLogoDownloadEngine::HttpHeaderReceived( const TDesC8& aHeaderData ) |
|
1219 { |
|
1220 IRLOG_DEBUG( "CIRLogoDownloadEngine::HttpHeaderReceived - Entering." ); |
|
1221 _LIT8(KDelim,":"); |
|
1222 _LIT8(KContentType,"Content-Type"); |
|
1223 ExtractHeaderValue( aHeaderData, KContentType, KDelim, |
|
1224 iResponseHeaders-> iContentType ); |
|
1225 _LIT8(KMaxAge,"max-age"); |
|
1226 _LIT8(KDelimEqual,"="); |
|
1227 ExtractHeaderValue( aHeaderData, KMaxAge, KDelimEqual, |
|
1228 iResponseHeaders-> iMaxAge ); |
|
1229 _LIT8(KContentLength,"Content-Length"); |
|
1230 ExtractHeaderValue( aHeaderData, KContentLength, KDelim, |
|
1231 iResponseHeaders-> iContentLength ); |
|
1232 _LIT8(KExpires,"Expires"); |
|
1233 ExtractHeaderValue( aHeaderData, KExpires, KDelim, |
|
1234 iResponseHeaders->iExpires ); |
|
1235 _LIT8(KETag,"ETag"); |
|
1236 ExtractHeaderValue( aHeaderData, KETag, KDelim, iResponseHeaders->iETag ); |
|
1237 IRLOG_DEBUG( "CIRLogoDownloadEngine::HttpHeaderReceived - Exiting." ); |
|
1238 } |
|
1239 |
|
1240 // --------------------------------------------------------------------------- |
|
1241 // CIRLogoDownloadEngine::ExtractHeaderValue() |
|
1242 // Used to build the CIRHttpResponseData |
|
1243 // --------------------------------------------------------------------------- |
|
1244 // |
|
1245 void CIRLogoDownloadEngine::ExtractHeaderValue( const TDesC8& aHeaderData, |
|
1246 const TDesC8& aHeaderName, const TDesC8& aDelimeter, |
|
1247 TDes8& aHolder ) const |
|
1248 { |
|
1249 IRLOG_DEBUG( "CIRLogoDownloadEngine::ExtractHeaderValue - Entering" ); |
|
1250 TInt position = aHeaderData.Find( aHeaderName ); |
|
1251 if ( position >= 0 ) |
|
1252 { |
|
1253 TPtrC8 headerValue = aHeaderData.Mid( position ); |
|
1254 TInt delimeterPosition = headerValue.Find( aDelimeter ); |
|
1255 if ( delimeterPosition != KErrNotFound ) |
|
1256 { |
|
1257 delimeterPosition++; |
|
1258 TPtrC8 value = headerValue.Mid( delimeterPosition ); |
|
1259 aHolder.Copy( value ); |
|
1260 aHolder.TrimAll(); |
|
1261 } |
|
1262 } |
|
1263 IRLOG_DEBUG( "CIRLogoDownloadEngine::ExtractHeaderValue - Exiting." ); |
|
1264 } |
|
1265 |
|
1266 // --------------------------------------------------------------------------- |
|
1267 // CIRLogoDownloadEngine::HttpDateHeaderReceived() |
|
1268 // Used to build the CIRHttpResponseData members |
|
1269 // --------------------------------------------------------------------------- |
|
1270 // |
|
1271 void CIRLogoDownloadEngine::HttpDateHeaderReceived( const TDesC8 &aHeader, |
|
1272 const TTime& aTime ) |
|
1273 { |
|
1274 IRLOG_DEBUG( "CIRLogoDownloadEngine::HttpDateHeaderReceived - Entering." ); |
|
1275 _LIT8(KDate,"Date"); |
|
1276 _LIT8(KLastModified,"Last-Modified"); |
|
1277 TInt position = aHeader.Find( KDate ); |
|
1278 if ( position != KErrNotFound ) |
|
1279 { |
|
1280 iResponseHeaders->iDate = aTime; |
|
1281 return; |
|
1282 } |
|
1283 position = aHeader.Find( KLastModified ); |
|
1284 if ( position != KErrNotFound ) |
|
1285 { |
|
1286 iResponseHeaders->iLastModified = aTime; |
|
1287 } |
|
1288 IRLOG_DEBUG( "CIRLogoDownloadEngine::HttpDateHeaderReceived - Exiting." ); |
|
1289 } |
|
1290 |
|
1291 // --------------------------------------------------------------------------- |
|
1292 // CIRLogoDownloadEngine::ManagePresetArrayIndexL() |
|
1293 // To make another download request if exists in the queue |
|
1294 // To update the iPresetArray current index |
|
1295 // --------------------------------------------------------------------------- |
|
1296 void CIRLogoDownloadEngine::ManagePresetArrayIndexL() |
|
1297 { |
|
1298 IRLOG_DEBUG( "CIRLogoDownloadEngine::ManagePresetArrayIndexL - Entering" ); |
|
1299 TInt PresetArrayLength = iPresetArray->Count(); |
|
1300 if ( ( PresetArrayLength > 0 ) && ( iPresetArrayPos < PresetArrayLength ) ) |
|
1301 { |
|
1302 CIRIsdsPreset* tempPreset = CIRIsdsPreset::NewL(); |
|
1303 CleanupStack::PushL( tempPreset ); |
|
1304 *tempPreset = *( iPresetArray->At( iPresetArrayPos ) ); |
|
1305 if ( iReqFromArrayPos < iReqFromArray->Count() && |
|
1306 iReqFromArray->At(iReqFromArrayPos ) == 0 ) |
|
1307 { |
|
1308 FetchLogoDataL( tempPreset ); |
|
1309 } |
|
1310 else if ( iObserverArrayPos < iObserverArray->Count() ) |
|
1311 { |
|
1312 FetchLogoDataL( tempPreset, |
|
1313 iObserverArray->At( iObserverArrayPos ), |
|
1314 iReqFromArray->At( iReqFromArrayPos ) ); |
|
1315 ++iObserverArrayPos; |
|
1316 } |
|
1317 ++iPresetArrayPos; |
|
1318 ++iReqFromArrayPos; |
|
1319 // delete tempPreset; |
|
1320 CleanupStack::PopAndDestroy( tempPreset ); |
|
1321 } |
|
1322 IRLOG_DEBUG( "CIRLogoDownloadEngine::ManagePresetArrayIndexL - Exiting" ); |
|
1323 } |
|
1324 |
|
1325 // --------------------------------------------------------------------------- |
|
1326 // CIRLogoDownloadEngine::ManageCachePresetArrayIndexL() |
|
1327 // To make another download request if exists in the queue |
|
1328 // To update the iCachePresetArray current index |
|
1329 // --------------------------------------------------------------------------- |
|
1330 void CIRLogoDownloadEngine::ManageCachePresetArrayIndexL() |
|
1331 { |
|
1332 IRLOG_DEBUG( "CIRLogoDownloadEngine::ManageCachePresetArrayIndexL - Exiting" ); |
|
1333 TInt CachePresetArrayLength = iCachePresetArray->Count(); |
|
1334 if ( ( CachePresetArrayLength > 0 ) && |
|
1335 ( iCachePresetArrayPos < CachePresetArrayLength ) ) |
|
1336 { |
|
1337 CIRIsdsPreset* tempPreset; |
|
1338 tempPreset = CIRIsdsPreset::NewL(); |
|
1339 CleanupStack::PushL( tempPreset ); |
|
1340 *tempPreset = *( iCachePresetArray->At( iCachePresetArrayPos ) ); |
|
1341 |
|
1342 if ( iCacheReqFromArrayPos < iCacheReqFromArray->Count() && |
|
1343 iCacheReqFromArray->At( iCacheReqFromArrayPos ) == 0 ) |
|
1344 { |
|
1345 SendRequestL( tempPreset, KLogoSize, KLogoSize ); |
|
1346 } |
|
1347 else if ( iCacheObserverArrayPos < iCacheObserverArray->Count() ) |
|
1348 { |
|
1349 SendRequestL( tempPreset, |
|
1350 iCacheObserverArray->At( iCacheObserverArrayPos ), |
|
1351 iCacheReqFromArray->At( iCacheReqFromArrayPos ) ); |
|
1352 ++iCacheObserverArrayPos; |
|
1353 } |
|
1354 ++iCachePresetArrayPos; |
|
1355 ++iCacheReqFromArrayPos; |
|
1356 // delete tempPreset; |
|
1357 CleanupStack::PopAndDestroy( tempPreset ); |
|
1358 } |
|
1359 IRLOG_DEBUG( "CIRLogoDownloadEngine::ManageCachePresetArrayIndexL - Exiting" ); |
|
1360 } |
|
1361 |
|
1362 // --------------------------------------------------------------------------- |
|
1363 // CIRLogoDownloadEngine::CacheError() |
|
1364 // Called from cachemgmt in case of an error |
|
1365 // callback API from MIRCacheObserver |
|
1366 // --------------------------------------------------------------------------- |
|
1367 void CIRLogoDownloadEngine::CacheError() |
|
1368 { |
|
1369 IRLOG_DEBUG( "CIRLogoDownloadEngine::CacheError" ); |
|
1370 |
|
1371 //code here, if needed |
|
1372 } |
|
1373 |
|
1374 // --------------------------------------------------------------------------- |
|
1375 // CIRLogoDownloadEngine::CacheFailed() |
|
1376 // Called from cachemgmt in case of cache failure |
|
1377 // callback API from MIRCacheObserver |
|
1378 // --------------------------------------------------------------------------- |
|
1379 void CIRLogoDownloadEngine::CacheFailed() |
|
1380 { |
|
1381 IRLOG_DEBUG( "CIRLogoDownloadEngine::CacheFailed" ); |
|
1382 //code here, if needed |
|
1383 } |
|
1384 |
|
1385 // --------------------------------------------------------------------------- |
|
1386 // CIRLogoDownloadEngine::CacheInvalid() |
|
1387 // Called from cachemgmt in case cache is invalid |
|
1388 // callback API from MIRCacheObserver |
|
1389 // --------------------------------------------------------------------------- |
|
1390 void CIRLogoDownloadEngine::CacheInvalid() |
|
1391 { |
|
1392 IRLOG_DEBUG( "CIRLogoDownloadEngine::CacheInvalid - Entering" ); |
|
1393 iETag = iCache->iETag; |
|
1394 IRLOG_DEBUG( "CIRLogoDownloadEngine::CacheInvalid - Exiting" ); |
|
1395 } |
|
1396 |
|
1397 // --------------------------------------------------------------------------- |
|
1398 // CIRLogoDownloadEngine::CachedStructureL(TInt aChoice) |
|
1399 // Called from cachemgmt data retrival is successful |
|
1400 // callback API from MIRCacheObserver |
|
1401 // --------------------------------------------------------------------------- |
|
1402 void CIRLogoDownloadEngine::CachedStructureL( TInt aChoice ) |
|
1403 { |
|
1404 IRLOG_DEBUG( "CIRLogoDownloadEngine::CachedStructureL - Entering" ); |
|
1405 if ( iCacheReqMade ) |
|
1406 { |
|
1407 iCacheReqMade = EFalse; |
|
1408 if ( aChoice == KCacheAvailable ) |
|
1409 { |
|
1410 |
|
1411 TInt sizeImgUrlWithPmts = 0; |
|
1412 //Remove the imgUrl with parameters from the Preset |
|
1413 //now set imgUrl without parameters in to the Preset |
|
1414 if ( iSendingLogo == 0 ) |
|
1415 { |
|
1416 sizeImgUrlWithPmts = iCacheTempPreset->GetImgUrl().Length(); |
|
1417 } |
|
1418 else if ( iSendingLogo == 1 ) |
|
1419 { |
|
1420 sizeImgUrlWithPmts = iTempPreset->GetImgUrl().Length(); |
|
1421 } |
|
1422 else if ( iSendingLogo == 2 ) |
|
1423 { |
|
1424 sizeImgUrlWithPmts = KTen; |
|
1425 } |
|
1426 TBool hasParameters = EFalse; |
|
1427 RBuf urlWithPar; |
|
1428 CleanupClosePushL(urlWithPar); |
|
1429 urlWithPar.CreateL( sizeImgUrlWithPmts ); |
|
1430 if ( iSendingLogo == 0 ) |
|
1431 { |
|
1432 urlWithPar.Copy( iCacheTempPreset->GetImgUrl() ); |
|
1433 } |
|
1434 else if ( iSendingLogo == 1 ) |
|
1435 { |
|
1436 urlWithPar.Copy( iTempPreset->GetImgUrl() ); |
|
1437 } |
|
1438 else if ( iSendingLogo == 2 ) |
|
1439 { |
|
1440 _LIT(KNone,""); |
|
1441 urlWithPar.Copy( KNone ); |
|
1442 } |
|
1443 |
|
1444 RBuf tempBuf; |
|
1445 CleanupClosePushL(tempBuf); |
|
1446 tempBuf.CreateL( sizeImgUrlWithPmts ); |
|
1447 |
|
1448 TLex urlLex( urlWithPar ); |
|
1449 for ( ; !urlLex.Eos(); ) |
|
1450 { |
|
1451 tempBuf.Zero(); |
|
1452 while ( urlLex.Peek() != '?' && !urlLex.Eos() ) |
|
1453 { |
|
1454 tempBuf.Append( urlLex.Get() ); |
|
1455 } |
|
1456 if ( urlLex.Peek() == '?' ) |
|
1457 { |
|
1458 hasParameters = ETrue; |
|
1459 } |
|
1460 urlLex.Inc(); |
|
1461 } |
|
1462 |
|
1463 RBuf imgUrl; |
|
1464 CleanupClosePushL(imgUrl); |
|
1465 if ( hasParameters ) |
|
1466 { |
|
1467 //let say urlWithPar has the value http://www.logos.com/images/test.pngx=100&y=100 |
|
1468 //now the tempBuf contains the value x=100&y=100 |
|
1469 TInt sizeUrlParameters = tempBuf.Length(); |
|
1470 sizeUrlParameters++; // now this integer contains the size of x=100&y=100 |
|
1471 TInt sizeImgUrl = sizeImgUrlWithPmts - sizeUrlParameters; |
|
1472 |
|
1473 //Create a buffer to store the imgUrl without parameters |
|
1474 imgUrl.CreateL( sizeImgUrl ); |
|
1475 imgUrl.Copy( urlWithPar.Left( sizeImgUrl ) ); |
|
1476 if ( iSendingLogo == 0 ) |
|
1477 { |
|
1478 iCacheTempPreset->SetImgUrlL( imgUrl ); |
|
1479 } |
|
1480 else if ( iSendingLogo == 1 ) |
|
1481 { |
|
1482 iTempPreset->SetImgUrlL( imgUrl ); |
|
1483 } |
|
1484 } |
|
1485 else |
|
1486 { |
|
1487 //nothing to be done |
|
1488 //the imgUrl present in the preset is correct, no need to change anything |
|
1489 } |
|
1490 |
|
1491 if ( iSendingLogo == 0 ) |
|
1492 { |
|
1493 //logo is available in the cache |
|
1494 if ( aChoice == KCacheAvailable ) |
|
1495 { |
|
1496 iCacheTempPreset->SetLogoDataL( iCache->iLogoData ); |
|
1497 } |
|
1498 if ( iCacheReqFrom == 0 ) |
|
1499 { |
|
1500 iPresetModifiedStatus = ETrue; |
|
1501 } |
|
1502 else |
|
1503 { |
|
1504 iCacheTempLogoHandle->PresetLogoDownloadedL( |
|
1505 iCacheTempPreset ); |
|
1506 } |
|
1507 |
|
1508 ManageCachePresetArrayIndexL(); |
|
1509 } |
|
1510 else if ( iSendingLogo == 1 ) |
|
1511 { |
|
1512 //logo is available in the cache |
|
1513 if ( aChoice == KCacheAvailable ) |
|
1514 { |
|
1515 iTempPreset->SetLogoDataL( iCache->iLogoData ); |
|
1516 } |
|
1517 if ( iTempReqFrom == 0 ) |
|
1518 { |
|
1519 iPresetModifiedStatus = ETrue; |
|
1520 } |
|
1521 else |
|
1522 { |
|
1523 iTempLogoHandle->PresetLogoDownloadedL( iTempPreset ); |
|
1524 } |
|
1525 |
|
1526 ManagePresetArrayIndexL(); |
|
1527 } |
|
1528 //logo request from the search results (while displaying logo) |
|
1529 else if ( iSendingLogo == 2 ) |
|
1530 { |
|
1531 //code here, if needed |
|
1532 } |
|
1533 //close all the buffers |
|
1534 CleanupStack::PopAndDestroy(3); |
|
1535 } |
|
1536 } |
|
1537 IRLOG_DEBUG( "CIRLogoDownloadEngine::CachedStructureL - Exiting" ); |
|
1538 } |
|
1539 |
|
1540 // --------------------------------------------------------------------------- |
|
1541 // CIRLogoDownloadEngine::ReleaseResources() |
|
1542 // Releases the resources held by logo download engine |
|
1543 // Used to close the Http Session if already open |
|
1544 // --------------------------------------------------------------------------- |
|
1545 void CIRLogoDownloadEngine::ReleaseResources() |
|
1546 { |
|
1547 IRLOG_DEBUG( "CIRLogoDownloadEngine::ReleaseResources - Entering" ); |
|
1548 CancelTransaction(); |
|
1549 iLogoSession.Close(); |
|
1550 iFirstTime = ETrue; |
|
1551 IRLOG_DEBUG( "CIRLogoDownloadEngine::ReleaseResources - Exiting" ); |
|
1552 } |
|
1553 |
|
1554 // ----------------------------------------------------------------------------- |
|
1555 // --------------------------------------------------------------------------- |
|
1556 // Notified by network controller when network is active, to reissue |
|
1557 // the request NotifyActiveNetworkObserversL() |
|
1558 // --------------------------------------------------------------------------- |
|
1559 |
|
1560 void CIRLogoDownloadEngine::NotifyActiveNetworkObserversL( |
|
1561 TIRNetworkEvent aEvent ) |
|
1562 { |
|
1563 IRLOG_DEBUG( "CIRLogoDownloadEngine::NotifyActiveNetworkObserversL - Entering" ); |
|
1564 switch ( aEvent ) |
|
1565 { |
|
1566 case ENetworkConnectionDisconnected: |
|
1567 { |
|
1568 ReleaseResources(); |
|
1569 } |
|
1570 break; |
|
1571 case ENetworkConnectionEstablished: |
|
1572 { |
|
1573 if ( iLogoRequestPending ) |
|
1574 { |
|
1575 IssueLogoDownloadRequestL(); |
|
1576 } |
|
1577 } |
|
1578 } |
|
1579 IRLOG_DEBUG( "CIRLogoDownloadEngine::NotifyActiveNetworkObserversL - Exiting" ); |
|
1580 } |
|
1581 |
|
1582 // --------------------------------------------------------------------------- |
|
1583 // Notified by network controller when user cancels network connection, |
|
1584 // to reset the pending requests |
|
1585 // ResetPendingRequests() |
|
1586 // --------------------------------------------------------------------------- |
|
1587 void CIRLogoDownloadEngine::ResetPendingRequests( TBool /*aValue*/) |
|
1588 { |
|
1589 // nothing to do |
|
1590 } |