Feature Discovery API: Technical Specification

Type of the Interface

The type of interface this component uses is a method call. All functionality is accessed through the CFeatureDiscovery class.

Interface Class Structure

The functionality provided by this module is accessed through the CFeatureDiscovery class.

Usage

Protocol

The CFeatureDiscovery class can be used in two different ways, statically and dynamically. If querying only one feature, it is more efficient to use the class via the static method, IsFeatureSupportedL(). For other cases, when querying more than one feature, it is more efficient to use the class by creating an instance and calling the IsSupported() method.

When using CFeatureDiscovery dynamically, the user must create an instance of the CFeatureDiscovery class using one of the factory methods, NewL() or NewLC().

After creating an instance the user can call the exported IsSupported() method to query whether a feature is supported in the current environment. The created instance must be deleted after use.

When using CFeatureDiscovery statically, an instance is not needed; the query operation can be preformed by calling static method IsFeatureSupportedL() directly.

A simple code example showing the usage of Feature Discovery is shown in the Example.

Error Handling

The leave mechanism of the Symbian OS is used to handle out-of-memory conditions. Other errors are indicated using one of the standard Symbian error codes.

No extra error handling is defined.

Example

// Interface declaration
#include <FeatDiscovery.h>
…
// Static way of using the class:
TBool isSupported = CFeatureDiscovery::IsFeatureSupportedL(KfeatureIdUsb);
// Dynamic way of using the class using NewL():
CFeatureDiscovery* testA = CFeatureDiscovery::NewL();
TBool usbSupported = testA->IsSupported(KFeatureIdUsb);
TBool mmcSupported = testA->IsSupported(KFeatureIdMmc);
delete testA;
// Dynamic way of using the class using NewLC():
CFeatureDiscovery* testB = CFeatureDiscovery::NewLC();
TBool wcdmaSupported = testB->IsSupported(KFeatureIdProtocolWcdma);
TBool gsmSupported = testB->IsSupported(KFeatureIdProtocolGsm);
CleanupStack::PopAndDestroy();

Detailed Description

All the public interfaces of the subsystem are described below in more detail.

CFeatureDiscovery

This class offers an interface through which the functionality of Feature Discovery is accessed.

static CFeatureDiscovery* NewL()

This is a factory method that is used to create a new instance.

Return value:

This factory method returns a pointer to a new instance of the CFeatureDiscovery class.

static CFeatureDiscovery* NewLC()

This is a factory method that is used to create a new instance.

This method leaves the instance of the object on the cleanup stack.

Return value:

This factory method returns a pointer to a new instance of the CFeatureDiscovery class.

TBool IsSupported(TInt aFeature)

Fetches information about whether or not a certain feature is supported.

Feature identifications are defined in an appropriate HRH file. The resource header files (HRH) that are used are defined by using the Symbian build variant file variant.CFG which can be found in the following path: epoc32\tools\variant\.

A TBool indicating whether the feature is supported (ETrue) or not (EFalse).

If the feature does not exist, the return value is Efalse.

static TBool IsFeatureSupportedL(TInt aFeature)

Fetches information about whether or not a certain feature is supported.

Feature identifications are defined in an appropriate HRH file. The resource header files (HRH) that are used are defined by using the Symbian build variant file variant.CFG which can be found in the following path: epoc32\tools\variant\.

There is no need to create an instance of the class when using this method.

A TBool indicating whether the feature is supported (ETrue) or not (EFalse).

If the feature does not exist, the return value is Efalse. The method may leave one of the standard Symbian OS error codes.

Code Architecture

The client interface for Feature Discovery can be accessed through the CFeatureDiscovery interface that is defined in the header FeatDiscovery.H. The name of the corresponding DLL is FEATDISCOVERY.DLL.


Copyright © Nokia Corporation 2001-2008
Back to top