Update contrib.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\include\d32resmanus.inl
16 // WARNING: This file contains some APIs which are internal and are subject
17 // to change without noticed. Such APIs should therefore not be used
18 // outside the Kernel and Hardware Services package.
23 #ifdef RESOURCE_MANAGER_SIMULATED_PSL
24 #ifdef PRM_ENABLE_EXTENDED_VERSION2
25 _LIT(KPddName, "resourcecontrollerextendedcore.pdd");
26 #elif defined(PRM_ENABLE_EXTENDED_VERSION)
27 _LIT(KPddName,"resourcecontrollerextended.pdd"); // To support testing of the Extended version of the PDD
29 _LIT(KPddName,"resourcecontroller.pdd");
32 #ifdef PRM_ENABLE_EXTENDED_VERSION2
33 _LIT(KPddName, "resmanextendedcore.pdd");
34 #elif defined(PRM_ENABLE_EXTENDED_VERSION)
35 _LIT(KPddName, "resmanextended.pdd"); // To enable operation with the extended version of the PDD
37 _LIT(KPddName, "ResMan.pdd"); // To enable operation with the basic PDD
41 inline TInt RBusDevResManUs::Open(TDesC8& aClientName)
42 {return(DoCreate(KLddRootName,VersionRequired(),-1,&KPddName,(TDesC8*)&(aClientName),EOwnerThread));}
44 inline TVersion RBusDevResManUs::VersionRequired() const
45 {return(TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber));}
47 inline TInt RBusDevResManUs::Initialise(const TUint8 aNumGetStateRes, const TUint8 aNumSetStateRes, const TUint8 aNumListenableRes)
48 {TUint8 stateRes[3]; \
49 stateRes[0]=aNumGetStateRes; \
50 stateRes[1]=aNumSetStateRes; \
51 stateRes[2]=aNumListenableRes; \
52 TInt r= DoControl(EInitialise,(TAny *)&stateRes); \
55 // Synchronous methods
56 inline TInt RBusDevResManUs::GetNoOfResources(TUint& aNumResources, const TBool aInfoRead)
57 {return(DoControl(EGetNoOfResources,(TAny*)&aNumResources, (TAny*)aInfoRead));}
59 inline TInt RBusDevResManUs::GetAllResourcesInfo(RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, TUint& aNumResources, const TBool aRefresh)
61 parms[0]=&aNumResources; \
62 parms[1]=(TUint*)aRefresh; \
63 return(DoControl(EGetAllResourcesInfo,(TAny*)aInfoPtrs,(TAny*)&parms));}
65 inline TInt RBusDevResManUs::GetNoOfClients(TUint& aNumClients, const TBool aIncludeKern, const TBool aInfoRead)
67 parms[0]=(TUint)aIncludeKern; \
68 parms[1]=0; /* 0 represents all clients */ \
69 parms[2]=(TUint)aInfoRead; \
70 return(DoControl(EGetNoOfClients,(TAny*)&aNumClients,(TAny*)&parms));}
72 inline TInt RBusDevResManUs::GetNamesAllClients(RSimplePointerArray<TClientName>* aInfoPtrs, TUint& aNumClients, const TBool aIncludeKern, const TBool aRefresh)
74 parms[0]=&aNumClients; \
75 parms[1]=(TUint*)aIncludeKern; \
76 parms[2]=(TUint*)0; /* 0 represents all clients */ \
77 parms[3]=(TUint*)aRefresh; \
78 return(DoControl(EGetNamesAllClients,(TAny*)aInfoPtrs,(TAny*)&parms));}
80 inline TInt RBusDevResManUs::GetNumClientsUsingResource(const TUint aResourceId, TUint& aNumClients, const TBool aIncludeKern, const TBool aInfoRead)
82 parms[0]=(TUint)aIncludeKern; \
83 parms[1]=aResourceId; \
84 parms[2]=(TUint)aInfoRead; \
85 return(DoControl(EGetNumClientsUsingResource,(TAny*)&aNumClients,(TAny*)&parms));}
87 inline TInt RBusDevResManUs::GetInfoOnClientsUsingResource(const TUint aResourceId, TUint& aNumClients, RSimplePointerArray<TClientInfoBuf>* aInfoPtrs, const TBool aIncludeKern, const TBool aRefresh)
89 parms[0]=&aNumClients; \
90 parms[1]=(TUint*)aIncludeKern; \
91 parms[2]=(TUint*)aResourceId; \
92 parms[3]=(TUint*)aRefresh; \
93 return(DoControl(EGetInfoOnClientsUsingResource,(TAny*)aInfoPtrs,(TAny*)&parms));}
95 inline TInt RBusDevResManUs::GetNumResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources,const TBool aInfoRead)
97 parms[0]=&aNumResources; \
98 parms[1]=(TUint*)aInfoRead; \
99 return(DoControl(EGetNumResourcesInUseByClient,(TAny*)&aClientName,(TAny*)&parms));}
101 inline TInt RBusDevResManUs::GetInfoOnResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources, RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, const TBool aRefresh)
103 parms[0]=&aNumResources; \
104 parms[1]=(TUint*)aInfoPtrs; \
105 parms[2]=(TUint*)aRefresh; \
106 return(DoControl(EGetInfoOnResourcesInUseByClient,(TAny*)&aClientName,(TAny*)&parms));}
108 inline TInt RBusDevResManUs::GetResourceIdByName(TDesC8& aResourceName, TUint& aResourceId)
109 {return(DoControl(EGetResourceIdByName,(TAny*)&aResourceName,(TAny*)&aResourceId));}
111 inline TInt RBusDevResManUs::GetResourceInfo(const TUint aResourceId, TResourceInfoBuf* aInfo)
112 {return(DoControl(EGetResourceInfo,(TAny*)aResourceId,aInfo));}
114 inline TInt RBusDevResManUs::GetResourceControllerVersion(TUint& aVer)
115 {return(DoControl(EGetResourceControllerVersion,(TAny*)&aVer,NULL));}
117 inline TInt RBusDevResManUs::GetNumDependentsForResource(const TUint aResourceId, TUint* aNumDependents, const TBool aInfoRead)
119 parms[0]=aResourceId; \
120 parms[1]=(TUint)aInfoRead; \
121 return(DoControl(EGetNumDependentsForResource,(TAny*)aNumDependents,(TAny*)&parms));}
123 inline TInt RBusDevResManUs::GetDependentsIdForResource(const TUint aResourceId, TDes8& aResIdArray, TUint* aNumDepResources, const TBool aRefresh)
126 parms[0]=aResourceId; \
127 parms[1]=(TUint)(&aResIdArray); \
128 parms[2]=(TUint)aRefresh; \
129 return(DoControl(EGetDependentsIdForResource,(TAny*)aNumDepResources,(TAny*)&parms));}
131 //Asynchronous methods
132 inline void RBusDevResManUs::ChangeResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TInt aNewState)
133 {DoRequest(EChangeResourceState,aStatus,(TAny*)aResourceId,(TAny*)aNewState);}
135 inline void RBusDevResManUs::GetResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TBool aCached, TInt* aState, TInt *aLevelOwnerId)
137 parms[0]=(TInt*)aCached; \
139 parms[2]=aLevelOwnerId; \
140 DoRequest(EGetResourceState,aStatus,(TAny*)aResourceId,(TAny*)&parms);}
142 inline void RBusDevResManUs::RequestNotification(TRequestStatus& aStatus, const TUint aResourceId)
143 {DoRequest(ERequestChangeNotification,aStatus,(TAny*)aResourceId);}
145 inline void RBusDevResManUs::RequestNotification(TRequestStatus& aStatus, const TUint aResourceId,
146 const TInt aThreshold, const TBool aDirection)
148 parms[0]=aResourceId; \
149 parms[1]=(TUint)aDirection; \
150 DoRequest(ERequestQualifiedChangeNotification, aStatus, (TAny*)aThreshold, (TAny*)(&parms[0]));}
152 // Specific request cancellation functions
153 inline TInt RBusDevResManUs::CancelChangeResourceState (TRequestStatus& aStatus)
154 {return(DoControl(ECancelChangeResourceState,(TAny*)&aStatus));}
156 inline TInt RBusDevResManUs::CancelGetResourceState(TRequestStatus& aStatus)
157 {return(DoControl(ECancelGetResourceState,(TAny*)&aStatus));}
159 inline TInt RBusDevResManUs::CancelRequestNotification(TRequestStatus& aStatus)
160 {return(DoControl(ECancelRequestChangeNotification,(TAny*)&aStatus));}
162 // Resource-specific request cancellation functions
163 inline TInt RBusDevResManUs::CancelChangeResourceStateRequests (const TUint aResourceId)
164 {return(DoControl(ECancelChangeResourceStateRequests,(TAny*)aResourceId));}
166 inline TInt RBusDevResManUs::CancelGetResourceStateRequests(const TUint aResourceId)
167 {return(DoControl(ECancelGetResourceStateRequests,(TAny*)aResourceId));}
169 inline TInt RBusDevResManUs::CancelNotificationRequests(const TUint aResourceId)
170 {return(DoControl(ECancelChangeNotificationRequests,(TAny*)aResourceId));}
172 // Generic Cancel function
173 inline void RBusDevResManUs::CancelAsyncOperation(TRequestStatus* aStatus)
174 {DoCancel((TInt)aStatus);}
177 #ifdef RESOURCE_MANAGER_SIMULATED_PSL
178 // Requests to support testing
179 inline TInt RBusDevResManUs::GetNumCandidateAsyncResources(TUint& aNumResources)
180 {return(DoControl(EGetNumCandidateAsyncResources,(TAny*)&aNumResources));}
182 inline TInt RBusDevResManUs::GetCandidateAsyncResourceId(TUint aIndex, TUint& aResourceId)
183 {return(DoControl(EGetCandidateAsyncResourceId,(TAny*)aIndex,(TAny*)&aResourceId));}
185 inline TInt RBusDevResManUs::GetNumCandidateSharedResources(TUint& aNumResources)
186 {return(DoControl(EGetNumCandidateSharedResources,(TAny*)&aNumResources));}
188 inline TInt RBusDevResManUs::GetCandidateSharedResourceId(TUint aIndex, TUint& aResourceId)
189 {return(DoControl(EGetCandidateSharedResourceId,(TAny*)aIndex,(TAny*)&aResourceId));}