0
|
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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32\include\d32resmanus.h
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@publishedPartner
|
|
21 |
@released
|
|
22 |
*/
|
|
23 |
|
|
24 |
|
|
25 |
#ifndef __D32RESMANUS_H__
|
|
26 |
#define __D32RESMANUS_H__
|
|
27 |
#include <e32cmn.h>
|
|
28 |
#include <e32ver.h>
|
|
29 |
|
|
30 |
#include <drivers/resource_category.h>
|
|
31 |
|
|
32 |
// Name lengths repesent byte length (2 bytes per character for Unicode)
|
|
33 |
#define MAX_RESOURCE_NAME_LENGTH 32 // 8-bit operation
|
|
34 |
#define MAX_NAME_LENGTH_IN_RESMAN 32 // Maximum length of 8-bit name in Resource Controller
|
|
35 |
#define MAX_CLIENT_NAME_LENGTH 256 // 8-bit operation
|
|
36 |
|
|
37 |
#ifdef RESOURCE_MANAGER_SIMULATED_PSL
|
|
38 |
#define LEVEL_GAP_REQUIRED_FOR_ASYNC_TESTING 10 // Semi-arbitrary
|
|
39 |
#define LEVEL_GAP_REQUIRED_FOR_SHARED_TESTING 3 // Semi-arbitrary
|
|
40 |
#endif
|
|
41 |
|
|
42 |
//Structure to pass the dependency information
|
|
43 |
#ifndef __KERNEL_MODE__
|
|
44 |
struct SResourceDependencyInfo
|
|
45 |
{
|
|
46 |
TUint iResourceId;
|
|
47 |
TUint8 iDependencyPriority;
|
|
48 |
};
|
|
49 |
#endif
|
|
50 |
|
|
51 |
struct TCapsDevResManUs
|
|
52 |
{
|
|
53 |
/**
|
|
54 |
* The device version
|
|
55 |
*/
|
|
56 |
TVersion version;
|
|
57 |
};
|
|
58 |
|
|
59 |
struct TResourceInfo
|
|
60 |
{
|
|
61 |
TBuf8<MAX_RESOURCE_NAME_LENGTH>iName;
|
|
62 |
TUint iId;
|
|
63 |
TResourceClass iClass;
|
|
64 |
TResourceType iType;
|
|
65 |
TResourceUsage iUsage;
|
|
66 |
TResourceSense iSense;
|
|
67 |
TInt iMinLevel;
|
|
68 |
TInt iMaxLevel;
|
|
69 |
};
|
|
70 |
typedef TPckgBuf<TResourceInfo> TResourceInfoBuf;
|
|
71 |
|
|
72 |
|
|
73 |
typedef TBuf8<MAX_NAME_LENGTH_IN_RESMAN> TClientName;
|
|
74 |
|
|
75 |
struct TClientInfo
|
|
76 |
{
|
|
77 |
TClientName iName;
|
|
78 |
TUint iId;
|
|
79 |
};
|
|
80 |
|
|
81 |
typedef TPckgBuf<TClientInfo> TClientInfoBuf;
|
|
82 |
|
|
83 |
template <class T>
|
|
84 |
class RSimplePointerArray : private RPointerArrayBase
|
|
85 |
{
|
|
86 |
public:
|
|
87 |
inline RSimplePointerArray();
|
|
88 |
inline explicit RSimplePointerArray(TInt aGranularity);
|
|
89 |
|
|
90 |
inline void Close() {RPointerArrayBase::Close();};
|
|
91 |
inline TInt Count() const {return RPointerArrayBase::Count();};
|
|
92 |
inline T* const& operator[](TInt anIndex) const {return (T* const&)At(anIndex);};
|
|
93 |
inline T*& operator[](TInt anIndex) {return (T*&)At(anIndex);};
|
|
94 |
inline TInt Append(const T* anEntry) {return RPointerArrayBase::Append(anEntry);};
|
|
95 |
inline TInt Insert(const T* anEntry, TInt aPos) {return RPointerArrayBase::Insert(anEntry,aPos);};
|
|
96 |
inline void Remove(TInt anIndex){RPointerArrayBase::Remove(anIndex);};
|
|
97 |
|
|
98 |
inline T** Entries() {return (T**)(RPointerArrayBase::Entries());};
|
|
99 |
};
|
|
100 |
|
|
101 |
template <class T>
|
|
102 |
inline RSimplePointerArray<T>::RSimplePointerArray()
|
|
103 |
: RPointerArrayBase()
|
|
104 |
{}
|
|
105 |
|
|
106 |
template <class T>
|
|
107 |
inline RSimplePointerArray<T>::RSimplePointerArray(TInt aGranularity)
|
|
108 |
: RPointerArrayBase(aGranularity)
|
|
109 |
{}
|
|
110 |
|
|
111 |
|
|
112 |
#ifdef RESOURCE_MANAGER_SIMULATED_PSL
|
|
113 |
#ifdef PRM_ENABLE_EXTENDED_VERSION2
|
|
114 |
_LIT(KLddRootName, "resourcecontrollerextendedcore");
|
|
115 |
#elif defined (PRM_ENABLE_EXTENDED_VERSION)
|
|
116 |
_LIT(KLddRootName,"resourcecontrollerextended"); // To support testing of the Extended version
|
|
117 |
#else
|
|
118 |
_LIT(KLddRootName,"resourcecontroller"); // To support testing of the basic version
|
|
119 |
#endif
|
|
120 |
#else
|
|
121 |
#ifdef PRM_ENABLE_EXTENDED_VERSION2
|
|
122 |
_LIT(KLddRootName, "resmanextendedcore");
|
|
123 |
_LIT(KLddName, "resmanextendedcore.ldd");
|
|
124 |
#elif defined(PRM_ENABLE_EXTENDED_VERSION)
|
|
125 |
_LIT(KLddRootName,"resmanextended"); // To enable operation with both the basic and Extended PDD
|
|
126 |
_LIT(KLddName, "resmanextended.ldd"); // LDD will support the Extended funcitonality
|
|
127 |
#else
|
|
128 |
_LIT(KLddRootName,"ResMan"); // To enable operation with both the basic and Extended PDD
|
|
129 |
_LIT(KLddName, "ResMan.ldd"); // LDD will support the Extended funcitonality
|
|
130 |
#endif
|
|
131 |
#endif
|
|
132 |
|
|
133 |
class RBusDevResManUs : public RBusLogicalChannel
|
|
134 |
{
|
|
135 |
enum TVer {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=KE32BuildVersionNumber};
|
|
136 |
|
|
137 |
public:
|
|
138 |
/**
|
|
139 |
* Control requests
|
|
140 |
*/
|
|
141 |
enum TControl
|
|
142 |
{
|
|
143 |
EInitialise, /**< Specify resource requirement and register */
|
|
144 |
EGetNoOfResources, /**< Read the total number of resources */
|
|
145 |
EGetAllResourcesInfo, /**< Read the info for all resources into a buffer */
|
|
146 |
EGetNoOfClients, /**< Read the total number of (Rsource Manager) clients */
|
|
147 |
EGetNamesAllClients, /**< Read the names of all clients into a buffer */
|
|
148 |
EGetNumClientsUsingResource, /**< Read the number of clients for specified resource */
|
|
149 |
EGetInfoOnClientsUsingResource, /**< Read the info for clients for specified resource */
|
|
150 |
EGetNumResourcesInUseByClient, /**< Read the number of resources registered by a client*/
|
|
151 |
EGetInfoOnResourcesInUseByClient, /**< Read the info for all resources registered by the
|
|
152 |
named client into a buffer */
|
|
153 |
EGetResourceIdByName, /**< Read the ID for a named resource */
|
|
154 |
EGetResourceInfo, /**< Read the info for specified resource to a buffer */
|
|
155 |
ECancelChangeResourceStateRequests, /**< Cancel all change state requests for a resource */
|
|
156 |
ECancelGetResourceStateRequests, /**< Cancel all get state requests for a resource */
|
|
157 |
ECancelChangeNotificationRequests, /**< Cancel all notification requests for a resource */
|
|
158 |
ECancelChangeResourceState, /**< Cancel a specific change state request */
|
|
159 |
ECancelGetResourceState, /**< Cancel a specific get state request */
|
|
160 |
ECancelRequestChangeNotification, /**< Cancel a specific notification request */
|
|
161 |
EGetResourceControllerVersion, /**< Read the version of the Resource Controller */
|
|
162 |
EGetNumDependentsForResource, /**< Read the number of dependents for a resource */
|
|
163 |
EGetDependentsIdForResource /**< Read the dependency information for a resource */
|
|
164 |
#ifdef RESOURCE_MANAGER_SIMULATED_PSL
|
|
165 |
,
|
|
166 |
// Requests to support testing
|
|
167 |
EGetNumCandidateAsyncResources,
|
|
168 |
EGetCandidateAsyncResourceId,
|
|
169 |
EGetNumCandidateSharedResources,
|
|
170 |
EGetCandidateSharedResourceId
|
|
171 |
#endif
|
|
172 |
};
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Asynchronous requests
|
|
176 |
*/
|
|
177 |
enum TRequest
|
|
178 |
{
|
|
179 |
EChangeResourceState, /**< Change the state of a resource */
|
|
180 |
EGetResourceState, /**< Get the state of a resource */
|
|
181 |
ERequestChangeNotification, /**< Register for resource change notifications */
|
|
182 |
ERequestQualifiedChangeNotification /**< Register for qualified resource change notifications */
|
|
183 |
};
|
|
184 |
|
|
185 |
#ifndef __KERNEL_MODE__
|
|
186 |
public:
|
|
187 |
|
|
188 |
inline TInt Open(TDesC8& aClientName);
|
|
189 |
inline TInt Initialise(const TUint8 aNumGetStateRes, const TUint8 aNumSetStateRes, const TUint8 aNumListenableRes);
|
|
190 |
inline TVersion VersionRequired() const;
|
|
191 |
|
|
192 |
// Synchronous requests
|
|
193 |
inline TInt GetNoOfResources(TUint& aNumResources, const TBool aInfoRead=ETrue);
|
|
194 |
inline TInt GetAllResourcesInfo(RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, TUint& aNumResources, const TBool aRefresh=EFalse);
|
|
195 |
inline TInt GetNoOfClients(TUint& aNumClients,const TBool aIncludeKern,const TBool aInfoRead=ETrue);
|
|
196 |
inline TInt GetNamesAllClients(RSimplePointerArray<TClientName>* aInfoPtrs, TUint& aNumClients, const TBool aIncludeKern, const TBool aRefresh=EFalse);
|
|
197 |
inline TInt GetNumClientsUsingResource(const TUint aResourceId, TUint& aNumClients, const TBool aIncludeKern,const TBool aInfoRead=ETrue);
|
|
198 |
inline TInt GetInfoOnClientsUsingResource(const TUint aResourceId, TUint& aNumClients, RSimplePointerArray<TClientInfoBuf>* aInfoPtrs, const TBool aIncludeKern, const TBool aRefresh=EFalse);
|
|
199 |
inline TInt GetNumResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources,const TBool aInfoRead=ETrue);
|
|
200 |
inline TInt GetInfoOnResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources, RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, const TBool aRefresh=EFalse);
|
|
201 |
|
|
202 |
inline TInt GetResourceIdByName(TDesC8& aResourceName, TUint& aResourceId);
|
|
203 |
inline TInt GetResourceInfo(const TUint aResourceId, TResourceInfoBuf* aInfo);
|
|
204 |
inline TInt GetResourceControllerVersion(TUint& aVer);
|
|
205 |
inline TInt GetNumDependentsForResource(const TUint aResourceId, TUint* aNumDependents, const TBool aInfoRead=ETrue);
|
|
206 |
inline TInt GetDependentsIdForResource(const TUint aResourceId, TDes8& aResIdArray, TUint* aNumDepResources, const TBool aRefresh=EFalse);
|
|
207 |
// Asynchronous requests
|
|
208 |
inline void ChangeResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TInt aNewState);
|
|
209 |
inline void GetResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TBool aCached, TInt* aState, TInt *aLevelOwnerId);
|
|
210 |
inline void RequestNotification(TRequestStatus& aStatus, const TUint aResourceId);
|
|
211 |
inline void RequestNotification(TRequestStatus& aStatus, const TUint aResourceId, const TInt aThreshold, const TBool aDirection);
|
|
212 |
|
|
213 |
// Cancel requests
|
|
214 |
inline TInt CancelChangeResourceStateRequests(const TUint aResourceId);
|
|
215 |
inline TInt CancelGetResourceStateRequests(const TUint aResourceId);
|
|
216 |
inline TInt CancelNotificationRequests(const TUint aResourceId);
|
|
217 |
//
|
|
218 |
inline TInt CancelChangeResourceState(TRequestStatus& aStatus);
|
|
219 |
inline TInt CancelGetResourceState(TRequestStatus& aStatus);
|
|
220 |
inline TInt CancelRequestNotification(TRequestStatus& aStatus);
|
|
221 |
//
|
|
222 |
inline void CancelAsyncOperation(TRequestStatus* aStatus);
|
|
223 |
|
|
224 |
#ifdef RESOURCE_MANAGER_SIMULATED_PSL
|
|
225 |
// Requests to support testing
|
|
226 |
inline TInt GetNumCandidateAsyncResources(TUint& aNumResources);
|
|
227 |
inline TInt GetCandidateAsyncResourceId(TUint aIndex, TUint& aResourceId);
|
|
228 |
inline TInt GetNumCandidateSharedResources(TUint& aNumResources);
|
|
229 |
inline TInt GetCandidateSharedResourceId(TUint aIndex, TUint& aResourceId);
|
|
230 |
#endif
|
|
231 |
|
|
232 |
#endif
|
|
233 |
};
|
|
234 |
|
|
235 |
|
|
236 |
#ifndef __KERNEL_MODE__
|
|
237 |
#include <d32resmanus.inl>
|
|
238 |
#endif
|
|
239 |
|
|
240 |
|
|
241 |
#endif
|