227 // |
227 // |
228 void CMMFDevSoundSession::ServiceL(const RMmfIpcMessage& aMessage) |
228 void CMMFDevSoundSession::ServiceL(const RMmfIpcMessage& aMessage) |
229 { |
229 { |
230 SYMBIAN_DEBPRN2(_L("\nCMMFDevSoundSession[0x%x] NEW REQUEST %02x while pending=%d"), |
230 SYMBIAN_DEBPRN2(_L("\nCMMFDevSoundSession[0x%x] NEW REQUEST %02x while pending=%d"), |
231 aMessage.Function(), iOperationCompletePending || iAsyncQueueStart->IsActive()); |
231 aMessage.Function(), iOperationCompletePending || iAsyncQueueStart->IsActive()); |
|
232 |
232 if( iOperationCompletePending || iAsyncQueueStart->IsActive()) |
233 if( iOperationCompletePending || iAsyncQueueStart->IsActive()) |
233 { |
234 { |
234 // if not possible to service now, then queue request |
235 // if not possible to service now, then queue request |
235 EnqueueRequest(aMessage); |
236 EnqueueRequest(aMessage); |
236 } |
237 } |
257 void CMMFDevSoundSession::DoServiceRequestL(const RMmfIpcMessage& aMessage) |
258 void CMMFDevSoundSession::DoServiceRequestL(const RMmfIpcMessage& aMessage) |
258 { |
259 { |
259 iAsyncQueueStart->Cancel(); // just in case. |
260 iAsyncQueueStart->Cancel(); // just in case. |
260 TMMFMessageDestinationPckg destinationPckg; |
261 TMMFMessageDestinationPckg destinationPckg; |
261 MmfMessageUtil::ReadL(aMessage, 0, destinationPckg); |
262 MmfMessageUtil::ReadL(aMessage, 0, destinationPckg); |
|
263 SYMBIAN_DEBPRN2(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - DestinationHandle [%d] InterfaceId [%d] "), destinationPckg().DestinationHandle(), destinationPckg().InterfaceId()); |
262 if ((destinationPckg().DestinationHandle() == KMMFObjectHandleDevSound) && |
264 if ((destinationPckg().DestinationHandle() == KMMFObjectHandleDevSound) && |
263 (destinationPckg().InterfaceId() == KUidInterfaceMMFDevSound)) |
265 (destinationPckg().InterfaceId() == KUidInterfaceMMFDevSound)) |
264 { |
266 { |
|
267 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - Request [%d]"), aMessage.Function()); |
265 TBool complete = EFalse; |
268 TBool complete = EFalse; |
266 switch(aMessage.Function()) |
269 switch(aMessage.Function()) |
267 { |
270 { |
268 case EMMFDevSoundProxyPostOpen: |
271 case EMMFDevSoundProxyPostOpen: |
269 complete = DoPostOpenL(aMessage); |
272 complete = DoPostOpenL(aMessage); |
439 aMessage.Complete(KErrNone); |
442 aMessage.Complete(KErrNone); |
440 } |
443 } |
441 // Note: There are operations that not complete the message using the following flag |
444 // Note: There are operations that not complete the message using the following flag |
442 // So if the message is not completed, cannot be assumed that there is an operation pending |
445 // So if the message is not completed, cannot be assumed that there is an operation pending |
443 |
446 |
|
447 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - iOperationCompletePending [%d]"), iOperationCompletePending); |
444 if(iOperationCompletePending) |
448 if(iOperationCompletePending) |
445 { |
449 { |
446 // Keep a copy of the message for Asynchronous requests & Pseudo-asynchronous |
450 // Keep a copy of the message for Asynchronous requests & Pseudo-asynchronous |
447 iRequestBeingServiced.SetMessage(aMessage); |
451 iRequestBeingServiced.SetMessage(aMessage); |
448 } |
452 } |
497 // CMMFDevSoundSession::DoInitialize1L |
502 // CMMFDevSoundSession::DoInitialize1L |
498 // (other items were commented in a header). |
503 // (other items were commented in a header). |
499 // |
504 // |
500 TBool CMMFDevSoundSession::DoInitialize1L(const RMmfIpcMessage& aMessage) |
505 TBool CMMFDevSoundSession::DoInitialize1L(const RMmfIpcMessage& aMessage) |
501 { |
506 { |
502 TInt err = iMsgQueue.Open(aMessage, 2); // a global queue. |
507 iMsgQueue.Close(); // close if already open |
|
508 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
503 User::LeaveIfError(err); |
509 User::LeaveIfError(err); |
504 DoSetClientConfigL();// added here instead of the CreateL() |
510 DoSetClientConfigL();// added here instead of the CreateL() |
505 TMMFDevSoundProxySettingsPckg devSoundBuf; |
511 TMMFDevSoundProxySettingsPckg devSoundBuf; |
506 MmfMessageUtil::ReadL(aMessage,1,devSoundBuf); |
512 MmfMessageUtil::ReadL(aMessage,1,devSoundBuf); |
507 TMMFState mode = devSoundBuf().iMode; |
513 TMMFState mode = devSoundBuf().iMode; |
518 // CMMFDevSoundSession::DoInitialize2L |
524 // CMMFDevSoundSession::DoInitialize2L |
519 // (other items were commented in a header). |
525 // (other items were commented in a header). |
520 // |
526 // |
521 TBool CMMFDevSoundSession::DoInitialize2L(const RMmfIpcMessage& aMessage) |
527 TBool CMMFDevSoundSession::DoInitialize2L(const RMmfIpcMessage& aMessage) |
522 { |
528 { |
523 TInt err = iMsgQueue.Open(aMessage, 2); // a global queue. |
529 iMsgQueue.Close(); // close if already open |
|
530 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
524 User::LeaveIfError(err); |
531 User::LeaveIfError(err); |
525 DoSetClientConfigL();// added here instead of the CreateL() |
532 DoSetClientConfigL();// added here instead of the CreateL() |
526 TMMFDevSoundProxySettingsPckg devSoundBuf; |
533 TMMFDevSoundProxySettingsPckg devSoundBuf; |
527 MmfMessageUtil::ReadL(aMessage,1,devSoundBuf); |
534 MmfMessageUtil::ReadL(aMessage,1,devSoundBuf); |
528 TUid HWDev = devSoundBuf().iHWDev; |
535 TUid HWDev = devSoundBuf().iHWDev; |
537 // CMMFDevSoundSession::DoInitialize4L |
544 // CMMFDevSoundSession::DoInitialize4L |
538 // (other items were commented in a header). |
545 // (other items were commented in a header). |
539 // |
546 // |
540 TBool CMMFDevSoundSession::DoInitialize4L(const RMmfIpcMessage& aMessage) |
547 TBool CMMFDevSoundSession::DoInitialize4L(const RMmfIpcMessage& aMessage) |
541 { |
548 { |
542 TInt err = iMsgQueue.Open(aMessage, 2); // a global queue. |
549 iMsgQueue.Close(); |
|
550 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
543 User::LeaveIfError(err); |
551 User::LeaveIfError(err); |
544 DoSetClientConfigL();// added here instead of the CreateL() |
552 DoSetClientConfigL();// added here instead of the CreateL() |
545 TMMFDevSoundProxySettingsPckg devSoundBuf; |
553 TMMFDevSoundProxySettingsPckg devSoundBuf; |
546 aMessage.ReadL(TInt(1),devSoundBuf); |
554 aMessage.ReadL(TInt(1),devSoundBuf); |
547 TFourCC desiredFourCC = devSoundBuf().iDesiredFourCC; |
555 TFourCC desiredFourCC = devSoundBuf().iDesiredFourCC; |
824 // CMMFDevSoundSession::DoStopL |
832 // CMMFDevSoundSession::DoStopL |
825 // (other items were commented in a header). |
833 // (other items were commented in a header). |
826 // |
834 // |
827 TBool CMMFDevSoundSession::DoStopL(const RMmfIpcMessage& /*aMessage*/) |
835 TBool CMMFDevSoundSession::DoStopL(const RMmfIpcMessage& /*aMessage*/) |
828 { |
836 { |
829 // Sometimes Stop is not involved on a commit cycle |
837 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoStopL - Enter")); |
|
838 // Sometimes Stop is not involved on a commit cycle |
830 TBool completed = iAdapter->Stop(); |
839 TBool completed = iAdapter->Stop(); |
831 if (completed) |
840 if (completed) |
832 { |
841 { |
833 iQueuedRequests.Reset(); |
842 iQueuedRequests.Reset(); |
834 FlushEventQueue(); // completed returned here means we were idle to start with. TODO could possibly skip this flush |
843 FlushEventQueue(); // completed returned here means we were idle to start with. TODO could possibly skip this flush |
835 iChunk.Close(); |
844 iChunk.Close(); |
836 } |
845 } |
837 iOperationCompletePending = !completed; |
846 iOperationCompletePending = !completed; |
|
847 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoStopL - Exit. Return value is [%d]"), completed); |
838 return completed; |
848 return completed; |
839 } |
849 } |
840 |
850 |
841 // |
851 // |
842 // CMMFDevSoundSession::DoPauseL |
852 // CMMFDevSoundSession::DoPauseL |
853 // CMMFDevSoundSession::DoPlayToneL |
863 // CMMFDevSoundSession::DoPlayToneL |
854 // (other items were commented in a header). |
864 // (other items were commented in a header). |
855 // |
865 // |
856 TBool CMMFDevSoundSession::DoPlayToneL(const RMmfIpcMessage& aMessage) |
866 TBool CMMFDevSoundSession::DoPlayToneL(const RMmfIpcMessage& aMessage) |
857 { |
867 { |
858 TMMFDevSoundProxySettingsPckg devSoundBuf; |
868 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayToneL - Enter")); |
|
869 TMMFDevSoundProxySettingsPckg devSoundBuf; |
859 aMessage.ReadL(TInt(1),devSoundBuf); |
870 aMessage.ReadL(TInt(1),devSoundBuf); |
860 TInt frequency = devSoundBuf().iFrequencyOne; |
871 TInt frequency = devSoundBuf().iFrequencyOne; |
861 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
872 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
862 iAdapter->PlayToneL(frequency, duration); |
873 iAdapter->PlayToneL(frequency, duration); |
863 iOperationCompletePending = ETrue; |
874 iOperationCompletePending = ETrue; |
|
875 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayToneL - Exit. Return value is [%d]"), ETrue); |
864 return ETrue; |
876 return ETrue; |
865 } |
877 } |
866 |
878 |
867 // |
879 // |
868 // CMMFDevSoundSession::DoPlayDualToneL |
880 // CMMFDevSoundSession::DoPlayDualToneL |
869 // (other items were commented in a header). |
881 // (other items were commented in a header). |
870 // |
882 // |
871 TBool CMMFDevSoundSession::DoPlayDualToneL(const RMmfIpcMessage& aMessage) |
883 TBool CMMFDevSoundSession::DoPlayDualToneL(const RMmfIpcMessage& aMessage) |
872 { |
884 { |
873 TMMFDevSoundProxySettingsPckg devSoundBuf; |
885 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDualToneL - Enter")); |
|
886 TMMFDevSoundProxySettingsPckg devSoundBuf; |
874 aMessage.ReadL(TInt(1),devSoundBuf); |
887 aMessage.ReadL(TInt(1),devSoundBuf); |
875 TInt frequencyOne = devSoundBuf().iFrequencyOne; |
888 TInt frequencyOne = devSoundBuf().iFrequencyOne; |
876 TInt frequencyTwo = devSoundBuf().iFrequencyTwo; |
889 TInt frequencyTwo = devSoundBuf().iFrequencyTwo; |
877 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
890 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
878 iAdapter->PlayDualToneL(frequencyOne, frequencyTwo, duration); |
891 iAdapter->PlayDualToneL(frequencyOne, frequencyTwo, duration); |
879 iOperationCompletePending = ETrue; |
892 iOperationCompletePending = ETrue; |
|
893 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayDualToneL - Exit. Return value is [%d]"), ETrue); |
880 return ETrue; |
894 return ETrue; |
881 } |
895 } |
882 |
896 |
883 // |
897 // |
884 // CMMFDevSoundSession::DoPlayDTMFStringL |
898 // CMMFDevSoundSession::DoPlayDTMFStringL |
885 // (other items were commented in a header). |
899 // (other items were commented in a header). |
886 // |
900 // |
887 TBool CMMFDevSoundSession::DoPlayDTMFStringL(const RMmfIpcMessage& aMessage) |
901 TBool CMMFDevSoundSession::DoPlayDTMFStringL(const RMmfIpcMessage& aMessage) |
888 { |
902 { |
889 TInt dtmfLength = aMessage.GetDesLength(2); |
903 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDTMFStringL - Enter")); |
|
904 TInt dtmfLength = aMessage.GetDesLength(2); |
890 |
905 |
891 if(iDtmfString) |
906 if(iDtmfString) |
892 { |
907 { |
893 delete iDtmfString; |
908 delete iDtmfString; |
894 iDtmfString = NULL; |
909 iDtmfString = NULL; |
898 TPtr dtmfPtr = iDtmfString->Des(); |
913 TPtr dtmfPtr = iDtmfString->Des(); |
899 aMessage.ReadL(TInt(2), dtmfPtr); |
914 aMessage.ReadL(TInt(2), dtmfPtr); |
900 |
915 |
901 iAdapter->PlayDTMFStringL(*iDtmfString); |
916 iAdapter->PlayDTMFStringL(*iDtmfString); |
902 iOperationCompletePending = ETrue; |
917 iOperationCompletePending = ETrue; |
|
918 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayDTMFStringL - Exit. Return value is [%d]"), ETrue); |
903 return ETrue; |
919 return ETrue; |
904 } |
920 } |
905 |
921 |
906 // |
922 // |
907 // CMMFDevSoundSession::DoPlayToneSequenceL |
923 // CMMFDevSoundSession::DoPlayToneSequenceL |
908 // (other items were commented in a header). |
924 // (other items were commented in a header). |
909 // |
925 // |
910 TBool CMMFDevSoundSession::DoPlayToneSequenceL(const RMmfIpcMessage& aMessage) |
926 TBool CMMFDevSoundSession::DoPlayToneSequenceL(const RMmfIpcMessage& aMessage) |
911 { |
927 { |
912 TInt toneLength = aMessage.GetDesLength(1); |
928 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayToneSequenceL - Enter")); |
|
929 TInt toneLength = aMessage.GetDesLength(1); |
913 |
930 |
914 if(iToneSeqBuf) |
931 if(iToneSeqBuf) |
915 { |
932 { |
916 delete iToneSeqBuf; |
933 delete iToneSeqBuf; |
917 iToneSeqBuf = NULL; |
934 iToneSeqBuf = NULL; |
921 TPtr8 toneSeqPtr = iToneSeqBuf->Des(); |
938 TPtr8 toneSeqPtr = iToneSeqBuf->Des(); |
922 aMessage.ReadL(TInt(1), toneSeqPtr); |
939 aMessage.ReadL(TInt(1), toneSeqPtr); |
923 |
940 |
924 iAdapter->PlayToneSequenceL(*iToneSeqBuf); |
941 iAdapter->PlayToneSequenceL(*iToneSeqBuf); |
925 iOperationCompletePending = ETrue; |
942 iOperationCompletePending = ETrue; |
|
943 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayToneSequenceL - Exit. Return value is [%d]"), ETrue); |
926 return ETrue; |
944 return ETrue; |
927 } |
945 } |
928 |
946 |
929 // |
947 // |
930 // CMMFDevSoundSession::DoPlayFixedSequenceL |
948 // CMMFDevSoundSession::DoPlayFixedSequenceL |
931 // (other items were commented in a header). |
949 // (other items were commented in a header). |
932 // |
950 // |
933 TBool CMMFDevSoundSession::DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage) |
951 TBool CMMFDevSoundSession::DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage) |
934 { |
952 { |
935 TPckgBuf<TInt> buf; |
953 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Enter")); |
|
954 TPckgBuf<TInt> buf; |
936 aMessage.ReadL(TInt(1),buf); |
955 aMessage.ReadL(TInt(1),buf); |
937 TInt seqNum = buf(); |
956 TInt seqNum = buf(); |
938 |
957 |
939 iAdapter->PlayFixedSequenceL(seqNum); |
958 iAdapter->PlayFixedSequenceL(seqNum); |
940 iOperationCompletePending = ETrue; |
959 iOperationCompletePending = ETrue; |
|
960 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Exit. Return value is [%d]"), ETrue); |
941 return ETrue; |
961 return ETrue; |
942 } |
962 } |
943 |
963 |
944 // |
964 // |
945 // CMMFDevSoundSession::DoSetDTMFLengthsL |
965 // CMMFDevSoundSession::DoSetDTMFLengthsL |
946 // (other items were commented in a header). |
966 // (other items were commented in a header). |
947 // |
967 // |
948 TBool CMMFDevSoundSession::DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage) |
968 TBool CMMFDevSoundSession::DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage) |
949 { |
969 { |
950 TMMFDevSoundProxySettingsPckg devSoundBuf; |
970 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetDTMFLengthsL - Enter")); |
|
971 TMMFDevSoundProxySettingsPckg devSoundBuf; |
951 aMessage.ReadL(TInt(1),devSoundBuf); |
972 aMessage.ReadL(TInt(1),devSoundBuf); |
952 TTimeIntervalMicroSeconds32 toneOnLength = devSoundBuf().iToneOnLength; |
973 TTimeIntervalMicroSeconds32 toneOnLength = devSoundBuf().iToneOnLength; |
953 TTimeIntervalMicroSeconds32 toneOffLength = devSoundBuf().iToneOffLength; |
974 TTimeIntervalMicroSeconds32 toneOffLength = devSoundBuf().iToneOffLength; |
954 TTimeIntervalMicroSeconds32 pauseLength = devSoundBuf().iPauseLength; |
975 TTimeIntervalMicroSeconds32 pauseLength = devSoundBuf().iPauseLength; |
955 User::LeaveIfError(iAdapter->SetDTMFLengths(toneOnLength, toneOffLength, pauseLength)); |
976 User::LeaveIfError(iAdapter->SetDTMFLengths(toneOnLength, toneOffLength, pauseLength)); |
|
977 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetDTMFLengthsL - Exit. Return value is [%d]"), ETrue); |
956 return ETrue; |
978 return ETrue; |
957 } |
979 } |
958 |
980 |
959 // |
981 // |
960 // CMMFDevSoundSession::DoSetVolumeRampL |
982 // CMMFDevSoundSession::DoSetVolumeRampL |
961 // (other items were commented in a header). |
983 // (other items were commented in a header). |
962 // |
984 // |
963 TBool CMMFDevSoundSession::DoSetVolumeRampL(const RMmfIpcMessage& aMessage) |
985 TBool CMMFDevSoundSession::DoSetVolumeRampL(const RMmfIpcMessage& aMessage) |
964 { |
986 { |
965 TMMFDevSoundProxySettingsPckg devSoundBuf; |
987 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Enter")); |
|
988 TMMFDevSoundProxySettingsPckg devSoundBuf; |
966 aMessage.ReadL(TInt(1),devSoundBuf); |
989 aMessage.ReadL(TInt(1),devSoundBuf); |
967 TTimeIntervalMicroSeconds duration = devSoundBuf().iDuration; |
990 TTimeIntervalMicroSeconds duration = devSoundBuf().iDuration; |
968 User::LeaveIfError(iAdapter->SetVolumeRamp(duration)); |
991 User::LeaveIfError(iAdapter->SetVolumeRamp(duration)); |
969 iOperationCompletePending = EFalse; // Volume ramp doesn't result on commit |
992 iOperationCompletePending = EFalse; // Volume ramp doesn't result on commit |
|
993 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Exit")); |
970 return ETrue; // operation complete |
994 return ETrue; // operation complete |
971 } |
995 } |
972 |
996 |
973 // |
997 // |
974 // CMMFDevSoundSession::DoGetSupportedInputDataTypesL |
998 // CMMFDevSoundSession::DoGetSupportedInputDataTypesL |
1042 // CMMFDevSoundSession::DoSetToneRepeatsL |
1066 // CMMFDevSoundSession::DoSetToneRepeatsL |
1043 // (other items were commented in a header). |
1067 // (other items were commented in a header). |
1044 // |
1068 // |
1045 TBool CMMFDevSoundSession::DoSetToneRepeatsL(const RMmfIpcMessage& aMessage) |
1069 TBool CMMFDevSoundSession::DoSetToneRepeatsL(const RMmfIpcMessage& aMessage) |
1046 { |
1070 { |
1047 TPckgBuf<TInt> countRepeat; |
1071 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Enter")); |
|
1072 TPckgBuf<TInt> countRepeat; |
1048 aMessage.ReadL(TInt(1),countRepeat); |
1073 aMessage.ReadL(TInt(1),countRepeat); |
1049 |
1074 |
1050 TPckgBuf<TTimeIntervalMicroSeconds> repeatTS; |
1075 TPckgBuf<TTimeIntervalMicroSeconds> repeatTS; |
1051 aMessage.ReadL(TInt(2),repeatTS); |
1076 aMessage.ReadL(TInt(2),repeatTS); |
1052 User::LeaveIfError(iAdapter->SetToneRepeats(countRepeat(), repeatTS())); |
1077 User::LeaveIfError(iAdapter->SetToneRepeats(countRepeat(), repeatTS())); |
1053 |
1078 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Exit")); |
1054 return ETrue; |
1079 return ETrue; |
1055 } |
1080 } |
1056 |
1081 |
1057 // |
1082 // |
1058 // CMMFDevSoundSession::DoSetPrioritySettingsL |
1083 // CMMFDevSoundSession::DoSetPrioritySettingsL |
1074 // (other items were commented in a header). |
1099 // (other items were commented in a header). |
1075 // |
1100 // |
1076 TBool CMMFDevSoundSession::DoFixedSequenceCountL( |
1101 TBool CMMFDevSoundSession::DoFixedSequenceCountL( |
1077 const RMmfIpcMessage& aMessage) |
1102 const RMmfIpcMessage& aMessage) |
1078 { |
1103 { |
1079 TPckgBuf<TInt> fixSeqCountPckg; |
1104 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoFixedSequenceCountL - Enter")); |
|
1105 TPckgBuf<TInt> fixSeqCountPckg; |
1080 TInt fixSeqCount = iAdapter->FixedSequenceCount(); |
1106 TInt fixSeqCount = iAdapter->FixedSequenceCount(); |
1081 fixSeqCountPckg = fixSeqCount; |
1107 fixSeqCountPckg = fixSeqCount; |
1082 |
1108 |
1083 aMessage.WriteL(TInt(2),fixSeqCountPckg); |
1109 aMessage.WriteL(TInt(2),fixSeqCountPckg); |
|
1110 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoFixedSequenceCountL - Exit")); |
1084 return ETrue; |
1111 return ETrue; |
1085 } |
1112 } |
1086 |
1113 |
1087 |
1114 |
1088 // |
1115 // |
1337 // |
1364 // |
1338 // CMMFDevSoundSession::FlushEventQueue() |
1365 // CMMFDevSoundSession::FlushEventQueue() |
1339 // |
1366 // |
1340 void CMMFDevSoundSession::FlushEventQueue() |
1367 void CMMFDevSoundSession::FlushEventQueue() |
1341 { |
1368 { |
1342 if(iMsgQueue.Handle() != 0) |
1369 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::FlushEventQueue - Enter")); |
|
1370 if(iMsgQueue.Handle() != 0) |
1343 { |
1371 { |
1344 TMMFDevSoundQueueItem queueItem; |
1372 TMMFDevSoundQueueItem queueItem; |
1345 TInt err = KErrNone; |
1373 TInt err = KErrNone; |
1346 while(err != KErrUnderflow) |
1374 while(err != KErrUnderflow) |
1347 { |
1375 { |
1348 err = iMsgQueue.Receive(queueItem); |
1376 err = iMsgQueue.Receive(queueItem); |
1349 } |
1377 } |
1350 } |
1378 } |
|
1379 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::FlushEventQueue - Exit")); |
1351 } |
1380 } |
1352 |
1381 |
1353 void CMMFDevSoundSession::FilterQueueEvent(TMMFDevSoundProxyRequest aRequest) |
1382 void CMMFDevSoundSession::FilterQueueEvent(TMMFDevSoundProxyRequest aRequest) |
1354 { |
1383 { |
1355 if(iMsgQueue.Handle() != 0) |
1384 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::FilterQueueEvent - Enter")); |
|
1385 if(iMsgQueue.Handle() != 0) |
1356 { |
1386 { |
1357 // Pop and push events result at the queue |
1387 // Pop and push events result at the queue |
1358 // can be seen as "circular list" |
1388 // can be seen as "circular list" |
1359 // set a mark to traverse it safely |
1389 // set a mark to traverse it safely |
1360 TMMFDevSoundQueueItem markItem; |
1390 TMMFDevSoundQueueItem markItem; |
1378 // assumes sufficient space in the queue |
1408 // assumes sufficient space in the queue |
1379 err = iMsgQueue.Send(queueItem); |
1409 err = iMsgQueue.Send(queueItem); |
1380 } |
1410 } |
1381 } |
1411 } |
1382 } |
1412 } |
|
1413 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::FilterQueueEvent - Exit")); |
1383 } |
1414 } |
1384 |
1415 |
1385 // |
1416 // |
1386 // CMMFDevSoundSession::Disconnect |
1417 // CMMFDevSoundSession::Disconnect |
1387 // (other items were commented in a header). |
1418 // (other items were commented in a header). |
1388 // |
1419 // |
1389 void CMMFDevSoundSession::Disconnect(const RMessage2& aMessage) |
1420 void CMMFDevSoundSession::Disconnect(const RMessage2& aMessage) |
1390 { |
1421 { |
1391 TBool complete = iAdapter->CloseDevSound(); |
1422 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Enter")); |
|
1423 TBool complete = iAdapter->CloseDevSound(); |
1392 if(!complete) |
1424 if(!complete) |
1393 { |
1425 { |
1394 iRequestBeingServiced.SetMessage(aMessage); |
1426 iRequestBeingServiced.SetMessage(aMessage); |
1395 iOperationCompletePending = ETrue; |
1427 iOperationCompletePending = ETrue; |
1396 iClosingWait->Start(); |
1428 iClosingWait->Start(); |
1397 } |
1429 } |
1398 CSession2::Disconnect(aMessage); |
1430 CSession2::Disconnect(aMessage); |
|
1431 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Exit")); |
1399 } |
1432 } |
1400 |
1433 |
1401 |
1434 |
1402 // |
1435 // |
1403 // CMMFDevSoundSession::NewL |
1436 // CMMFDevSoundSession::NewL |
1505 // CMMFDevSoundSession::ToneFinished |
1538 // CMMFDevSoundSession::ToneFinished |
1506 // (other items were commented in a header). |
1539 // (other items were commented in a header). |
1507 // |
1540 // |
1508 void CMMFDevSoundSession::ToneFinished(TInt aError) |
1541 void CMMFDevSoundSession::ToneFinished(TInt aError) |
1509 { |
1542 { |
1510 TMMFDevSoundQueueItem item; |
1543 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::ToneFinished - Enter. Error [%d]"), aError); |
|
1544 TMMFDevSoundQueueItem item; |
1511 item.iRequest = EMMFDevSoundProxyTFEvent; |
1545 item.iRequest = EMMFDevSoundProxyTFEvent; |
1512 item.iErrorCode = aError; |
1546 item.iErrorCode = aError; |
1513 // assumes sufficient space in the queue so ignores the return value |
1547 // assumes sufficient space in the queue so ignores the return value |
1514 iMsgQueue.Send(item); |
1548 iMsgQueue.Send(item); |
|
1549 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::ToneFinished - Exit")); |
1515 } |
1550 } |
1516 |
1551 |
1517 // |
1552 // |
1518 // CMMFDevSoundSession::BufferToBeFilled |
1553 // CMMFDevSoundSession::BufferToBeFilled |
1519 // (other items were commented in a header). |
1554 // (other items were commented in a header). |
1551 // CMMFDevSoundSession::PlayError |
1586 // CMMFDevSoundSession::PlayError |
1552 // (other items were commented in a header). |
1587 // (other items were commented in a header). |
1553 // |
1588 // |
1554 void CMMFDevSoundSession::PlayError(TInt aError) |
1589 void CMMFDevSoundSession::PlayError(TInt aError) |
1555 { |
1590 { |
1556 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::PlayError [%d]"), aError); |
1591 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::PlayError - Enter [%d]"), aError); |
1557 |
1592 |
1558 // Set play error flag to ignore following PlayData requests |
1593 // Set play error flag to ignore following PlayData requests |
1559 iPlayErrorOccured = ETrue; |
1594 iPlayErrorOccured = ETrue; |
1560 |
1595 |
1561 TMMFDevSoundQueueItem item; |
1596 TMMFDevSoundQueueItem item; |
1562 item.iRequest = EMMFDevSoundProxyPEEvent; |
1597 item.iRequest = EMMFDevSoundProxyPEEvent; |
1563 item.iErrorCode = aError; |
1598 item.iErrorCode = aError; |
1564 iChunk.Close(); |
1599 iChunk.Close(); |
1565 // assumes sufficient space in the queue so ignores the return value |
1600 // assumes sufficient space in the queue so ignores the return value |
1566 iMsgQueue.Send(item); |
1601 iMsgQueue.Send(item); |
|
1602 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::PlayError - Exit")); |
1567 } |
1603 } |
1568 |
1604 |
1569 // |
1605 // |
1570 // CMMFDevSoundSession::BufferToBeEmptied |
1606 // CMMFDevSoundSession::BufferToBeEmptied |
1571 // (other items were commented in a header). |
1607 // (other items were commented in a header). |
1645 // CMMFDevSoundSession::CallbackFromAdaptorReceived |
1681 // CMMFDevSoundSession::CallbackFromAdaptorReceived |
1646 // (other items were commented in a header). |
1682 // (other items were commented in a header). |
1647 // |
1683 // |
1648 void CMMFDevSoundSession::CallbackFromAdaptorReceived(TInt aType, TInt aError) |
1684 void CMMFDevSoundSession::CallbackFromAdaptorReceived(TInt aType, TInt aError) |
1649 { |
1685 { |
1650 |
1686 SYMBIAN_DEBPRN2(_L("CMMFDevSoundSession[0x%x]::CallbackFromAdaptorReceived - Enter. Type [%d ]Error [%d]"), aType, aError); |
1651 if(aType == KCallbackRecordPauseComplete) |
1687 if(aType == KCallbackRecordPauseComplete) |
1652 { |
1688 { |
1653 TMMFDevSoundQueueItem item; |
1689 TMMFDevSoundQueueItem item; |
1654 item.iRequest = EMMFDevSoundProxyPausedRecordCompleteEvent; |
1690 item.iRequest = EMMFDevSoundProxyPausedRecordCompleteEvent; |
1655 item.iErrorCode = KErrNone; |
1691 item.iErrorCode = KErrNone; |
1690 { |
1726 { |
1691 DoProcessingError(); |
1727 DoProcessingError(); |
1692 } |
1728 } |
1693 } |
1729 } |
1694 } |
1730 } |
|
1731 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::CallbackFromAdaptorReceived - Exit")); |
1695 } |
1732 } |
1696 |
1733 |
1697 |
1734 |
1698 // |
1735 // |
1699 // CMMFDevSoundSession::PreemptionStartedCallbackReceived |
1736 // CMMFDevSoundSession::PreemptionStartedCallbackReceived |
1700 // (other items were commented in a header). |
1737 // (other items were commented in a header). |
1701 // |
1738 // |
1702 void CMMFDevSoundSession::PreemptionStartedCallbackReceived() |
1739 void CMMFDevSoundSession::PreemptionStartedCallbackReceived() |
1703 { |
1740 { |
1704 // Solution: Enqueue any request that arrives before preemption is completed |
1741 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::PreemptionStartedCallbackReceived - Enter")); |
|
1742 // Solution: Enqueue any request that arrives before preemption is completed |
1705 iOperationCompletePending = ETrue; |
1743 iOperationCompletePending = ETrue; |
|
1744 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::PreemptionStartedCallbackReceived - Exit")); |
1706 } |
1745 } |
1707 |
1746 |
1708 // |
1747 // |
1709 // CMMFDevSoundSession::PreemptionFinishedCallbackReceived |
1748 // CMMFDevSoundSession::PreemptionFinishedCallbackReceived |
1710 // (other items were commented in a header). |
1749 // (other items were commented in a header). |
1711 // |
1750 // |
1712 void CMMFDevSoundSession::PreemptionFinishedCallbackReceived(TBool aCanStartNewOperation) |
1751 void CMMFDevSoundSession::PreemptionFinishedCallbackReceived(TBool aCanStartNewOperation) |
1713 { |
1752 { |
|
1753 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::PreemptionFinishedCallbackReceived - Enter")); |
1714 if (iHandlingExtdCI) |
1754 if (iHandlingExtdCI) |
1715 { |
1755 { |
1716 // we are in the middle of handling a CI, so ignore - will handle later when unwinding |
1756 // we are in the middle of handling a CI, so ignore - will handle later when unwinding |
1717 return; |
1757 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::PreemptionFinishedCallbackReceived - Exit. Exiting from if block for CI")); |
|
1758 return; |
1718 } |
1759 } |
1719 iOperationCompletePending = EFalse; |
1760 iOperationCompletePending = EFalse; |
1720 if ( aCanStartNewOperation && iQueuedRequests.Count() != 0 ) |
1761 if ( aCanStartNewOperation && iQueuedRequests.Count() != 0 ) |
1721 { |
1762 { |
1722 DequeueRequest(); |
1763 DequeueRequest(); |
1723 } |
1764 } |
|
1765 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::PreemptionFinishedCallbackReceived - Exit")); |
1724 } |
1766 } |
1725 |
1767 |
1726 // |
1768 // |
1727 // CMMFDevSoundSession::AdaptorControlsContext() |
1769 // CMMFDevSoundSession::AdaptorControlsContext() |
1728 // |
1770 // |
1752 // CMMFDevSoundSession::SendEventToClient |
1794 // CMMFDevSoundSession::SendEventToClient |
1753 // (other items were commented in a header). |
1795 // (other items were commented in a header). |
1754 // |
1796 // |
1755 void CMMFDevSoundSession::SendEventToClient(const TMMFEvent& aEvent) |
1797 void CMMFDevSoundSession::SendEventToClient(const TMMFEvent& aEvent) |
1756 { |
1798 { |
1757 TMMFDevSoundQueueItem item; |
1799 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::SendEventToClient - Enter")); |
|
1800 TMMFDevSoundQueueItem item; |
1758 item.iRequest = EMMFDevSoundProxySETCEvent; |
1801 item.iRequest = EMMFDevSoundProxySETCEvent; |
1759 item.iErrorCode = KErrNone; |
1802 item.iErrorCode = KErrNone; |
1760 item.iEventPckg() = aEvent; |
1803 item.iEventPckg() = aEvent; |
1761 // assumes sufficient space in the queue so ignores the return value |
1804 // assumes sufficient space in the queue so ignores the return value |
1762 TInt err = iMsgQueue.Send(item); |
1805 TInt err = iMsgQueue.Send(item); |
1763 __ASSERT_DEBUG(err == KErrNone, Panic(EMsgQueueFailedToSendMsg)); |
1806 __ASSERT_DEBUG(err == KErrNone, Panic(EMsgQueueFailedToSendMsg)); |
|
1807 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::SendEventToClient - Exit")); |
1764 } |
1808 } |
1765 |
1809 |
1766 void CMMFDevSoundSession::AsynchronousOperationComplete(TInt aError, TBool aCanStartNewOperation) |
1810 void CMMFDevSoundSession::AsynchronousOperationComplete(TInt aError, TBool aCanStartNewOperation) |
1767 { |
1811 { |
1768 __ASSERT_DEBUG(!iHandlingExtdCI, Panic(EUnexpectedAsyncOpCompleteHandlingCI)); |
1812 __ASSERT_DEBUG(!iHandlingExtdCI, Panic(EUnexpectedAsyncOpCompleteHandlingCI)); |