Reporting Feature Data for a Single Feature Dynamically Using RFeatureControl

How to report feature data using RFeatureControl dynamically.

To report feature data for a single feature 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 Uid of the feature you want a report on,

  4. create an instance of TFeatureEntry with the Uid of the feature as argument to the constructor,
    
             // Query single feature status and data
              TFeatureEntry entry( KFeatureUid4 );
    

  5. call the FeatureSupported() function of the RFeatureControl object with the Uid of the feature entry as argument, and
    
              err = control.FeatureSupported( entry );
              if( err == KFeatureSupported )
                  {
                  TUint32 data = entry.FeatureData();
                  // do something with enabled feature's data
                  }
              else if( err == KFeatureUnsupported )
                  {
                  // do or do not something with disabled feature's data
                  }
    

  6. 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: