connectivitymodules/SeCon/services/pcd/inc/sconqueue.h
branchRCL_3
changeset 19 0aa8cc770c8a
parent 18 453dfc402455
child 20 4a793f564d72
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
     1 /*
       
     2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Queue header file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _SCONQUEUE_H_
       
    20 #define _SCONQUEUE_H_
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <e32cons.h>
       
    26 
       
    27 #include "sconconmltask.h"
       
    28 
       
    29 class CSConAppInstaller;
       
    30 class CSConBackupRestore;
       
    31 class CSConInstallerQueue;
       
    32 class CSConBackupRestoreQueue;
       
    33 
       
    34 //============================================================
       
    35 // Class CSConTaskQueue declaration
       
    36 //============================================================	
       
    37 NONSHARABLE_CLASS ( CSConTaskQueue )
       
    38 	{
       
    39 	public:
       
    40 		/**
       
    41 		 * Destructor
       
    42 		 * @return none
       
    43 		 */
       
    44 		virtual ~CSConTaskQueue();
       
    45 		/**
       
    46 		 * Returns the status of a specified task / all tasks
       
    47 		 * @param aTask The task number
       
    48 		 * @param aAllTasks If ETrue => Receive status of all tasks
       
    49 		 * @param aStatus The reply
       
    50     	 * @return none
       
    51 		 */
       
    52 		virtual void GetQueueStatusL( TInt aTask, TBool aAllTasks, 
       
    53 									CSConStatusReply*& aStatus );
       
    54 		/**
       
    55 		 * Adds a new task to queue
       
    56 		 * @param aNewTask A new task to be added
       
    57 		 * @param aTaskId The task number
       
    58     	 * @return KErrNone if no errors, else system wide error codes
       
    59 		 */
       
    60 		virtual TInt AddNewTask( CSConTask*& aNewTask, TInt aTaskId );
       
    61 		/**
       
    62 		 * Set the task to completed -mode
       
    63 		 * @param aTask The task number
       
    64 		 * @param aError The task error code
       
    65     	 * @return none
       
    66 		 */
       
    67 		virtual void CompleteTask( TInt aTask, TInt aError );
       
    68 		/**
       
    69 		 * Set the task progress value
       
    70 		 * @param aTask The task number
       
    71 		 * @param aProgressValue The progress value
       
    72     	 * @return none
       
    73 		 */
       
    74 		virtual void SetTaskProgress( TInt aTask, TInt aProgressValue );
       
    75 		/**
       
    76 		 * Receives a specified task
       
    77 		 * @param aTaskId The task number
       
    78 		 * @param aTask The address to the task
       
    79     	 * @return KErrNone if no errors, else system wide error codes
       
    80 		 */
       
    81 		virtual TInt GetTask( TInt aTaskId, CSConTask*& aTask );
       
    82 		/**
       
    83 		 * Removes a task from the queue
       
    84 		 * @param aTask The task number
       
    85     	 * @return none
       
    86 		 */
       
    87 		virtual void RemoveTask( TInt aTask );	
       
    88 		/**
       
    89 		 * Cancels a task
       
    90 		 * @param aTask The task number
       
    91 		 * @param aAllTasks If ETrue => cancel all tasks
       
    92     	 * @return none
       
    93 		 */	
       
    94 		virtual void CancelTask( TInt aTask, TBool aAllTasks );
       
    95 		/**
       
    96 		 * The status of the process
       
    97     	 * @return ETrue if process active, else EFalse
       
    98 		 */
       
    99 		virtual TBool QueueProcessActive() const;
       
   100 		/**
       
   101 		 * Changes the status of the queue process
       
   102     	 * @return none
       
   103 		 */
       
   104 		virtual void ChangeQueueProcessStatus();
       
   105 		/**
       
   106 		 * Resets the queue
       
   107     	 * @return none
       
   108 		 */
       
   109 		virtual void Reset();		
       
   110 		/**
       
   111 		 * Compares task numbers
       
   112 		 * @param aFirst The first task
       
   113 		 * @param aSecon The second task
       
   114     	 * @return -1 if the first task number is smaller than the second, 
       
   115     	 * 1 the first task number is greater than the second, 0 if task 
       
   116     	 * numbers are equal
       
   117 		 */
       
   118 		static TInt Compare( const CSConTask& aFirst, 
       
   119 							 const CSConTask& aSecond );
       
   120 		/**
       
   121 		 * Matches the task numbers
       
   122 		 * @param aFirst The first task
       
   123 		 * @param aSecon The second task
       
   124     	 * @return ETrue if task numbers match, else EFalse
       
   125 		 */
       
   126 		static TBool Match( const CSConTask& aFirst, 
       
   127 							const CSConTask& aSecond );
       
   128 		
       
   129 	private:
       
   130 		/**
       
   131 		 * Pure virtual function for starting the queue observation
       
   132 		 * @return none
       
   133 		 */
       
   134 		virtual void StartQueue() = 0;
       
   135 		/**
       
   136 		 * Pure virtual function for stoping the queue observation
       
   137 		 * @return none
       
   138 		 */
       
   139 		virtual void StopQueue() = 0;
       
   140 		/**
       
   141 		 * Pure virtual function for polling the queue
       
   142 		 * @return none
       
   143 		 */
       
   144 		virtual void PollQueue() = 0;
       
   145 		
       
   146 	protected:
       
   147 		RPointerArray<CSConTask>	iQueue;
       
   148 		RTimer 						iTimer;
       
   149 		TBool						iQueueProcessActive;
       
   150 	};
       
   151 	
       
   152 #endif
       
   153 
       
   154 // End of file