keepalive/flextimer/server/inc/flextimerserver.h
changeset 32 5c4486441ae6
equal deleted inserted replaced
31:c16e04725da3 32:5c4486441ae6
       
     1 /*
       
     2  * Copyright (c) 2010 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:
       
    15  * Class definition for Flexible timer server. Server creates session
       
    16  * objects and manages message passing to those.
       
    17  *
       
    18  */
       
    19 /*
       
    20  * %version: 1 %
       
    21  */
       
    22 // Protection against nested includes
       
    23 #ifndef FLEXTIMERSERVER_H
       
    24 #define FLEXTIMERSERVER_H
       
    25 
       
    26 // System includes
       
    27 #include <e32base.h>
       
    28 
       
    29 // Forward declarations
       
    30 class CFlexTimerEngine;
       
    31 
       
    32 // Class declaration
       
    33 /**
       
    34  *  Flexible timer server class implements the server for FlexTimers. This
       
    35  *  class provides services for creating new sessions, and for passing
       
    36  *  a client message to dedicated session.
       
    37  */
       
    38 class CFlexTimerServer : public CServer2
       
    39     {
       
    40     
       
    41 public:
       
    42     /**
       
    43      * Two phased constructor 
       
    44      * 
       
    45      * @param aPriority Active object priority for the server 
       
    46      * @return Pointer to created server object
       
    47      */
       
    48     IMPORT_C static CFlexTimerServer* NewL( CActive::TPriority aPriority );
       
    49 
       
    50     /**
       
    51      * Destructor 
       
    52      */
       
    53     virtual ~CFlexTimerServer();
       
    54 
       
    55 public:
       
    56 
       
    57     /**
       
    58      * From: CServer2
       
    59      * Function for creating a new session to this server. 
       
    60      *
       
    61      * @param aVersion Version identifier from client
       
    62      * @param aMessage Reference to creation message sent by client
       
    63      * @return Pointer to created session object
       
    64      */
       
    65     CSession2* NewSessionL( const TVersion& aVersion,
       
    66                             const RMessage2& aMessage ) const;
       
    67 
       
    68     /**
       
    69      * Function for creating server thread resources. Creates the server
       
    70      * object and active scheduler. Loops in the active scheduler to serve
       
    71      * client requests until explicitly shutdown. Function leaves if the
       
    72      * creation of needed resources fails.
       
    73      */
       
    74     static void StartServerL();
       
    75 
       
    76 private:
       
    77 
       
    78     /**
       
    79      * Constructor
       
    80      * 
       
    81      * @param aPriority Active object priority 
       
    82      */
       
    83     CFlexTimerServer( CActive::TPriority aPriority );
       
    84 
       
    85     /**
       
    86      * 2nd phase constructor, creates CFlexTimerEngine
       
    87      */
       
    88     void ConstructL();
       
    89 
       
    90 private:
       
    91 
       
    92     /**
       
    93      * Pointer to FlexTimerEngine created during server start-up
       
    94      */
       
    95     CFlexTimerEngine* iTimerEngine;
       
    96 
       
    97     };
       
    98 
       
    99 #endif /* FLEXTIMERSERVER_H */