#include <cenrepnotifyhandler.h>
Link against: cenrepnotifhandler.lib
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); }
Defines different key types. Enumeration is used to indicate the key type that is listened to.
Enumerator | Value | Description |
---|---|---|
EIntKey | Key holds a TInt value. | |
ERealKey | Key holds a TReal value. | |
EStringKey | Key holds a TDesC16 value. | |
EBinaryKey | Key holds a TDesC8 value. |
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.
Parameters | |
---|---|
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. |
Leave Codes | |
---|---|
KErrArgument | if invalid key type is passed as a parameter. |
Capability | |
---|---|
None |
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.
Parameters | |
---|---|
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. |
Capability | |
---|---|
None |
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.
Parameters | |
---|---|
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. |
Leave Codes | |
---|---|
KErrArgument | if invalid key type is passed as a parameter. |
Capability | |
---|---|
None |
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.
Parameters | |
---|---|
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. |
Capability | |
---|---|
None |
Reimplemented from CActive::RunError(TInt)
Implements CActive
Parameters | |
---|---|
aError | the error returned |
IMPORT_C void | StartListeningL | ( | ) |
When this method is called, the CCenRepNotifyHandler starts listening for notifications. If it is already listening, nothing happens.
Leave Codes | |
---|---|
KErrNotFound | if setting does not exist KErrPermissionDenied if client does not have the necessary capability plus other system-wide error codes. For whole settings handler, the HandleNotifyError will be trigerred with the error code |
Capability | |
---|---|
Dependent | Capability required depends on platform security of keyspace. |
IMPORT_C void | StopListening | ( | ) |
Capability | |
---|---|
None |