Querying a Feature Set Dynamically Using CFeatureDiscovery

How to query a feature set using CFeatureDiscovery dynamically.

To query whether a feature is supported in a feature set using CFeatureDiscovery dynamically, take the following steps.


  1. Decide the set of features you want to query and determine their Uids,

  2. create an instance of TFeatureSet,
    
      // 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;
    

  3. add each feature you want to query by calling the Append() function of TFeatureSet with the Uid of the feature as argument (one call for each feature),
    
      User::LeaveIfError( featset.Append( <featureUIDx> ) );
      User::LeaveIfError( featset.Append( <featureUIDx> ) );
    

  4. create an instance of CFeatureDiscovery,
    
      // Call NewLC() to create an instance of CFeatureDiscovery.
      // The method leaves the instance of the object on the cleanup stack.
      CFeatureDiscovery* testB = CFeatureDiscovery::NewLC();
    

  5. call its FeaturesSupported() function with the TFeatureSet as argument, and
    
      // 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>);
    

  6. destroy the CFeatureDiscovery instance when you have finished with it if it was created with NewL() rather than NewLC().