Update contrib.
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.
14 // e32\drivers\resourceman\resource.cpp
18 #include <drivers/resourcecontrol.h>
22 Constructor for static resource
23 This sets the passed resource name and default level.
24 @param aName The name for the resource to be set.
25 @param aDefaultLevel Default level of the resource.
27 EXPORT_C DStaticPowerResource::DStaticPowerResource(const TDesC8& aName, TInt aDefaultLevel)
29 if(aName.Length() > KMaxResourceNameLength)
30 DPowerResourceController::Panic(DPowerResourceController::EResourceNameExceedsLimit);
31 iName = (HBuf8*)&aName;
32 iDefaultLevel = aDefaultLevel;
33 iCachedLevel = aDefaultLevel;
35 __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DStaticPowerResource::DStaticPowerResource"));
42 Default implementation for GetInfo.
43 PSL should override this function to fill the PSL specific arguements
44 @param aInfo Updated with the resource information structure(TPowerResourceInfoV01).
45 @return KErrNone if success or one of the system wide errors
47 EXPORT_C TInt DStaticPowerResource::GetInfo(TDes8* anInfo) const
49 __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DStaticPowerResource::GetInfo"));
50 TPowerResourceInfoV01 *pBuf = (TPowerResourceInfoV01*)anInfo;
52 pBuf->iLatencyGet=LatencyGet();
53 pBuf->iLatencySet=LatencySet();
57 pBuf->iResourceName=iName;
58 pBuf->iDefaultLevel = iDefaultLevel;
59 __KTRACE_OPT(KRESMANAGER, Kern::Printf("<DStaticPowerResource::GetInfo"));