sl@0: // Copyright (c) 2007-2010 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: // INCLUDE FILES sl@0: #include sl@0: #include "featmgrtlsdata.h" sl@0: #include "featmgrdebug.h" sl@0: #include sl@0: sl@0: // LOCAL CONSTANTS AND MACROS sl@0: _LIT( KPanicCategory, "RFeatureControl" ); sl@0: sl@0: // ============================= LOCAL FUNCTIONS =============================== sl@0: sl@0: CFeatMgrTlsData* TlsData( ) sl@0: { sl@0: CFeatMgrTlsData* tlsData = STATIC_CAST( CFeatMgrTlsData*, Dll::Tls() ); sl@0: sl@0: __ASSERT_ALWAYS( tlsData, User::Panic( KPanicCategory, EPanicBadHandle ) ); sl@0: sl@0: return tlsData; sl@0: } sl@0: sl@0: sl@0: // ============================ MEMBER FUNCTIONS =============================== sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::RFeatureControl sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C RFeatureControl::RFeatureControl() : sl@0: iInitialized( EFalse ), iReserved1( 0 ), iReserved2 ( 0 ) sl@0: { sl@0: FUNC_LOG sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::Connect() sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::Connect() sl@0: { sl@0: FUNC_LOG sl@0: sl@0: return Open(); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::Open() sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::Open() sl@0: { sl@0: FUNC_LOG sl@0: sl@0: if ( !Dll::Tls() ) sl@0: { sl@0: CFeatMgrTlsData* tlsData = NULL; sl@0: sl@0: TRAPD( err, tlsData = CFeatMgrTlsData::NewL() ); sl@0: sl@0: if ( err == KErrNone ) sl@0: { sl@0: err = Dll::SetTls( tlsData ); sl@0: if (err != KErrNone) sl@0: { sl@0: delete tlsData; sl@0: ERROR_LOG1( "RFeatureControl::Open SetTls error %d ", err ); sl@0: return err; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERROR_LOG1( "RFeatureControl::Open error %d ", err ); sl@0: return err; sl@0: } sl@0: } sl@0: sl@0: // Increase the client count (self) sl@0: iInitialized = ETrue; sl@0: TlsData()->IncreaseClientCount(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::Close() sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C void RFeatureControl::Close() sl@0: { sl@0: FUNC_LOG sl@0: sl@0: if ( Dll::Tls() && iInitialized ) sl@0: { sl@0: CFeatMgrTlsData::DeleteClient(); sl@0: } sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::FeatureSupported(TUid) sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::FeatureSupported( TUid aFeature ) sl@0: { sl@0: TFeatureEntry feature( aFeature ); sl@0: TInt retVal = TlsData()->FeatureSupported( feature ); sl@0: sl@0: return retVal; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::FeatureSupported(TFeatureEntry&) sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::FeatureSupported( TFeatureEntry& aFeature ) sl@0: { sl@0: return TlsData()->FeatureSupported( aFeature ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::FeaturesSupported(RFeatureArray&) sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::FeaturesSupported( RFeatureArray& aFeatures ) sl@0: { sl@0: TInt err( KErrNone ); sl@0: sl@0: if( !aFeatures.Count() ) sl@0: { sl@0: err = KErrArgument; sl@0: } sl@0: else sl@0: { sl@0: err = TlsData()->FeaturesSupported( aFeatures ); sl@0: } sl@0: sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::EnableFeature(TUid) sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::EnableFeature( TUid aFeature ) sl@0: { sl@0: return TlsData()->EnableFeature( aFeature ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::DisableFeature(TUid) sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::DisableFeature( TUid aFeature ) sl@0: { sl@0: return TlsData()->DisableFeature( aFeature ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::SetFeature(TUid, TBool, TInt) sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::SetFeature( TUid aFeature, TBool aEnabled, TUint32 aData ) sl@0: { sl@0: return TlsData()->SetFeature( aFeature, aEnabled, aData ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::SetFeature() sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::SetFeature( TUid aFeature, TUint32 aData ) sl@0: { sl@0: return TlsData()->SetFeature( aFeature, aData ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::AddFeature() sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::AddFeature( TFeatureEntry& aFeature ) sl@0: { sl@0: return TlsData()->AddFeature( aFeature ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::DeleteFeature() sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::DeleteFeature( TUid aFeature ) sl@0: { sl@0: return TlsData()->DeleteFeature( aFeature ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::ListSupportedFeaturesL() sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::ListSupportedFeatures( RFeatureUidArray& aSupportedFeatures ) sl@0: { sl@0: TRAPD( err, TlsData()->ListSupportedFeaturesL( aSupportedFeatures ) ); sl@0: return err; sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::SWIStart() sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::SWIStart() sl@0: { sl@0: return TlsData()->SWIStart( ); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // RFeatureControl::SWIEnd() sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: EXPORT_C TInt RFeatureControl::SWIEnd() sl@0: { sl@0: return TlsData()->SWIEnd( ); sl@0: } sl@0: sl@0: sl@0: // End of File