#include <featdiscovery.h>
#include <featureinfo.h> // for feature definitions
// replace <featureUIDx> with a real UID )
// 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(<featureUIDx>);
// 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(<featureUIDx>);
TBool mmcSupported = testA->IsSupported(<featureUIDx>);
// 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(<featureUIDx>);
TBool gsmSupported = testB->IsSupported(<featureUIDx>);
// Dynamic way of using multiple feature query. This is preferred
// way to fetch support statuses if there are several features to be
// queried, because it involves less inter-process communication.
TFeatureSet featset;
User::LeaveIfError( featset.Append( <featureUIDx> ) );
User::LeaveIfError( featset.Append( <featureUIDx> ) );
TInt err = testB->FeaturesSupported( featset );
if(!err)
{
TBool uid1Supported = featset.IsFeatureSupported(<featureUIDx>);
TBool uid2Supported = featset.IsFeatureSupported(<featureUIDx>);
// ... or whether all QUERIED features are supported
TBool allSupported = featset.AreAllFeaturesSupported();
}
// featset cleans array up in destructor on scope exit
// Pop and delete the created instance of CFeatureDiscovery.
CleanupStack::PopAndDestroy();