author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:27:01 +0100 | |
branch | Symbian2 |
changeset 3 | e1b950c65cb4 |
parent 0 | 061f57f2323e |
child 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@2 | 1 |
/* |
williamr@2 | 2 |
* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies). |
williamr@2 | 3 |
* All rights reserved. |
williamr@2 | 4 |
* This component and the accompanying materials are made available |
williamr@2 | 5 |
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
williamr@2 | 6 |
* which accompanies this distribution, and is available |
williamr@2 | 7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
williamr@2 | 8 |
* |
williamr@2 | 9 |
* Initial Contributors: |
williamr@2 | 10 |
* Nokia Corporation - initial contribution. |
williamr@2 | 11 |
* |
williamr@2 | 12 |
* Contributors: |
williamr@2 | 13 |
* |
williamr@2 | 14 |
* Description: Offers functionality for querying whether a feature is |
williamr@2 | 15 |
* supported in the current environment. |
williamr@2 | 16 |
* |
williamr@2 | 17 |
*/ |
williamr@2 | 18 |
|
williamr@2 | 19 |
|
williamr@2 | 20 |
#ifndef FEATUREDISCOVERY_H |
williamr@2 | 21 |
#define FEATUREDISCOVERY_H |
williamr@2 | 22 |
|
williamr@2 | 23 |
// INCLUDES |
williamr@2 | 24 |
#include <e32std.h> |
williamr@2 | 25 |
|
williamr@2 | 26 |
|
williamr@2 | 27 |
/** |
williamr@2 | 28 |
* Class used to query which features are suppported in the environment. |
williamr@2 | 29 |
* Feature Discovery API provides methods which are used to query which |
williamr@2 | 30 |
* features are supported in the environment. A feature is a functionality that |
williamr@2 | 31 |
* can be optionally left out of some product configurations. Features often |
williamr@2 | 32 |
* depend on the underlying hardware. For example, MMC support or USB support |
williamr@2 | 33 |
* can be features. The API consist of the CFeatureDiscovery class which is |
williamr@2 | 34 |
* used together with feature IDs defined in the featureinfo.h file. |
williamr@2 | 35 |
* |
williamr@2 | 36 |
* |
williamr@2 | 37 |
* Usage: |
williamr@2 | 38 |
* |
williamr@2 | 39 |
* @code |
williamr@2 | 40 |
* #include <FeatDiscovery.h> |
williamr@2 | 41 |
* #include <featureinfo.h> // for feature definitions |
williamr@2 | 42 |
* |
williamr@2 | 43 |
* // If querying only one feature, it is more efficient to use the class |
williamr@2 | 44 |
* // via the static method, IsFeatureSupportedL(). |
williamr@2 | 45 |
* // When querying more than one feature, it is more efficient to use the |
williamr@2 | 46 |
* // class by creating an instance and calling the IsSupported() method. |
williamr@2 | 47 |
* |
williamr@2 | 48 |
* // Static way of using the class: |
williamr@2 | 49 |
* TBool isSupported = CFeatureDiscovery::IsFeatureSupportedL(KFeatureIdUsb); |
williamr@2 | 50 |
* |
williamr@2 | 51 |
* // Dynamic way of using the class using NewL(): |
williamr@2 | 52 |
* |
williamr@2 | 53 |
* // Call NewL() to create an instance of CFeatureDiscovery. |
williamr@2 | 54 |
* CFeatureDiscovery* testA = CFeatureDiscovery::NewL(); |
williamr@2 | 55 |
* |
williamr@2 | 56 |
* // Call the exported IsSupported() method to query whether features |
williamr@2 | 57 |
* // are supported in the current environment or not. |
williamr@2 | 58 |
* TBool usbSupported = testA->IsSupported(KFeatureIdUsb); |
williamr@2 | 59 |
* TBool mmcSupported = testA->IsSupported(KFeatureIdMmc); |
williamr@2 | 60 |
* |
williamr@2 | 61 |
* // Delete the created instance of CFeatureDiscovery. |
williamr@2 | 62 |
* delete testA; |
williamr@2 | 63 |
* |
williamr@2 | 64 |
* // Dynamic way of using the class using NewLC(): |
williamr@2 | 65 |
* |
williamr@2 | 66 |
* // Call NewLC() to create an instance of CFeatureDiscovery. |
williamr@2 | 67 |
* // The method leaves the instance of the object on the cleanup stack. |
williamr@2 | 68 |
* CFeatureDiscovery* testB = CFeatureDiscovery::NewLC(); |
williamr@2 | 69 |
* |
williamr@2 | 70 |
* // Call the exported IsSupported() method to query whether features |
williamr@2 | 71 |
* // are supported in the current environment or not. |
williamr@2 | 72 |
* TBool wcdmaSupported = testB->IsSupported(KFeatureIdProtocolWcdma); |
williamr@2 | 73 |
* TBool gsmSupported = testB->IsSupported(KFeatureIdProtocolGsm); |
williamr@2 | 74 |
* |
williamr@2 | 75 |
* // Pop and delete the created instance of CFeatureDiscovery. |
williamr@2 | 76 |
* CleanupStack::PopAndDestroy(); |
williamr@2 | 77 |
* @endcode |
williamr@2 | 78 |
* |
williamr@2 | 79 |
* @lib featdiscovery.lib |
williamr@2 | 80 |
* @since S60 2.8 |
williamr@2 | 81 |
*/ |
williamr@2 | 82 |
|
williamr@2 | 83 |
class CFeatureDiscovery : public CBase |
williamr@2 | 84 |
{ |
williamr@2 | 85 |
public: |
williamr@2 | 86 |
|
williamr@2 | 87 |
/** |
williamr@2 | 88 |
* This is a two-phase constructor method that is used to create |
williamr@2 | 89 |
* a new instance of the CFeatureDiscovery class. |
williamr@2 | 90 |
* |
williamr@2 | 91 |
* @return a pointer to a new instance of the CFeatureDiscovery class. |
williamr@2 | 92 |
* |
williamr@2 | 93 |
* @leave One of the Symbian OS error codes |
williamr@2 | 94 |
*/ |
williamr@2 | 95 |
IMPORT_C static CFeatureDiscovery* NewL(); |
williamr@2 | 96 |
|
williamr@2 | 97 |
/** |
williamr@2 | 98 |
* This is a two-phase constructor method that is used to create |
williamr@2 | 99 |
* a new instance of the CFeatureDiscovery class. This method leaves |
williamr@2 | 100 |
* the instance of the object on the cleanup stack. |
williamr@2 | 101 |
* |
williamr@2 | 102 |
* @return a pointer to a new instance of the CFeatureDiscovery class. |
williamr@2 | 103 |
* |
williamr@2 | 104 |
* @leave One of the Symbian OS error codes |
williamr@2 | 105 |
*/ |
williamr@2 | 106 |
IMPORT_C static CFeatureDiscovery* NewLC(); |
williamr@2 | 107 |
|
williamr@2 | 108 |
/** |
williamr@2 | 109 |
* Destructor. |
williamr@2 | 110 |
*/ |
williamr@2 | 111 |
virtual ~CFeatureDiscovery(); |
williamr@2 | 112 |
|
williamr@2 | 113 |
/** |
williamr@2 | 114 |
* Static way to fetch information whether a certain feature is |
williamr@2 | 115 |
* supported in the current envinronment. There is no need to create |
williamr@2 | 116 |
* an instance of the class when using this method. |
williamr@2 | 117 |
* |
williamr@2 | 118 |
* @param aFeature is the feature ID of the feature that is queried. |
williamr@2 | 119 |
* @return a TBool indicating whether the feature is supported (ETrue) |
williamr@2 | 120 |
* or not (EFalse). If the feature does not exist, the return value is |
williamr@2 | 121 |
* EFalse. |
williamr@2 | 122 |
* |
williamr@2 | 123 |
* @leave One of the Symbian OS error codes. |
williamr@2 | 124 |
*/ |
williamr@2 | 125 |
IMPORT_C static TBool IsFeatureSupportedL(TInt aFeature); |
williamr@2 | 126 |
|
williamr@2 | 127 |
/** |
williamr@2 | 128 |
* Dynamic way to fetch information whether a certain feature is |
williamr@2 | 129 |
* supported in the current environment. Before calling the method |
williamr@2 | 130 |
* an instance of the CFeatureDiscovery class need to be created by |
williamr@2 | 131 |
* using one of the factory methods, NewL() or NewLC(). The created |
williamr@2 | 132 |
* instance must be deleted after use. |
williamr@2 | 133 |
* |
williamr@2 | 134 |
* @param aFeature is the feature ID of the feature that is queried. |
williamr@2 | 135 |
* @return a TBool indicating whether the feature is supported (ETrue) |
williamr@2 | 136 |
* or not (EFalse). If the feature does not exist, the return value is |
williamr@2 | 137 |
* EFalse. |
williamr@2 | 138 |
*/ |
williamr@2 | 139 |
IMPORT_C TBool IsSupported(TInt aFeature) const ; |
williamr@2 | 140 |
|
williamr@2 | 141 |
private: |
williamr@2 | 142 |
|
williamr@2 | 143 |
/** |
williamr@2 | 144 |
* C++ default constructor. |
williamr@2 | 145 |
*/ |
williamr@2 | 146 |
CFeatureDiscovery(); |
williamr@2 | 147 |
|
williamr@2 | 148 |
/** |
williamr@2 | 149 |
* By default Symbian OS constructor is private. |
williamr@2 | 150 |
*/ |
williamr@2 | 151 |
void ConstructL(); |
williamr@2 | 152 |
} ; |
williamr@2 | 153 |
|
williamr@2 | 154 |
|
williamr@2 | 155 |
#endif // FEATUREDISCOVERY_H |
williamr@2 | 156 |
|
williamr@2 | 157 |
// EOF |