14 * Description: |
14 * Description: |
15 * This file contains the declaration of the Download Mgr Server. |
15 * This file contains the declaration of the Download Mgr Server. |
16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 |
|
20 // INCLUDE FILES |
19 // INCLUDE FILES |
21 #include "DownloadMgrLogger.h" |
20 #include "DownloadMgrLogger.h" |
22 #include "DownloadMgrServer.h" |
21 #include "DownloadMgrServer.h" |
23 #include "DownloadMgrDef.h" |
22 #include "DownloadMgrDef.h" |
24 #include "DownloadMgrEventQueue.h" |
23 #include "DownloadMgrEventQueue.h" |
25 |
24 |
26 #include <HttpClientAppInstance.h> |
25 #include "HttpClientAppInstance.h" |
27 #include <HttpDownload.h> |
26 #include "HttpDownload.h" |
28 #include <e32svr.h> |
27 #include <e32svr.h> |
29 #include <basched.h> |
28 #include <basched.h> |
30 |
29 |
31 // CONSTANTS |
30 // CONSTANTS |
32 |
31 |
144 CLOG_ENTERFN( "CDownloadMgrSession::ServiceL" ) |
143 CLOG_ENTERFN( "CDownloadMgrSession::ServiceL" ) |
145 TRAPD( err, DispatchMessageL( aMessage ) ); |
144 TRAPD( err, DispatchMessageL( aMessage ) ); |
146 if( iComplete || ( KErrNone != err ) ) |
145 if( iComplete || ( KErrNone != err ) ) |
147 { |
146 { |
148 // Only the syncron requests has to be completed here! |
147 // Only the syncron requests has to be completed here! |
|
148 if ((!aMessage.IsNull()) && (!CurrentMessage().IsNull()) ) |
149 aMessage.Complete( err ); |
149 aMessage.Complete( err ); |
150 } |
150 } |
151 } |
151 } |
152 |
152 |
153 |
153 |
310 { |
315 { |
311 return iCurrentMessage; |
316 return iCurrentMessage; |
312 } |
317 } |
313 |
318 |
314 // --------------------------------------------------------- |
319 // --------------------------------------------------------- |
|
320 // CDownloadMgrSession::GetNumberOfSubsession |
|
321 // --------------------------------------------------------- |
|
322 // |
|
323 void CDownloadMgrSession::GetNumberOfSubsession() |
|
324 { |
|
325 TInt32 value(0); |
|
326 for( TInt i = 0; i < iObjectIx->Count(); i++ ){ |
|
327 CDownloadSubSession* downloadSess |
|
328 = ( CDownloadSubSession* )(*iObjectIx)[i]; |
|
329 if( downloadSess != NULL ){ |
|
330 value++; |
|
331 } |
|
332 } |
|
333 TPckg<TInt32> pckg( value ); |
|
334 Write( 0, CurrentMessage(), pckg ); |
|
335 } |
|
336 |
|
337 // --------------------------------------------------------- |
315 // CDownloadMgrSession::InitializeL |
338 // CDownloadMgrSession::InitializeL |
316 // --------------------------------------------------------- |
339 // --------------------------------------------------------- |
317 // |
340 // |
318 void CDownloadMgrSession::InitializeL() |
341 void CDownloadMgrSession::InitializeL() |
319 { |
342 { |
330 // Check how many download we have and return it to the client |
353 // Check how many download we have and return it to the client |
331 CLOG_WRITE_FORMAT( "CDownloadMgrSession::InitializeL iClientAppInstance %d", iClientAppInstance ); |
354 CLOG_WRITE_FORMAT( "CDownloadMgrSession::InitializeL iClientAppInstance %d", iClientAppInstance ); |
332 CArrayPtrFlat<CHttpDownload>* currentDownloads = iClientAppInstance->DownloadsL(); |
355 CArrayPtrFlat<CHttpDownload>* currentDownloads = iClientAppInstance->DownloadsL(); |
333 TPckg<TInt> countPckg( currentDownloads->Count() ); |
356 TPckg<TInt> countPckg( currentDownloads->Count() ); |
334 TPckg<TInt> sessionId( iSessionId ); |
357 TPckg<TInt> sessionId( iSessionId ); |
335 |
358 if (!CurrentMessage().IsNull()) |
336 Write( 1, CurrentMessage(), countPckg ); |
359 Write( 1, CurrentMessage(), countPckg ); |
|
360 if (!CurrentMessage().IsNull()) |
337 Write( 3, CurrentMessage(), sessionId ); |
361 Write( 3, CurrentMessage(), sessionId ); |
338 |
362 |
339 CLOG_NAME_2( _L("Session_%x_%x"), uidPckg().iUid, iSessionId ); |
363 CLOG_NAME_2( _L("Session_%x_%x"), uidPckg().iUid, iSessionId ); |
340 |
364 |
341 currentDownloads->Reset(); |
365 currentDownloads->Reset(); |