Reporting on Several Features Dynamically Using RFeatureControl

How to query a feature set using RFeatureControl dynamically.

To query whether the features in a featuer set are supported using RFeatureControl dynamically, take the following steps.


  1. 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;

  2. call its Open() function,
    
         TInt err = featureControl.Open();
    

  3. determine the features you want a report on,

  4. create an instance of RFeatureArray (an array of TFeatureEntry objects),
    
         if ( err == KErrNone )
             {
             // Query multiple features statuses (single IPC-call, so less overhead)
              RFeatureArray Uids;
              CleanupClosePushL(Uids);
    

  5. append the Uid of each feature entry to the array,
    
              Uids.AppendL( KFeatureUid1 );
              Uids.AppendL( KFeatureUid2 );
    

  6. call the FeaturesSupported() function of the RFeatureControl object with a reference to the feature array as argument, and
    
             TInt err = control.FeaturesSupported( Uids );
    

  7. call the Close() function of the RFeatureControl object.
    
             // Remember to call CloseL after using RFeatureControl.
             // It disconnects the Feature Manager server.
             featureControl.Close();  
             }
    

FeatureSupported() returns:

  • KErrNone if the status of each feature was fetched successfully,

  • KErrArgument if the array was empty, and

  • otherwise returns an error code.

If any of the feature entries in the array does not exist, the call to FeatureSupported() removes the feature entry Uid from the list. To discover whether a feature entry exists, call the Find() function of RFeatureArray with the Uid of the entry as argument. To discover whether a feature which exists is also enabled, query its EFeatureEnabled status bit.