CCenRepNotifyHandler Class Reference
class CCenRepNotifyHandler : public CActive
|
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:
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);
}
Constructor & Destructor Documentation
CCenRepNotifyHandler(MCenRepNotifyHandlerCallback &, CRepository &, TCenRepKeyType, TUint32)
Constructor used for single key listening.
CCenRepNotifyHandler(MCenRepNotifyHandlerCallback &, CRepository &)
Constructor used for whole repository listening.
~CCenRepNotifyHandler()
IMPORT_C
|
~CCenRepNotifyHandler
|
(
|
)
|
[virtual]
|
Member Functions Documentation
DoCancel()
void
|
DoCancel
|
(
|
)
|
[protected, virtual]
|
NewL(MCenRepNotifyHandlerCallback &, CRepository &, TCenRepKeyType, TUint32)
This is a two-phase constructor method that is used to create a new instance for listening to the changes in a single key.
-
leave
-
KErrArgument if invalid key type is passed as a parameter.
-
capability
-
None
Parameters
MCenRepNotifyHandlerCallback
& aCallback
|
Reference to a callback instance.
|
CRepository
& aSession
|
Reference to an existing repository session. Do not close this session until all CCenRepNotifyHandler instances referring to it have been deleted.
|
TCenRepKeyType
aKeyType
|
Type of the key identified by aId parameter.
|
TUint32
aId
|
Id of the key that change notifications are needed for.
|
NewL(MCenRepNotifyHandlerCallback &, CRepository &)
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
MCenRepNotifyHandlerCallback
& aCallback
|
Reference to a callback instance.
|
CRepository
& aSession
|
Reference to an existing repository session. Do not close this session until all CCenRepNotifyHandler instances referring to it have been deleted.
|
NewLC(MCenRepNotifyHandlerCallback &, CRepository &, TCenRepKeyType, TUint32)
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.
-
leave
-
KErrArgument if invalid key type is passed as a parameter.
-
capability
-
None
Parameters
MCenRepNotifyHandlerCallback
& aCallback
|
Reference to a callback instance.
|
CRepository
& aSession
|
Reference to an existing repository session. Do not close this session until all CCenRepNotifyHandler instances referring to it have been deleted.
|
TCenRepKeyType
aKeyType
|
Type of the key identified by aId parameter.
|
TUint32
aId
|
Id of the key that change notifications are needed for.
|
NewLC(MCenRepNotifyHandlerCallback &, CRepository &)
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
MCenRepNotifyHandlerCallback
& aCallback
|
Reference to a callback instance.
|
CRepository
& aSession
|
Reference to an existing repository session. Do not close this session until all CCenRepNotifyHandler instances referring to it have been deleted.
|
OrderNotification()
TInt
|
OrderNotification
|
(
|
)
|
[private]
|
RunError(TInt)
TInt
|
RunError
|
(
|
TInt
|
aError
|
)
|
[protected, virtual]
|
Parameters
TInt
aError
|
the error returned
|
RunL()
void
|
RunL
|
(
|
)
|
[protected, virtual]
|
StartListeningL()
IMPORT_C void
|
StartListeningL
|
(
|
)
|
|
When this method is called, the
CCenRepNotifyHandler
starts listening for notifications. If it is already listening, nothing happens.
For single setting handler when there is already an existing notification on the same setting and session,the HandleNotifyError will be trigerred with KErrAlreadyExists error
-
leave
-
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.
StopListening()
IMPORT_C void
|
StopListening
|
(
|
)
|
|
When this method is called, the
CCenRepNotifyHandler
stops listening for notifications. If it is already stopped, nothing happens.
-
capability
-
None
Member Enumerations Documentation
Enum TCenRepKeyType
Defines different key types. Enumeration is used to indicate the key type that is listened to.
Enumerators
EIntKey
|
|
ERealKey
|
|
EStringKey
|
|
EBinaryKey
|
|
Member Data Documentation
MCenRepNotifyHandlerCallback & iCallback
TBool
iWholeRepository
TBool
|
iWholeRepository
|
[private]
|
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.