sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: #ifndef FEATMGR_H sl@0: #define FEATMGR_H sl@0: sl@0: // INCLUDES sl@0: #include sl@0: #include sl@0: sl@0: // FORWARD DECLARATIONS sl@0: class CFeatMgrTlsData; sl@0: sl@0: // DEFINES sl@0: sl@0: // CLASS DECLARATION sl@0: sl@0: // CONSTANTS sl@0: sl@0: /** sl@0: Feature manager API. sl@0: Feature manager API offers the following functionality: sl@0: - Inquire whether a certain static feature is supported. sl@0: For usage, see example code at the end of the header file. sl@0: sl@0: @publishedPartner sl@0: @deprecated Use the class CFeatureDiscovery for basic feature queries, or the sl@0: class RFeatureControl for advanced feature queries and control. sl@0: */ sl@0: class FeatureManager sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: This must be called in the scope of the thread before calling sl@0: any other methods. It sets up TLS. Uninitialization is done sl@0: by calling the UnInitializeLib() function. sl@0: sl@0: @leave KErrNoMemory Memory allocation failure. sl@0: sl@0: @deprecated Use the class CFeatureDiscovery for basic feature queries, or the sl@0: class RFeatureControl for advanced feature queries and control. sl@0: */ sl@0: IMPORT_C static void InitializeLibL(); sl@0: sl@0: /** sl@0: This must be called in the scope of the thread after calling sl@0: InitializeLibL(). It frees the allocated TLS. Do not call UnInitializeLib() sl@0: if InitalizeLibL() leaves. sl@0: sl@0: @deprecated Use the class CFeatureDiscovery for basic feature queries, or the sl@0: class RFeatureControl for advanced feature queries and control. sl@0: */ sl@0: IMPORT_C static void UnInitializeLib(); sl@0: sl@0: /** sl@0: Fetches information whether a certain feature is supported. sl@0: sl@0: @param aFeature feature id. sl@0: @return feature support status. sl@0: sl@0: @deprecated Use the class CFeatureDiscovery for basic feature queries, or the sl@0: class RFeatureControl for advanced feature queries and control. sl@0: */ sl@0: IMPORT_C static TBool FeatureSupported(TInt aFeature); sl@0: sl@0: private: sl@0: sl@0: /** sl@0: Get TlsData pointer. sl@0: sl@0: @return object stored in TLS sl@0: */ sl@0: static CFeatMgrTlsData* TlsData(); sl@0: sl@0: private: sl@0: sl@0: /** sl@0: C++ default constructor. sl@0: Prohibits instantiation of this class. sl@0: */ sl@0: FeatureManager(); sl@0: sl@0: sl@0: }; sl@0: sl@0: /** sl@0: Example usage: sl@0: sl@0: @code sl@0: // replace with a real UID sl@0: sl@0: #include sl@0: #include // for feature definitions sl@0: sl@0: CMyClass::ConstructL() sl@0: { sl@0: // Sets up TLS, must be done before FeatureManager is used. sl@0: FeatureManager::InitializeLibL(); sl@0: // Used in destructor. sl@0: iFeatMgrInitialized = ETrue; sl@0: } sl@0: sl@0: CMyClass::ShowMenuL() sl@0: { sl@0: if ( FeatureManager::FeatureSupported( ) ) sl@0: { sl@0: // Feature supported, show menu item associated with it. sl@0: } sl@0: } sl@0: sl@0: CMyClass::~CMyClass() sl@0: { sl@0: // Do not call UnInitializeLib() if InitalizeLib() leaves. sl@0: if ( iFeatMgrInitialized ) sl@0: { sl@0: // Frees the TLS. Must be done after FeatureManager is used. sl@0: FeatureManager::UnInitializeLib(); sl@0: } sl@0: } sl@0: @endcode sl@0: sl@0: */ sl@0: #endif // FEATMGR_H sl@0: sl@0: // End of File