os/kernelhwsrv/kernel/eka/drivers/resourceman/resource.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/drivers/resourceman/resource.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,62 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\drivers\resourceman\resource.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include <drivers/resourcecontrol.h>
    1.22 +/**
    1.23 +    @publishedPartner
    1.24 +    @prototype 9.5
    1.25 +    Constructor for static resource
    1.26 +    This sets the passed resource name and default level.
    1.27 +    @param aName The name for the resource to be set.
    1.28 +	@param aDefaultLevel Default level of the resource. 
    1.29 +    */
    1.30 +EXPORT_C DStaticPowerResource::DStaticPowerResource(const TDesC8& aName, TInt aDefaultLevel) 
    1.31 +	{
    1.32 +	if(aName.Length() > KMaxResourceNameLength)
    1.33 +		DPowerResourceController::Panic(DPowerResourceController::EResourceNameExceedsLimit);
    1.34 +	iName = (HBuf8*)&aName;
    1.35 +	iDefaultLevel = aDefaultLevel;
    1.36 +	iCachedLevel = aDefaultLevel;
    1.37 +	iLevelOwnerId = -1;
    1.38 +    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DStaticPowerResource::DStaticPowerResource"));
    1.39 +	}
    1.40 +
    1.41 +
    1.42 +/**
    1.43 +    @publishedPartner
    1.44 +    @prototype 9.5
    1.45 +    Default implementation for GetInfo.
    1.46 +	PSL should override this function to fill the PSL specific arguements
    1.47 +    @param aInfo Updated with the resource information structure(TPowerResourceInfoV01).
    1.48 +    @return KErrNone if success or one of the system wide errors
    1.49 +    */
    1.50 +EXPORT_C TInt DStaticPowerResource::GetInfo(TDes8* anInfo) const
    1.51 +	{
    1.52 +    __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DStaticPowerResource::GetInfo"));
    1.53 +    TPowerResourceInfoV01 *pBuf = (TPowerResourceInfoV01*)anInfo;
    1.54 +    pBuf->iClass=Class();
    1.55 +    pBuf->iLatencyGet=LatencyGet();
    1.56 +    pBuf->iLatencySet=LatencySet();
    1.57 +    pBuf->iType=Type();
    1.58 +    pBuf->iUsage=Usage();
    1.59 +    pBuf->iSense=Sense();
    1.60 +    pBuf->iResourceName=iName;
    1.61 +	pBuf->iDefaultLevel = iDefaultLevel;
    1.62 +	__KTRACE_OPT(KRESMANAGER, Kern::Printf("<DStaticPowerResource::GetInfo"));
    1.63 +    return KErrNone;
    1.64 +	}
    1.65 +