locationcentre/lcserver/inc/lcserversession.h
branchRCL_3
changeset 16 4721bd00d3da
parent 14 3a25f69541ff
child 21 e15b7f06eba6
equal deleted inserted replaced
14:3a25f69541ff 16:4721bd00d3da
     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 side session object.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_LCSERVERSESSION_H
       
    20 #define C_LCSERVERSESSION_H
       
    21 
       
    22 // SYSTEM INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CLcServer;
       
    27 class CLcServerEngine;
       
    28 
       
    29 /**
       
    30  *  Location Centre server side session object.
       
    31  *
       
    32  *  @since S60 v5.0
       
    33  */
       
    34 NONSHARABLE_CLASS( CLcServerSession ): public CSession2
       
    35     {
       
    36 public:
       
    37     /**
       
    38      * Constructs a new instance of Location Centre server side session object.
       
    39      *
       
    40      * @param[in] aLcServer         Reference to the server side object.
       
    41      * @param[in] aLcServerEngine   Reference to the Location Centre Server Engine.
       
    42      * @return The new instance of Location Centre server side session object.
       
    43      * @leave System wide error code if the object creation fails.         
       
    44      */
       
    45     static CLcServerSession* NewL( CLcServer&       aLcServer,
       
    46                                    CLcServerEngine& aLcServerEngine );
       
    47     
       
    48     /**
       
    49      * Constructs a new instance of Location Centre server side session object.
       
    50      * Leaves the created instance on the cleanup stack.
       
    51      *
       
    52      * @param[in] aLcServer         Reference to the server side object.
       
    53      * @param[in] aLcServerEngine   Reference to the Location Centre Server Engine. 
       
    54      * @return The new instance of Location Centre server side session object.
       
    55      * @leave System wide error code if the object creation fails.         
       
    56      */
       
    57     static CLcServerSession* NewLC( CLcServer&          aLcServer,
       
    58                                     CLcServerEngine&    aLcServerEngine );        
       
    59 
       
    60     /**
       
    61      * C++ Destructor.
       
    62      * Frees all the resources associated with this Location Centre
       
    63      * server side session object.
       
    64      */
       
    65     virtual ~CLcServerSession();
       
    66     
       
    67     /**
       
    68      * Notifies the Server session class that the Location Centre Registry has
       
    69      * been updated. This enables the session to notify the corresponding
       
    70      * Location Centre Client which is observing for these changes.
       
    71      */
       
    72     void RegistryUpdated();
       
    73 
       
    74 public: // Inherited from the base classes
       
    75     /**
       
    76      * Inherited from the CSession2 class
       
    77      *
       
    78      * Service handler for all messages that are directed to this session.
       
    79      */
       
    80     void ServiceL( const RMessage2& aMessage );
       
    81     
       
    82     /**
       
    83     * From CSession2
       
    84     *
       
    85     * Error function invoked when the ServiceL message leaves.
       
    86     */
       
    87     void ServiceError( const RMessage2& aMessage, 
       
    88                              TInt       aError );
       
    89             
       
    90 private:
       
    91     /**
       
    92      * C++ Default constructor
       
    93      *
       
    94      * @param aLcServer Reference to the server side object.     
       
    95      */
       
    96     CLcServerSession( CLcServer&        aLcServer,
       
    97                       CLcServerEngine&  aLcServerEngine );
       
    98     
       
    99     /**
       
   100      * Second phase of the two phase constructor
       
   101      */
       
   102     void ConstructL();
       
   103     
       
   104 private:
       
   105     /**
       
   106      * Reference to the Server side object.
       
   107      *
       
   108      * Required to notify the creation and destruction of a session
       
   109      * This is necessary to ensure that the server shut down when there
       
   110      * are no sessions outstanding.
       
   111      */
       
   112     CLcServer&                  iLcServer;
       
   113     
       
   114     /**
       
   115      * Boolean flag to indicate that this class has incremented the
       
   116      * number of sessions in the server. Hence, the need to decrement
       
   117      * the count on termination.
       
   118      */
       
   119     TBool                       iDecrementSession;
       
   120     
       
   121     /**
       
   122      * Reference to the Location Centre Server Engine.
       
   123      */
       
   124     CLcServerEngine&            iEngine;
       
   125    
       
   126     /**
       
   127      * Boolean value to indicate that a notification request is
       
   128      * outstanding.
       
   129      */
       
   130     TBool                       iNotificationOutStanding;
       
   131     
       
   132     TBool                       iNotifyPending;
       
   133      
       
   134     /**
       
   135      * RMessage2 object to notify the changes in Location Centre
       
   136      * registry.
       
   137      */
       
   138     RMessage2                  iObserverMessage;
       
   139    
       
   140     };
       
   141 
       
   142 #endif // C_LCSERVERSESSION_H