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 |
// e32\drivers\resourceman\resource.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <drivers/resourcecontrol.h>
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@publishedPartner
|
sl@0
|
21 |
@prototype 9.5
|
sl@0
|
22 |
Constructor for static resource
|
sl@0
|
23 |
This sets the passed resource name and default level.
|
sl@0
|
24 |
@param aName The name for the resource to be set.
|
sl@0
|
25 |
@param aDefaultLevel Default level of the resource.
|
sl@0
|
26 |
*/
|
sl@0
|
27 |
EXPORT_C DStaticPowerResource::DStaticPowerResource(const TDesC8& aName, TInt aDefaultLevel)
|
sl@0
|
28 |
{
|
sl@0
|
29 |
if(aName.Length() > KMaxResourceNameLength)
|
sl@0
|
30 |
DPowerResourceController::Panic(DPowerResourceController::EResourceNameExceedsLimit);
|
sl@0
|
31 |
iName = (HBuf8*)&aName;
|
sl@0
|
32 |
iDefaultLevel = aDefaultLevel;
|
sl@0
|
33 |
iCachedLevel = aDefaultLevel;
|
sl@0
|
34 |
iLevelOwnerId = -1;
|
sl@0
|
35 |
__KTRACE_OPT(KRESMANAGER, Kern::Printf(">DStaticPowerResource::DStaticPowerResource"));
|
sl@0
|
36 |
}
|
sl@0
|
37 |
|
sl@0
|
38 |
|
sl@0
|
39 |
/**
|
sl@0
|
40 |
@publishedPartner
|
sl@0
|
41 |
@prototype 9.5
|
sl@0
|
42 |
Default implementation for GetInfo.
|
sl@0
|
43 |
PSL should override this function to fill the PSL specific arguements
|
sl@0
|
44 |
@param aInfo Updated with the resource information structure(TPowerResourceInfoV01).
|
sl@0
|
45 |
@return KErrNone if success or one of the system wide errors
|
sl@0
|
46 |
*/
|
sl@0
|
47 |
EXPORT_C TInt DStaticPowerResource::GetInfo(TDes8* anInfo) const
|
sl@0
|
48 |
{
|
sl@0
|
49 |
__KTRACE_OPT(KRESMANAGER, Kern::Printf(">DStaticPowerResource::GetInfo"));
|
sl@0
|
50 |
TPowerResourceInfoV01 *pBuf = (TPowerResourceInfoV01*)anInfo;
|
sl@0
|
51 |
pBuf->iClass=Class();
|
sl@0
|
52 |
pBuf->iLatencyGet=LatencyGet();
|
sl@0
|
53 |
pBuf->iLatencySet=LatencySet();
|
sl@0
|
54 |
pBuf->iType=Type();
|
sl@0
|
55 |
pBuf->iUsage=Usage();
|
sl@0
|
56 |
pBuf->iSense=Sense();
|
sl@0
|
57 |
pBuf->iResourceName=iName;
|
sl@0
|
58 |
pBuf->iDefaultLevel = iDefaultLevel;
|
sl@0
|
59 |
__KTRACE_OPT(KRESMANAGER, Kern::Printf("<DStaticPowerResource::GetInfo"));
|
sl@0
|
60 |
return KErrNone;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|