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