|
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 "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 // |
|
15 |
|
16 #include "mmrcserverinfo.h" |
|
17 #include "mmrcserversession.h" |
|
18 #include "mmrcservercontroller.h" |
|
19 #include "mlogicalchain.h" |
|
20 #include "mmrcutil.h" |
|
21 #include <a3f/a3f_trace_utils.h> |
|
22 |
|
23 |
|
24 //------------------------------------------------------------------------------------ |
|
25 // |
|
26 //------------------------------------------------------------------------------------ |
|
27 /** |
|
28 * By default Symbian 2nd phase constructor is private. |
|
29 * @param CMMRCServerController& A reference on the MMRC Server controller |
|
30 */ |
|
31 CMMRCServerInfo::CMMRCServerInfo(CMMRCServerController& aServerController) |
|
32 : iMMRCServerController( aServerController) |
|
33 { |
|
34 TRACE_CREATE(); |
|
35 DP_CONTEXT(----> CMMRCServerInfo::CMMRCServerInfo *CD1*, CtxDevSound, DPLOCAL); |
|
36 DP_IN(); |
|
37 |
|
38 DP_OUT(); |
|
39 } |
|
40 |
|
41 |
|
42 /** |
|
43 * destructor |
|
44 */ |
|
45 CMMRCServerInfo::~CMMRCServerInfo() |
|
46 { |
|
47 DP_CONTEXT(----> CMMRCServerInfo::~CMMRCServerInfo *CD1*, CtxDevSound, DPLOCAL); |
|
48 DP_IN(); |
|
49 |
|
50 iMMRCAllocatedResourceContextsQueue.ResetAndDestroy(); |
|
51 iMMRCContextsQueue.ResetAndDestroy(); |
|
52 iMMRCAPRContextsQueue.ResetAndDestroy(); |
|
53 iMMRCPausedContextsQueue.ResetAndDestroy(); |
|
54 |
|
55 DP_OUT(); |
|
56 } |
|
57 |
|
58 /** |
|
59 * Constructs, and returns a pointer to, a new CMMRCServerInfo object. |
|
60 * Leaves on failure. |
|
61 * @param CMMRCServerController& A reference on the MMRC Server controller |
|
62 * @return CMMRCServerInfo* A pointer to newly created utlitly object. |
|
63 */ |
|
64 CMMRCServerInfo* CMMRCServerInfo::NewL(CMMRCServerController& aServerController) |
|
65 { |
|
66 DP_STATIC_CONTEXT(----> CMMRCServerInfo::NewL *CD1*, CtxDevSound, DPLOCAL); |
|
67 DP_IN(); |
|
68 |
|
69 CMMRCServerInfo* self = NewLC(aServerController); |
|
70 CleanupStack::Pop(self); |
|
71 |
|
72 DP0_RET(self, "self = 0x%x"); |
|
73 } |
|
74 |
|
75 /** |
|
76 * Constructs, leaves object on the cleanup stack, and returns a pointer |
|
77 * to, a new CMMRCServerInfo object. |
|
78 * Leaves on failure. |
|
79 * @param CMMRCServerController& A reference on the MMRC Server controller |
|
80 * @return CMMRCServerInfo* A pointer to newly created utlitly object. |
|
81 */ |
|
82 CMMRCServerInfo* CMMRCServerInfo::NewLC(CMMRCServerController& aServerController) |
|
83 { |
|
84 DP_STATIC_CONTEXT(----> CMMRCServerInfo::NewLC *CD1*, CtxDevSound, DPLOCAL); |
|
85 DP_IN(); |
|
86 |
|
87 CMMRCServerInfo* self=new(ELeave) CMMRCServerInfo(aServerController); |
|
88 CleanupStack::PushL(self); |
|
89 self->ConstructL( ); |
|
90 |
|
91 DP0_RET(self, "self = 0x%x"); |
|
92 } |
|
93 |
|
94 /** |
|
95 CMMRCServerInfo::ConstructL |
|
96 Symbian 2nd phase constructor can leave. |
|
97 */ |
|
98 void CMMRCServerInfo::ConstructL() |
|
99 { |
|
100 DP_CONTEXT(----> CMMRCServerInfo::ConstructL *CD1*, CtxDevSound, DPLOCAL); |
|
101 DP_IN(); |
|
102 |
|
103 DP_OUT(); |
|
104 } |
|
105 |
|
106 /** |
|
107 * Change the state of the server |
|
108 * @param TMMRCServerState aNewState |
|
109 */ |
|
110 void CMMRCServerInfo::SwitchServerState(TMMRCServerState aNewState, TUint64 aContextId) |
|
111 { |
|
112 DP_CONTEXT(----> CMMRCServerInfo::SwitchServerState *CD1*, CtxDevSound, DPLOCAL); |
|
113 DP_IN(); |
|
114 |
|
115 iMMRCServerInfoState = aNewState; |
|
116 iLastTransactionContextId = aContextId; |
|
117 |
|
118 DP_OUT(); |
|
119 } |
|
120 |
|
121 /** |
|
122 * return the current server state |
|
123 * @return TMMRCServerState& aServerState |
|
124 */ |
|
125 void CMMRCServerInfo::ServerState(TMMRCServerState& aServerState, TUint64& aContextId) const |
|
126 { |
|
127 DP_CONTEXT(----> CMMRCServerInfo::ServerState *CD1*, CtxDevSound, DPLOCAL); |
|
128 DP_IN(); |
|
129 |
|
130 aContextId = iLastTransactionContextId; |
|
131 aServerState = iMMRCServerInfoState; |
|
132 |
|
133 DP_OUT(); |
|
134 } |
|
135 |
|
136 //------------------------------------------------------------------------------------ |
|
137 // |
|
138 //------------------------------------------------------------------------------------ |
|
139 |
|
140 /** |
|
141 * Push an Context on the Context queue in parameter |
|
142 * @param RMMRCContextsQueueTD& aContextsQueue |
|
143 * @param CMMRCServerSession& aServerSession |
|
144 * @leave in case of memory error |
|
145 */ |
|
146 void CMMRCServerInfo::PushContextL(RMMRCContextsQueueTD& aContextsQueue, const CMMRCServerSession& aServerSession ) |
|
147 { |
|
148 DP_CONTEXT(----> CMMRCServerInfo::PushContextL *CD1*, CtxDevSound, DPLOCAL); |
|
149 DP_IN(); |
|
150 |
|
151 aContextsQueue.PushL(&aServerSession); |
|
152 |
|
153 DP_OUT(); |
|
154 } |
|
155 |
|
156 /** |
|
157 * Pop and remove the first Context of the highest priority from the Context queue in parameter |
|
158 * @param RMMRCContextsQueueTD& aContextsQueue |
|
159 * @return CMMRCServerSession* the session of the Context |
|
160 */ |
|
161 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstContext(RMMRCContextsQueueTD& aContextsQueue) |
|
162 { |
|
163 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstContext *CD1*, CtxDevSound, DPLOCAL); |
|
164 DP_IN(); |
|
165 |
|
166 CMMRCServerSession* serverSession = 0; |
|
167 //PopAndRemove return null if the queue is empty; |
|
168 serverSession = aContextsQueue.PopAndRemove(); |
|
169 |
|
170 DP0_RET(serverSession, "serverSession = 0x%x"); |
|
171 } |
|
172 |
|
173 /** |
|
174 * Pop and remove the first Context from the Context queue in parameter by contextId |
|
175 * @param RMMRCContextsQueueTD& aContextsQueue |
|
176 * @param const TAudioContextId& aContextId |
|
177 * @return CMMRCServerSession* the session of the Context |
|
178 */ |
|
179 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstContextByContextId(RMMRCContextsQueueTD& aContextsQueue, const TAudioContextId& aContextId ) |
|
180 { |
|
181 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstContextByContextId *CD1*, CtxDevSound, DPLOCAL); |
|
182 DP_IN(); |
|
183 |
|
184 CMMRCServerSession* serverSession = NULL; |
|
185 |
|
186 TInt nbContexts = aContextsQueue.Count(); |
|
187 for( TInt i = 0 ; i < nbContexts ; i++ ) |
|
188 { |
|
189 serverSession = aContextsQueue[i]; |
|
190 |
|
191 TAudioContextId contextId = serverSession->ContextId(); |
|
192 if( aContextId == contextId ) |
|
193 { |
|
194 aContextsQueue.PopAndRemove(i); |
|
195 break; |
|
196 } |
|
197 else |
|
198 { |
|
199 serverSession = NULL; |
|
200 } |
|
201 } |
|
202 |
|
203 DP0_RET(serverSession, "serverSession = 0x%x"); |
|
204 } |
|
205 |
|
206 |
|
207 /** |
|
208 * Pop and remove the first Context of the highest priority from the Context queue in parameter |
|
209 * @param RMMRCContextsQueueTD& aContextsQueue |
|
210 * @return CMMRCServerSession* the session of the Context |
|
211 */ |
|
212 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveContextFirstHighestPriority(RMMRCContextsQueueTD& aContextsQueue) |
|
213 { |
|
214 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveContextFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); |
|
215 DP_IN(); |
|
216 |
|
217 TInt nbContexts = aContextsQueue.Count(); |
|
218 if( 0 == nbContexts ) |
|
219 { |
|
220 return NULL; |
|
221 } |
|
222 |
|
223 TInt highestPriority = 0; |
|
224 TInt sessionIdx = 0; |
|
225 for( TInt i = 0 ; i < nbContexts ; i++ ) |
|
226 { |
|
227 const CMMRCServerSession* srvSession = aContextsQueue[i]; |
|
228 // LogicalChainLastCommited or LogicalChainRequested is not null necesseraly |
|
229 const MLogicalChain* logicalChain = srvSession->LogicalChainRequested(); |
|
230 if(!logicalChain) |
|
231 { |
|
232 logicalChain = srvSession->LogicalChainLastCommited(); |
|
233 } |
|
234 if(!logicalChain) |
|
235 { |
|
236 return NULL; |
|
237 } |
|
238 // AM Getting the priority |
|
239 TInt currentChainPriority = (const_cast<MLogicalChain*>(logicalChain))->Priority(); |
|
240 if( currentChainPriority > highestPriority ) |
|
241 { |
|
242 highestPriority = currentChainPriority; |
|
243 sessionIdx = i; |
|
244 } |
|
245 |
|
246 |
|
247 // JIn edited as these settings have been removed |
|
248 /* TAudioTypeSettings audioTypeSettings = (logicalChain->ChainConfiguration()).iAudioTypeSettings; |
|
249 if( audioTypeSettings.iPriority > highestPriority ) |
|
250 { |
|
251 highestPriority = audioTypeSettings.iPriority; |
|
252 sessionIdx = i; |
|
253 } |
|
254 */ |
|
255 |
|
256 // AM |
|
257 // highestPriority = 5; |
|
258 // sessionIdx = i; |
|
259 |
|
260 //EOJin |
|
261 } |
|
262 CMMRCServerSession* serverSession = aContextsQueue.PopAndRemove(sessionIdx); |
|
263 |
|
264 DP0_RET(serverSession, "serverSession=0x%x"); |
|
265 } |
|
266 |
|
267 /** |
|
268 * Pop and remove the first Context of the highest priority and more than aPriority |
|
269 * from the Context queue in parameter |
|
270 * @param RMMRCContextsQueueTD& aContextsQueue |
|
271 * @param TInt aPriority |
|
272 * @return CMMRCServerSession* the session of the Context |
|
273 */ |
|
274 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveContextFirstHighestPriority(RMMRCContextsQueueTD& aContextsQueue, TInt /*aPriority*/ ) |
|
275 { |
|
276 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveContextFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); |
|
277 DP_IN(); |
|
278 |
|
279 CMMRCServerSession* serverSession = NULL; |
|
280 TInt nbContexts = aContextsQueue.Count(); |
|
281 if( 0 == nbContexts ) |
|
282 { |
|
283 return NULL; |
|
284 } |
|
285 |
|
286 TInt highestPriority = 0; |
|
287 TInt sessionIdx = 0; |
|
288 for( TInt i = 0 ; i < nbContexts ; i++ ) |
|
289 { |
|
290 const CMMRCServerSession* srvSession = aContextsQueue[i]; |
|
291 // LogicalChainLastCommited or LogicalChainRequested is not null necesseraly |
|
292 const MLogicalChain* logicalChain = srvSession->LogicalChainRequested(); |
|
293 if(!logicalChain) |
|
294 { |
|
295 return NULL; |
|
296 } |
|
297 |
|
298 // AM Getting the priority |
|
299 TInt currentChainPriority = (const_cast<MLogicalChain*>(logicalChain))->Priority(); |
|
300 if( currentChainPriority > highestPriority ) |
|
301 { |
|
302 highestPriority = currentChainPriority; |
|
303 sessionIdx = i; |
|
304 } |
|
305 |
|
306 |
|
307 |
|
308 // EOJin |
|
309 } |
|
310 |
|
311 if( sessionIdx < nbContexts ) |
|
312 { |
|
313 serverSession = aContextsQueue.PopAndRemove(sessionIdx); |
|
314 } |
|
315 |
|
316 DP0_RET(serverSession, "serverSession=0x%x"); |
|
317 } |
|
318 |
|
319 /** |
|
320 * Pop the first Context from the Context queue in parameter |
|
321 * @param RMMRCContextsQueueTD& aContextsQueue |
|
322 * @return CMMRCServerSession* the session of the Context |
|
323 */ |
|
324 CMMRCServerSession* CMMRCServerInfo::PopFirstContext(const RMMRCContextsQueueTD& aContextsQueue) const |
|
325 { |
|
326 DP_CONTEXT(----> CMMRCServerInfo::PopFirstContext *CD1*, CtxDevSound, DPLOCAL); |
|
327 DP_IN(); |
|
328 |
|
329 CMMRCServerSession* serverSession = 0; |
|
330 //PopAndRemove return null if the queue is empty; |
|
331 serverSession = aContextsQueue.Pop(); |
|
332 |
|
333 DP0_RET(serverSession, "serverSession=0x%x"); |
|
334 } |
|
335 |
|
336 /** |
|
337 * Pop the first Context of the highest priority from the Context queue in parameter |
|
338 * @param RMMRCContextsQueueTD& aContextsQueue |
|
339 * @return CMMRCServerSession* the session of the Context |
|
340 */ |
|
341 CMMRCServerSession* CMMRCServerInfo::PopContextFirstHighestPriority(const RMMRCContextsQueueTD& aContextsQueue) const |
|
342 { |
|
343 DP_CONTEXT(----> CMMRCServerInfo::PopContextFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); |
|
344 DP_IN(); |
|
345 |
|
346 TInt nbContexts = aContextsQueue.Count(); |
|
347 if( 0 == nbContexts ) |
|
348 { |
|
349 return NULL; |
|
350 } |
|
351 |
|
352 TInt highestPriority = 0; |
|
353 TInt sessionIdx = 0; |
|
354 for( TInt i = 0 ; i < nbContexts ; i++ ) |
|
355 { |
|
356 const CMMRCServerSession* srvSession = aContextsQueue[i]; |
|
357 // LogicalChainLastCommited or LogicalChainRequested is not null necesseraly |
|
358 const MLogicalChain* logicalChain = srvSession->LogicalChainRequested(); |
|
359 if(!logicalChain) |
|
360 { |
|
361 logicalChain = srvSession->LogicalChainLastCommited(); |
|
362 } |
|
363 if(!logicalChain) |
|
364 { |
|
365 return NULL; |
|
366 } |
|
367 |
|
368 // Jin edited to remove dependency on missing element |
|
369 /* |
|
370 TAudioTypeSettings audioTypeSettings = (logicalChain->ChainConfiguration()).iAudioTypeSettings; |
|
371 if( audioTypeSettings.iPriority > highestPriority ) |
|
372 { |
|
373 highestPriority = audioTypeSettings.iPriority; |
|
374 sessionIdx = i; |
|
375 } |
|
376 */ |
|
377 // AM |
|
378 /* highestPriority = 5; |
|
379 sessionIdx = i; |
|
380 |
|
381 */ |
|
382 // AM Getting the priority |
|
383 TInt currentChainPriority = (const_cast<MLogicalChain*>(logicalChain))->Priority(); |
|
384 if( currentChainPriority > highestPriority ) |
|
385 { |
|
386 highestPriority = currentChainPriority; |
|
387 sessionIdx = i; |
|
388 } |
|
389 |
|
390 // EOJIn |
|
391 } |
|
392 CMMRCServerSession* serverSession = aContextsQueue.Pop(sessionIdx); |
|
393 |
|
394 DP0_RET(serverSession, "serverSession=0x%x"); |
|
395 } |
|
396 |
|
397 /** |
|
398 * Pop the first Context of the highest priority and more than aPriority |
|
399 * from the Context queue in parameter |
|
400 * @param RMMRCContextsQueueTD& aContextsQueue |
|
401 * @param TInt aPriority |
|
402 * @return CMMRCServerSession* the session of the Context |
|
403 */ |
|
404 CMMRCServerSession* CMMRCServerInfo::PopContextFirstHighestPriority(const RMMRCContextsQueueTD& aContextsQueue, TInt /*aPriority*/ ) const |
|
405 { |
|
406 DP_CONTEXT(----> CMMRCServerInfo::PopContextFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); |
|
407 DP_IN(); |
|
408 |
|
409 TInt nbContexts = aContextsQueue.Count(); |
|
410 if( 0 == nbContexts ) |
|
411 { |
|
412 return NULL; |
|
413 } |
|
414 |
|
415 TInt highestPriority = 0; |
|
416 TInt sessionIdx = 0; |
|
417 for( TInt i = 0 ; i < nbContexts ; i++ ) |
|
418 { |
|
419 const CMMRCServerSession* srvSession = aContextsQueue[i]; |
|
420 // LogicalChainLastCommited or LogicalChainRequested is not null necesseraly |
|
421 const MLogicalChain* logicalChain = srvSession->LogicalChainRequested(); |
|
422 if(!logicalChain) |
|
423 { |
|
424 logicalChain = srvSession->LogicalChainLastCommited(); |
|
425 } |
|
426 if(!logicalChain) |
|
427 { |
|
428 return NULL; |
|
429 } |
|
430 |
|
431 // JIn edited to remove dependency |
|
432 /* |
|
433 TAudioTypeSettings audioTypeSettings = (logicalChain->ChainConfiguration()).iAudioTypeSettings; |
|
434 if( audioTypeSettings.iPriority > aPriority && audioTypeSettings.iPriority > highestPriority ) |
|
435 { |
|
436 highestPriority = audioTypeSettings.iPriority; |
|
437 sessionIdx = i; |
|
438 } |
|
439 */ |
|
440 |
|
441 // AM New way to access |
|
442 // highestPriority = 5; |
|
443 // sessionIdx = i; |
|
444 |
|
445 // AM Getting the priority |
|
446 TInt currentChainPriority = (const_cast<MLogicalChain*>(logicalChain))->Priority(); |
|
447 if( currentChainPriority > highestPriority ) |
|
448 { |
|
449 highestPriority = currentChainPriority; |
|
450 sessionIdx = i; |
|
451 } |
|
452 // EOJIn |
|
453 } |
|
454 |
|
455 CMMRCServerSession* serverSession = NULL; |
|
456 if( sessionIdx < nbContexts ) |
|
457 { |
|
458 serverSession = aContextsQueue.Pop(sessionIdx); |
|
459 } |
|
460 |
|
461 DP0_RET(serverSession, "serverSession=0x%x"); |
|
462 } |
|
463 |
|
464 //------------------------------------------------------------------------------------ |
|
465 // |
|
466 //------------------------------------------------------------------------------------ |
|
467 |
|
468 /** |
|
469 * Push an Context on the Context queue |
|
470 * @param CMMRCServerSession& aServerSession |
|
471 * @leave in case of memory error |
|
472 */ |
|
473 void CMMRCServerInfo::PushRequestL(const CMMRCServerSession& aServerSession ) |
|
474 { |
|
475 DP_CONTEXT(----> CMMRCServerInfo::PushRequestL *CD1*, CtxDevSound, DPLOCAL); |
|
476 DP_IN(); |
|
477 |
|
478 PushContextL(iMMRCContextsQueue, aServerSession); |
|
479 |
|
480 DP_OUT(); |
|
481 } |
|
482 |
|
483 /** |
|
484 * Pop and remove the first Context from the Context queue |
|
485 * @return CMMRCServerSession* the session of the Context |
|
486 */ |
|
487 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstRequest() |
|
488 { |
|
489 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstRequest *CD1*, CtxDevSound, DPLOCAL); |
|
490 DP_IN(); |
|
491 |
|
492 CMMRCServerSession* mmrcSession = PopAndRemoveFirstContext(iMMRCContextsQueue); |
|
493 |
|
494 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
495 } |
|
496 |
|
497 /** |
|
498 * Pop and remove the first Context from the Context queue by contextId |
|
499 * @param const TAudioContextId& aContextId |
|
500 * @return CMMRCServerSession* the session of the Context |
|
501 */ |
|
502 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstRequestByContextId(const TAudioContextId& aContextId ) |
|
503 { |
|
504 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstRequestByContextId *CD1*, CtxDevSound, DPLOCAL); |
|
505 DP_IN(); |
|
506 |
|
507 CMMRCServerSession* mmrcSession = PopAndRemoveFirstContextByContextId(iMMRCContextsQueue, aContextId); |
|
508 |
|
509 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
510 } |
|
511 |
|
512 |
|
513 /** |
|
514 * Pop and remove the first Context of the highest priority from the Context queue |
|
515 * @param TInt aPriority |
|
516 * @return CMMRCServerSession* the session of the Context |
|
517 */ |
|
518 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveRequestFirstHighestPriority() |
|
519 { |
|
520 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveRequestFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); |
|
521 DP_IN(); |
|
522 |
|
523 CMMRCServerSession* mmrcSession = PopAndRemoveContextFirstHighestPriority(iMMRCContextsQueue); |
|
524 |
|
525 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
526 } |
|
527 |
|
528 /** |
|
529 * Pop and remove the first Context of the highest priority and more than aPriority |
|
530 * from the Context queue |
|
531 * @param TInt aPriority |
|
532 * @return CMMRCServerSession* the session of the Context |
|
533 */ |
|
534 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveRequestFirstHighestPriority( TInt aPriority ) |
|
535 { |
|
536 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveRequestFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); |
|
537 DP_IN(); |
|
538 |
|
539 CMMRCServerSession* mmrcSession = PopAndRemoveContextFirstHighestPriority(iMMRCContextsQueue, aPriority); |
|
540 |
|
541 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
542 } |
|
543 |
|
544 /** |
|
545 * Pop the first Context from the Context queue |
|
546 * @return CMMRCServerSession* the session of the Context |
|
547 */ |
|
548 CMMRCServerSession* CMMRCServerInfo::PopFirstRequest() const |
|
549 { |
|
550 DP_CONTEXT(----> CMMRCServerInfo::PopFirstRequest *CD1*, CtxDevSound, DPLOCAL); |
|
551 DP_IN(); |
|
552 |
|
553 CMMRCServerSession* mmrcSession = PopFirstContext(iMMRCContextsQueue); |
|
554 |
|
555 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
556 } |
|
557 |
|
558 /** |
|
559 * Pop the first Context of the highest priority from the Context queue |
|
560 * @return CMMRCServerSession* the session of the Context |
|
561 */ |
|
562 CMMRCServerSession* CMMRCServerInfo::PopRequestFirstHighestPriority() const |
|
563 { |
|
564 DP_CONTEXT(----> CMMRCServerInfo::PopRequestFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); |
|
565 DP_IN(); |
|
566 |
|
567 CMMRCServerSession* mmrcSession = PopContextFirstHighestPriority(iMMRCContextsQueue); |
|
568 |
|
569 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
570 } |
|
571 |
|
572 /** |
|
573 * Pop the first Context of the highest priority and more than aPriority |
|
574 * from the Context queue |
|
575 * @param TInt aPriority |
|
576 * @return CMMRCServerSession* the session of the Context |
|
577 */ |
|
578 CMMRCServerSession* CMMRCServerInfo::PopRequestFirstHighestPriority(TInt aPriority ) const |
|
579 { |
|
580 DP_CONTEXT(----> CMMRCServerInfo::PopRequestFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); |
|
581 DP_IN(); |
|
582 |
|
583 CMMRCServerSession* mmrcSession = PopContextFirstHighestPriority(iMMRCContextsQueue, aPriority); |
|
584 |
|
585 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
586 } |
|
587 |
|
588 //------------------------------------------------------------------------------------ |
|
589 // |
|
590 //------------------------------------------------------------------------------------ |
|
591 |
|
592 /** |
|
593 * Push an Context on the in-process Context queue |
|
594 * @param CMMRCServerSession& aServerSession |
|
595 * @leave in case of memory error |
|
596 */ |
|
597 void CMMRCServerInfo::PushAllocatedResourceContextL(const CMMRCServerSession& aServerSession ) |
|
598 { |
|
599 DP_CONTEXT(----> CMMRCServerInfo::PushAllocatedResourceContextL *CD1*, CtxDevSound, DPLOCAL); |
|
600 DP_IN(); |
|
601 |
|
602 PushContextL(iMMRCAllocatedResourceContextsQueue, aServerSession); |
|
603 |
|
604 DP_OUT(); |
|
605 } |
|
606 |
|
607 /** |
|
608 * Pop and remove the first Context of the highest priority from the in-process Context queue |
|
609 * @return CMMRCServerSession* the session of the Context |
|
610 */ |
|
611 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstAllocatedResourceContext() |
|
612 { |
|
613 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstAllocatedResourceContext *CD1*, CtxDevSound, DPLOCAL); |
|
614 DP_IN(); |
|
615 |
|
616 CMMRCServerSession* mmrcSession = PopAndRemoveFirstContext(iMMRCAllocatedResourceContextsQueue); |
|
617 |
|
618 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
619 } |
|
620 |
|
621 /** |
|
622 * Pop and remove the first Context from the in-process Context queue by contextId |
|
623 * @param const TAudioContextId& aContextId |
|
624 * @return CMMRCServerSession* the session of the Context |
|
625 */ |
|
626 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstAllocatedResourceContextByContextId(const TAudioContextId& aContextId ) |
|
627 { |
|
628 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstAllocatedResourceContextByContextId *CD1*, CtxDevSound, DPLOCAL); |
|
629 DP_IN(); |
|
630 |
|
631 CMMRCServerSession* mmrcSession = PopAndRemoveFirstContextByContextId(iMMRCAllocatedResourceContextsQueue, aContextId); |
|
632 |
|
633 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
634 } |
|
635 |
|
636 /** |
|
637 * Pop the first Context from the in-process Context queue |
|
638 * @return CMMRCServerSession* the session of the Context |
|
639 */ |
|
640 CMMRCServerSession* CMMRCServerInfo::PopFirstAllocatedResourceContext() const |
|
641 { |
|
642 DP_CONTEXT(----> CMMRCServerInfo::PopFirstAllocatedResourceContext *CD1*, CtxDevSound, DPLOCAL); |
|
643 DP_IN(); |
|
644 |
|
645 CMMRCServerSession* mmrcSession = PopFirstContext(iMMRCAllocatedResourceContextsQueue); |
|
646 |
|
647 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
648 } |
|
649 |
|
650 //------------------------------------------------------------------------------------ |
|
651 // |
|
652 //------------------------------------------------------------------------------------ |
|
653 |
|
654 /** |
|
655 * Push an Context on the in-process Context queue |
|
656 * @param CMMRCServerSession& aServerSession |
|
657 * @leave in case of memory error |
|
658 */ |
|
659 void CMMRCServerInfo::PushPausedContextL(const CMMRCServerSession& aServerSession ) |
|
660 { |
|
661 DP_CONTEXT(----> CMMRCServerInfo::PushPausedContextL *CD1*, CtxDevSound, DPLOCAL); |
|
662 DP_IN(); |
|
663 |
|
664 PushContextInOrderL(iMMRCPausedContextsQueue, aServerSession); |
|
665 |
|
666 DP_OUT(); |
|
667 } |
|
668 |
|
669 /** |
|
670 * Pop and remove the first Context of the highest priority from the in-process Context queue |
|
671 * @return CMMRCServerSession* the session of the Context |
|
672 */ |
|
673 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstPausedContext() |
|
674 { |
|
675 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstPausedContext *CD1*, CtxDevSound, DPLOCAL); |
|
676 DP_IN(); |
|
677 |
|
678 CMMRCServerSession* mmrcSession = PopAndRemoveFirstContextForPause(iMMRCPausedContextsQueue); |
|
679 |
|
680 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
681 } |
|
682 /** |
|
683 * Pop and remove the first Context from the in-process Context queue by contextId |
|
684 * @param const TAudioContextId& aContextId |
|
685 * @return CMMRCServerSession* the session of the Context |
|
686 */ |
|
687 CMMRCServerSession* CMMRCServerInfo::PopAndRemovePausedContext(const TAudioContextId& aContextId ) |
|
688 { |
|
689 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemovePausedContext *CD1*, CtxDevSound, DPLOCAL); |
|
690 DP_IN(); |
|
691 |
|
692 CMMRCServerSession* mmrcSession = PopAndRemoveContextIdForPause(iMMRCPausedContextsQueue, aContextId); |
|
693 |
|
694 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
695 } |
|
696 /** |
|
697 * Pop the Context from the in-process Context queue |
|
698 * @param const TAudioContextId& aContextId |
|
699 * @return CMMRCServerSession* the session of the Context |
|
700 */ |
|
701 CMMRCServerSession* CMMRCServerInfo::PausedContextByIndex(TInt aIndex) |
|
702 { |
|
703 DP_CONTEXT(----> CMMRCServerInfo::PausedContextByIndex *CD1*, CtxDevSound, DPLOCAL); |
|
704 DP_IN(); |
|
705 |
|
706 CMMRCServerSession* mmrcSession = PausedContextByIndexForPause(iMMRCPausedContextsQueue, aIndex); |
|
707 |
|
708 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
709 } |
|
710 |
|
711 |
|
712 //------------------------------------------------------------------------------------ |
|
713 // |
|
714 //------------------------------------------------------------------------------------ |
|
715 |
|
716 /** |
|
717 * Push an Context on the in-process Context queue |
|
718 * @param CMMRCServerSession& aServerSession |
|
719 * @leave in case of memory error |
|
720 */ |
|
721 void CMMRCServerInfo::PushAPRContextL(const CMMRCServerSession& aServerSession ) |
|
722 { |
|
723 DP_CONTEXT(----> CMMRCServerInfo::PushAPRContextL *CD1*, CtxDevSound, DPLOCAL); |
|
724 DP_IN(); |
|
725 |
|
726 PushContextL(iMMRCAPRContextsQueue, aServerSession); |
|
727 |
|
728 DP_OUT(); |
|
729 } |
|
730 |
|
731 /** |
|
732 * Pop and remove the first Context of the highest priority from the in-process Context queue |
|
733 * @return CMMRCServerSession* the session of the Context |
|
734 */ |
|
735 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstAPRContext() |
|
736 { |
|
737 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstAPRContext *CD1*, CtxDevSound, DPLOCAL); |
|
738 DP_IN(); |
|
739 |
|
740 CMMRCServerSession* mmrcSession = PopAndRemoveFirstContext(iMMRCAPRContextsQueue); |
|
741 |
|
742 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
743 } |
|
744 /** |
|
745 * Pop and remove the first Context from the in-process Context queue by contextId |
|
746 * @param const TAudioContextId& aContextId |
|
747 * @return CMMRCServerSession* the session of the Context |
|
748 */ |
|
749 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstAPRContextByContextId(const TAudioContextId& aContextId ) |
|
750 { |
|
751 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstAPRContextByContextId *CD1*, CtxDevSound, DPLOCAL); |
|
752 DP_IN(); |
|
753 |
|
754 CMMRCServerSession* mmrcSession = PopAndRemoveFirstContextByContextId(iMMRCAPRContextsQueue, aContextId); |
|
755 |
|
756 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
757 } |
|
758 /** |
|
759 * Pop the first Context from the in-process Context queue |
|
760 * @return CMMRCServerSession* the session of the Context |
|
761 */ |
|
762 CMMRCServerSession* CMMRCServerInfo::PopFirstAPRContext() const |
|
763 { |
|
764 DP_CONTEXT(----> CMMRCServerInfo::PopFirstAPRContext *CD1*, CtxDevSound, DPLOCAL); |
|
765 DP_IN(); |
|
766 |
|
767 CMMRCServerSession* mmrcSession = PopFirstContext(iMMRCAPRContextsQueue); |
|
768 |
|
769 DP0_RET(mmrcSession, "mmrcSession = 0x%x"); |
|
770 } |
|
771 |
|
772 /** |
|
773 |
|
774 */ |
|
775 TBool CMMRCServerInfo::IsOnAPRList(TAudioContextId aId) |
|
776 { |
|
777 DP_CONTEXT(----> CMMRCServerInfo::IsOnAPRList *CD1*, CtxDevSound, DPLOCAL); |
|
778 DP_IN(); |
|
779 TBool iIsContain = EFalse; |
|
780 CMMRCServerSession* serverSession = NULL; |
|
781 |
|
782 TInt nbContexts = iMMRCAPRContextsQueue.Count(); |
|
783 for( TInt i = 0 ; i < nbContexts ; i++ ) |
|
784 { |
|
785 serverSession = iMMRCAPRContextsQueue[i]; |
|
786 |
|
787 TAudioContextId contextId = serverSession->ContextId(); |
|
788 if( aId == contextId ) |
|
789 { |
|
790 iIsContain = ETrue; |
|
791 break; |
|
792 } |
|
793 } |
|
794 |
|
795 DP0_RET(iIsContain, "%d"); |
|
796 } |
|
797 |
|
798 /** |
|
799 |
|
800 */ |
|
801 void CMMRCServerInfo::PushContextInOrderL(RMMRCContextsQueueOrderTD& aContextsQueue, const CMMRCServerSession& aServerSession ) |
|
802 { |
|
803 DP_CONTEXT(----> CMMRCServerInfo::PushContextInOrderL *CD1*, CtxDevSound, DPLOCAL); |
|
804 DP_IN(); |
|
805 |
|
806 aContextsQueue.PushL(&aServerSession); |
|
807 |
|
808 DP_OUT(); |
|
809 } |
|
810 |
|
811 |
|
812 /** |
|
813 |
|
814 */ |
|
815 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstContextForPause(RMMRCContextsQueueOrderTD& aContextsQueue) |
|
816 { |
|
817 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstContextForPause *CD1*, CtxDevSound, DPLOCAL); |
|
818 DP_IN(); |
|
819 |
|
820 CMMRCServerSession* serverSession = 0; |
|
821 //PopAndRemove return null if the queue is empty; |
|
822 serverSession = aContextsQueue.PopAndRemoveForPause(0); |
|
823 |
|
824 DP0_RET(serverSession, "serverSession = 0x%x"); |
|
825 } |
|
826 |
|
827 /** |
|
828 |
|
829 */ |
|
830 CMMRCServerSession* CMMRCServerInfo::PopAndRemoveContextIdForPause(RMMRCContextsQueueOrderTD& aContextsQueue, const TAudioContextId& aContextId ) |
|
831 { |
|
832 DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveContextIdForPause *CD1*, CtxDevSound, DPLOCAL); |
|
833 DP_IN(); |
|
834 |
|
835 CMMRCServerSession* serverSession = NULL; |
|
836 |
|
837 TInt nbContexts = aContextsQueue.Count(); |
|
838 for( TInt i = 0 ; i < nbContexts ; i++ ) |
|
839 { |
|
840 serverSession = aContextsQueue[i]; |
|
841 |
|
842 TAudioContextId contextId = serverSession->ContextId(); |
|
843 if( aContextId == contextId ) |
|
844 { |
|
845 aContextsQueue.PopAndRemoveForPause(i); |
|
846 break; |
|
847 } |
|
848 else |
|
849 { |
|
850 serverSession = NULL; |
|
851 } |
|
852 } |
|
853 |
|
854 DP0_RET(serverSession, "serverSession = 0x%x"); |
|
855 } |
|
856 |
|
857 |
|
858 /** |
|
859 |
|
860 */ |
|
861 CMMRCServerSession* CMMRCServerInfo::PausedContextByIndexForPause(RMMRCContextsQueueOrderTD& aContextsQueue, TInt aIndex) |
|
862 { |
|
863 DP_CONTEXT(----> CMMRCServerInfo::PausedContextByIndexForPause *CD1*, CtxDevSound, DPLOCAL); |
|
864 DP_IN(); |
|
865 |
|
866 CMMRCServerSession* serverSession = 0; |
|
867 //PopAndRemove return null if the queue is empty; |
|
868 serverSession = aContextsQueue[aIndex]; |
|
869 |
|
870 DP0_RET(serverSession, "serverSession = 0x%x"); |
|
871 } |
|
872 |
|
873 |
|
874 |
|
875 /** |
|
876 |
|
877 */ |
|
878 TBool CMMRCServerInfo::IsOnPauseList(TAudioContextId aId) |
|
879 { |
|
880 DP_CONTEXT(----> CMMRCServerInfo::IsOnAPRList *CD1*, CtxDevSound, DPLOCAL); |
|
881 DP_IN(); |
|
882 TBool iIsContain = EFalse; |
|
883 CMMRCServerSession* serverSession = NULL; |
|
884 |
|
885 TInt nbContexts = iMMRCPausedContextsQueue.Count(); |
|
886 for( TInt i = 0 ; i < nbContexts ; i++ ) |
|
887 { |
|
888 serverSession = iMMRCPausedContextsQueue[i]; |
|
889 |
|
890 TAudioContextId contextId = serverSession->ContextId(); |
|
891 if( aId == contextId ) |
|
892 { |
|
893 iIsContain = ETrue; |
|
894 break; |
|
895 } |
|
896 } |
|
897 |
|
898 DP0_RET(iIsContain, "%d"); |
|
899 } |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 TInt CMMRCServerInfo::RequestsCount() |
|
905 { return iMMRCContextsQueue.Count(); } |
|
906 TInt CMMRCServerInfo::AllocatedResourceContextsCount() |
|
907 { return iMMRCAllocatedResourceContextsQueue.Count(); } |
|
908 TInt CMMRCServerInfo::AllocatedAPRContextsCount() |
|
909 { return iMMRCAPRContextsQueue.Count(); } |
|
910 TInt CMMRCServerInfo::AllocatedPausedContextsCount() |
|
911 { return iMMRCPausedContextsQueue.Count(); } |
|
912 |
|
913 //EOF |