kernel/eka/drivers/resourceman/resource.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     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 // e32\drivers\resourceman\resource.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <drivers/resourcecontrol.h>
       
    19 /**
       
    20     @publishedPartner
       
    21     @prototype 9.5
       
    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. 
       
    26     */
       
    27 EXPORT_C DStaticPowerResource::DStaticPowerResource(const TDesC8& aName, TInt aDefaultLevel) 
       
    28 	{
       
    29 	if(aName.Length() > KMaxResourceNameLength)
       
    30 		DPowerResourceController::Panic(DPowerResourceController::EResourceNameExceedsLimit);
       
    31 	iName = (HBuf8*)&aName;
       
    32 	iDefaultLevel = aDefaultLevel;
       
    33 	iCachedLevel = aDefaultLevel;
       
    34 	iLevelOwnerId = -1;
       
    35     __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DStaticPowerResource::DStaticPowerResource"));
       
    36 	}
       
    37 
       
    38 
       
    39 /**
       
    40     @publishedPartner
       
    41     @prototype 9.5
       
    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
       
    46     */
       
    47 EXPORT_C TInt DStaticPowerResource::GetInfo(TDes8* anInfo) const
       
    48 	{
       
    49     __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DStaticPowerResource::GetInfo"));
       
    50     TPowerResourceInfoV01 *pBuf = (TPowerResourceInfoV01*)anInfo;
       
    51     pBuf->iClass=Class();
       
    52     pBuf->iLatencyGet=LatencyGet();
       
    53     pBuf->iLatencySet=LatencySet();
       
    54     pBuf->iType=Type();
       
    55     pBuf->iUsage=Usage();
       
    56     pBuf->iSense=Sense();
       
    57     pBuf->iResourceName=iName;
       
    58 	pBuf->iDefaultLevel = iDefaultLevel;
       
    59 	__KTRACE_OPT(KRESMANAGER, Kern::Printf("<DStaticPowerResource::GetInfo"));
       
    60     return KErrNone;
       
    61 	}
       
    62