Reporting
on all Features on a Device Dynamically Using RFeatureControl
How to list all supported features on a device using RFeatureControl dynamically.
To list all supported
features on a device 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();
create an instance of RFeatureArray (an array of TFeatureEntry objects),
// List all supported features.
// A client owned RFeatureUidArray array which will be filled with
// the UIDs of supported features.
RFeatureUidArray supportedFeatures;
call its ListSupportedFeatures() function with a
reference to the RFeatureArray as argument,
// ListSupportedFeatures() returns one of the Symbian error codes.
err = featureControl.ListSupportedFeatures( supportedFeatures );
// do something
call its Close() function,
// Closes the array and frees all memory allocated to the array.
supportedFeatures.Close();
call the Close() function of the RFeatureArray object.
// Remember to call CloseL after using RFeatureControl.
// It disconnects the Feature Manager server.
featureControl.Close();
}
}
ListSupportedFeatures() causes
the passed in array to be filled with the Uids of supported features. It returns:
KErrNone if
the RFeatureArray was successfully filled with Uids,
KServerBusy if
the call failed because features were being enabled or disabled (so creating
a lock), and
otherwise returns an
error code.
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.