cbs/CbsServer/ServerInc/CCbsSession.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2003 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:  This file contains the header file of the CCbsRecCollector class.
       
    15 *    
       
    16 *                CCbsSession class represents a server-side CbsClient/CbsMcnClient session.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef     CCBSSESSION_H
       
    23 #define     CCBSSESSION_H
       
    24 
       
    25 // INCLUDES
       
    26 #include <e32base.h>
       
    27 #include "CbsCommon.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CCbsServer;
       
    31 class CCbsObject;
       
    32 class CObjectConIx;
       
    33 
       
    34 //  CLASS DECLARATION 
       
    35 
       
    36 /**
       
    37 *   This class represents a server-side session.
       
    38 *
       
    39 *   The instances of the class are responsible of handling 
       
    40 *   the requests of client-side RCbs and RCbsMcnSession objects.
       
    41 *
       
    42 *   This class contains handlers for opening subsessions and
       
    43 *   retrieving some general CBS information.
       
    44 *
       
    45 *   Client will be panicked, if a request is invalid.
       
    46 */
       
    47 class   CCbsSession : public CSession2
       
    48     {
       
    49     public:     // New functions
       
    50         /**
       
    51         *   Creates a new instance of the class.
       
    52         *
       
    53         *   @param  aServer         Server
       
    54         *   @return                 New CCbsSession instance
       
    55         */
       
    56         static CSession2* NewL( CCbsServer& aServer );
       
    57 
       
    58         /**
       
    59         *   Destructor.
       
    60         */
       
    61         ~CCbsSession();
       
    62 
       
    63         /**
       
    64         *   Finds the appropriate message service method and calls it to 
       
    65         *   handle the request.
       
    66         *
       
    67         *   @param  aMessage        Handle to the message that 
       
    68         *                           contains the request.
       
    69         */
       
    70         void DispatchMessageL( const RMessage2& aMessage );
       
    71 
       
    72         /**
       
    73         *   Panics the client.
       
    74         *
       
    75         *   @param  aPanic          Identifies the reason for panic.
       
    76         */
       
    77         void PanicClient( TCbsSessionPanic aPanic ) const;
       
    78 
       
    79         /**
       
    80         *   Returns the number of new topics detected. 
       
    81         *
       
    82         *   The counter will be reset after a call.
       
    83         *
       
    84         *   @return                 Number of topics detected.
       
    85         */
       
    86         TInt TotalTopicsDetected();
       
    87 
       
    88         /**
       
    89         *   Returns the last message arrived from the client
       
    90         *
       
    91         *   @return                 Current message
       
    92         */
       
    93         RMessage2& Message();
       
    94 
       
    95         CCbsServer& Server();
       
    96 
       
    97     public:     // From CSession2
       
    98         
       
    99         /**
       
   100         *   Handles the received message.
       
   101         *
       
   102         *   The method simply calls DispatchMessageL (see above) under
       
   103         *   trap harness. 
       
   104         *
       
   105         *   @param  aMessage        Handle to the message.
       
   106         */
       
   107         void ServiceL( const RMessage2& aMessage );
       
   108     
       
   109     private:
       
   110 
       
   111         /**
       
   112         *   Constructor.
       
   113         *
       
   114         *   @param  aServer         Reference to the server.
       
   115         */
       
   116         CCbsSession( CCbsServer& aServer );
       
   117 
       
   118         /**
       
   119         *   Finalizes the construction.
       
   120         */
       
   121         void ConstructL();
       
   122 
       
   123         /**
       
   124         *   Handles the session-based requests.
       
   125         *
       
   126         *   @param  aMessage        A handle to the message.
       
   127         *   @return                 ETrue if the request was handled in 
       
   128         *                           the main session.
       
   129         */
       
   130         TBool HandleSessionRequestsL( const RMessage2& aMessage );
       
   131 
       
   132         /**
       
   133         *   Create a new subsession, settings, for the session.
       
   134         */
       
   135         void NewSettingsL();
       
   136 
       
   137         /**
       
   138         *   Create a new subsession, topic list, for the session.
       
   139         */
       
   140         void NewTopicListL();
       
   141 
       
   142         /**
       
   143         *   Create a new subsession, topic collection, for the session.
       
   144         */
       
   145         void NewTopicCollectionL();
       
   146 
       
   147         /**
       
   148         *   Create a new subsession, topic messages, for the session.
       
   149         */
       
   150         void NewTopicMessagesL();
       
   151 
       
   152         /**
       
   153         *   Create a new MCN subsession.
       
   154         */
       
   155         void NewMcnSubsessionL();
       
   156 
       
   157         /**
       
   158         *   Return the current cell info message to the client.
       
   159         */ 
       
   160         void GetCurrentMcnInfoL();        
       
   161 
       
   162     private:    // Data
       
   163         
       
   164         /**
       
   165         *   Reference to CCbsServer object. 
       
   166         *   iServer is a private member of CSharableSession so
       
   167         *   we define a new name for CCbsServer pointer.
       
   168         */
       
   169         CCbsServer& iCbsServer;
       
   170 
       
   171 
       
   172         /** 
       
   173         *   The last message arrived from the client
       
   174         *   
       
   175         */
       
   176         RMessage2 iCurrentMessage;
       
   177 
       
   178     };
       
   179 
       
   180 #endif      //  CCBSSESSION_H   
       
   181             
       
   182 // End of File
       
   183 
       
   184