browserutilities/downloadmgr/DownloadMgrClntSrv/src/DownloadMgrSrvSession.cpp
branchRCL_3
changeset 93 79859ed3eea9
parent 73 a1a5d4e727e8
child 94 919f36ff910f
equal deleted inserted replaced
92:e1bea15f9a39 93:79859ed3eea9
    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 
    19 // INCLUDE FILES
    20 // INCLUDE FILES
    20 #include "DownloadMgrLogger.h"
    21 #include "DownloadMgrLogger.h"
    21 #include "DownloadMgrServer.h"
    22 #include "DownloadMgrServer.h"
    22 #include "DownloadMgrDef.h"
    23 #include "DownloadMgrDef.h"
    23 #include "DownloadMgrEventQueue.h"
    24 #include "DownloadMgrEventQueue.h"
    24 
    25 
    25 #include "HttpClientAppInstance.h"
    26 #include <HttpClientAppInstance.h>
    26 #include "HttpDownload.h"
    27 #include <HttpDownload.h>
    27 #include <e32svr.h>
    28 #include <e32svr.h>
    28 #include <basched.h>
    29 #include <basched.h>
    29 
    30 
    30 // CONSTANTS
    31 // CONSTANTS
    31 
    32 
   143     CLOG_ENTERFN( "CDownloadMgrSession::ServiceL" )
   144     CLOG_ENTERFN( "CDownloadMgrSession::ServiceL" )
   144 	TRAPD( err, DispatchMessageL( aMessage ) );
   145 	TRAPD( err, DispatchMessageL( aMessage ) );
   145     if( iComplete || ( KErrNone != err ) )
   146     if( iComplete || ( KErrNone != err ) )
   146         {
   147         {
   147         // Only the syncron requests has to be completed here!
   148         // 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 
   172         }
   172         }
   173         
   173         
   174     // check for session-relative requests
   174     // check for session-relative requests
   175 	switch( aMessage.Function() )
   175 	switch( aMessage.Function() )
   176 		{
   176 		{
   177 	    case EHttpDownMgrNumOfSubSessions:
       
   178 	         {
       
   179 	         GetNumberOfSubsession();
       
   180 	         return;
       
   181 	         }
       
   182         case EHttpDownloadMgrInitialize:
   177         case EHttpDownloadMgrInitialize:
   183             {
   178             {
   184             InitializeL();
   179             InitializeL();
   185             return;
   180             return;
   186             }
   181             }
   315     {
   310     {
   316     return iCurrentMessage;
   311     return iCurrentMessage;
   317     }
   312     }
   318 
   313 
   319 // ---------------------------------------------------------
   314 // ---------------------------------------------------------
   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 // ---------------------------------------------------------
       
   338 // CDownloadMgrSession::InitializeL
   315 // CDownloadMgrSession::InitializeL
   339 // ---------------------------------------------------------
   316 // ---------------------------------------------------------
   340 //
   317 //
   341 void CDownloadMgrSession::InitializeL()
   318 void CDownloadMgrSession::InitializeL()
   342     {
   319     {
   353     // Check how many download we have and return it to the client
   330     // Check how many download we have and return it to the client
   354     CLOG_WRITE_FORMAT( "CDownloadMgrSession::InitializeL iClientAppInstance %d", iClientAppInstance );
   331     CLOG_WRITE_FORMAT( "CDownloadMgrSession::InitializeL iClientAppInstance %d", iClientAppInstance );
   355     CArrayPtrFlat<CHttpDownload>* currentDownloads = iClientAppInstance->DownloadsL();
   332     CArrayPtrFlat<CHttpDownload>* currentDownloads = iClientAppInstance->DownloadsL();
   356 	TPckg<TInt> countPckg( currentDownloads->Count() );
   333 	TPckg<TInt> countPckg( currentDownloads->Count() );
   357 	TPckg<TInt> sessionId( iSessionId );
   334 	TPckg<TInt> sessionId( iSessionId );
   358   if (!CurrentMessage().IsNull())
   335 
   359     Write( 1, CurrentMessage(), countPckg );
   336     Write( 1, CurrentMessage(), countPckg );
   360   if (!CurrentMessage().IsNull())
       
   361     Write( 3, CurrentMessage(), sessionId );
   337     Write( 3, CurrentMessage(), sessionId );
   362 
   338 
   363     CLOG_NAME_2( _L("Session_%x_%x"), uidPckg().iUid, iSessionId );
   339     CLOG_NAME_2( _L("Session_%x_%x"), uidPckg().iUid, iSessionId );
   364 
   340 
   365     currentDownloads->Reset();
   341     currentDownloads->Reset();