1.1 --- a/epoc32/include/featdiscovery.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/featdiscovery.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,157 @@
1.4 -featdiscovery.h
1.5 +/*
1.6 +* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* 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
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description: Offers functionality for querying whether a feature is
1.19 +* supported in the current environment.
1.20 +*
1.21 +*/
1.22 +
1.23 +
1.24 +#ifndef FEATUREDISCOVERY_H
1.25 +#define FEATUREDISCOVERY_H
1.26 +
1.27 +// INCLUDES
1.28 +#include <e32std.h>
1.29 +
1.30 +
1.31 +/**
1.32 +* Class used to query which features are suppported in the environment.
1.33 +* Feature Discovery API provides methods which are used to query which
1.34 +* features are supported in the environment. A feature is a functionality that
1.35 +* can be optionally left out of some product configurations. Features often
1.36 +* depend on the underlying hardware. For example, MMC support or USB support
1.37 +* can be features. The API consist of the CFeatureDiscovery class which is
1.38 +* used together with feature IDs defined in the featureinfo.h file.
1.39 +*
1.40 +*
1.41 +* Usage:
1.42 +*
1.43 +* @code
1.44 +* #include <FeatDiscovery.h>
1.45 +* #include <featureinfo.h> // for feature definitions
1.46 +*
1.47 +* // If querying only one feature, it is more efficient to use the class
1.48 +* // via the static method, IsFeatureSupportedL().
1.49 +* // When querying more than one feature, it is more efficient to use the
1.50 +* // class by creating an instance and calling the IsSupported() method.
1.51 +*
1.52 +* // Static way of using the class:
1.53 +* TBool isSupported = CFeatureDiscovery::IsFeatureSupportedL(KFeatureIdUsb);
1.54 +*
1.55 +* // Dynamic way of using the class using NewL():
1.56 +*
1.57 +* // Call NewL() to create an instance of CFeatureDiscovery.
1.58 +* CFeatureDiscovery* testA = CFeatureDiscovery::NewL();
1.59 +*
1.60 +* // Call the exported IsSupported() method to query whether features
1.61 +* // are supported in the current environment or not.
1.62 +* TBool usbSupported = testA->IsSupported(KFeatureIdUsb);
1.63 +* TBool mmcSupported = testA->IsSupported(KFeatureIdMmc);
1.64 +*
1.65 +* // Delete the created instance of CFeatureDiscovery.
1.66 +* delete testA;
1.67 +*
1.68 +* // Dynamic way of using the class using NewLC():
1.69 +*
1.70 +* // Call NewLC() to create an instance of CFeatureDiscovery.
1.71 +* // The method leaves the instance of the object on the cleanup stack.
1.72 +* CFeatureDiscovery* testB = CFeatureDiscovery::NewLC();
1.73 +*
1.74 +* // Call the exported IsSupported() method to query whether features
1.75 +* // are supported in the current environment or not.
1.76 +* TBool wcdmaSupported = testB->IsSupported(KFeatureIdProtocolWcdma);
1.77 +* TBool gsmSupported = testB->IsSupported(KFeatureIdProtocolGsm);
1.78 +*
1.79 +* // Pop and delete the created instance of CFeatureDiscovery.
1.80 +* CleanupStack::PopAndDestroy();
1.81 +* @endcode
1.82 +*
1.83 +* @lib featdiscovery.lib
1.84 +* @since S60 2.8
1.85 +*/
1.86 +
1.87 +class CFeatureDiscovery : public CBase
1.88 + {
1.89 + public:
1.90 +
1.91 + /**
1.92 + * This is a two-phase constructor method that is used to create
1.93 + * a new instance of the CFeatureDiscovery class.
1.94 + *
1.95 + * @return a pointer to a new instance of the CFeatureDiscovery class.
1.96 + *
1.97 + * @leave One of the Symbian OS error codes
1.98 + */
1.99 + IMPORT_C static CFeatureDiscovery* NewL();
1.100 +
1.101 + /**
1.102 + * This is a two-phase constructor method that is used to create
1.103 + * a new instance of the CFeatureDiscovery class. This method leaves
1.104 + * the instance of the object on the cleanup stack.
1.105 + *
1.106 + * @return a pointer to a new instance of the CFeatureDiscovery class.
1.107 + *
1.108 + * @leave One of the Symbian OS error codes
1.109 + */
1.110 + IMPORT_C static CFeatureDiscovery* NewLC();
1.111 +
1.112 + /**
1.113 + * Destructor.
1.114 + */
1.115 + virtual ~CFeatureDiscovery();
1.116 +
1.117 + /**
1.118 + * Static way to fetch information whether a certain feature is
1.119 + * supported in the current envinronment. There is no need to create
1.120 + * an instance of the class when using this method.
1.121 + *
1.122 + * @param aFeature is the feature ID of the feature that is queried.
1.123 + * @return a TBool indicating whether the feature is supported (ETrue)
1.124 + * or not (EFalse). If the feature does not exist, the return value is
1.125 + * EFalse.
1.126 + *
1.127 + * @leave One of the Symbian OS error codes.
1.128 + */
1.129 + IMPORT_C static TBool IsFeatureSupportedL(TInt aFeature);
1.130 +
1.131 + /**
1.132 + * Dynamic way to fetch information whether a certain feature is
1.133 + * supported in the current environment. Before calling the method
1.134 + * an instance of the CFeatureDiscovery class need to be created by
1.135 + * using one of the factory methods, NewL() or NewLC(). The created
1.136 + * instance must be deleted after use.
1.137 + *
1.138 + * @param aFeature is the feature ID of the feature that is queried.
1.139 + * @return a TBool indicating whether the feature is supported (ETrue)
1.140 + * or not (EFalse). If the feature does not exist, the return value is
1.141 + * EFalse.
1.142 + */
1.143 + IMPORT_C TBool IsSupported(TInt aFeature) const ;
1.144 +
1.145 + private:
1.146 +
1.147 + /**
1.148 + * C++ default constructor.
1.149 + */
1.150 + CFeatureDiscovery();
1.151 +
1.152 + /**
1.153 + * By default Symbian OS constructor is private.
1.154 + */
1.155 + void ConstructL();
1.156 + } ;
1.157 +
1.158 +
1.159 +#endif // FEATUREDISCOVERY_H
1.160 +
1.161 +// EOF