messagingappbase/ncnlist/inc/CNcnMsvSessionHandler.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2004 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:   Defines class CNcnMsvSessionHandler.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef NCNMSVSESSIONHANDLER_H
       
    21 #define NCNMSVSESSIONHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <msvapi.h>     // For MMsvSessionObserver
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MNcnMsvSessionHandlerObserver;
       
    29 class CMsvSession;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34  * Handles the Msv-session instance and notifier observers about
       
    35  * changes in session state.
       
    36  */
       
    37 class CNcnMsvSessionHandler :
       
    38     public CBase,
       
    39     public MMsvSessionObserver
       
    40     {
       
    41     private:  // Constructors and destructor
       
    42 
       
    43         /**
       
    44         * C++ default constructor.
       
    45         */
       
    46         CNcnMsvSessionHandler( );
       
    47 
       
    48         /**
       
    49          * 2nd. phase constructor.
       
    50          */ 
       
    51         void ConstructL();
       
    52 
       
    53     public:  // Constructors and destructor
       
    54 
       
    55         /**
       
    56         * Two-phased constructor.
       
    57         */
       
    58         static CNcnMsvSessionHandler* NewL( );
       
    59 
       
    60         /**
       
    61         * Destructor.
       
    62         */
       
    63         virtual ~CNcnMsvSessionHandler();
       
    64         
       
    65     public:     // From MMsvSessionObserver
       
    66     
       
    67         void HandleSessionEventL(
       
    68             TMsvSessionEvent aEvent,
       
    69             TAny* aArg1,
       
    70             TAny* aArg2,
       
    71             TAny* aArg3 );
       
    72 
       
    73     public:  // New methods
       
    74 
       
    75         /**
       
    76          * Adds an observer.
       
    77          * @param aObserver The observer to add. Ownership is not passed.
       
    78          */
       
    79         void AddObserverL( MNcnMsvSessionHandlerObserver* aObserver );
       
    80 
       
    81         /**
       
    82          * Removes the specified observer.
       
    83          * @param aObserver The observer to remove. Ownership is not passed.
       
    84          */
       
    85         void RemoveObserver( MNcnMsvSessionHandlerObserver* aObserver );
       
    86 
       
    87         /**
       
    88          * Returns ETrue if Msv session is ready.
       
    89          * @return ETrue if Msv session is ready.
       
    90          */
       
    91         TBool IsMsvSessionReady() const;
       
    92 
       
    93         /**
       
    94          * Returns Msv session reference. May leave with KErrGeneral
       
    95          * if Msv session is not ready.
       
    96          * @return The Msv session reference.
       
    97          */
       
    98         CMsvSession& MsvSessionL();
       
    99         
       
   100         /**
       
   101          * Starts the session handler. Method will connect the session
       
   102          * and handler notifies observers about the progress.
       
   103          * Method may leave if Msv session could not be instantiated.
       
   104          */
       
   105         void StartSessionHandlerL();
       
   106         
       
   107         /**
       
   108          * Stops the session handler.
       
   109          */
       
   110         void StopSessionHandler();
       
   111         
       
   112     private:    // New methods
       
   113     
       
   114         /**
       
   115          * Handles Msv terminated event.
       
   116          */
       
   117         void HandleMsvTerminatedL();        
       
   118         
       
   119         /**
       
   120          * Handles Msv closed event.
       
   121          */
       
   122         void HandleMsvClosed();
       
   123         
       
   124         /**
       
   125          * Handles created entries.
       
   126          */
       
   127         void HandleMsvEntriesCreatedL( const CMsvEntrySelection& aSelection );
       
   128         
       
   129         /**
       
   130          * Handles deleted entries.
       
   131          */
       
   132         void HandleMsvEntriesDeletedL( const CMsvEntrySelection& aSelection );                
       
   133         
       
   134         /**
       
   135          * Notifies that Msv session is ready.
       
   136          */
       
   137         void NotifyMsvSessionReady();
       
   138         
       
   139         /**
       
   140          * Notifies that Msv session is closed.
       
   141          */
       
   142         void NotifyMsvSessionClosed();
       
   143         
       
   144         /**
       
   145          * Notifies about created msv entry.
       
   146          * @param aMsvId The id of the created entry.
       
   147          */
       
   148         void NotifyMsvEntryCreated( const TMsvId& aMsvId );
       
   149         
       
   150         /**
       
   151          * Notifies about deleted msv entry.
       
   152          * @param aMsvId The id of the deleted entry.
       
   153          */
       
   154         void NotifyMsvEntryDeleted( const TMsvId& aMsvId );
       
   155         
       
   156          /**
       
   157          * Notifies that the Message Server has automatically changed the index 
       
   158          * location to use the internal disk.
       
   159          * @param aDriveNumber The drive number where the message store moves
       
   160          */
       
   161         void HandleMsvMediaChangedL( const TDriveNumber& aDriveNumber );
       
   162 
       
   163 		/**
       
   164 		* Notifies that the disk containing the Message Store is available again.
       
   165 		* The Message Server can now operate as normal
       
   166 		* @param aDriveNumber is a TDriveNumber value that identifies the drive that is being used.
       
   167 		*/
       
   168         void HandleMsvMediaAvailableL( const TDriveNumber& aDriveNumber );
       
   169         
       
   170         /**
       
   171 		* Notifies that the disk containing the Message Store is Unavailable .
       
   172 		*/
       
   173         void HandleMsvMediaUnAvailableL( );
       
   174         
       
   175     private:    // Data
       
   176 
       
   177         // Msv session pointer, owned
       
   178         CMsvSession* iMsvSession;        
       
   179         
       
   180         // Observer array, pointers are not owned
       
   181         CArrayPtrSeg<MNcnMsvSessionHandlerObserver> iObservers;
       
   182     };
       
   183 
       
   184 #endif    // NCNMSVSESSIONHANDLER_H
       
   185 
       
   186 // End of File