os/kernelhwsrv/kerneltest/e32test/resourceman/resourceman_psl/rescontrol_psl.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/resourceman/resourceman_psl/rescontrol_psl.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,952 @@
     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 +// e32test\resourceman\resourceman_psl\rescontrol_psl.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include "rescontrol_psl.h"
    1.22 +TInt KSimulatedRCThreadPriority = 28;
    1.23 +#ifdef RESOURCE_MANAGER_SIMULATED_PSL
    1.24 +static DSimulatedPowerResourceController TheController;
    1.25 +#endif
    1.26 +
    1.27 +//Resource controller creation
    1.28 +#ifdef RESOURCE_MANAGER_SIMULATED_PSL
    1.29 +DECLARE_STANDARD_PDD()
    1.30 +	{
    1.31 +	TInt r = DPowerResourceController::InitController();							
    1.32 +	if(r == KErrNone)
    1.33 +		return new DResConPddFactory;
    1.34 +	return NULL;																
    1.35 +	}
    1.36 +#endif
    1.37 +
    1.38 +/** ISR function invoked when the specified amount of time expires. This is used for event driven resources. */
    1.39 +void DSimulatedPowerResourceController::TimerIsrFunc(TAny *ptr)
    1.40 +	{
    1.41 +	DSimulatedPowerResourceController *pC = (DSimulatedPowerResourceController *)ptr;
    1.42 +	//Queues a Dfc to signal fast semaphore.
    1.43 +	pC->iEventDfc.Add();
    1.44 +	}
    1.45 +
    1.46 +/** DFC function to signal the fast semaphore. For event driven resources, the PIL is blocked until specified time (just 
    1.47 +	to simulate hardware event). */  
    1.48 +void DSimulatedPowerResourceController::EventDfcFunc(TAny *ptr)
    1.49 +	{
    1.50 +	DSimulatedPowerResourceController *pC = (DSimulatedPowerResourceController *)ptr;
    1.51 +	NKern::FSSignal((NFastSemaphore*)&pC->iEventFastSem);
    1.52 +	}
    1.53 +
    1.54 +/** Constructor for simulated resource controller. */
    1.55 +DSimulatedPowerResourceController::DSimulatedPowerResourceController():DPowerResourceController(),iStaticResourceCount(0), iEventDfc(EventDfcFunc, this)
    1.56 +	{
    1.57 +	Kern::Printf(">DSimulatedPowerResourceController");
    1.58 +	}
    1.59 +
    1.60 +/** Destructor for simulated resource controller. */
    1.61 +DSimulatedPowerResourceController::~DSimulatedPowerResourceController()
    1.62 +	{
    1.63 +	Kern::Printf("DSimulatedPowerResourceController::~DSimulatedPowerResourceController()\n");
    1.64 +	((TDynamicDfcQue*)iDfcQ)->Destroy();
    1.65 +	DStaticPowerResource *pR;
    1.66 +	TUint c;
    1.67 +	for(c = 0; c < iStaticResourceCount; c++)
    1.68 +		{
    1.69 +		pR = iResources[c];
    1.70 +		delete pR;
    1.71 +		}
    1.72 +	delete []iResources;
    1.73 +#ifdef PRM_ENABLE_EXTENDED_VERSION
    1.74 +	DStaticPowerResourceD* pDR;
    1.75 +	
    1.76 +	delete []iNodeArray; //Delete dependency nodes
    1.77 +	for(c = 0; c < iStaticResDependencyCount; c++) 
    1.78 +		{
    1.79 +		pDR = iDependencyResources[c];
    1.80 +		delete pDR;
    1.81 +		}
    1.82 +	delete []iDependencyResources;
    1.83 +#endif
    1.84 +	}
    1.85 +
    1.86 +#ifdef PRM_ENABLE_EXTENDED_VERSION
    1.87 +//Function to return the controller pointer to use in extended psl file
    1.88 +DSimulatedPowerResourceController* GetControllerPtr()
    1.89 +	{
    1.90 +	return &TheController;
    1.91 +	}
    1.92 +#endif
    1.93 +
    1.94 +/** This function is called from PIL, during resource controller creation phase.
    1.95 +	It creates a DFC queue and then invokes setDfcQ function to PIL to set the queue.
    1.96 +	It calls InitPools function of PIL to create the specified sizes of clients, 
    1.97 +	client levels and requests pools.
    1.98 +	*/
    1.99 +TInt DSimulatedPowerResourceController::DoInitController()
   1.100 +	{
   1.101 +	TInt r = KErrNone;
   1.102 +	Kern::Printf(">DSimulatedPowerResourceController::DoInitController()");
   1.103 +	//Create a DFC queue
   1.104 +	r = Kern::DynamicDfcQCreate((TDynamicDfcQue*&)iDfcQ, KSimulatedRCThreadPriority, KResmanName);
   1.105 +	if(r != KErrNone)
   1.106 +		{
   1.107 +		Kern::Printf("DFC Queue creation failed");
   1.108 +		return r;
   1.109 +		}
   1.110 +
   1.111 +#ifdef CPU_AFFINITY_ANY
   1.112 +	NKern::ThreadSetCpuAffinity((NThread*)(iDfcQ->iThread), KCpuAffinityAny);			
   1.113 +#endif
   1.114 +
   1.115 +	//Call the resource controller to set the DFCQ
   1.116 +	SetDfcQ(iDfcQ);
   1.117 +	
   1.118 +#ifdef PRM_ENABLE_EXTENDED_VERSION
   1.119 +	//Create a DFC Dependency Queue
   1.120 +	r = Kern::DynamicDfcQCreate((TDynamicDfcQue*&)iDfcQDependency, KSimulatedRCThreadPriority, 
   1.121 +									KResmanName);
   1.122 +	if(r != KErrNone)
   1.123 +		{
   1.124 +		Kern::Printf("DFC Dependency Queue creation failed");
   1.125 +		return r;
   1.126 +		}
   1.127 +	//Call the resource controller to set the DFCQDependency
   1.128 +	SetDfcQDependency(iDfcQDependency);
   1.129 +#endif
   1.130 +	//Init pools
   1.131 +	r = InitPools(KERNEL_CLIENTS, USER_CLIENTS, CLIENT_LEVELS, REQUESTS);
   1.132 +	return r;
   1.133 +	}
   1.134 +
   1.135 +/** This function is used only for testing purpose to test the RegisterResorcesForIdle API
   1.136 +	ideally will be used by Power controller to obtain the state of the resources will be interested
   1.137 +	for idle power management.
   1.138 +	*/
   1.139 +EXPORT_C TInt DSimulatedPowerResourceController::CaptureIdleResourcesInfo(TUint aControllerId, TUint aNumResources, TPtr* aPtr)
   1.140 +	{
   1.141 +	Kern::Printf("DSimulatedPowerResourceController::CaptureIdleResourcesInfo\n");
   1.142 +	TInt r = TheController.RegisterResourcesForIdle(aControllerId, aNumResources, aPtr);
   1.143 +	return r;
   1.144 +	}
   1.145 +
   1.146 +/** This function is used only for testing purpose. This is complete the initialization of resource controller.
   1.147 +	This is used to test the Postbootlevel and registration of static resource API's. 
   1.148 +	*/
   1.149 +EXPORT_C TInt DSimulatedPowerResourceController::CompleteResourceControllerInitialisation()
   1.150 +	{
   1.151 +	Kern::Printf("DSimulatedPowerResourceController::CompleteResourceControllerInitialisation()\n");
   1.152 +	return(TheController.InitResources());
   1.153 +	}
   1.154 +
   1.155 +/** This function changes the state of the resource to appropriate value */
   1.156 +TInt DSimulatedPowerResourceController::ChangeResource(TPowerRequest& req, TInt& aCurrentLevel, TInt aMaxLevel, TInt aMinLevel)
   1.157 +	{
   1.158 +	DStaticPowerResource* pR = req.Resource();
   1.159 +	if(pR->Sense() == DStaticPowerResource::ECustom) //Custom sense set it to specified level
   1.160 +		{
   1.161 +		req.Level() = aCurrentLevel;
   1.162 +		}
   1.163 +	else if(pR->Sense() == DStaticPowerResource::EPositive) 
   1.164 +		{
   1.165 +		//Set it to value specified if valid, otherwise minimum or maximum based on the value.
   1.166 +		if(req.Level() > aMaxLevel)
   1.167 +			req.Level() = aMaxLevel;
   1.168 +		else if(req.Level() < aMinLevel)
   1.169 +			req.Level() = aMinLevel;
   1.170 +		aCurrentLevel = req.Level();
   1.171 +		}
   1.172 +	else
   1.173 +		{
   1.174 +		//Set it to value specified if valid, otherwise minimum or maximum based on the value.
   1.175 +		if( req.Level() < aMaxLevel)
   1.176 +			req.Level() = aMaxLevel;
   1.177 +		else if(req.Level() > aMinLevel)
   1.178 +			req.Level() = aMinLevel;
   1.179 +		aCurrentLevel = req.Level();
   1.180 +		}
   1.181 +	return KErrNone;
   1.182 +	}
   1.183 +
   1.184 +/** This function processes all instantaneous resource types. Instantaneous resources should returned immediately, so 
   1.185 +	this function returns immediately after updating the value. */
   1.186 +TInt DSimulatedPowerResourceController::ProcessInstantaneousResources(TPowerRequest& req, TInt& aCurrentLevel, TInt aMaxLevel, TInt aMinLevel, TInt aDefaultLevel)
   1.187 +	{
   1.188 +	if(req.ReqType() == TPowerRequest::EGet)
   1.189 +		{
   1.190 +		req.Level() = aCurrentLevel;
   1.191 +		}
   1.192 +	else if(req.ReqType() == TPowerRequest::EChange)
   1.193 +		{
   1.194 +		return ChangeResource(req, aCurrentLevel, aMaxLevel, aMinLevel);
   1.195 +		}
   1.196 +	else if(req.ReqType() == TPowerRequest::ESetDefaultLevel)
   1.197 +		{
   1.198 +		req.Level() = aDefaultLevel;
   1.199 +		aCurrentLevel = aDefaultLevel;
   1.200 +		}
   1.201 +	else
   1.202 +		return KErrNotSupported;
   1.203 +	return KErrNone;
   1.204 +	}
   1.205 +
   1.206 +/** Function used for polling resources. */
   1.207 +TBool PollingFunction(TAny* ptr)
   1.208 +	{
   1.209 +	static TInt count = 0;
   1.210 +	if(++count == (TInt)ptr)
   1.211 +		{
   1.212 +		count = 0;
   1.213 +		return ETrue;
   1.214 +		}
   1.215 +	return EFalse;
   1.216 +	}
   1.217 +
   1.218 +/** This function processes polled resources. It waits for specified time and then performs requested operation
   1.219 +	if the specified operation is long latency operation.
   1.220 +	*/
   1.221 +TInt DSimulatedPowerResourceController::ProcessPolledResources(TPowerRequest& req, TInt&aCurrentLevel, TInt aMaxLevel, TInt aMinLevel, TInt aDefaultLevel, TInt aBlockTime)
   1.222 +	{
   1.223 +	DStaticPowerResource* pR = req.Resource();
   1.224 +	if(req.ReqType() == TPowerRequest::EGet)
   1.225 +		{
   1.226 +		if(!pR->LatencyGet())
   1.227 +			return ProcessInstantaneousResources(req, aCurrentLevel, aMaxLevel, aMinLevel, aDefaultLevel);
   1.228 +		Kern::PollingWait(PollingFunction, (TAny*)aBlockTime, 3, aBlockTime);
   1.229 +		req.Level() = aCurrentLevel;
   1.230 +		}
   1.231 +	else if(req.ReqType() == TPowerRequest::EChange)
   1.232 +		{
   1.233 +		if(!pR->LatencySet())
   1.234 +			return ProcessInstantaneousResources(req, aCurrentLevel, aMaxLevel, aMinLevel, aDefaultLevel);
   1.235 +		Kern::PollingWait(PollingFunction, (TAny*)aBlockTime, 3, aBlockTime);
   1.236 +		return ChangeResource(req, aCurrentLevel, aMaxLevel, aMinLevel);
   1.237 +		}
   1.238 +	else if(req.ReqType() == TPowerRequest::ESetDefaultLevel)
   1.239 +		{
   1.240 +		if(!pR->LatencySet())
   1.241 +			return ProcessInstantaneousResources(req, aCurrentLevel, aMaxLevel, aMinLevel, aDefaultLevel);
   1.242 +		Kern::PollingWait(PollingFunction, (TAny*)aBlockTime, 3, aBlockTime);
   1.243 +		req.Level() = aDefaultLevel;
   1.244 +		aCurrentLevel = aDefaultLevel;
   1.245 +		}
   1.246 +	else
   1.247 +		return KErrNotSupported;
   1.248 +	return KErrNone;
   1.249 +	}
   1.250 +
   1.251 +/** This function processes event driven resources. It makes the calling function (PIL) to block on fast semaphore
   1.252 +	and starts the timer.The PIL is blocked until the timer expires. 
   1.253 +	*/
   1.254 +TInt DSimulatedPowerResourceController::ProcessEventResources(TPowerRequest& req, TInt& aCurrentLevel, TInt aMaxLevel, TInt aMinLevel, TInt aDefaultLevel, TInt aBlockTime)
   1.255 +	{
   1.256 +	DStaticPowerResource* pR = req.Resource();
   1.257 +	if(((req.ReqType() == TPowerRequest::EGet) && (!pR->LatencyGet())) || ((req.ReqType() == TPowerRequest::EChange) && (!pR->LatencySet())) || ((req.ReqType() == TPowerRequest::ESetDefaultLevel) && (!pR->LatencySet())))
   1.258 +		return ProcessInstantaneousResources(req, aCurrentLevel, aMaxLevel, aMinLevel, aDefaultLevel);	
   1.259 +	iEventFastSem.iOwningThread = (NThreadBase*)NKern::CurrentThread();
   1.260 +	iEventFastSem.iCount = 0;
   1.261 +	TInt timeout = NKern::TimerTicks(aBlockTime);
   1.262 +	NTimer iEventTimer(TimerIsrFunc, this);
   1.263 +	iEventTimer.OneShot(timeout);
   1.264 +	NKern::FSWait(&iEventFastSem);
   1.265 +	if(req.ReqType() == TPowerRequest::EGet)
   1.266 +		req.Level() = aCurrentLevel;
   1.267 +	else if(req.ReqType() == TPowerRequest::EChange)
   1.268 +		return ChangeResource(req, aCurrentLevel, aMaxLevel, aMinLevel);
   1.269 +	else if(req.ReqType() == TPowerRequest::ESetDefaultLevel)
   1.270 +		{
   1.271 +		req.Level() = aDefaultLevel;
   1.272 +		aCurrentLevel = aDefaultLevel;
   1.273 +		}
   1.274 +	else
   1.275 +		return KErrNotSupported;
   1.276 +	return KErrNone;
   1.277 +	}
   1.278 +
   1.279 +//This registers all static resource with resource controller. This function is called by PIL
   1.280 +TInt DSimulatedPowerResourceController::DoRegisterStaticResources(DStaticPowerResource**& aStaticResourceArray, TUint16& aStaticResourceCount)
   1.281 +	{
   1.282 +	Kern::Printf(">DSimulatedPowerResourceController::DoRegisterStaticResources");
   1.283 +	aStaticResourceArray = (DStaticPowerResource**)new(DStaticPowerResource*[MAX_RESOURCE_COUNT]);
   1.284 +	if(!aStaticResourceArray)
   1.285 +		return KErrNoMemory;
   1.286 +	DStaticPowerResource* pR = NULL;
   1.287 +
   1.288 +	//Create Binary Single Instantaneous Positive Resource
   1.289 +	pR = new DBSIGISPResource();
   1.290 +	if(!pR)
   1.291 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.292 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.293 +
   1.294 +	//Create Multilevel Single Instantaneous Positive Resource
   1.295 +	pR = new DMLSIGISPResource();
   1.296 +	if(!pR)
   1.297 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.298 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.299 +
   1.300 +	//Create Binary Single Instantaneous Negative Resource
   1.301 +	pR = new DBSIGISNResource();
   1.302 +	if(!pR)
   1.303 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.304 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.305 +
   1.306 +	//Create Multilevel Single Instantaneous Negative Resource
   1.307 +	pR = new DMLSIGISNResource();
   1.308 +	if(!pR)
   1.309 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.310 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.311 +
   1.312 +	//Create Binary Single Longlatency Positive Resource
   1.313 +	pR = new DBSLGLSPResource();
   1.314 +	if(!pR)
   1.315 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.316 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.317 +
   1.318 +	//Create Multilevel Single Longlatency  Positive Resource
   1.319 +	pR = new DMLSLGLSPResource();
   1.320 +	if(!pR)
   1.321 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.322 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.323 +
   1.324 +	//Create Binary Single Longlatency Get & Instantaneous Set Negative Resource
   1.325 +	pR = new DBSLGISNResource();
   1.326 +	if(!pR)
   1.327 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.328 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.329 +
   1.330 +	//Create Multilevel Single Longlatency Get & Instantaneous Set Negative Resource
   1.331 +	pR = new DMLSLGISNResource();
   1.332 +	if(!pR)
   1.333 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.334 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.335 +
   1.336 +	//Create Binary Single Instantaneous Get & Longlatency Set Positive Resource
   1.337 +	pR = new DBSIGLSPResource();
   1.338 +	if(!pR)
   1.339 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.340 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.341 +
   1.342 +	//Create Multilevel Single Instantaneous Get & Longlatency Set Positive Resource
   1.343 +	pR = new DMLSIGLSPResource();
   1.344 +	if(!pR)
   1.345 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.346 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.347 +
   1.348 +	//Create Binary SHared Instantaneous Positive Resource
   1.349 +	pR = new DBSHIGISPResource();
   1.350 +	if(!pR)
   1.351 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.352 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.353 +
   1.354 +	//Create Multilevel SHared Instantaneous Positive Resource
   1.355 +	pR = new DMLSHIGISPResource();
   1.356 +	if(!pR)
   1.357 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.358 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.359 +
   1.360 +	//Create Binary SHared Instantaneous Negative Resource
   1.361 +	pR = new DBSHIGISNResource();
   1.362 +	if(!pR)
   1.363 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.364 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.365 +
   1.366 +	//Create Multilevel SHared Instantaneous Negative Resource
   1.367 +	pR = new DMLSHIGISNResource();
   1.368 +	if(!pR)
   1.369 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.370 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.371 +
   1.372 +	//Create Binary SHared Longlatency Positive Resource
   1.373 +	pR = new DBSHLGLSPResource();
   1.374 +	if(!pR)
   1.375 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.376 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.377 +
   1.378 +	//Create Multilevel SHared Longlatency  Positive Resource
   1.379 +	pR = new DMLSHLGLSPResource();
   1.380 +	if(!pR)
   1.381 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.382 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.383 +
   1.384 +	//Create Binary SHared Longlatency Get & Instantaneous Set Negative Resource
   1.385 +	pR = new DBSHLGISNResource();
   1.386 +	if(!pR)
   1.387 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.388 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.389 +
   1.390 +	//Create Multilevel SHared Longlatency Get & Instantaneous Set Negative Resource
   1.391 +	pR = new DMLSHLGISNResource();
   1.392 +	if(!pR)
   1.393 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.394 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.395 +
   1.396 +	//Create holes in resource array
   1.397 +	aStaticResourceArray[iStaticResourceCount++] = NULL;
   1.398 +	aStaticResourceArray[iStaticResourceCount++] = NULL;
   1.399 +	//Create Binary SHared Instantaneous Get & Longlatency Set Positive Resource
   1.400 +	pR = new DBSHIGLSPResource();
   1.401 +	if(!pR)
   1.402 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.403 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.404 +
   1.405 +	//Create Multilevel SHared Instantaneous Get & Longlatency Set Positive Resource
   1.406 +	pR = new DMLSHIGLSPResource();
   1.407 +	if(!pR)
   1.408 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.409 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.410 +	 
   1.411 +	//Create Binary shared Longlatency get and set Custom Resource
   1.412 +	pR = new DBSHLGLSCResource();
   1.413 +	if(!pR)
   1.414 +		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   1.415 +	aStaticResourceArray[iStaticResourceCount++] = pR;
   1.416 +
   1.417 +	iResources = aStaticResourceArray;
   1.418 +
   1.419 +	aStaticResourceCount = iStaticResourceCount;
   1.420 +	return KErrNone;
   1.421 +	}
   1.422 +
   1.423 +//Constructors of all resources
   1.424 +_LIT(KDBSIGISPResource, "SymbianSimulResource");
   1.425 +DBSIGISPResource::DBSIGISPResource() : DStaticPowerResource(KDBSIGISPResource, E_OFF), iMinLevel(0), iMaxLevel(1), iCurrentLevel(0)
   1.426 +	{
   1.427 +	iFlags = KBinary;
   1.428 +	}
   1.429 +
   1.430 +_LIT(KDMLSIGISPResource, "DMLSIGISPResource");
   1.431 +DMLSIGISPResource::DMLSIGISPResource() : DStaticPowerResource(KDMLSIGISPResource, 12), iMinLevel(10), iMaxLevel(75), iCurrentLevel(12)
   1.432 +	{
   1.433 +	iFlags = KMultiLevel;
   1.434 +	}
   1.435 +
   1.436 +_LIT(KDBSIGISNResource, "DBSIGISNResource");
   1.437 +DBSIGISNResource::DBSIGISNResource() : DStaticPowerResource(KDBSIGISNResource, E_ON), iMinLevel(E_ON), iMaxLevel(E_OFF), iCurrentLevel(E_ON)
   1.438 +	{
   1.439 +	iFlags = KBinary | KSenseNegative;
   1.440 +	}
   1.441 +
   1.442 +_LIT(KDMLSIGISNResource, "DMLSIGISNResource");
   1.443 +DMLSIGISNResource::DMLSIGISNResource() : DStaticPowerResource(KDMLSIGISNResource, 75), iMinLevel(75), iMaxLevel(10), iCurrentLevel(75)
   1.444 +	{
   1.445 +	iFlags = KMultiLevel | KSenseNegative;
   1.446 +	}
   1.447 +
   1.448 +_LIT(KDBSLGLSPResource, "DBSLGLSPResource");
   1.449 +// change this state to OFF
   1.450 +DBSLGLSPResource::DBSLGLSPResource() : DStaticPowerResource(KDBSLGLSPResource, E_ON), iMinLevel(E_OFF), iMaxLevel(E_ON), iCurrentLevel(E_ON), iPolled(ETrue)
   1.451 +	{
   1.452 +	iFlags = KLongLatencyGet | KLongLatencySet;
   1.453 +	NKern::LockSystem();
   1.454 +	iBlockTime = 5; 
   1.455 +	NKern::UnlockSystem();
   1.456 +	}
   1.457 +
   1.458 +_LIT(KDMLSLGLSPResource, "DMLSLGLSPResource");
   1.459 +DMLSLGLSPResource::DMLSLGLSPResource() : DStaticPowerResource(KDMLSLGLSPResource, 75), iMinLevel(10), iMaxLevel(75), iCurrentLevel(75), iPolled(EFalse)
   1.460 +	{
   1.461 +	iFlags = KMultiLevel | KLongLatencySet | KLongLatencyGet;
   1.462 +	NKern::LockSystem();
   1.463 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.464 +	NKern::UnlockSystem();
   1.465 +	}
   1.466 +
   1.467 +_LIT(KDBSLGISNResource, "DBSLGISNResource");
   1.468 +DBSLGISNResource::DBSLGISNResource() : DStaticPowerResource(KDBSLGISNResource, E_ON), iMinLevel(E_ON), iMaxLevel(E_OFF), iCurrentLevel(E_ON), iPolled(ETrue)
   1.469 +	{
   1.470 +	iFlags = KLongLatencyGet | KSenseNegative;
   1.471 +	NKern::LockSystem();
   1.472 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.473 +	NKern::UnlockSystem();
   1.474 +	}
   1.475 +
   1.476 +_LIT(KDMLSLGISNResource, "DMLSLGISNResource");
   1.477 +DMLSLGISNResource::DMLSLGISNResource() : DStaticPowerResource(KDMLSLGISNResource, 75), iMinLevel(75), iMaxLevel(10), iCurrentLevel(75), iPolled(EFalse)
   1.478 +	{
   1.479 +	iFlags = KMultiLevel | KLongLatencyGet | KSenseNegative;
   1.480 +	NKern::LockSystem();
   1.481 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.482 +	NKern::UnlockSystem();
   1.483 +	}
   1.484 +
   1.485 +_LIT(KDBSIGLSPResource, "DBSIGLSPResource");
   1.486 +DBSIGLSPResource::DBSIGLSPResource() : DStaticPowerResource(KDBSIGLSPResource, E_ON), iMinLevel(E_OFF), iMaxLevel(E_ON), iCurrentLevel(E_ON), iPolled(ETrue)
   1.487 +	{
   1.488 +	iFlags = KBinary | KLongLatencySet;
   1.489 +	NKern::LockSystem();
   1.490 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.491 +	NKern::UnlockSystem();
   1.492 +	}
   1.493 +
   1.494 +_LIT(KDMLSIGLSPResource, "DMLSIGLSPResource");
   1.495 +DMLSIGLSPResource::DMLSIGLSPResource() : DStaticPowerResource(KDMLSIGLSPResource, 75), iMinLevel(10), iMaxLevel(100), iCurrentLevel(75), iPolled(EFalse)
   1.496 +	{
   1.497 +	iFlags = KMultiLevel | KLongLatencySet;
   1.498 +	NKern::LockSystem();
   1.499 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.500 +	NKern::UnlockSystem();
   1.501 +	}
   1.502 +
   1.503 +_LIT(KDBSHIGISPResource, "DBSHIGISPResource");
   1.504 +DBSHIGISPResource::DBSHIGISPResource() : DStaticPowerResource(KDBSHIGISPResource, E_OFF), iMinLevel(0), iMaxLevel(1), iCurrentLevel(0)
   1.505 +	{
   1.506 +	iFlags = KBinary | KShared;
   1.507 +	}
   1.508 +
   1.509 +_LIT(KDMLSHIGISPResource, "DMLSHIGISPResource");
   1.510 +DMLSHIGISPResource::DMLSHIGISPResource() : DStaticPowerResource(KDMLSHIGISPResource, 12), iMinLevel(10), iMaxLevel(75), iCurrentLevel(12)
   1.511 +	{
   1.512 +	iFlags = KMultiLevel | KShared;
   1.513 +	}
   1.514 +
   1.515 +_LIT(KDBSHIGISNResource, "DBSHIGISNResource");
   1.516 +DBSHIGISNResource::DBSHIGISNResource() : DStaticPowerResource(KDBSHIGISNResource, E_ON), iMinLevel(E_ON), iMaxLevel(E_OFF), iCurrentLevel(E_ON)
   1.517 +	{
   1.518 +	iFlags = KBinary | KShared | KSenseNegative;
   1.519 +	}
   1.520 +
   1.521 +_LIT(KDMLSHIGISNResource, "DMLSHIGISNResource");
   1.522 +DMLSHIGISNResource::DMLSHIGISNResource() : DStaticPowerResource(KDMLSHIGISNResource, 75), iMinLevel(75), iMaxLevel(10), iCurrentLevel(75)
   1.523 +	{
   1.524 +	iFlags = KMultiLevel | KShared | KSenseNegative;
   1.525 +	}
   1.526 +
   1.527 +_LIT(KDBSHLGLSPResource, "DBSHLGLSPResource");
   1.528 +DBSHLGLSPResource::DBSHLGLSPResource() : DStaticPowerResource(KDBSHLGLSPResource, E_ON), iMinLevel(E_OFF), iMaxLevel(E_ON), iCurrentLevel(E_ON), iPolled(ETrue)
   1.529 +	{
   1.530 +	iFlags = KBinary | KShared | KLongLatencySet | KLongLatencyGet;
   1.531 +	NKern::LockSystem();
   1.532 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.533 +	NKern::UnlockSystem();
   1.534 +	}
   1.535 +
   1.536 +_LIT(KDMLSHLGLSPResource, "DMLSHLGLSPResource");
   1.537 +DMLSHLGLSPResource::DMLSHLGLSPResource() : DStaticPowerResource(KDMLSHLGLSPResource, 70), iMinLevel(5), iMaxLevel(70), iCurrentLevel(70), iPolled(EFalse)
   1.538 +	{
   1.539 +	iFlags = KMultiLevel | KShared | KLongLatencySet | KLongLatencyGet;
   1.540 +	NKern::LockSystem();
   1.541 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.542 +	NKern::UnlockSystem();
   1.543 +	}
   1.544 +
   1.545 +_LIT(KDBSHLGISNResource, "DBSHLGISNResource");
   1.546 +DBSHLGISNResource::DBSHLGISNResource() : DStaticPowerResource(KDBSHLGISNResource, E_ON), iMinLevel(E_ON), iMaxLevel(E_OFF), iCurrentLevel(E_ON), iPolled(ETrue)
   1.547 +	{
   1.548 +	iFlags = KBinary | KShared | KLongLatencyGet | KSenseNegative;
   1.549 +	NKern::LockSystem();
   1.550 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.551 +	NKern::UnlockSystem();
   1.552 +	}
   1.553 +
   1.554 +_LIT(KDMLSHLGISNResource, "DMLSHLGISNResource");
   1.555 +DMLSHLGISNResource::DMLSHLGISNResource() : DStaticPowerResource(KDMLSHLGISNResource, 75), iMinLevel(75), iMaxLevel(10), iCurrentLevel(75), iPolled(EFalse)
   1.556 +	{
   1.557 +	iFlags = KMultiLevel | KShared | KLongLatencySet | KSenseNegative;
   1.558 +	NKern::LockSystem();
   1.559 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.560 +	NKern::UnlockSystem();
   1.561 +	}
   1.562 +
   1.563 +_LIT(KDBSHIGLSPResource, "DBSHIGLSPResource");
   1.564 +DBSHIGLSPResource::DBSHIGLSPResource() : DStaticPowerResource(KDBSHIGLSPResource, E_ON), iMinLevel(E_OFF), iMaxLevel(E_ON), iCurrentLevel(E_ON), iPolled(ETrue)
   1.565 +	{
   1.566 +	iFlags = KBinary | KShared | KLongLatencySet;
   1.567 +	NKern::LockSystem();
   1.568 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.569 +	NKern::UnlockSystem();
   1.570 +	}
   1.571 +
   1.572 +_LIT(KDMLSHIGLSPResource, "DMLSHIGLSPResource");
   1.573 +DMLSHIGLSPResource::DMLSHIGLSPResource() : DStaticPowerResource(KDMLSHIGLSPResource, 75), iMinLevel(10), iMaxLevel(75), iCurrentLevel(75), iPolled(EFalse)
   1.574 +	{
   1.575 +	iFlags = KMultiLevel | KShared | KLongLatencySet;
   1.576 +	NKern::LockSystem();
   1.577 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.578 +	NKern::UnlockSystem();
   1.579 +	}
   1.580 +
   1.581 +_LIT(KDBSHLGLSCResource, "KDBSHLGLSCResource");
   1.582 +DBSHLGLSCResource::DBSHLGLSCResource() : DStaticPowerResource(KDBSHLGLSCResource, E_ON), iMinLevel(E_OFF), iMaxLevel(E_ON), iCurrentLevel(E_ON), iPolled(EFalse)
   1.583 +	{
   1.584 +	iFlags = KMultiLevel | KShared | KLongLatencySet | KSenseCustom;
   1.585 +	SetCustomFunction(CustomFunction);
   1.586 +	NKern::LockSystem();
   1.587 +	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   1.588 +	NKern::UnlockSystem();
   1.589 +	}
   1.590 +
   1.591 +//DoRequest implementation of all functions
   1.592 +TInt DBSIGISPResource::DoRequest(TPowerRequest& req)
   1.593 +	{
   1.594 +	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   1.595 +	}
   1.596 +
   1.597 +TInt DMLSIGISPResource::DoRequest(TPowerRequest& req)
   1.598 +	{
   1.599 +	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   1.600 +	}
   1.601 +
   1.602 +TInt DBSIGISNResource::DoRequest(TPowerRequest& req)
   1.603 +	{
   1.604 +	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   1.605 +	}
   1.606 +
   1.607 +TInt DMLSIGISNResource::DoRequest(TPowerRequest& req)
   1.608 +	{
   1.609 +	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   1.610 +	}
   1.611 +
   1.612 +TInt DBSLGLSPResource::DoRequest(TPowerRequest& req)
   1.613 +	{
   1.614 +	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.615 +	}
   1.616 +
   1.617 +TInt DMLSLGLSPResource::DoRequest(TPowerRequest& req)
   1.618 +	{
   1.619 +	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.620 +	}
   1.621 +
   1.622 +TInt DBSLGISNResource::DoRequest(TPowerRequest& req)
   1.623 +	{
   1.624 +	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.625 +	}
   1.626 +
   1.627 +TInt DMLSLGISNResource::DoRequest(TPowerRequest& req)
   1.628 +	{
   1.629 +	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.630 +	}
   1.631 +
   1.632 +TInt DBSIGLSPResource::DoRequest(TPowerRequest& req)
   1.633 +	{
   1.634 +	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.635 +	}
   1.636 +
   1.637 +TInt DMLSIGLSPResource::DoRequest(TPowerRequest& req)
   1.638 +	{
   1.639 +	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.640 +	}
   1.641 +
   1.642 +TInt DBSHIGISPResource::DoRequest(TPowerRequest& req)
   1.643 +	{
   1.644 +	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   1.645 +	}
   1.646 +
   1.647 +TInt DMLSHIGISPResource::DoRequest(TPowerRequest& req)
   1.648 +	{
   1.649 +	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   1.650 +	}
   1.651 +
   1.652 +TInt DBSHIGISNResource::DoRequest(TPowerRequest& req)
   1.653 +	{
   1.654 +	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   1.655 +	}
   1.656 +
   1.657 +TInt DMLSHIGISNResource::DoRequest(TPowerRequest& req)
   1.658 +	{
   1.659 +	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   1.660 +	}
   1.661 +
   1.662 +TInt DBSHLGLSPResource::DoRequest(TPowerRequest& req)
   1.663 +	{
   1.664 +	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.665 +	}
   1.666 +
   1.667 +TInt DMLSHLGLSPResource::DoRequest(TPowerRequest& req)
   1.668 +	{
   1.669 +	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.670 +	}
   1.671 +
   1.672 +TInt DBSHLGISNResource::DoRequest(TPowerRequest& req)
   1.673 +	{
   1.674 +	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.675 +	}
   1.676 +
   1.677 +TInt DMLSHLGISNResource::DoRequest(TPowerRequest& req)
   1.678 +	{
   1.679 +	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.680 +	}
   1.681 +
   1.682 +TInt DBSHIGLSPResource::DoRequest(TPowerRequest& req)
   1.683 +	{
   1.684 +	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.685 +	}
   1.686 +
   1.687 +TInt DMLSHIGLSPResource::DoRequest(TPowerRequest& req)
   1.688 +	{
   1.689 +	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.690 +	}
   1.691 +
   1.692 +TInt DBSHLGLSCResource::DoRequest(TPowerRequest& req)
   1.693 +	{
   1.694 +	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   1.695 +	}
   1.696 +
   1.697 +/** Custom function implemetation*/
   1.698 +TBool DBSHLGLSCResource::CustomFunction(TInt &aClientId, const TDesC8& aClientName,
   1.699 +                                        TUint /*aResourceId*/,
   1.700 +                                        TCustomOperation aCustomOperation, TInt &aLevel,
   1.701 +                                        TAny* aLevelList, TAny* /*aReserved*/)
   1.702 +	{
   1.703 +	static TInt ClientId = -1;
   1.704 +
   1.705 +	Kern::Printf("CustomFunction Passed Clientname = %S\n", &aClientName);
   1.706 +
   1.707 +	//Allow first client to change the resource state
   1.708 +	if(aCustomOperation == EClientRequestLevel  &&  ClientId == -1)
   1.709 +		{
   1.710 +		ClientId = aClientId;
   1.711 +		return ETrue;
   1.712 +		}
   1.713 +
   1.714 +	//If client deregisters then ask to set the value to next client level if present, else to default level.
   1.715 +    if(aCustomOperation == EClientRelinquishLevel)
   1.716 +		{	
   1.717 +		TInt count = 0;
   1.718 +		SPowerResourceClientLevel* pL = NULL;
   1.719 +		SDblQue* pS = (SDblQue*)aLevelList;
   1.720 +		for(SDblQueLink* pCL=pS->First();pCL!=&pS->iA;pCL=pCL->iNext)
   1.721 +			{
   1.722 +			count++;
   1.723 +			pL=(SPowerResourceClientLevel*)pCL;
   1.724 +			if((pL->iClientId != (TUint)aClientId))
   1.725 +				{
   1.726 +				aClientId = pL->iClientId;
   1.727 +				aLevel = pL->iLevel;
   1.728 +				ClientId = aClientId;
   1.729 +				return ETrue;
   1.730 +				}
   1.731 +			}
   1.732 +		if((pL == NULL) || (count == 1))
   1.733 +			{
   1.734 +		  aClientId = -1;
   1.735 +		  aLevel = E_OFF;
   1.736 +		  ClientId = aClientId;
   1.737 +		  return ETrue;
   1.738 +			}
   1.739 +		}
   1.740 +
   1.741 +    	/*Allow if the current client is asking to state change to E_ON. 
   1.742 +	  Also change is allowed if current client asks for E_OFF and no other
   1.743 +	  client is holding requirement for E_ON
   1.744 +	  */
   1.745 +	if(aClientId == ClientId)
   1.746 +		{
   1.747 +		if(aLevel == E_ON)
   1.748 +			return ETrue;
   1.749 +		SPowerResourceClientLevel* pL = NULL;
   1.750 +		SDblQue* pS = (SDblQue*)aLevelList;
   1.751 +		for(SDblQueLink* pCL=pS->First();pCL!=&pS->iA;pCL=pCL->iNext)
   1.752 +			{
   1.753 +			pL=(SPowerResourceClientLevel*)pCL;
   1.754 +			if(pL->iLevel == E_ON)
   1.755 +				{
   1.756 +				aClientId = pL->iClientId;
   1.757 +				ClientId = pL->iClientId;
   1.758 +				aLevel = E_ON;
   1.759 +				return EFalse;
   1.760 +				}
   1.761 +			}
   1.762 +		return ETrue;
   1.763 +		}
   1.764 +	return EFalse;
   1.765 +	}
   1.766 +
   1.767 +//Get info implementation of all resources.
   1.768 +TInt DBSIGISPResource::GetInfo(TDes8* info) const
   1.769 +	{
   1.770 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.771 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.772 +	buf1->iMinLevel = iMinLevel;
   1.773 +	buf1->iMaxLevel = iMaxLevel;
   1.774 +	return KErrNone;
   1.775 +	}
   1.776 +
   1.777 +TInt DMLSIGISPResource::GetInfo(TDes8* info) const
   1.778 +	{
   1.779 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.780 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.781 +	buf1->iMinLevel = iMinLevel;
   1.782 +	buf1->iMaxLevel = iMaxLevel;
   1.783 +	return KErrNone;
   1.784 +	}
   1.785 +
   1.786 +TInt DBSIGISNResource::GetInfo(TDes8* info) const
   1.787 +	{
   1.788 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.789 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.790 +	buf1->iMinLevel = iMinLevel;
   1.791 +	buf1->iMaxLevel = iMaxLevel;
   1.792 +	return KErrNone;
   1.793 +	}
   1.794 +
   1.795 +TInt DMLSIGISNResource::GetInfo(TDes8* info) const
   1.796 +	{
   1.797 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.798 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.799 +	buf1->iMinLevel = iMinLevel;
   1.800 +	buf1->iMaxLevel = iMaxLevel;
   1.801 +	return KErrNone;
   1.802 +	}
   1.803 +
   1.804 +TInt DBSLGLSPResource::GetInfo(TDes8* info) const
   1.805 +	{
   1.806 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.807 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.808 +	buf1->iMinLevel = iMinLevel;
   1.809 +	buf1->iMaxLevel = iMaxLevel;
   1.810 +	return KErrNone;
   1.811 +	}
   1.812 +
   1.813 +TInt DMLSLGLSPResource::GetInfo(TDes8* info) const
   1.814 +	{
   1.815 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.816 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.817 +	buf1->iMinLevel = iMinLevel;
   1.818 +	buf1->iMaxLevel = iMaxLevel;
   1.819 +	return KErrNone;
   1.820 +	}
   1.821 +
   1.822 +TInt DBSLGISNResource::GetInfo(TDes8* info) const
   1.823 +	{
   1.824 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.825 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.826 +	buf1->iMinLevel = iMinLevel;
   1.827 +	buf1->iMaxLevel = iMaxLevel;
   1.828 +	return KErrNone;
   1.829 +	}
   1.830 +
   1.831 +TInt DMLSLGISNResource::GetInfo(TDes8* info) const
   1.832 +	{
   1.833 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.834 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.835 +	buf1->iMinLevel = iMinLevel;
   1.836 +	buf1->iMaxLevel = iMaxLevel;
   1.837 +	return KErrNone;
   1.838 +	}
   1.839 +
   1.840 +TInt DBSIGLSPResource::GetInfo(TDes8* info) const
   1.841 +	{
   1.842 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.843 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.844 +	buf1->iMinLevel = iMinLevel;
   1.845 +	buf1->iMaxLevel = iMaxLevel;
   1.846 +	return KErrNone;
   1.847 +	}
   1.848 +
   1.849 +TInt DMLSIGLSPResource::GetInfo(TDes8* info) const
   1.850 +	{
   1.851 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.852 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.853 +	buf1->iMinLevel = iMinLevel;
   1.854 +	buf1->iMaxLevel = iMaxLevel;
   1.855 +	return KErrNone;
   1.856 +	}
   1.857 +
   1.858 +TInt DBSHIGISPResource::GetInfo(TDes8* info) const
   1.859 +	{
   1.860 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.861 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.862 +	buf1->iMinLevel = iMinLevel;
   1.863 +	buf1->iMaxLevel = iMaxLevel;
   1.864 +	return KErrNone;
   1.865 +	}
   1.866 +
   1.867 +TInt DMLSHIGISPResource::GetInfo(TDes8* info) const
   1.868 +	{
   1.869 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.870 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.871 +	buf1->iMinLevel = iMinLevel;
   1.872 +	buf1->iMaxLevel = iMaxLevel;
   1.873 +	return KErrNone;
   1.874 +	}
   1.875 +
   1.876 +TInt DBSHIGISNResource::GetInfo(TDes8* info) const
   1.877 +	{
   1.878 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.879 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.880 +	buf1->iMinLevel = iMinLevel;
   1.881 +	buf1->iMaxLevel = iMaxLevel;
   1.882 +	return KErrNone;
   1.883 +	}
   1.884 +
   1.885 +TInt DMLSHIGISNResource::GetInfo(TDes8* info) const
   1.886 +	{
   1.887 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.888 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.889 +	buf1->iMinLevel = iMinLevel;
   1.890 +	buf1->iMaxLevel = iMaxLevel;
   1.891 +	return KErrNone;
   1.892 +	}
   1.893 +
   1.894 +TInt DBSHLGLSPResource::GetInfo(TDes8* info) const
   1.895 +	{
   1.896 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.897 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.898 +	buf1->iMinLevel = iMinLevel;
   1.899 +	buf1->iMaxLevel = iMaxLevel;
   1.900 +	return KErrNone;
   1.901 +	}
   1.902 +
   1.903 +TInt DMLSHLGLSPResource::GetInfo(TDes8* info) const
   1.904 +	{
   1.905 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.906 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.907 +	buf1->iMinLevel = iMinLevel;
   1.908 +	buf1->iMaxLevel = iMaxLevel;
   1.909 +	return KErrNone;
   1.910 +	}
   1.911 +
   1.912 +TInt DBSHLGISNResource::GetInfo(TDes8* info) const
   1.913 +	{
   1.914 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.915 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.916 +	buf1->iMinLevel = iMinLevel;
   1.917 +	buf1->iMaxLevel = iMaxLevel;
   1.918 +	return KErrNone;
   1.919 +	}
   1.920 +
   1.921 +TInt DMLSHLGISNResource::GetInfo(TDes8* info) const
   1.922 +	{
   1.923 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.924 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.925 +	buf1->iMinLevel = iMinLevel;
   1.926 +	buf1->iMaxLevel = iMaxLevel;
   1.927 +	return KErrNone;
   1.928 +	}
   1.929 +
   1.930 +TInt DBSHIGLSPResource::GetInfo(TDes8* info) const
   1.931 +	{
   1.932 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.933 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.934 +	buf1->iMinLevel = iMinLevel;
   1.935 +	buf1->iMaxLevel = iMaxLevel;
   1.936 +	return KErrNone;
   1.937 +	}
   1.938 +
   1.939 +TInt DMLSHIGLSPResource::GetInfo(TDes8* info) const
   1.940 +	{
   1.941 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.942 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.943 +	buf1->iMinLevel = iMinLevel;
   1.944 +	buf1->iMaxLevel = iMaxLevel;
   1.945 +	return KErrNone;
   1.946 +	}
   1.947 +
   1.948 +TInt DBSHLGLSCResource::GetInfo(TDes8* info) const
   1.949 +	{
   1.950 +	DStaticPowerResource::GetInfo((TDes8*)info);
   1.951 +	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   1.952 +	buf1->iMinLevel = iMinLevel;
   1.953 +	buf1->iMaxLevel = iMaxLevel;
   1.954 +	return KErrNone;
   1.955 +	}