connectivitymodules/SeCon/services/pcd/src/sconpcd.cpp
branchRCL_3
changeset 18 453dfc402455
parent 0 d0791faffa3f
equal deleted inserted replaced
17:dbd1c5e08735 18:453dfc402455
    21 #include "sconpcd.h"
    21 #include "sconpcd.h"
    22 #include "sconpcdconsts.h"
    22 #include "sconpcdconsts.h"
    23 #include "sconinstqueue.h"
    23 #include "sconinstqueue.h"
    24 #include "sconbrqueue.h"
    24 #include "sconbrqueue.h"
    25 #include "sconmetadata.h"
    25 #include "sconmetadata.h"
       
    26 #include "sconsynchandler.h"
    26 #include "debug.h"
    27 #include "debug.h"
    27 
    28 
    28 // ============================= MEMBER FUNCTIONS ===============================
    29 // ============================= MEMBER FUNCTIONS ===============================
    29 
    30 
    30 
    31 
    86         CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    87         CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    87         CActiveScheduler::Install( scheduler );
    88         CActiveScheduler::Install( scheduler );
    88         }
    89         }
    89     CActiveScheduler::Add( iInstallerQueue );
    90     CActiveScheduler::Add( iInstallerQueue );
    90     CActiveScheduler::Add( iBackupRestoreQueue );
    91     CActiveScheduler::Add( iBackupRestoreQueue );
       
    92     iSyncHandler = CSconSyncHandler::NewL( iFs );
    91     TRACE_FUNC_EXIT;
    93     TRACE_FUNC_EXIT;
    92     }
    94     }
    93     
    95     
    94 // -----------------------------------------------------------------------------
    96 // -----------------------------------------------------------------------------
    95 // CSConPCD::~CSConPCD()
    97 // CSConPCD::~CSConPCD()
   117         {
   119         {
   118         delete iLatestReply;
   120         delete iLatestReply;
   119         iLatestReply = NULL;
   121         iLatestReply = NULL;
   120         }
   122         }
   121     
   123     
       
   124     if ( iSyncHandler )
       
   125         {
       
   126         iSyncHandler->Cancel();
       
   127         delete iSyncHandler;
       
   128         iSyncHandler = NULL;
       
   129         }
   122     iFs.Close();
   130     iFs.Close();
   123     TRACE_FUNC_EXIT;
   131     TRACE_FUNC_EXIT;
   124     }
   132     }
   125     
   133     
   126 // -----------------------------------------------------------------------------
   134 // -----------------------------------------------------------------------------
   253     if ( iBackupRestoreQueue )
   261     if ( iBackupRestoreQueue )
   254         {
   262         {
   255         LOGGER_WRITE( "CSConPCD::ResetPCD() : Reseting backup queue" );
   263         LOGGER_WRITE( "CSConPCD::ResetPCD() : Reseting backup queue" );
   256         iBackupRestoreQueue->Reset();
   264         iBackupRestoreQueue->Reset();
   257         }
   265         }
       
   266     
       
   267     TRACE_FUNC_EXIT;
       
   268     }
       
   269 
       
   270 // -----------------------------------------------------------------------------
       
   271 // CSConPCD::HandleGetSyncRequestL()
       
   272 // 
       
   273 // -----------------------------------------------------------------------------
       
   274 //
       
   275 void CSConPCD::HandleGetSyncRequestL( const TDesC8& aRequest, RWriteStream& aResult, TInt aMaxObjectSize )
       
   276     {
       
   277     TRACE_FUNC_ENTRY;
       
   278     iSyncHandler->HandleGetSyncRequestL( aRequest, aResult, aMaxObjectSize );
       
   279     
       
   280     TRACE_FUNC_EXIT;
       
   281     }
       
   282 
       
   283 // -----------------------------------------------------------------------------
       
   284 // CSConPCD::HandlePutSyncRequestL()
       
   285 // 
       
   286 // -----------------------------------------------------------------------------
       
   287 //
       
   288 void CSConPCD::HandlePutSyncRequestL( const TDesC8& aRequest, RReadStream& aResult )
       
   289     {
       
   290     TRACE_FUNC_ENTRY;
       
   291     iSyncHandler->HandlePutSyncRequestL( aRequest, aResult );
   258     
   292     
   259     TRACE_FUNC_EXIT;
   293     TRACE_FUNC_EXIT;
   260     }
   294     }
   261 
   295 
   262 // -----------------------------------------------------------------------------
   296 // -----------------------------------------------------------------------------
   419         mergeReply->iNoTasks = ETrue;
   453         mergeReply->iNoTasks = ETrue;
   420         }
   454         }
   421         
   455         
   422     for ( TInt i = 0; i < installerReply->iTasks.Count(); i++ )
   456     for ( TInt i = 0; i < installerReply->iTasks.Count(); i++ )
   423         {
   457         {
   424         mergeReply->iTasks.Append( installerReply->iTasks[i]->CopyAndFreeL() );
   458         CSConTaskReply* temp = installerReply->iTasks[i]->CopyAndFreeL();
       
   459         CleanupStack::PushL( temp );
       
   460         mergeReply->iTasks.AppendL( temp );
       
   461         CleanupStack::Pop( temp );
   425         }
   462         }
   426     
   463     
   427     // installer replys are copied to mergereply, delete installerReply
   464     // installer replys are copied to mergereply, delete installerReply
   428     CleanupStack::PopAndDestroy( installerReply );
   465     CleanupStack::PopAndDestroy( installerReply );
   429     
   466     
   430     // do same for br reply
   467     // do same for br reply
   431     for ( TInt j = 0; j < brReply->iTasks.Count(); j++ )
   468     for ( TInt i = 0; i < brReply->iTasks.Count(); i++ )
   432         {
   469         {
   433         mergeReply->iTasks.Append( brReply->iTasks[j]->CopyAndFreeL() );
   470         CSConTaskReply* temp = brReply->iTasks[i]->CopyAndFreeL();
       
   471         CleanupStack::PushL( temp );
       
   472         mergeReply->iTasks.AppendL( temp );
       
   473         CleanupStack::Pop( temp );
   434         }
   474         }
   435     
   475     
   436     CleanupStack::PopAndDestroy( brReply );
   476     CleanupStack::PopAndDestroy( brReply );
   437     
   477     
   438     CleanupStack::Pop( mergeReply );
   478     CleanupStack::Pop( mergeReply );