videoscheduler/SchedulerServer/inc/CCseSchedulerServer.h
branchRCL_3
changeset 22 826cea16efd9
parent 21 798ee5f1972c
child 23 13a33d82ad98
equal deleted inserted replaced
21:798ee5f1972c 22: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 Scheduler Server class*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CCSESCHEDULERSERVER_H
       
    21 #define __CCSESCHEDULERSERVER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include "CseSchedulerServer.pan"   // Panic codes
       
    26 
       
    27 // CONSTANTS
       
    28 #define KCseSchedulerMinHeapSize 2*KMinHeapSize
       
    29 #define KCseSchedulerMaxHeapSize 0x1F0000 
       
    30 
       
    31 // MACROS
       
    32 // None
       
    33 
       
    34 // DATA TYPES
       
    35 // None
       
    36 
       
    37 // FUNCTION PROTOTYPES
       
    38 // None
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 class CCseSchedulerServerEngine;
       
    42 
       
    43 // CLASS DECLARATION
       
    44 /**
       
    45 *  Server class
       
    46 *
       
    47 *  @lib CseSchedulerServer.exe
       
    48 */
       
    49 class CCseSchedulerServer : public CPolicyServer
       
    50     {
       
    51     public: // Constructors and destructor
       
    52         
       
    53         /**
       
    54         * Two-phased constructor.        
       
    55         */
       
    56          static CCseSchedulerServer* NewLC( );
       
    57         
       
    58         /**
       
    59         * Destructor.
       
    60         */
       
    61         virtual ~CCseSchedulerServer();
       
    62     
       
    63     public: // New functions
       
    64 
       
    65         /**
       
    66         * Thread function, creates cleanup stack for the thread.
       
    67         * @return KErrNone
       
    68         */
       
    69         static TInt ThreadFunction( );
       
    70         
       
    71         /**
       
    72         * Thread function, the active scheduler is installed and started.
       
    73         * @return None.
       
    74         */
       
    75         static void ThreadFunctionL( );
       
    76 
       
    77         /**
       
    78         * Panics server.
       
    79         * @param aPanic panic code.
       
    80         * @return None.
       
    81         */
       
    82         static void PanicServer( TCseSchedulerServPanic aPanic );
       
    83         
       
    84         /**
       
    85         * Starts the server thread.
       
    86         * @return None.
       
    87         */
       
    88         static TInt StartThread();
       
    89         
       
    90         /**
       
    91         * Dec
       
    92         * @return None.
       
    93         */
       
    94         void Dec();
       
    95         
       
    96         /**
       
    97         * Inc
       
    98         * @return None.
       
    99         */
       
   100         void Inc();
       
   101         
       
   102         /**
       
   103         * Create new Session.
       
   104         * @param aVersion server version number.
       
   105         * @return CSharableSession pointer to new created session.
       
   106         */
       
   107         CSession2* NewSessionL( const TVersion &aVersion,
       
   108                                 const RMessage2& aMessage ) const;
       
   109 
       
   110         /**
       
   111         * Gets engine object.
       
   112         * @return CCseSchedulerServerEngine pointer.
       
   113         */
       
   114         CCseSchedulerServerEngine* GetEngineObjectL();
       
   115 
       
   116 		/**
       
   117 		* Makes check if server is still needed (has schedules on run or active
       
   118 		* client), if not calls ActiveScheduler::Stop resulting server shutdown.
       
   119 		*/
       
   120 		void StopServer();
       
   121 
       
   122     protected: // Functions from base classes
       
   123 
       
   124         /**
       
   125         * From CPolicyServer, called by framework to perform 
       
   126         * custom security check for any client messages.
       
   127         * 
       
   128         * @param aMsg     Message.
       
   129         * @param aAction  Action.
       
   130         * @param aMissing Security info.
       
   131         * @return Result of security check.
       
   132         */
       
   133         TCustomResult CustomSecurityCheckL( const RMessage2 &aMsg, TInt &aAction, TSecurityInfo &aMissing );
       
   134 
       
   135 	    /**
       
   136 		* Starter callback used with CIdle. Used to break call stack.
       
   137 		* @param    aPtr    Pointer back to CCseSchedulerUserInformer-class
       
   138 		* @return   Always EFalse.
       
   139 		*/
       
   140 		static TInt StarterCallback( TAny* aPtr );
       
   141 	
       
   142 		/**
       
   143 		* Starter callback handler. Checks if server is actually needed (there
       
   144 		* is client or schedules to be run). If engine is not needed, signals
       
   145 		* server to be deleted.
       
   146 		* @return   Always EFalse
       
   147 		*/
       
   148 		TInt HandleStarterCallback();
       
   149 				
       
   150    
       
   151     private: // Constructors and destructor 
       
   152         
       
   153         /**
       
   154         * C++ default constructor.
       
   155         */
       
   156         CCseSchedulerServer();
       
   157 
       
   158         /**
       
   159         * By default Symbian 2nd phase constructor is private.
       
   160         */
       
   161         void ConstructL( );
       
   162     
       
   163     private: // New functions
       
   164 
       
   165         /**
       
   166         * Deletes scheduler engine.
       
   167         * @return None.
       
   168         */
       
   169         void DeleteSchedulerEngine();
       
   170 
       
   171         
       
   172     private: // Data    
       
   173         /**
       
   174         * Object container index. Own.
       
   175         */
       
   176         CObjectConIx* iContainerIx;
       
   177 
       
   178         /**
       
   179         * Object container. Own.
       
   180         */
       
   181         CObjectCon* iObjectCon;
       
   182         
       
   183         /**
       
   184         * Number of sessions
       
   185         */
       
   186         TInt iSessionCount;
       
   187 
       
   188         /**
       
   189         * Engine object. Own.
       
   190         */
       
   191         CCseSchedulerServerEngine* iSchedulerEngine;       
       
   192         
       
   193         /**
       
   194         * CIdle, used to break call stack when scheduler is started. Own.
       
   195         */ 
       
   196         CPeriodic* iStarterBreaker;
       
   197     };
       
   198 
       
   199 #endif // __CCSESCHEDULERSERVER_H
       
   200 
       
   201 // End of File