How to know features supported
Article Metadata
CFeatureDiscovery class is used to query which features are suppported in the platform/environment. A feature is functionality that can be optionally left out of some product configurations. Features often depend on the underlying hardware. For example, MMC support or USB support can be features. The API consist of the CFeatureDiscovery class which is used together with feature IDs defined in the featureinfo.h header file.
#include <FeatDiscovery.h>
#include <featureinfo.h> // for feature definitions
TBool isSupported = CFeatureDiscovery::IsFeatureSupportedL(KFeatureIdUsb);
TBool isIRAvailable = CFeatureDiscovery::IsFeatureSupportedL( KFeatureIdIrda );
TBool isBTAvailable = CFeatureDiscovery::IsFeatureSupportedL( KFeatureIdBt );
If querying only one feature, it is more efficient to use the class via the static method, IsFeatureSupportedL(). When querying more than one feature, it is more efficient to use the class by creating an instance and calling the IsSupported() method as follows.
//Call NewL() to create an instance of CFeatureDiscovery.
CFeatureDiscovery* testA = CFeatureDiscovery::NewL();
// Call the exported IsSupported() method to query whether features
// are supported in the current environment or not.
TBool usbSupported = testA->IsSupported(KFeatureIdUsb);
TBool mmcSupported = testA->IsSupported(KFeatureIdMmc);
// Delete the created instance of CFeatureDiscovery.
delete testA;


07 Sep
2009
Some device might not support some features, for example some device do not have camera at all. For developing generic application, that can be installed on all device of that platform, need checking of some feature is supported or not before using that feature.
Taking another example, before accessing bluetooth API, we must check whether this feature is supported or not. This article describes how to get available feature using API CFeatureDiscovery. This article is useful to both, beginners as well as experienced developer.