sl@0: // Copyright (c) 2005-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: // Public interface for querying support for features on a device, and
sl@0: // subscribing for notification if any features are added or removed.
sl@0: // 
sl@0: //
sl@0: 
sl@0: #ifndef FEATREG_H
sl@0: #define FEATREG_H
sl@0: 
sl@0: /**
sl@0:  * Interface for inquiring whether features are supported on the device.
sl@0:  *
sl@0:  * The code segment below shows an example of how the QuerySupport() API 
sl@0:  * should be used in client code that checks feature status. 
sl@0:  *   
sl@0:  * @code
sl@0:  *  
sl@0:  *  // Single query 
sl@0:  *  // 
sl@0:  *  TBool haveUsb = RFeatureRegistry::QuerySupportS(NFeature::KUsb) > 0;
sl@0:  *  if (haveUsb)
sl@0:  *    { // ... connect to USB service ...
sl@0:  *    }  
sl@0:  *
sl@0:  *  // or Multiple queries
sl@0:  *  // 
sl@0:  *  RFeatureRegistry featReg;
sl@0:  *  const TBool opened = (featReg.Open() == KErrNone);
sl@0:  *  iHaveUsb = opened && (featReg.QuerySupport(NFeature::KUsb) > 0);
sl@0:  *  iHaveBluetooth = opened && (featReg.QuerySupport(NFeature::KBluetooth) > 0);
sl@0:  *  featReg.Close(); // can always call Close(), even if Open() failed:
sl@0:  *  // ... proceed to update application menus based on these featue flags
sl@0:  *  
sl@0:  * @endcode 
sl@0:  *  
sl@0:  * Note the QuerySupport() API can return a negative error code. Clients 
sl@0:  * calling this API need to decide if this should result in specific error 
sl@0:  * handling or whether ignoring the error and assuming the feature is not
sl@0:  * supported is the best policy.
sl@0:  * 
sl@0:  * @see RFeatureRegistry::QuerySupportS      
sl@0:  * @publishedPartner
sl@0:  * @deprecated
sl@0:  */
sl@0: NONSHARABLE_CLASS(RFeatureRegistry)
sl@0: 	{
sl@0: public:
sl@0: 	/**
sl@0: 	 * Bit assignments in status word for listed features
sl@0: 	 *
sl@0:  	 * @internalComponent
sl@0:      */
sl@0: 	enum
sl@0: 		{
sl@0: 		EStatusSupportBit = 1, 
sl@0: 		EStatusUpgradableBit = 2
sl@0: 		};
sl@0: 	inline RFeatureRegistry();
sl@0: 	IMPORT_C TInt Open();
sl@0: 	IMPORT_C TInt QuerySupport(TUid aFeatureUid);
sl@0: 	IMPORT_C TInt QuerySupport(TUid aFeatureUid, TUint32& aInfo);
sl@0: 	IMPORT_C void Close();
sl@0: 
sl@0: 	IMPORT_C static TInt QuerySupportS(TUid aFeatureUid);
sl@0: 	IMPORT_C static TInt QuerySupportS(TUid aFeatureUid, TUint32& aInfo);
sl@0: 
sl@0: private:
sl@0: 	class TImpl;
sl@0: 	TImpl* iImpl;
sl@0: 	};
sl@0: 
sl@0: #ifndef SYMBIAN_FEATURE_MANAGER
sl@0: /**
sl@0:  * Interface for obtaining notification of changes in the Feature Registry.
sl@0:  *
sl@0:  * @internalComponent
sl@0:  */
sl@0:  
sl@0: NONSHARABLE_CLASS(RFeatureRegistryNotify)
sl@0: 	{
sl@0: public:
sl@0: 	inline RFeatureRegistryNotify();
sl@0: 	IMPORT_C TInt Open();
sl@0: 	IMPORT_C void Subscribe(TRequestStatus &aNotifyStatus);
sl@0: 	IMPORT_C void Cancel();
sl@0: 	IMPORT_C void Close();
sl@0: 
sl@0: private:
sl@0: 	class TImpl;
sl@0: 	TImpl* iImpl;
sl@0: 	};
sl@0: 
sl@0: #endif
sl@0: 
sl@0: #include <featreg.inl> 
sl@0: 
sl@0: #endif