MCFListener Class Reference

class MCFListener

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...
        }
      }
    }
-
Since
S60 5.0
Public Member Functions
voidActionIndicationL(const CCFActionIndication &)
voidContextIndicationL(const CCFContextIndication &)
TAny *Extension(const TUid &)
voidHandleContextFrameworkError(TCFError, const TDesC &, const TDesC &)
Public Member Enumerations
enumTCFError { EGeneralError, ESecurityCheckErrorForContextSubscription }

Member Functions Documentation

ActionIndicationL(const CCFActionIndication &)

voidActionIndicationL(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.

Since
S60 5.0

Parameters

const CCFActionIndication & aActionToExecuteAction indication.

ContextIndicationL(const CCFContextIndication &)

voidContextIndicationL(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.

Since
S60 5.0

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.

Since
S60 5.0

Parameters

const TUid & aExtensionUid

HandleContextFrameworkError(TCFError, const TDesC &, const TDesC &)

voidHandleContextFrameworkError(TCFErroraError,
const TDesC &aSource,
const TDesC &aType
)[pure virtual]

Indicates that error has occured.

Since
S60 5.0

Parameters

TCFError aErrorError code.
const TDesC & aSource
const TDesC & aType

Member Enumerations Documentation

Enum TCFError

Enumerators

EGeneralError
ESecurityCheckErrorForContextSubscription