PECengine/PresenceServer2/ServerSrc/CPEngSession.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Presence Server session handler implementation
       
    15 *				 All clients request are handler here,
       
    16 *  				 or forwarded to the sub-session
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef __CPENGSESSION_H__
       
    22 #define __CPENGSESSION_H__
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32def.h>
       
    26 
       
    27 //  FORWARD DECLARATIONS
       
    28 class	MPEngServer;
       
    29 class	RPEngMessage;
       
    30 class	CPEngSubSession;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34  *  Presence Server session handler implementation
       
    35  *  All clients request are handler here,
       
    36  *  or forwarded to the sub-session
       
    37  *
       
    38  *  @lib PEngServer2
       
    39  *  @since 3.0
       
    40  */
       
    41 NONSHARABLE_CLASS(   CPEngSession ):
       
    42         public CSession2
       
    43     {
       
    44 public:		// Constructors and destructors
       
    45 
       
    46     /**
       
    47      * Two-phased constructor.
       
    48      * @param aServer server instance
       
    49      * @return instance of the session
       
    50      */
       
    51     static CPEngSession* NewL( MPEngServer& aServer );
       
    52 
       
    53     /**
       
    54      * Destructor.
       
    55      */
       
    56     virtual ~CPEngSession();
       
    57 
       
    58 public:		// Methods derived from CSession
       
    59 
       
    60     /**
       
    61      *  Service clients request
       
    62      *  @see <CSession2.h>
       
    63      *	@since 3.0
       
    64      *  @param aMessage message with request details
       
    65      */
       
    66     void ServiceL( const RMessage2 &aMessage );
       
    67 
       
    68     /**
       
    69      *  Handles the service error
       
    70      *	@since 3.0
       
    71      *  @see <CSession2.h>
       
    72      *  @param aMessage message with request details
       
    73      *  @param aError error
       
    74      */
       
    75     void ServiceError( const RMessage2& aMessage, TInt aError );
       
    76 
       
    77 private:	// New methods
       
    78 
       
    79     /**
       
    80      *  Dispatch clients message
       
    81      *
       
    82      *	@since 3.0
       
    83      *  @param aMessage clients message
       
    84      */
       
    85     TBool DispatchMessageL( const RPEngMessage& aMessage );
       
    86 
       
    87     /**
       
    88      *	Create new sub-session
       
    89      *
       
    90      *	@since 3.0
       
    91      *	@param aMessage clients message
       
    92      */
       
    93     void CreateNewSubSessionL( const RPEngMessage& aMessage );
       
    94 
       
    95     /**
       
    96      *	Remove sub-session
       
    97      *	@since 3.0
       
    98      *	@param	aHandle handle of the subsession
       
    99      */
       
   100     void RemoveSubSessionL( TUint  aHandle );
       
   101 
       
   102     /**
       
   103      *	Find Subsession
       
   104      *	@since 3.0
       
   105      *	@param	aHandle handle of the subsession to find
       
   106      *  @return sub-session instance
       
   107      */
       
   108     CPEngSubSession& FindSubSessionL( TUint  aHandle ) const;
       
   109 
       
   110 
       
   111     /*
       
   112      *	Panic client
       
   113      *	@since 3.0
       
   114      *  @param	aMessage clients message
       
   115      *  @param	aPanic panic reason
       
   116      */
       
   117     void PanicClient( const RPEngMessage& aMessage,
       
   118                       const TInt aPanic ) const;
       
   119 
       
   120 
       
   121 protected:	// Constructors and destructors
       
   122 
       
   123     /**
       
   124       * C++ default constructor.
       
   125       */
       
   126     CPEngSession( MPEngServer& aServer );// Default constructor, protected to allow derivation
       
   127 
       
   128     /**
       
   129      * By default Symbian 2nd phase constructor is private.
       
   130      */
       
   131     void ConstructL();
       
   132 
       
   133 private:	// Data
       
   134 
       
   135     /// OWN: Collection of the Sub Sessions
       
   136     CObjectIx*							iSubSessions;
       
   137 
       
   138     /// REF: server clas
       
   139     MPEngServer&						iMainServer;
       
   140     };
       
   141 
       
   142 #endif      //  __CPEngSession_H__