PECengine/StorageManager2/ClientSrc/CPEngStorageManagerWatcher.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:  It is used to liste Storage Ids and session state
       
    15 *				 changes
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __CPENGSTORAGEMANAGERWATCHER_H__
       
    22 #define __CPENGSTORAGEMANAGERWATCHER_H__
       
    23 
       
    24 //  INCLUDES
       
    25 #include	<e32base.h>
       
    26 #include	<bamdesca.h>
       
    27 #include	"RPEngStorageSubFolderClient.h"
       
    28 #include	"MPEngStorageManagerWatcher.h"
       
    29 
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class MPEngGlobalEventObserver;
       
    33 class MPEngSIDChangeObserver;
       
    34 class CPEngSIdChangeListener;
       
    35 class MPEngStorageFactory;
       
    36 class CPEngSessionSlotId;
       
    37 class CPEngSessionSlotEvent;
       
    38 class CPEngSessionSlotState;
       
    39 
       
    40 /**
       
    41  *  Storage manager watcher
       
    42  *  It is used to liste Storage Ids and session state changes.
       
    43  *	State changes are listened only of the session of the
       
    44  *	storage watcher.
       
    45  *	All observer Storage Id are also located in the session slot
       
    46  *	storage watcher was loaded
       
    47  *
       
    48  *  @lib PEngStoreMan2.dll
       
    49  *  @since 3.0
       
    50  */
       
    51 NONSHARABLE_CLASS( CPEngStorageManagerWatcher ):
       
    52         public CBase,
       
    53         public MPEngStorageManagerWatcher
       
    54     {
       
    55 public:  // Constructors and destructor
       
    56 
       
    57     /**
       
    58      * Two-phased constructor.
       
    59      */
       
    60     static CPEngStorageManagerWatcher* NewL(
       
    61         const CPEngSessionSlotId& aSessionSlot,
       
    62         RPEngStorageClient& aStorageClient,
       
    63         MPEngStorageFactory& aStorageFactory );
       
    64 
       
    65     /**
       
    66      * Two-phased constructor.
       
    67      */
       
    68     static CPEngStorageManagerWatcher* NewLC(
       
    69         const CPEngSessionSlotId& aSessionSlot,
       
    70         RPEngStorageClient& aStorageClient,
       
    71         MPEngStorageFactory& aStorageFactory );
       
    72 
       
    73     /**
       
    74      * Destructor.
       
    75      */
       
    76     virtual ~CPEngStorageManagerWatcher();
       
    77 
       
    78 public: // New functions of main class
       
    79 
       
    80     /**
       
    81      *	Notify new Global event connected to this session slot
       
    82      *	Notifies about Global event all the listeners
       
    83      *
       
    84      *  @since 3.0
       
    85      *  @param	aNewEvent new global event
       
    86      */
       
    87     void NotifyGlobalEvent( const CPEngSessionSlotEvent& aNewEvent );
       
    88 
       
    89     /**
       
    90      *	Handler error of the listener
       
    91      *	It notifies about error all listeners
       
    92      *
       
    93      *  @since 3.0
       
    94      */
       
    95     void NotifyListenerError( TInt aError );
       
    96 
       
    97 
       
    98 public: // New functions of MPEngStorageManagerWatcher
       
    99 
       
   100     /**
       
   101      *	Openes handle to the Storage Manager watcher
       
   102      *  @see <MPEngStorageManagerWatcher.h>
       
   103      *	@since 3.0
       
   104      */
       
   105     void Open();
       
   106 
       
   107     /**
       
   108      *	Closes handle to the Storage Manager watcher
       
   109      *  @see <MPEngStorageManagerWatcher.h>
       
   110      *	@since 3.0
       
   111      */
       
   112     void Close();
       
   113 
       
   114     /**
       
   115      *	Create Storage Manager
       
   116      *  @see <MPEngStorageManagerWatcher.h>
       
   117      *	@since 3.0
       
   118       */
       
   119     MPEngStorageManager* CreateStorageManagerL();
       
   120 
       
   121     /**
       
   122      *	Register new event observer
       
   123      *  @see <MPEngStorageManagerWatcher.h>
       
   124      *	@since 3.0
       
   125       */
       
   126     TPEngNWSessionSlotState RegisterListenEventObserverL(
       
   127         MPEngGlobalEventObserver& aEventObserver );
       
   128 
       
   129     /**
       
   130      *	Un Register event observer
       
   131      *  @see <MPEngStorageManagerWatcher.h>
       
   132      *	@since 3.0
       
   133       */
       
   134     void UnregisterListenEventObserver(
       
   135         MPEngGlobalEventObserver& aEventObserver );
       
   136 
       
   137     /**
       
   138      *	Returns current state of the presence server
       
   139      *  @see <MPEngStorageManagerWatcher.h>
       
   140      *	@since 3.0
       
   141       */
       
   142     TPEngNWSessionSlotState CurrentStateOfSessionSlot();
       
   143 
       
   144     /**
       
   145      *	Registers Storage IDs listener
       
   146      *  @see <MPEngStorageManagerWatcher.h>
       
   147      *	@since 3.0
       
   148      */
       
   149     void RegisterListenSIDsObserverL(
       
   150         const MDesCArray& aInterestedSIds,
       
   151         MPEngSIDChangeObserver& aSIdChangeObserver,
       
   152         TPEngObserverPriority aPriority,
       
   153         TBool aKeepOldIds );
       
   154 
       
   155 
       
   156     /**
       
   157      *	Remove engaged SIds from existing Storage IDs listener
       
   158      *  @see <MPEngStorageManagerWatcher.h>
       
   159      *	@since 3.0
       
   160      */
       
   161     void RemoveSIDsFromSIDsObserver(
       
   162         const MDesCArray& aSIdsToRemove,
       
   163         const MPEngSIDChangeObserver& aSIdChangeObserver );
       
   164 
       
   165     /**
       
   166      *  Restart Storage Id observer
       
   167      *  @see <MPEngStorageManagerWatcher.h>
       
   168      *	@since 3.0
       
   169      */
       
   170     void RestartSIDsObserver(
       
   171         const MPEngSIDChangeObserver& aSIdChangeObserver );
       
   172 
       
   173     /**
       
   174      *	Un Register SId change observer
       
   175      *  @see <MPEngStorageManagerWatcher.h>
       
   176      *	@since 3.0
       
   177       */
       
   178     void UnregisterListenSIDsObserver(
       
   179         const MPEngSIDChangeObserver& aSIdChangeObserver );
       
   180 
       
   181     /**
       
   182      *	Suspend existing SIDs listener
       
   183      *  @see <MPEngStorageManagerWatcher.h>
       
   184      *	@since 3.0
       
   185       */
       
   186     TInt SuspendListenSIDsObserver(
       
   187         const MPEngSIDChangeObserver& aSIdChangeObserver );
       
   188 
       
   189     /**
       
   190      *	Resume existing suspended SIDs listener
       
   191      *  @see <MPEngStorageManagerWatcher.h>
       
   192      *	@since 3.0
       
   193       */
       
   194     TInt ResumeListenSIDsObserver(
       
   195         const MPEngSIDChangeObserver& aSIdChangeObserver );
       
   196 
       
   197     /*
       
   198      *	Get Session slot Id class
       
   199      *  @see <MPEngStorageManagerWatcher.h>
       
   200      *	@since 3.0
       
   201      */
       
   202     const CPEngSessionSlotId& SessionSlotId() const;
       
   203 
       
   204 private: // New Private functions of the main class
       
   205 
       
   206     /**
       
   207      *	Clean Storage Id Listener
       
   208      *	@since 3.0
       
   209      */
       
   210     void CleanStorageIdListener();
       
   211 
       
   212 
       
   213     /**
       
   214      *	Load Storage Id listener
       
   215      *	@since 3.0
       
   216      */
       
   217     void LoadSIdListenerL();
       
   218 
       
   219 private:
       
   220 
       
   221     /**
       
   222      * C++ default constructor.
       
   223      */
       
   224     CPEngStorageManagerWatcher( MPEngStorageFactory& aStorageFactory );
       
   225 
       
   226     /**
       
   227      * By default Symbian 2nd phase constructor is private.
       
   228      */
       
   229     void ConstructL( const CPEngSessionSlotId& aSessionSlot,
       
   230                      RPEngStorageClient& aStorageClient );
       
   231 
       
   232 private:    // Data
       
   233     /// OWN: Notify client
       
   234     RPEngStorageSubFolderClient					iNotifyClient;
       
   235 
       
   236     /// REF: Storage Manager Factory
       
   237     MPEngStorageFactory&						iStorageManagerFactory;
       
   238 
       
   239     /// OWN: Store Id listener, owned
       
   240     CPEngSIdChangeListener*						iStorageIdListener;
       
   241 
       
   242     /// Access count for reference counted object
       
   243     TInt										iAccessCount;
       
   244 
       
   245     /// OWN: Session Slot Id
       
   246     CPEngSessionSlotId*							iSessionSlotId;
       
   247 
       
   248     /// FER: Observers of the events of this particular session
       
   249     RPointerArray<MPEngGlobalEventObserver>		iEventObservers;
       
   250 
       
   251     /// Session Slot state
       
   252     TPEngNWSessionSlotState						iSessionState;
       
   253 
       
   254     };
       
   255 
       
   256 #endif      // __CPENGSTORAGEMANAGERWATCHER_H__
       
   257 
       
   258 // End of File