messagingappbase/ncnlist/inc/CNcnSession.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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:   Server session class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CNCNSESSION_H__
       
    21 #define __CNCNSESSION_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 //  ENUMERATIONS
       
    27 enum TNcnSessionPanic
       
    28     {
       
    29     EPanicNcnRequestActive
       
    30     };
       
    31     
       
    32 // FORWARD DECLARATIONS
       
    33 class MNcnNotificationObserver;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38  * Server session class for handling client messages from
       
    39  * NCN Notification API.
       
    40  *
       
    41  */
       
    42 class CNcnSession : public CSession2
       
    43     {
       
    44     public: // Constructor and destructor
       
    45 
       
    46        /**
       
    47         * Two-phased constructor.
       
    48         *
       
    49         * @return CNcnSession object
       
    50         */
       
    51         static CNcnSession* NewL( MNcnNotificationObserver& aObserver );
       
    52 
       
    53        /**
       
    54         * Destructor.
       
    55         */
       
    56         ~CNcnSession();
       
    57 
       
    58     public: // From CSession2
       
    59     
       
    60         void ServiceL( const RMessage2 &aMessage );
       
    61     
       
    62     private:
       
    63     
       
    64         void ServiceNewInternalMessages1L( const RMessage2& aMessage );
       
    65         
       
    66         void ServiceNewInternalMessages2L( const RMessage2& aMessage );        
       
    67         
       
    68         void ServiceInternalMarkUnread1L( const RMessage2& aMessage );
       
    69         
       
    70         void ServiceInternalMarkUnread2L( const RMessage2& aMessage );
       
    71         
       
    72         void ServiceNewMessages1L( const RMessage2& aMessage );
       
    73         
       
    74         void ServiceMarkUnread1L( const RMessage2& aMessage );
       
    75         
       
    76         void CancelRequest();
       
    77         
       
    78         /**
       
    79          * Completes and resets a request message, if any.
       
    80          * After completion message is reset.
       
    81          * @param aError Completion error code.
       
    82          */
       
    83         void CompleteRequestMessage( TInt aError );
       
    84         
       
    85         /**
       
    86          * Sets the current request message.
       
    87          * @param aMessage
       
    88          */
       
    89         void SetRequestMessage( const RMessage2& aMessage );
       
    90         
       
    91         /**
       
    92          * Return ETrue if there is a pending request.
       
    93          * @return ETrue if there is a pending request.
       
    94          */
       
    95         TBool IsRequestPending() const;
       
    96         
       
    97         /**
       
    98          * Service implementation.
       
    99          * @param aMessage Request message.
       
   100          */
       
   101         void HandleServiceL( const RMessage2& aMessage );
       
   102         
       
   103         /**
       
   104          * Internal mark unread service implementation.
       
   105          * @param aMessage Request message.
       
   106          */
       
   107         void HandleMarkUnreadServiceL( const RMessage2& aMessage );
       
   108 
       
   109         /**
       
   110          * Panics the client with specified panic code.
       
   111          * @param aMessage The request message.
       
   112          * @param aPanic Panic code.
       
   113          */
       
   114         void PanicClient( const RMessage2& aMessage, TNcnSessionPanic aPanic );
       
   115         
       
   116     private:
       
   117 
       
   118        /**
       
   119         * C++ default constructor.
       
   120         */
       
   121         CNcnSession( MNcnNotificationObserver& aObserver );
       
   122 
       
   123        /**
       
   124         *  Constructor, second phase
       
   125         */
       
   126         void ConstructL();
       
   127 
       
   128 	private:    // data
       
   129 	
       
   130 	    MNcnNotificationObserver& iObserver;
       
   131 	    
       
   132 	    /**
       
   133 	     * Pointer to request message.
       
   134 	     */
       
   135 	    RMessagePtr2 iRequestMessage;
       
   136     };
       
   137 
       
   138 
       
   139 #endif // __CNCNSESSION_H__
       
   140 
       
   141 // End of File