CFeatureDiscoveryImpl Class Reference

class CFeatureDiscoveryImpl : public CBase
 // replace <featureUID> with a real UID )

 #include <featmgr/featurecontrol.h>
 #include <featmgr/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;
     TInt err = featureControl.Open();

     if ( err == KErrNone )
         {
         // Query multiple features statuses (single IPC-call, so less overhead)

          RFeatureArray uids;
          CleanupClosePushL(uids);

          uids.AppendL( KFeatureUid1 );
          uids.AppendL( KFeatureUid2 );
          TInt err = control.FeaturesSupported( uids );

          if ( err == KErrNone )
              {
              TInt index;

              index = uids.Find( KFeatureUid1 );
              if(index == KErrNotFound)
                  {
                  // Feature does not exist (result is analogous if KFeatureUid1
                  // is not appended in uids array before query).
                  }
              else
                  {
                  iFeature1Supported = uids[index].FeatureFlags().IsSet( EFeatureSupported );
                  }

              index = uids.Find( KFeatureUid2 );
              if(index == KErrNotFound)
                  {
                  // Feature does not exist (result is analogous if KFeatureUid2
                  // is not appended in uids array before query).
                  }
              else
                  {
                  TBool feature2Supported = uids[index].FeatureFlags().IsSet( EFeatureSupported );
                  TUint32 data = uids[index].FeatureData();
                  // Do something with support-information and data
                  ...
                  }
              }
          CleanupStack::PopAndDestroy(&uids);


         // Query single feature status

          err = control.FeatureSupported( KFeatureUid3 );
          if( err == KFeatureSupported )
              {
              // do something with enabled feature
              }


         // Query single feature status and data

          TFeatureEntry entry( KFeatureUid4 );
          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
              }


         // Enable some feature.

         // EnableFeature() and DisableFeature() methods return
         // KErrNone if the feature was succesfully enabled or disabled,
         // KErrAccessDenied if the feature is not modifiable.
         // KErrPermissionDenied a capability check fails,
         // KErrNotFound if the feature does not exist and
         // otherwise one of the Symbian error codes.
         err = featureControl.EnableFeature( <featureUID> );

         // do something


         // List all supported features.

         // A client owned RFeatureUidArray array which will be filled with
         // the UIDs of supported features.
         RFeatureUidArray supportedFeatures;

         // ListSupportedFeatures() returns one of the Symbian error codes.
         err = featureControl.ListSupportedFeatures( supportedFeatures );

         // do something

         // Closes the array and frees all memory allocated to the array.
         supportedFeatures.Close();


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

     }

Inherits from

  • CFeatureDiscoveryImpl

Constructor & Destructor Documentation

CFeatureDiscoveryImpl()

CFeatureDiscoveryImpl()[private]

C++ default constructor.

~CFeatureDiscoveryImpl()

~CFeatureDiscoveryImpl()[virtual]

Destructor.

Member Functions Documentation

ConstructL()

voidConstructL()[private]

By default Symbian OS constructor is private.

FeaturesSupported(TFeatureSet &)

TInt FeaturesSupported(TFeatureSet &aFeatures)

Dynamic way to fetch information whether set of features are 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

TFeatureSet & aFeaturesis the wrapper class for feature array queried.

FeaturesSupportedL(TFeatureSet &)

voidFeaturesSupportedL(TFeatureSet &aFeatures)[static]

Static way to fetch information whether set of features are supported in the current envinronment. There is no need to create an instance of the class when using this method.

leave
Any One of the Symbian OS system-wide error codes

Parameters

TFeatureSet & aFeaturesis the wrapper class for feature array queried.

IsFeatureSupportedL(TUid)

TBool IsFeatureSupportedL(TUidaFeature)[static]

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.

leave
Any One of the Symbian OS system-wide error codes

Parameters

TUid aFeatureis the feature UID of the feature that is queried.

IsSupported(TUid)

TBool IsSupported(TUidaFeature)

Dynamic way to fetch information whether a certain feature is supported in the current environment. Before calling the method an instance of the CFeatureDiscoveryImpl class need to be created by using one of the factory methods, NewL() or NewLC(). The created instance must be deleted after use.

Parameters

TUid aFeatureis the feature UID of the feature that is queried.

NewL()

CFeatureDiscoveryImpl *NewL()[static]

This is a two-phase constructor method that is used to create a new instance of the CFeatureDiscoveryImpl class.

leave
Any One of the Symbian OS system-wide error codes

Member Data Documentation

RFeatureControl iFeatControl

RFeatureControl iFeatControl[private]