Class used to query which features are suppported in the environment.
The Feature Discovery API provides methods which are used to query which features are supported in the 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 file.
Usage:
#include <FeatDiscovery.h> #include <featureinfo.h>// for feature definitions// 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.// Static way of using the class:
TBool isSupported = CFeatureDiscovery::IsFeatureSupportedL(KFeatureIdUsb);
// Dynamic way of using the class using NewL():// 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;
// Dynamic way of using the class using NewLC():// Call NewLC() to create an instance of CFeatureDiscovery.// The method leaves the instance of the object on the cleanup stack.CFeatureDiscovery* testB = CFeatureDiscovery::NewLC();
// Call the exported IsSupported() method to query whether features // are supported in the current environment or not.
TBool wcdmaSupported = testB->IsSupported(KFeatureIdProtocolWcdma);
TBool gsmSupported = testB->IsSupported(KFeatureIdProtocolGsm);
// Pop and delete the created instance of CFeatureDiscovery.
CleanupStack::PopAndDestroy();
Static way to fetch information whether a certain feature is supported in the current envinronment.
There is no need to create an instance of the class when using this method.
Parameters:
aFeature
is the feature ID of the feature that is queried.
Returns:
a TBool indicating whether the feature is supported (ETrue) or not (EFalse). If the feature does not exist, the return value is EFalse.
Leave:
One of the Symbian OS error codes.
IMPORT_C TBool CFeatureDiscovery::IsSupported
(
TInt
aFeature
)
const
Dynamic way to fetch information whether a certain feature is supported in the current environment.
Before calling the method an instance of the CFeatureDiscovery class need to be created by using one of the factory methods, NewL() or NewLC(). The created instance must be deleted after use.
Parameters:
aFeature
is the feature ID of the feature that is queried.
Returns:
a TBool indicating whether the feature is supported (ETrue) or not (EFalse). If the feature does not exist, the return value is EFalse.