Reporting
on Several Features Dynamically Using RFeatureControl
How to query a feature set using RFeatureControl dynamically.
To query whether
the features in a featuer set are supported using RFeatureControl dynamically,
take the following steps.
Create an instance of RFeatureControl,
// replace <featureUID> with a real Uid )
#include <featurecontrol.h>
#include <featureinfo.h> // for feature definitions
CMyClass::MyMethodL()
{
// Replace KFeatureUidx with real feature Uid.
// Open() must be called before calling any other methods.
// Disconnect is done by calling the Close() method.
RFeatureControl featureControl;
call its Open() function,
TInt err = featureControl.Open();
determine the features you want a report on,
create an instance of RFeatureArray (an array of TFeatureEntry objects),
if ( err == KErrNone )
{
// Query multiple features statuses (single IPC-call, so less overhead)
RFeatureArray Uids;
CleanupClosePushL(Uids);
append the Uid of each feature entry to the array,
Uids.AppendL( KFeatureUid1 );
Uids.AppendL( KFeatureUid2 );
call the FeaturesSupported() function of the RFeatureControl object
with a reference to the feature array as argument, and
TInt err = control.FeaturesSupported( Uids );
call the Close() function of the RFeatureControl object.
// Remember to call CloseL after using RFeatureControl.
// It disconnects the Feature Manager server.
featureControl.Close();
}
FeatureSupported() returns:
KErrNone if
the status of each feature was fetched successfully,
KErrArgument if
the array was empty, and
otherwise returns an
error code.
If any of the feature entries in the array does not exist, the call
to FeatureSupported() removes the feature entry Uid from
the list. To discover whether a feature entry exists, call the Find() function
of RFeatureArray with the Uid of the entry as argument.
To discover whether a feature which exists is also enabled, query its EFeatureEnabled status
bit.
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.