videoscheduler/SchedulerServer/inc/CCseSchedulerThreadPacket.h
changeset 50 557e19da7faf
parent 43 0a57f2fb63b1
child 52 0c0f95df01f4
equal deleted inserted replaced
43:0a57f2fb63b1 50:557e19da7faf
     1 /*
       
     2 * Copyright (c) 2006 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 the License "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:    Header file for CCseSchedulerThreadPacket-class.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef _CCSESCHEDULERTHREADPACKET_H
       
    20 #define _CCSESCHEDULERTHREADPACKET_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // CONSTANTS
       
    26 // None
       
    27 // MACROS
       
    28 // None
       
    29 
       
    30 // DATA TYPES
       
    31 // None
       
    32 
       
    33 // FUNCTION PROTOTYPES
       
    34 // None
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CCseScheduledProgram;
       
    38 
       
    39 /**
       
    40 * Class holding CCseScheduledProgram and ThreadResultCode. This is given to
       
    41 * separate plugin thread and should not be accessed before thread dies.
       
    42 */
       
    43 class CCseSchedulerThreadPacket : public CBase
       
    44 {
       
    45 	public:	// Constructors and destructors
       
    46 		/**
       
    47         * Destructor.
       
    48         */
       
    49 		virtual ~CCseSchedulerThreadPacket();
       
    50 		
       
    51 		/**
       
    52         * Two-phased constructor.
       
    53         * @param    aObserver   A pointer back to server engine through observer
       
    54         */
       
    55 		static CCseSchedulerThreadPacket* NewL(  );
       
    56 
       
    57 	private: // Constructors and destructors
       
    58 	 	/**
       
    59         * By default Symbian 2nd phase constructor is private.
       
    60         */
       
    61 		void ConstructL();
       
    62 		
       
    63 		/**
       
    64         * C++ default constructor.
       
    65 		* @param    aObserver   A pointer back to server engine through observer.
       
    66         */
       
    67 		CCseSchedulerThreadPacket(  );	
       
    68 		
       
    69     public: // New methods
       
    70         /**
       
    71         * Sets schedule to thread packet. Overwrites existing one.
       
    72         * @param    aData   Scheduled program to be set        
       
    73         */
       
    74         void SetScheduleL( CCseScheduledProgram& aData );
       
    75         
       
    76         /**
       
    77         * Gets schedule from thread packet.
       
    78         * @return   Pointer to scheduled program.
       
    79         */
       
    80         CCseScheduledProgram* Schedule( );
       
    81         
       
    82         /**
       
    83         * Sets threads result code. Should be set before thread completes.
       
    84         * Defaults to KErrGeneral.
       
    85         * @param    aResultCode   New result code. Overwrites existing one.
       
    86         */
       
    87         void SetResultCode( TInt32 aResultCode);
       
    88         
       
    89         /**
       
    90         * Gets threads result code. 
       
    91         * @return Threads result code. Defaulted to KErrGeneral if not set.
       
    92         */
       
    93         TInt32 ResultCode( );
       
    94         
       
    95         /**
       
    96         * Sets semaphore used to signal plugin shutdown request.
       
    97         * @param    aSemaphore   Semaphore used to signal shutdown
       
    98         */
       
    99         void SetShutdownSemaphore( RSemaphore& aSemaphore );
       
   100         
       
   101         /**
       
   102         * Sets semaphore used to signal when plugin shutdown has completed.
       
   103         * @param    aSemaphore   Semaphore used to signal shutdown
       
   104         */
       
   105         void SetShutdownCompleteSemaphore( RSemaphore& aSemaphore );
       
   106         
       
   107         /**
       
   108         * Gets semaphore used to signal plugin shutdown request.
       
   109         * @return RSemaphore Semaphore used to signal plugin shutdown request.
       
   110         */
       
   111         RSemaphore& ShutdownSemaphore();
       
   112         
       
   113         /**
       
   114         * Gets semaphore used to signal when plugin shutdown has completed.
       
   115         * @return RSemaphore Semaphore used to signal when plugin shutdown has completed.
       
   116         */
       
   117         RSemaphore& ShutdownCompleteSemaphore();
       
   118 		
       
   119 	private: // Data
       
   120 	    /**
       
   121 	    * Scheduled program to be run in the plugin thread. Own.
       
   122 	    */
       
   123 		CCseScheduledProgram* iSchedule;
       
   124 		
       
   125 		/**
       
   126 	    * Plugin completition code after the thread dies.
       
   127 	    */
       
   128 		TInt32                iResultCode;
       
   129 		
       
   130 		/**
       
   131 	    * Semaphore signalled when plugin shutdown is wanted while plugin is running.
       
   132 	    */
       
   133 		RSemaphore            iShutdownSemaphore;
       
   134 		
       
   135 		/**
       
   136 	    * Semaphore signalled when plugin shutdown is completed.
       
   137 	    */
       
   138 		RSemaphore            iShutdownCompleteSemaphore;
       
   139 };
       
   140 
       
   141 #endif //_CCSESCHEDULERTHREADPACKET_H