os/kernelhwsrv/kerneltest/e32test/resourceman/d_rescontrolcli.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/resourceman/d_rescontrolcli.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,635 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32test\resourceman\d_rescontrolcli.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __D_RESCONTROLCLI_H__
    1.22 +#define __D_RESCONTROLCLI_H__
    1.23 +
    1.24 +#include <e32cmn.h>
    1.25 +#include <e32ver.h>
    1.26 +#ifndef __KERNEL_MODE__
    1.27 +#include <e32std.h>
    1.28 +#endif   
    1.29 +
    1.30 +#ifndef __KERNEL_MODE__
    1.31 +//Structure to pass the dependency information
    1.32 +struct SResourceDependencyInfo
    1.33 +	{
    1.34 +	TUint iResourceId;
    1.35 +	TUint8 iDependencyPriority;
    1.36 +	};
    1.37 +#endif
    1.38 +
    1.39 +#define MAX_CLIENTS 50 //Maximum clients allowed
    1.40 +
    1.41 +#ifndef PRM_ENABLE_EXTENDED_VERSION
    1.42 +_LIT(KLddName, "D_RESCONTROLCLI.LDD");
    1.43 +#else
    1.44 +_LIT(KLddName, "D_EXTENDEDRESCONTROLCLI.LDD");
    1.45 +#endif
    1.46 +
    1.47 +/** Struture for passing information between user and kernel side.*/
    1.48 +struct TParameterListInfo
    1.49 +	{
    1.50 +	TUint iClientId;
    1.51 +	TAny* iPtr1;
    1.52 +	TAny* iPtr2;
    1.53 +	TAny* iPtr3;
    1.54 +	TAny* iPtr4;
    1.55 +	TAny* iPtr5;
    1.56 +	};
    1.57 +
    1.58 +/** User side logical channel */
    1.59 +class RTestResMan : public RBusLogicalChannel
    1.60 +	{
    1.61 +public:
    1.62 +	// Structure for holding driver capabilities information
    1.63 +	class TCaps
    1.64 +		{
    1.65 +	public:
    1.66 +		TVersion iVersion;
    1.67 +		};
    1.68 +
    1.69 +private:
    1.70 +	enum TControl //Request types for synchronous operation.
    1.71 +		{ 
    1.72 +		ERegisterClient,
    1.73 +		EDeRegisterClient,
    1.74 +		EGetClientName,
    1.75 +		EGetClientId,
    1.76 +		EGetResourceId,
    1.77 +		EGetResourceInfo,
    1.78 +		EGetNumResourcesInUseByClient,
    1.79 +		EGetInfoOnResourcesInUseByClient,
    1.80 +		EGetNumClientsUsingResource,
    1.81 +		EGetInfoOnClientsUsingResource,
    1.82 +		EAllocReserve,
    1.83 +		ECheckNotifications,
    1.84 +		EChangeResourceStateSync,
    1.85 +		EGetResourceStateSync,
    1.86 +		ERegisterForIdleResourcesInfo,
    1.87 +		EGetIdleResourcesInfo,
    1.88 +		EDeRegisterClientLevelFromResource,
    1.89 +		ERequestNotificationCond,
    1.90 +		ERequestNotificationUncond,
    1.91 +		ECheckPostBootLevelNotifications,
    1.92 +		ECancelNotification, 
    1.93 +		EGetControllerVersion,
    1.94 +#ifdef PRM_ENABLE_EXTENDED_VERSION
    1.95 +		ERegisterDynamicResource,
    1.96 +		EDeRegisterDynamicResource,
    1.97 +		ERegisterResourceDependency,
    1.98 +		EDeRegisterResourceDependency,
    1.99 +		EGetNumDependentsForResource,
   1.100 +		EGetDependentsIdForResource,
   1.101 +#endif //PRM_ENABLE_EXTENDED_VERSION
   1.102 +		EMaxControl,
   1.103 +		};
   1.104 +	enum TRequest //Request types for asynchronous operation
   1.105 +		{
   1.106 +		EChangeResourceStateAsync = EMaxControl + 1,
   1.107 +	    EGetResourceStateAsync, 
   1.108 +#ifdef PRM_ENABLE_EXTENDED_VERSION
   1.109 +		EChangeResStateAndDeregisterDynamicRes,
   1.110 +		ECheckParallelExecutionForChangeResState
   1.111 +#endif
   1.112 +		};
   1.113 +	friend class DTestResManLdd;
   1.114 +public:
   1.115 +   	TInt Open();
   1.116 +    TInt RegisterClient(TUint& aClientId, const TDesC* aClientName, TOwnerType aType=EOwnerProcess);
   1.117 +    TInt DeRegisterClient(TUint aClientId);
   1.118 +    TInt GetClientName(TUint aClientId, TUint aTargetClientId, TDes8* aClientName);
   1.119 +    TInt GetClientId(TUint aClientId, TDesC8& aClientName, TUint& aTargetClientId);
   1.120 +    TInt GetResourceId(TUint aClientId, TDesC8& aResourceName, TUint& aResourceId);
   1.121 +    TInt GetResourceInfo(TUint aClientId, TUint aResourceId, TAny* aBuf);
   1.122 +    TInt GetNumResourcesInUseByClient(TUint aClientId, TUint aTargetClientId,TUint& aNumResources);
   1.123 +    TInt GetInfoOnResourcesInUseByClient(TUint aClientId, TUint aTargetClientId, TUint& aNumResources, TAny* info);
   1.124 +    TInt GetNumClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients);
   1.125 +    TInt GetInfoOnClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients, TAny* info);
   1.126 +    TInt AllocReserve(TUint aClientId, TUint8 aNumClientLevels, TUint8 aNumResources);
   1.127 +    TInt CheckNotifications(TUint aResourceId, TUint aUnconNoti, TUint aCondNoti);
   1.128 +    TInt ChangeResourceStateSync(TUint aClientId, TUint aResourceId, TInt aNewState);
   1.129 +    void ChangeResourceStateAsync(TUint aClientId, TUint aResourceId, TInt& aState, TRequestStatus& aStatus, TBool aReqCancel = EFalse);
   1.130 +    TInt GetResourceStateSync(TUint aClientId, TUint aResourceId, TBool aCached, TInt& aNewState, TInt& aLevelOwnerId);
   1.131 +    void GetResourceStateAsync(TUint aClientId, TUint aResourceId, TBool aCached, TRequestStatus& aStatus, TInt& aState, TInt& aLevelOwnerId, TBool aReqCancel = EFalse);
   1.132 +    TInt RequestNotification(TUint aClientId, TUint aResourceId);
   1.133 +    TInt RequestNotification(TUint aClientId, TUint aResourceId, TInt aDirection, TInt aThreshold);
   1.134 +    TInt CancelNotification(TUint aClientId, TUint aResourceId, TBool aType);
   1.135 +    TInt RegisterForIdleResourcesInfo(TUint aPowerControllerId, TUint aResourceNum, TAny* anInfo);
   1.136 +    TInt GetIdleResourcesInfo(TUint aResourceNum, TAny* info);
   1.137 +	TInt DeRegisterClientLevelFromResource(TInt aClientId, TUint aResId);
   1.138 +	TInt CheckPostBootLevelNotifications();
   1.139 +	TInt GetResourceControllerVersion(TUint aClientId, TUint& aVersion);
   1.140 +#ifdef PRM_ENABLE_EXTENDED_VERSION
   1.141 +	TInt RegisterDynamicResource(TUint aClientId, TUint& aResourceId);
   1.142 +	TInt DeRegisterDynamicResource(TUint aClientId, TUint aResourceId, TInt *aLevel);
   1.143 +	TInt RegisterResourceDependency(TUint aClientId, SResourceDependencyInfo aInfo1, SResourceDependencyInfo aInfo2);
   1.144 +	TInt DeRegisterResourceDependency(TUint aClientId, TUint aResourceId1, TUint aResourceId2);
   1.145 +	void ChangeResStateAndDeRegisterDynamicRes(TUint aClientId, TUint aResourceId, TInt &aLevel, TRequestStatus& aStatus);
   1.146 +	TInt GetNumDependentsForResource(TUint aClientId, TUint aResourceId, TUint& aNumDepResource);
   1.147 +	TInt GetDependentsIdForResource(TUint aClientId, TUint aResourceId, TAny* aResIdArray, TUint& aNumDepResources);
   1.148 +	void CheckParallelExecutionForChangeResState(TUint aClientId, TUint aDepResId, TInt& aDepLevel, TUint aResId, TInt aLevel, TRequestStatus& aStatus);
   1.149 +#endif //PRM_ENABLE_EXTENDED_VERSION
   1.150 +    inline static TVersion VersionRequired();
   1.151 +    };
   1.152 +
   1.153 +inline TVersion RTestResMan::VersionRequired()
   1.154 +	{
   1.155 +	const TInt KMajorVersionNumber=1;
   1.156 +	const TInt KMinorVersionNumber=0;
   1.157 +	const TInt KBuildVersionNumber=KE32BuildVersionNumber;
   1.158 +	return TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber);
   1.159 +	}
   1.160 +
   1.161 +#ifndef __KERNEL_MODE__
   1.162 +
   1.163 +/** Open a channel for the driver.This driver does not allow more than one channel open at a time. */ 
   1.164 +TInt RTestResMan::Open()
   1.165 +	{
   1.166 +    return DoCreate(KLddName, VersionRequired(),KNullUnit,NULL,NULL);
   1.167 +	}
   1.168 +
   1.169 +/** Request to register a client with resource manager
   1.170 +	@Param	- aClientId, On Success with be updated with a valid unique clientID,
   1.171 +			- aClientName, Name of the client to register with RM,
   1.172 +			- aType, Defines ownership, can be either process relative or thread relative
   1.173 +	@return- KErrNone on Sucess or one of system wide errors.
   1.174 +	*/
   1.175 +TInt RTestResMan::RegisterClient(TUint& aClientId, const TDesC* aClientName, TOwnerType aType)
   1.176 +	{
   1.177 +    TParameterListInfo anInfo;
   1.178 +    anInfo.iPtr1 = (TAny*)&aClientId;
   1.179 +    anInfo.iPtr2 = (TAny*)aClientName;
   1.180 +    anInfo.iPtr3 = (TAny*)aType;
   1.181 +    return DoControl(ERegisterClient, (TAny*)&anInfo);
   1.182 +	}
   1.183 +
   1.184 +/** Request to deregister a client from RM.
   1.185 +	@Param - aClientID, The ID of the Client to deregister
   1.186 +	@return- KErrNone on Sucess or one of system wide errors.
   1.187 +	*/
   1.188 +TInt RTestResMan::DeRegisterClient(TUint aClientId)
   1.189 +	{
   1.190 +    return DoControl(EDeRegisterClient, (TAny*)aClientId);
   1.191 +	}
   1.192 +
   1.193 +/** Request to obtain the name of the specified client of the RM
   1.194 +	@Param	- aClientId, Requesting ClientId
   1.195 +			- aTargetClientId, Id of the client whose name is requested.
   1.196 +			- aClientName, On Success returned with client name.
   1.197 +	@return- KErrNone on Sucess or one of system wide errors.
   1.198 +	*/
   1.199 +TInt RTestResMan::GetClientName(TUint aClientId, TUint aTargetClientId, TDes8* aClientName)
   1.200 +	{
   1.201 +    TParameterListInfo anInfo;
   1.202 +    anInfo.iClientId = aClientId;
   1.203 +    anInfo.iPtr1 = (TAny*)aTargetClientId;
   1.204 +    anInfo.iPtr2 = (TAny*)aClientName;
   1.205 +    return DoControl(EGetClientName, (TAny*)&anInfo);
   1.206 +	}
   1.207 +
   1.208 +/** Request to obtain the ID of the specified client of the RM
   1.209 +	@Param  - aClientId, Requesting ClientId,
   1.210 +			- aClientName, Client Name whose Id is being requested,
   1.211 +			- aTargetClientId, On Success with be updated with requested client Id
   1.212 +	@return- KErrNone on Sucess or one of system wide errors.	
   1.213 +	*/
   1.214 +TInt RTestResMan::GetClientId(TUint aClientId, TDesC8& aClientName, TUint& aTargetClientId)
   1.215 +	{
   1.216 +    TParameterListInfo anInfo;
   1.217 +    anInfo.iClientId = aClientId;
   1.218 +    anInfo.iPtr1 = (TAny*)&aClientName;
   1.219 +    anInfo.iPtr2 = (TAny*)&aTargetClientId;
   1.220 +    return DoControl(EGetClientId, (TAny*)&anInfo);
   1.221 +	}
   1.222 +
   1.223 +/** Request to obtain the ID of the specified resource of the RM
   1.224 +	@Param	- aClientId, Requesting ClientId,
   1.225 +			- aResourceName, Resource name whose ID is being requested
   1.226 +			- aResourceId, On Success returned with resource id.
   1.227 +	@return- KErrNone on Sucess or one of system wide errors.
   1.228 +	*/
   1.229 +TInt RTestResMan::GetResourceId(TUint aClientId, TDesC8& aResourceName, TUint& aResourceId)
   1.230 +	{
   1.231 +    TParameterListInfo anInfo;
   1.232 +    anInfo.iClientId = aClientId;
   1.233 +    anInfo.iPtr1 = (TAny*)&aResourceName;
   1.234 +    anInfo.iPtr2 = (TAny*)&aResourceId;
   1.235 +    return DoControl(EGetResourceId, (TAny*)&anInfo);
   1.236 +	}
   1.237 +
   1.238 +/** Request to obtain the information of the specified resource
   1.239 +	@Param	- aClientId, Requesting ClientId,
   1.240 +			- aResourceId, Resource Id whose information is requested
   1.241 +			- aBuf, On Success filled with resource information
   1.242 +	@return- KErrNone on Sucess or one of system wide errors.
   1.243 +	*/
   1.244 +TInt RTestResMan::GetResourceInfo(TUint aClientId, TUint aResourceId, TAny* aBuf)
   1.245 +	{
   1.246 +    TParameterListInfo anInfo;
   1.247 +    anInfo.iClientId = aClientId;
   1.248 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.249 +    anInfo.iPtr2 = aBuf;
   1.250 +    return DoControl(EGetResourceInfo, (TAny*)&anInfo);
   1.251 +	}
   1.252 +
   1.253 +/** Request to obtain the number of resources the specified client has requirement on resource level.
   1.254 +	@Param	- aClientId, Requesting ClientId,
   1.255 +			- aTargetClientId, ClientId, the number of resources on which it has requirement is requested.
   1.256 +			- aNumResources, On Success contains the number of resources the client has requirement
   1.257 +	@return- KErrNone on Sucess or one of system wide errors.
   1.258 +	*/
   1.259 +TInt RTestResMan::GetNumResourcesInUseByClient(TUint aClientId, TUint aTargetClientId,TUint& aNumResources)
   1.260 +	{
   1.261 +    TParameterListInfo anInfo;
   1.262 +    anInfo.iClientId = aClientId;
   1.263 +    anInfo.iPtr1 = (TAny*) aTargetClientId;
   1.264 +    anInfo.iPtr2 = (TAny*)&aNumResources;
   1.265 +    return DoControl(EGetNumResourcesInUseByClient, (TAny*)&anInfo);
   1.266 +	}
   1.267 +
   1.268 +/** Request to obtain the information on resources
   1.269 +	@Param	- aClientId, Requesting ClientId,
   1.270 +			- aTargetClientId, ClientId, information on all the resources on which it has requirement is requested
   1.271 +			- aNumResources, Number of resources whose information needs to be filled (size of info)
   1.272 +			- info, On sucess will be filled with resources information.
   1.273 +	@return- KErrNone on Sucess or one of system wide errors.
   1.274 +	*/
   1.275 +TInt RTestResMan::GetInfoOnResourcesInUseByClient(TUint aClientId, TUint aTargetClientId, TUint& aNumResources, TAny* info)
   1.276 +	{
   1.277 +    TParameterListInfo anInfo;
   1.278 +    anInfo.iClientId = aClientId;
   1.279 +    anInfo.iPtr1 = (TAny*)aTargetClientId;
   1.280 +    anInfo.iPtr2 = (TAny*)&aNumResources;
   1.281 +    anInfo.iPtr3 = info;
   1.282 +    return DoControl(EGetInfoOnResourcesInUseByClient, (TAny*)&anInfo);
   1.283 +	}
   1.284 +
   1.285 +/** Request to obtain the number of clients holding the specified resource.
   1.286 +	@Param	- aClientId, Requesting ClientId,
   1.287 +			- aResourceId, ID of the resource.
   1.288 +			- aNumClients, On Success contains the number of clients holding requirement on specified resource
   1.289 +	@return- KErrNone on Sucess or one of system wide errors.
   1.290 +	*/
   1.291 +TInt RTestResMan::GetNumClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients)
   1.292 +	{
   1.293 +    TParameterListInfo anInfo;
   1.294 +    anInfo.iClientId = aClientId;
   1.295 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.296 +    anInfo.iPtr2 = (TAny*)&aNumClients;
   1.297 +    return DoControl(EGetNumClientsUsingResource, (TAny*)&anInfo);
   1.298 +	}
   1.299 +
   1.300 +/** Request to obtain the information on clients
   1.301 +	@Param	- aClientId, Requesting ClientId,
   1.302 +			- aResourceId, Id of the resource
   1.303 +			- aNumClients, Number of Clients whose information needs to be filled (size of info)
   1.304 +			- info, On sucess will be filled with client information.
   1.305 +	@return- KErrNone on Sucess or one of system wide errors.
   1.306 +	*/
   1.307 +TInt RTestResMan::GetInfoOnClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients, TAny* info)
   1.308 +	{
   1.309 +    TParameterListInfo anInfo;
   1.310 +    anInfo.iClientId = aClientId;
   1.311 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.312 +    anInfo.iPtr2 = (TAny*)&aNumClients;
   1.313 +    anInfo.iPtr3 = info;
   1.314 +    return DoControl(EGetInfoOnClientsUsingResource, (TAny*)&anInfo);
   1.315 +	}
   1.316 +
   1.317 +/** Request to preallocate the clientlevel and requests RM internal structures.
   1.318 +	@Param	- aClientId, Requesting ClientId,
   1.319 +			- aNumClientLevels, Client Level objects to preallocate
   1.320 +			- aNumRequests, Request level objects to preallocate
   1.321 +	@return- KErrNone on Sucess or one of system wide errors.
   1.322 +	*/
   1.323 +TInt RTestResMan::AllocReserve(TUint aClientId, TUint8 aNumClientLevels, TUint8 aNumRequests)
   1.324 +	{
   1.325 +    TParameterListInfo anInfo;
   1.326 +    anInfo.iClientId = aClientId;
   1.327 +    anInfo.iPtr1 = (TAny*)aNumClientLevels;
   1.328 +    anInfo.iPtr2 = (TAny*)aNumRequests;
   1.329 +    return DoControl(EAllocReserve, (TAny*)&anInfo);
   1.330 +	}
   1.331 +
   1.332 +/** Function to verify the notification sent for the earlier resource state change.
   1.333 +	@Param	- aResourceId, Id of the resource whose notifications are verified.
   1.334 +			- aUncondNoti, Number of expected unconditional notification
   1.335 +			- aCondNoti, Number of expected conditional notification
   1.336 +	@return- KErrNone on Sucess or KErrUnderflow
   1.337 +	*/
   1.338 +TInt RTestResMan::CheckNotifications(TUint aResourceId, TUint aUncondNoti, TUint aCondNoti)
   1.339 +	{
   1.340 +    TParameterListInfo anInfo;
   1.341 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.342 +    anInfo.iPtr2 = (TAny*)aUncondNoti;
   1.343 +    anInfo.iPtr3 = (TAny*)aCondNoti;
   1.344 +    return DoControl(ECheckNotifications, (TAny*)&anInfo);
   1.345 +	}
   1.346 +
   1.347 +/** Request to change the state of the resource synchronously
   1.348 +	@Param	- aClientId, Requesting clientId
   1.349 +			- aResourceId, Id of the resource whose state change is requested.
   1.350 +			- aNewState, Requested new state
   1.351 +	@return- KErrNone on Sucess or one of system wide errors.
   1.352 +	*/
   1.353 +TInt RTestResMan::ChangeResourceStateSync(TUint aClientId, TUint aResourceId, TInt aNewState)
   1.354 +	{
   1.355 +    TParameterListInfo anInfo;
   1.356 +    anInfo.iClientId = aClientId;
   1.357 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.358 +    anInfo.iPtr2 = (TAny*)aNewState;
   1.359 +    return DoControl(EChangeResourceStateSync, (TAny*)&anInfo);
   1.360 +	}
   1.361 +
   1.362 +/** Request to change the state of the resource asynchronously
   1.363 +	@Param	- aClientId, Requesting clientId
   1.364 +			- aResourceId, Id of the resource whose state change is requested.
   1.365 +			- aState, Requested new state
   1.366 +			- aStatus, TRequestStatus object to indicate completion of operation
   1.367 +			- aReqCancel, If true CancelAsyncOperation API of RM is called immediately after asynchronos request operation
   1.368 +	*/
   1.369 +void RTestResMan::ChangeResourceStateAsync(TUint aClientId, TUint aResourceId, TInt& aState, TRequestStatus& aStatus, TBool aReqCancel)
   1.370 +	{
   1.371 +    TParameterListInfo anInfo;
   1.372 +    anInfo.iClientId = aClientId;
   1.373 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.374 +    anInfo.iPtr2 = (TAny*)&aState;
   1.375 +    anInfo.iPtr3 = (TAny*)aReqCancel;
   1.376 +    DoRequest(EChangeResourceStateAsync, aStatus, (TAny*)&anInfo);
   1.377 +	}
   1.378 +
   1.379 +/** Request to obtain the state of the resource synchronously
   1.380 +	@Param	- aClientId, Requesting clientId
   1.381 +			- aResourceId, Id of the resource whose state change is requested.
   1.382 +			- aCached, if true requesting for cached value
   1.383 +			- aNewState, On success returns the new state
   1.384 +			- aLevelOwnerId, On success returns the Id of the client currently holding the resource.
   1.385 +	@return- KErrNone on Sucess or one of system wide errors.
   1.386 +	*/
   1.387 +TInt RTestResMan::GetResourceStateSync(TUint aClientId, TUint aResourceId, TBool aCached, TInt& aNewState, TInt& aLevelOwnerId)
   1.388 +	{
   1.389 +    TParameterListInfo anInfo;
   1.390 +    anInfo.iClientId = aClientId;
   1.391 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.392 +    anInfo.iPtr2 = (TAny*)aCached;
   1.393 +    anInfo.iPtr3 = (TAny*)&aNewState;
   1.394 +	anInfo.iPtr4 = (TAny*)&aLevelOwnerId;
   1.395 +    return DoControl(EGetResourceStateSync, (TAny*)&anInfo);
   1.396 +	}
   1.397 +
   1.398 +/** Request to obtain the state of the resource asynchronously
   1.399 +	@Param	- aClientId, Requesting clientId
   1.400 +			- aResourceId, Id of the resource whose state change is requested.
   1.401 +			- aCached, if true requesting for cached value
   1.402 +			- aStatus, TRequestStatus object to indicate completion of operation
   1.403 +			- aReqCancel, If true CancelAsyncOperation API of RM is called immediately after asynchronos request operation
   1.404 +	*/
   1.405 +void RTestResMan::GetResourceStateAsync(TUint aClientId, TUint aResourceId, TBool aCached, TRequestStatus& aStatus, TInt& aState, TInt& aLevelOwnerId, TBool aReqCancel)
   1.406 +	{
   1.407 +    TParameterListInfo anInfo;
   1.408 +    anInfo.iClientId = aClientId;
   1.409 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.410 +    anInfo.iPtr2 = (TAny*)aCached;
   1.411 +    anInfo.iPtr3 = (TAny*)aReqCancel;
   1.412 +	anInfo.iPtr4 = (TAny*)&aState;
   1.413 +	anInfo.iPtr5 = (TAny*)&aLevelOwnerId;
   1.414 +    DoRequest(EGetResourceStateAsync, aStatus, (TAny*)&anInfo);
   1.415 +	}
   1.416 +
   1.417 +/** Request to notify when the state of the specified resource changes
   1.418 +	@Param	- aClientId, Requesting clientId,
   1.419 +			- aResourceId, ID of the resource
   1.420 +	@return- KErrNone on Sucess or one of system wide errors.
   1.421 +	*/
   1.422 +TInt RTestResMan::RequestNotification(TUint aClientId, TUint aResourceId)
   1.423 +	{
   1.424 +    return DoControl(ERequestNotificationUncond, (TAny*)aClientId, (TAny*)aResourceId);
   1.425 +	}
   1.426 +
   1.427 +/** Request to notify when the state of the specified resource change crosses the threshold in the specified direction
   1.428 +	@Param	- aClientId, Requesting clientId,
   1.429 +			- aResourceId, ID of the resource,
   1.430 +			- aDirection, Direction of change of the resource state that will trigger the notification
   1.431 +			- aThreshold, Level of resource state that will trigger the notifications when reached.
   1.432 +	@return- KErrNone on Sucess or one of system wide errors.
   1.433 +	*/
   1.434 +TInt RTestResMan::RequestNotification(TUint aClientId, TUint aResourceId, TInt aDirection, TInt aThreshold)
   1.435 +	{
   1.436 +    TParameterListInfo anInfo;
   1.437 +    anInfo.iClientId = aClientId;
   1.438 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.439 +    anInfo.iPtr2 = (TAny*)aThreshold;
   1.440 +    anInfo.iPtr3 = (TAny*)aDirection;
   1.441 +    return DoControl(ERequestNotificationCond, (TAny*)&anInfo);
   1.442 +	}
   1.443 +
   1.444 +/** Request to cancel the previously requested notification
   1.445 +	@Param	- aClientId, Requesting clientId
   1.446 +			- aResourceId, ID of the resource
   1.447 +			- aType, ETrue Conditional
   1.448 +	@return- KErrCancel on Sucess or one of system wide errors.
   1.449 +	*/
   1.450 +TInt RTestResMan::CancelNotification(TUint aClientId, TUint aResourceId, TBool aType)
   1.451 +	{
   1.452 +    TParameterListInfo anInfo;
   1.453 +    anInfo.iClientId = aClientId;
   1.454 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.455 +    anInfo.iPtr2 = (TAny*)aType;
   1.456 +    return DoControl(ECancelNotification, (TAny*)&anInfo);
   1.457 +	}
   1.458 +
   1.459 +/** Request to register the specified number of resources to RM to keep the list updated with the
   1.460 +	cached value of the resources and owner of the resources. This is used for testing of the API.
   1.461 +	@Param	- aResourceNum - Number of resource, whose information needs to be cached
   1.462 +	@return- KErrNone on Sucess or one of system wide errors.
   1.463 +	*/
   1.464 +TInt RTestResMan::RegisterForIdleResourcesInfo(TUint aPowerControllerId, TUint aResourceNum, TAny* aPtr)
   1.465 +     {
   1.466 +	 TParameterListInfo anInfo;
   1.467 +	 anInfo.iClientId = aPowerControllerId;
   1.468 +	 anInfo.iPtr1 = (TAny*)aResourceNum;
   1.469 +	 anInfo.iPtr2 = (TAny*)aPtr;
   1.470 +     return DoControl(ERegisterForIdleResourcesInfo, (TAny*)&anInfo);
   1.471 +     }
   1.472 +
   1.473 +/** Request to Deregister client level from resource. 
   1.474 +	@Param - aClientId - ID of the client requesting deregistration.
   1.475 +	@Param - aResId - ID of the resource from which to deregister the client level of requested client.
   1.476 +	@return KErrNone on Sucess or one of system wide errors.
   1.477 +	*/
   1.478 +TInt RTestResMan::DeRegisterClientLevelFromResource(TInt aClientId, TUint aResId)
   1.479 +	{
   1.480 +	return DoControl(EDeRegisterClientLevelFromResource, (TAny*)aClientId, (TAny*)aResId);
   1.481 +	}
   1.482 +
   1.483 +
   1.484 +/** Request to get the information of the all the resources cached by RM as requested by 
   1.485 +	RegisterForIdleResourcesInfo API
   1.486 +	@Param	- aResourceNum - Number of resources (size of info)
   1.487 +			- info, On success returns with resource infomations
   1.488 +	@return- KErrNone on Sucess or one of system wide errors.
   1.489 +	*/
   1.490 +TInt RTestResMan::GetIdleResourcesInfo(TUint aResourceNum, TAny* info)
   1.491 +     {
   1.492 +     return DoControl(EGetIdleResourcesInfo, (TAny*)aResourceNum, (TAny*)info);
   1.493 +     }
   1.494 +
   1.495 +/** Request to check the notifications recieved as a result of postboot level setting. 
   1.496 +	@return KErrNone on success or one of system wide errors.
   1.497 +	*/
   1.498 +TInt RTestResMan::CheckPostBootLevelNotifications()
   1.499 +	{
   1.500 +	return DoControl(ECheckPostBootLevelNotifications, (TAny*)NULL, (TAny*)NULL);
   1.501 +	}
   1.502 +
   1.503 +/** Get the version of Resource Controller
   1.504 +	@Param - aClientId - Id of the client requesting version information
   1.505 +	@Param - aVersion - Version will be updated. 0 - Basic, 1- extended version
   1.506 +	@return KErrNone on success or one of system wide errors.
   1.507 +	*/
   1.508 +TInt RTestResMan::GetResourceControllerVersion(TUint aClientId, TUint& aVersion)
   1.509 +	{
   1.510 +	return DoControl(EGetControllerVersion, (TAny*)aClientId, (TAny*)&aVersion);
   1.511 +	}
   1.512 +
   1.513 +#ifdef PRM_ENABLE_EXTENDED_VERSION
   1.514 +/** Register dynamic resource.
   1.515 +	@Param - aClientId - Id of the client that is registering the dynamic resource
   1.516 +	@Param - aResourceId - On success will be updated with the resource id allocated for this resource
   1.517 +	@return KErrNone on success or one of system wide errors.
   1.518 +	*/
   1.519 +TInt RTestResMan::RegisterDynamicResource(TUint aClientId, TUint& aResourceId)
   1.520 +	{
   1.521 +	return DoControl(ERegisterDynamicResource, (TAny*)aClientId, (TAny*)&aResourceId);
   1.522 +	}
   1.523 +
   1.524 +/** Deregister dynamic resource.
   1.525 +	@Param - aClientId - Id of the client that is deregistering the dynamic resource
   1.526 +	@Param - aResourceId - Id of the dynamic resource to deregister
   1.527 +	@Param - aLevel - Pointer to the required final state. 
   1.528 +	@return KErrNone on success or one of system wide errors.
   1.529 +	*/
   1.530 +TInt RTestResMan::DeRegisterDynamicResource(TUint aClientId, TUint aResourceId, TInt *aLevel)
   1.531 +	{
   1.532 +    TParameterListInfo anInfo;
   1.533 +    anInfo.iClientId = aClientId;
   1.534 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.535 +    anInfo.iPtr2 = (TAny*)aLevel;
   1.536 +    return DoControl(EDeRegisterDynamicResource, (TAny*)&anInfo);
   1.537 +	}
   1.538 +
   1.539 +/** Change the resource state asynchronously and immediately try to deregister dynamic resource.
   1.540 +	@Param - aClientId - Id of the client that is requesting the resource state change.
   1.541 +	@Param - aResourceId - Id of the resource whose state change is requested.
   1.542 +	@Param - aLevel - Requested new state
   1.543 +	@Param - aStatus, TRequestStatus object to indicate completion of operation
   1.544 +	@return KErrNone on success or one of system wide errors.
   1.545 +	*/
   1.546 +void RTestResMan::ChangeResStateAndDeRegisterDynamicRes(TUint aClientId, TUint aResourceId, TInt &aLevel, TRequestStatus &aStatus)
   1.547 +	{
   1.548 +    TParameterListInfo anInfo;
   1.549 +    anInfo.iClientId = aClientId;
   1.550 +    anInfo.iPtr1 = (TAny*)aResourceId;
   1.551 +    anInfo.iPtr2 = (TAny*)&aLevel;
   1.552 +    DoRequest(EChangeResStateAndDeregisterDynamicRes, aStatus, (TAny*)&anInfo);
   1.553 +	}
   1.554 +
   1.555 +/** Register depedency between resources.
   1.556 +	@Param - aClientId - Id of the client that is establishing the dependency.
   1.557 +	@Param - aInfo1 - Infomation about the first resource in the dependency link.
   1.558 +	@Param - aInfo2 - Information about the second resource in the dependency link.
   1.559 +	@return KErrNone on success or one of the system wide errors.
   1.560 +    */
   1.561 +TInt RTestResMan::RegisterResourceDependency(TUint aClientId, SResourceDependencyInfo aInfo1, SResourceDependencyInfo aInfo2)
   1.562 +	{
   1.563 +    TParameterListInfo anInfo;
   1.564 +    anInfo.iClientId = aClientId;
   1.565 +    anInfo.iPtr1 = (TAny*)&aInfo1;
   1.566 +    anInfo.iPtr2 = (TAny*)&aInfo2;
   1.567 +    return DoControl(ERegisterResourceDependency, (TAny*)&anInfo);
   1.568 +	}
   1.569 +
   1.570 +/** Deregister dependency between resources.
   1.571 +	@Param - aClientId - Id of the client that is deregistering the resource dependency
   1.572 +	@Param - aResourceId1 - Id of the first resource in the dependency link that is being deregistered.
   1.573 +	@Param - aResourceId2 - Id of the second resource in the dependency link that is being deregistered.
   1.574 +	@return KErrNone on success or one of the system wide errors.
   1.575 +	*/
   1.576 +TInt RTestResMan::DeRegisterResourceDependency(TUint aClientId, TUint aResourceId1, TUint aResourceId2)
   1.577 +	{
   1.578 +    TParameterListInfo anInfo;
   1.579 +    anInfo.iClientId = aClientId;
   1.580 +    anInfo.iPtr1 = (TAny*)aResourceId1;
   1.581 +    anInfo.iPtr2 = (TAny*)aResourceId2;
   1.582 +    return DoControl(EDeRegisterResourceDependency, (TAny*)&anInfo);
   1.583 +	}
   1.584 +
   1.585 +/** Get number of dependents for the specified resource
   1.586 +	@Param - aClientId - Id of the client that is requesting dependents count
   1.587 +	@Param - aResourceId - Id of the resource whose number of dependents is requested.
   1.588 +	@Param - aNumDepResource - On success will be updated with number of dependents.
   1.589 +	@return KErrNone on success or one of the system wide errors.
   1.590 +	*/
   1.591 +TInt RTestResMan::GetNumDependentsForResource(TUint aClientId, TUint aResourceId, TUint& aNumDepResource)
   1.592 +	{
   1.593 +	TParameterListInfo anInfo;
   1.594 +	anInfo.iClientId = aClientId;
   1.595 +	anInfo.iPtr1 = (TAny*)aResourceId;
   1.596 +	anInfo.iPtr2 = (TAny*)&aNumDepResource;
   1.597 +	return DoControl(EGetNumDependentsForResource, (TAny*)&anInfo);
   1.598 +	}
   1.599 +
   1.600 +/** Get dependent resource id's for the specified resource
   1.601 +	@Param - aClientId - Id of the client that is requesting the dependent id list.
   1.602 +	@Param - aResIdArray - On success will be updated with dependent resource id.
   1.603 +	@Param - aNumDepResources - Will be updated with actual number of dependents.
   1.604 +	@return KErrNone on success or one of the system wide errors.
   1.605 +	*/
   1.606 +TInt RTestResMan::GetDependentsIdForResource(TUint aClientId, TUint aResourceId, TAny* aResIdArray, TUint& aNumDepResources)
   1.607 +	{
   1.608 +	TParameterListInfo anInfo;
   1.609 +	anInfo.iClientId = aClientId;
   1.610 +	anInfo.iPtr1 = (TAny*)aResourceId;
   1.611 +	anInfo.iPtr2 = (TAny*)aResIdArray;
   1.612 +	anInfo.iPtr3 = (TAny*)&aNumDepResources;
   1.613 +	return DoControl(EGetDependentsIdForResource, (TAny*)&anInfo);
   1.614 +	}
   1.615 +/** Checks for state change of dependency resource while deregistering the non-dependency resource.
   1.616 +	@Param - aClientId - Id of the client that is requesting this operation
   1.617 +	@Param - aDepResInfo - Embeds resource id, level and status for dependency resource
   1.618 +	@Param - aDepLevel - the level to which the dependency resource is moved to.
   1.619 +	@Param - aResId - Id of the static resource.
   1.620 +	@Param - aLevel - the level to which the static resource is moved to.
   1.621 +	@Param - aStatus - to recieve the status of asynchronous operation.
   1.622 +	@return KErrNone on success or one of the system wide errors.
   1.623 +	*/
   1.624 +void RTestResMan::CheckParallelExecutionForChangeResState(TUint aClientId, TUint aDepResId, TInt& aDepLevel, 
   1.625 +												TUint aResId, TInt aLevel, TRequestStatus& aStatus)
   1.626 +	{
   1.627 +	TParameterListInfo anInfo;
   1.628 +	anInfo.iClientId = aClientId;
   1.629 +	anInfo.iPtr1 = (TAny*)aDepResId;
   1.630 +	anInfo.iPtr2 = (TAny*)&aDepLevel;
   1.631 +	anInfo.iPtr3 = (TAny*)aResId;
   1.632 +	anInfo.iPtr4 = (TAny*)aLevel;
   1.633 +	DoRequest(ECheckParallelExecutionForChangeResState, aStatus, (TAny*)&anInfo);
   1.634 +	}
   1.635 +#endif //PRM_ENABLE_EXTENDED_VERSION
   1.636 +
   1.637 +#endif //__KERNEL_MODE__
   1.638 +#endif //__D_RESCONTROLCLI_H__