connectivitymodules/SeCon/services/pcd/src/sconbrqueue.cpp
changeset 20 e1de7d03f843
parent 19 2691f6aa1921
child 26 fdc38da86094
equal deleted inserted replaced
19:2691f6aa1921 20:e1de7d03f843
    28 // Two-phase constructor
    28 // Two-phase constructor
    29 // -----------------------------------------------------------------------------
    29 // -----------------------------------------------------------------------------
    30 //
    30 //
    31 CSConBackupRestoreQueue* CSConBackupRestoreQueue::NewL( const TInt aMaxObjectSize, RFs& aFs )
    31 CSConBackupRestoreQueue* CSConBackupRestoreQueue::NewL( const TInt aMaxObjectSize, RFs& aFs )
    32 	{
    32 	{
       
    33 	TRACE_FUNC_ENTRY;
    33 	CSConBackupRestoreQueue* self = new (ELeave) CSConBackupRestoreQueue();
    34 	CSConBackupRestoreQueue* self = new (ELeave) CSConBackupRestoreQueue();
    34 	CleanupStack::PushL( self );
    35 	CleanupStack::PushL( self );
    35 	self->ConstructL( aMaxObjectSize, aFs );
    36 	self->ConstructL( aMaxObjectSize, aFs );
    36 	CleanupStack::Pop( self );
    37 	CleanupStack::Pop( self );
       
    38 	TRACE_FUNC_EXIT;
    37     return self;
    39     return self;
    38 	}
    40 	}
    39 	
    41 	
    40 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    41 // CSConBackupRestoreQueue::CSConBackupRestoreQueue()
    43 // CSConBackupRestoreQueue::CSConBackupRestoreQueue()
    52 // Initializes member data
    54 // Initializes member data
    53 // -----------------------------------------------------------------------------
    55 // -----------------------------------------------------------------------------
    54 //
    56 //
    55 void CSConBackupRestoreQueue::ConstructL( const TInt aMaxObjectSize, RFs& aFs )
    57 void CSConBackupRestoreQueue::ConstructL( const TInt aMaxObjectSize, RFs& aFs )
    56 	{
    58 	{
       
    59 	TRACE_FUNC_ENTRY;
    57 	iBackupRestore = CSConBackupRestore::NewL( this, aMaxObjectSize, aFs );
    60 	iBackupRestore = CSConBackupRestore::NewL( this, aMaxObjectSize, aFs );
    58 	CActiveScheduler::Add( iBackupRestore );
    61 	CActiveScheduler::Add( iBackupRestore );
    59 	User::LeaveIfError( iTimer.CreateLocal() );
    62 	User::LeaveIfError( iTimer.CreateLocal() );
       
    63 	TRACE_FUNC_EXIT;
    60 	}
    64 	}
    61 	
    65 	
    62 // -----------------------------------------------------------------------------
    66 // -----------------------------------------------------------------------------
    63 // CSConBackupRestoreQueue::~CSConBackupRestoreQueue()
    67 // CSConBackupRestoreQueue::~CSConBackupRestoreQueue()
    64 // Destructor
    68 // Destructor
    82 // Starts queue polling
    86 // Starts queue polling
    83 // -----------------------------------------------------------------------------
    87 // -----------------------------------------------------------------------------
    84 //
    88 //
    85 void CSConBackupRestoreQueue::StartQueue()	
    89 void CSConBackupRestoreQueue::StartQueue()	
    86 	{
    90 	{
       
    91 	TRACE_FUNC_ENTRY;
    87 	if( IsActive() )
    92 	if( IsActive() )
    88 		{
    93 		{
    89 		Cancel();
    94 		Cancel();
    90 		}
    95 		}
    91 		
    96 		
    92 	iTimer.After( iStatus, KSConTimerValue );
    97 	iTimer.After( iStatus, KSConTimerValue );
    93 	SetActive();
    98 	SetActive();
       
    99 	TRACE_FUNC_EXIT;
    94 	}
   100 	}
    95 	
   101 	
    96 // -----------------------------------------------------------------------------
   102 // -----------------------------------------------------------------------------
    97 // CSConBackupRestoreQueue::StopQueue()
   103 // CSConBackupRestoreQueue::StopQueue()
    98 // Stops queue polling
   104 // Stops queue polling
    99 // -----------------------------------------------------------------------------
   105 // -----------------------------------------------------------------------------
   100 //
   106 //
   101 void CSConBackupRestoreQueue::StopQueue()	
   107 void CSConBackupRestoreQueue::StopQueue()	
   102 	{
   108 	{
       
   109 	TRACE_FUNC_ENTRY;
   103 	iTimer.Cancel();
   110 	iTimer.Cancel();
       
   111 	TRACE_FUNC_EXIT;
   104 	}
   112 	}
   105 
   113 
   106 // -----------------------------------------------------------------------------
   114 // -----------------------------------------------------------------------------
   107 // CSConBackupRestoreQueue::AddNewTask( CSConTask*& aNewTask, TInt aTaskId )
   115 // CSConBackupRestoreQueue::AddNewTask( CSConTask*& aNewTask, TInt aTaskId )
   108 // Adds a new task to queue
   116 // Adds a new task to queue
   129 		{
   137 		{
   130 		StartQueue();
   138 		StartQueue();
   131 		}
   139 		}
   132 
   140 
   133 	ret = iQueue.InsertInOrder( aNewTask, CSConTaskQueue::Compare );
   141 	ret = iQueue.InsertInOrder( aNewTask, CSConTaskQueue::Compare );
       
   142 	LOGGER_WRITE_1( "CSConBackupRestoreQueue::AddNewTask() : returned %d", ret );
   134 	return ret;
   143 	return ret;
   135 	}
   144 	}
   136 
   145 
   137 // -----------------------------------------------------------------------------
   146 // -----------------------------------------------------------------------------
   138 // CSConBackupRestoreQueue::CancelTask( TInt aTask, TBool aAllTasks )
   147 // CSConBackupRestoreQueue::CancelTask( TInt aTask, TBool aAllTasks )
   178 // An address pointer to another queue
   187 // An address pointer to another queue
   179 // -----------------------------------------------------------------------------
   188 // -----------------------------------------------------------------------------
   180 //
   189 //
   181 void CSConBackupRestoreQueue::QueueAddress( CSConInstallerQueue*& aTaskQueue )
   190 void CSConBackupRestoreQueue::QueueAddress( CSConInstallerQueue*& aTaskQueue )
   182 	{
   191 	{
       
   192 	TRACE_FUNC;
   183 	iInstQueueAddress = aTaskQueue;
   193 	iInstQueueAddress = aTaskQueue;
   184 	}
   194 	}
   185 
   195 
   186 // -----------------------------------------------------------------------------
   196 // -----------------------------------------------------------------------------
   187 // CSConBackupRestoreQueue::GetTaskMethod( TInt& aTaskId )
   197 // CSConBackupRestoreQueue::GetTaskMethod( TInt& aTaskId )
   241 // Entry to CSConPCD
   251 // Entry to CSConPCD
   242 // -----------------------------------------------------------------------------
   252 // -----------------------------------------------------------------------------
   243 //
   253 //
   244 void CSConBackupRestoreQueue::RunL()
   254 void CSConBackupRestoreQueue::RunL()
   245 	{
   255 	{
       
   256 	TRACE_FUNC_ENTRY;
       
   257 	LOGGER_WRITE_1( "There are still %d tasks in this queue", iQueue.Count() );
   246 	if( iQueue.Count() > 0 )
   258 	if( iQueue.Count() > 0 )
   247 		{
   259 		{
   248 		PollQueue();
   260 		PollQueue();
   249 		StartQueue();
   261 		StartQueue();
   250 		}
   262 		}
       
   263 	TRACE_FUNC_EXIT;
   251 	}
   264 	}
   252 
   265 
   253 // End of file
   266 // End of file