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