videoscheduler/SchedulerServer/inc/CCseSchedulerPluginControllerBase.h
branchRCL_3
changeset 47 826cea16efd9
parent 45 798ee5f1972c
child 48 13a33d82ad98
equal deleted inserted replaced
45:798ee5f1972c 47:826cea16efd9
     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 PluginControllerBase-class*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CCSESCHEDULERPLUGINCONTROLLERBASE_H
       
    21 #define __CCSESCHEDULERPLUGINCONTROLLERBASE_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <ipvideo/MCsePluginObserver.h>
       
    26 #include <ipvideo/MCseScheduleObserver.h>
       
    27 #include "MCseSchedulerTimerObserver.h"
       
    28 #include "MCsePluginControllerObserver.h"
       
    29 
       
    30 // CONSTANTS
       
    31 // None
       
    32 
       
    33 // MACROS
       
    34 // None
       
    35 
       
    36 // DATA TYPES
       
    37 // None
       
    38 
       
    39 // FUNCTION PROTOTYPES
       
    40 // None
       
    41 
       
    42 // FORWARD DECLARATIONS
       
    43 // None
       
    44 
       
    45 // CLASS DECLARATION
       
    46 class CCseScheduledProgram;
       
    47 class CCseSchedulerTimer;
       
    48 class CCseSchedulerServerEngine;
       
    49 
       
    50 /**
       
    51 * Base class for plugin controllers. Handles all plugin related stuff except scheduling logic.
       
    52 */
       
    53 class CCseSchedulerPluginControllerBase : public CBase,                                          
       
    54                                           public MCseScheduleObserver,
       
    55                                           public MCseSchedulerTimerObserver
       
    56     {
       
    57     public: // Constructors and destructor
       
    58         /**
       
    59         * Two-phased constructor.
       
    60         * @params aEngine reference to engine
       
    61         * @params aPluginUid plugin uid of the plugin this plugin controller is made for
       
    62         * @return CCseSchedulerPluginControllerBase pointer to CCseSchedulerPluginControllerBase class
       
    63         */
       
    64         static CCseSchedulerPluginControllerBase* NewL( MCsePluginControllerObserver& aEngine, TInt32 aPluginUid );
       
    65 
       
    66         /**
       
    67         * Destructor.
       
    68         */
       
    69         virtual ~CCseSchedulerPluginControllerBase();
       
    70 
       
    71     protected:
       
    72         /**
       
    73         * C++ default constructor.
       
    74         */
       
    75         CCseSchedulerPluginControllerBase( MCsePluginControllerObserver& aEngine, TInt32 aPluginUid );
       
    76         
       
    77         /**
       
    78         * By default Symbian 2nd phase constructor is private.
       
    79         */
       
    80         void ConstructL();           
       
    81     
       
    82     public: // from MCseScheduleObserver-class     
       
    83         /**
       
    84         * Plugins uses this method to inform common scheduler engine that
       
    85         * schedule is handled.
       
    86 		* @param aDbIdentifier DbIdentifier of scheduled program that just
       
    87 		*                      has been processed.
       
    88         */
       
    89         virtual void ScheduleCompletedL( const TUint32 aDbIdentifier, TInt aCompletitionCode );
       
    90 
       
    91     public: // from MCseSchedulerTimerObserver-class        
       
    92         /**
       
    93         * Plugins uses this method to inform common scheduler engine that
       
    94         * schedule is handled.
       
    95 		* @param aDbIdentifier DbIdentifier of scheduled program that just
       
    96 		*                      has been processed.
       
    97         */
       
    98         virtual void TimerErrorL( const TInt32 aError );
       
    99         
       
   100         /**
       
   101         * Timer is up, run the Plugins!!!
       
   102         */
       
   103         virtual void RunPluginsL( );
       
   104 
       
   105     public: // New methods
       
   106     
       
   107         /**
       
   108          * Sets plugin to be cleared after callstack break.
       
   109          * @param aToBeCleared ETrue if controller needs to be cleared.
       
   110          */
       
   111         void SetToBeCleared( TBool aToBeCleared );
       
   112         
       
   113         /**
       
   114          * Clears controller: clears (takes down all threads running for the plugin)
       
   115          * all landlords. 
       
   116          */
       
   117         virtual void ClearControllerL();
       
   118         
       
   119         /**
       
   120         * Cleans the controller from LandLord(s) that aren't needed anymore.
       
   121         */
       
   122         virtual void DoCleanUp( );
       
   123      
       
   124         /**
       
   125         * Sets schedules to controller. More precise information is found from Uni and Multi
       
   126         * controller classes.
       
   127         * @params aScheduleArrat    Array of schedules to be set into controller. All given
       
   128         *                           schedules should have same start time.
       
   129         */
       
   130         virtual void SetSchedulesL( RPointerArray<CCseScheduledProgram>& aScheduleArray );
       
   131                 
       
   132         /**
       
   133         * Gets plugin id. This Uid of the plugin going to be run when time is right. Can be
       
   134         * used, for example, to find right kind of controller to a schedule.
       
   135         * @return plugin Uid of the plugin used to run the schedule.
       
   136         */
       
   137         TInt32 PluginUid( );        
       
   138         
       
   139         /**
       
   140         * Checks if the plugin is obsolete (There are no more schedules to be run).
       
   141         * @return ETrue if obsolete, EFalse if not.
       
   142         */
       
   143         TBool IsObsolete() const;
       
   144 
       
   145         /**
       
   146         * Checks if the plugin is set to be cleared.
       
   147         * @return ETrue if set, EFalse if not.
       
   148         */
       
   149         TBool IsToBeCleared();
       
   150         
       
   151         /**
       
   152         * Checks if there are active plugins in controller.
       
   153         * @return ETrue if active plugins found, EFalse otherwise
       
   154         */
       
   155         virtual TBool IsControllerActive();
       
   156         
       
   157     protected: //data        
       
   158         /**
       
   159         * Array containing schedules to be run. Own.
       
   160         */
       
   161         RPointerArray<CCseScheduledProgram> iScheduleArray;
       
   162         
       
   163          /**
       
   164         * Timer class. Own.
       
   165         */
       
   166         CCseSchedulerTimer* iTimer;
       
   167         
       
   168         /**
       
   169         * Reference to engine
       
   170         */
       
   171         MCsePluginControllerObserver& iEngine;
       
   172         
       
   173         /**
       
   174         * Uid of the plugin contrelled by this controller.
       
   175         */        
       
   176         TInt32 iPluginUid;
       
   177         
       
   178         /**
       
   179         * Boolean indicating if this plugin controller is to cleared
       
   180         * (plugin running is deleted).
       
   181         */        
       
   182         TBool iToBeCleared;
       
   183     };
       
   184     
       
   185 #endif // __CCSESCHEDULERPLUGINCONTROLLERBASE_H