videoscheduler/SchedulerServer/inc/CCseSchedulerPluginStarter.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 for PluginStarter-class*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef __CCSESCHEDULERPLUGINSTARTER_H
       
    20 #define __CCSESCHEDULERPLUGINSTARTER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <ipvideo/MCsePluginObserver.h>
       
    25 #include "MCseSemaphoreSignalObserver.h"
       
    26 
       
    27 // CONSTANTS
       
    28 // None
       
    29 
       
    30 // MACROS
       
    31 // None
       
    32 
       
    33 // DATA TYPES
       
    34 // None
       
    35 
       
    36 // FUNCTION PROTOTYPES
       
    37 // None
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 // None
       
    41 
       
    42 // CLASS DECLARATION
       
    43 class CCseSchedulerThreadPacket;
       
    44 class CCseSchedulerPluginIF;
       
    45 class CCseSchedulerLandLord;
       
    46 class CCseSemaphoreController;
       
    47 
       
    48 /**
       
    49 * Handles running and shutting down one plugin. Runs in seperate thread than rest of the SchedulerEngine
       
    50 */
       
    51 class CCseSchedulerPluginStarter : public CBase,
       
    52                                    public MCseSemaphoreSignalObserver,
       
    53                                    public MCsePluginObserver
       
    54     {
       
    55     public: // Constructors and destructor
       
    56         /**
       
    57         * Two-phased constructor.
       
    58         * @param    aThreadPacket   Thread packet containing all the needed information to plugin
       
    59         *                           to be run.
       
    60         * @return CCseSchedulerPluginStarter pointer to CCseSchedulerPluginStarter class
       
    61         */
       
    62         static CCseSchedulerPluginStarter* NewL( CCseSchedulerThreadPacket* aThreadPacket );
       
    63 
       
    64         /**
       
    65         * Destructor.
       
    66         */
       
    67         virtual ~CCseSchedulerPluginStarter();
       
    68         
       
    69     public: // from MCsePluginObserver-class
       
    70         void PluginCompleted( TInt aCompletitionValue );
       
    71         
       
    72     public: // from MCseSemaphoreSignalObserver-class
       
    73         void SemaphoreSignalled( );        
       
    74         
       
    75     public: // New methods
       
    76         /**
       
    77         * Creates plugin and runs schedule in it.
       
    78         * @param    aParam    Any pointer that actually holds CCseThreadPacket
       
    79         * @return   KErrNone if succesful, otherwise common Symbian error codes.
       
    80         */
       
    81         static TInt StartThread( TAny* aParam );
       
    82 
       
    83     private: // Constructors and destructor
       
    84         /**
       
    85         * C++ default constructor.
       
    86         */
       
    87         CCseSchedulerPluginStarter( CCseSchedulerThreadPacket* aThreadPacket );
       
    88 
       
    89         /**
       
    90         * By default Symbian 2nd phase constructor is private.
       
    91         */
       
    92         void ConstructL();
       
    93         
       
    94     private:  // New methods
       
    95 		/**
       
    96         * Called from actual StartThread. Creates CCseSchedulerPluginStarter.
       
    97         * @param    aParam    Any pointer that actually holds CCseThreadPacket        
       
    98         */
       
    99         static void DoStartThreadL( TAny* aParam );        
       
   100         
       
   101         /**
       
   102         * Creates plugin based on schedule and runs schedule in it.
       
   103         */
       
   104         void RunPluginL( );
       
   105         
       
   106         /**
       
   107 		* Plugin complete callback used with CIdle. Used to break call stack.
       
   108 		* @param    aPtr    Pointer back to CCseSchedulerPluginStarter-class
       
   109 		* @return   Always  EFalse.
       
   110 		*/
       
   111 		static TInt PluginCompleteCallback( TAny* aPtr );
       
   112 
       
   113 		/**
       
   114 		* Plugin complete callback handler. Stops active scheduler, sets completition value
       
   115 		* and runs down the plugin.		
       
   116 		* @return   Always EFalse
       
   117 		*/
       
   118 		TInt HandlePluginCompleteCallback();
       
   119         
       
   120    private:  // Data
       
   121         /**
       
   122         * Thread packet. Includes all needed information for plugin and the completiotion value.
       
   123         * Own.
       
   124         */
       
   125         CCseSchedulerThreadPacket* iThreadPacket;
       
   126         
       
   127         /**
       
   128         * Plugin in run. Own.
       
   129         */
       
   130         CCseSchedulerPluginIF* iPlugin;
       
   131         
       
   132         /**
       
   133         * CIdle, used to break call stack when plugin completes. Own.
       
   134         */ 
       
   135         CIdle* iCompletitionBreaker;
       
   136         
       
   137         /**
       
   138         * Bool flagging if plugin is wanted to be shot down
       
   139         */ 
       
   140         TBool iPluginRdyToTakedown;
       
   141         
       
   142         /**
       
   143         * Semaphore monitor. Check once a while if shutdown semaphore is signalled.
       
   144         */ 
       
   145         CCseSemaphoreController* iSemaphoreMonitor;
       
   146     };
       
   147     
       
   148 #endif // __CCSESCHEDULERPLUGINSTARTER_H