sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\resourceman\d_rescontrolcli.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __D_RESCONTROLCLI_H__ sl@0: #define __D_RESCONTROLCLI_H__ sl@0: sl@0: #include sl@0: #include sl@0: #ifndef __KERNEL_MODE__ sl@0: #include sl@0: #endif sl@0: sl@0: #ifndef __KERNEL_MODE__ sl@0: //Structure to pass the dependency information sl@0: struct SResourceDependencyInfo sl@0: { sl@0: TUint iResourceId; sl@0: TUint8 iDependencyPriority; sl@0: }; sl@0: #endif sl@0: sl@0: #define MAX_CLIENTS 50 //Maximum clients allowed sl@0: sl@0: #ifndef PRM_ENABLE_EXTENDED_VERSION sl@0: _LIT(KLddName, "D_RESCONTROLCLI.LDD"); sl@0: #else sl@0: _LIT(KLddName, "D_EXTENDEDRESCONTROLCLI.LDD"); sl@0: #endif sl@0: sl@0: /** Struture for passing information between user and kernel side.*/ sl@0: struct TParameterListInfo sl@0: { sl@0: TUint iClientId; sl@0: TAny* iPtr1; sl@0: TAny* iPtr2; sl@0: TAny* iPtr3; sl@0: TAny* iPtr4; sl@0: TAny* iPtr5; sl@0: }; sl@0: sl@0: /** User side logical channel */ sl@0: class RTestResMan : public RBusLogicalChannel sl@0: { sl@0: public: sl@0: // Structure for holding driver capabilities information sl@0: class TCaps sl@0: { sl@0: public: sl@0: TVersion iVersion; sl@0: }; sl@0: sl@0: private: sl@0: enum TControl //Request types for synchronous operation. sl@0: { sl@0: ERegisterClient, sl@0: EDeRegisterClient, sl@0: EGetClientName, sl@0: EGetClientId, sl@0: EGetResourceId, sl@0: EGetResourceInfo, sl@0: EGetNumResourcesInUseByClient, sl@0: EGetInfoOnResourcesInUseByClient, sl@0: EGetNumClientsUsingResource, sl@0: EGetInfoOnClientsUsingResource, sl@0: EAllocReserve, sl@0: ECheckNotifications, sl@0: EChangeResourceStateSync, sl@0: EGetResourceStateSync, sl@0: ERegisterForIdleResourcesInfo, sl@0: EGetIdleResourcesInfo, sl@0: EDeRegisterClientLevelFromResource, sl@0: ERequestNotificationCond, sl@0: ERequestNotificationUncond, sl@0: ECheckPostBootLevelNotifications, sl@0: ECancelNotification, sl@0: EGetControllerVersion, sl@0: #ifdef PRM_ENABLE_EXTENDED_VERSION sl@0: ERegisterDynamicResource, sl@0: EDeRegisterDynamicResource, sl@0: ERegisterResourceDependency, sl@0: EDeRegisterResourceDependency, sl@0: EGetNumDependentsForResource, sl@0: EGetDependentsIdForResource, sl@0: #endif //PRM_ENABLE_EXTENDED_VERSION sl@0: EMaxControl, sl@0: }; sl@0: enum TRequest //Request types for asynchronous operation sl@0: { sl@0: EChangeResourceStateAsync = EMaxControl + 1, sl@0: EGetResourceStateAsync, sl@0: #ifdef PRM_ENABLE_EXTENDED_VERSION sl@0: EChangeResStateAndDeregisterDynamicRes, sl@0: ECheckParallelExecutionForChangeResState sl@0: #endif sl@0: }; sl@0: friend class DTestResManLdd; sl@0: public: sl@0: TInt Open(); sl@0: TInt RegisterClient(TUint& aClientId, const TDesC* aClientName, TOwnerType aType=EOwnerProcess); sl@0: TInt DeRegisterClient(TUint aClientId); sl@0: TInt GetClientName(TUint aClientId, TUint aTargetClientId, TDes8* aClientName); sl@0: TInt GetClientId(TUint aClientId, TDesC8& aClientName, TUint& aTargetClientId); sl@0: TInt GetResourceId(TUint aClientId, TDesC8& aResourceName, TUint& aResourceId); sl@0: TInt GetResourceInfo(TUint aClientId, TUint aResourceId, TAny* aBuf); sl@0: TInt GetNumResourcesInUseByClient(TUint aClientId, TUint aTargetClientId,TUint& aNumResources); sl@0: TInt GetInfoOnResourcesInUseByClient(TUint aClientId, TUint aTargetClientId, TUint& aNumResources, TAny* info); sl@0: TInt GetNumClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients); sl@0: TInt GetInfoOnClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients, TAny* info); sl@0: TInt AllocReserve(TUint aClientId, TUint8 aNumClientLevels, TUint8 aNumResources); sl@0: TInt CheckNotifications(TUint aResourceId, TUint aUnconNoti, TUint aCondNoti); sl@0: TInt ChangeResourceStateSync(TUint aClientId, TUint aResourceId, TInt aNewState); sl@0: void ChangeResourceStateAsync(TUint aClientId, TUint aResourceId, TInt& aState, TRequestStatus& aStatus, TBool aReqCancel = EFalse); sl@0: TInt GetResourceStateSync(TUint aClientId, TUint aResourceId, TBool aCached, TInt& aNewState, TInt& aLevelOwnerId); sl@0: void GetResourceStateAsync(TUint aClientId, TUint aResourceId, TBool aCached, TRequestStatus& aStatus, TInt& aState, TInt& aLevelOwnerId, TBool aReqCancel = EFalse); sl@0: TInt RequestNotification(TUint aClientId, TUint aResourceId); sl@0: TInt RequestNotification(TUint aClientId, TUint aResourceId, TInt aDirection, TInt aThreshold); sl@0: TInt CancelNotification(TUint aClientId, TUint aResourceId, TBool aType); sl@0: TInt RegisterForIdleResourcesInfo(TUint aPowerControllerId, TUint aResourceNum, TAny* anInfo); sl@0: TInt GetIdleResourcesInfo(TUint aResourceNum, TAny* info); sl@0: TInt DeRegisterClientLevelFromResource(TInt aClientId, TUint aResId); sl@0: TInt CheckPostBootLevelNotifications(); sl@0: TInt GetResourceControllerVersion(TUint aClientId, TUint& aVersion); sl@0: #ifdef PRM_ENABLE_EXTENDED_VERSION sl@0: TInt RegisterDynamicResource(TUint aClientId, TUint& aResourceId); sl@0: TInt DeRegisterDynamicResource(TUint aClientId, TUint aResourceId, TInt *aLevel); sl@0: TInt RegisterResourceDependency(TUint aClientId, SResourceDependencyInfo aInfo1, SResourceDependencyInfo aInfo2); sl@0: TInt DeRegisterResourceDependency(TUint aClientId, TUint aResourceId1, TUint aResourceId2); sl@0: void ChangeResStateAndDeRegisterDynamicRes(TUint aClientId, TUint aResourceId, TInt &aLevel, TRequestStatus& aStatus); sl@0: TInt GetNumDependentsForResource(TUint aClientId, TUint aResourceId, TUint& aNumDepResource); sl@0: TInt GetDependentsIdForResource(TUint aClientId, TUint aResourceId, TAny* aResIdArray, TUint& aNumDepResources); sl@0: void CheckParallelExecutionForChangeResState(TUint aClientId, TUint aDepResId, TInt& aDepLevel, TUint aResId, TInt aLevel, TRequestStatus& aStatus); sl@0: #endif //PRM_ENABLE_EXTENDED_VERSION sl@0: inline static TVersion VersionRequired(); sl@0: }; sl@0: sl@0: inline TVersion RTestResMan::VersionRequired() sl@0: { sl@0: const TInt KMajorVersionNumber=1; sl@0: const TInt KMinorVersionNumber=0; sl@0: const TInt KBuildVersionNumber=KE32BuildVersionNumber; sl@0: return TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); sl@0: } sl@0: sl@0: #ifndef __KERNEL_MODE__ sl@0: sl@0: /** Open a channel for the driver.This driver does not allow more than one channel open at a time. */ sl@0: TInt RTestResMan::Open() sl@0: { sl@0: return DoCreate(KLddName, VersionRequired(),KNullUnit,NULL,NULL); sl@0: } sl@0: sl@0: /** Request to register a client with resource manager sl@0: @Param - aClientId, On Success with be updated with a valid unique clientID, sl@0: - aClientName, Name of the client to register with RM, sl@0: - aType, Defines ownership, can be either process relative or thread relative sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::RegisterClient(TUint& aClientId, const TDesC* aClientName, TOwnerType aType) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iPtr1 = (TAny*)&aClientId; sl@0: anInfo.iPtr2 = (TAny*)aClientName; sl@0: anInfo.iPtr3 = (TAny*)aType; sl@0: return DoControl(ERegisterClient, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to deregister a client from RM. sl@0: @Param - aClientID, The ID of the Client to deregister sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::DeRegisterClient(TUint aClientId) sl@0: { sl@0: return DoControl(EDeRegisterClient, (TAny*)aClientId); sl@0: } sl@0: sl@0: /** Request to obtain the name of the specified client of the RM sl@0: @Param - aClientId, Requesting ClientId sl@0: - aTargetClientId, Id of the client whose name is requested. sl@0: - aClientName, On Success returned with client name. sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetClientName(TUint aClientId, TUint aTargetClientId, TDes8* aClientName) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aTargetClientId; sl@0: anInfo.iPtr2 = (TAny*)aClientName; sl@0: return DoControl(EGetClientName, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to obtain the ID of the specified client of the RM sl@0: @Param - aClientId, Requesting ClientId, sl@0: - aClientName, Client Name whose Id is being requested, sl@0: - aTargetClientId, On Success with be updated with requested client Id sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetClientId(TUint aClientId, TDesC8& aClientName, TUint& aTargetClientId) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)&aClientName; sl@0: anInfo.iPtr2 = (TAny*)&aTargetClientId; sl@0: return DoControl(EGetClientId, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to obtain the ID of the specified resource of the RM sl@0: @Param - aClientId, Requesting ClientId, sl@0: - aResourceName, Resource name whose ID is being requested sl@0: - aResourceId, On Success returned with resource id. sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetResourceId(TUint aClientId, TDesC8& aResourceName, TUint& aResourceId) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)&aResourceName; sl@0: anInfo.iPtr2 = (TAny*)&aResourceId; sl@0: return DoControl(EGetResourceId, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to obtain the information of the specified resource sl@0: @Param - aClientId, Requesting ClientId, sl@0: - aResourceId, Resource Id whose information is requested sl@0: - aBuf, On Success filled with resource information sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetResourceInfo(TUint aClientId, TUint aResourceId, TAny* aBuf) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = aBuf; sl@0: return DoControl(EGetResourceInfo, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to obtain the number of resources the specified client has requirement on resource level. sl@0: @Param - aClientId, Requesting ClientId, sl@0: - aTargetClientId, ClientId, the number of resources on which it has requirement is requested. sl@0: - aNumResources, On Success contains the number of resources the client has requirement sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetNumResourcesInUseByClient(TUint aClientId, TUint aTargetClientId,TUint& aNumResources) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*) aTargetClientId; sl@0: anInfo.iPtr2 = (TAny*)&aNumResources; sl@0: return DoControl(EGetNumResourcesInUseByClient, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to obtain the information on resources sl@0: @Param - aClientId, Requesting ClientId, sl@0: - aTargetClientId, ClientId, information on all the resources on which it has requirement is requested sl@0: - aNumResources, Number of resources whose information needs to be filled (size of info) sl@0: - info, On sucess will be filled with resources information. sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetInfoOnResourcesInUseByClient(TUint aClientId, TUint aTargetClientId, TUint& aNumResources, TAny* info) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aTargetClientId; sl@0: anInfo.iPtr2 = (TAny*)&aNumResources; sl@0: anInfo.iPtr3 = info; sl@0: return DoControl(EGetInfoOnResourcesInUseByClient, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to obtain the number of clients holding the specified resource. sl@0: @Param - aClientId, Requesting ClientId, sl@0: - aResourceId, ID of the resource. sl@0: - aNumClients, On Success contains the number of clients holding requirement on specified resource sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetNumClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)&aNumClients; sl@0: return DoControl(EGetNumClientsUsingResource, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to obtain the information on clients sl@0: @Param - aClientId, Requesting ClientId, sl@0: - aResourceId, Id of the resource sl@0: - aNumClients, Number of Clients whose information needs to be filled (size of info) sl@0: - info, On sucess will be filled with client information. sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetInfoOnClientsUsingResource(TUint aClientId, TUint aResourceId, TUint& aNumClients, TAny* info) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)&aNumClients; sl@0: anInfo.iPtr3 = info; sl@0: return DoControl(EGetInfoOnClientsUsingResource, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to preallocate the clientlevel and requests RM internal structures. sl@0: @Param - aClientId, Requesting ClientId, sl@0: - aNumClientLevels, Client Level objects to preallocate sl@0: - aNumRequests, Request level objects to preallocate sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::AllocReserve(TUint aClientId, TUint8 aNumClientLevels, TUint8 aNumRequests) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aNumClientLevels; sl@0: anInfo.iPtr2 = (TAny*)aNumRequests; sl@0: return DoControl(EAllocReserve, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Function to verify the notification sent for the earlier resource state change. sl@0: @Param - aResourceId, Id of the resource whose notifications are verified. sl@0: - aUncondNoti, Number of expected unconditional notification sl@0: - aCondNoti, Number of expected conditional notification sl@0: @return- KErrNone on Sucess or KErrUnderflow sl@0: */ sl@0: TInt RTestResMan::CheckNotifications(TUint aResourceId, TUint aUncondNoti, TUint aCondNoti) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)aUncondNoti; sl@0: anInfo.iPtr3 = (TAny*)aCondNoti; sl@0: return DoControl(ECheckNotifications, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to change the state of the resource synchronously sl@0: @Param - aClientId, Requesting clientId sl@0: - aResourceId, Id of the resource whose state change is requested. sl@0: - aNewState, Requested new state sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::ChangeResourceStateSync(TUint aClientId, TUint aResourceId, TInt aNewState) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)aNewState; sl@0: return DoControl(EChangeResourceStateSync, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to change the state of the resource asynchronously sl@0: @Param - aClientId, Requesting clientId sl@0: - aResourceId, Id of the resource whose state change is requested. sl@0: - aState, Requested new state sl@0: - aStatus, TRequestStatus object to indicate completion of operation sl@0: - aReqCancel, If true CancelAsyncOperation API of RM is called immediately after asynchronos request operation sl@0: */ sl@0: void RTestResMan::ChangeResourceStateAsync(TUint aClientId, TUint aResourceId, TInt& aState, TRequestStatus& aStatus, TBool aReqCancel) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)&aState; sl@0: anInfo.iPtr3 = (TAny*)aReqCancel; sl@0: DoRequest(EChangeResourceStateAsync, aStatus, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to obtain the state of the resource synchronously sl@0: @Param - aClientId, Requesting clientId sl@0: - aResourceId, Id of the resource whose state change is requested. sl@0: - aCached, if true requesting for cached value sl@0: - aNewState, On success returns the new state sl@0: - aLevelOwnerId, On success returns the Id of the client currently holding the resource. sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetResourceStateSync(TUint aClientId, TUint aResourceId, TBool aCached, TInt& aNewState, TInt& aLevelOwnerId) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)aCached; sl@0: anInfo.iPtr3 = (TAny*)&aNewState; sl@0: anInfo.iPtr4 = (TAny*)&aLevelOwnerId; sl@0: return DoControl(EGetResourceStateSync, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to obtain the state of the resource asynchronously sl@0: @Param - aClientId, Requesting clientId sl@0: - aResourceId, Id of the resource whose state change is requested. sl@0: - aCached, if true requesting for cached value sl@0: - aStatus, TRequestStatus object to indicate completion of operation sl@0: - aReqCancel, If true CancelAsyncOperation API of RM is called immediately after asynchronos request operation sl@0: */ sl@0: void RTestResMan::GetResourceStateAsync(TUint aClientId, TUint aResourceId, TBool aCached, TRequestStatus& aStatus, TInt& aState, TInt& aLevelOwnerId, TBool aReqCancel) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)aCached; sl@0: anInfo.iPtr3 = (TAny*)aReqCancel; sl@0: anInfo.iPtr4 = (TAny*)&aState; sl@0: anInfo.iPtr5 = (TAny*)&aLevelOwnerId; sl@0: DoRequest(EGetResourceStateAsync, aStatus, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to notify when the state of the specified resource changes sl@0: @Param - aClientId, Requesting clientId, sl@0: - aResourceId, ID of the resource sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::RequestNotification(TUint aClientId, TUint aResourceId) sl@0: { sl@0: return DoControl(ERequestNotificationUncond, (TAny*)aClientId, (TAny*)aResourceId); sl@0: } sl@0: sl@0: /** Request to notify when the state of the specified resource change crosses the threshold in the specified direction sl@0: @Param - aClientId, Requesting clientId, sl@0: - aResourceId, ID of the resource, sl@0: - aDirection, Direction of change of the resource state that will trigger the notification sl@0: - aThreshold, Level of resource state that will trigger the notifications when reached. sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::RequestNotification(TUint aClientId, TUint aResourceId, TInt aDirection, TInt aThreshold) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)aThreshold; sl@0: anInfo.iPtr3 = (TAny*)aDirection; sl@0: return DoControl(ERequestNotificationCond, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to cancel the previously requested notification sl@0: @Param - aClientId, Requesting clientId sl@0: - aResourceId, ID of the resource sl@0: - aType, ETrue Conditional sl@0: @return- KErrCancel on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::CancelNotification(TUint aClientId, TUint aResourceId, TBool aType) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)aType; sl@0: return DoControl(ECancelNotification, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to register the specified number of resources to RM to keep the list updated with the sl@0: cached value of the resources and owner of the resources. This is used for testing of the API. sl@0: @Param - aResourceNum - Number of resource, whose information needs to be cached sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::RegisterForIdleResourcesInfo(TUint aPowerControllerId, TUint aResourceNum, TAny* aPtr) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aPowerControllerId; sl@0: anInfo.iPtr1 = (TAny*)aResourceNum; sl@0: anInfo.iPtr2 = (TAny*)aPtr; sl@0: return DoControl(ERegisterForIdleResourcesInfo, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Request to Deregister client level from resource. sl@0: @Param - aClientId - ID of the client requesting deregistration. sl@0: @Param - aResId - ID of the resource from which to deregister the client level of requested client. sl@0: @return KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::DeRegisterClientLevelFromResource(TInt aClientId, TUint aResId) sl@0: { sl@0: return DoControl(EDeRegisterClientLevelFromResource, (TAny*)aClientId, (TAny*)aResId); sl@0: } sl@0: sl@0: sl@0: /** Request to get the information of the all the resources cached by RM as requested by sl@0: RegisterForIdleResourcesInfo API sl@0: @Param - aResourceNum - Number of resources (size of info) sl@0: - info, On success returns with resource infomations sl@0: @return- KErrNone on Sucess or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetIdleResourcesInfo(TUint aResourceNum, TAny* info) sl@0: { sl@0: return DoControl(EGetIdleResourcesInfo, (TAny*)aResourceNum, (TAny*)info); sl@0: } sl@0: sl@0: /** Request to check the notifications recieved as a result of postboot level setting. sl@0: @return KErrNone on success or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::CheckPostBootLevelNotifications() sl@0: { sl@0: return DoControl(ECheckPostBootLevelNotifications, (TAny*)NULL, (TAny*)NULL); sl@0: } sl@0: sl@0: /** Get the version of Resource Controller sl@0: @Param - aClientId - Id of the client requesting version information sl@0: @Param - aVersion - Version will be updated. 0 - Basic, 1- extended version sl@0: @return KErrNone on success or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetResourceControllerVersion(TUint aClientId, TUint& aVersion) sl@0: { sl@0: return DoControl(EGetControllerVersion, (TAny*)aClientId, (TAny*)&aVersion); sl@0: } sl@0: sl@0: #ifdef PRM_ENABLE_EXTENDED_VERSION sl@0: /** Register dynamic resource. sl@0: @Param - aClientId - Id of the client that is registering the dynamic resource sl@0: @Param - aResourceId - On success will be updated with the resource id allocated for this resource sl@0: @return KErrNone on success or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::RegisterDynamicResource(TUint aClientId, TUint& aResourceId) sl@0: { sl@0: return DoControl(ERegisterDynamicResource, (TAny*)aClientId, (TAny*)&aResourceId); sl@0: } sl@0: sl@0: /** Deregister dynamic resource. sl@0: @Param - aClientId - Id of the client that is deregistering the dynamic resource sl@0: @Param - aResourceId - Id of the dynamic resource to deregister sl@0: @Param - aLevel - Pointer to the required final state. sl@0: @return KErrNone on success or one of system wide errors. sl@0: */ sl@0: TInt RTestResMan::DeRegisterDynamicResource(TUint aClientId, TUint aResourceId, TInt *aLevel) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)aLevel; sl@0: return DoControl(EDeRegisterDynamicResource, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Change the resource state asynchronously and immediately try to deregister dynamic resource. sl@0: @Param - aClientId - Id of the client that is requesting the resource state change. sl@0: @Param - aResourceId - Id of the resource whose state change is requested. sl@0: @Param - aLevel - Requested new state sl@0: @Param - aStatus, TRequestStatus object to indicate completion of operation sl@0: @return KErrNone on success or one of system wide errors. sl@0: */ sl@0: void RTestResMan::ChangeResStateAndDeRegisterDynamicRes(TUint aClientId, TUint aResourceId, TInt &aLevel, TRequestStatus &aStatus) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)&aLevel; sl@0: DoRequest(EChangeResStateAndDeregisterDynamicRes, aStatus, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Register depedency between resources. sl@0: @Param - aClientId - Id of the client that is establishing the dependency. sl@0: @Param - aInfo1 - Infomation about the first resource in the dependency link. sl@0: @Param - aInfo2 - Information about the second resource in the dependency link. sl@0: @return KErrNone on success or one of the system wide errors. sl@0: */ sl@0: TInt RTestResMan::RegisterResourceDependency(TUint aClientId, SResourceDependencyInfo aInfo1, SResourceDependencyInfo aInfo2) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)&aInfo1; sl@0: anInfo.iPtr2 = (TAny*)&aInfo2; sl@0: return DoControl(ERegisterResourceDependency, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Deregister dependency between resources. sl@0: @Param - aClientId - Id of the client that is deregistering the resource dependency sl@0: @Param - aResourceId1 - Id of the first resource in the dependency link that is being deregistered. sl@0: @Param - aResourceId2 - Id of the second resource in the dependency link that is being deregistered. sl@0: @return KErrNone on success or one of the system wide errors. sl@0: */ sl@0: TInt RTestResMan::DeRegisterResourceDependency(TUint aClientId, TUint aResourceId1, TUint aResourceId2) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId1; sl@0: anInfo.iPtr2 = (TAny*)aResourceId2; sl@0: return DoControl(EDeRegisterResourceDependency, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Get number of dependents for the specified resource sl@0: @Param - aClientId - Id of the client that is requesting dependents count sl@0: @Param - aResourceId - Id of the resource whose number of dependents is requested. sl@0: @Param - aNumDepResource - On success will be updated with number of dependents. sl@0: @return KErrNone on success or one of the system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetNumDependentsForResource(TUint aClientId, TUint aResourceId, TUint& aNumDepResource) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)&aNumDepResource; sl@0: return DoControl(EGetNumDependentsForResource, (TAny*)&anInfo); sl@0: } sl@0: sl@0: /** Get dependent resource id's for the specified resource sl@0: @Param - aClientId - Id of the client that is requesting the dependent id list. sl@0: @Param - aResIdArray - On success will be updated with dependent resource id. sl@0: @Param - aNumDepResources - Will be updated with actual number of dependents. sl@0: @return KErrNone on success or one of the system wide errors. sl@0: */ sl@0: TInt RTestResMan::GetDependentsIdForResource(TUint aClientId, TUint aResourceId, TAny* aResIdArray, TUint& aNumDepResources) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aResourceId; sl@0: anInfo.iPtr2 = (TAny*)aResIdArray; sl@0: anInfo.iPtr3 = (TAny*)&aNumDepResources; sl@0: return DoControl(EGetDependentsIdForResource, (TAny*)&anInfo); sl@0: } sl@0: /** Checks for state change of dependency resource while deregistering the non-dependency resource. sl@0: @Param - aClientId - Id of the client that is requesting this operation sl@0: @Param - aDepResInfo - Embeds resource id, level and status for dependency resource sl@0: @Param - aDepLevel - the level to which the dependency resource is moved to. sl@0: @Param - aResId - Id of the static resource. sl@0: @Param - aLevel - the level to which the static resource is moved to. sl@0: @Param - aStatus - to recieve the status of asynchronous operation. sl@0: @return KErrNone on success or one of the system wide errors. sl@0: */ sl@0: void RTestResMan::CheckParallelExecutionForChangeResState(TUint aClientId, TUint aDepResId, TInt& aDepLevel, sl@0: TUint aResId, TInt aLevel, TRequestStatus& aStatus) sl@0: { sl@0: TParameterListInfo anInfo; sl@0: anInfo.iClientId = aClientId; sl@0: anInfo.iPtr1 = (TAny*)aDepResId; sl@0: anInfo.iPtr2 = (TAny*)&aDepLevel; sl@0: anInfo.iPtr3 = (TAny*)aResId; sl@0: anInfo.iPtr4 = (TAny*)aLevel; sl@0: DoRequest(ECheckParallelExecutionForChangeResState, aStatus, (TAny*)&anInfo); sl@0: } sl@0: #endif //PRM_ENABLE_EXTENDED_VERSION sl@0: sl@0: #endif //__KERNEL_MODE__ sl@0: #endif //__D_RESCONTROLCLI_H__