author | hgs |
Tue, 02 Nov 2010 15:42:21 +0000 | |
changeset 301 | 172f33f13d7d |
parent 269 | d57b86b1867a |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2007-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 |
// e32test\resourceman\d_rescontrolcli.h |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#ifndef __D_RESCONTROLCLI_H__ |
|
19 |
#define __D_RESCONTROLCLI_H__ |
|
20 |
||
21 |
#include <e32cmn.h> |
|
22 |
#include <e32ver.h> |
|
23 |
#ifndef __KERNEL_MODE__ |
|
24 |
#include <e32std.h> |
|
25 |
#endif |
|
26 |
||
27 |
#ifndef __KERNEL_MODE__ |
|
28 |
//Structure to pass the dependency information |
|
29 |
struct SResourceDependencyInfo |
|
30 |
{ |
|
31 |
TUint iResourceId; |
|
32 |
TUint8 iDependencyPriority; |
|
33 |
}; |
|
34 |
#endif |
|
35 |
||
36 |
#define MAX_CLIENTS 50 //Maximum clients allowed |
|
37 |
||
38 |
#ifndef PRM_ENABLE_EXTENDED_VERSION |
|
39 |
_LIT(KLddName, "D_RESCONTROLCLI.LDD"); |
|
40 |
#else |
|
41 |
_LIT(KLddName, "D_EXTENDEDRESCONTROLCLI.LDD"); |
|
42 |
#endif |
|
43 |
||
44 |
/** Struture for passing information between user and kernel side.*/ |
|
45 |
struct TParameterListInfo |
|
46 |
{ |
|
47 |
TUint iClientId; |
|
48 |
TAny* iPtr1; |
|
49 |
TAny* iPtr2; |
|
50 |
TAny* iPtr3; |
|
51 |
TAny* iPtr4; |
|
52 |
TAny* iPtr5; |
|
53 |
}; |
|
54 |
||
55 |
/** User side logical channel */ |
|
56 |
class RTestResMan : public RBusLogicalChannel |
|
57 |
{ |
|
58 |
public: |
|
59 |
// Structure for holding driver capabilities information |
|
60 |
class TCaps |
|
61 |
{ |
|
62 |
public: |
|
63 |
TVersion iVersion; |
|
64 |
}; |
|
65 |
||
66 |
private: |
|
67 |
enum TControl //Request types for synchronous operation. |
|
68 |
{ |
|
69 |
ERegisterClient, |
|
70 |
EDeRegisterClient, |
|
71 |
EGetClientName, |
|
72 |
EGetClientId, |
|
73 |
EGetResourceId, |
|
74 |
EGetResourceInfo, |
|
75 |
EGetNumResourcesInUseByClient, |
|
76 |
EGetInfoOnResourcesInUseByClient, |
|
77 |
EGetNumClientsUsingResource, |
|
78 |
EGetInfoOnClientsUsingResource, |
|
79 |
EAllocReserve, |
|
80 |
ECheckNotifications, |
|
81 |
EChangeResourceStateSync, |
|
82 |
EGetResourceStateSync, |
|
83 |
ERegisterForIdleResourcesInfo, |
|
84 |
EGetIdleResourcesInfo, |
|
85 |
EDeRegisterClientLevelFromResource, |
|
86 |
ERequestNotificationCond, |
|
87 |
ERequestNotificationUncond, |
|
88 |
ECheckPostBootLevelNotifications, |
|
89 |
ECancelNotification, |
|
90 |
EGetControllerVersion, |
|
269 | 91 |
ERegisterResourceController, |
0 | 92 |
#ifdef PRM_ENABLE_EXTENDED_VERSION |
93 |
ERegisterDynamicResource, |
|
94 |
EDeRegisterDynamicResource, |
|
95 |
ERegisterResourceDependency, |
|
96 |
EDeRegisterResourceDependency, |
|
97 |
EGetNumDependentsForResource, |
|
98 |
EGetDependentsIdForResource, |
|
99 |
#endif //PRM_ENABLE_EXTENDED_VERSION |
|
100 |
EMaxControl, |
|
101 |
}; |
|
102 |
enum TRequest //Request types for asynchronous operation |
|
103 |
{ |
|
104 |
EChangeResourceStateAsync = EMaxControl + 1, |
|
105 |
EGetResourceStateAsync, |
|
106 |
#ifdef PRM_ENABLE_EXTENDED_VERSION |
|
107 |
EChangeResStateAndDeregisterDynamicRes, |
|
108 |
ECheckParallelExecutionForChangeResState |
|
109 |
#endif |
|
110 |
}; |
|
111 |
friend class DTestResManLdd; |
|
112 |
public: |
|
113 |
TInt Open(); |
|
114 |
TInt RegisterClient(TUint& aClientId, const TDesC* aClientName, TOwnerType aType=EOwnerProcess); |
|
115 |
TInt DeRegisterClient(TUint aClientId); |
|
116 |
TInt GetClientName(TUint aClientId, TUint aTargetClientId, TDes8* aClientName); |
|
117 |
TInt GetClientId(TUint aClientId, TDesC8& aClientName, TUint& aTargetClientId); |
|
118 |
TInt GetResourceId(TUint aClientId, TDesC8& aResourceName, TUint& aResourceId); |
|
119 |
TInt GetResourceInfo(TUint aClientId, TUint aResourceId, TAny* aBuf); |
|
120 |
TInt GetNumResourcesInUseByClient(TUint aClientId, TUint aTargetClientId,TUint& aNumResources); |
|
121 |
TInt GetInfoOnResourcesInUseByClient(TUint aClientId, TUint aTargetClientId, TUint& aNumResources, TAny* info); |
|
122 |
TInt GetNumClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients); |
|
123 |
TInt GetInfoOnClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients, TAny* info); |
|
124 |
TInt AllocReserve(TUint aClientId, TUint8 aNumClientLevels, TUint8 aNumResources); |
|
125 |
TInt CheckNotifications(TUint aResourceId, TUint aUnconNoti, TUint aCondNoti); |
|
126 |
TInt ChangeResourceStateSync(TUint aClientId, TUint aResourceId, TInt aNewState); |
|
127 |
void ChangeResourceStateAsync(TUint aClientId, TUint aResourceId, TInt& aState, TRequestStatus& aStatus, TBool aReqCancel = EFalse); |
|
128 |
TInt GetResourceStateSync(TUint aClientId, TUint aResourceId, TBool aCached, TInt& aNewState, TInt& aLevelOwnerId); |
|
129 |
void GetResourceStateAsync(TUint aClientId, TUint aResourceId, TBool aCached, TRequestStatus& aStatus, TInt& aState, TInt& aLevelOwnerId, TBool aReqCancel = EFalse); |
|
130 |
TInt RequestNotification(TUint aClientId, TUint aResourceId); |
|
131 |
TInt RequestNotification(TUint aClientId, TUint aResourceId, TInt aDirection, TInt aThreshold); |
|
132 |
TInt CancelNotification(TUint aClientId, TUint aResourceId, TBool aType); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
133 |
TInt RegisterForIdleResourcesInfo(TUint aPowerControllerId, TUint aResourceNum, TAny* anInfo); |
0 | 134 |
TInt GetIdleResourcesInfo(TUint aResourceNum, TAny* info); |
135 |
TInt DeRegisterClientLevelFromResource(TInt aClientId, TUint aResId); |
|
136 |
TInt CheckPostBootLevelNotifications(); |
|
137 |
TInt GetResourceControllerVersion(TUint aClientId, TUint& aVersion); |
|
269 | 138 |
TInt CheckResourceControllerRegistration(); |
0 | 139 |
#ifdef PRM_ENABLE_EXTENDED_VERSION |
140 |
TInt RegisterDynamicResource(TUint aClientId, TUint& aResourceId); |
|
141 |
TInt DeRegisterDynamicResource(TUint aClientId, TUint aResourceId, TInt *aLevel); |
|
142 |
TInt RegisterResourceDependency(TUint aClientId, SResourceDependencyInfo aInfo1, SResourceDependencyInfo aInfo2); |
|
143 |
TInt DeRegisterResourceDependency(TUint aClientId, TUint aResourceId1, TUint aResourceId2); |
|
144 |
void ChangeResStateAndDeRegisterDynamicRes(TUint aClientId, TUint aResourceId, TInt &aLevel, TRequestStatus& aStatus); |
|
145 |
TInt GetNumDependentsForResource(TUint aClientId, TUint aResourceId, TUint& aNumDepResource); |
|
146 |
TInt GetDependentsIdForResource(TUint aClientId, TUint aResourceId, TAny* aResIdArray, TUint& aNumDepResources); |
|
147 |
void CheckParallelExecutionForChangeResState(TUint aClientId, TUint aDepResId, TInt& aDepLevel, TUint aResId, TInt aLevel, TRequestStatus& aStatus); |
|
148 |
#endif //PRM_ENABLE_EXTENDED_VERSION |
|
149 |
inline static TVersion VersionRequired(); |
|
150 |
}; |
|
151 |
||
152 |
inline TVersion RTestResMan::VersionRequired() |
|
153 |
{ |
|
154 |
const TInt KMajorVersionNumber=1; |
|
155 |
const TInt KMinorVersionNumber=0; |
|
156 |
const TInt KBuildVersionNumber=KE32BuildVersionNumber; |
|
157 |
return TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); |
|
158 |
} |
|
159 |
||
160 |
#ifndef __KERNEL_MODE__ |
|
161 |
||
162 |
/** Open a channel for the driver.This driver does not allow more than one channel open at a time. */ |
|
163 |
TInt RTestResMan::Open() |
|
164 |
{ |
|
165 |
return DoCreate(KLddName, VersionRequired(),KNullUnit,NULL,NULL); |
|
166 |
} |
|
167 |
||
168 |
/** Request to register a client with resource manager |
|
169 |
@Param - aClientId, On Success with be updated with a valid unique clientID, |
|
170 |
- aClientName, Name of the client to register with RM, |
|
171 |
- aType, Defines ownership, can be either process relative or thread relative |
|
172 |
@return- KErrNone on Sucess or one of system wide errors. |
|
173 |
*/ |
|
174 |
TInt RTestResMan::RegisterClient(TUint& aClientId, const TDesC* aClientName, TOwnerType aType) |
|
175 |
{ |
|
176 |
TParameterListInfo anInfo; |
|
177 |
anInfo.iPtr1 = (TAny*)&aClientId; |
|
178 |
anInfo.iPtr2 = (TAny*)aClientName; |
|
179 |
anInfo.iPtr3 = (TAny*)aType; |
|
180 |
return DoControl(ERegisterClient, (TAny*)&anInfo); |
|
181 |
} |
|
182 |
||
183 |
/** Request to deregister a client from RM. |
|
184 |
@Param - aClientID, The ID of the Client to deregister |
|
185 |
@return- KErrNone on Sucess or one of system wide errors. |
|
186 |
*/ |
|
187 |
TInt RTestResMan::DeRegisterClient(TUint aClientId) |
|
188 |
{ |
|
189 |
return DoControl(EDeRegisterClient, (TAny*)aClientId); |
|
190 |
} |
|
191 |
||
192 |
/** Request to obtain the name of the specified client of the RM |
|
193 |
@Param - aClientId, Requesting ClientId |
|
194 |
- aTargetClientId, Id of the client whose name is requested. |
|
195 |
- aClientName, On Success returned with client name. |
|
196 |
@return- KErrNone on Sucess or one of system wide errors. |
|
197 |
*/ |
|
198 |
TInt RTestResMan::GetClientName(TUint aClientId, TUint aTargetClientId, TDes8* aClientName) |
|
199 |
{ |
|
200 |
TParameterListInfo anInfo; |
|
201 |
anInfo.iClientId = aClientId; |
|
202 |
anInfo.iPtr1 = (TAny*)aTargetClientId; |
|
203 |
anInfo.iPtr2 = (TAny*)aClientName; |
|
204 |
return DoControl(EGetClientName, (TAny*)&anInfo); |
|
205 |
} |
|
206 |
||
207 |
/** Request to obtain the ID of the specified client of the RM |
|
208 |
@Param - aClientId, Requesting ClientId, |
|
209 |
- aClientName, Client Name whose Id is being requested, |
|
210 |
- aTargetClientId, On Success with be updated with requested client Id |
|
211 |
@return- KErrNone on Sucess or one of system wide errors. |
|
212 |
*/ |
|
213 |
TInt RTestResMan::GetClientId(TUint aClientId, TDesC8& aClientName, TUint& aTargetClientId) |
|
214 |
{ |
|
215 |
TParameterListInfo anInfo; |
|
216 |
anInfo.iClientId = aClientId; |
|
217 |
anInfo.iPtr1 = (TAny*)&aClientName; |
|
218 |
anInfo.iPtr2 = (TAny*)&aTargetClientId; |
|
219 |
return DoControl(EGetClientId, (TAny*)&anInfo); |
|
220 |
} |
|
221 |
||
222 |
/** Request to obtain the ID of the specified resource of the RM |
|
223 |
@Param - aClientId, Requesting ClientId, |
|
224 |
- aResourceName, Resource name whose ID is being requested |
|
225 |
- aResourceId, On Success returned with resource id. |
|
226 |
@return- KErrNone on Sucess or one of system wide errors. |
|
227 |
*/ |
|
228 |
TInt RTestResMan::GetResourceId(TUint aClientId, TDesC8& aResourceName, TUint& aResourceId) |
|
229 |
{ |
|
230 |
TParameterListInfo anInfo; |
|
231 |
anInfo.iClientId = aClientId; |
|
232 |
anInfo.iPtr1 = (TAny*)&aResourceName; |
|
233 |
anInfo.iPtr2 = (TAny*)&aResourceId; |
|
234 |
return DoControl(EGetResourceId, (TAny*)&anInfo); |
|
235 |
} |
|
236 |
||
237 |
/** Request to obtain the information of the specified resource |
|
238 |
@Param - aClientId, Requesting ClientId, |
|
239 |
- aResourceId, Resource Id whose information is requested |
|
240 |
- aBuf, On Success filled with resource information |
|
241 |
@return- KErrNone on Sucess or one of system wide errors. |
|
242 |
*/ |
|
243 |
TInt RTestResMan::GetResourceInfo(TUint aClientId, TUint aResourceId, TAny* aBuf) |
|
244 |
{ |
|
245 |
TParameterListInfo anInfo; |
|
246 |
anInfo.iClientId = aClientId; |
|
247 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
248 |
anInfo.iPtr2 = aBuf; |
|
249 |
return DoControl(EGetResourceInfo, (TAny*)&anInfo); |
|
250 |
} |
|
251 |
||
252 |
/** Request to obtain the number of resources the specified client has requirement on resource level. |
|
253 |
@Param - aClientId, Requesting ClientId, |
|
254 |
- aTargetClientId, ClientId, the number of resources on which it has requirement is requested. |
|
255 |
- aNumResources, On Success contains the number of resources the client has requirement |
|
256 |
@return- KErrNone on Sucess or one of system wide errors. |
|
257 |
*/ |
|
258 |
TInt RTestResMan::GetNumResourcesInUseByClient(TUint aClientId, TUint aTargetClientId,TUint& aNumResources) |
|
259 |
{ |
|
260 |
TParameterListInfo anInfo; |
|
261 |
anInfo.iClientId = aClientId; |
|
262 |
anInfo.iPtr1 = (TAny*) aTargetClientId; |
|
263 |
anInfo.iPtr2 = (TAny*)&aNumResources; |
|
264 |
return DoControl(EGetNumResourcesInUseByClient, (TAny*)&anInfo); |
|
265 |
} |
|
266 |
||
267 |
/** Request to obtain the information on resources |
|
268 |
@Param - aClientId, Requesting ClientId, |
|
269 |
- aTargetClientId, ClientId, information on all the resources on which it has requirement is requested |
|
270 |
- aNumResources, Number of resources whose information needs to be filled (size of info) |
|
271 |
- info, On sucess will be filled with resources information. |
|
272 |
@return- KErrNone on Sucess or one of system wide errors. |
|
273 |
*/ |
|
274 |
TInt RTestResMan::GetInfoOnResourcesInUseByClient(TUint aClientId, TUint aTargetClientId, TUint& aNumResources, TAny* info) |
|
275 |
{ |
|
276 |
TParameterListInfo anInfo; |
|
277 |
anInfo.iClientId = aClientId; |
|
278 |
anInfo.iPtr1 = (TAny*)aTargetClientId; |
|
279 |
anInfo.iPtr2 = (TAny*)&aNumResources; |
|
280 |
anInfo.iPtr3 = info; |
|
281 |
return DoControl(EGetInfoOnResourcesInUseByClient, (TAny*)&anInfo); |
|
282 |
} |
|
283 |
||
284 |
/** Request to obtain the number of clients holding the specified resource. |
|
285 |
@Param - aClientId, Requesting ClientId, |
|
286 |
- aResourceId, ID of the resource. |
|
287 |
- aNumClients, On Success contains the number of clients holding requirement on specified resource |
|
288 |
@return- KErrNone on Sucess or one of system wide errors. |
|
289 |
*/ |
|
290 |
TInt RTestResMan::GetNumClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients) |
|
291 |
{ |
|
292 |
TParameterListInfo anInfo; |
|
293 |
anInfo.iClientId = aClientId; |
|
294 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
295 |
anInfo.iPtr2 = (TAny*)&aNumClients; |
|
296 |
return DoControl(EGetNumClientsUsingResource, (TAny*)&anInfo); |
|
297 |
} |
|
298 |
||
299 |
/** Request to obtain the information on clients |
|
300 |
@Param - aClientId, Requesting ClientId, |
|
301 |
- aResourceId, Id of the resource |
|
302 |
- aNumClients, Number of Clients whose information needs to be filled (size of info) |
|
303 |
- info, On sucess will be filled with client information. |
|
304 |
@return- KErrNone on Sucess or one of system wide errors. |
|
305 |
*/ |
|
306 |
TInt RTestResMan::GetInfoOnClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients, TAny* info) |
|
307 |
{ |
|
308 |
TParameterListInfo anInfo; |
|
309 |
anInfo.iClientId = aClientId; |
|
310 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
311 |
anInfo.iPtr2 = (TAny*)&aNumClients; |
|
312 |
anInfo.iPtr3 = info; |
|
313 |
return DoControl(EGetInfoOnClientsUsingResource, (TAny*)&anInfo); |
|
314 |
} |
|
315 |
||
316 |
/** Request to preallocate the clientlevel and requests RM internal structures. |
|
317 |
@Param - aClientId, Requesting ClientId, |
|
318 |
- aNumClientLevels, Client Level objects to preallocate |
|
319 |
- aNumRequests, Request level objects to preallocate |
|
320 |
@return- KErrNone on Sucess or one of system wide errors. |
|
321 |
*/ |
|
322 |
TInt RTestResMan::AllocReserve(TUint aClientId, TUint8 aNumClientLevels, TUint8 aNumRequests) |
|
323 |
{ |
|
324 |
TParameterListInfo anInfo; |
|
325 |
anInfo.iClientId = aClientId; |
|
326 |
anInfo.iPtr1 = (TAny*)aNumClientLevels; |
|
327 |
anInfo.iPtr2 = (TAny*)aNumRequests; |
|
328 |
return DoControl(EAllocReserve, (TAny*)&anInfo); |
|
329 |
} |
|
330 |
||
331 |
/** Function to verify the notification sent for the earlier resource state change. |
|
332 |
@Param - aResourceId, Id of the resource whose notifications are verified. |
|
333 |
- aUncondNoti, Number of expected unconditional notification |
|
334 |
- aCondNoti, Number of expected conditional notification |
|
335 |
@return- KErrNone on Sucess or KErrUnderflow |
|
336 |
*/ |
|
337 |
TInt RTestResMan::CheckNotifications(TUint aResourceId, TUint aUncondNoti, TUint aCondNoti) |
|
338 |
{ |
|
339 |
TParameterListInfo anInfo; |
|
340 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
341 |
anInfo.iPtr2 = (TAny*)aUncondNoti; |
|
342 |
anInfo.iPtr3 = (TAny*)aCondNoti; |
|
343 |
return DoControl(ECheckNotifications, (TAny*)&anInfo); |
|
344 |
} |
|
345 |
||
346 |
/** Request to change the state of the resource synchronously |
|
347 |
@Param - aClientId, Requesting clientId |
|
348 |
- aResourceId, Id of the resource whose state change is requested. |
|
349 |
- aNewState, Requested new state |
|
350 |
@return- KErrNone on Sucess or one of system wide errors. |
|
351 |
*/ |
|
352 |
TInt RTestResMan::ChangeResourceStateSync(TUint aClientId, TUint aResourceId, TInt aNewState) |
|
353 |
{ |
|
354 |
TParameterListInfo anInfo; |
|
355 |
anInfo.iClientId = aClientId; |
|
356 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
357 |
anInfo.iPtr2 = (TAny*)aNewState; |
|
358 |
return DoControl(EChangeResourceStateSync, (TAny*)&anInfo); |
|
359 |
} |
|
360 |
||
361 |
/** Request to change the state of the resource asynchronously |
|
362 |
@Param - aClientId, Requesting clientId |
|
363 |
- aResourceId, Id of the resource whose state change is requested. |
|
364 |
- aState, Requested new state |
|
365 |
- aStatus, TRequestStatus object to indicate completion of operation |
|
366 |
- aReqCancel, If true CancelAsyncOperation API of RM is called immediately after asynchronos request operation |
|
367 |
*/ |
|
368 |
void RTestResMan::ChangeResourceStateAsync(TUint aClientId, TUint aResourceId, TInt& aState, TRequestStatus& aStatus, TBool aReqCancel) |
|
369 |
{ |
|
370 |
TParameterListInfo anInfo; |
|
371 |
anInfo.iClientId = aClientId; |
|
372 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
373 |
anInfo.iPtr2 = (TAny*)&aState; |
|
374 |
anInfo.iPtr3 = (TAny*)aReqCancel; |
|
375 |
DoRequest(EChangeResourceStateAsync, aStatus, (TAny*)&anInfo); |
|
376 |
} |
|
377 |
||
378 |
/** Request to obtain the state of the resource synchronously |
|
379 |
@Param - aClientId, Requesting clientId |
|
380 |
- aResourceId, Id of the resource whose state change is requested. |
|
381 |
- aCached, if true requesting for cached value |
|
382 |
- aNewState, On success returns the new state |
|
383 |
- aLevelOwnerId, On success returns the Id of the client currently holding the resource. |
|
384 |
@return- KErrNone on Sucess or one of system wide errors. |
|
385 |
*/ |
|
386 |
TInt RTestResMan::GetResourceStateSync(TUint aClientId, TUint aResourceId, TBool aCached, TInt& aNewState, TInt& aLevelOwnerId) |
|
387 |
{ |
|
388 |
TParameterListInfo anInfo; |
|
389 |
anInfo.iClientId = aClientId; |
|
390 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
391 |
anInfo.iPtr2 = (TAny*)aCached; |
|
392 |
anInfo.iPtr3 = (TAny*)&aNewState; |
|
393 |
anInfo.iPtr4 = (TAny*)&aLevelOwnerId; |
|
394 |
return DoControl(EGetResourceStateSync, (TAny*)&anInfo); |
|
395 |
} |
|
396 |
||
397 |
/** Request to obtain the state of the resource asynchronously |
|
398 |
@Param - aClientId, Requesting clientId |
|
399 |
- aResourceId, Id of the resource whose state change is requested. |
|
400 |
- aCached, if true requesting for cached value |
|
401 |
- aStatus, TRequestStatus object to indicate completion of operation |
|
402 |
- aReqCancel, If true CancelAsyncOperation API of RM is called immediately after asynchronos request operation |
|
403 |
*/ |
|
404 |
void RTestResMan::GetResourceStateAsync(TUint aClientId, TUint aResourceId, TBool aCached, TRequestStatus& aStatus, TInt& aState, TInt& aLevelOwnerId, TBool aReqCancel) |
|
405 |
{ |
|
406 |
TParameterListInfo anInfo; |
|
407 |
anInfo.iClientId = aClientId; |
|
408 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
409 |
anInfo.iPtr2 = (TAny*)aCached; |
|
410 |
anInfo.iPtr3 = (TAny*)aReqCancel; |
|
411 |
anInfo.iPtr4 = (TAny*)&aState; |
|
412 |
anInfo.iPtr5 = (TAny*)&aLevelOwnerId; |
|
413 |
DoRequest(EGetResourceStateAsync, aStatus, (TAny*)&anInfo); |
|
414 |
} |
|
415 |
||
416 |
/** Request to notify when the state of the specified resource changes |
|
417 |
@Param - aClientId, Requesting clientId, |
|
418 |
- aResourceId, ID of the resource |
|
419 |
@return- KErrNone on Sucess or one of system wide errors. |
|
420 |
*/ |
|
421 |
TInt RTestResMan::RequestNotification(TUint aClientId, TUint aResourceId) |
|
422 |
{ |
|
423 |
return DoControl(ERequestNotificationUncond, (TAny*)aClientId, (TAny*)aResourceId); |
|
424 |
} |
|
425 |
||
426 |
/** Request to notify when the state of the specified resource change crosses the threshold in the specified direction |
|
427 |
@Param - aClientId, Requesting clientId, |
|
428 |
- aResourceId, ID of the resource, |
|
429 |
- aDirection, Direction of change of the resource state that will trigger the notification |
|
430 |
- aThreshold, Level of resource state that will trigger the notifications when reached. |
|
431 |
@return- KErrNone on Sucess or one of system wide errors. |
|
432 |
*/ |
|
433 |
TInt RTestResMan::RequestNotification(TUint aClientId, TUint aResourceId, TInt aDirection, TInt aThreshold) |
|
434 |
{ |
|
435 |
TParameterListInfo anInfo; |
|
436 |
anInfo.iClientId = aClientId; |
|
437 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
438 |
anInfo.iPtr2 = (TAny*)aThreshold; |
|
439 |
anInfo.iPtr3 = (TAny*)aDirection; |
|
440 |
return DoControl(ERequestNotificationCond, (TAny*)&anInfo); |
|
441 |
} |
|
442 |
||
443 |
/** Request to cancel the previously requested notification |
|
444 |
@Param - aClientId, Requesting clientId |
|
445 |
- aResourceId, ID of the resource |
|
446 |
- aType, ETrue Conditional |
|
447 |
@return- KErrCancel on Sucess or one of system wide errors. |
|
448 |
*/ |
|
449 |
TInt RTestResMan::CancelNotification(TUint aClientId, TUint aResourceId, TBool aType) |
|
450 |
{ |
|
451 |
TParameterListInfo anInfo; |
|
452 |
anInfo.iClientId = aClientId; |
|
453 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
454 |
anInfo.iPtr2 = (TAny*)aType; |
|
455 |
return DoControl(ECancelNotification, (TAny*)&anInfo); |
|
456 |
} |
|
457 |
||
458 |
/** Request to register the specified number of resources to RM to keep the list updated with the |
|
459 |
cached value of the resources and owner of the resources. This is used for testing of the API. |
|
460 |
@Param - aResourceNum - Number of resource, whose information needs to be cached |
|
461 |
@return- KErrNone on Sucess or one of system wide errors. |
|
462 |
*/ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
463 |
TInt RTestResMan::RegisterForIdleResourcesInfo(TUint aPowerControllerId, TUint aResourceNum, TAny* aPtr) |
0 | 464 |
{ |
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
465 |
TParameterListInfo anInfo; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
466 |
anInfo.iClientId = aPowerControllerId; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
467 |
anInfo.iPtr1 = (TAny*)aResourceNum; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
468 |
anInfo.iPtr2 = (TAny*)aPtr; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
469 |
return DoControl(ERegisterForIdleResourcesInfo, (TAny*)&anInfo); |
0 | 470 |
} |
471 |
||
472 |
/** Request to Deregister client level from resource. |
|
473 |
@Param - aClientId - ID of the client requesting deregistration. |
|
474 |
@Param - aResId - ID of the resource from which to deregister the client level of requested client. |
|
475 |
@return KErrNone on Sucess or one of system wide errors. |
|
476 |
*/ |
|
477 |
TInt RTestResMan::DeRegisterClientLevelFromResource(TInt aClientId, TUint aResId) |
|
478 |
{ |
|
479 |
return DoControl(EDeRegisterClientLevelFromResource, (TAny*)aClientId, (TAny*)aResId); |
|
480 |
} |
|
481 |
||
482 |
||
483 |
/** Request to get the information of the all the resources cached by RM as requested by |
|
484 |
RegisterForIdleResourcesInfo API |
|
485 |
@Param - aResourceNum - Number of resources (size of info) |
|
486 |
- info, On success returns with resource infomations |
|
487 |
@return- KErrNone on Sucess or one of system wide errors. |
|
488 |
*/ |
|
489 |
TInt RTestResMan::GetIdleResourcesInfo(TUint aResourceNum, TAny* info) |
|
490 |
{ |
|
491 |
return DoControl(EGetIdleResourcesInfo, (TAny*)aResourceNum, (TAny*)info); |
|
492 |
} |
|
493 |
||
494 |
/** Request to check the notifications recieved as a result of postboot level setting. |
|
495 |
@return KErrNone on success or one of system wide errors. |
|
496 |
*/ |
|
497 |
TInt RTestResMan::CheckPostBootLevelNotifications() |
|
498 |
{ |
|
499 |
return DoControl(ECheckPostBootLevelNotifications, (TAny*)NULL, (TAny*)NULL); |
|
500 |
} |
|
501 |
||
502 |
/** Get the version of Resource Controller |
|
503 |
@Param - aClientId - Id of the client requesting version information |
|
504 |
@Param - aVersion - Version will be updated. 0 - Basic, 1- extended version |
|
505 |
@return KErrNone on success or one of system wide errors. |
|
506 |
*/ |
|
507 |
TInt RTestResMan::GetResourceControllerVersion(TUint aClientId, TUint& aVersion) |
|
508 |
{ |
|
509 |
return DoControl(EGetControllerVersion, (TAny*)aClientId, (TAny*)&aVersion); |
|
510 |
} |
|
511 |
||
269 | 512 |
TInt RTestResMan::CheckResourceControllerRegistration() |
513 |
{ |
|
514 |
return DoControl(ERegisterResourceController, (TAny*)NULL, (TAny*)NULL); |
|
515 |
} |
|
516 |
||
0 | 517 |
#ifdef PRM_ENABLE_EXTENDED_VERSION |
518 |
/** Register dynamic resource. |
|
519 |
@Param - aClientId - Id of the client that is registering the dynamic resource |
|
520 |
@Param - aResourceId - On success will be updated with the resource id allocated for this resource |
|
521 |
@return KErrNone on success or one of system wide errors. |
|
522 |
*/ |
|
523 |
TInt RTestResMan::RegisterDynamicResource(TUint aClientId, TUint& aResourceId) |
|
524 |
{ |
|
525 |
return DoControl(ERegisterDynamicResource, (TAny*)aClientId, (TAny*)&aResourceId); |
|
526 |
} |
|
527 |
||
528 |
/** Deregister dynamic resource. |
|
529 |
@Param - aClientId - Id of the client that is deregistering the dynamic resource |
|
530 |
@Param - aResourceId - Id of the dynamic resource to deregister |
|
531 |
@Param - aLevel - Pointer to the required final state. |
|
532 |
@return KErrNone on success or one of system wide errors. |
|
533 |
*/ |
|
534 |
TInt RTestResMan::DeRegisterDynamicResource(TUint aClientId, TUint aResourceId, TInt *aLevel) |
|
535 |
{ |
|
536 |
TParameterListInfo anInfo; |
|
537 |
anInfo.iClientId = aClientId; |
|
538 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
539 |
anInfo.iPtr2 = (TAny*)aLevel; |
|
540 |
return DoControl(EDeRegisterDynamicResource, (TAny*)&anInfo); |
|
541 |
} |
|
542 |
||
543 |
/** Change the resource state asynchronously and immediately try to deregister dynamic resource. |
|
544 |
@Param - aClientId - Id of the client that is requesting the resource state change. |
|
545 |
@Param - aResourceId - Id of the resource whose state change is requested. |
|
546 |
@Param - aLevel - Requested new state |
|
547 |
@Param - aStatus, TRequestStatus object to indicate completion of operation |
|
548 |
@return KErrNone on success or one of system wide errors. |
|
549 |
*/ |
|
550 |
void RTestResMan::ChangeResStateAndDeRegisterDynamicRes(TUint aClientId, TUint aResourceId, TInt &aLevel, TRequestStatus &aStatus) |
|
551 |
{ |
|
552 |
TParameterListInfo anInfo; |
|
553 |
anInfo.iClientId = aClientId; |
|
554 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
555 |
anInfo.iPtr2 = (TAny*)&aLevel; |
|
556 |
DoRequest(EChangeResStateAndDeregisterDynamicRes, aStatus, (TAny*)&anInfo); |
|
557 |
} |
|
558 |
||
559 |
/** Register depedency between resources. |
|
560 |
@Param - aClientId - Id of the client that is establishing the dependency. |
|
561 |
@Param - aInfo1 - Infomation about the first resource in the dependency link. |
|
562 |
@Param - aInfo2 - Information about the second resource in the dependency link. |
|
563 |
@return KErrNone on success or one of the system wide errors. |
|
564 |
*/ |
|
565 |
TInt RTestResMan::RegisterResourceDependency(TUint aClientId, SResourceDependencyInfo aInfo1, SResourceDependencyInfo aInfo2) |
|
566 |
{ |
|
567 |
TParameterListInfo anInfo; |
|
568 |
anInfo.iClientId = aClientId; |
|
569 |
anInfo.iPtr1 = (TAny*)&aInfo1; |
|
570 |
anInfo.iPtr2 = (TAny*)&aInfo2; |
|
571 |
return DoControl(ERegisterResourceDependency, (TAny*)&anInfo); |
|
572 |
} |
|
573 |
||
574 |
/** Deregister dependency between resources. |
|
575 |
@Param - aClientId - Id of the client that is deregistering the resource dependency |
|
576 |
@Param - aResourceId1 - Id of the first resource in the dependency link that is being deregistered. |
|
577 |
@Param - aResourceId2 - Id of the second resource in the dependency link that is being deregistered. |
|
578 |
@return KErrNone on success or one of the system wide errors. |
|
579 |
*/ |
|
580 |
TInt RTestResMan::DeRegisterResourceDependency(TUint aClientId, TUint aResourceId1, TUint aResourceId2) |
|
581 |
{ |
|
582 |
TParameterListInfo anInfo; |
|
583 |
anInfo.iClientId = aClientId; |
|
584 |
anInfo.iPtr1 = (TAny*)aResourceId1; |
|
585 |
anInfo.iPtr2 = (TAny*)aResourceId2; |
|
586 |
return DoControl(EDeRegisterResourceDependency, (TAny*)&anInfo); |
|
587 |
} |
|
588 |
||
589 |
/** Get number of dependents for the specified resource |
|
590 |
@Param - aClientId - Id of the client that is requesting dependents count |
|
591 |
@Param - aResourceId - Id of the resource whose number of dependents is requested. |
|
592 |
@Param - aNumDepResource - On success will be updated with number of dependents. |
|
593 |
@return KErrNone on success or one of the system wide errors. |
|
594 |
*/ |
|
595 |
TInt RTestResMan::GetNumDependentsForResource(TUint aClientId, TUint aResourceId, TUint& aNumDepResource) |
|
596 |
{ |
|
597 |
TParameterListInfo anInfo; |
|
598 |
anInfo.iClientId = aClientId; |
|
599 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
600 |
anInfo.iPtr2 = (TAny*)&aNumDepResource; |
|
601 |
return DoControl(EGetNumDependentsForResource, (TAny*)&anInfo); |
|
602 |
} |
|
603 |
||
604 |
/** Get dependent resource id's for the specified resource |
|
605 |
@Param - aClientId - Id of the client that is requesting the dependent id list. |
|
606 |
@Param - aResIdArray - On success will be updated with dependent resource id. |
|
607 |
@Param - aNumDepResources - Will be updated with actual number of dependents. |
|
608 |
@return KErrNone on success or one of the system wide errors. |
|
609 |
*/ |
|
610 |
TInt RTestResMan::GetDependentsIdForResource(TUint aClientId, TUint aResourceId, TAny* aResIdArray, TUint& aNumDepResources) |
|
611 |
{ |
|
612 |
TParameterListInfo anInfo; |
|
613 |
anInfo.iClientId = aClientId; |
|
614 |
anInfo.iPtr1 = (TAny*)aResourceId; |
|
615 |
anInfo.iPtr2 = (TAny*)aResIdArray; |
|
616 |
anInfo.iPtr3 = (TAny*)&aNumDepResources; |
|
617 |
return DoControl(EGetDependentsIdForResource, (TAny*)&anInfo); |
|
618 |
} |
|
619 |
/** Checks for state change of dependency resource while deregistering the non-dependency resource. |
|
620 |
@Param - aClientId - Id of the client that is requesting this operation |
|
621 |
@Param - aDepResInfo - Embeds resource id, level and status for dependency resource |
|
622 |
@Param - aDepLevel - the level to which the dependency resource is moved to. |
|
623 |
@Param - aResId - Id of the static resource. |
|
624 |
@Param - aLevel - the level to which the static resource is moved to. |
|
625 |
@Param - aStatus - to recieve the status of asynchronous operation. |
|
626 |
@return KErrNone on success or one of the system wide errors. |
|
627 |
*/ |
|
628 |
void RTestResMan::CheckParallelExecutionForChangeResState(TUint aClientId, TUint aDepResId, TInt& aDepLevel, |
|
629 |
TUint aResId, TInt aLevel, TRequestStatus& aStatus) |
|
630 |
{ |
|
631 |
TParameterListInfo anInfo; |
|
632 |
anInfo.iClientId = aClientId; |
|
633 |
anInfo.iPtr1 = (TAny*)aDepResId; |
|
634 |
anInfo.iPtr2 = (TAny*)&aDepLevel; |
|
635 |
anInfo.iPtr3 = (TAny*)aResId; |
|
636 |
anInfo.iPtr4 = (TAny*)aLevel; |
|
637 |
DoRequest(ECheckParallelExecutionForChangeResState, aStatus, (TAny*)&anInfo); |
|
638 |
} |
|
639 |
#endif //PRM_ENABLE_EXTENDED_VERSION |
|
640 |
||
641 |
#endif //__KERNEL_MODE__ |
|
642 |
#endif //__D_RESCONTROLCLI_H__ |