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