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);
    }

Inherits from

Public Member Functions
~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 voidStartListeningL()
IMPORT_C voidStopListening()
Protected Member Functions
voidDoCancel()
TInt RunError(TInt)
voidRunL()
Private Member Functions
CCenRepNotifyHandler(MCenRepNotifyHandlerCallback &, CRepository &, TCenRepKeyType, TUint32)
CCenRepNotifyHandler(MCenRepNotifyHandlerCallback &, CRepository &)
TInt OrderNotification()
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enumTCenRepKeyType { EIntKey, ERealKey, EStringKey, EBinaryKey }
Inherited Enumerations
CActive:TPriority
Private Attributes
MCenRepNotifyHandlerCallback &iCallback
TUint32 iId
TCenRepKeyType iKeyType
CRepository &iSession
TBool iWholeRepository
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CCenRepNotifyHandler(MCenRepNotifyHandlerCallback &, CRepository &, TCenRepKeyType, TUint32)

CCenRepNotifyHandler(MCenRepNotifyHandlerCallback &aCallback,
CRepository &aSession,
TCenRepKeyTypeaKeyType,
TUint32aId
)[private]

Parameters

MCenRepNotifyHandlerCallback & aCallback
CRepository & aSession
TCenRepKeyType aKeyType
TUint32 aId

CCenRepNotifyHandler(MCenRepNotifyHandlerCallback &, CRepository &)

CCenRepNotifyHandler(MCenRepNotifyHandlerCallback &aCallback,
CRepository &aSession
)[private]

Parameters

MCenRepNotifyHandlerCallback & aCallback
CRepository & aSession

~CCenRepNotifyHandler()

IMPORT_C~CCenRepNotifyHandler()[virtual]

Destructor.

Member Functions Documentation

DoCancel()

voidDoCancel()[protected, virtual]

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel().

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel().

CActive::Cancel

NewL(MCenRepNotifyHandlerCallback &, CRepository &, TCenRepKeyType, TUint32)

IMPORT_C CCenRepNotifyHandler *NewL(MCenRepNotifyHandlerCallback &aCallback,
CRepository &aSession,
TCenRepKeyTypeaKeyType,
TUint32aId
)[static]

Parameters

MCenRepNotifyHandlerCallback & aCallback
CRepository & aSession
TCenRepKeyType aKeyType
TUint32 aId

NewL(MCenRepNotifyHandlerCallback &, CRepository &)

IMPORT_C CCenRepNotifyHandler *NewL(MCenRepNotifyHandlerCallback &aCallback,
CRepository &aSession
)[static]

Parameters

MCenRepNotifyHandlerCallback & aCallback
CRepository & aSession

NewLC(MCenRepNotifyHandlerCallback &, CRepository &, TCenRepKeyType, TUint32)

IMPORT_C CCenRepNotifyHandler *NewLC(MCenRepNotifyHandlerCallback &aCallback,
CRepository &aSession,
TCenRepKeyTypeaKeyType,
TUint32aId
)[static]

Parameters

MCenRepNotifyHandlerCallback & aCallback
CRepository & aSession
TCenRepKeyType aKeyType
TUint32 aId

NewLC(MCenRepNotifyHandlerCallback &, CRepository &)

IMPORT_C CCenRepNotifyHandler *NewLC(MCenRepNotifyHandlerCallback &aCallback,
CRepository &aSession
)[static]

Parameters

MCenRepNotifyHandlerCallback & aCallback
CRepository & aSession

OrderNotification()

TInt OrderNotification()[private]

RunError(TInt)

TInt RunError(TIntaError)[protected, virtual]

Parameters

TInt aError

RunL()

voidRunL()[protected, virtual]

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.

CActiveScheduler::Start

CActiveScheduler::Error

CActiveScheduler::WaitForAnyRequest

TRAPD

StartListeningL()

IMPORT_C voidStartListeningL()

StopListening()

IMPORT_C voidStopListening()

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

MCenRepNotifyHandlerCallback &iCallback[private]

TUint32 iId

TUint32 iId[private]

TCenRepKeyType iKeyType

TCenRepKeyType iKeyType[private]

CRepository & iSession

CRepository &iSession[private]

TBool iWholeRepository

TBool iWholeRepository[private]