locationcentre/lcserver/inc/lcserver.h
changeset 0 522cd55cc3d7
equal deleted inserted replaced
-1:000000000000 0:522cd55cc3d7
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Location Centre Server object.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_LCSERVER_H
       
    20 #define C_LCSERVER_H
       
    21 
       
    22 // SYSTEM INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // USER INCLUDES
       
    26 #include "lcserverengineobserver.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CLcServerShutDownTimer;
       
    30 class CLcServerEngine;
       
    31 
       
    32 /**
       
    33  *  Location Centre server.
       
    34  *
       
    35  *  This class is inherited from CServer2 and not CPolicyServer. This is
       
    36  *  because there is no capability checking required for accessing the
       
    37  *  services offered by this server.
       
    38  *
       
    39  *  @since S60 v5.0
       
    40  */
       
    41 NONSHARABLE_CLASS( CLcServer ): public CServer2,
       
    42                                 public MLcServerEngineObserver
       
    43     {
       
    44 public:
       
    45     /**
       
    46      * Constructs a new instance of Location Centre server.
       
    47      *
       
    48      * @return The new instance of Location Centre server object.
       
    49      * @leave System wide error code if the object creation fails.         
       
    50      */
       
    51     static CLcServer* NewL();
       
    52     
       
    53     /**
       
    54      * Constructs a new instance of Location Centre server.
       
    55      * Leaves the created instance on the cleanup stack.
       
    56      *
       
    57      * @return The new instance of Location Centre server object.
       
    58      * @leave System wide error code if the object creation fails.         
       
    59      */
       
    60     static CLcServer* NewLC();        
       
    61 
       
    62     /**
       
    63      * C++ Destructor.
       
    64      * Frees all the resources associated with this Location Centre
       
    65      * server
       
    66      */
       
    67     virtual ~CLcServer();
       
    68     
       
    69     /**
       
    70      * Increments the number of Location centre sessions that are open.
       
    71      * 
       
    72      * This is generally done by the session objects once they have 
       
    73      * successfully completed their session initialization.
       
    74      */
       
    75     void IncrementSessions();
       
    76     
       
    77     /**
       
    78      * Decrements the number of Location centre sessions that are open.
       
    79      * 
       
    80      * This is generally done by the session objects in their
       
    81      * destrutors.
       
    82      */
       
    83     void DecrementSessions();
       
    84     
       
    85 
       
    86 public: // Inherited from the base classes
       
    87     /**
       
    88      * Inherited from CServer2
       
    89      *
       
    90      * @param aVersion The version number for the Location Centre server.
       
    91      * @param aMessage The connect message from the client.
       
    92      * @return Reference to the new session object.
       
    93      */
       
    94     CSession2* NewSessionL( const TVersion&     aVersion,
       
    95                             const RMessage2&    aMessage ) const;
       
    96      
       
    97     /**
       
    98      * Inherited from MLcServerEngineObserver
       
    99      */
       
   100     void LcRegistryUpdated();
       
   101     
       
   102 private:
       
   103     /**
       
   104      * C++ Default constructor
       
   105      */
       
   106     CLcServer();
       
   107     
       
   108     /**
       
   109      * Second phase of the two phase constructor
       
   110      */
       
   111     void ConstructL();
       
   112     
       
   113 private:
       
   114     /**
       
   115      * Shutdown timer.
       
   116      *
       
   117      * Used to shutdown the server if there are no outstanding connections
       
   118      * for a specified period of time.
       
   119      * Owns.
       
   120      */
       
   121     CLcServerShutDownTimer*         iShutDownTimer;
       
   122     
       
   123     /**
       
   124      * Number of Location centre server sessions.
       
   125      */
       
   126     TInt                            iNumberofSessions;
       
   127     
       
   128     /**
       
   129      * Location Centre Server Engine.
       
   130      *
       
   131      * Owns
       
   132      */
       
   133     CLcServerEngine*                iEngine;
       
   134     };
       
   135 
       
   136 #endif // C_LCSERVERSTARTUP_H