First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 // The name of the device driver
20 #ifdef RESOURCE_MANAGER_SIMULATED_PSL
21 _LIT(KPrmIfLddName, "D_PRMACCTSTSIM");
23 _LIT(KPrmIfLddName, "D_PRMACCTST");
26 // The maximum length of a resource name (should always be 32 characters)
27 const TInt KNameMaxLength = 32;
29 // This is a copy of TPowerResourceInfoV01 meant to be used by the user-side
33 enum TType { EBinary, EMultiLevel, EMultiProperty };
34 enum TUsage { ESingleUse, EShared };
35 enum TLatency { EInstantaneous, ELongLatency };
36 enum TClass { EPhysical, ELogical };
37 enum TSense { EPositive, ENegative, ECustom };
44 TDesC8* iResourceName;
56 typedef TPckgBuf<TResInfo> TTestResourceInfoBuf01;
59 // To be used with ChangeResourceStateAndGetState()
60 class TTestResourceState
66 typedef TPckgBuf<TTestResourceState> TTestResourceStateBuf;
68 class RPrmIf : public RBusLogicalChannel
74 EControlGetKernelExtClientId,
75 EControlRegisterClient,
76 EControlDeRegisterClient,
77 EControlGetInfoOnResourcesInUseByClient,
78 EControlChangeResourceState,
79 EControlGetResourceState,
80 EControlGetResourceStateCached,
81 EControlGetLevelOwner,
82 EControlGetTotalNumberOfResources,
83 EControlGetResourceDependencies
87 ERequestChangeResourceStateAndGetState
89 #ifndef __KERNEL_MODE__
92 { return DoCreate(KPrmIfLddName, TVersion(), KNullUnit, NULL, NULL); }
93 inline TInt OpenClient(TUint aClientId)
94 { return DoControl(EControlOpenClient, (TAny*) aClientId); }
95 inline TInt GetKernelExtClientId(TUint& aClientId)
96 { return DoControl(EControlGetKernelExtClientId, (TAny*) &aClientId); }
97 inline TInt RegisterClient(const TDesC8& aClientName)
98 { return DoControl(EControlRegisterClient, (TAny*) &aClientName); }
99 inline TInt DeRegisterClient()
100 { return DoControl(EControlDeRegisterClient); }
101 inline TInt GetInfoOnResourcesInUseByClient(TUint aClientId, RBuf8& aInfo)
102 { return DoControl(EControlGetInfoOnResourcesInUseByClient, (TAny*) aClientId, (TAny*) &aInfo); }
103 inline TInt ChangeResourceState(TUint aResourceId, TInt aNewState)
104 { return DoControl(EControlChangeResourceState, (TAny*) aResourceId, (TAny*) aNewState); }
105 inline TInt GetResourceState(TUint aResourceId, TInt& aState)
106 { return DoControl(EControlGetResourceState, (TAny*) aResourceId, (TAny*) &aState); }
107 inline TInt GetResourceStateCached(TUint aResourceId, TInt& aState)
108 { return DoControl(EControlGetResourceStateCached, (TAny*) aResourceId, (TAny*) &aState); }
109 inline TInt GetLevelOwner(TUint aResourceId, TInt& aLevelOwner)
110 { return DoControl(EControlGetLevelOwner, (TAny*) aResourceId, (TAny*) &aLevelOwner); }
111 inline TInt GetTotalNumberOfResources(TUint& aNumResources)
112 { return DoControl(EControlGetTotalNumberOfResources, (TAny*) &aNumResources); }
113 inline TInt GetResourceDependencies(TUint aResourceId, RBuf8& aDeps)
114 { return DoControl(EControlGetResourceDependencies, (TAny*) aResourceId, (TAny*) &aDeps); }
115 inline void ChangeResourceStateAndGetState(TRequestStatus& aRs, TTestResourceStateBuf& aState, TInt& aTmpState)
116 { DoRequest(ERequestChangeResourceStateAndGetState, aRs, (TAny*) &aState, (TAny*) &aTmpState); }
118 #endif // __KERNEL_MODE__
120 #endif // D_PRMACCTST_H