sl@0
|
1 |
// Copyright (c) 2007-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 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef D_PRMACCTST_H
|
sl@0
|
17 |
#define D_PRMACCTST_H
|
sl@0
|
18 |
|
sl@0
|
19 |
// The name of the device driver
|
sl@0
|
20 |
#ifdef RESOURCE_MANAGER_SIMULATED_PSL
|
sl@0
|
21 |
_LIT(KPrmIfLddName, "D_PRMACCTSTSIM");
|
sl@0
|
22 |
#else
|
sl@0
|
23 |
_LIT(KPrmIfLddName, "D_PRMACCTST");
|
sl@0
|
24 |
#endif
|
sl@0
|
25 |
|
sl@0
|
26 |
// The maximum length of a resource name (should always be 32 characters)
|
sl@0
|
27 |
const TInt KNameMaxLength = 32;
|
sl@0
|
28 |
|
sl@0
|
29 |
// This is a copy of TPowerResourceInfoV01 meant to be used by the user-side
|
sl@0
|
30 |
// test application.
|
sl@0
|
31 |
struct TResInfo
|
sl@0
|
32 |
{
|
sl@0
|
33 |
enum TType { EBinary, EMultiLevel, EMultiProperty };
|
sl@0
|
34 |
enum TUsage { ESingleUse, EShared };
|
sl@0
|
35 |
enum TLatency { EInstantaneous, ELongLatency };
|
sl@0
|
36 |
enum TClass { EPhysical, ELogical };
|
sl@0
|
37 |
enum TSense { EPositive, ENegative, ECustom };
|
sl@0
|
38 |
TClass iClass;
|
sl@0
|
39 |
TLatency iLatencyGet;
|
sl@0
|
40 |
TLatency iLatencySet;
|
sl@0
|
41 |
TType iType;
|
sl@0
|
42 |
TUsage iUsage;
|
sl@0
|
43 |
TSense iSense;
|
sl@0
|
44 |
TDesC8* iResourceName;
|
sl@0
|
45 |
TInt iResourceId;
|
sl@0
|
46 |
TInt iDefaultLevel;
|
sl@0
|
47 |
TInt iMinLevel;
|
sl@0
|
48 |
TInt iMaxLevel;
|
sl@0
|
49 |
TInt iReserved1;
|
sl@0
|
50 |
TInt iReserved2;
|
sl@0
|
51 |
TInt iReserved3;
|
sl@0
|
52 |
TInt iPslReserved1;
|
sl@0
|
53 |
TInt iPslReserved2;
|
sl@0
|
54 |
TInt iPslReserved3;
|
sl@0
|
55 |
};
|
sl@0
|
56 |
typedef TPckgBuf<TResInfo> TTestResourceInfoBuf01;
|
sl@0
|
57 |
|
sl@0
|
58 |
|
sl@0
|
59 |
// To be used with ChangeResourceStateAndGetState()
|
sl@0
|
60 |
class TTestResourceState
|
sl@0
|
61 |
{
|
sl@0
|
62 |
public:
|
sl@0
|
63 |
TUint iResourceId;
|
sl@0
|
64 |
TInt iNewState;
|
sl@0
|
65 |
};
|
sl@0
|
66 |
typedef TPckgBuf<TTestResourceState> TTestResourceStateBuf;
|
sl@0
|
67 |
|
sl@0
|
68 |
class RPrmIf : public RBusLogicalChannel
|
sl@0
|
69 |
{
|
sl@0
|
70 |
public:
|
sl@0
|
71 |
enum TControl
|
sl@0
|
72 |
{
|
sl@0
|
73 |
EControlOpenClient,
|
sl@0
|
74 |
EControlGetKernelExtClientId,
|
sl@0
|
75 |
EControlRegisterClient,
|
sl@0
|
76 |
EControlDeRegisterClient,
|
sl@0
|
77 |
EControlGetInfoOnResourcesInUseByClient,
|
sl@0
|
78 |
EControlChangeResourceState,
|
sl@0
|
79 |
EControlGetResourceState,
|
sl@0
|
80 |
EControlGetResourceStateCached,
|
sl@0
|
81 |
EControlGetLevelOwner,
|
sl@0
|
82 |
EControlGetTotalNumberOfResources,
|
sl@0
|
83 |
EControlGetResourceDependencies
|
sl@0
|
84 |
};
|
sl@0
|
85 |
enum TRequest
|
sl@0
|
86 |
{
|
sl@0
|
87 |
ERequestChangeResourceStateAndGetState
|
sl@0
|
88 |
};
|
sl@0
|
89 |
#ifndef __KERNEL_MODE__
|
sl@0
|
90 |
public:
|
sl@0
|
91 |
inline TInt Open()
|
sl@0
|
92 |
{ return DoCreate(KPrmIfLddName, TVersion(), KNullUnit, NULL, NULL); }
|
sl@0
|
93 |
inline TInt OpenClient(TUint aClientId)
|
sl@0
|
94 |
{ return DoControl(EControlOpenClient, (TAny*) aClientId); }
|
sl@0
|
95 |
inline TInt GetKernelExtClientId(TUint& aClientId)
|
sl@0
|
96 |
{ return DoControl(EControlGetKernelExtClientId, (TAny*) &aClientId); }
|
sl@0
|
97 |
inline TInt RegisterClient(const TDesC8& aClientName)
|
sl@0
|
98 |
{ return DoControl(EControlRegisterClient, (TAny*) &aClientName); }
|
sl@0
|
99 |
inline TInt DeRegisterClient()
|
sl@0
|
100 |
{ return DoControl(EControlDeRegisterClient); }
|
sl@0
|
101 |
inline TInt GetInfoOnResourcesInUseByClient(TUint aClientId, RBuf8& aInfo)
|
sl@0
|
102 |
{ return DoControl(EControlGetInfoOnResourcesInUseByClient, (TAny*) aClientId, (TAny*) &aInfo); }
|
sl@0
|
103 |
inline TInt ChangeResourceState(TUint aResourceId, TInt aNewState)
|
sl@0
|
104 |
{ return DoControl(EControlChangeResourceState, (TAny*) aResourceId, (TAny*) aNewState); }
|
sl@0
|
105 |
inline TInt GetResourceState(TUint aResourceId, TInt& aState)
|
sl@0
|
106 |
{ return DoControl(EControlGetResourceState, (TAny*) aResourceId, (TAny*) &aState); }
|
sl@0
|
107 |
inline TInt GetResourceStateCached(TUint aResourceId, TInt& aState)
|
sl@0
|
108 |
{ return DoControl(EControlGetResourceStateCached, (TAny*) aResourceId, (TAny*) &aState); }
|
sl@0
|
109 |
inline TInt GetLevelOwner(TUint aResourceId, TInt& aLevelOwner)
|
sl@0
|
110 |
{ return DoControl(EControlGetLevelOwner, (TAny*) aResourceId, (TAny*) &aLevelOwner); }
|
sl@0
|
111 |
inline TInt GetTotalNumberOfResources(TUint& aNumResources)
|
sl@0
|
112 |
{ return DoControl(EControlGetTotalNumberOfResources, (TAny*) &aNumResources); }
|
sl@0
|
113 |
inline TInt GetResourceDependencies(TUint aResourceId, RBuf8& aDeps)
|
sl@0
|
114 |
{ return DoControl(EControlGetResourceDependencies, (TAny*) aResourceId, (TAny*) &aDeps); }
|
sl@0
|
115 |
inline void ChangeResourceStateAndGetState(TRequestStatus& aRs, TTestResourceStateBuf& aState, TInt& aTmpState)
|
sl@0
|
116 |
{ DoRequest(ERequestChangeResourceStateAndGetState, aRs, (TAny*) &aState, (TAny*) &aTmpState); }
|
sl@0
|
117 |
|
sl@0
|
118 |
#endif // __KERNEL_MODE__
|
sl@0
|
119 |
};
|
sl@0
|
120 |
#endif // D_PRMACCTST_H
|