sl@0: // Copyright (c) 1995-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 the License "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: // e32\include\d32resmanus.inl sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without noticed. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: #ifndef __KERNEL_H__ sl@0: sl@0: #ifdef RESOURCE_MANAGER_SIMULATED_PSL sl@0: #ifdef PRM_ENABLE_EXTENDED_VERSION2 sl@0: _LIT(KPddName, "resourcecontrollerextendedcore.pdd"); sl@0: #elif defined(PRM_ENABLE_EXTENDED_VERSION) sl@0: _LIT(KPddName,"resourcecontrollerextended.pdd"); // To support testing of the Extended version of the PDD sl@0: #else sl@0: _LIT(KPddName,"resourcecontroller.pdd"); sl@0: #endif sl@0: #else sl@0: #ifdef PRM_ENABLE_EXTENDED_VERSION2 sl@0: _LIT(KPddName, "resmanextendedcore.pdd"); sl@0: #elif defined(PRM_ENABLE_EXTENDED_VERSION) sl@0: _LIT(KPddName, "resmanextended.pdd"); // To enable operation with the extended version of the PDD sl@0: #else sl@0: _LIT(KPddName, "ResMan.pdd"); // To enable operation with the basic PDD sl@0: #endif sl@0: #endif sl@0: sl@0: inline TInt RBusDevResManUs::Open(TDesC8& aClientName) sl@0: {return(DoCreate(KLddRootName,VersionRequired(),-1,&KPddName,(TDesC8*)&(aClientName),EOwnerThread));} sl@0: sl@0: inline TVersion RBusDevResManUs::VersionRequired() const sl@0: {return(TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber));} sl@0: sl@0: inline TInt RBusDevResManUs::Initialise(const TUint8 aNumGetStateRes, const TUint8 aNumSetStateRes, const TUint8 aNumListenableRes) sl@0: {TUint8 stateRes[3]; \ sl@0: stateRes[0]=aNumGetStateRes; \ sl@0: stateRes[1]=aNumSetStateRes; \ sl@0: stateRes[2]=aNumListenableRes; \ sl@0: TInt r= DoControl(EInitialise,(TAny *)&stateRes); \ sl@0: return r;} sl@0: sl@0: // Synchronous methods sl@0: inline TInt RBusDevResManUs::GetNoOfResources(TUint& aNumResources, const TBool aInfoRead) sl@0: {return(DoControl(EGetNoOfResources,(TAny*)&aNumResources, (TAny*)aInfoRead));} sl@0: sl@0: inline TInt RBusDevResManUs::GetAllResourcesInfo(RSimplePointerArray* aInfoPtrs, TUint& aNumResources, const TBool aRefresh) sl@0: {TUint* parms[2]; \ sl@0: parms[0]=&aNumResources; \ sl@0: parms[1]=(TUint*)aRefresh; \ sl@0: return(DoControl(EGetAllResourcesInfo,(TAny*)aInfoPtrs,(TAny*)&parms));} sl@0: sl@0: inline TInt RBusDevResManUs::GetNoOfClients(TUint& aNumClients, const TBool aIncludeKern, const TBool aInfoRead) sl@0: {TUint parms[3]; \ sl@0: parms[0]=(TUint)aIncludeKern; \ sl@0: parms[1]=0; /* 0 represents all clients */ \ sl@0: parms[2]=(TUint)aInfoRead; \ sl@0: return(DoControl(EGetNoOfClients,(TAny*)&aNumClients,(TAny*)&parms));} sl@0: sl@0: inline TInt RBusDevResManUs::GetNamesAllClients(RSimplePointerArray* aInfoPtrs, TUint& aNumClients, const TBool aIncludeKern, const TBool aRefresh) sl@0: {TUint* parms[4]; \ sl@0: parms[0]=&aNumClients; \ sl@0: parms[1]=(TUint*)aIncludeKern; \ sl@0: parms[2]=(TUint*)0; /* 0 represents all clients */ \ sl@0: parms[3]=(TUint*)aRefresh; \ sl@0: return(DoControl(EGetNamesAllClients,(TAny*)aInfoPtrs,(TAny*)&parms));} sl@0: sl@0: inline TInt RBusDevResManUs::GetNumClientsUsingResource(const TUint aResourceId, TUint& aNumClients, const TBool aIncludeKern, const TBool aInfoRead) sl@0: {TUint parms[3]; \ sl@0: parms[0]=(TUint)aIncludeKern; \ sl@0: parms[1]=aResourceId; \ sl@0: parms[2]=(TUint)aInfoRead; \ sl@0: return(DoControl(EGetNumClientsUsingResource,(TAny*)&aNumClients,(TAny*)&parms));} sl@0: sl@0: inline TInt RBusDevResManUs::GetInfoOnClientsUsingResource(const TUint aResourceId, TUint& aNumClients, RSimplePointerArray* aInfoPtrs, const TBool aIncludeKern, const TBool aRefresh) sl@0: {TUint* parms[4]; \ sl@0: parms[0]=&aNumClients; \ sl@0: parms[1]=(TUint*)aIncludeKern; \ sl@0: parms[2]=(TUint*)aResourceId; \ sl@0: parms[3]=(TUint*)aRefresh; \ sl@0: return(DoControl(EGetInfoOnClientsUsingResource,(TAny*)aInfoPtrs,(TAny*)&parms));} sl@0: sl@0: inline TInt RBusDevResManUs::GetNumResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources,const TBool aInfoRead) sl@0: {TUint* parms[2]; \ sl@0: parms[0]=&aNumResources; \ sl@0: parms[1]=(TUint*)aInfoRead; \ sl@0: return(DoControl(EGetNumResourcesInUseByClient,(TAny*)&aClientName,(TAny*)&parms));} sl@0: sl@0: inline TInt RBusDevResManUs::GetInfoOnResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources, RSimplePointerArray* aInfoPtrs, const TBool aRefresh) sl@0: {TUint* parms[3]; \ sl@0: parms[0]=&aNumResources; \ sl@0: parms[1]=(TUint*)aInfoPtrs; \ sl@0: parms[2]=(TUint*)aRefresh; \ sl@0: return(DoControl(EGetInfoOnResourcesInUseByClient,(TAny*)&aClientName,(TAny*)&parms));} sl@0: sl@0: inline TInt RBusDevResManUs::GetResourceIdByName(TDesC8& aResourceName, TUint& aResourceId) sl@0: {return(DoControl(EGetResourceIdByName,(TAny*)&aResourceName,(TAny*)&aResourceId));} sl@0: sl@0: inline TInt RBusDevResManUs::GetResourceInfo(const TUint aResourceId, TResourceInfoBuf* aInfo) sl@0: {return(DoControl(EGetResourceInfo,(TAny*)aResourceId,aInfo));} sl@0: sl@0: inline TInt RBusDevResManUs::GetResourceControllerVersion(TUint& aVer) sl@0: {return(DoControl(EGetResourceControllerVersion,(TAny*)&aVer,NULL));} sl@0: sl@0: inline TInt RBusDevResManUs::GetNumDependentsForResource(const TUint aResourceId, TUint* aNumDependents, const TBool aInfoRead) sl@0: {TUint parms[2]; \ sl@0: parms[0]=aResourceId; \ sl@0: parms[1]=(TUint)aInfoRead; \ sl@0: return(DoControl(EGetNumDependentsForResource,(TAny*)aNumDependents,(TAny*)&parms));} sl@0: sl@0: inline TInt RBusDevResManUs::GetDependentsIdForResource(const TUint aResourceId, TDes8& aResIdArray, TUint* aNumDepResources, const TBool aRefresh) sl@0: { sl@0: TUint parms[3]; \ sl@0: parms[0]=aResourceId; \ sl@0: parms[1]=(TUint)(&aResIdArray); \ sl@0: parms[2]=(TUint)aRefresh; \ sl@0: return(DoControl(EGetDependentsIdForResource,(TAny*)aNumDepResources,(TAny*)&parms));} sl@0: sl@0: //Asynchronous methods sl@0: inline void RBusDevResManUs::ChangeResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TInt aNewState) sl@0: {DoRequest(EChangeResourceState,aStatus,(TAny*)aResourceId,(TAny*)aNewState);} sl@0: sl@0: inline void RBusDevResManUs::GetResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TBool aCached, TInt* aState, TInt *aLevelOwnerId) sl@0: {TInt* parms[3]; \ sl@0: parms[0]=(TInt*)aCached; \ sl@0: parms[1]=aState; \ sl@0: parms[2]=aLevelOwnerId; \ sl@0: DoRequest(EGetResourceState,aStatus,(TAny*)aResourceId,(TAny*)&parms);} sl@0: sl@0: inline void RBusDevResManUs::RequestNotification(TRequestStatus& aStatus, const TUint aResourceId) sl@0: {DoRequest(ERequestChangeNotification,aStatus,(TAny*)aResourceId);} sl@0: sl@0: inline void RBusDevResManUs::RequestNotification(TRequestStatus& aStatus, const TUint aResourceId, sl@0: const TInt aThreshold, const TBool aDirection) sl@0: {TUint parms[2]; \ sl@0: parms[0]=aResourceId; \ sl@0: parms[1]=(TUint)aDirection; \ sl@0: DoRequest(ERequestQualifiedChangeNotification, aStatus, (TAny*)aThreshold, (TAny*)(&parms[0]));} sl@0: sl@0: // Specific request cancellation functions sl@0: inline TInt RBusDevResManUs::CancelChangeResourceState (TRequestStatus& aStatus) sl@0: {return(DoControl(ECancelChangeResourceState,(TAny*)&aStatus));} sl@0: sl@0: inline TInt RBusDevResManUs::CancelGetResourceState(TRequestStatus& aStatus) sl@0: {return(DoControl(ECancelGetResourceState,(TAny*)&aStatus));} sl@0: sl@0: inline TInt RBusDevResManUs::CancelRequestNotification(TRequestStatus& aStatus) sl@0: {return(DoControl(ECancelRequestChangeNotification,(TAny*)&aStatus));} sl@0: sl@0: // Resource-specific request cancellation functions sl@0: inline TInt RBusDevResManUs::CancelChangeResourceStateRequests (const TUint aResourceId) sl@0: {return(DoControl(ECancelChangeResourceStateRequests,(TAny*)aResourceId));} sl@0: sl@0: inline TInt RBusDevResManUs::CancelGetResourceStateRequests(const TUint aResourceId) sl@0: {return(DoControl(ECancelGetResourceStateRequests,(TAny*)aResourceId));} sl@0: sl@0: inline TInt RBusDevResManUs::CancelNotificationRequests(const TUint aResourceId) sl@0: {return(DoControl(ECancelChangeNotificationRequests,(TAny*)aResourceId));} sl@0: sl@0: // Generic Cancel function sl@0: inline void RBusDevResManUs::CancelAsyncOperation(TRequestStatus* aStatus) sl@0: {DoCancel((TInt)aStatus);} sl@0: sl@0: sl@0: #ifdef RESOURCE_MANAGER_SIMULATED_PSL sl@0: // Requests to support testing sl@0: inline TInt RBusDevResManUs::GetNumCandidateAsyncResources(TUint& aNumResources) sl@0: {return(DoControl(EGetNumCandidateAsyncResources,(TAny*)&aNumResources));} sl@0: sl@0: inline TInt RBusDevResManUs::GetCandidateAsyncResourceId(TUint aIndex, TUint& aResourceId) sl@0: {return(DoControl(EGetCandidateAsyncResourceId,(TAny*)aIndex,(TAny*)&aResourceId));} sl@0: sl@0: inline TInt RBusDevResManUs::GetNumCandidateSharedResources(TUint& aNumResources) sl@0: {return(DoControl(EGetNumCandidateSharedResources,(TAny*)&aNumResources));} sl@0: sl@0: inline TInt RBusDevResManUs::GetCandidateSharedResourceId(TUint aIndex, TUint& aResourceId) sl@0: {return(DoControl(EGetCandidateSharedResourceId,(TAny*)aIndex,(TAny*)&aResourceId));} sl@0: sl@0: #endif sl@0: sl@0: #endif