0
|
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 |
//
|
|
15 |
|
|
16 |
#ifndef D_PRMACCTST_H
|
|
17 |
#define D_PRMACCTST_H
|
|
18 |
|
|
19 |
// The name of the device driver
|
|
20 |
#ifdef RESOURCE_MANAGER_SIMULATED_PSL
|
|
21 |
_LIT(KPrmIfLddName, "D_PRMACCTSTSIM");
|
|
22 |
#else
|
|
23 |
_LIT(KPrmIfLddName, "D_PRMACCTST");
|
|
24 |
#endif
|
|
25 |
|
|
26 |
// The maximum length of a resource name (should always be 32 characters)
|
|
27 |
const TInt KNameMaxLength = 32;
|
|
28 |
|
|
29 |
// This is a copy of TPowerResourceInfoV01 meant to be used by the user-side
|
|
30 |
// test application.
|
|
31 |
struct TResInfo
|
|
32 |
{
|
|
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 };
|
|
38 |
TClass iClass;
|
|
39 |
TLatency iLatencyGet;
|
|
40 |
TLatency iLatencySet;
|
|
41 |
TType iType;
|
|
42 |
TUsage iUsage;
|
|
43 |
TSense iSense;
|
|
44 |
TDesC8* iResourceName;
|
|
45 |
TInt iResourceId;
|
|
46 |
TInt iDefaultLevel;
|
|
47 |
TInt iMinLevel;
|
|
48 |
TInt iMaxLevel;
|
|
49 |
TInt iReserved1;
|
|
50 |
TInt iReserved2;
|
|
51 |
TInt iReserved3;
|
|
52 |
TInt iPslReserved1;
|
|
53 |
TInt iPslReserved2;
|
|
54 |
TInt iPslReserved3;
|
|
55 |
};
|
|
56 |
typedef TPckgBuf<TResInfo> TTestResourceInfoBuf01;
|
|
57 |
|
|
58 |
|
|
59 |
// To be used with ChangeResourceStateAndGetState()
|
|
60 |
class TTestResourceState
|
|
61 |
{
|
|
62 |
public:
|
|
63 |
TUint iResourceId;
|
|
64 |
TInt iNewState;
|
|
65 |
};
|
|
66 |
typedef TPckgBuf<TTestResourceState> TTestResourceStateBuf;
|
|
67 |
|
|
68 |
class RPrmIf : public RBusLogicalChannel
|
|
69 |
{
|
|
70 |
public:
|
|
71 |
enum TControl
|
|
72 |
{
|
|
73 |
EControlOpenClient,
|
|
74 |
EControlGetKernelExtClientId,
|
|
75 |
EControlRegisterClient,
|
|
76 |
EControlDeRegisterClient,
|
|
77 |
EControlGetInfoOnResourcesInUseByClient,
|
|
78 |
EControlChangeResourceState,
|
|
79 |
EControlGetResourceState,
|
|
80 |
EControlGetResourceStateCached,
|
|
81 |
EControlGetLevelOwner,
|
|
82 |
EControlGetTotalNumberOfResources,
|
|
83 |
EControlGetResourceDependencies
|
|
84 |
};
|
|
85 |
enum TRequest
|
|
86 |
{
|
|
87 |
ERequestChangeResourceStateAndGetState
|
|
88 |
};
|
|
89 |
#ifndef __KERNEL_MODE__
|
|
90 |
public:
|
|
91 |
inline TInt Open()
|
|
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); }
|
|
117 |
|
|
118 |
#endif // __KERNEL_MODE__
|
|
119 |
};
|
|
120 |
#endif // D_PRMACCTST_H
|