00001 /* 00002 * ============================================================================== 00003 * Name : CenRepNotifyHandler.h 00004 * Part of : Common Services / Common Engine 00005 * Interface : SDK, Central Repository Notification Handler API 00006 * Description : Active object wrapper for Central Repository one-shot 00007 * Notification handling. 00008 * Version : %version: 12 % 00009 * 00010 * Copyright © 2004-2006 Nokia. All rights reserved. 00011 * This material, including documentation and any related 00012 * computer programs, is protected by copyright controlled by 00013 * Nokia. All rights are reserved. Copying, including 00014 * reproducing, storing, adapting or translating, any 00015 * or all of this material requires the prior written consent of 00016 * Nokia. This material also contains confidential 00017 * information which may not be disclosed to others without the 00018 * prior written consent of Nokia. 00019 * ============================================================================== 00020 */ 00021 00022 #ifndef CCENREPNOTIFYHANDLER_H 00023 #define CCENREPNOTIFYHANDLER_H 00024 00025 // INCLUDES 00026 #include <e32std.h> 00027 #include <e32base.h> 00028 00029 // FORWARD DECLARATIONS 00030 class MCenRepNotifyHandlerCallback; 00031 class CRepository; 00032 00073 class CCenRepNotifyHandler : public CActive 00074 { 00075 public: 00080 enum TCenRepKeyType 00081 { 00082 EIntKey, 00083 ERealKey, 00084 EStringKey, 00085 EBinaryKey 00086 }; 00087 00100 IMPORT_C static CCenRepNotifyHandler* NewL( MCenRepNotifyHandlerCallback& aCallback, 00101 CRepository& aSession, 00102 TCenRepKeyType aKeyType, 00103 TUint32 aId ); 00104 00119 IMPORT_C static CCenRepNotifyHandler* NewL( MCenRepNotifyHandlerCallback& aCallback, 00120 CRepository& aSession ); 00121 00135 IMPORT_C static CCenRepNotifyHandler* NewLC( MCenRepNotifyHandlerCallback& aCallback, 00136 CRepository& aSession, 00137 TCenRepKeyType aKeyType, 00138 TUint32 aId ); 00154 IMPORT_C static CCenRepNotifyHandler* NewLC( MCenRepNotifyHandlerCallback& aCallback, 00155 CRepository& aSession ); 00164 IMPORT_C void StartListeningL(); 00165 00170 IMPORT_C void StopListening(); 00171 00172 00176 IMPORT_C virtual ~CCenRepNotifyHandler(); 00177 00178 protected: 00179 00185 void RunL(); 00186 00192 TInt RunError( TInt aError ); 00193 00199 void DoCancel(); 00200 00201 private: 00202 00211 CCenRepNotifyHandler( MCenRepNotifyHandlerCallback& aCallback, 00212 CRepository& aSession, 00213 TCenRepKeyType aKeyType, 00214 TUint32 aId ); 00215 00222 CCenRepNotifyHandler( MCenRepNotifyHandlerCallback& aCallback, 00223 CRepository& aSession ); 00224 /* 00225 * Order notification 00226 * @return error code from CenRep 00227 */ 00228 TInt OrderNotification(); 00229 00230 private: 00231 00232 CRepository& iSession; // not owned by this class 00233 MCenRepNotifyHandlerCallback& iCallback; // not owned by this class 00234 TCenRepKeyType iKeyType; 00235 TUint32 iId; 00236 TBool iWholeRepository; // The flag to indicate if listening is for whole repository 00237 }; 00238 00239 00251 class MCenRepNotifyHandlerCallback 00252 { 00253 00254 public: 00255 00263 IMPORT_C virtual void HandleNotifyInt( TUint32 aId, TInt aNewValue ); 00264 00272 IMPORT_C virtual void HandleNotifyReal( TUint32 aId, TReal aNewValue ); 00273 00281 IMPORT_C virtual void HandleNotifyString( TUint32 aId, const TDesC16& aNewValue ); 00282 00290 IMPORT_C virtual void HandleNotifyBinary( TUint32 aId, const TDesC8& aNewValue ); 00291 00304 IMPORT_C virtual void HandleNotifyGeneric( TUint32 aId ); 00305 00319 IMPORT_C virtual void HandleNotifyError( TUint32 aId, TInt aError, 00320 CCenRepNotifyHandler* aHandler ); 00321 }; 00322 00323 // CCENREPNOTIFYHANDLER_H 00324 #endif 00325 00326 // End of File