os/kernelhwsrv/kerneltest/e32test/resourceman/resourceman_psl/rescontrol_psl.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // e32test\resourceman\resourceman_psl\rescontrol_psl.cpp
    15 // 
    16 //
    17 
    18 #include "rescontrol_psl.h"
    19 TInt KSimulatedRCThreadPriority = 28;
    20 #ifdef RESOURCE_MANAGER_SIMULATED_PSL
    21 static DSimulatedPowerResourceController TheController;
    22 #endif
    23 
    24 //Resource controller creation
    25 #ifdef RESOURCE_MANAGER_SIMULATED_PSL
    26 DECLARE_STANDARD_PDD()
    27 	{
    28 	TInt r = DPowerResourceController::InitController();							
    29 	if(r == KErrNone)
    30 		return new DResConPddFactory;
    31 	return NULL;																
    32 	}
    33 #endif
    34 
    35 /** ISR function invoked when the specified amount of time expires. This is used for event driven resources. */
    36 void DSimulatedPowerResourceController::TimerIsrFunc(TAny *ptr)
    37 	{
    38 	DSimulatedPowerResourceController *pC = (DSimulatedPowerResourceController *)ptr;
    39 	//Queues a Dfc to signal fast semaphore.
    40 	pC->iEventDfc.Add();
    41 	}
    42 
    43 /** DFC function to signal the fast semaphore. For event driven resources, the PIL is blocked until specified time (just 
    44 	to simulate hardware event). */  
    45 void DSimulatedPowerResourceController::EventDfcFunc(TAny *ptr)
    46 	{
    47 	DSimulatedPowerResourceController *pC = (DSimulatedPowerResourceController *)ptr;
    48 	NKern::FSSignal((NFastSemaphore*)&pC->iEventFastSem);
    49 	}
    50 
    51 /** Constructor for simulated resource controller. */
    52 DSimulatedPowerResourceController::DSimulatedPowerResourceController():DPowerResourceController(),iStaticResourceCount(0), iEventDfc(EventDfcFunc, this)
    53 	{
    54 	Kern::Printf(">DSimulatedPowerResourceController");
    55 	}
    56 
    57 /** Destructor for simulated resource controller. */
    58 DSimulatedPowerResourceController::~DSimulatedPowerResourceController()
    59 	{
    60 	Kern::Printf("DSimulatedPowerResourceController::~DSimulatedPowerResourceController()\n");
    61 	((TDynamicDfcQue*)iDfcQ)->Destroy();
    62 	DStaticPowerResource *pR;
    63 	TUint c;
    64 	for(c = 0; c < iStaticResourceCount; c++)
    65 		{
    66 		pR = iResources[c];
    67 		delete pR;
    68 		}
    69 	delete []iResources;
    70 #ifdef PRM_ENABLE_EXTENDED_VERSION
    71 	DStaticPowerResourceD* pDR;
    72 	
    73 	delete []iNodeArray; //Delete dependency nodes
    74 	for(c = 0; c < iStaticResDependencyCount; c++) 
    75 		{
    76 		pDR = iDependencyResources[c];
    77 		delete pDR;
    78 		}
    79 	delete []iDependencyResources;
    80 #endif
    81 	}
    82 
    83 #ifdef PRM_ENABLE_EXTENDED_VERSION
    84 //Function to return the controller pointer to use in extended psl file
    85 DSimulatedPowerResourceController* GetControllerPtr()
    86 	{
    87 	return &TheController;
    88 	}
    89 #endif
    90 
    91 /** This function is called from PIL, during resource controller creation phase.
    92 	It creates a DFC queue and then invokes setDfcQ function to PIL to set the queue.
    93 	It calls InitPools function of PIL to create the specified sizes of clients, 
    94 	client levels and requests pools.
    95 	*/
    96 TInt DSimulatedPowerResourceController::DoInitController()
    97 	{
    98 	TInt r = KErrNone;
    99 	Kern::Printf(">DSimulatedPowerResourceController::DoInitController()");
   100 	//Create a DFC queue
   101 	r = Kern::DynamicDfcQCreate((TDynamicDfcQue*&)iDfcQ, KSimulatedRCThreadPriority, KResmanName);
   102 	if(r != KErrNone)
   103 		{
   104 		Kern::Printf("DFC Queue creation failed");
   105 		return r;
   106 		}
   107 
   108 #ifdef CPU_AFFINITY_ANY
   109 	NKern::ThreadSetCpuAffinity((NThread*)(iDfcQ->iThread), KCpuAffinityAny);			
   110 #endif
   111 
   112 	//Call the resource controller to set the DFCQ
   113 	SetDfcQ(iDfcQ);
   114 	
   115 #ifdef PRM_ENABLE_EXTENDED_VERSION
   116 	//Create a DFC Dependency Queue
   117 	r = Kern::DynamicDfcQCreate((TDynamicDfcQue*&)iDfcQDependency, KSimulatedRCThreadPriority, 
   118 									KResmanName);
   119 	if(r != KErrNone)
   120 		{
   121 		Kern::Printf("DFC Dependency Queue creation failed");
   122 		return r;
   123 		}
   124 	//Call the resource controller to set the DFCQDependency
   125 	SetDfcQDependency(iDfcQDependency);
   126 #endif
   127 	//Init pools
   128 	r = InitPools(KERNEL_CLIENTS, USER_CLIENTS, CLIENT_LEVELS, REQUESTS);
   129 	return r;
   130 	}
   131 
   132 /** This function is used only for testing purpose to test the RegisterResorcesForIdle API
   133 	ideally will be used by Power controller to obtain the state of the resources will be interested
   134 	for idle power management.
   135 	*/
   136 EXPORT_C TInt DSimulatedPowerResourceController::CaptureIdleResourcesInfo(TUint aControllerId, TUint aNumResources, TPtr* aPtr)
   137 	{
   138 	Kern::Printf("DSimulatedPowerResourceController::CaptureIdleResourcesInfo\n");
   139 	TInt r = TheController.RegisterResourcesForIdle(aControllerId, aNumResources, aPtr);
   140 	return r;
   141 	}
   142 
   143 /** This function is used only for testing purpose. This is complete the initialization of resource controller.
   144 	This is used to test the Postbootlevel and registration of static resource API's. 
   145 	*/
   146 EXPORT_C TInt DSimulatedPowerResourceController::CompleteResourceControllerInitialisation()
   147 	{
   148 	Kern::Printf("DSimulatedPowerResourceController::CompleteResourceControllerInitialisation()\n");
   149 	return(TheController.InitResources());
   150 	}
   151 
   152 /** This function changes the state of the resource to appropriate value */
   153 TInt DSimulatedPowerResourceController::ChangeResource(TPowerRequest& req, TInt& aCurrentLevel, TInt aMaxLevel, TInt aMinLevel)
   154 	{
   155 	DStaticPowerResource* pR = req.Resource();
   156 	if(pR->Sense() == DStaticPowerResource::ECustom) //Custom sense set it to specified level
   157 		{
   158 		req.Level() = aCurrentLevel;
   159 		}
   160 	else if(pR->Sense() == DStaticPowerResource::EPositive) 
   161 		{
   162 		//Set it to value specified if valid, otherwise minimum or maximum based on the value.
   163 		if(req.Level() > aMaxLevel)
   164 			req.Level() = aMaxLevel;
   165 		else if(req.Level() < aMinLevel)
   166 			req.Level() = aMinLevel;
   167 		aCurrentLevel = req.Level();
   168 		}
   169 	else
   170 		{
   171 		//Set it to value specified if valid, otherwise minimum or maximum based on the value.
   172 		if( req.Level() < aMaxLevel)
   173 			req.Level() = aMaxLevel;
   174 		else if(req.Level() > aMinLevel)
   175 			req.Level() = aMinLevel;
   176 		aCurrentLevel = req.Level();
   177 		}
   178 	return KErrNone;
   179 	}
   180 
   181 /** This function processes all instantaneous resource types. Instantaneous resources should returned immediately, so 
   182 	this function returns immediately after updating the value. */
   183 TInt DSimulatedPowerResourceController::ProcessInstantaneousResources(TPowerRequest& req, TInt& aCurrentLevel, TInt aMaxLevel, TInt aMinLevel, TInt aDefaultLevel)
   184 	{
   185 	if(req.ReqType() == TPowerRequest::EGet)
   186 		{
   187 		req.Level() = aCurrentLevel;
   188 		}
   189 	else if(req.ReqType() == TPowerRequest::EChange)
   190 		{
   191 		return ChangeResource(req, aCurrentLevel, aMaxLevel, aMinLevel);
   192 		}
   193 	else if(req.ReqType() == TPowerRequest::ESetDefaultLevel)
   194 		{
   195 		req.Level() = aDefaultLevel;
   196 		aCurrentLevel = aDefaultLevel;
   197 		}
   198 	else
   199 		return KErrNotSupported;
   200 	return KErrNone;
   201 	}
   202 
   203 /** Function used for polling resources. */
   204 TBool PollingFunction(TAny* ptr)
   205 	{
   206 	static TInt count = 0;
   207 	if(++count == (TInt)ptr)
   208 		{
   209 		count = 0;
   210 		return ETrue;
   211 		}
   212 	return EFalse;
   213 	}
   214 
   215 /** This function processes polled resources. It waits for specified time and then performs requested operation
   216 	if the specified operation is long latency operation.
   217 	*/
   218 TInt DSimulatedPowerResourceController::ProcessPolledResources(TPowerRequest& req, TInt&aCurrentLevel, TInt aMaxLevel, TInt aMinLevel, TInt aDefaultLevel, TInt aBlockTime)
   219 	{
   220 	DStaticPowerResource* pR = req.Resource();
   221 	if(req.ReqType() == TPowerRequest::EGet)
   222 		{
   223 		if(!pR->LatencyGet())
   224 			return ProcessInstantaneousResources(req, aCurrentLevel, aMaxLevel, aMinLevel, aDefaultLevel);
   225 		Kern::PollingWait(PollingFunction, (TAny*)aBlockTime, 3, aBlockTime);
   226 		req.Level() = aCurrentLevel;
   227 		}
   228 	else if(req.ReqType() == TPowerRequest::EChange)
   229 		{
   230 		if(!pR->LatencySet())
   231 			return ProcessInstantaneousResources(req, aCurrentLevel, aMaxLevel, aMinLevel, aDefaultLevel);
   232 		Kern::PollingWait(PollingFunction, (TAny*)aBlockTime, 3, aBlockTime);
   233 		return ChangeResource(req, aCurrentLevel, aMaxLevel, aMinLevel);
   234 		}
   235 	else if(req.ReqType() == TPowerRequest::ESetDefaultLevel)
   236 		{
   237 		if(!pR->LatencySet())
   238 			return ProcessInstantaneousResources(req, aCurrentLevel, aMaxLevel, aMinLevel, aDefaultLevel);
   239 		Kern::PollingWait(PollingFunction, (TAny*)aBlockTime, 3, aBlockTime);
   240 		req.Level() = aDefaultLevel;
   241 		aCurrentLevel = aDefaultLevel;
   242 		}
   243 	else
   244 		return KErrNotSupported;
   245 	return KErrNone;
   246 	}
   247 
   248 /** This function processes event driven resources. It makes the calling function (PIL) to block on fast semaphore
   249 	and starts the timer.The PIL is blocked until the timer expires. 
   250 	*/
   251 TInt DSimulatedPowerResourceController::ProcessEventResources(TPowerRequest& req, TInt& aCurrentLevel, TInt aMaxLevel, TInt aMinLevel, TInt aDefaultLevel, TInt aBlockTime)
   252 	{
   253 	DStaticPowerResource* pR = req.Resource();
   254 	if(((req.ReqType() == TPowerRequest::EGet) && (!pR->LatencyGet())) || ((req.ReqType() == TPowerRequest::EChange) && (!pR->LatencySet())) || ((req.ReqType() == TPowerRequest::ESetDefaultLevel) && (!pR->LatencySet())))
   255 		return ProcessInstantaneousResources(req, aCurrentLevel, aMaxLevel, aMinLevel, aDefaultLevel);	
   256 	iEventFastSem.iOwningThread = (NThreadBase*)NKern::CurrentThread();
   257 	iEventFastSem.iCount = 0;
   258 	TInt timeout = NKern::TimerTicks(aBlockTime);
   259 	NTimer iEventTimer(TimerIsrFunc, this);
   260 	iEventTimer.OneShot(timeout);
   261 	NKern::FSWait(&iEventFastSem);
   262 	if(req.ReqType() == TPowerRequest::EGet)
   263 		req.Level() = aCurrentLevel;
   264 	else if(req.ReqType() == TPowerRequest::EChange)
   265 		return ChangeResource(req, aCurrentLevel, aMaxLevel, aMinLevel);
   266 	else if(req.ReqType() == TPowerRequest::ESetDefaultLevel)
   267 		{
   268 		req.Level() = aDefaultLevel;
   269 		aCurrentLevel = aDefaultLevel;
   270 		}
   271 	else
   272 		return KErrNotSupported;
   273 	return KErrNone;
   274 	}
   275 
   276 //This registers all static resource with resource controller. This function is called by PIL
   277 TInt DSimulatedPowerResourceController::DoRegisterStaticResources(DStaticPowerResource**& aStaticResourceArray, TUint16& aStaticResourceCount)
   278 	{
   279 	Kern::Printf(">DSimulatedPowerResourceController::DoRegisterStaticResources");
   280 	aStaticResourceArray = (DStaticPowerResource**)new(DStaticPowerResource*[MAX_RESOURCE_COUNT]);
   281 	if(!aStaticResourceArray)
   282 		return KErrNoMemory;
   283 	DStaticPowerResource* pR = NULL;
   284 
   285 	//Create Binary Single Instantaneous Positive Resource
   286 	pR = new DBSIGISPResource();
   287 	if(!pR)
   288 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   289 	aStaticResourceArray[iStaticResourceCount++] = pR;
   290 
   291 	//Create Multilevel Single Instantaneous Positive Resource
   292 	pR = new DMLSIGISPResource();
   293 	if(!pR)
   294 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   295 	aStaticResourceArray[iStaticResourceCount++] = pR;
   296 
   297 	//Create Binary Single Instantaneous Negative Resource
   298 	pR = new DBSIGISNResource();
   299 	if(!pR)
   300 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   301 	aStaticResourceArray[iStaticResourceCount++] = pR;
   302 
   303 	//Create Multilevel Single Instantaneous Negative Resource
   304 	pR = new DMLSIGISNResource();
   305 	if(!pR)
   306 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   307 	aStaticResourceArray[iStaticResourceCount++] = pR;
   308 
   309 	//Create Binary Single Longlatency Positive Resource
   310 	pR = new DBSLGLSPResource();
   311 	if(!pR)
   312 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   313 	aStaticResourceArray[iStaticResourceCount++] = pR;
   314 
   315 	//Create Multilevel Single Longlatency  Positive Resource
   316 	pR = new DMLSLGLSPResource();
   317 	if(!pR)
   318 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   319 	aStaticResourceArray[iStaticResourceCount++] = pR;
   320 
   321 	//Create Binary Single Longlatency Get & Instantaneous Set Negative Resource
   322 	pR = new DBSLGISNResource();
   323 	if(!pR)
   324 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   325 	aStaticResourceArray[iStaticResourceCount++] = pR;
   326 
   327 	//Create Multilevel Single Longlatency Get & Instantaneous Set Negative Resource
   328 	pR = new DMLSLGISNResource();
   329 	if(!pR)
   330 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   331 	aStaticResourceArray[iStaticResourceCount++] = pR;
   332 
   333 	//Create Binary Single Instantaneous Get & Longlatency Set Positive Resource
   334 	pR = new DBSIGLSPResource();
   335 	if(!pR)
   336 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   337 	aStaticResourceArray[iStaticResourceCount++] = pR;
   338 
   339 	//Create Multilevel Single Instantaneous Get & Longlatency Set Positive Resource
   340 	pR = new DMLSIGLSPResource();
   341 	if(!pR)
   342 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   343 	aStaticResourceArray[iStaticResourceCount++] = pR;
   344 
   345 	//Create Binary SHared Instantaneous Positive Resource
   346 	pR = new DBSHIGISPResource();
   347 	if(!pR)
   348 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   349 	aStaticResourceArray[iStaticResourceCount++] = pR;
   350 
   351 	//Create Multilevel SHared Instantaneous Positive Resource
   352 	pR = new DMLSHIGISPResource();
   353 	if(!pR)
   354 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   355 	aStaticResourceArray[iStaticResourceCount++] = pR;
   356 
   357 	//Create Binary SHared Instantaneous Negative Resource
   358 	pR = new DBSHIGISNResource();
   359 	if(!pR)
   360 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   361 	aStaticResourceArray[iStaticResourceCount++] = pR;
   362 
   363 	//Create Multilevel SHared Instantaneous Negative Resource
   364 	pR = new DMLSHIGISNResource();
   365 	if(!pR)
   366 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   367 	aStaticResourceArray[iStaticResourceCount++] = pR;
   368 
   369 	//Create Binary SHared Longlatency Positive Resource
   370 	pR = new DBSHLGLSPResource();
   371 	if(!pR)
   372 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   373 	aStaticResourceArray[iStaticResourceCount++] = pR;
   374 
   375 	//Create Multilevel SHared Longlatency  Positive Resource
   376 	pR = new DMLSHLGLSPResource();
   377 	if(!pR)
   378 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   379 	aStaticResourceArray[iStaticResourceCount++] = pR;
   380 
   381 	//Create Binary SHared Longlatency Get & Instantaneous Set Negative Resource
   382 	pR = new DBSHLGISNResource();
   383 	if(!pR)
   384 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   385 	aStaticResourceArray[iStaticResourceCount++] = pR;
   386 
   387 	//Create Multilevel SHared Longlatency Get & Instantaneous Set Negative Resource
   388 	pR = new DMLSHLGISNResource();
   389 	if(!pR)
   390 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   391 	aStaticResourceArray[iStaticResourceCount++] = pR;
   392 
   393 	//Create holes in resource array
   394 	aStaticResourceArray[iStaticResourceCount++] = NULL;
   395 	aStaticResourceArray[iStaticResourceCount++] = NULL;
   396 	//Create Binary SHared Instantaneous Get & Longlatency Set Positive Resource
   397 	pR = new DBSHIGLSPResource();
   398 	if(!pR)
   399 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   400 	aStaticResourceArray[iStaticResourceCount++] = pR;
   401 
   402 	//Create Multilevel SHared Instantaneous Get & Longlatency Set Positive Resource
   403 	pR = new DMLSHIGLSPResource();
   404 	if(!pR)
   405 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   406 	aStaticResourceArray[iStaticResourceCount++] = pR;
   407 	 
   408 	//Create Binary shared Longlatency get and set Custom Resource
   409 	pR = new DBSHLGLSCResource();
   410 	if(!pR)
   411 		CLEAN_AND_RETURN(iStaticResourceCount, aStaticResourceArray, KErrNoMemory)
   412 	aStaticResourceArray[iStaticResourceCount++] = pR;
   413 
   414 	iResources = aStaticResourceArray;
   415 
   416 	aStaticResourceCount = iStaticResourceCount;
   417 	return KErrNone;
   418 	}
   419 
   420 //Constructors of all resources
   421 _LIT(KDBSIGISPResource, "SymbianSimulResource");
   422 DBSIGISPResource::DBSIGISPResource() : DStaticPowerResource(KDBSIGISPResource, E_OFF), iMinLevel(0), iMaxLevel(1), iCurrentLevel(0)
   423 	{
   424 	iFlags = KBinary;
   425 	}
   426 
   427 _LIT(KDMLSIGISPResource, "DMLSIGISPResource");
   428 DMLSIGISPResource::DMLSIGISPResource() : DStaticPowerResource(KDMLSIGISPResource, 12), iMinLevel(10), iMaxLevel(75), iCurrentLevel(12)
   429 	{
   430 	iFlags = KMultiLevel;
   431 	}
   432 
   433 _LIT(KDBSIGISNResource, "DBSIGISNResource");
   434 DBSIGISNResource::DBSIGISNResource() : DStaticPowerResource(KDBSIGISNResource, E_ON), iMinLevel(E_ON), iMaxLevel(E_OFF), iCurrentLevel(E_ON)
   435 	{
   436 	iFlags = KBinary | KSenseNegative;
   437 	}
   438 
   439 _LIT(KDMLSIGISNResource, "DMLSIGISNResource");
   440 DMLSIGISNResource::DMLSIGISNResource() : DStaticPowerResource(KDMLSIGISNResource, 75), iMinLevel(75), iMaxLevel(10), iCurrentLevel(75)
   441 	{
   442 	iFlags = KMultiLevel | KSenseNegative;
   443 	}
   444 
   445 _LIT(KDBSLGLSPResource, "DBSLGLSPResource");
   446 // change this state to OFF
   447 DBSLGLSPResource::DBSLGLSPResource() : DStaticPowerResource(KDBSLGLSPResource, E_ON), iMinLevel(E_OFF), iMaxLevel(E_ON), iCurrentLevel(E_ON), iPolled(ETrue)
   448 	{
   449 	iFlags = KLongLatencyGet | KLongLatencySet;
   450 	NKern::LockSystem();
   451 	iBlockTime = 5; 
   452 	NKern::UnlockSystem();
   453 	}
   454 
   455 _LIT(KDMLSLGLSPResource, "DMLSLGLSPResource");
   456 DMLSLGLSPResource::DMLSLGLSPResource() : DStaticPowerResource(KDMLSLGLSPResource, 75), iMinLevel(10), iMaxLevel(75), iCurrentLevel(75), iPolled(EFalse)
   457 	{
   458 	iFlags = KMultiLevel | KLongLatencySet | KLongLatencyGet;
   459 	NKern::LockSystem();
   460 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   461 	NKern::UnlockSystem();
   462 	}
   463 
   464 _LIT(KDBSLGISNResource, "DBSLGISNResource");
   465 DBSLGISNResource::DBSLGISNResource() : DStaticPowerResource(KDBSLGISNResource, E_ON), iMinLevel(E_ON), iMaxLevel(E_OFF), iCurrentLevel(E_ON), iPolled(ETrue)
   466 	{
   467 	iFlags = KLongLatencyGet | KSenseNegative;
   468 	NKern::LockSystem();
   469 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   470 	NKern::UnlockSystem();
   471 	}
   472 
   473 _LIT(KDMLSLGISNResource, "DMLSLGISNResource");
   474 DMLSLGISNResource::DMLSLGISNResource() : DStaticPowerResource(KDMLSLGISNResource, 75), iMinLevel(75), iMaxLevel(10), iCurrentLevel(75), iPolled(EFalse)
   475 	{
   476 	iFlags = KMultiLevel | KLongLatencyGet | KSenseNegative;
   477 	NKern::LockSystem();
   478 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   479 	NKern::UnlockSystem();
   480 	}
   481 
   482 _LIT(KDBSIGLSPResource, "DBSIGLSPResource");
   483 DBSIGLSPResource::DBSIGLSPResource() : DStaticPowerResource(KDBSIGLSPResource, E_ON), iMinLevel(E_OFF), iMaxLevel(E_ON), iCurrentLevel(E_ON), iPolled(ETrue)
   484 	{
   485 	iFlags = KBinary | KLongLatencySet;
   486 	NKern::LockSystem();
   487 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   488 	NKern::UnlockSystem();
   489 	}
   490 
   491 _LIT(KDMLSIGLSPResource, "DMLSIGLSPResource");
   492 DMLSIGLSPResource::DMLSIGLSPResource() : DStaticPowerResource(KDMLSIGLSPResource, 75), iMinLevel(10), iMaxLevel(100), iCurrentLevel(75), iPolled(EFalse)
   493 	{
   494 	iFlags = KMultiLevel | KLongLatencySet;
   495 	NKern::LockSystem();
   496 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   497 	NKern::UnlockSystem();
   498 	}
   499 
   500 _LIT(KDBSHIGISPResource, "DBSHIGISPResource");
   501 DBSHIGISPResource::DBSHIGISPResource() : DStaticPowerResource(KDBSHIGISPResource, E_OFF), iMinLevel(0), iMaxLevel(1), iCurrentLevel(0)
   502 	{
   503 	iFlags = KBinary | KShared;
   504 	}
   505 
   506 _LIT(KDMLSHIGISPResource, "DMLSHIGISPResource");
   507 DMLSHIGISPResource::DMLSHIGISPResource() : DStaticPowerResource(KDMLSHIGISPResource, 12), iMinLevel(10), iMaxLevel(75), iCurrentLevel(12)
   508 	{
   509 	iFlags = KMultiLevel | KShared;
   510 	}
   511 
   512 _LIT(KDBSHIGISNResource, "DBSHIGISNResource");
   513 DBSHIGISNResource::DBSHIGISNResource() : DStaticPowerResource(KDBSHIGISNResource, E_ON), iMinLevel(E_ON), iMaxLevel(E_OFF), iCurrentLevel(E_ON)
   514 	{
   515 	iFlags = KBinary | KShared | KSenseNegative;
   516 	}
   517 
   518 _LIT(KDMLSHIGISNResource, "DMLSHIGISNResource");
   519 DMLSHIGISNResource::DMLSHIGISNResource() : DStaticPowerResource(KDMLSHIGISNResource, 75), iMinLevel(75), iMaxLevel(10), iCurrentLevel(75)
   520 	{
   521 	iFlags = KMultiLevel | KShared | KSenseNegative;
   522 	}
   523 
   524 _LIT(KDBSHLGLSPResource, "DBSHLGLSPResource");
   525 DBSHLGLSPResource::DBSHLGLSPResource() : DStaticPowerResource(KDBSHLGLSPResource, E_ON), iMinLevel(E_OFF), iMaxLevel(E_ON), iCurrentLevel(E_ON), iPolled(ETrue)
   526 	{
   527 	iFlags = KBinary | KShared | KLongLatencySet | KLongLatencyGet;
   528 	NKern::LockSystem();
   529 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   530 	NKern::UnlockSystem();
   531 	}
   532 
   533 _LIT(KDMLSHLGLSPResource, "DMLSHLGLSPResource");
   534 DMLSHLGLSPResource::DMLSHLGLSPResource() : DStaticPowerResource(KDMLSHLGLSPResource, 70), iMinLevel(5), iMaxLevel(70), iCurrentLevel(70), iPolled(EFalse)
   535 	{
   536 	iFlags = KMultiLevel | KShared | KLongLatencySet | KLongLatencyGet;
   537 	NKern::LockSystem();
   538 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   539 	NKern::UnlockSystem();
   540 	}
   541 
   542 _LIT(KDBSHLGISNResource, "DBSHLGISNResource");
   543 DBSHLGISNResource::DBSHLGISNResource() : DStaticPowerResource(KDBSHLGISNResource, E_ON), iMinLevel(E_ON), iMaxLevel(E_OFF), iCurrentLevel(E_ON), iPolled(ETrue)
   544 	{
   545 	iFlags = KBinary | KShared | KLongLatencyGet | KSenseNegative;
   546 	NKern::LockSystem();
   547 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   548 	NKern::UnlockSystem();
   549 	}
   550 
   551 _LIT(KDMLSHLGISNResource, "DMLSHLGISNResource");
   552 DMLSHLGISNResource::DMLSHLGISNResource() : DStaticPowerResource(KDMLSHLGISNResource, 75), iMinLevel(75), iMaxLevel(10), iCurrentLevel(75), iPolled(EFalse)
   553 	{
   554 	iFlags = KMultiLevel | KShared | KLongLatencySet | KSenseNegative;
   555 	NKern::LockSystem();
   556 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   557 	NKern::UnlockSystem();
   558 	}
   559 
   560 _LIT(KDBSHIGLSPResource, "DBSHIGLSPResource");
   561 DBSHIGLSPResource::DBSHIGLSPResource() : DStaticPowerResource(KDBSHIGLSPResource, E_ON), iMinLevel(E_OFF), iMaxLevel(E_ON), iCurrentLevel(E_ON), iPolled(ETrue)
   562 	{
   563 	iFlags = KBinary | KShared | KLongLatencySet;
   564 	NKern::LockSystem();
   565 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   566 	NKern::UnlockSystem();
   567 	}
   568 
   569 _LIT(KDMLSHIGLSPResource, "DMLSHIGLSPResource");
   570 DMLSHIGLSPResource::DMLSHIGLSPResource() : DStaticPowerResource(KDMLSHIGLSPResource, 75), iMinLevel(10), iMaxLevel(75), iCurrentLevel(75), iPolled(EFalse)
   571 	{
   572 	iFlags = KMultiLevel | KShared | KLongLatencySet;
   573 	NKern::LockSystem();
   574 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   575 	NKern::UnlockSystem();
   576 	}
   577 
   578 _LIT(KDBSHLGLSCResource, "KDBSHLGLSCResource");
   579 DBSHLGLSCResource::DBSHLGLSCResource() : DStaticPowerResource(KDBSHLGLSCResource, E_ON), iMinLevel(E_OFF), iMaxLevel(E_ON), iCurrentLevel(E_ON), iPolled(EFalse)
   580 	{
   581 	iFlags = KMultiLevel | KShared | KLongLatencySet | KSenseCustom;
   582 	SetCustomFunction(CustomFunction);
   583 	NKern::LockSystem();
   584 	iBlockTime = MIN_BLOCK_TIME + Kern::Random() % MAX_BLOCK_TIME;
   585 	NKern::UnlockSystem();
   586 	}
   587 
   588 //DoRequest implementation of all functions
   589 TInt DBSIGISPResource::DoRequest(TPowerRequest& req)
   590 	{
   591 	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   592 	}
   593 
   594 TInt DMLSIGISPResource::DoRequest(TPowerRequest& req)
   595 	{
   596 	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   597 	}
   598 
   599 TInt DBSIGISNResource::DoRequest(TPowerRequest& req)
   600 	{
   601 	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   602 	}
   603 
   604 TInt DMLSIGISNResource::DoRequest(TPowerRequest& req)
   605 	{
   606 	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   607 	}
   608 
   609 TInt DBSLGLSPResource::DoRequest(TPowerRequest& req)
   610 	{
   611 	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   612 	}
   613 
   614 TInt DMLSLGLSPResource::DoRequest(TPowerRequest& req)
   615 	{
   616 	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   617 	}
   618 
   619 TInt DBSLGISNResource::DoRequest(TPowerRequest& req)
   620 	{
   621 	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   622 	}
   623 
   624 TInt DMLSLGISNResource::DoRequest(TPowerRequest& req)
   625 	{
   626 	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   627 	}
   628 
   629 TInt DBSIGLSPResource::DoRequest(TPowerRequest& req)
   630 	{
   631 	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   632 	}
   633 
   634 TInt DMLSIGLSPResource::DoRequest(TPowerRequest& req)
   635 	{
   636 	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   637 	}
   638 
   639 TInt DBSHIGISPResource::DoRequest(TPowerRequest& req)
   640 	{
   641 	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   642 	}
   643 
   644 TInt DMLSHIGISPResource::DoRequest(TPowerRequest& req)
   645 	{
   646 	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   647 	}
   648 
   649 TInt DBSHIGISNResource::DoRequest(TPowerRequest& req)
   650 	{
   651 	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   652 	}
   653 
   654 TInt DMLSHIGISNResource::DoRequest(TPowerRequest& req)
   655 	{
   656 	return TheController.ProcessInstantaneousResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel);
   657 	}
   658 
   659 TInt DBSHLGLSPResource::DoRequest(TPowerRequest& req)
   660 	{
   661 	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   662 	}
   663 
   664 TInt DMLSHLGLSPResource::DoRequest(TPowerRequest& req)
   665 	{
   666 	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   667 	}
   668 
   669 TInt DBSHLGISNResource::DoRequest(TPowerRequest& req)
   670 	{
   671 	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   672 	}
   673 
   674 TInt DMLSHLGISNResource::DoRequest(TPowerRequest& req)
   675 	{
   676 	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   677 	}
   678 
   679 TInt DBSHIGLSPResource::DoRequest(TPowerRequest& req)
   680 	{
   681 	return TheController.ProcessPolledResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   682 	}
   683 
   684 TInt DMLSHIGLSPResource::DoRequest(TPowerRequest& req)
   685 	{
   686 	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   687 	}
   688 
   689 TInt DBSHLGLSCResource::DoRequest(TPowerRequest& req)
   690 	{
   691 	return TheController.ProcessEventResources(req, iCurrentLevel, iMaxLevel, iMinLevel, iDefaultLevel, iBlockTime);
   692 	}
   693 
   694 /** Custom function implemetation*/
   695 TBool DBSHLGLSCResource::CustomFunction(TInt &aClientId, const TDesC8& aClientName,
   696                                         TUint /*aResourceId*/,
   697                                         TCustomOperation aCustomOperation, TInt &aLevel,
   698                                         TAny* aLevelList, TAny* /*aReserved*/)
   699 	{
   700 	static TInt ClientId = -1;
   701 
   702 	Kern::Printf("CustomFunction Passed Clientname = %S\n", &aClientName);
   703 
   704 	//Allow first client to change the resource state
   705 	if(aCustomOperation == EClientRequestLevel  &&  ClientId == -1)
   706 		{
   707 		ClientId = aClientId;
   708 		return ETrue;
   709 		}
   710 
   711 	//If client deregisters then ask to set the value to next client level if present, else to default level.
   712     if(aCustomOperation == EClientRelinquishLevel)
   713 		{	
   714 		TInt count = 0;
   715 		SPowerResourceClientLevel* pL = NULL;
   716 		SDblQue* pS = (SDblQue*)aLevelList;
   717 		for(SDblQueLink* pCL=pS->First();pCL!=&pS->iA;pCL=pCL->iNext)
   718 			{
   719 			count++;
   720 			pL=(SPowerResourceClientLevel*)pCL;
   721 			if((pL->iClientId != (TUint)aClientId))
   722 				{
   723 				aClientId = pL->iClientId;
   724 				aLevel = pL->iLevel;
   725 				ClientId = aClientId;
   726 				return ETrue;
   727 				}
   728 			}
   729 		if((pL == NULL) || (count == 1))
   730 			{
   731 		  aClientId = -1;
   732 		  aLevel = E_OFF;
   733 		  ClientId = aClientId;
   734 		  return ETrue;
   735 			}
   736 		}
   737 
   738     	/*Allow if the current client is asking to state change to E_ON. 
   739 	  Also change is allowed if current client asks for E_OFF and no other
   740 	  client is holding requirement for E_ON
   741 	  */
   742 	if(aClientId == ClientId)
   743 		{
   744 		if(aLevel == E_ON)
   745 			return ETrue;
   746 		SPowerResourceClientLevel* pL = NULL;
   747 		SDblQue* pS = (SDblQue*)aLevelList;
   748 		for(SDblQueLink* pCL=pS->First();pCL!=&pS->iA;pCL=pCL->iNext)
   749 			{
   750 			pL=(SPowerResourceClientLevel*)pCL;
   751 			if(pL->iLevel == E_ON)
   752 				{
   753 				aClientId = pL->iClientId;
   754 				ClientId = pL->iClientId;
   755 				aLevel = E_ON;
   756 				return EFalse;
   757 				}
   758 			}
   759 		return ETrue;
   760 		}
   761 	return EFalse;
   762 	}
   763 
   764 //Get info implementation of all resources.
   765 TInt DBSIGISPResource::GetInfo(TDes8* info) const
   766 	{
   767 	DStaticPowerResource::GetInfo((TDes8*)info);
   768 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   769 	buf1->iMinLevel = iMinLevel;
   770 	buf1->iMaxLevel = iMaxLevel;
   771 	return KErrNone;
   772 	}
   773 
   774 TInt DMLSIGISPResource::GetInfo(TDes8* info) const
   775 	{
   776 	DStaticPowerResource::GetInfo((TDes8*)info);
   777 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   778 	buf1->iMinLevel = iMinLevel;
   779 	buf1->iMaxLevel = iMaxLevel;
   780 	return KErrNone;
   781 	}
   782 
   783 TInt DBSIGISNResource::GetInfo(TDes8* info) const
   784 	{
   785 	DStaticPowerResource::GetInfo((TDes8*)info);
   786 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   787 	buf1->iMinLevel = iMinLevel;
   788 	buf1->iMaxLevel = iMaxLevel;
   789 	return KErrNone;
   790 	}
   791 
   792 TInt DMLSIGISNResource::GetInfo(TDes8* info) const
   793 	{
   794 	DStaticPowerResource::GetInfo((TDes8*)info);
   795 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   796 	buf1->iMinLevel = iMinLevel;
   797 	buf1->iMaxLevel = iMaxLevel;
   798 	return KErrNone;
   799 	}
   800 
   801 TInt DBSLGLSPResource::GetInfo(TDes8* info) const
   802 	{
   803 	DStaticPowerResource::GetInfo((TDes8*)info);
   804 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   805 	buf1->iMinLevel = iMinLevel;
   806 	buf1->iMaxLevel = iMaxLevel;
   807 	return KErrNone;
   808 	}
   809 
   810 TInt DMLSLGLSPResource::GetInfo(TDes8* info) const
   811 	{
   812 	DStaticPowerResource::GetInfo((TDes8*)info);
   813 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   814 	buf1->iMinLevel = iMinLevel;
   815 	buf1->iMaxLevel = iMaxLevel;
   816 	return KErrNone;
   817 	}
   818 
   819 TInt DBSLGISNResource::GetInfo(TDes8* info) const
   820 	{
   821 	DStaticPowerResource::GetInfo((TDes8*)info);
   822 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   823 	buf1->iMinLevel = iMinLevel;
   824 	buf1->iMaxLevel = iMaxLevel;
   825 	return KErrNone;
   826 	}
   827 
   828 TInt DMLSLGISNResource::GetInfo(TDes8* info) const
   829 	{
   830 	DStaticPowerResource::GetInfo((TDes8*)info);
   831 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   832 	buf1->iMinLevel = iMinLevel;
   833 	buf1->iMaxLevel = iMaxLevel;
   834 	return KErrNone;
   835 	}
   836 
   837 TInt DBSIGLSPResource::GetInfo(TDes8* info) const
   838 	{
   839 	DStaticPowerResource::GetInfo((TDes8*)info);
   840 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   841 	buf1->iMinLevel = iMinLevel;
   842 	buf1->iMaxLevel = iMaxLevel;
   843 	return KErrNone;
   844 	}
   845 
   846 TInt DMLSIGLSPResource::GetInfo(TDes8* info) const
   847 	{
   848 	DStaticPowerResource::GetInfo((TDes8*)info);
   849 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   850 	buf1->iMinLevel = iMinLevel;
   851 	buf1->iMaxLevel = iMaxLevel;
   852 	return KErrNone;
   853 	}
   854 
   855 TInt DBSHIGISPResource::GetInfo(TDes8* info) const
   856 	{
   857 	DStaticPowerResource::GetInfo((TDes8*)info);
   858 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   859 	buf1->iMinLevel = iMinLevel;
   860 	buf1->iMaxLevel = iMaxLevel;
   861 	return KErrNone;
   862 	}
   863 
   864 TInt DMLSHIGISPResource::GetInfo(TDes8* info) const
   865 	{
   866 	DStaticPowerResource::GetInfo((TDes8*)info);
   867 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   868 	buf1->iMinLevel = iMinLevel;
   869 	buf1->iMaxLevel = iMaxLevel;
   870 	return KErrNone;
   871 	}
   872 
   873 TInt DBSHIGISNResource::GetInfo(TDes8* info) const
   874 	{
   875 	DStaticPowerResource::GetInfo((TDes8*)info);
   876 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   877 	buf1->iMinLevel = iMinLevel;
   878 	buf1->iMaxLevel = iMaxLevel;
   879 	return KErrNone;
   880 	}
   881 
   882 TInt DMLSHIGISNResource::GetInfo(TDes8* info) const
   883 	{
   884 	DStaticPowerResource::GetInfo((TDes8*)info);
   885 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   886 	buf1->iMinLevel = iMinLevel;
   887 	buf1->iMaxLevel = iMaxLevel;
   888 	return KErrNone;
   889 	}
   890 
   891 TInt DBSHLGLSPResource::GetInfo(TDes8* info) const
   892 	{
   893 	DStaticPowerResource::GetInfo((TDes8*)info);
   894 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   895 	buf1->iMinLevel = iMinLevel;
   896 	buf1->iMaxLevel = iMaxLevel;
   897 	return KErrNone;
   898 	}
   899 
   900 TInt DMLSHLGLSPResource::GetInfo(TDes8* info) const
   901 	{
   902 	DStaticPowerResource::GetInfo((TDes8*)info);
   903 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   904 	buf1->iMinLevel = iMinLevel;
   905 	buf1->iMaxLevel = iMaxLevel;
   906 	return KErrNone;
   907 	}
   908 
   909 TInt DBSHLGISNResource::GetInfo(TDes8* info) const
   910 	{
   911 	DStaticPowerResource::GetInfo((TDes8*)info);
   912 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   913 	buf1->iMinLevel = iMinLevel;
   914 	buf1->iMaxLevel = iMaxLevel;
   915 	return KErrNone;
   916 	}
   917 
   918 TInt DMLSHLGISNResource::GetInfo(TDes8* info) const
   919 	{
   920 	DStaticPowerResource::GetInfo((TDes8*)info);
   921 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   922 	buf1->iMinLevel = iMinLevel;
   923 	buf1->iMaxLevel = iMaxLevel;
   924 	return KErrNone;
   925 	}
   926 
   927 TInt DBSHIGLSPResource::GetInfo(TDes8* info) const
   928 	{
   929 	DStaticPowerResource::GetInfo((TDes8*)info);
   930 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   931 	buf1->iMinLevel = iMinLevel;
   932 	buf1->iMaxLevel = iMaxLevel;
   933 	return KErrNone;
   934 	}
   935 
   936 TInt DMLSHIGLSPResource::GetInfo(TDes8* info) const
   937 	{
   938 	DStaticPowerResource::GetInfo((TDes8*)info);
   939 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   940 	buf1->iMinLevel = iMinLevel;
   941 	buf1->iMaxLevel = iMaxLevel;
   942 	return KErrNone;
   943 	}
   944 
   945 TInt DBSHLGLSCResource::GetInfo(TDes8* info) const
   946 	{
   947 	DStaticPowerResource::GetInfo((TDes8*)info);
   948 	TPowerResourceInfoV01 *buf1 = (TPowerResourceInfoV01*)info;
   949 	buf1->iMinLevel = iMinLevel;
   950 	buf1->iMaxLevel = iMaxLevel;
   951 	return KErrNone;
   952 	}