18 #include <e32svr.h> |
18 #include <e32svr.h> |
19 #include <e32uid.h> |
19 #include <e32uid.h> |
20 #include <e32capability.h> |
20 #include <e32capability.h> |
21 #include "tmsutility.h" |
21 #include "tmsutility.h" |
22 #include "tmsclientserver.h" |
22 #include "tmsclientserver.h" |
23 #include "tmsserver.h" |
23 #include "tmstelephonycenrep.h" |
24 #include "tmsservershutdown.h" |
24 #include "tmsservershutdown.h" |
25 #include "tmsserversession.h" |
25 #include "tmsserversession.h" |
26 #include "tmscallserverstartparam.h" |
26 #include "tmscallserverstartparam.h" |
27 #include "tmscallserver.h" |
27 #include "tmscallserver.h" |
28 #include "tmscallclisrv.h" |
28 #include "tmscallclisrv.h" |
29 #include "globaleffectssettings.h" |
29 #include "tmsglobaleffectssettings.h" |
30 #include "tareventhandler.h" |
30 #include "tmstareventhandler.h" |
31 #include "cspaudiohandler.h" |
31 #include "tmscenrepaudiohandler.h" |
|
32 #include "tmsserver.h" |
32 |
33 |
33 using namespace TMS; |
34 using namespace TMS; |
34 |
35 |
35 // CONSTANTS |
36 // CONSTANTS |
36 const TInt KShutDownDelayTime = 5000000; // 5 sec delay time |
37 const TInt KTMSShutDownDelayTime = 1000000; // 1 sec delay time |
37 const TInt KOutputsArraySize = 10; |
38 const TInt KOutputsArraySize = 10; |
38 |
39 |
39 // ----------------------------------------------------------------------------- |
40 // ----------------------------------------------------------------------------- |
40 // TMSServer::NewL |
41 // TMSServer::NewL |
41 // |
42 // |
158 |
159 |
159 // If session count is zero, start server shutdown |
160 // If session count is zero, start server shutdown |
160 if (iSession == 0) |
161 if (iSession == 0) |
161 { |
162 { |
162 iShutdownTimer->SetDelay(TTimeIntervalMicroSeconds32( |
163 iShutdownTimer->SetDelay(TTimeIntervalMicroSeconds32( |
163 KShutDownDelayTime)); |
164 KTMSShutDownDelayTime)); |
164 } |
165 } |
165 |
166 |
166 TRACE_PRN_N1(_L("TMS->DNL: DropSession->Active Sessions: [%d]"), iSession); |
167 TRACE_PRN_N1(_L("TMS->DNL: DropSession->Active Sessions: [%d]"), iSession); |
167 } |
168 } |
168 |
169 |
169 // ----------------------------------------------------------------------------- |
170 // ----------------------------------------------------------------------------- |
170 // TMSServer::SessionCount |
171 // TMSServer::SessionCount |
171 // |
172 // |
172 // ----------------------------------------------------------------------------- |
173 // ----------------------------------------------------------------------------- |
173 // |
174 // |
174 TInt TMSServer::SessionCount() |
175 TInt TMSServer::SessionCount() const |
175 { |
176 { |
176 return iSession; |
177 return iSession; |
177 } |
178 } |
178 |
179 |
179 // ----------------------------------------------------------------------------- |
180 // ----------------------------------------------------------------------------- |
180 // TMSServer::SetDnLinkSession |
181 // TMSServer::SetDnLinkSession |
181 // |
182 // |
182 // ----------------------------------------------------------------------------- |
183 // ----------------------------------------------------------------------------- |
183 // |
184 // |
184 void TMSServer::SetDnLinkSession(TBool aSession) |
185 void TMSServer::SetDnLinkSession(const TBool aSession) |
185 { |
186 { |
186 iDnlinkSession = aSession; |
187 iDnlinkSession = aSession; |
187 } |
188 } |
188 |
189 |
189 // ----------------------------------------------------------------------------- |
190 // ----------------------------------------------------------------------------- |
190 // TMSServer::SetUpLinkSession |
191 // TMSServer::SetUpLinkSession |
191 // |
192 // |
192 // ----------------------------------------------------------------------------- |
193 // ----------------------------------------------------------------------------- |
193 // |
194 // |
194 void TMSServer::SetUpLinkSession(TBool aSession) |
195 void TMSServer::SetUpLinkSession(const TBool aSession) |
195 { |
196 { |
196 iUplinkSession = aSession; |
197 iUplinkSession = aSession; |
197 } |
198 } |
198 |
199 |
199 // ----------------------------------------------------------------------------- |
200 // ----------------------------------------------------------------------------- |
253 // ----------------------------------------------------------------------------- |
255 // ----------------------------------------------------------------------------- |
254 // |
256 // |
255 TInt TMSServer::StartTMSCallServer(TMSCallProxyLocal& aHandle) |
257 TInt TMSServer::StartTMSCallServer(TMSCallProxyLocal& aHandle) |
256 { |
258 { |
257 TRACE_PRN_FN_ENT; |
259 TRACE_PRN_FN_ENT; |
258 TInt status = KErrNone; |
260 |
259 |
261 TInt status = TMS_RESULT_SUCCESS; |
260 TMSStartAndMonitorTMSCallThread* callServerThread = NULL; |
262 TMSStartAndMonitorTMSCallThread* callServerThread = NULL; |
261 TRAP(status, callServerThread =TMSStartAndMonitorTMSCallThread::NewL( |
263 TRAP(status, callServerThread =TMSStartAndMonitorTMSCallThread::NewL( |
262 const_cast<TMSServer*>(this))); |
264 const_cast<TMSServer*>(this))); |
263 if (status != KErrNone) |
265 if (status != TMS_RESULT_SUCCESS) |
264 { |
266 { |
265 delete callServerThread; |
267 delete callServerThread; |
266 } |
268 } |
267 else |
269 else |
268 { |
270 { |
269 status = iTMSCallServList.Append(callServerThread); |
271 status = iTMSCallServList.Append(callServerThread); |
270 if (callServerThread && status == KErrNone) |
272 if (callServerThread && status == TMS_RESULT_SUCCESS) |
271 { |
273 { |
272 status = callServerThread->StartTMSCallServer(aHandle); |
274 status = callServerThread->StartTMSCallServer(aHandle); |
273 TInt count = 0; |
275 TInt count = 0; |
274 count = iTMSCallServList.Count(); |
276 count = iTMSCallServList.Count(); |
275 |
277 |
310 // |
312 // |
311 // ----------------------------------------------------------------------------- |
313 // ----------------------------------------------------------------------------- |
312 // |
314 // |
313 void TMSServer::StartRoutingNotifierL() |
315 void TMSServer::StartRoutingNotifierL() |
314 { |
316 { |
|
317 TRACE_PRN_FN_ENT; |
|
318 |
315 if (!iTarHandler) |
319 if (!iTarHandler) |
316 { |
320 { |
|
321 iTarHandlerCount = 0; |
317 iTarHandler = TMSTarEventHandler::NewL((const_cast<TMSServer*> (this))); |
322 iTarHandler = TMSTarEventHandler::NewL((const_cast<TMSServer*> (this))); |
318 } |
323 } |
|
324 iTarHandlerCount++; |
|
325 |
|
326 TRACE_PRN_FN_EXT; |
319 } |
327 } |
320 |
328 |
321 // ----------------------------------------------------------------------------- |
329 // ----------------------------------------------------------------------------- |
322 // TMSServer::CancelRoutingNotifier |
330 // TMSServer::CancelRoutingNotifier |
323 // |
331 // |
324 // ----------------------------------------------------------------------------- |
332 // ----------------------------------------------------------------------------- |
325 // |
333 // |
326 void TMSServer::CancelRoutingNotifier() |
334 void TMSServer::CancelRoutingNotifier() |
327 { |
335 { |
328 delete iTarHandler; |
336 if (--iTarHandlerCount <= 0) |
329 iTarHandler = NULL; |
337 { |
|
338 delete iTarHandler; |
|
339 iTarHandler = NULL; |
|
340 } |
330 } |
341 } |
331 |
342 |
332 // ----------------------------------------------------------------------------- |
343 // ----------------------------------------------------------------------------- |
333 // TMSServer::StartCenRepHandlerL |
344 // TMSServer::StartCenRepHandlerL |
334 // |
345 // |
335 // ----------------------------------------------------------------------------- |
346 // ----------------------------------------------------------------------------- |
336 // |
347 // |
337 void TMSServer::StartCenRepHandlerL() |
348 void TMSServer::StartCenRepHandlerL() |
338 { |
349 { |
|
350 TRACE_PRN_FN_ENT; |
|
351 |
339 #ifdef _USE_TELEPHONY_CENREP_ |
352 #ifdef _USE_TELEPHONY_CENREP_ |
340 if (!iAudioCenRepHandler) |
353 if (!iAudioCenRepHandler) |
341 { |
354 { |
342 iAudioCenRepHandler = CSPAudioHandler::NewL( |
355 iAudioCenRepHandlerCount = 0; |
|
356 iAudioCenRepHandler = TMSCenRepAudioHandler::NewL( |
343 (const_cast<TMSServer*> (this))); |
357 (const_cast<TMSServer*> (this))); |
344 } |
358 } |
|
359 iAudioCenRepHandlerCount++; |
345 #endif |
360 #endif |
|
361 |
|
362 TRACE_PRN_FN_EXT; |
346 } |
363 } |
347 |
364 |
348 // ----------------------------------------------------------------------------- |
365 // ----------------------------------------------------------------------------- |
349 // TMSServer::CancelCenRepHandler |
366 // TMSServer::CancelCenRepHandler |
350 // |
367 // |
351 // ----------------------------------------------------------------------------- |
368 // ----------------------------------------------------------------------------- |
352 // |
369 // |
353 void TMSServer::CancelCenRepHandler() |
370 void TMSServer::CancelCenRepHandler() |
354 { |
371 { |
355 delete iAudioCenRepHandler; |
372 if (--iAudioCenRepHandlerCount <= 0) |
356 iAudioCenRepHandler = NULL; |
373 { |
|
374 delete iAudioCenRepHandler; |
|
375 iAudioCenRepHandler = NULL; |
|
376 } |
357 } |
377 } |
358 |
378 |
359 // ----------------------------------------------------------------------------- |
379 // ----------------------------------------------------------------------------- |
360 // TMSServer::SetOutput |
380 // TMSServer::SetOutput |
361 // |
381 // |
362 // ----------------------------------------------------------------------------- |
382 // ----------------------------------------------------------------------------- |
363 // |
383 // |
364 TInt TMSServer::SetOutput(CSession2* /*sid*/, TInt output) |
384 TInt TMSServer::SetOutput(CSession2* /*sid*/, TInt output) |
365 { |
385 { |
366 TRACE_PRN_FN_ENT; |
386 TRACE_PRN_FN_ENT; |
367 TInt status(KErrNone); |
387 |
368 |
388 TInt status = SendMessageToCallServ(TMS_ROUTING_OUTPUT_SET, output); |
369 status = SendMessageToCallServ(TMS_ROUTING_OUTPUT_SET, output); |
389 if (status == TMS_RESULT_SUCCESS) |
370 |
|
371 if (status == KErrNone) |
|
372 { |
390 { |
373 iCurrentRouting = output; |
391 iCurrentRouting = output; |
374 } |
392 } |
375 |
393 |
376 TRACE_PRN_FN_EXT; |
394 TRACE_PRN_FN_EXT; |
386 { |
404 { |
387 TRACE_PRN_FN_ENT; |
405 TRACE_PRN_FN_ENT; |
388 |
406 |
389 TUint output; |
407 TUint output; |
390 TInt i = 0; |
408 TInt i = 0; |
391 TInt status(KErrNone); |
409 TInt status(TMS_RESULT_SUCCESS); |
392 while (i < iTMSCallServList.Count()) |
410 while (i < iTMSCallServList.Count()) |
393 { |
411 { |
394 TMSStartAndMonitorTMSCallThread* callThread = iTMSCallServList[i]; |
412 TMSStartAndMonitorTMSCallThread* callThread = iTMSCallServList[i]; |
395 |
413 |
396 if (callThread) |
414 if (callThread) |
397 { |
415 { |
398 status = callThread->iTMSCallProxyLocal.ReceiveFromCallServer( |
416 status = callThread->iTMSCallProxyLocal.ReceiveFromCallServer( |
399 TMS_ROUTING_OUTPUT_GET, output); |
417 TMS_ROUTING_OUTPUT_GET, output); |
400 if (status != KErrNone) |
418 if (status != TMS_RESULT_SUCCESS) |
401 { |
419 { |
402 break; |
420 break; |
403 } |
421 } |
404 } |
422 } |
405 i++; |
423 i++; |
406 } |
424 } |
407 TPckgBuf<TInt> p(output); |
425 TPckgBuf<TInt> p(output); |
408 aMessage.Write(0, p); |
426 aMessage.Write(0, p); |
409 aMessage.Complete(KErrNone); |
427 aMessage.Complete(TMS_RESULT_SUCCESS); |
410 TRACE_PRN_FN_EXT; |
428 |
411 return KErrNone; |
429 TRACE_PRN_FN_EXT; |
|
430 return status; |
412 } |
431 } |
413 |
432 |
414 // ----------------------------------------------------------------------------- |
433 // ----------------------------------------------------------------------------- |
415 // TMSServer::GetPreviousOutput |
434 // TMSServer::GetPreviousOutput |
416 // |
435 // |
417 // ----------------------------------------------------------------------------- |
436 // ----------------------------------------------------------------------------- |
418 // |
437 // |
419 TInt TMSServer::GetPreviousOutput(const RMessage2& aMessage) |
438 TInt TMSServer::GetPreviousOutput(const RMessage2& aMessage) |
420 { |
439 { |
421 TRACE_PRN_FN_ENT; |
440 TRACE_PRN_FN_ENT; |
|
441 |
422 TUint output; |
442 TUint output; |
423 TInt i = 0; |
443 TInt i = 0; |
424 TInt status(KErrNone); |
444 TInt status(TMS_RESULT_SUCCESS); |
425 while (i < iTMSCallServList.Count()) |
445 while (i < iTMSCallServList.Count()) |
426 { |
446 { |
427 TMSStartAndMonitorTMSCallThread* callThread = iTMSCallServList[i]; |
447 TMSStartAndMonitorTMSCallThread* callThread = iTMSCallServList[i]; |
428 |
448 |
429 if (callThread) |
449 if (callThread) |
430 { |
450 { |
431 status = callThread->iTMSCallProxyLocal.ReceiveFromCallServer( |
451 status = callThread->iTMSCallProxyLocal.ReceiveFromCallServer( |
432 TMS_ROUTING_PREVIOUSOUTPUT_GET, output); |
452 TMS_ROUTING_PREVIOUSOUTPUT_GET, output); |
433 if (status != KErrNone) |
453 if (status != TMS_RESULT_SUCCESS) |
434 { |
454 { |
435 break; |
455 break; |
436 } |
456 } |
437 } |
457 } |
438 i++; |
458 i++; |
439 } |
459 } |
440 TPckgBuf<TInt> p(output); |
460 TPckgBuf<TInt> p(output); |
441 aMessage.Write(0, p); |
461 aMessage.Write(0, p); |
442 aMessage.Complete(KErrNone); |
462 aMessage.Complete(TMS_RESULT_SUCCESS); |
|
463 |
443 TRACE_PRN_FN_EXT; |
464 TRACE_PRN_FN_EXT; |
444 return status; |
465 return status; |
445 } |
466 } |
446 |
467 |
447 // ----------------------------------------------------------------------------- |
468 // ----------------------------------------------------------------------------- |
506 // ----------------------------------------------------------------------------- |
527 // ----------------------------------------------------------------------------- |
507 // |
528 // |
508 TInt TMSServer::GetMaxLevel(const RMessage2& aMessage) |
529 TInt TMSServer::GetMaxLevel(const RMessage2& aMessage) |
509 { |
530 { |
510 TRACE_PRN_FN_ENT; |
531 TRACE_PRN_FN_ENT; |
511 TInt status(KErrNone); |
532 |
|
533 TInt status(TMS_RESULT_SUCCESS); |
512 TPckgBuf<TUint> pckg; |
534 TPckgBuf<TUint> pckg; |
513 |
535 |
514 pckg() = iEffectSettings->MaxVolume(); |
536 pckg() = iEffectSettings->MaxVolume(); |
515 if (status == KErrNone) |
537 if (status == TMS_RESULT_SUCCESS) |
516 { |
538 { |
517 status = aMessage.Write(0, pckg); |
539 status = aMessage.Write(0, pckg); |
518 aMessage.Complete(status); |
540 aMessage.Complete(status); |
519 } |
541 } |
|
542 |
520 TRACE_PRN_FN_EXT; |
543 TRACE_PRN_FN_EXT; |
521 return status; |
544 return status; |
522 } |
545 } |
523 |
546 |
524 // ----------------------------------------------------------------------------- |
547 // ----------------------------------------------------------------------------- |
561 // ----------------------------------------------------------------------------- |
585 // ----------------------------------------------------------------------------- |
562 // |
586 // |
563 TInt TMSServer::SetLevel(CSession2* /*sid*/, TBool tmsclient, TInt level) |
587 TInt TMSServer::SetLevel(CSession2* /*sid*/, TBool tmsclient, TInt level) |
564 { |
588 { |
565 TRACE_PRN_FN_ENT; |
589 TRACE_PRN_FN_ENT; |
566 TInt status(KErrNone); |
590 |
567 |
591 TInt status = SendMessageToCallServ(TMS_EFFECT_GLOBAL_VOL_SET, level); |
568 status = SendMessageToCallServ(TMS_EFFECT_GLOBAL_VOL_SET, level); |
592 if (status == TMS_RESULT_SUCCESS) |
569 |
|
570 if (status == KErrNone) |
|
571 { |
593 { |
572 switch (iCurrentRouting) |
594 switch (iCurrentRouting) |
573 { |
595 { |
574 case TMS_AUDIO_OUTPUT_PUBLIC: |
596 case TMS_AUDIO_OUTPUT_PUBLIC: |
575 case TMS_AUDIO_OUTPUT_LOUDSPEAKER: |
597 case TMS_AUDIO_OUTPUT_LOUDSPEAKER: |
622 // ----------------------------------------------------------------------------- |
644 // ----------------------------------------------------------------------------- |
623 // |
645 // |
624 TInt TMSServer::GetMaxGain(const RMessage2& aMessage) |
646 TInt TMSServer::GetMaxGain(const RMessage2& aMessage) |
625 { |
647 { |
626 TRACE_PRN_FN_ENT; |
648 TRACE_PRN_FN_ENT; |
627 TInt status(KErrNone); |
649 |
|
650 TInt status(TMS_RESULT_SUCCESS); |
628 TPckgBuf<TUint> pckg; |
651 TPckgBuf<TUint> pckg; |
629 |
|
630 pckg() = iEffectSettings->MaxGain(); |
652 pckg() = iEffectSettings->MaxGain(); |
631 if (status == KErrNone) |
653 if (status == TMS_RESULT_SUCCESS) |
632 { |
654 { |
633 status = aMessage.Write(0, pckg); |
655 status = aMessage.Write(0, pckg); |
634 aMessage.Complete(status); |
656 aMessage.Complete(status); |
635 } |
657 } |
636 |
658 |
644 // ----------------------------------------------------------------------------- |
666 // ----------------------------------------------------------------------------- |
645 // |
667 // |
646 TInt TMSServer::GetGain(const RMessage2& aMessage) |
668 TInt TMSServer::GetGain(const RMessage2& aMessage) |
647 { |
669 { |
648 TRACE_PRN_FN_ENT; |
670 TRACE_PRN_FN_ENT; |
649 TInt status(KErrNone); |
671 |
|
672 TInt status(TMS_RESULT_SUCCESS); |
650 TPckgBuf<TUint> pckg; |
673 TPckgBuf<TUint> pckg; |
651 |
|
652 pckg() = iEffectSettings->Gain(); |
674 pckg() = iEffectSettings->Gain(); |
653 if (status == KErrNone) |
675 if (status == TMS_RESULT_SUCCESS) |
654 { |
676 { |
655 status = aMessage.Write(0, pckg); |
677 status = aMessage.Write(0, pckg); |
656 aMessage.Complete(status); |
678 aMessage.Complete(status); |
657 } |
679 } |
658 |
680 |
666 // ----------------------------------------------------------------------------- |
688 // ----------------------------------------------------------------------------- |
667 // |
689 // |
668 TInt TMSServer::SetGain(CSession2* /*sid*/, TInt level) |
690 TInt TMSServer::SetGain(CSession2* /*sid*/, TInt level) |
669 { |
691 { |
670 TRACE_PRN_FN_ENT; |
692 TRACE_PRN_FN_ENT; |
671 TInt status(KErrNone); |
693 |
672 |
694 TInt status = SendMessageToCallServ(TMS_EFFECT_GLOBAL_GAIN_SET, level); |
673 status = SendMessageToCallServ(TMS_EFFECT_GLOBAL_GAIN_SET, level); |
695 if (status == TMS_RESULT_SUCCESS) |
674 |
|
675 if (status == KErrNone) |
|
676 { |
696 { |
677 iEffectSettings->SetGain(level); |
697 iEffectSettings->SetGain(level); |
678 iSessionIter.SetToFirst(); |
698 iSessionIter.SetToFirst(); |
679 |
699 |
680 TMSServerSession* serverSession = |
700 TMSServerSession* serverSession = |
698 // ----------------------------------------------------------------------------- |
718 // ----------------------------------------------------------------------------- |
699 // |
719 // |
700 TInt TMSServer::GetSupportedCodecs(const TMSStreamType strmType, |
720 TInt TMSServer::GetSupportedCodecs(const TMSStreamType strmType, |
701 RArray<TFourCC>*& aCodecs) |
721 RArray<TFourCC>*& aCodecs) |
702 { |
722 { |
|
723 TRACE_PRN_FN_ENT; |
|
724 |
703 if (strmType == TMS_STREAM_UPLINK) |
725 if (strmType == TMS_STREAM_UPLINK) |
704 { |
726 { |
705 aCodecs = &iUplCodecs; |
727 aCodecs = &iUplCodecs; |
706 } |
728 } |
707 else if (strmType == TMS_STREAM_DOWNLINK) |
729 else if (strmType == TMS_STREAM_DOWNLINK) |
708 { |
730 { |
709 aCodecs = &iDnlCodecs; |
731 aCodecs = &iDnlCodecs; |
710 } |
732 } |
711 return KErrNone; |
733 |
|
734 TRACE_PRN_FN_EXT; |
|
735 return TMS_RESULT_SUCCESS; |
712 } |
736 } |
713 |
737 |
714 // ----------------------------------------------------------------------------- |
738 // ----------------------------------------------------------------------------- |
715 // TMSServer::SendMessageToCallServ |
739 // TMSServer::SendMessageToCallServ |
716 // |
740 // |
717 // ----------------------------------------------------------------------------- |
741 // ----------------------------------------------------------------------------- |
718 // |
742 // |
719 TInt TMSServer::SendMessageToCallServ(TInt func, TInt value) |
743 TInt TMSServer::SendMessageToCallServ(TInt func, TInt value) |
720 { |
744 { |
721 TInt status(KErrNone); |
745 TRACE_PRN_FN_ENT; |
|
746 |
|
747 TInt status(TMS_RESULT_SUCCESS); |
722 TInt i = 0; |
748 TInt i = 0; |
723 while (i < iTMSCallServList.Count()) |
749 while (i < iTMSCallServList.Count()) |
724 { |
750 { |
725 TMSStartAndMonitorTMSCallThread* callThread = iTMSCallServList[i]; |
751 TMSStartAndMonitorTMSCallThread* callThread = iTMSCallServList[i]; |
726 |
752 |
733 } |
759 } |
734 else |
760 else |
735 { |
761 { |
736 status = callThread->iTMSCallProxyLocal.SendToCallServer( |
762 status = callThread->iTMSCallProxyLocal.SendToCallServer( |
737 func, value); |
763 func, value); |
738 if (status != KErrNone) |
764 if (status != TMS_RESULT_SUCCESS) |
739 { |
765 { |
740 break; |
766 break; |
741 } |
767 } |
742 } |
768 } |
743 } |
769 } |
744 i++; |
770 i++; |
745 } |
771 } |
|
772 |
|
773 TRACE_PRN_FN_EXT; |
746 return status; |
774 return status; |
747 } |
775 } |
748 |
776 |
749 // ----------------------------------------------------------------------------- |
777 // ----------------------------------------------------------------------------- |
750 // TMSServer::SendMessageToCallServ |
778 // TMSServer::SendMessageToCallServ |
751 // |
779 // |
752 // ----------------------------------------------------------------------------- |
780 // ----------------------------------------------------------------------------- |
753 // |
781 // |
754 TInt TMSServer::SendMessageToCallServ(TInt func, TIpcArgs args) |
782 TInt TMSServer::SendMessageToCallServ(TInt func, TIpcArgs args) |
755 { |
783 { |
756 TInt status(KErrNone); |
784 TRACE_PRN_FN_ENT; |
|
785 |
|
786 TInt status(TMS_RESULT_SUCCESS); |
757 TInt i = 0; |
787 TInt i = 0; |
758 while (i < iTMSCallServList.Count()) |
788 while (i < iTMSCallServList.Count()) |
759 { |
789 { |
760 TMSStartAndMonitorTMSCallThread* callThread = iTMSCallServList[i]; |
790 TMSStartAndMonitorTMSCallThread* callThread = iTMSCallServList[i]; |
761 |
791 |
768 } |
798 } |
769 else |
799 else |
770 { |
800 { |
771 status = callThread->iTMSCallProxyLocal.SendToCallServer( |
801 status = callThread->iTMSCallProxyLocal.SendToCallServer( |
772 func, args); |
802 func, args); |
773 if (status != KErrNone) |
803 if (status != TMS_RESULT_SUCCESS) |
774 { |
804 { |
775 break; |
805 break; |
776 } |
806 } |
777 } |
807 } |
778 } |
808 } |
779 i++; |
809 i++; |
780 } |
810 } |
|
811 |
|
812 TRACE_PRN_FN_EXT; |
781 return status; |
813 return status; |
782 } |
814 } |
783 |
815 |
784 // ----------------------------------------------------------------------------- |
816 // ----------------------------------------------------------------------------- |
785 // TMSServer::NotifyTarClients |
817 // TMSServer::NotifyTarClients |
786 // |
818 // |
787 // ----------------------------------------------------------------------------- |
819 // ----------------------------------------------------------------------------- |
788 // |
820 // |
789 TInt TMSServer::NotifyTarClients(TRoutingMsgBufPckg routingpckg) |
821 TInt TMSServer::NotifyTarClients(TRoutingMsgBufPckg routingpckg) |
790 { |
822 { |
|
823 TRACE_PRN_FN_ENT; |
|
824 |
791 iCurrentRouting = routingpckg().iOutput; |
825 iCurrentRouting = routingpckg().iOutput; |
792 iSessionIter.SetToFirst(); |
826 iSessionIter.SetToFirst(); |
793 TMSServerSession* serverSession = |
827 TMSServerSession* serverSession = |
794 static_cast<TMSServerSession*> (iSessionIter++); |
828 static_cast<TMSServerSession*> (iSessionIter++); |
795 |
829 |
796 while (serverSession != NULL) |
830 while (serverSession != NULL) |
797 { |
831 { |
798 serverSession->HandleRoutingChange(routingpckg); |
832 serverSession->HandleRoutingChange(routingpckg); |
799 serverSession = static_cast<TMSServerSession*> (iSessionIter++); |
833 serverSession = static_cast<TMSServerSession*> (iSessionIter++); |
800 } |
834 } |
801 return KErrNone; |
835 |
|
836 TRACE_PRN_FN_EXT; |
|
837 return TMS_RESULT_SUCCESS; |
802 } |
838 } |
803 |
839 |
804 // ----------------------------------------------------------------------------- |
840 // ----------------------------------------------------------------------------- |
805 // RunServerL |
841 // RunServerL |
806 // |
842 // |
896 TInt TMSStartAndMonitorTMSCallThread::StartTMSCallServer( |
934 TInt TMSStartAndMonitorTMSCallThread::StartTMSCallServer( |
897 TMSCallProxyLocal& aHndl) |
935 TMSCallProxyLocal& aHndl) |
898 { |
936 { |
899 TRACE_PRN_FN_ENT; |
937 TRACE_PRN_FN_ENT; |
900 |
938 |
901 TInt status(KErrNone); |
939 TInt status(TMS_RESULT_SUCCESS); |
902 TMSCallServerStartParam start(iTMSServer, iCallSrvrHndl); |
940 TMSCallServerStartParam start(iTMSServer, iCallSrvrHndl); |
903 const TUidType serverUid(KNullUid, KNullUid, KUidTMSCallServerUid3); |
941 const TUidType serverUid(KNullUid, KNullUid, KUidTMSCallServerUid3); |
904 TThreadFunction serverFunc = TMSCallServer::StartThread; |
942 TThreadFunction serverFunc = TMSCallServer::StartThread; |
905 |
943 |
906 status = iServerThread.Create(_L(""), |
944 status = iServerThread.Create(_L(""), |
933 iServerThread.Resume(); |
971 iServerThread.Resume(); |
934 // Server will call the reciprocal static synchronise call |
972 // Server will call the reciprocal static synchronise call |
935 } |
973 } |
936 |
974 |
937 User::WaitForRequest(reqStatus); // wait for start or death |
975 User::WaitForRequest(reqStatus); // wait for start or death |
938 if (reqStatus.Int() != KErrNone) |
976 if (reqStatus.Int() != TMS_RESULT_SUCCESS) |
939 { |
977 { |
940 iServerThread.Close(); |
978 iServerThread.Close(); |
941 iCallSrvrHndl.Close(); |
979 iCallSrvrHndl.Close(); |
942 return reqStatus.Int(); |
980 return reqStatus.Int(); |
943 } |
981 } |
944 status = aHndl.Open(iCallSrvrHndl); |
982 status = aHndl.Open(iCallSrvrHndl); |
945 |
983 |
946 if (status != KErrNone) |
984 if (status != TMS_RESULT_SUCCESS) |
947 { |
985 { |
948 iServerThread.Close(); |
986 iServerThread.Close(); |
949 iCallSrvrHndl.Close(); |
987 iCallSrvrHndl.Close(); |
950 return status; |
988 return status; |
951 } |
989 } |
993 // Perhaps we need to move this to a .cpp? |
1031 // Perhaps we need to move this to a .cpp? |
994 // ----------------------------------------------------------------------------- |
1032 // ----------------------------------------------------------------------------- |
995 TInt TMSCallProxyLocal::Open(RServer2& aTMSCallServerHandle) |
1033 TInt TMSCallProxyLocal::Open(RServer2& aTMSCallServerHandle) |
996 { |
1034 { |
997 TRACE_PRN_FN_ENT; |
1035 TRACE_PRN_FN_ENT; |
|
1036 |
998 TInt status(KErrNotSupported); |
1037 TInt status(KErrNotSupported); |
999 status = CreateSession(aTMSCallServerHandle, |
1038 status = CreateSession(aTMSCallServerHandle, |
1000 TVersion(KTMSCallServerMajorVersionNumber, |
1039 TVersion(KTMSCallServerMajorVersionNumber, |
1001 KTMSCallServerMinorVersionNumber, |
1040 KTMSCallServerMinorVersionNumber, |
1002 KTMSCallServerBuildVersionNumber), |
1041 KTMSCallServerBuildVersionNumber), |
1035 // |
1074 // |
1036 // ----------------------------------------------------------------------------- |
1075 // ----------------------------------------------------------------------------- |
1037 // |
1076 // |
1038 TInt TMSCallProxyLocal::ReceiveFromCallServer(TInt aFunc, TUint& value) |
1077 TInt TMSCallProxyLocal::ReceiveFromCallServer(TInt aFunc, TUint& value) |
1039 { |
1078 { |
1040 TInt status(KErrNone); |
1079 TInt status(TMS_RESULT_SUCCESS); |
1041 TPckgBuf<TUint> pckg; |
1080 TPckgBuf<TUint> pckg; |
1042 TIpcArgs args(&pckg); |
1081 TIpcArgs args(&pckg); |
1043 status = SendReceive(aFunc, args); |
1082 status = SendReceive(aFunc, args); |
1044 if (status == KErrNone) |
1083 if (status == TMS_RESULT_SUCCESS) |
1045 { |
1084 { |
1046 value = pckg(); |
1085 value = pckg(); |
1047 } |
1086 } |
1048 return status; |
1087 return status; |
1049 } |
1088 } |