MCFListener Class Reference
Interface for CF listener.
MCFListener
receives indications of context changes and action indications according to the subscriptions. Also possible error situations are notified through
MCFListener
interface.
Context indication: To receive context indications client first needs to subscribe a context. See cfclient.h how to subscribe contexts. When a context which is affected by the context subscription made by the client is updated a context indication is informed to client. Context indication consists of the changed context:
void CClient::ContextIndicationL( const CCFContextIndication& aChangedContext )
{
_LIT( KSomeSource, "Source" );
_LIT( KSomeType, "Type" );
const CCFContextObject& context = aChangedContext.Context();
if( context.Source() == KSomeSource && context.Type() == KSomeType )
{
// Handle context indication...
}
}
Action indication: To receive action indications client first needs to subscribe a certain action. See cfclient.h how to subscribe actions. When a rule which has an action, sbscribed by the client, associated to is evaluated to true client will receive an action indication. Action indication contains the action ID which is needed to be executed and all the parameters defined in the rule:
void CClient::ActionIndicationL( const CCFActionIndication& aActionToExecute )
{
_LIT( KSomeActionId, "ActionId" );
if( aActionToExecute.Identifier() == KSomeActionId )
{
const RKeyValueArray& params = aActionToExecute.Parameters();
TInt paramCount = params.Count();
for( TInt i = 0; i < paramCount; i++ )
{
// Process parameters
const CCFKeyValuePair& parameter = params[i];
...
// Execute action
...
}
}
}
Subscription error: If client is subcribing a context which it does not have sufficient capabilities this will lead to a context subscription error. Since contexts can be subscribed before they have been defined context subscription errors will be asynchronously notified everytime:
void CClient::HandleContextFrameworkError( TCFError aError,
const TDesC& aSource,
const TDesC& aType )
{
_LIT( KSubscribedSource, "Source" );
_LIT( KSubscribedType, "Type" );
if( aError == MCFListener::ESecurityCheckErrorForContextSubscription )
{
if( aSource == KSubscribedSource && aType == KSubscribedType )
{
// Handle error...
}
}
}
Member Functions Documentation
ActionIndicationL(const CCFActionIndication &)
void
|
ActionIndicationL
|
(
|
const CCFActionIndication &
|
aActionToExecute
|
)
|
[pure virtual]
|
Indicates that specified action is needed to be executed. When action indication is received certain rule has been triggered and action is needed to be performed.
Parameters
const CCFActionIndication & aActionToExecute
|
Action indication.
|
ContextIndicationL(const CCFContextIndication &)
void
|
ContextIndicationL
|
(
|
const CCFContextIndication &
|
aChangedContext
|
)
|
[pure virtual]
|
Indicates a change in context for subscribed clients. If client has subscribed to partial context class path, only the changed context will be indicated.
Parameters
const CCFContextIndication & aChangedContext
|
|
Extension(const TUid &)
TAny
*
|
Extension
|
(
|
const
TUid
&
|
aExtensionUid
|
)
|
const [pure virtual]
|
Returns an extension interface. The extension interface is mapped with the extension UID.
If the client does not support the requested interface, client must return NULL. Otherwise client needs to return the correct interface combined with the UID.
Parameters
const
TUid
& aExtensionUid
|
|
HandleContextFrameworkError(TCFError, const TDesC &, const TDesC &)
void
|
HandleContextFrameworkError
|
(
|
TCFError
|
aError,
|
|
const
TDesC
&
|
aSource,
|
|
const
TDesC
&
|
aType
|
|
)
|
[pure virtual]
|
Indicates that error has occured.
Member Enumerations Documentation
Enum TCFError
Enumerators
EGeneralError
|
|
ESecurityCheckErrorForContextSubscription
|
|
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.