#include <cenrepnotifyhandler.h>
class CCenRepNotifyHandler : public CActive |
Public Member Enumerations | |
---|---|
enum | TCenRepKeyType { EIntKey, ERealKey, EStringKey, EBinaryKey } |
Public Member Functions | |
---|---|
virtual | ~CCenRepNotifyHandler() |
IMPORT_C CCenRepNotifyHandler * | NewL(MCenRepNotifyHandlerCallback &, CRepository &, TCenRepKeyType, TUint32) |
IMPORT_C CCenRepNotifyHandler * | NewL(MCenRepNotifyHandlerCallback &, CRepository &) |
IMPORT_C CCenRepNotifyHandler * | NewLC(MCenRepNotifyHandlerCallback &, CRepository &, TCenRepKeyType, TUint32) |
IMPORT_C CCenRepNotifyHandler * | NewLC(MCenRepNotifyHandlerCallback &, CRepository &) |
IMPORT_C void | StartListeningL() |
IMPORT_C void | StopListening() |
Protected Member Functions | |
---|---|
virtual void | DoCancel() |
virtual TInt | RunError(TInt) |
virtual void | RunL() |
Inherited Attributes | |
---|---|
CActive::iStatus |
Inherited Enumerations | |
---|---|
CActive:TPriority |
Active object wrapper for Central Repository one-shot notification handling. 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:
iSession = CRepository::NewL(KTestUid); iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iSession, CCenRepNotifyHandler::EStringKey, KKey1); iNotifyHandler->StartListeningL();
iNotifyHandler->StopListening(); delete iNotifyHandler;
void CMyCenRepNotifyTest::HandleNotifyString(TUint32 aId, const TDesC16& aNewValue) { // Print out the notified value RDebug::Print(_L("Key %d changed, new value: %S"), aId, &aNewValue); }
IMPORT_C CCenRepNotifyHandler * | NewL | ( | MCenRepNotifyHandlerCallback & | aCallback, |
CRepository & | aSession, | |||
TCenRepKeyType | aKeyType, | |||
TUint32 | aId | |||
) | [static] |
This is a two-phase constructor method that is used to create a new instance for listening to the changes in a single key.
Parameter | Description |
---|---|
aCallback | Reference to a callback instance. |
aSession | Reference to an existing repository session. Do not close this session until all CCenRepNotifyHandler instances referring to it have been deleted. |
aKeyType | Type of the key identified by aId parameter. |
aId | Id of the key that change notifications are needed for. |
Returns: A pointer to a new instance of the CCenRepNotifyHandler class.
IMPORT_C CCenRepNotifyHandler * | NewL | ( | MCenRepNotifyHandlerCallback & | aCallback, |
CRepository & | aSession | |||
) | [static] |
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.
Parameter | Description |
---|---|
aCallback | Reference to a callback instance. |
aSession | Reference to an existing repository session. Do not close this session until all CCenRepNotifyHandler instances referring to it have been deleted. |
Returns: A pointer to a new instance of the CCenRepNotifyHandler class.
IMPORT_C CCenRepNotifyHandler * | NewLC | ( | MCenRepNotifyHandlerCallback & | aCallback, |
CRepository & | aSession, | |||
TCenRepKeyType | aKeyType, | |||
TUint32 | aId | |||
) | [static] |
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.
Parameter | Description |
---|---|
aCallback | Reference to a callback instance. |
aSession | Reference to an existing repository session. Do not close this session until all CCenRepNotifyHandler instances referring to it have been deleted. |
aKeyType | Type of the key identified by aId parameter. |
aId | Id of the key that change notifications are needed for. |
Returns: A pointer to a new instance of the CCenRepNotifyHandler class.
IMPORT_C CCenRepNotifyHandler * | NewLC | ( | MCenRepNotifyHandlerCallback & | aCallback, |
CRepository & | aSession | |||
) | [static] |
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.
Parameter | Description |
---|---|
aCallback | Reference to a callback instance. |
aSession | Reference to an existing repository session. Do not close this session until all CCenRepNotifyHandler instances referring to it have been deleted. |
Returns: A pointer to a new instance of the CCenRepNotifyHandler class.
Reimplemented from CActive::RunError(TInt)
Implements CActive
Parameter | Description |
---|---|
aError | the error returned |
Returns: error
IMPORT_C void | StartListeningL | ( | ) |
When this method is called, the CCenRepNotifyHandler starts listening for notifications. If it is already listening, nothing happens.
IMPORT_C void | StopListening | ( | ) |