os/kernelhwsrv/kernel/eka/include/d32resmanus.inl
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32\include\d32resmanus.inl
sl@0
    15
// 
sl@0
    16
// WARNING: This file contains some APIs which are internal and are subject
sl@0
    17
//          to change without noticed. Such APIs should therefore not be used
sl@0
    18
//          outside the Kernel and Hardware Services package.
sl@0
    19
//
sl@0
    20
sl@0
    21
#ifndef __KERNEL_H__
sl@0
    22
sl@0
    23
#ifdef RESOURCE_MANAGER_SIMULATED_PSL
sl@0
    24
#ifdef PRM_ENABLE_EXTENDED_VERSION2
sl@0
    25
_LIT(KPddName, "resourcecontrollerextendedcore.pdd");
sl@0
    26
#elif defined(PRM_ENABLE_EXTENDED_VERSION)
sl@0
    27
_LIT(KPddName,"resourcecontrollerextended.pdd");	// To support testing of the Extended version of the PDD
sl@0
    28
#else
sl@0
    29
_LIT(KPddName,"resourcecontroller.pdd");
sl@0
    30
#endif
sl@0
    31
#else
sl@0
    32
#ifdef PRM_ENABLE_EXTENDED_VERSION2
sl@0
    33
_LIT(KPddName, "resmanextendedcore.pdd");
sl@0
    34
#elif defined(PRM_ENABLE_EXTENDED_VERSION)
sl@0
    35
_LIT(KPddName, "resmanextended.pdd");			// To enable operation with the extended version of the PDD
sl@0
    36
#else
sl@0
    37
_LIT(KPddName, "ResMan.pdd");				// To enable operation with the basic PDD
sl@0
    38
#endif
sl@0
    39
#endif
sl@0
    40
sl@0
    41
inline TInt RBusDevResManUs::Open(TDesC8& aClientName)
sl@0
    42
	 {return(DoCreate(KLddRootName,VersionRequired(),-1,&KPddName,(TDesC8*)&(aClientName),EOwnerThread));}
sl@0
    43
sl@0
    44
inline TVersion RBusDevResManUs::VersionRequired() const
sl@0
    45
	{return(TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber));}
sl@0
    46
sl@0
    47
inline TInt RBusDevResManUs::Initialise(const TUint8 aNumGetStateRes, const TUint8 aNumSetStateRes, const TUint8 aNumListenableRes)
sl@0
    48
	{TUint8 stateRes[3]; \
sl@0
    49
	stateRes[0]=aNumGetStateRes; \
sl@0
    50
	stateRes[1]=aNumSetStateRes; \
sl@0
    51
	stateRes[2]=aNumListenableRes; \
sl@0
    52
	TInt r= DoControl(EInitialise,(TAny *)&stateRes); \
sl@0
    53
	return r;}
sl@0
    54
sl@0
    55
	// Synchronous methods
sl@0
    56
inline TInt RBusDevResManUs::GetNoOfResources(TUint& aNumResources, const TBool aInfoRead)
sl@0
    57
	{return(DoControl(EGetNoOfResources,(TAny*)&aNumResources, (TAny*)aInfoRead));}
sl@0
    58
sl@0
    59
inline TInt RBusDevResManUs::GetAllResourcesInfo(RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, TUint& aNumResources, const TBool aRefresh)
sl@0
    60
	{TUint* parms[2]; \
sl@0
    61
	parms[0]=&aNumResources; \
sl@0
    62
	parms[1]=(TUint*)aRefresh; \
sl@0
    63
	return(DoControl(EGetAllResourcesInfo,(TAny*)aInfoPtrs,(TAny*)&parms));}
sl@0
    64
sl@0
    65
inline TInt RBusDevResManUs::GetNoOfClients(TUint& aNumClients, const TBool aIncludeKern, const TBool aInfoRead)
sl@0
    66
	{TUint parms[3]; \
sl@0
    67
	parms[0]=(TUint)aIncludeKern; \
sl@0
    68
	parms[1]=0; /* 0 represents all clients */ \
sl@0
    69
	parms[2]=(TUint)aInfoRead; \
sl@0
    70
	return(DoControl(EGetNoOfClients,(TAny*)&aNumClients,(TAny*)&parms));}
sl@0
    71
sl@0
    72
inline TInt RBusDevResManUs::GetNamesAllClients(RSimplePointerArray<TClientName>* aInfoPtrs, TUint& aNumClients, const TBool aIncludeKern, const TBool aRefresh)
sl@0
    73
	{TUint* parms[4]; \
sl@0
    74
	parms[0]=&aNumClients; \
sl@0
    75
	parms[1]=(TUint*)aIncludeKern; \
sl@0
    76
	parms[2]=(TUint*)0; /* 0 represents all clients */ \
sl@0
    77
	parms[3]=(TUint*)aRefresh; \
sl@0
    78
	return(DoControl(EGetNamesAllClients,(TAny*)aInfoPtrs,(TAny*)&parms));}
sl@0
    79
sl@0
    80
inline TInt RBusDevResManUs::GetNumClientsUsingResource(const TUint aResourceId, TUint& aNumClients, const TBool aIncludeKern, const TBool aInfoRead)
sl@0
    81
	{TUint parms[3]; \
sl@0
    82
	parms[0]=(TUint)aIncludeKern; \
sl@0
    83
	parms[1]=aResourceId; \
sl@0
    84
	parms[2]=(TUint)aInfoRead; \
sl@0
    85
	return(DoControl(EGetNumClientsUsingResource,(TAny*)&aNumClients,(TAny*)&parms));}
sl@0
    86
sl@0
    87
inline TInt RBusDevResManUs::GetInfoOnClientsUsingResource(const TUint aResourceId, TUint& aNumClients, RSimplePointerArray<TClientInfoBuf>* aInfoPtrs, const TBool aIncludeKern, const TBool aRefresh)
sl@0
    88
	{TUint* parms[4]; \
sl@0
    89
	parms[0]=&aNumClients; \
sl@0
    90
	parms[1]=(TUint*)aIncludeKern; \
sl@0
    91
	parms[2]=(TUint*)aResourceId; \
sl@0
    92
	parms[3]=(TUint*)aRefresh; \
sl@0
    93
	return(DoControl(EGetInfoOnClientsUsingResource,(TAny*)aInfoPtrs,(TAny*)&parms));}
sl@0
    94
sl@0
    95
inline TInt RBusDevResManUs::GetNumResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources,const TBool aInfoRead)
sl@0
    96
	{TUint* parms[2]; \
sl@0
    97
	parms[0]=&aNumResources; \
sl@0
    98
	parms[1]=(TUint*)aInfoRead; \
sl@0
    99
	return(DoControl(EGetNumResourcesInUseByClient,(TAny*)&aClientName,(TAny*)&parms));}
sl@0
   100
sl@0
   101
inline TInt RBusDevResManUs::GetInfoOnResourcesInUseByClient(TDesC8& aClientName, TUint &aNumResources, RSimplePointerArray<TResourceInfoBuf>* aInfoPtrs, const TBool aRefresh)
sl@0
   102
	{TUint* parms[3]; \
sl@0
   103
	parms[0]=&aNumResources; \
sl@0
   104
	parms[1]=(TUint*)aInfoPtrs; \
sl@0
   105
	parms[2]=(TUint*)aRefresh; \
sl@0
   106
	return(DoControl(EGetInfoOnResourcesInUseByClient,(TAny*)&aClientName,(TAny*)&parms));}
sl@0
   107
sl@0
   108
inline TInt RBusDevResManUs::GetResourceIdByName(TDesC8& aResourceName, TUint& aResourceId)
sl@0
   109
	{return(DoControl(EGetResourceIdByName,(TAny*)&aResourceName,(TAny*)&aResourceId));}
sl@0
   110
sl@0
   111
inline TInt RBusDevResManUs::GetResourceInfo(const TUint aResourceId, TResourceInfoBuf* aInfo)
sl@0
   112
	{return(DoControl(EGetResourceInfo,(TAny*)aResourceId,aInfo));}
sl@0
   113
sl@0
   114
inline TInt RBusDevResManUs::GetResourceControllerVersion(TUint& aVer)
sl@0
   115
	{return(DoControl(EGetResourceControllerVersion,(TAny*)&aVer,NULL));}
sl@0
   116
sl@0
   117
inline TInt RBusDevResManUs::GetNumDependentsForResource(const TUint aResourceId, TUint* aNumDependents, const TBool aInfoRead)
sl@0
   118
	{TUint parms[2]; \
sl@0
   119
	parms[0]=aResourceId; \
sl@0
   120
	parms[1]=(TUint)aInfoRead; \
sl@0
   121
	return(DoControl(EGetNumDependentsForResource,(TAny*)aNumDependents,(TAny*)&parms));}
sl@0
   122
sl@0
   123
inline TInt RBusDevResManUs::GetDependentsIdForResource(const TUint aResourceId, TDes8& aResIdArray, TUint* aNumDepResources, const TBool aRefresh)
sl@0
   124
	{
sl@0
   125
	TUint parms[3]; \
sl@0
   126
	parms[0]=aResourceId; \
sl@0
   127
	parms[1]=(TUint)(&aResIdArray); \
sl@0
   128
	parms[2]=(TUint)aRefresh; \
sl@0
   129
	return(DoControl(EGetDependentsIdForResource,(TAny*)aNumDepResources,(TAny*)&parms));}
sl@0
   130
sl@0
   131
	//Asynchronous methods
sl@0
   132
inline void RBusDevResManUs::ChangeResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TInt aNewState)
sl@0
   133
	{DoRequest(EChangeResourceState,aStatus,(TAny*)aResourceId,(TAny*)aNewState);}
sl@0
   134
sl@0
   135
inline void RBusDevResManUs::GetResourceState(TRequestStatus& aStatus, const TUint aResourceId, const TBool aCached, TInt* aState, TInt *aLevelOwnerId)
sl@0
   136
	{TInt* parms[3]; \
sl@0
   137
	parms[0]=(TInt*)aCached; \
sl@0
   138
	parms[1]=aState; \
sl@0
   139
	parms[2]=aLevelOwnerId; \
sl@0
   140
	DoRequest(EGetResourceState,aStatus,(TAny*)aResourceId,(TAny*)&parms);}
sl@0
   141
sl@0
   142
inline void RBusDevResManUs::RequestNotification(TRequestStatus& aStatus, const TUint aResourceId)
sl@0
   143
	{DoRequest(ERequestChangeNotification,aStatus,(TAny*)aResourceId);}
sl@0
   144
sl@0
   145
inline void RBusDevResManUs::RequestNotification(TRequestStatus& aStatus, const TUint aResourceId, 
sl@0
   146
											const TInt aThreshold, const TBool aDirection)
sl@0
   147
	{TUint parms[2]; \
sl@0
   148
	parms[0]=aResourceId; \
sl@0
   149
	parms[1]=(TUint)aDirection; \
sl@0
   150
	DoRequest(ERequestQualifiedChangeNotification, aStatus, (TAny*)aThreshold, (TAny*)(&parms[0]));}
sl@0
   151
sl@0
   152
	// Specific request cancellation functions
sl@0
   153
inline TInt RBusDevResManUs::CancelChangeResourceState (TRequestStatus& aStatus)
sl@0
   154
	{return(DoControl(ECancelChangeResourceState,(TAny*)&aStatus));}
sl@0
   155
sl@0
   156
inline TInt RBusDevResManUs::CancelGetResourceState(TRequestStatus& aStatus)
sl@0
   157
	{return(DoControl(ECancelGetResourceState,(TAny*)&aStatus));}
sl@0
   158
sl@0
   159
inline TInt RBusDevResManUs::CancelRequestNotification(TRequestStatus& aStatus)
sl@0
   160
	{return(DoControl(ECancelRequestChangeNotification,(TAny*)&aStatus));}
sl@0
   161
sl@0
   162
	// Resource-specific request cancellation functions
sl@0
   163
inline TInt RBusDevResManUs::CancelChangeResourceStateRequests (const TUint aResourceId)
sl@0
   164
	{return(DoControl(ECancelChangeResourceStateRequests,(TAny*)aResourceId));}
sl@0
   165
sl@0
   166
inline TInt RBusDevResManUs::CancelGetResourceStateRequests(const TUint aResourceId)
sl@0
   167
	{return(DoControl(ECancelGetResourceStateRequests,(TAny*)aResourceId));}
sl@0
   168
sl@0
   169
inline TInt RBusDevResManUs::CancelNotificationRequests(const TUint aResourceId)
sl@0
   170
	{return(DoControl(ECancelChangeNotificationRequests,(TAny*)aResourceId));}
sl@0
   171
sl@0
   172
	// Generic Cancel function
sl@0
   173
inline void RBusDevResManUs::CancelAsyncOperation(TRequestStatus* aStatus)
sl@0
   174
	{DoCancel((TInt)aStatus);}
sl@0
   175
sl@0
   176
sl@0
   177
#ifdef RESOURCE_MANAGER_SIMULATED_PSL
sl@0
   178
	// Requests to support testing
sl@0
   179
inline	TInt RBusDevResManUs::GetNumCandidateAsyncResources(TUint& aNumResources)
sl@0
   180
	{return(DoControl(EGetNumCandidateAsyncResources,(TAny*)&aNumResources));}
sl@0
   181
sl@0
   182
inline	TInt RBusDevResManUs::GetCandidateAsyncResourceId(TUint aIndex, TUint& aResourceId)
sl@0
   183
	{return(DoControl(EGetCandidateAsyncResourceId,(TAny*)aIndex,(TAny*)&aResourceId));}
sl@0
   184
sl@0
   185
inline	TInt RBusDevResManUs::GetNumCandidateSharedResources(TUint& aNumResources)
sl@0
   186
	{return(DoControl(EGetNumCandidateSharedResources,(TAny*)&aNumResources));}
sl@0
   187
sl@0
   188
inline	TInt RBusDevResManUs::GetCandidateSharedResourceId(TUint aIndex, TUint& aResourceId)
sl@0
   189
	{return(DoControl(EGetCandidateSharedResourceId,(TAny*)aIndex,(TAny*)&aResourceId));}
sl@0
   190
sl@0
   191
#endif
sl@0
   192
sl@0
   193
#endif