tsrc/centralrepositorystub/inc/cenrepnotifyhandler.h
branchRCL_3
changeset 33 bc78a40cd63c
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
       
     1 /*
       
     2 * Copyright (c) 2010 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CENREPNOTIFYHANDLER_H
       
    21 #define CENREPNOTIFYHANDLER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MCenRepNotifyHandlerCallback;
       
    29 class CRepository;
       
    30 
       
    31 
       
    32 
       
    33 class CCenRepNotifyHandler : public CBase//CActive
       
    34     {
       
    35     public:
       
    36         /**
       
    37         * Defines different key types. Enumeration is used to indicate the 
       
    38         * key type that is listened to. 
       
    39         */
       
    40         enum TCenRepKeyType
       
    41         {
       
    42             EIntKey,    ///< Key holds a TInt value.
       
    43             ERealKey,   ///< Key holds a TReal value.
       
    44             EStringKey, ///< Key holds a TDesC16 value.
       
    45             EBinaryKey  ///< Key holds a TDesC8 value.
       
    46         };
       
    47 
       
    48         IMPORT_C static CCenRepNotifyHandler* NewL( MCenRepNotifyHandlerCallback& aCallback, 
       
    49                                                     CRepository& aSession );
       
    50 
       
    51         IMPORT_C static CCenRepNotifyHandler* NewLC( MCenRepNotifyHandlerCallback& aCallback, 
       
    52                                                      CRepository& aSession );
       
    53         IMPORT_C void StartListeningL();
       
    54 
       
    55         IMPORT_C void StopListening();
       
    56 
       
    57 
       
    58         /**
       
    59         * Destructor.
       
    60         */
       
    61         IMPORT_C virtual ~CCenRepNotifyHandler();
       
    62 /*
       
    63     protected:
       
    64 
       
    65         void RunL();
       
    66     
       
    67         TInt RunError( TInt aError );
       
    68 
       
    69         void DoCancel();
       
    70 */
       
    71     private:
       
    72                                                    
       
    73         CCenRepNotifyHandler( MCenRepNotifyHandlerCallback& aCallback, 
       
    74                               CRepository& aSession );
       
    75        
       
    76     private:
       
    77         
       
    78         CRepository& iSession;  // not owned by this class
       
    79         MCenRepNotifyHandlerCallback& iCallback; // not owned by this class
       
    80 //        TCenRepKeyType iKeyType;
       
    81 //        TUint32 iId;        
       
    82 //        TBool iWholeRepository;  // The flag to indicate if listening is for whole repository
       
    83     };
       
    84 
       
    85 
       
    86 /**
       
    87 * Class provides a callback interface for handling the notifification
       
    88 * events from the Central Repository. The Client derives a class 
       
    89 * from this interface and implements the HandleNotify-methods that 
       
    90 * interest it.
       
    91 * An empty default implementation is provided for all of the methods.
       
    92 * In debug build the default implementations print out a debug trace.
       
    93 *
       
    94 * @publishedPartner
       
    95 * @released
       
    96 */
       
    97 class MCenRepNotifyHandlerCallback
       
    98     {
       
    99 
       
   100     public:
       
   101 
       
   102     /** 
       
   103     * This callback method is used to notify the client about
       
   104     * changes in keys when the whole repository is listened for.
       
   105     *
       
   106     * Note: It is not guaranteed that a notification will be received
       
   107     *       for all keys, if multiple keys are changed in rapid succession
       
   108     *       by multiple threads or when the whole repository is reset,
       
   109     *       therefore only listen for whole repository if this is not an issue.
       
   110     *
       
   111     * @param aId Id of the key that has changed. If multiple keys were changed by
       
   112     *            whole repository reset, value will be KInvalidNotificationId.
       
   113     * @capability Dependent Capability required depends on implementation of override.
       
   114     */
       
   115     IMPORT_C virtual void HandleNotifyGeneric( TUint32 aId );
       
   116 
       
   117     };
       
   118 
       
   119 #endif      // CENREPNOTIFYHANDLER_H
       
   120 
       
   121 // End of File