24 #include "e32debug.h" |
24 #include "e32debug.h" |
25 |
25 |
26 #define SYMBIAN_DEBPRN0(str) RDebug::Print(str, this) |
26 #define SYMBIAN_DEBPRN0(str) RDebug::Print(str, this) |
27 #define SYMBIAN_DEBPRN1(str, val1) RDebug::Print(str, this, val1) |
27 #define SYMBIAN_DEBPRN1(str, val1) RDebug::Print(str, this, val1) |
28 #define SYMBIAN_DEBPRN2(str, val1, val2) RDebug::Print(str, this, val1, val2) |
28 #define SYMBIAN_DEBPRN2(str, val1, val2) RDebug::Print(str, this, val1, val2) |
|
29 #define SYMBIAN_DEBPRN3(str, val1, val2, val3) RDebug::Print(str, this, val1, val2, val3) |
29 #else |
30 #else |
30 #define SYMBIAN_DEBPRN0(str) |
31 #define SYMBIAN_DEBPRN0(str) |
31 #define SYMBIAN_DEBPRN1(str, val1) |
32 #define SYMBIAN_DEBPRN1(str, val1) |
32 #define SYMBIAN_DEBPRN2(str, val1, val2) |
33 #define SYMBIAN_DEBPRN2(str, val1, val2) |
|
34 #define SYMBIAN_DEBPRN3(str, val1, val2, val3) |
33 #endif //_DEBUG |
35 #endif //_DEBUG |
34 |
36 |
35 //Assume that we can have two user request and one callback request |
37 const TInt KMaxQueueRequest = 6; |
36 //at the same time (maximum). |
|
37 const TInt KMaxQueueRequest = 3; |
|
38 |
38 |
39 // MEMBER FUNCTIONS |
39 // MEMBER FUNCTIONS |
40 |
40 |
41 TMMFDevSoundRequest::TMMFDevSoundRequest() |
41 TMMFDevSoundRequest::TMMFDevSoundRequest() |
42 : iMessageCompleted(EFalse), |
42 : iMessageCompleted(EFalse), |
220 server.IncrementSessionId(); |
220 server.IncrementSessionId(); |
221 iDevSoundSessionId = server.DevSoundSessionId(); |
221 iDevSoundSessionId = server.DevSoundSessionId(); |
222 } |
222 } |
223 |
223 |
224 // |
224 // |
|
225 // NeedToQueue - mid-commit cycle or async queue start AO is active |
|
226 // |
|
227 TBool CMMFDevSoundSession::NeedToQueue() const |
|
228 { |
|
229 return iOperationCompletePending || iAsyncQueueStart->IsActive(); |
|
230 } |
|
231 |
|
232 // |
225 // CMMFDevSoundSession::ServiceL |
233 // CMMFDevSoundSession::ServiceL |
226 // (other items were commented in a header). |
234 // (other items were commented in a header). |
227 // |
235 // |
228 void CMMFDevSoundSession::ServiceL(const RMmfIpcMessage& aMessage) |
236 void CMMFDevSoundSession::ServiceL(const RMmfIpcMessage& aMessage) |
229 { |
237 { |
230 SYMBIAN_DEBPRN2(_L("\nCMMFDevSoundSession[0x%x] NEW REQUEST %02x while pending=%d"), |
238 SYMBIAN_DEBPRN2(_L("\nCMMFDevSoundSession[0x%x] NEW REQUEST %02x while pending=%d"), |
231 aMessage.Function(), iOperationCompletePending || iAsyncQueueStart->IsActive()); |
239 aMessage.Function(), NeedToQueue()); |
232 |
240 |
233 if( iOperationCompletePending || iAsyncQueueStart->IsActive()) |
241 if(NeedToQueue()) |
234 { |
242 { |
235 // if not possible to service now, then queue request |
243 // if not possible to service now, then queue request |
236 EnqueueRequest(aMessage); |
244 EnqueueRequest(aMessage); |
237 } |
245 } |
238 else |
246 else |
255 // CMMFDevSoundSession::DoServiceL |
263 // CMMFDevSoundSession::DoServiceL |
256 // (other items were commented in a header). |
264 // (other items were commented in a header). |
257 // |
265 // |
258 void CMMFDevSoundSession::DoServiceRequestL(const RMmfIpcMessage& aMessage) |
266 void CMMFDevSoundSession::DoServiceRequestL(const RMmfIpcMessage& aMessage) |
259 { |
267 { |
|
268 iRequestBeingServiced.SetMessage(aMessage); |
260 iAsyncQueueStart->Cancel(); // just in case. |
269 iAsyncQueueStart->Cancel(); // just in case. |
261 TMMFMessageDestinationPckg destinationPckg; |
270 ResetNotifiedError(); |
|
271 |
|
272 TMMFMessageDestinationPckg destinationPckg; |
262 MmfMessageUtil::ReadL(aMessage, 0, destinationPckg); |
273 MmfMessageUtil::ReadL(aMessage, 0, destinationPckg); |
263 SYMBIAN_DEBPRN2(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - DestinationHandle [%d] InterfaceId [%d] "), destinationPckg().DestinationHandle(), destinationPckg().InterfaceId()); |
274 SYMBIAN_DEBPRN2(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - DestinationHandle [%d] InterfaceId [%d] "), destinationPckg().DestinationHandle(), destinationPckg().InterfaceId()); |
264 if ((destinationPckg().DestinationHandle() == KMMFObjectHandleDevSound) && |
275 if ((destinationPckg().DestinationHandle() == KMMFObjectHandleDevSound) && |
265 (destinationPckg().InterfaceId() == KUidInterfaceMMFDevSound)) |
276 (destinationPckg().InterfaceId() == KUidInterfaceMMFDevSound)) |
266 { |
277 { |
438 if (complete) |
449 if (complete) |
439 { |
450 { |
440 // Complete the message |
451 // Complete the message |
441 // Synchronous requests & Pseudo-asynchronous |
452 // Synchronous requests & Pseudo-asynchronous |
442 aMessage.Complete(KErrNone); |
453 aMessage.Complete(KErrNone); |
443 } |
454 |
444 // Note: There are operations that not complete the message using the following flag |
455 // Store function if we need to re-apply it again due to pre-emption clash |
445 // So if the message is not completed, cannot be assumed that there is an operation pending |
456 if(iRequestBeingServiced.Type() == TMMFDevSoundRequest::EAction_PseudoAsynchronous) |
446 |
457 { |
447 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - iOperationCompletePending [%d]"), iOperationCompletePending); |
458 iRedoFunction = aMessage.Function(); |
448 if(iOperationCompletePending) |
459 } |
449 { |
460 } |
450 // Keep a copy of the message for Asynchronous requests & Pseudo-asynchronous |
461 } |
451 iRequestBeingServiced.SetMessage(aMessage); |
462 else if (aMessage.Function() == RMessage2::EDisConnect) |
452 } |
463 { |
453 } |
464 TBool complete = iAdapter->CloseDevSound(); |
|
465 if(!complete) |
|
466 { |
|
467 iRequestBeingServiced.SetMessage(aMessage); |
|
468 iOperationCompletePending = ETrue; |
|
469 ResetNotifiedError(); |
|
470 } |
|
471 else |
|
472 { |
|
473 // if we get here, iClosing wait will have been started and we'd be waiting |
|
474 iClosingWait->AsyncStop(); |
|
475 } |
|
476 } |
454 else |
477 else |
455 { |
478 { |
456 // If there's a CI extension, see if that handles this request |
479 // If there's a CI extension, see if that handles this request |
457 TInt err = KErrNotSupported; |
480 TInt err = KErrNotSupported; |
458 if (iCIExtension) |
481 if (iCIExtension) |
465 { |
488 { |
466 err = err2; |
489 err = err2; |
467 } |
490 } |
468 iOperationCompletePending = EFalse; |
491 iOperationCompletePending = EFalse; |
469 iHandlingExtdCI = EFalse; |
492 iHandlingExtdCI = EFalse; |
|
493 SYMBIAN_DEBPRN2(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - CIExtensionRequest[%d] - Exit with Error[%d] "), aMessage.Function(),err); |
470 } |
494 } |
471 |
495 |
472 if (err != KErrNone) |
496 if (err != KErrNone) |
473 { |
497 { |
474 // Not been handled, the request is not supported |
498 // Not been handled, the request is not supported |
475 aMessage.Complete(KErrNotSupported); |
499 aMessage.Complete(KErrNotSupported); |
476 } |
500 } |
477 } |
501 } |
478 } |
502 } |
479 |
503 |
|
504 void CMMFDevSoundSession::DoServiceAlreadyCompletedRequestL(const TInt aFunction) |
|
505 { |
|
506 ResetNotifiedError(); |
|
507 |
|
508 switch(aFunction) |
|
509 { |
|
510 case EMMFDevSoundProxyInitialize1: |
|
511 DoAlreadyCompletedInitialize1L(); |
|
512 break; |
|
513 case EMMFDevSoundProxyInitialize2: |
|
514 DoAlreadyCompletedInitialize2L(); |
|
515 break; |
|
516 case EMMFDevSoundProxyInitialize4: |
|
517 DoAlreadyCompletedInitialize4L(); |
|
518 break; |
|
519 case EMMFDevSoundProxyPlayInit: |
|
520 DoAlreadyCompletedPlayInitL(); |
|
521 break; |
|
522 case EMMFDevSoundProxyRecordInit: |
|
523 DoAlreadyCompletedRecordInitL(); |
|
524 break; |
|
525 case EMMFDevSoundProxyPlayTone: |
|
526 DoAlreadyCompletedPlayToneL(); |
|
527 break; |
|
528 case EMMFDevSoundProxyPlayDualTone: |
|
529 DoAlreadyCompletedPlayDualToneL(); |
|
530 break; |
|
531 case EMMFDevSoundProxyPlayDTMFString: |
|
532 DoAlreadyCompletedPlayDTMFStringL(); |
|
533 break; |
|
534 case EMMFDevSoundProxyPlayToneSequence: |
|
535 DoAlreadyCompletedPlayToneSequenceL(); |
|
536 break; |
|
537 case EMMFDevSoundProxyPlayFixedSequence: |
|
538 DoAlreadyCompletedPlayFixedSequenceL(); |
|
539 break; |
|
540 default: |
|
541 User::Leave(KErrNotSupported); |
|
542 break; |
|
543 } |
|
544 |
|
545 } |
|
546 |
|
547 void CMMFDevSoundSession::HandleAlreadyCompletedRequest() |
|
548 { |
|
549 TRAPD(err,DoServiceAlreadyCompletedRequestL(iRedoFunction)); |
|
550 |
|
551 if (err != KErrNone) |
|
552 { |
|
553 switch(iRedoFunction) |
|
554 { |
|
555 case EMMFDevSoundProxyInitialize1: |
|
556 case EMMFDevSoundProxyInitialize2: |
|
557 case EMMFDevSoundProxyInitialize4: |
|
558 InitializeComplete(err); |
|
559 break; |
|
560 case EMMFDevSoundProxyPlayInit: |
|
561 PlayError(err); |
|
562 break; |
|
563 case EMMFDevSoundProxyRecordInit: |
|
564 RecordError(err); |
|
565 break; |
|
566 case EMMFDevSoundProxyPlayTone: |
|
567 case EMMFDevSoundProxyPlayDualTone: |
|
568 case EMMFDevSoundProxyPlayDTMFString: |
|
569 case EMMFDevSoundProxyPlayToneSequence: |
|
570 case EMMFDevSoundProxyPlayFixedSequence: |
|
571 ToneFinished(err); |
|
572 break; |
|
573 default: |
|
574 break; |
|
575 } |
|
576 } |
|
577 } |
480 |
578 |
481 void CMMFDevSoundSession::EnqueueRequest(const RMmfIpcMessage& aMessage) |
579 void CMMFDevSoundSession::EnqueueRequest(const RMmfIpcMessage& aMessage) |
482 { |
580 { |
483 // Encapsule the request |
581 // Encapsule the request |
484 TMMFDevSoundRequest request; |
582 TMMFDevSoundRequest request; |
508 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
606 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
509 User::LeaveIfError(err); |
607 User::LeaveIfError(err); |
510 DoSetClientConfigL();// added here instead of the CreateL() |
608 DoSetClientConfigL();// added here instead of the CreateL() |
511 TMMFDevSoundProxySettingsPckg devSoundBuf; |
609 TMMFDevSoundProxySettingsPckg devSoundBuf; |
512 MmfMessageUtil::ReadL(aMessage,1,devSoundBuf); |
610 MmfMessageUtil::ReadL(aMessage,1,devSoundBuf); |
|
611 iCachedClientData = devSoundBuf; |
513 TMMFState mode = devSoundBuf().iMode; |
612 TMMFState mode = devSoundBuf().iMode; |
514 iAdapter->InitializeL(mode); |
613 iAdapter->InitializeL(mode); |
515 iBufferPlay = NULL; |
614 iBufferPlay = NULL; |
516 iPlayErrorOccured = EFalse; |
615 iPlayErrorOccured = EFalse; |
517 // Flag to queue any further request |
616 // Flag to queue any further request |
519 iOperationCompletePending = ETrue; |
618 iOperationCompletePending = ETrue; |
520 return ETrue; |
619 return ETrue; |
521 } |
620 } |
522 |
621 |
523 // |
622 // |
|
623 // CMMFDevSoundSession::DoAlreadyCompletedInitialize1L |
|
624 // (other items were commented in a header). |
|
625 // |
|
626 void CMMFDevSoundSession::DoAlreadyCompletedInitialize1L() |
|
627 { |
|
628 TMMFState mode = iCachedClientData().iMode; |
|
629 iAdapter->InitializeL(mode); |
|
630 iBufferPlay = NULL; |
|
631 iPlayErrorOccured = EFalse; |
|
632 // Flag to queue any further request |
|
633 iOperationCompletePending = ETrue; |
|
634 } |
|
635 |
|
636 // |
524 // CMMFDevSoundSession::DoInitialize2L |
637 // CMMFDevSoundSession::DoInitialize2L |
525 // (other items were commented in a header). |
638 // (other items were commented in a header). |
526 // |
639 // |
527 TBool CMMFDevSoundSession::DoInitialize2L(const RMmfIpcMessage& aMessage) |
640 TBool CMMFDevSoundSession::DoInitialize2L(const RMmfIpcMessage& aMessage) |
528 { |
641 { |
530 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
643 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
531 User::LeaveIfError(err); |
644 User::LeaveIfError(err); |
532 DoSetClientConfigL();// added here instead of the CreateL() |
645 DoSetClientConfigL();// added here instead of the CreateL() |
533 TMMFDevSoundProxySettingsPckg devSoundBuf; |
646 TMMFDevSoundProxySettingsPckg devSoundBuf; |
534 MmfMessageUtil::ReadL(aMessage,1,devSoundBuf); |
647 MmfMessageUtil::ReadL(aMessage,1,devSoundBuf); |
|
648 iCachedClientData = devSoundBuf; |
535 TUid HWDev = devSoundBuf().iHWDev; |
649 TUid HWDev = devSoundBuf().iHWDev; |
536 TMMFState mode = devSoundBuf().iMode; |
650 TMMFState mode = devSoundBuf().iMode; |
537 iAdapter->InitializeL(HWDev, mode); |
651 iAdapter->InitializeL(HWDev, mode); |
538 iBufferPlay = NULL; |
652 iBufferPlay = NULL; |
539 iPlayErrorOccured = EFalse; |
653 iPlayErrorOccured = EFalse; |
540 return ETrue; |
654 return ETrue; |
|
655 } |
|
656 |
|
657 // |
|
658 // CMMFDevSoundSession::DoAlreadyCompletedInitialize2L |
|
659 // (other items were commented in a header). |
|
660 // |
|
661 void CMMFDevSoundSession::DoAlreadyCompletedInitialize2L() |
|
662 { |
|
663 TUid HWDev = iCachedClientData().iHWDev; |
|
664 TMMFState mode = iCachedClientData().iMode; |
|
665 iAdapter->InitializeL(HWDev, mode); |
|
666 iBufferPlay = NULL; |
|
667 iPlayErrorOccured = EFalse; |
541 } |
668 } |
542 |
669 |
543 // |
670 // |
544 // CMMFDevSoundSession::DoInitialize4L |
671 // CMMFDevSoundSession::DoInitialize4L |
545 // (other items were commented in a header). |
672 // (other items were commented in a header). |
550 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
677 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
551 User::LeaveIfError(err); |
678 User::LeaveIfError(err); |
552 DoSetClientConfigL();// added here instead of the CreateL() |
679 DoSetClientConfigL();// added here instead of the CreateL() |
553 TMMFDevSoundProxySettingsPckg devSoundBuf; |
680 TMMFDevSoundProxySettingsPckg devSoundBuf; |
554 aMessage.ReadL(TInt(1),devSoundBuf); |
681 aMessage.ReadL(TInt(1),devSoundBuf); |
|
682 iCachedClientData = devSoundBuf; |
555 TFourCC desiredFourCC = devSoundBuf().iDesiredFourCC; |
683 TFourCC desiredFourCC = devSoundBuf().iDesiredFourCC; |
556 TMMFState mode = devSoundBuf().iMode; |
684 TMMFState mode = devSoundBuf().iMode; |
557 iAdapter->InitializeL(desiredFourCC, mode); |
685 iAdapter->InitializeL(desiredFourCC, mode); |
558 iBufferPlay = NULL; |
686 iBufferPlay = NULL; |
559 iPlayErrorOccured = EFalse; |
687 iPlayErrorOccured = EFalse; |
562 iOperationCompletePending = ETrue; |
690 iOperationCompletePending = ETrue; |
563 return ETrue; |
691 return ETrue; |
564 } |
692 } |
565 |
693 |
566 // |
694 // |
|
695 // CMMFDevSoundSession::DoAlreadyCompletedInitialize4L |
|
696 // (other items were commented in a header). |
|
697 // |
|
698 void CMMFDevSoundSession::DoAlreadyCompletedInitialize4L() |
|
699 { |
|
700 TFourCC desiredFourCC = iCachedClientData().iDesiredFourCC; |
|
701 TMMFState mode = iCachedClientData().iMode; |
|
702 iAdapter->InitializeL(desiredFourCC, mode); |
|
703 iBufferPlay = NULL; |
|
704 iPlayErrorOccured = EFalse; |
|
705 // Flag to queue any further request |
|
706 iOperationCompletePending = ETrue; |
|
707 } |
|
708 |
|
709 // |
567 // CMMFDevSoundSession::DoCancelInitialize |
710 // CMMFDevSoundSession::DoCancelInitialize |
568 // (other items were commented in a header). |
711 // (other items were commented in a header). |
569 // |
712 // |
570 TBool CMMFDevSoundSession::DoCancelInitializeL(const RMmfIpcMessage& aMessage) |
713 TBool CMMFDevSoundSession::DoCancelInitializeL(const RMmfIpcMessage& aMessage) |
571 { |
714 { |
780 iOperationCompletePending = ETrue; |
923 iOperationCompletePending = ETrue; |
781 return ETrue; |
924 return ETrue; |
782 } |
925 } |
783 |
926 |
784 // |
927 // |
|
928 // CMMFDevSoundSession::DoAlreadyCompletedPlayInitL |
|
929 // (other items were commented in a header). |
|
930 // |
|
931 void CMMFDevSoundSession::DoAlreadyCompletedPlayInitL() |
|
932 { |
|
933 iAdapter->PlayInitL(); |
|
934 iOperationCompletePending = ETrue; |
|
935 } |
|
936 |
|
937 // |
785 // CMMFDevSoundSession::DoRecordInitL |
938 // CMMFDevSoundSession::DoRecordInitL |
786 // (other items were commented in a header). |
939 // (other items were commented in a header). |
787 // |
940 // |
788 TBool CMMFDevSoundSession::DoRecordInitL(const RMmfIpcMessage& /*aMessage*/) |
941 TBool CMMFDevSoundSession::DoRecordInitL(const RMmfIpcMessage& /*aMessage*/) |
789 { |
942 { |
790 iAdapter->RecordInitL(); |
943 iAdapter->RecordInitL(); |
791 iOperationCompletePending = ETrue; |
944 iOperationCompletePending = ETrue; |
792 return ETrue; |
945 return ETrue; |
|
946 } |
|
947 |
|
948 // |
|
949 // CMMFDevSoundSession::DoAlreadyCompletedRecordInitL |
|
950 // (other items were commented in a header). |
|
951 // |
|
952 void CMMFDevSoundSession::DoAlreadyCompletedRecordInitL() |
|
953 { |
|
954 iAdapter->RecordInitL(); |
|
955 iOperationCompletePending = ETrue; |
793 } |
956 } |
794 |
957 |
795 // |
958 // |
796 // CMMFDevSoundSession::DoPlayDataL |
959 // CMMFDevSoundSession::DoPlayDataL |
797 // (other items were commented in a header). |
960 // (other items were commented in a header). |
866 TBool CMMFDevSoundSession::DoPlayToneL(const RMmfIpcMessage& aMessage) |
1029 TBool CMMFDevSoundSession::DoPlayToneL(const RMmfIpcMessage& aMessage) |
867 { |
1030 { |
868 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayToneL - Enter")); |
1031 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayToneL - Enter")); |
869 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1032 TMMFDevSoundProxySettingsPckg devSoundBuf; |
870 aMessage.ReadL(TInt(1),devSoundBuf); |
1033 aMessage.ReadL(TInt(1),devSoundBuf); |
|
1034 iCachedClientData = devSoundBuf; |
871 TInt frequency = devSoundBuf().iFrequencyOne; |
1035 TInt frequency = devSoundBuf().iFrequencyOne; |
872 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
1036 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
873 iAdapter->PlayToneL(frequency, duration); |
1037 iAdapter->PlayToneL(frequency, duration); |
874 iOperationCompletePending = ETrue; |
1038 iOperationCompletePending = ETrue; |
875 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayToneL - Exit. Return value is [%d]"), ETrue); |
1039 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayToneL - Exit. Return value is [%d]"), ETrue); |
876 return ETrue; |
1040 return ETrue; |
877 } |
1041 } |
878 |
1042 |
879 // |
1043 // |
|
1044 // CMMFDevSoundSession::DoAlreadyCompletedPlayToneL |
|
1045 // (other items were commented in a header). |
|
1046 // |
|
1047 void CMMFDevSoundSession::DoAlreadyCompletedPlayToneL() |
|
1048 { |
|
1049 TInt frequency = iCachedClientData().iFrequencyOne; |
|
1050 TTimeIntervalMicroSeconds duration(iCachedClientData().iDuration); |
|
1051 iAdapter->PlayToneL(frequency, duration); |
|
1052 iOperationCompletePending = ETrue; |
|
1053 } |
|
1054 |
|
1055 // |
880 // CMMFDevSoundSession::DoPlayDualToneL |
1056 // CMMFDevSoundSession::DoPlayDualToneL |
881 // (other items were commented in a header). |
1057 // (other items were commented in a header). |
882 // |
1058 // |
883 TBool CMMFDevSoundSession::DoPlayDualToneL(const RMmfIpcMessage& aMessage) |
1059 TBool CMMFDevSoundSession::DoPlayDualToneL(const RMmfIpcMessage& aMessage) |
884 { |
1060 { |
885 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDualToneL - Enter")); |
1061 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDualToneL - Enter")); |
886 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1062 TMMFDevSoundProxySettingsPckg devSoundBuf; |
887 aMessage.ReadL(TInt(1),devSoundBuf); |
1063 aMessage.ReadL(TInt(1),devSoundBuf); |
|
1064 iCachedClientData = devSoundBuf; |
888 TInt frequencyOne = devSoundBuf().iFrequencyOne; |
1065 TInt frequencyOne = devSoundBuf().iFrequencyOne; |
889 TInt frequencyTwo = devSoundBuf().iFrequencyTwo; |
1066 TInt frequencyTwo = devSoundBuf().iFrequencyTwo; |
890 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
1067 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
891 iAdapter->PlayDualToneL(frequencyOne, frequencyTwo, duration); |
1068 iAdapter->PlayDualToneL(frequencyOne, frequencyTwo, duration); |
892 iOperationCompletePending = ETrue; |
1069 iOperationCompletePending = ETrue; |
893 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayDualToneL - Exit. Return value is [%d]"), ETrue); |
1070 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayDualToneL - Exit. Return value is [%d]"), ETrue); |
894 return ETrue; |
1071 return ETrue; |
895 } |
1072 } |
896 |
1073 |
897 // |
1074 // |
|
1075 // CMMFDevSoundSession::DoAlreadyCompletedPlayDualToneL |
|
1076 // (other items were commented in a header). |
|
1077 // |
|
1078 void CMMFDevSoundSession::DoAlreadyCompletedPlayDualToneL() |
|
1079 { |
|
1080 TInt frequencyOne = iCachedClientData().iFrequencyOne; |
|
1081 TInt frequencyTwo = iCachedClientData().iFrequencyTwo; |
|
1082 TTimeIntervalMicroSeconds duration(iCachedClientData().iDuration); |
|
1083 iAdapter->PlayDualToneL(frequencyOne, frequencyTwo, duration); |
|
1084 iOperationCompletePending = ETrue; |
|
1085 } |
|
1086 |
|
1087 // |
898 // CMMFDevSoundSession::DoPlayDTMFStringL |
1088 // CMMFDevSoundSession::DoPlayDTMFStringL |
899 // (other items were commented in a header). |
1089 // (other items were commented in a header). |
900 // |
1090 // |
901 TBool CMMFDevSoundSession::DoPlayDTMFStringL(const RMmfIpcMessage& aMessage) |
1091 TBool CMMFDevSoundSession::DoPlayDTMFStringL(const RMmfIpcMessage& aMessage) |
902 { |
1092 { |
940 |
1140 |
941 iAdapter->PlayToneSequenceL(*iToneSeqBuf); |
1141 iAdapter->PlayToneSequenceL(*iToneSeqBuf); |
942 iOperationCompletePending = ETrue; |
1142 iOperationCompletePending = ETrue; |
943 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayToneSequenceL - Exit. Return value is [%d]"), ETrue); |
1143 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayToneSequenceL - Exit. Return value is [%d]"), ETrue); |
944 return ETrue; |
1144 return ETrue; |
|
1145 } |
|
1146 |
|
1147 // |
|
1148 // CMMFDevSoundSession::DoAlreadyCompletedPlayToneSequenceL |
|
1149 // (other items were commented in a header). |
|
1150 // |
|
1151 void CMMFDevSoundSession::DoAlreadyCompletedPlayToneSequenceL() |
|
1152 { |
|
1153 iAdapter->PlayToneSequenceL(*iToneSeqBuf); |
|
1154 iOperationCompletePending = ETrue; |
945 } |
1155 } |
946 |
1156 |
947 // |
1157 // |
948 // CMMFDevSoundSession::DoPlayFixedSequenceL |
1158 // CMMFDevSoundSession::DoPlayFixedSequenceL |
949 // (other items were commented in a header). |
1159 // (other items were commented in a header). |
952 { |
1162 { |
953 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Enter")); |
1163 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Enter")); |
954 TPckgBuf<TInt> buf; |
1164 TPckgBuf<TInt> buf; |
955 aMessage.ReadL(TInt(1),buf); |
1165 aMessage.ReadL(TInt(1),buf); |
956 TInt seqNum = buf(); |
1166 TInt seqNum = buf(); |
957 |
1167 iSeqNum = seqNum; |
958 iAdapter->PlayFixedSequenceL(seqNum); |
1168 iAdapter->PlayFixedSequenceL(seqNum); |
959 iOperationCompletePending = ETrue; |
1169 iOperationCompletePending = ETrue; |
960 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Exit. Return value is [%d]"), ETrue); |
1170 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Exit. Return value is [%d]"), ETrue); |
961 return ETrue; |
1171 return ETrue; |
|
1172 } |
|
1173 |
|
1174 // |
|
1175 // CMMFDevSoundSession::DoAlreadyCompletedPlayFixedSequenceL |
|
1176 // (other items were commented in a header). |
|
1177 // |
|
1178 void CMMFDevSoundSession::DoAlreadyCompletedPlayFixedSequenceL() |
|
1179 { |
|
1180 iAdapter->PlayFixedSequenceL(iSeqNum); |
|
1181 iOperationCompletePending = ETrue; |
962 } |
1182 } |
963 |
1183 |
964 // |
1184 // |
965 // CMMFDevSoundSession::DoSetDTMFLengthsL |
1185 // CMMFDevSoundSession::DoSetDTMFLengthsL |
966 // (other items were commented in a header). |
1186 // (other items were commented in a header). |
988 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1208 TMMFDevSoundProxySettingsPckg devSoundBuf; |
989 aMessage.ReadL(TInt(1),devSoundBuf); |
1209 aMessage.ReadL(TInt(1),devSoundBuf); |
990 TTimeIntervalMicroSeconds duration = devSoundBuf().iDuration; |
1210 TTimeIntervalMicroSeconds duration = devSoundBuf().iDuration; |
991 User::LeaveIfError(iAdapter->SetVolumeRamp(duration)); |
1211 User::LeaveIfError(iAdapter->SetVolumeRamp(duration)); |
992 iOperationCompletePending = EFalse; // Volume ramp doesn't result on commit |
1212 iOperationCompletePending = EFalse; // Volume ramp doesn't result on commit |
993 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Exit")); |
1213 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Exit. Return value is [%d]"), ETrue); |
994 return ETrue; // operation complete |
1214 return ETrue; // operation complete |
995 } |
1215 } |
996 |
1216 |
997 // |
1217 // |
998 // CMMFDevSoundSession::DoGetSupportedInputDataTypesL |
1218 // CMMFDevSoundSession::DoGetSupportedInputDataTypesL |
1073 aMessage.ReadL(TInt(1),countRepeat); |
1293 aMessage.ReadL(TInt(1),countRepeat); |
1074 |
1294 |
1075 TPckgBuf<TTimeIntervalMicroSeconds> repeatTS; |
1295 TPckgBuf<TTimeIntervalMicroSeconds> repeatTS; |
1076 aMessage.ReadL(TInt(2),repeatTS); |
1296 aMessage.ReadL(TInt(2),repeatTS); |
1077 User::LeaveIfError(iAdapter->SetToneRepeats(countRepeat(), repeatTS())); |
1297 User::LeaveIfError(iAdapter->SetToneRepeats(countRepeat(), repeatTS())); |
1078 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Exit")); |
1298 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Exit. Return value is [%d]"), ETrue); |
1079 return ETrue; |
1299 return ETrue; |
1080 } |
1300 } |
1081 |
1301 |
1082 // |
1302 // |
1083 // CMMFDevSoundSession::DoSetPrioritySettingsL |
1303 // CMMFDevSoundSession::DoSetPrioritySettingsL |
1418 // (other items were commented in a header). |
1638 // (other items were commented in a header). |
1419 // |
1639 // |
1420 void CMMFDevSoundSession::Disconnect(const RMessage2& aMessage) |
1640 void CMMFDevSoundSession::Disconnect(const RMessage2& aMessage) |
1421 { |
1641 { |
1422 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Enter")); |
1642 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Enter")); |
1423 TBool complete = iAdapter->CloseDevSound(); |
1643 if (NeedToQueue()) |
1424 if(!complete) |
1644 { |
1425 { |
1645 // if we are in the middle of something, enqueue and wait |
1426 iRequestBeingServiced.SetMessage(aMessage); |
1646 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Add to queue")); |
1427 iOperationCompletePending = ETrue; |
1647 EnqueueRequest(aMessage); |
1428 iClosingWait->Start(); |
1648 iClosingWait->Start(); |
1429 } |
1649 } |
|
1650 else |
|
1651 { |
|
1652 // else do now. Enter ActiveSchedulerWait to wait for AsyncOpComplete |
|
1653 TBool complete = iAdapter->CloseDevSound(); |
|
1654 if(!complete) |
|
1655 { |
|
1656 iRequestBeingServiced.SetMessage(aMessage); |
|
1657 iOperationCompletePending = ETrue; |
|
1658 ResetNotifiedError(); |
|
1659 iClosingWait->Start(); |
|
1660 } |
|
1661 } |
1430 CSession2::Disconnect(aMessage); |
1662 CSession2::Disconnect(aMessage); |
1431 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Exit")); |
1663 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Exit")); |
1432 } |
1664 } |
1433 |
1665 |
1434 |
1666 |
1681 // CMMFDevSoundSession::CallbackFromAdaptorReceived |
1913 // CMMFDevSoundSession::CallbackFromAdaptorReceived |
1682 // (other items were commented in a header). |
1914 // (other items were commented in a header). |
1683 // |
1915 // |
1684 void CMMFDevSoundSession::CallbackFromAdaptorReceived(TInt aType, TInt aError) |
1916 void CMMFDevSoundSession::CallbackFromAdaptorReceived(TInt aType, TInt aError) |
1685 { |
1917 { |
1686 SYMBIAN_DEBPRN2(_L("CMMFDevSoundSession[0x%x]::CallbackFromAdaptorReceived - Enter. Type [%d ]Error [%d]"), aType, aError); |
1918 SYMBIAN_DEBPRN2(_L("CMMFDevSoundSession[0x%x]::CallbackFromAdaptorReceived - Enter. Type[%d] Error[%d]"), aType, aError); |
1687 if(aType == KCallbackRecordPauseComplete) |
1919 if(aType == KCallbackRecordPauseComplete) |
1688 { |
1920 { |
1689 TMMFDevSoundQueueItem item; |
1921 TMMFDevSoundQueueItem item; |
1690 item.iRequest = EMMFDevSoundProxyPausedRecordCompleteEvent; |
1922 item.iRequest = EMMFDevSoundProxyPausedRecordCompleteEvent; |
1691 item.iErrorCode = KErrNone; |
1923 item.iErrorCode = KErrNone; |
1700 //coverity[uninit_use_in_call] |
1932 //coverity[uninit_use_in_call] |
1701 // Disabled Coverity warning, since it complains about iReserved1 member in TMMFEvent being uninitialised |
1933 // Disabled Coverity warning, since it complains about iReserved1 member in TMMFEvent being uninitialised |
1702 } |
1934 } |
1703 else if (aType == KCallbackFlushComplete) |
1935 else if (aType == KCallbackFlushComplete) |
1704 { |
1936 { |
1705 iRequestBeingServiced.Complete(aError); |
1937 if(!iHandlingExtdCI && iRequestBeingServiced.Function()==EMMFDevSoundProxyEmptyBuffers) |
1706 iOperationCompletePending = EFalse; |
1938 { |
|
1939 //If we come here then it is due to a EMMFDevSoundProxyEmptyBuffers request from client. |
|
1940 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::CallbackFromAdaptorReceived - Calling TMMFDevSoundRequest::Complete on iRequestBeingServiced")); |
|
1941 iRequestBeingServiced.Complete(aError); |
|
1942 iOperationCompletePending = EFalse; |
|
1943 } |
1707 } |
1944 } |
1708 else |
1945 else |
1709 { |
1946 { |
1710 if( iOperationCompletePending ) |
1947 if( NeedToQueue() ) |
1711 { |
1948 { |
1712 // If not possible to service now, then queue request |
1949 // If not possible to service now, then queue request |
1713 // Encapsule the request |
1950 // Encapsule the request |
1714 TMMFDevSoundRequest request(aType); |
1951 TMMFDevSoundRequest request(aType); |
1715 // assumes sufficient space in the queue so ignores the return value |
1952 // assumes sufficient space in the queue so ignores the return value |
1764 } |
2001 } |
1765 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::PreemptionFinishedCallbackReceived - Exit")); |
2002 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::PreemptionFinishedCallbackReceived - Exit")); |
1766 } |
2003 } |
1767 |
2004 |
1768 // |
2005 // |
|
2006 // CMMFDevSoundSession::PreemptionClash |
|
2007 // (other items were commented in a header). |
|
2008 // |
|
2009 void CMMFDevSoundSession::PreemptionClash() |
|
2010 { |
|
2011 //assumes sufficient space in the queue so ignore the return value |
|
2012 iQueuedRequests.Insert(iRequestBeingServiced, 0); |
|
2013 iPreemptionClash=ETrue; |
|
2014 } |
|
2015 |
|
2016 // |
|
2017 // CMMFDevSoundSession::PreemptionClashWithStateChange |
|
2018 // (other items were commented in a header). |
|
2019 // |
|
2020 void CMMFDevSoundSession::PreemptionClashWithStateChange() |
|
2021 { |
|
2022 #ifdef _DEBUG |
|
2023 TMMFDevSoundRequest msg = iQueuedRequests[0]; |
|
2024 // message being removed should be the one we previously pushed via PreemptionClash() |
|
2025 __ASSERT_DEBUG(iRequestBeingServiced==msg, Panic(ERequestBeingServicedMismatch)); |
|
2026 #endif |
|
2027 // remove without processing request with AsynchronousOperationComplete() completing the message |
|
2028 iQueuedRequests.Remove(0); |
|
2029 iPreemptionClash=EFalse; |
|
2030 } |
|
2031 |
|
2032 // |
1769 // CMMFDevSoundSession::AdaptorControlsContext() |
2033 // CMMFDevSoundSession::AdaptorControlsContext() |
1770 // |
2034 // |
1771 |
2035 |
1772 TBool CMMFDevSoundSession::AdaptorControlsContext() const |
2036 TBool CMMFDevSoundSession::AdaptorControlsContext() const |
1773 { |
2037 { |
1809 |
2073 |
1810 void CMMFDevSoundSession::AsynchronousOperationComplete(TInt aError, TBool aCanStartNewOperation) |
2074 void CMMFDevSoundSession::AsynchronousOperationComplete(TInt aError, TBool aCanStartNewOperation) |
1811 { |
2075 { |
1812 __ASSERT_DEBUG(!iHandlingExtdCI, Panic(EUnexpectedAsyncOpCompleteHandlingCI)); |
2076 __ASSERT_DEBUG(!iHandlingExtdCI, Panic(EUnexpectedAsyncOpCompleteHandlingCI)); |
1813 // when handling CIs we should not reach here |
2077 // when handling CIs we should not reach here |
|
2078 |
|
2079 TInt error = aError; |
|
2080 if (!error) |
|
2081 { |
|
2082 // if have no error payload, use notified error. It will be KErrNone if not set, so just use. |
|
2083 error = NotifiedError(); |
|
2084 } |
1814 |
2085 |
1815 switch (iRequestBeingServiced.Type()) |
2086 switch (iRequestBeingServiced.Type()) |
1816 { |
2087 { |
1817 case TMMFDevSoundRequest::ESessionEvents: |
2088 case TMMFDevSoundRequest::ESessionEvents: |
1818 { |
2089 { |
1937 void CMMFDevSoundSession::AsyncQueueStartCallback() |
2218 void CMMFDevSoundSession::AsyncQueueStartCallback() |
1938 { |
2219 { |
1939 SYMBIAN_DEBPRN0(_L("\n CMMFDevSoundSession[0x%x]======== Service a queued request\n")); |
2220 SYMBIAN_DEBPRN0(_L("\n CMMFDevSoundSession[0x%x]======== Service a queued request\n")); |
1940 TMMFDevSoundRequest msg = iQueuedRequests[0]; |
2221 TMMFDevSoundRequest msg = iQueuedRequests[0]; |
1941 iQueuedRequests.Remove(0); |
2222 iQueuedRequests.Remove(0); |
1942 TRAPD(err,DoServiceRequestL(msg.Message())); |
2223 TInt err = KErrNone; |
1943 if(err != KErrNone) |
2224 TBool doRequest = ETrue; |
1944 { |
2225 if(iPreemptionClash) |
1945 msg.Complete(err); |
2226 { |
1946 } |
2227 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::AsyncQueueStartCallback - Re-applying client request due to Pre-emption clash")); |
|
2228 iPreemptionClash=EFalse; // clear flag before reading next request in queue |
|
2229 iAdapter->RollbackAdaptorActiveStateToBeforeCommit(); |
|
2230 if ((iRequestBeingServiced.Type() == TMMFDevSoundRequest::EAction_PseudoAsynchronous)) |
|
2231 { |
|
2232 doRequest = EFalse; |
|
2233 HandleAlreadyCompletedRequest(); |
|
2234 } |
|
2235 } |
|
2236 |
|
2237 if (doRequest) |
|
2238 { |
|
2239 TRAP(err,DoServiceRequestL(msg.Message())); |
|
2240 if(err != KErrNone) |
|
2241 { |
|
2242 msg.Complete(err); |
|
2243 } |
|
2244 } |
|
2245 |
1947 if (!iOperationCompletePending && iQueuedRequests.Count() != 0) |
2246 if (!iOperationCompletePending && iQueuedRequests.Count() != 0) |
1948 { |
2247 { |
1949 //dequeue next |
2248 //dequeue next |
1950 DequeueRequest(); |
2249 DequeueRequest(); |
1951 } |
2250 } |
1970 // |
2269 // |
1971 // CMMFDevSoundSession::DoProcessingFinished() |
2270 // CMMFDevSoundSession::DoProcessingFinished() |
1972 // |
2271 // |
1973 void CMMFDevSoundSession::DoProcessingFinished() |
2272 void CMMFDevSoundSession::DoProcessingFinished() |
1974 { |
2273 { |
|
2274 ResetNotifiedError(); |
|
2275 |
1975 TBool asyncOperation = EFalse; |
2276 TBool asyncOperation = EFalse; |
1976 //ProcessingFinished should never fail |
2277 //ProcessingFinished should never fail |
1977 __ASSERT_ALWAYS(KErrNone, iAdapter->ProcessingFinishedReceived(asyncOperation)); |
2278 __ASSERT_ALWAYS(KErrNone, iAdapter->ProcessingFinishedReceived(asyncOperation)); |
1978 iOperationCompletePending = asyncOperation; |
2279 iOperationCompletePending = asyncOperation; |
1979 if (iOperationCompletePending) |
2280 if (iOperationCompletePending) |
1985 // |
2286 // |
1986 // CMMFDevSoundSession::DoProcessingError() |
2287 // CMMFDevSoundSession::DoProcessingError() |
1987 // |
2288 // |
1988 void CMMFDevSoundSession::DoProcessingError() |
2289 void CMMFDevSoundSession::DoProcessingError() |
1989 { |
2290 { |
|
2291 ResetNotifiedError(); |
|
2292 |
1990 TBool asyncOperation = EFalse; |
2293 TBool asyncOperation = EFalse; |
1991 //ProcessingFinished should never fail |
2294 //ProcessingFinished should never fail |
1992 __ASSERT_ALWAYS(KErrNone, iAdapter->ProcessingError(asyncOperation)); |
2295 __ASSERT_ALWAYS(KErrNone, iAdapter->ProcessingError(asyncOperation)); |
1993 iOperationCompletePending = asyncOperation; |
2296 iOperationCompletePending = asyncOperation; |
1994 if (iOperationCompletePending) |
2297 if (iOperationCompletePending) |
2325 void CMMFDevSoundSession::BufferErrorEvent() |
2628 void CMMFDevSoundSession::BufferErrorEvent() |
2326 { |
2629 { |
2327 // this will generate an processing error event and callback |
2630 // this will generate an processing error event and callback |
2328 iAdapter->BufferErrorEvent(); |
2631 iAdapter->BufferErrorEvent(); |
2329 } |
2632 } |
|
2633 |
|
2634 void CMMFDevSoundSession::ResetNotifiedError() |
|
2635 // called at beginning of commit cycle, so any error will be from callbacks |
|
2636 { |
|
2637 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::ResetNotifiedError")); |
|
2638 iNotifiedError = KErrNone; |
|
2639 } |
|
2640 |
|
2641 TInt CMMFDevSoundSession::NotifiedError() const |
|
2642 // NotifiedError property |
|
2643 { |
|
2644 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::NotifiedError(%d)"), iNotifiedError); |
|
2645 return iNotifiedError; |
|
2646 } |
|
2647 |
|
2648 void CMMFDevSoundSession::NotifyError(TInt aError) |
|
2649 // cache notified error |
|
2650 { |
|
2651 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::NotifyError(%d)"), aError); |
|
2652 iNotifiedError = aError; |
|
2653 } |
|
2654 |
2330 // End of file |
2655 // End of file |