Link against: CenRepNotifHandler.lib
None
Capability required depends on platform security of the repository.
#include <CenRepNotifyHandler.h>
Central Repository Notification Handler API provides an easy-to-use implementation of a CActive-based wrapper for Central Repository single-shot notifications. In most cases Central Repository Notification Handler can automatically resubscribe to notifications and fetch the modified value from Central Repository. The API consists of the classes CCenRepNotifyHandler and MCenRepNotifyHandlerCallback. The user of this class needs to implement relevant MCenRepNotifyHandlerCallback interface methods to receive notifications. The user of Central Repository Notification Handler API needs access to Central Repository (centralrepository.h).
Usage:
Initialization example (from a class that implements MCenRepNotifyHandlerCallback interface):
iSession = CRepository::NewL(KTestUid); iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iSession, CCenRepNotifyHandler::EStringKey, KKey1); iNotifyHandler->StartListeningL();
Uninitialization example:
iNotifyHandler->StopListening();
delete iNotifyHandler;
Handler method implementation example:
void CMyCenRepNotifyTest::HandleNotifyString(TUint32 aId, const TDesC16& aNewValue) { // Print out the notified value RDebug::Print(_L("Key %d changed, new value: %S"), aId, &aNewValue); }
Public Types |
|
enum | TCenRepKeyType { EIntKey, ERealKey, EStringKey, EBinaryKey } |
Defines different key types. More... |
|
Public Member Functions |
|
IMPORT_C void | StartListeningL () |
When this method is called, the CCenRepNotifyHandler starts listening for notifications. |
|
IMPORT_C void | StopListening () |
When this method is called, the CCenRepNotifyHandler stops listening for notifications. |
|
virtual IMPORT_C | ~CCenRepNotifyHandler () |
Destructor. |
|
Static Public Member Functions |
|
static IMPORT_C CCenRepNotifyHandler * | NewL (MCenRepNotifyHandlerCallback &aCallback, CRepository &aSession, TCenRepKeyType aKeyType, TUint32 aId) |
This is a two-phase constructor method that is used to create a new instance for listening to the changes in a single key.
|
|
static IMPORT_C CCenRepNotifyHandler * | NewL (MCenRepNotifyHandlerCallback &aCallback, CRepository &aSession) |
This is a two-phase constructor method that is used to create a new instance for listening to the changes in all keys in the
repository. |
|
static IMPORT_C CCenRepNotifyHandler * | NewLC (MCenRepNotifyHandlerCallback &aCallback, CRepository &aSession, TCenRepKeyType aKeyType, TUint32 aId) |
This is a two-phase constructor method that is used to create a new instance for listening to the changes in a single key.
|
|
static IMPORT_C CCenRepNotifyHandler * | NewLC (MCenRepNotifyHandlerCallback &aCallback, CRepository &aSession) |
This is a two-phase constructor method that is used to create a new instance for listening to the changes in all keys in the
repository. |
|
Protected Member Functions |
|
void | RunL () |
Implements CActive. |
|
TInt | RunError (TInt aError) |
Implements CActive. |
|
void | DoCancel () |
Implements CActive. |
|
Defines different key types. Enumeration is used to indicate the key type that is listened to. |
|
Destructor. |
|
Implements CActive.
|
|
This is a two-phase constructor method that is used to create a new instance for listening to the changes in all keys in the repository. Type specific callback methods of MCenRepNotifyHandlerCallback will not be used when notifying about changes in this case, only HandleNotifyGeneric() is used.
|
|
This is a two-phase constructor method that is used to create a new instance for listening to the changes in a single key.
|
|
This is a two-phase constructor method that is used to create a new instance for listening to the changes in all keys in the repository. Leaves the constructed instance to cleanup stack. Type specific callback methods of MCenRepNotifyHandlerCallback will not be used when notifying about changes in this case, only HandleNotifyGeneric() is used.
|
|
This is a two-phase constructor method that is used to create a new instance for listening to the changes in a single key. Leaves the constructed instance to cleanup stack.
|
|
Implements CActive.
|
|
Implements CActive.
|
|
When this method is called, the CCenRepNotifyHandler starts listening for notifications. If it is already listening, nothing happens.
|
|
When this method is called, the CCenRepNotifyHandler stops listening for notifications. If it is already stopped, nothing happens. |