changeset 54 | b68f3e90dca1 |
parent 24 | 2672ba96448e |
51:613e4e943120 | 54:b68f3e90dca1 |
---|---|
267 { |
267 { |
268 iRequestBeingServiced.SetMessage(aMessage); |
268 iRequestBeingServiced.SetMessage(aMessage); |
269 iAsyncQueueStart->Cancel(); // just in case. |
269 iAsyncQueueStart->Cancel(); // just in case. |
270 ResetNotifiedError(); |
270 ResetNotifiedError(); |
271 |
271 |
272 TMMFMessageDestinationPckg destinationPckg; |
272 if (aMessage.Function() == RMessage2::EDisConnect) |
273 MmfMessageUtil::ReadL(aMessage, 0, destinationPckg); |
273 { |
274 SYMBIAN_DEBPRN2(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - DestinationHandle [%d] InterfaceId [%d] "), destinationPckg().DestinationHandle(), destinationPckg().InterfaceId()); |
|
275 if ((destinationPckg().DestinationHandle() == KMMFObjectHandleDevSound) && |
|
276 (destinationPckg().InterfaceId() == KUidInterfaceMMFDevSound)) |
|
277 { |
|
278 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - Request [%d]"), aMessage.Function()); |
|
279 TBool complete = EFalse; |
|
280 switch(aMessage.Function()) |
|
281 { |
|
282 case EMMFDevSoundProxyPostOpen: |
|
283 complete = DoPostOpenL(aMessage); |
|
284 break; |
|
285 case EMMFDevSoundProxyInitialize1: |
|
286 complete = DoInitialize1L(aMessage); |
|
287 break; |
|
288 case EMMFDevSoundProxyInitialize2: |
|
289 complete = DoInitialize2L(aMessage); |
|
290 break; |
|
291 case EMMFDevSoundProxyInitialize4: |
|
292 complete = DoInitialize4L(aMessage); |
|
293 break; |
|
294 case EMMFDevSoundProxyCapabilities: |
|
295 complete = DoCapabilitiesL(aMessage); |
|
296 break; |
|
297 case EMMFDevSoundProxyConfig: |
|
298 complete = DoConfigL(aMessage); |
|
299 break; |
|
300 case EMMFDevSoundProxySetConfig: |
|
301 complete = DoSetConfigL(aMessage); |
|
302 break; |
|
303 case EMMFDevSoundProxyMaxVolume: |
|
304 complete = DoMaxVolumeL(aMessage); |
|
305 break; |
|
306 case EMMFDevSoundProxyVolume: |
|
307 complete = DoVolumeL(aMessage); |
|
308 break; |
|
309 case EMMFDevSoundProxySetVolume: |
|
310 complete = DoSetVolumeL(aMessage); |
|
311 break; |
|
312 case EMMFDevSoundProxyMaxGain: |
|
313 complete = DoMaxGainL(aMessage); |
|
314 break; |
|
315 case EMMFDevSoundProxyGain: |
|
316 complete = DoGainL(aMessage); |
|
317 break; |
|
318 case EMMFDevSoundProxySetGain: |
|
319 complete = DoSetGainL(aMessage); |
|
320 break; |
|
321 case EMMFDevSoundProxyPlayBalance: |
|
322 complete = DoGetPlayBalanceL(aMessage); |
|
323 break; |
|
324 case EMMFDevSoundProxySetPlayBalance: |
|
325 complete = DoSetPlayBalanceL(aMessage); |
|
326 break; |
|
327 case EMMFDevSoundProxyRecordBalance: |
|
328 complete = DoGetRecordBalanceL(aMessage); |
|
329 break; |
|
330 case EMMFDevSoundProxySetRecordBalance: |
|
331 complete = DoSetRecordBalanceL(aMessage); |
|
332 break; |
|
333 case EMMFDevSoundProxyBTBFData: |
|
334 complete = DoBufferToBeFilledDataL(aMessage); |
|
335 break; |
|
336 case EMMFDevSoundProxyBTBEData: |
|
337 complete = DoBufferToBeEmptiedDataL(aMessage); |
|
338 break; |
|
339 case EMMFDevSoundProxyPlayInit: |
|
340 complete = DoPlayInitL(aMessage); |
|
341 break; |
|
342 case EMMFDevSoundProxyRecordInit: |
|
343 complete = DoRecordInitL(aMessage); |
|
344 break; |
|
345 case EMMFDevSoundProxyPlayData: |
|
346 complete = DoPlayDataL(aMessage); |
|
347 break; |
|
348 case EMMFDevSoundProxyRecordData: |
|
349 complete = DoRecordDataL(aMessage); |
|
350 break; |
|
351 case EMMFDevSoundProxyStop: |
|
352 complete = DoStopL(aMessage); |
|
353 break; |
|
354 case EMMFDevSoundProxyPause: |
|
355 complete = DoPauseL(aMessage); |
|
356 break; |
|
357 case EMMFDevSoundProxyPlayTone: |
|
358 complete = DoPlayToneL(aMessage); |
|
359 break; |
|
360 case EMMFDevSoundProxyPlayDualTone: |
|
361 complete = DoPlayDualToneL(aMessage); |
|
362 break; |
|
363 case EMMFDevSoundProxyPlayDTMFString: |
|
364 complete = DoPlayDTMFStringL(aMessage); |
|
365 break; |
|
366 case EMMFDevSoundProxyPlayToneSequence: |
|
367 complete = DoPlayToneSequenceL(aMessage); |
|
368 break; |
|
369 case EMMFDevSoundProxyPlayFixedSequence: |
|
370 complete = DoPlayFixedSequenceL(aMessage); |
|
371 break; |
|
372 case EMMFDevSoundProxySetDTMFLengths: |
|
373 complete = DoSetDTMFLengthsL(aMessage); |
|
374 break; |
|
375 case EMMFDevSoundProxySetVolumeRamp: |
|
376 complete = DoSetVolumeRampL(aMessage); |
|
377 break; |
|
378 case EMMFDevSoundProxyGetSupportedInputDataTypes: |
|
379 complete = DoGetSupportedInputDataTypesL(aMessage); |
|
380 break; |
|
381 case EMMFDevSoundProxyGetSupportedOutputDataTypes: |
|
382 complete = DoGetSupportedOutputDataTypesL(aMessage); |
|
383 break; |
|
384 case EMMFDevSoundProxyCopyFourCCArrayData: |
|
385 complete = DoCopyFourCCArrayDataL(aMessage); |
|
386 break; |
|
387 case EMMFDevSoundProxySamplesRecorded: |
|
388 complete = DoSamplesRecordedL(aMessage); |
|
389 break; |
|
390 case EMMFDevSoundProxySamplesPlayed: |
|
391 complete = DoSamplesPlayedL(aMessage); |
|
392 break; |
|
393 case EMMFDevSoundProxySetToneRepeats: |
|
394 complete = DoSetToneRepeatsL(aMessage); |
|
395 break; |
|
396 case EMMFDevSoundProxySetPrioritySettings: |
|
397 complete = DoSetPrioritySettingsL(aMessage); |
|
398 break; |
|
399 case EMMFDevSoundProxyFixedSequenceCount: |
|
400 complete = DoFixedSequenceCountL(aMessage); |
|
401 break; |
|
402 case EMMFDevSoundProxyCancelInitialize: |
|
403 complete = DoCancelInitializeL(aMessage); |
|
404 break; |
|
405 case EMMFDevSoundProxyEmptyBuffers: |
|
406 complete = DoEmptyBuffersL(aMessage); |
|
407 break; |
|
408 case EMMFDevSoundProxyGetTimePlayed: |
|
409 complete = DoGetTimePlayedL(aMessage); |
|
410 break; |
|
411 case EMMFDevSoundProxyIsResumeSupported: |
|
412 complete = DoQueryResumeSupportedL(aMessage); |
|
413 break; |
|
414 case EMMFDevSoundProxyResume: |
|
415 complete = DoResumeL(aMessage); |
|
416 break; |
|
417 |
|
418 // DevSound custom command support |
|
419 case EMMFDevSoundProxySyncCustomCommand: |
|
420 case EMMFDevSoundProxySyncCustomCommandResult: |
|
421 case EMMFDevSoundProxyAsyncCustomCommand: |
|
422 case EMMFDevSoundProxyAsyncCustomCommandResult: |
|
423 complete = DoCustomCommandL(aMessage); |
|
424 break; |
|
425 case EMMFDevSoundProxyClose: |
|
426 complete = DoPrepareCloseL(aMessage); |
|
427 break; |
|
428 case EMMFDevSoundProxyRequestResourceNotification: |
|
429 complete = DoRegisterAsClientL(aMessage); |
|
430 break; |
|
431 case EMMFDevSoundProxyCancelRequestResourceNotification: |
|
432 complete = DoCancelRegisterAsClientL(aMessage); |
|
433 break; |
|
434 case EMMFDevSoundProxyGetResourceNotificationData: |
|
435 complete = DoGetResourceNotificationDataL(aMessage); |
|
436 break; |
|
437 case EMMFDevSoundProxyWillResumePlay: |
|
438 complete = DoWillResumePlayL(aMessage); |
|
439 break; |
|
440 case EMMFDevSoundProxySetClientThreadInfo: |
|
441 complete = DoSetClientThreadInfoL(aMessage); |
|
442 break; |
|
443 default: |
|
444 User::Leave(KErrNotSupported); |
|
445 break; |
|
446 } |
|
447 |
|
448 // Check if can complete the message now |
|
449 if (complete) |
|
450 { |
|
451 // Complete the message |
|
452 // Synchronous requests & Pseudo-asynchronous |
|
453 aMessage.Complete(KErrNone); |
|
454 |
|
455 // Store function if we need to re-apply it again due to pre-emption clash |
|
456 if(iRequestBeingServiced.Type() == TMMFDevSoundRequest::EAction_PseudoAsynchronous) |
|
457 { |
|
458 iRedoFunction = aMessage.Function(); |
|
459 } |
|
460 } |
|
461 } |
|
462 else if (aMessage.Function() == RMessage2::EDisConnect) |
|
463 { |
|
464 TBool complete = iAdapter->CloseDevSound(); |
274 TBool complete = iAdapter->CloseDevSound(); |
465 if(!complete) |
275 if(!complete) |
466 { |
276 { |
467 iRequestBeingServiced.SetMessage(aMessage); |
277 iRequestBeingServiced.SetMessage(aMessage); |
468 iOperationCompletePending = ETrue; |
278 iOperationCompletePending = ETrue; |
471 else |
281 else |
472 { |
282 { |
473 // if we get here, iClosing wait will have been started and we'd be waiting |
283 // if we get here, iClosing wait will have been started and we'd be waiting |
474 iClosingWait->AsyncStop(); |
284 iClosingWait->AsyncStop(); |
475 } |
285 } |
476 } |
286 return; |
287 } |
|
288 |
|
289 TMMFMessageDestinationPckg destinationPckg; |
|
290 User::LeaveIfError(MessageRead(aMessage, 0, destinationPckg)); |
|
291 SYMBIAN_DEBPRN2(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - DestinationHandle [%d] InterfaceId [%d] "), destinationPckg().DestinationHandle(), destinationPckg().InterfaceId()); |
|
292 if ((destinationPckg().DestinationHandle() == KMMFObjectHandleDevSound) && |
|
293 (destinationPckg().InterfaceId() == KUidInterfaceMMFDevSound)) |
|
294 { |
|
295 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoServiceRequestL - Request [%d]"), aMessage.Function()); |
|
296 TBool complete = EFalse; |
|
297 switch(aMessage.Function()) |
|
298 { |
|
299 case EMMFDevSoundProxyPostOpen: |
|
300 complete = DoPostOpenL(aMessage); |
|
301 break; |
|
302 case EMMFDevSoundProxyInitialize1: |
|
303 complete = DoInitialize1L(aMessage); |
|
304 break; |
|
305 case EMMFDevSoundProxyInitialize2: |
|
306 complete = DoInitialize2L(aMessage); |
|
307 break; |
|
308 case EMMFDevSoundProxyInitialize4: |
|
309 complete = DoInitialize4L(aMessage); |
|
310 break; |
|
311 case EMMFDevSoundProxyCapabilities: |
|
312 complete = DoCapabilitiesL(aMessage); |
|
313 break; |
|
314 case EMMFDevSoundProxyConfig: |
|
315 complete = DoConfigL(aMessage); |
|
316 break; |
|
317 case EMMFDevSoundProxySetConfig: |
|
318 complete = DoSetConfigL(aMessage); |
|
319 break; |
|
320 case EMMFDevSoundProxyMaxVolume: |
|
321 complete = DoMaxVolumeL(aMessage); |
|
322 break; |
|
323 case EMMFDevSoundProxyVolume: |
|
324 complete = DoVolumeL(aMessage); |
|
325 break; |
|
326 case EMMFDevSoundProxySetVolume: |
|
327 complete = DoSetVolumeL(aMessage); |
|
328 break; |
|
329 case EMMFDevSoundProxyMaxGain: |
|
330 complete = DoMaxGainL(aMessage); |
|
331 break; |
|
332 case EMMFDevSoundProxyGain: |
|
333 complete = DoGainL(aMessage); |
|
334 break; |
|
335 case EMMFDevSoundProxySetGain: |
|
336 complete = DoSetGainL(aMessage); |
|
337 break; |
|
338 case EMMFDevSoundProxyPlayBalance: |
|
339 complete = DoGetPlayBalanceL(aMessage); |
|
340 break; |
|
341 case EMMFDevSoundProxySetPlayBalance: |
|
342 complete = DoSetPlayBalanceL(aMessage); |
|
343 break; |
|
344 case EMMFDevSoundProxyRecordBalance: |
|
345 complete = DoGetRecordBalanceL(aMessage); |
|
346 break; |
|
347 case EMMFDevSoundProxySetRecordBalance: |
|
348 complete = DoSetRecordBalanceL(aMessage); |
|
349 break; |
|
350 case EMMFDevSoundProxyBTBFData: |
|
351 complete = DoBufferToBeFilledDataL(aMessage); |
|
352 break; |
|
353 case EMMFDevSoundProxyBTBEData: |
|
354 complete = DoBufferToBeEmptiedDataL(aMessage); |
|
355 break; |
|
356 case EMMFDevSoundProxyPlayInit: |
|
357 complete = DoPlayInitL(aMessage); |
|
358 break; |
|
359 case EMMFDevSoundProxyRecordInit: |
|
360 complete = DoRecordInitL(aMessage); |
|
361 break; |
|
362 case EMMFDevSoundProxyPlayData: |
|
363 complete = DoPlayDataL(aMessage); |
|
364 break; |
|
365 case EMMFDevSoundProxyRecordData: |
|
366 complete = DoRecordDataL(aMessage); |
|
367 break; |
|
368 case EMMFDevSoundProxyStop: |
|
369 complete = DoStopL(aMessage); |
|
370 break; |
|
371 case EMMFDevSoundProxyPause: |
|
372 complete = DoPauseL(aMessage); |
|
373 break; |
|
374 case EMMFDevSoundProxyPlayTone: |
|
375 complete = DoPlayToneL(aMessage); |
|
376 break; |
|
377 case EMMFDevSoundProxyPlayDualTone: |
|
378 complete = DoPlayDualToneL(aMessage); |
|
379 break; |
|
380 case EMMFDevSoundProxyPlayDTMFString: |
|
381 complete = DoPlayDTMFStringL(aMessage); |
|
382 break; |
|
383 case EMMFDevSoundProxyPlayToneSequence: |
|
384 complete = DoPlayToneSequenceL(aMessage); |
|
385 break; |
|
386 case EMMFDevSoundProxyPlayFixedSequence: |
|
387 complete = DoPlayFixedSequenceL(aMessage); |
|
388 break; |
|
389 case EMMFDevSoundProxySetDTMFLengths: |
|
390 complete = DoSetDTMFLengthsL(aMessage); |
|
391 break; |
|
392 case EMMFDevSoundProxySetVolumeRamp: |
|
393 complete = DoSetVolumeRampL(aMessage); |
|
394 break; |
|
395 case EMMFDevSoundProxyGetSupportedInputDataTypes: |
|
396 complete = DoGetSupportedInputDataTypesL(aMessage); |
|
397 break; |
|
398 case EMMFDevSoundProxyGetSupportedOutputDataTypes: |
|
399 complete = DoGetSupportedOutputDataTypesL(aMessage); |
|
400 break; |
|
401 case EMMFDevSoundProxyCopyFourCCArrayData: |
|
402 complete = DoCopyFourCCArrayDataL(aMessage); |
|
403 break; |
|
404 case EMMFDevSoundProxySamplesRecorded: |
|
405 complete = DoSamplesRecordedL(aMessage); |
|
406 break; |
|
407 case EMMFDevSoundProxySamplesPlayed: |
|
408 complete = DoSamplesPlayedL(aMessage); |
|
409 break; |
|
410 case EMMFDevSoundProxySetToneRepeats: |
|
411 complete = DoSetToneRepeatsL(aMessage); |
|
412 break; |
|
413 case EMMFDevSoundProxySetPrioritySettings: |
|
414 complete = DoSetPrioritySettingsL(aMessage); |
|
415 break; |
|
416 case EMMFDevSoundProxyFixedSequenceCount: |
|
417 complete = DoFixedSequenceCountL(aMessage); |
|
418 break; |
|
419 case EMMFDevSoundProxyCancelInitialize: |
|
420 complete = DoCancelInitializeL(aMessage); |
|
421 break; |
|
422 case EMMFDevSoundProxyEmptyBuffers: |
|
423 complete = DoEmptyBuffersL(aMessage); |
|
424 break; |
|
425 case EMMFDevSoundProxyGetTimePlayed: |
|
426 complete = DoGetTimePlayedL(aMessage); |
|
427 break; |
|
428 case EMMFDevSoundProxyIsResumeSupported: |
|
429 complete = DoQueryResumeSupportedL(aMessage); |
|
430 break; |
|
431 case EMMFDevSoundProxyResume: |
|
432 complete = DoResumeL(aMessage); |
|
433 break; |
|
434 |
|
435 // DevSound custom command support |
|
436 case EMMFDevSoundProxySyncCustomCommand: |
|
437 case EMMFDevSoundProxySyncCustomCommandResult: |
|
438 case EMMFDevSoundProxyAsyncCustomCommand: |
|
439 case EMMFDevSoundProxyAsyncCustomCommandResult: |
|
440 complete = DoCustomCommandL(aMessage); |
|
441 break; |
|
442 case EMMFDevSoundProxyClose: |
|
443 complete = DoPrepareCloseL(aMessage); |
|
444 break; |
|
445 case EMMFDevSoundProxyRequestResourceNotification: |
|
446 complete = DoRegisterAsClientL(aMessage); |
|
447 break; |
|
448 case EMMFDevSoundProxyCancelRequestResourceNotification: |
|
449 complete = DoCancelRegisterAsClientL(aMessage); |
|
450 break; |
|
451 case EMMFDevSoundProxyGetResourceNotificationData: |
|
452 complete = DoGetResourceNotificationDataL(aMessage); |
|
453 break; |
|
454 case EMMFDevSoundProxyWillResumePlay: |
|
455 complete = DoWillResumePlayL(aMessage); |
|
456 break; |
|
457 case EMMFDevSoundProxySetClientThreadInfo: |
|
458 complete = DoSetClientThreadInfoL(aMessage); |
|
459 break; |
|
460 default: |
|
461 User::Leave(KErrNotSupported); |
|
462 break; |
|
463 } |
|
464 |
|
465 // Check if can complete the message now |
|
466 if (complete) |
|
467 { |
|
468 // Complete the message |
|
469 // Synchronous requests & Pseudo-asynchronous |
|
470 aMessage.Complete(KErrNone); |
|
471 |
|
472 // Store function if we need to re-apply it again due to pre-emption clash |
|
473 if(iRequestBeingServiced.Type() == TMMFDevSoundRequest::EAction_PseudoAsynchronous) |
|
474 { |
|
475 iRedoFunction = aMessage.Function(); |
|
476 } |
|
477 } |
|
478 } |
|
477 else |
479 else |
478 { |
480 { |
479 // If there's a CI extension, see if that handles this request |
481 // If there's a CI extension, see if that handles this request |
480 TInt err = KErrNotSupported; |
482 TInt err = KErrNotSupported; |
481 if (iCIExtension) |
483 if (iCIExtension) |
576 } |
578 } |
577 } |
579 } |
578 |
580 |
579 void CMMFDevSoundSession::EnqueueRequest(const RMmfIpcMessage& aMessage) |
581 void CMMFDevSoundSession::EnqueueRequest(const RMmfIpcMessage& aMessage) |
580 { |
582 { |
583 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::EnqueueRequest - Enter")); |
|
581 // Encapsule the request |
584 // Encapsule the request |
582 TMMFDevSoundRequest request; |
585 TMMFDevSoundRequest request; |
583 request.SetMessage(aMessage); |
586 request.SetMessage(aMessage); |
584 // Append |
587 // Append |
585 TInt error = iQueuedRequests.Append(request); |
588 TInt error = iQueuedRequests.Append(request); |
586 __ASSERT_DEBUG(error == KErrNone, Panic(EQueueRequestsFailedToAppend)); |
589 __ASSERT_DEBUG(error == KErrNone, Panic(EQueueRequestsFailedToAppend)); |
590 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::EnqueueRequest - Exit")); |
|
587 } |
591 } |
588 |
592 |
589 // |
593 // |
590 // CMMFDevSoundSession::DoPostOpenL |
594 // CMMFDevSoundSession::DoPostOpenL |
591 // |
595 // |
605 iMsgQueue.Close(); // close if already open |
609 iMsgQueue.Close(); // close if already open |
606 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
610 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
607 User::LeaveIfError(err); |
611 User::LeaveIfError(err); |
608 DoSetClientConfigL();// added here instead of the CreateL() |
612 DoSetClientConfigL();// added here instead of the CreateL() |
609 TMMFDevSoundProxySettingsPckg devSoundBuf; |
613 TMMFDevSoundProxySettingsPckg devSoundBuf; |
610 MmfMessageUtil::ReadL(aMessage,1,devSoundBuf); |
614 User::LeaveIfError(MessageRead(aMessage,1,devSoundBuf)); |
611 iCachedClientData = devSoundBuf; |
615 iCachedClientData = devSoundBuf; |
612 TMMFState mode = devSoundBuf().iMode; |
616 TMMFState mode = devSoundBuf().iMode; |
613 iAdapter->InitializeL(mode); |
617 iAdapter->InitializeL(mode); |
614 iBufferPlay = NULL; |
618 iBufferPlay = NULL; |
615 iPlayErrorOccured = EFalse; |
619 iPlayErrorOccured = EFalse; |
642 iMsgQueue.Close(); // close if already open |
646 iMsgQueue.Close(); // close if already open |
643 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
647 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
644 User::LeaveIfError(err); |
648 User::LeaveIfError(err); |
645 DoSetClientConfigL();// added here instead of the CreateL() |
649 DoSetClientConfigL();// added here instead of the CreateL() |
646 TMMFDevSoundProxySettingsPckg devSoundBuf; |
650 TMMFDevSoundProxySettingsPckg devSoundBuf; |
647 MmfMessageUtil::ReadL(aMessage,1,devSoundBuf); |
651 User::LeaveIfError(MessageRead(aMessage,1,devSoundBuf)); |
648 iCachedClientData = devSoundBuf; |
652 iCachedClientData = devSoundBuf; |
649 TUid HWDev = devSoundBuf().iHWDev; |
653 TUid HWDev = devSoundBuf().iHWDev; |
650 TMMFState mode = devSoundBuf().iMode; |
654 TMMFState mode = devSoundBuf().iMode; |
651 iAdapter->InitializeL(HWDev, mode); |
655 iAdapter->InitializeL(HWDev, mode); |
652 iBufferPlay = NULL; |
656 iBufferPlay = NULL; |
676 iMsgQueue.Close(); |
680 iMsgQueue.Close(); |
677 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
681 TInt err = iMsgQueue.Open(aMessage, 2, EOwnerThread); // a global queue but owned by thread |
678 User::LeaveIfError(err); |
682 User::LeaveIfError(err); |
679 DoSetClientConfigL();// added here instead of the CreateL() |
683 DoSetClientConfigL();// added here instead of the CreateL() |
680 TMMFDevSoundProxySettingsPckg devSoundBuf; |
684 TMMFDevSoundProxySettingsPckg devSoundBuf; |
681 aMessage.ReadL(TInt(1),devSoundBuf); |
685 User::LeaveIfError(MessageRead(aMessage, TInt(1), devSoundBuf)); |
682 iCachedClientData = devSoundBuf; |
686 iCachedClientData = devSoundBuf; |
683 TFourCC desiredFourCC = devSoundBuf().iDesiredFourCC; |
687 TFourCC desiredFourCC = devSoundBuf().iDesiredFourCC; |
684 TMMFState mode = devSoundBuf().iMode; |
688 TMMFState mode = devSoundBuf().iMode; |
685 iAdapter->InitializeL(desiredFourCC, mode); |
689 iAdapter->InitializeL(desiredFourCC, mode); |
686 iBufferPlay = NULL; |
690 iBufferPlay = NULL; |
753 TBool CMMFDevSoundSession::DoConfigL(const RMmfIpcMessage& aMessage) |
757 TBool CMMFDevSoundSession::DoConfigL(const RMmfIpcMessage& aMessage) |
754 { |
758 { |
755 TMMFDevSoundProxySettings devSoundSet; |
759 TMMFDevSoundProxySettings devSoundSet; |
756 devSoundSet.iConfig = iAdapter->Config(); |
760 devSoundSet.iConfig = iAdapter->Config(); |
757 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
761 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
758 aMessage.WriteL(TInt(2),pckg); |
762 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
759 return ETrue; |
763 return ETrue; |
760 } |
764 } |
761 |
765 |
762 // |
766 // |
763 // CMMFDevSoundSession::DoSetConfigL |
767 // CMMFDevSoundSession::DoSetConfigL |
764 // (other items were commented in a header). |
768 // (other items were commented in a header). |
765 // |
769 // |
766 TBool CMMFDevSoundSession::DoSetConfigL(const RMmfIpcMessage& aMessage) |
770 TBool CMMFDevSoundSession::DoSetConfigL(const RMmfIpcMessage& aMessage) |
767 { |
771 { |
768 TMMFDevSoundProxySettingsPckg devSoundBuf; |
772 TMMFDevSoundProxySettingsPckg devSoundBuf; |
769 aMessage.ReadL(TInt(1),devSoundBuf); |
773 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
770 TMMFCapabilities config = devSoundBuf().iConfig; |
774 TMMFCapabilities config = devSoundBuf().iConfig; |
771 iAdapter->SetConfigL(config); |
775 iAdapter->SetConfigL(config); |
772 iOperationCompletePending = ETrue; |
776 iOperationCompletePending = ETrue; |
773 return EFalse; |
777 return EFalse; |
774 } |
778 } |
780 TBool CMMFDevSoundSession::DoMaxVolumeL(const RMmfIpcMessage& aMessage) |
784 TBool CMMFDevSoundSession::DoMaxVolumeL(const RMmfIpcMessage& aMessage) |
781 { |
785 { |
782 TMMFDevSoundProxySettings devSoundSet; |
786 TMMFDevSoundProxySettings devSoundSet; |
783 devSoundSet.iMaxVolume = iAdapter->MaxVolume(); |
787 devSoundSet.iMaxVolume = iAdapter->MaxVolume(); |
784 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
788 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
785 aMessage.WriteL(TInt(2),pckg); |
789 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
786 return ETrue; |
790 return ETrue; |
787 } |
791 } |
788 |
792 |
789 // |
793 // |
790 // CMMFDevSoundSession::DoVolumeL |
794 // CMMFDevSoundSession::DoVolumeL |
793 TBool CMMFDevSoundSession::DoVolumeL(const RMmfIpcMessage& aMessage) |
797 TBool CMMFDevSoundSession::DoVolumeL(const RMmfIpcMessage& aMessage) |
794 { |
798 { |
795 TMMFDevSoundProxySettings devSoundSet; |
799 TMMFDevSoundProxySettings devSoundSet; |
796 devSoundSet.iVolume = iAdapter->Volume(); |
800 devSoundSet.iVolume = iAdapter->Volume(); |
797 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
801 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
798 aMessage.WriteL(TInt(2),pckg); |
802 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
799 return ETrue; |
803 return ETrue; |
800 } |
804 } |
801 |
805 |
802 // |
806 // |
803 // CMMFDevSoundSession::DoSetVolumeL |
807 // CMMFDevSoundSession::DoSetVolumeL |
804 // (other items were commented in a header). |
808 // (other items were commented in a header). |
805 // |
809 // |
806 TBool CMMFDevSoundSession::DoSetVolumeL(const RMmfIpcMessage& aMessage) |
810 TBool CMMFDevSoundSession::DoSetVolumeL(const RMmfIpcMessage& aMessage) |
807 { |
811 { |
808 TMMFDevSoundProxySettingsPckg devSoundBuf; |
812 TMMFDevSoundProxySettingsPckg devSoundBuf; |
809 aMessage.ReadL(TInt(1),devSoundBuf); |
813 User::LeaveIfError(MessageRead(aMessage, TInt(1),devSoundBuf)); |
810 TInt volume = devSoundBuf().iVolume; |
814 TInt volume = devSoundBuf().iVolume; |
811 TBool asyncOperation; |
815 TBool asyncOperation; |
812 User::LeaveIfError(iAdapter->SetVolume(volume, asyncOperation)); |
816 User::LeaveIfError(iAdapter->SetVolume(volume, asyncOperation)); |
813 iOperationCompletePending = asyncOperation; |
817 iOperationCompletePending = asyncOperation; |
814 return !asyncOperation; |
818 return !asyncOperation; |
821 TBool CMMFDevSoundSession::DoMaxGainL(const RMmfIpcMessage& aMessage) |
825 TBool CMMFDevSoundSession::DoMaxGainL(const RMmfIpcMessage& aMessage) |
822 { |
826 { |
823 TMMFDevSoundProxySettings devSoundSet; |
827 TMMFDevSoundProxySettings devSoundSet; |
824 devSoundSet.iMaxGain = iAdapter->MaxGain(); |
828 devSoundSet.iMaxGain = iAdapter->MaxGain(); |
825 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
829 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
826 aMessage.WriteL(TInt(2),pckg); |
830 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
827 return ETrue; |
831 return ETrue; |
828 } |
832 } |
829 |
833 |
830 // |
834 // |
831 // CMMFDevSoundSession::DoGainL |
835 // CMMFDevSoundSession::DoGainL |
834 TBool CMMFDevSoundSession::DoGainL(const RMmfIpcMessage& aMessage) |
838 TBool CMMFDevSoundSession::DoGainL(const RMmfIpcMessage& aMessage) |
835 { |
839 { |
836 TMMFDevSoundProxySettings devSoundSet; |
840 TMMFDevSoundProxySettings devSoundSet; |
837 devSoundSet.iGain = iAdapter->Gain(); |
841 devSoundSet.iGain = iAdapter->Gain(); |
838 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
842 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
839 aMessage.WriteL(TInt(2),pckg); |
843 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
840 return ETrue; |
844 return ETrue; |
841 } |
845 } |
842 |
846 |
843 // |
847 // |
844 // CMMFDevSoundSession::DoSetGainL |
848 // CMMFDevSoundSession::DoSetGainL |
845 // (other items were commented in a header). |
849 // (other items were commented in a header). |
846 // |
850 // |
847 TBool CMMFDevSoundSession::DoSetGainL(const RMmfIpcMessage& aMessage) |
851 TBool CMMFDevSoundSession::DoSetGainL(const RMmfIpcMessage& aMessage) |
848 { |
852 { |
849 TMMFDevSoundProxySettingsPckg devSoundBuf; |
853 TMMFDevSoundProxySettingsPckg devSoundBuf; |
850 aMessage.ReadL(TInt(1),devSoundBuf); |
854 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
851 TInt gain = devSoundBuf().iGain; |
855 TInt gain = devSoundBuf().iGain; |
852 TBool asyncOperation; |
856 TBool asyncOperation; |
853 User::LeaveIfError(iAdapter->SetGain(gain, asyncOperation)); |
857 User::LeaveIfError(iAdapter->SetGain(gain, asyncOperation)); |
854 iOperationCompletePending = asyncOperation; |
858 iOperationCompletePending = asyncOperation; |
855 return !asyncOperation; |
859 return !asyncOperation; |
862 TBool CMMFDevSoundSession::DoGetPlayBalanceL(const RMmfIpcMessage& aMessage) |
866 TBool CMMFDevSoundSession::DoGetPlayBalanceL(const RMmfIpcMessage& aMessage) |
863 { |
867 { |
864 TMMFDevSoundProxySettings devSoundSet; |
868 TMMFDevSoundProxySettings devSoundSet; |
865 iAdapter->GetPlayBalanceL(devSoundSet.iLeftPercentage, devSoundSet.iRightPercentage); |
869 iAdapter->GetPlayBalanceL(devSoundSet.iLeftPercentage, devSoundSet.iRightPercentage); |
866 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
870 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
867 aMessage.WriteL(TInt(2),pckg); |
871 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
868 return ETrue; |
872 return ETrue; |
869 } |
873 } |
870 |
874 |
871 // |
875 // |
872 // CMMFDevSoundSession::DoSetPlayBalanceL |
876 // CMMFDevSoundSession::DoSetPlayBalanceL |
873 // (other items were commented in a header). |
877 // (other items were commented in a header). |
874 // |
878 // |
875 TBool CMMFDevSoundSession::DoSetPlayBalanceL(const RMmfIpcMessage& aMessage) |
879 TBool CMMFDevSoundSession::DoSetPlayBalanceL(const RMmfIpcMessage& aMessage) |
876 { |
880 { |
877 TMMFDevSoundProxySettingsPckg devSoundBuf; |
881 TMMFDevSoundProxySettingsPckg devSoundBuf; |
878 aMessage.ReadL(TInt(1),devSoundBuf); |
882 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
879 TInt leftPercentage = devSoundBuf().iLeftPercentage; |
883 TInt leftPercentage = devSoundBuf().iLeftPercentage; |
880 TInt rightPercentage = devSoundBuf().iRightPercentage; |
884 TInt rightPercentage = devSoundBuf().iRightPercentage; |
881 TBool asyncOperation; |
885 TBool asyncOperation; |
882 iAdapter->SetPlayBalanceL(leftPercentage, rightPercentage, asyncOperation); |
886 iAdapter->SetPlayBalanceL(leftPercentage, rightPercentage, asyncOperation); |
883 iOperationCompletePending = asyncOperation; |
887 iOperationCompletePending = asyncOperation; |
891 TBool CMMFDevSoundSession::DoGetRecordBalanceL(const RMmfIpcMessage& aMessage) |
895 TBool CMMFDevSoundSession::DoGetRecordBalanceL(const RMmfIpcMessage& aMessage) |
892 { |
896 { |
893 TMMFDevSoundProxySettings devSoundSet; |
897 TMMFDevSoundProxySettings devSoundSet; |
894 iAdapter->GetRecordBalanceL(devSoundSet.iLeftPercentage, devSoundSet.iRightPercentage); |
898 iAdapter->GetRecordBalanceL(devSoundSet.iLeftPercentage, devSoundSet.iRightPercentage); |
895 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
899 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
896 aMessage.WriteL(TInt(2),pckg); |
900 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
897 return ETrue; |
901 return ETrue; |
898 } |
902 } |
899 |
903 |
900 // |
904 // |
901 // CMMFDevSoundSession::DoSetRecordBalanceL |
905 // CMMFDevSoundSession::DoSetRecordBalanceL |
902 // (other items were commented in a header). |
906 // (other items were commented in a header). |
903 // |
907 // |
904 TBool CMMFDevSoundSession::DoSetRecordBalanceL(const RMmfIpcMessage& aMessage) |
908 TBool CMMFDevSoundSession::DoSetRecordBalanceL(const RMmfIpcMessage& aMessage) |
905 { |
909 { |
906 TMMFDevSoundProxySettingsPckg devSoundBuf; |
910 TMMFDevSoundProxySettingsPckg devSoundBuf; |
907 aMessage.ReadL(TInt(1),devSoundBuf); |
911 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
908 TInt leftPercentage = devSoundBuf().iLeftPercentage; |
912 TInt leftPercentage = devSoundBuf().iLeftPercentage; |
909 TInt rightPercentage = devSoundBuf().iRightPercentage; |
913 TInt rightPercentage = devSoundBuf().iRightPercentage; |
910 TBool asyncOperation; |
914 TBool asyncOperation; |
911 iAdapter->SetRecordBalanceL(leftPercentage, rightPercentage, asyncOperation); |
915 iAdapter->SetRecordBalanceL(leftPercentage, rightPercentage, asyncOperation); |
912 iOperationCompletePending = asyncOperation; |
916 iOperationCompletePending = asyncOperation; |
968 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDataL - Ignore and Exit")); |
972 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDataL - Ignore and Exit")); |
969 return ETrue; |
973 return ETrue; |
970 } |
974 } |
971 |
975 |
972 TMMFDevSoundProxyHwBufPckg devSoundBuf; |
976 TMMFDevSoundProxyHwBufPckg devSoundBuf; |
973 aMessage.ReadL(TInt(1),devSoundBuf); |
977 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
974 iBufferPlay->SetLastBuffer(devSoundBuf().iLastBuffer); |
978 iBufferPlay->SetLastBuffer(devSoundBuf().iLastBuffer); |
975 |
979 |
976 TPtr8 dataPtr(iChunk.Base(), devSoundBuf().iBufferSize, devSoundBuf().iBufferSize); |
980 TPtr8 dataPtr(iChunk.Base(), devSoundBuf().iBufferSize, devSoundBuf().iBufferSize); |
977 // Copy data over from chunk |
981 // Copy data over from chunk |
978 iBufferPlay->Data().Copy(dataPtr); |
982 iBufferPlay->Data().Copy(dataPtr); |
1000 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoStopL - Enter")); |
1004 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoStopL - Enter")); |
1001 // Sometimes Stop is not involved on a commit cycle |
1005 // Sometimes Stop is not involved on a commit cycle |
1002 TBool completed = iAdapter->Stop(); |
1006 TBool completed = iAdapter->Stop(); |
1003 if (completed) |
1007 if (completed) |
1004 { |
1008 { |
1005 iQueuedRequests.Reset(); |
1009 FlushQueuedRequests(); |
1006 FlushEventQueue(); // completed returned here means we were idle to start with. TODO could possibly skip this flush |
1010 FlushEventQueue(); // completed returned here means we were idle to start with. TODO could possibly skip this flush |
1007 iChunk.Close(); |
1011 iChunk.Close(); |
1008 } |
1012 } |
1009 iOperationCompletePending = !completed; |
1013 iOperationCompletePending = !completed; |
1010 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoStopL - Exit. Return value is [%d]"), completed); |
1014 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoStopL - Exit. Return value is [%d]"), completed); |
1028 // |
1032 // |
1029 TBool CMMFDevSoundSession::DoPlayToneL(const RMmfIpcMessage& aMessage) |
1033 TBool CMMFDevSoundSession::DoPlayToneL(const RMmfIpcMessage& aMessage) |
1030 { |
1034 { |
1031 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayToneL - Enter")); |
1035 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayToneL - Enter")); |
1032 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1036 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1033 aMessage.ReadL(TInt(1),devSoundBuf); |
1037 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
1034 iCachedClientData = devSoundBuf; |
1038 iCachedClientData = devSoundBuf; |
1035 TInt frequency = devSoundBuf().iFrequencyOne; |
1039 TInt frequency = devSoundBuf().iFrequencyOne; |
1036 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
1040 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
1037 iAdapter->PlayToneL(frequency, duration); |
1041 iAdapter->PlayToneL(frequency, duration); |
1038 iOperationCompletePending = ETrue; |
1042 iOperationCompletePending = ETrue; |
1058 // |
1062 // |
1059 TBool CMMFDevSoundSession::DoPlayDualToneL(const RMmfIpcMessage& aMessage) |
1063 TBool CMMFDevSoundSession::DoPlayDualToneL(const RMmfIpcMessage& aMessage) |
1060 { |
1064 { |
1061 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDualToneL - Enter")); |
1065 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDualToneL - Enter")); |
1062 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1066 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1063 aMessage.ReadL(TInt(1),devSoundBuf); |
1067 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
1064 iCachedClientData = devSoundBuf; |
1068 iCachedClientData = devSoundBuf; |
1065 TInt frequencyOne = devSoundBuf().iFrequencyOne; |
1069 TInt frequencyOne = devSoundBuf().iFrequencyOne; |
1066 TInt frequencyTwo = devSoundBuf().iFrequencyTwo; |
1070 TInt frequencyTwo = devSoundBuf().iFrequencyTwo; |
1067 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
1071 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
1068 iAdapter->PlayDualToneL(frequencyOne, frequencyTwo, duration); |
1072 iAdapter->PlayDualToneL(frequencyOne, frequencyTwo, duration); |
1099 iDtmfString = NULL; |
1103 iDtmfString = NULL; |
1100 } |
1104 } |
1101 |
1105 |
1102 iDtmfString = HBufC::NewL(dtmfLength); |
1106 iDtmfString = HBufC::NewL(dtmfLength); |
1103 TPtr dtmfPtr = iDtmfString->Des(); |
1107 TPtr dtmfPtr = iDtmfString->Des(); |
1104 aMessage.ReadL(TInt(2), dtmfPtr); |
1108 User::LeaveIfError(MessageRead(aMessage, TInt(2), dtmfPtr)); |
1105 |
|
1106 iAdapter->PlayDTMFStringL(*iDtmfString); |
1109 iAdapter->PlayDTMFStringL(*iDtmfString); |
1107 iOperationCompletePending = ETrue; |
1110 iOperationCompletePending = ETrue; |
1108 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayDTMFStringL - Exit. Return value is [%d]"), ETrue); |
1111 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayDTMFStringL - Exit. Return value is [%d]"), ETrue); |
1109 return ETrue; |
1112 return ETrue; |
1110 } |
1113 } |
1134 iToneSeqBuf = NULL; |
1137 iToneSeqBuf = NULL; |
1135 } |
1138 } |
1136 |
1139 |
1137 iToneSeqBuf = HBufC8::NewL(toneLength); |
1140 iToneSeqBuf = HBufC8::NewL(toneLength); |
1138 TPtr8 toneSeqPtr = iToneSeqBuf->Des(); |
1141 TPtr8 toneSeqPtr = iToneSeqBuf->Des(); |
1139 aMessage.ReadL(TInt(1), toneSeqPtr); |
1142 User::LeaveIfError(MessageRead(aMessage,TInt(1), toneSeqPtr)); |
1140 |
1143 |
1141 iAdapter->PlayToneSequenceL(*iToneSeqBuf); |
1144 iAdapter->PlayToneSequenceL(*iToneSeqBuf); |
1142 iOperationCompletePending = ETrue; |
1145 iOperationCompletePending = ETrue; |
1143 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayToneSequenceL - Exit. Return value is [%d]"), ETrue); |
1146 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayToneSequenceL - Exit. Return value is [%d]"), ETrue); |
1144 return ETrue; |
1147 return ETrue; |
1160 // |
1163 // |
1161 TBool CMMFDevSoundSession::DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage) |
1164 TBool CMMFDevSoundSession::DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage) |
1162 { |
1165 { |
1163 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Enter")); |
1166 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Enter")); |
1164 TPckgBuf<TInt> buf; |
1167 TPckgBuf<TInt> buf; |
1165 aMessage.ReadL(TInt(1),buf); |
1168 User::LeaveIfError(MessageRead(aMessage,TInt(1),buf)); |
1166 TInt seqNum = buf(); |
1169 TInt seqNum = buf(); |
1167 iSeqNum = seqNum; |
1170 iSeqNum = seqNum; |
1168 iAdapter->PlayFixedSequenceL(seqNum); |
1171 iAdapter->PlayFixedSequenceL(seqNum); |
1169 iOperationCompletePending = ETrue; |
1172 iOperationCompletePending = ETrue; |
1170 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Exit. Return value is [%d]"), ETrue); |
1173 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Exit. Return value is [%d]"), ETrue); |
1187 // |
1190 // |
1188 TBool CMMFDevSoundSession::DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage) |
1191 TBool CMMFDevSoundSession::DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage) |
1189 { |
1192 { |
1190 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetDTMFLengthsL - Enter")); |
1193 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetDTMFLengthsL - Enter")); |
1191 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1194 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1192 aMessage.ReadL(TInt(1),devSoundBuf); |
1195 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
1193 TTimeIntervalMicroSeconds32 toneOnLength = devSoundBuf().iToneOnLength; |
1196 TTimeIntervalMicroSeconds32 toneOnLength = devSoundBuf().iToneOnLength; |
1194 TTimeIntervalMicroSeconds32 toneOffLength = devSoundBuf().iToneOffLength; |
1197 TTimeIntervalMicroSeconds32 toneOffLength = devSoundBuf().iToneOffLength; |
1195 TTimeIntervalMicroSeconds32 pauseLength = devSoundBuf().iPauseLength; |
1198 TTimeIntervalMicroSeconds32 pauseLength = devSoundBuf().iPauseLength; |
1196 User::LeaveIfError(iAdapter->SetDTMFLengths(toneOnLength, toneOffLength, pauseLength)); |
1199 User::LeaveIfError(iAdapter->SetDTMFLengths(toneOnLength, toneOffLength, pauseLength)); |
1197 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetDTMFLengthsL - Exit. Return value is [%d]"), ETrue); |
1200 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetDTMFLengthsL - Exit. Return value is [%d]"), ETrue); |
1204 // |
1207 // |
1205 TBool CMMFDevSoundSession::DoSetVolumeRampL(const RMmfIpcMessage& aMessage) |
1208 TBool CMMFDevSoundSession::DoSetVolumeRampL(const RMmfIpcMessage& aMessage) |
1206 { |
1209 { |
1207 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Enter")); |
1210 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Enter")); |
1208 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1211 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1209 aMessage.ReadL(TInt(1),devSoundBuf); |
1212 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
1210 TTimeIntervalMicroSeconds duration = devSoundBuf().iDuration; |
1213 TTimeIntervalMicroSeconds duration = devSoundBuf().iDuration; |
1211 User::LeaveIfError(iAdapter->SetVolumeRamp(duration)); |
1214 User::LeaveIfError(iAdapter->SetVolumeRamp(duration)); |
1212 iOperationCompletePending = EFalse; // Volume ramp doesn't result on commit |
1215 iOperationCompletePending = EFalse; // Volume ramp doesn't result on commit |
1213 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Exit. Return value is [%d]"), ETrue); |
1216 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Exit. Return value is [%d]"), ETrue); |
1214 return ETrue; // operation complete |
1217 return ETrue; // operation complete |
1222 const RMmfIpcMessage& aMessage) |
1225 const RMmfIpcMessage& aMessage) |
1223 { |
1226 { |
1224 iArray.Reset(); |
1227 iArray.Reset(); |
1225 |
1228 |
1226 TMMFPrioritySettingsPckg prioritySetBuf; |
1229 TMMFPrioritySettingsPckg prioritySetBuf; |
1227 aMessage.ReadL(TInt(1),prioritySetBuf); |
1230 User::LeaveIfError(MessageRead(aMessage,TInt(1),prioritySetBuf)); |
1228 TMMFPrioritySettings prioritySet = prioritySetBuf(); |
1231 TMMFPrioritySettings prioritySet = prioritySetBuf(); |
1229 |
1232 |
1230 iAdapter->GetSupportedInputDataTypesL(iArray, prioritySet); |
1233 iAdapter->GetSupportedInputDataTypesL(iArray, prioritySet); |
1231 |
1234 |
1232 TPckgBuf<TInt> pckg; |
1235 TPckgBuf<TInt> pckg; |
1233 pckg() = iArray.Count(); |
1236 pckg() = iArray.Count(); |
1234 aMessage.WriteL(TInt(2),pckg); |
1237 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
1235 |
1238 |
1236 return ETrue; |
1239 return ETrue; |
1237 } |
1240 } |
1238 |
1241 |
1239 // |
1242 // |
1244 const RMmfIpcMessage& aMessage) |
1247 const RMmfIpcMessage& aMessage) |
1245 { |
1248 { |
1246 iArray.Reset(); |
1249 iArray.Reset(); |
1247 |
1250 |
1248 TMMFPrioritySettingsPckg prioritySetBuf; |
1251 TMMFPrioritySettingsPckg prioritySetBuf; |
1249 aMessage.ReadL(TInt(1),prioritySetBuf); |
1252 User::LeaveIfError(MessageRead(aMessage,TInt(1),prioritySetBuf)); |
1250 TMMFPrioritySettings prioritySet = prioritySetBuf(); |
1253 TMMFPrioritySettings prioritySet = prioritySetBuf(); |
1251 |
1254 |
1252 iAdapter->GetSupportedOutputDataTypesL(iArray, prioritySet); |
1255 iAdapter->GetSupportedOutputDataTypesL(iArray, prioritySet); |
1253 |
1256 |
1254 TPckgBuf<TInt> pckg; |
1257 TPckgBuf<TInt> pckg; |
1255 pckg() = iArray.Count(); |
1258 pckg() = iArray.Count(); |
1256 aMessage.WriteL(TInt(2),pckg); |
1259 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
1257 |
1260 |
1258 return ETrue; |
1261 return ETrue; |
1259 } |
1262 } |
1260 |
1263 |
1261 // |
1264 // |
1264 // |
1267 // |
1265 TBool CMMFDevSoundSession::DoSamplesRecordedL(const RMmfIpcMessage& aMessage) |
1268 TBool CMMFDevSoundSession::DoSamplesRecordedL(const RMmfIpcMessage& aMessage) |
1266 { |
1269 { |
1267 TPckgBuf<TInt> pckg; |
1270 TPckgBuf<TInt> pckg; |
1268 pckg() = iAdapter->SamplesRecorded(); |
1271 pckg() = iAdapter->SamplesRecorded(); |
1269 aMessage.WriteL(TInt(2),pckg); |
1272 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
1270 return ETrue; |
1273 return ETrue; |
1271 } |
1274 } |
1272 |
1275 |
1273 // |
1276 // |
1274 // CMMFDevSoundSession::DoSamplesPlayedL |
1277 // CMMFDevSoundSession::DoSamplesPlayedL |
1276 // |
1279 // |
1277 TBool CMMFDevSoundSession::DoSamplesPlayedL(const RMmfIpcMessage& aMessage) |
1280 TBool CMMFDevSoundSession::DoSamplesPlayedL(const RMmfIpcMessage& aMessage) |
1278 { |
1281 { |
1279 TPckgBuf<TInt> pckg; |
1282 TPckgBuf<TInt> pckg; |
1280 pckg() = iAdapter->SamplesPlayed(); |
1283 pckg() = iAdapter->SamplesPlayed(); |
1281 aMessage.WriteL(TInt(2),pckg); |
1284 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
1282 return ETrue; |
1285 return ETrue; |
1283 } |
1286 } |
1284 |
1287 |
1285 // |
1288 // |
1286 // CMMFDevSoundSession::DoSetToneRepeatsL |
1289 // CMMFDevSoundSession::DoSetToneRepeatsL |
1288 // |
1291 // |
1289 TBool CMMFDevSoundSession::DoSetToneRepeatsL(const RMmfIpcMessage& aMessage) |
1292 TBool CMMFDevSoundSession::DoSetToneRepeatsL(const RMmfIpcMessage& aMessage) |
1290 { |
1293 { |
1291 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Enter")); |
1294 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Enter")); |
1292 TPckgBuf<TInt> countRepeat; |
1295 TPckgBuf<TInt> countRepeat; |
1293 aMessage.ReadL(TInt(1),countRepeat); |
1296 User::LeaveIfError(MessageRead(aMessage,TInt(1),countRepeat)); |
1294 |
1297 |
1295 TPckgBuf<TTimeIntervalMicroSeconds> repeatTS; |
1298 TPckgBuf<TTimeIntervalMicroSeconds> repeatTS; |
1296 aMessage.ReadL(TInt(2),repeatTS); |
1299 User::LeaveIfError(MessageRead(aMessage,TInt(2),repeatTS)); |
1297 User::LeaveIfError(iAdapter->SetToneRepeats(countRepeat(), repeatTS())); |
1300 User::LeaveIfError(iAdapter->SetToneRepeats(countRepeat(), repeatTS())); |
1298 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Exit. Return value is [%d]"), ETrue); |
1301 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Exit. Return value is [%d]"), ETrue); |
1299 return ETrue; |
1302 return ETrue; |
1300 } |
1303 } |
1301 |
1304 |
1305 // |
1308 // |
1306 TBool CMMFDevSoundSession::DoSetPrioritySettingsL( |
1309 TBool CMMFDevSoundSession::DoSetPrioritySettingsL( |
1307 const RMmfIpcMessage& aMessage) |
1310 const RMmfIpcMessage& aMessage) |
1308 { |
1311 { |
1309 TPckgBuf<TMMFPrioritySettings> prioritySet; |
1312 TPckgBuf<TMMFPrioritySettings> prioritySet; |
1310 aMessage.ReadL(TInt(1),prioritySet); |
1313 User::LeaveIfError(MessageRead(aMessage,TInt(1),prioritySet)); |
1311 |
1314 |
1312 User::LeaveIfError(iAdapter->SetPrioritySettings(prioritySet())); |
1315 User::LeaveIfError(iAdapter->SetPrioritySettings(prioritySet())); |
1313 iOperationCompletePending = EFalse; |
1316 iOperationCompletePending = EFalse; |
1314 return ETrue; |
1317 return ETrue; |
1315 } |
1318 } |
1324 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoFixedSequenceCountL - Enter")); |
1327 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoFixedSequenceCountL - Enter")); |
1325 TPckgBuf<TInt> fixSeqCountPckg; |
1328 TPckgBuf<TInt> fixSeqCountPckg; |
1326 TInt fixSeqCount = iAdapter->FixedSequenceCount(); |
1329 TInt fixSeqCount = iAdapter->FixedSequenceCount(); |
1327 fixSeqCountPckg = fixSeqCount; |
1330 fixSeqCountPckg = fixSeqCount; |
1328 |
1331 |
1329 aMessage.WriteL(TInt(2),fixSeqCountPckg); |
1332 User::LeaveIfError(MessageWrite(aMessage,TInt(2),fixSeqCountPckg)); |
1330 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoFixedSequenceCountL - Exit. Return value is [%d]"), ETrue); |
1333 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoFixedSequenceCountL - Exit. Return value is [%d]"), ETrue); |
1331 return ETrue; |
1334 return ETrue; |
1332 } |
1335 } |
1333 |
1336 |
1334 |
1337 |
1352 while (i < count) |
1355 while (i < count) |
1353 { |
1356 { |
1354 stream.WriteInt32L(iArray[i].FourCC()); |
1357 stream.WriteInt32L(iArray[i].FourCC()); |
1355 i++; |
1358 i++; |
1356 } |
1359 } |
1357 aMessage.WriteL(TInt(2), dataCopyBuffer->Ptr(0)); |
1360 User::LeaveIfError(MessageWrite(aMessage, TInt(2), dataCopyBuffer->Ptr(0))); |
1358 stream.Close(); |
1361 stream.Close(); |
1359 CleanupStack::PopAndDestroy(&stream); |
1362 CleanupStack::PopAndDestroy(&stream); |
1360 CleanupStack::PopAndDestroy(dataCopyBuffer); |
1363 CleanupStack::PopAndDestroy(dataCopyBuffer); |
1361 return ETrue; |
1364 return ETrue; |
1362 } |
1365 } |
1375 { |
1378 { |
1376 aMessage.Complete(KErrBadHandle); |
1379 aMessage.Complete(KErrBadHandle); |
1377 return EFalse; |
1380 return EFalse; |
1378 } |
1381 } |
1379 TPckgBuf<TInt> requestChunkBuf; |
1382 TPckgBuf<TInt> requestChunkBuf; |
1380 MmfMessageUtil::Read(aMessage, TInt(1), requestChunkBuf); |
1383 User::LeaveIfError(MessageRead(aMessage, TInt(1), requestChunkBuf)); |
1381 TBool requestChunk = requestChunkBuf(); |
1384 TBool requestChunk = requestChunkBuf(); |
1382 if (requestChunk) |
1385 if (requestChunk) |
1383 { |
1386 { |
1384 // if the client requests, always do EOpen |
1387 // if the client requests, always do EOpen |
1385 iHwBufPckgFill().iChunkOp = EOpen; |
1388 iHwBufPckgFill().iChunkOp = EOpen; |
1386 } |
1389 } |
1387 TInt err = MmfMessageUtil::Write(aMessage, TInt(2), iHwBufPckgFill); |
1390 TInt err = MessageWrite(aMessage, TInt(2), iHwBufPckgFill); |
1388 if ( (err == KErrNone) && (iHwBufPckgFill().iChunkOp == EOpen) ) |
1391 if ( (err == KErrNone) && (iHwBufPckgFill().iChunkOp == EOpen) ) |
1389 { |
1392 { |
1390 aMessage.Complete(iChunk); |
1393 aMessage.Complete(iChunk); |
1391 } |
1394 } |
1392 else |
1395 else |
1408 { |
1411 { |
1409 aMessage.Complete(KErrBadHandle); |
1412 aMessage.Complete(KErrBadHandle); |
1410 return EFalse; |
1413 return EFalse; |
1411 } |
1414 } |
1412 |
1415 |
1413 TInt err = MmfMessageUtil::Write(aMessage, TInt(2), iHwBufPckgEmpty); |
1416 TInt err = MessageWrite(aMessage, TInt(2), iHwBufPckgEmpty); |
1414 if ( (err == KErrNone) && (iHwBufPckgEmpty().iChunkOp == EOpen) ) |
1417 if ( (err == KErrNone) && (iHwBufPckgEmpty().iChunkOp == EOpen) ) |
1415 { |
1418 { |
1416 aMessage.Complete(iChunk); |
1419 aMessage.Complete(iChunk); |
1417 } |
1420 } |
1418 else |
1421 else |
1454 if (err != KErrNone) |
1457 if (err != KErrNone) |
1455 { |
1458 { |
1456 aMessage.Complete(err); |
1459 aMessage.Complete(err); |
1457 return EFalse; |
1460 return EFalse; |
1458 } |
1461 } |
1459 aMessage.WriteL(TInt(2),timePckg); |
1462 User::LeaveIfError(MessageWrite(aMessage,TInt(2),timePckg)); |
1460 return ETrue; |
1463 return ETrue; |
1461 } |
1464 } |
1462 |
1465 |
1463 TBool CMMFDevSoundSession::DoQueryResumeSupportedL(const RMmfIpcMessage& aMessage) |
1466 TBool CMMFDevSoundSession::DoQueryResumeSupportedL(const RMmfIpcMessage& aMessage) |
1464 { |
1467 { |
1465 TBool isSupported = EFalse; |
1468 TBool isSupported = EFalse; |
1466 TPckgBuf<TBool> isSupportedPckg(isSupported); |
1469 TPckgBuf<TBool> isSupportedPckg(isSupported); |
1467 isSupportedPckg() = iAdapter->IsResumeSupported(); |
1470 isSupportedPckg() = iAdapter->IsResumeSupported(); |
1468 aMessage.WriteL(TInt(2),isSupportedPckg); |
1471 User::LeaveIfError(MessageWrite(aMessage,TInt(2),isSupportedPckg)); |
1469 return ETrue; |
1472 return ETrue; |
1470 } |
1473 } |
1471 |
1474 |
1472 TBool CMMFDevSoundSession::DoResumeL(const RMmfIpcMessage& /*aMessage*/) |
1475 TBool CMMFDevSoundSession::DoResumeL(const RMmfIpcMessage& /*aMessage*/) |
1473 { |
1476 { |
1520 // |
1523 // |
1521 // CMMFDevSoundSession::CMMFDevSoundSession |
1524 // CMMFDevSoundSession::CMMFDevSoundSession |
1522 // (other items were commented in a header). |
1525 // (other items were commented in a header). |
1523 // |
1526 // |
1524 CMMFDevSoundSession::CMMFDevSoundSession() : |
1527 CMMFDevSoundSession::CMMFDevSoundSession() : |
1525 iSetClientConfigApplied (EFalse) |
1528 iSetClientConfigApplied (EFalse), |
1529 iDisconnecting (EFalse) |
|
1526 { |
1530 { |
1527 } |
1531 } |
1528 |
1532 |
1529 // |
1533 // |
1530 // CMMFDevSoundSession::~CMMFDevSoundSession |
1534 // CMMFDevSoundSession::~CMMFDevSoundSession |
1638 // (other items were commented in a header). |
1642 // (other items were commented in a header). |
1639 // |
1643 // |
1640 void CMMFDevSoundSession::Disconnect(const RMessage2& aMessage) |
1644 void CMMFDevSoundSession::Disconnect(const RMessage2& aMessage) |
1641 { |
1645 { |
1642 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Enter")); |
1646 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Enter")); |
1647 iDisconnecting = ETrue; |
|
1648 |
|
1643 if (NeedToQueue()) |
1649 if (NeedToQueue()) |
1644 { |
1650 { |
1645 // if we are in the middle of something, enqueue and wait |
1651 // if we are in the middle of something, enqueue and wait |
1646 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Add to queue")); |
1652 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Add to queue")); |
1647 EnqueueRequest(aMessage); |
1653 EnqueueRequest(aMessage); |
2104 if(iOperationCompletePending && aCanStartNewOperation) |
2110 if(iOperationCompletePending && aCanStartNewOperation) |
2105 { |
2111 { |
2106 if (iRequestBeingServiced.Function()==EMMFDevSoundProxyStop) |
2112 if (iRequestBeingServiced.Function()==EMMFDevSoundProxyStop) |
2107 { |
2113 { |
2108 // flush the queue - will have removed any stale items added between initial call and MMRC's reaction |
2114 // flush the queue - will have removed any stale items added between initial call and MMRC's reaction |
2109 iQueuedRequests.Reset(); |
2115 FlushQueuedRequests(); |
2110 FlushEventQueue(); |
2116 FlushEventQueue(); |
2111 iChunk.Close(); |
2117 iChunk.Close(); |
2112 } |
2118 } |
2113 |
2119 |
2114 if(iRequestBeingServiced.Function()==EMMFDevSoundProxyCapabilities) |
2120 if(iRequestBeingServiced.Function()==EMMFDevSoundProxyCapabilities) |
2115 { |
2121 { |
2116 TMMFDevSoundProxySettings devSoundSet; |
2122 TMMFDevSoundProxySettings devSoundSet; |
2117 devSoundSet.iCaps = iDevSoundCapabilities; |
2123 devSoundSet.iCaps = iDevSoundCapabilities; |
2118 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
2124 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
2119 iRequestBeingServiced.Message().Write(TInt(2),pckg); |
2125 MessageWrite(iRequestBeingServiced.Message(),TInt(2),pckg); |
2120 } |
2126 } |
2121 |
2127 |
2122 if(iRequestBeingServiced.Function()==EMMFDevSoundProxyCancelInitialize) |
2128 if(iRequestBeingServiced.Function()==EMMFDevSoundProxyCancelInitialize) |
2123 { |
2129 { |
2124 FlushEventQueue(); |
2130 FlushEventQueue(); |
2539 |
2545 |
2540 |
2546 |
2541 TBool CMMFDevSoundSession::DoRegisterAsClientL(const RMmfIpcMessage& aMessage) |
2547 TBool CMMFDevSoundSession::DoRegisterAsClientL(const RMmfIpcMessage& aMessage) |
2542 { |
2548 { |
2543 TMMFDevSoundProxySettingsPckg buf; |
2549 TMMFDevSoundProxySettingsPckg buf; |
2544 aMessage.ReadL(0,buf); |
2550 User::LeaveIfError(MessageRead(aMessage,0,buf)); |
2545 HBufC8* notificationRegistrationData = NULL; |
2551 HBufC8* notificationRegistrationData = NULL; |
2546 notificationRegistrationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesLengthL(1))); |
2552 notificationRegistrationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesLengthL(1))); |
2547 TPtr8 dataPtr(notificationRegistrationData->Des()); |
2553 TPtr8 dataPtr(notificationRegistrationData->Des()); |
2548 aMessage.ReadL(1,dataPtr); |
2554 User::LeaveIfError(MessageRead(aMessage,1,dataPtr)); |
2549 DoSetClientConfigL();// added here instead of the CreateL() |
2555 DoSetClientConfigL();// added here instead of the CreateL() |
2550 TInt err = KErrNone; |
2556 TInt err = KErrNone; |
2551 err = iAdapter->RegisterAsClient(buf().iNotificationEventUid,dataPtr); |
2557 err = iAdapter->RegisterAsClient(buf().iNotificationEventUid,dataPtr); |
2552 CleanupStack::PopAndDestroy(1); // Notification Registeration data |
2558 CleanupStack::PopAndDestroy(1); // Notification Registeration data |
2553 if (err != KErrNone) |
2559 if (err != KErrNone) |
2559 } |
2565 } |
2560 |
2566 |
2561 TBool CMMFDevSoundSession::DoCancelRegisterAsClientL(const RMmfIpcMessage& aMessage) |
2567 TBool CMMFDevSoundSession::DoCancelRegisterAsClientL(const RMmfIpcMessage& aMessage) |
2562 { |
2568 { |
2563 TMMFDevSoundProxySettingsPckg buf; |
2569 TMMFDevSoundProxySettingsPckg buf; |
2564 aMessage.ReadL(0,buf); |
2570 User::LeaveIfError(MessageRead(aMessage,0,buf)); |
2565 TInt err = KErrNone; |
2571 TInt err = KErrNone; |
2566 err = iAdapter->CancelRegisterAsClient(buf().iNotificationEventUid); |
2572 err = iAdapter->CancelRegisterAsClient(buf().iNotificationEventUid); |
2567 if (err != KErrNone) |
2573 if (err != KErrNone) |
2568 { |
2574 { |
2569 aMessage.Complete(err); |
2575 aMessage.Complete(err); |
2573 } |
2579 } |
2574 |
2580 |
2575 TBool CMMFDevSoundSession::DoGetResourceNotificationDataL(const RMmfIpcMessage& aMessage) |
2581 TBool CMMFDevSoundSession::DoGetResourceNotificationDataL(const RMmfIpcMessage& aMessage) |
2576 { |
2582 { |
2577 TMMFDevSoundProxySettingsPckg buf; |
2583 TMMFDevSoundProxySettingsPckg buf; |
2578 aMessage.ReadL(0,buf); |
2584 User::LeaveIfError(MessageRead(aMessage,0,buf)); |
2579 HBufC8* notificationData = NULL; |
2585 HBufC8* notificationData = NULL; |
2580 notificationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesMaxLengthL(2))); |
2586 notificationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesMaxLengthL(2))); |
2581 TPtr8 dataPtr(notificationData->Des()); |
2587 TPtr8 dataPtr(notificationData->Des()); |
2582 aMessage.ReadL(2,dataPtr); |
2588 User::LeaveIfError(MessageRead(aMessage,2,dataPtr)); |
2583 TInt err = KErrNone; |
2589 TInt err = KErrNone; |
2584 err = iAdapter->GetResourceNotificationData(buf().iNotificationEventUid,dataPtr); |
2590 err = iAdapter->GetResourceNotificationData(buf().iNotificationEventUid,dataPtr); |
2585 aMessage.WriteL(2,*notificationData); |
2591 User::LeaveIfError(MessageWrite(aMessage,2,*notificationData)); |
2586 CleanupStack::PopAndDestroy(1); // Notification data |
2592 CleanupStack::PopAndDestroy(1); // Notification data |
2587 if (err != KErrNone) |
2593 if (err != KErrNone) |
2588 { |
2594 { |
2589 aMessage.Complete(err); |
2595 aMessage.Complete(err); |
2590 return EFalse; |
2596 return EFalse; |
2609 if(!iSetClientConfigApplied) |
2615 if(!iSetClientConfigApplied) |
2610 { |
2616 { |
2611 if (aMessage.HasCapability(ECapabilityMultimediaDD) && aMessage.HasCapability(ECapabilityUserEnvironment)) |
2617 if (aMessage.HasCapability(ECapabilityMultimediaDD) && aMessage.HasCapability(ECapabilityUserEnvironment)) |
2612 { |
2618 { |
2613 TPckgBuf<TThreadId> threadId; |
2619 TPckgBuf<TThreadId> threadId; |
2614 aMessage.ReadL(1, threadId); |
2620 User::LeaveIfError(MessageRead(aMessage, 1, threadId)); |
2615 |
2621 |
2616 CMMFDevSoundServer* server = |
2622 CMMFDevSoundServer* server = |
2617 const_cast<CMMFDevSoundServer*>(static_cast<const CMMFDevSoundServer*>(Server())); |
2623 const_cast<CMMFDevSoundServer*>(static_cast<const CMMFDevSoundServer*>(Server())); |
2618 server->SetClientProcessIdL(threadId()); |
2624 server->SetClientProcessIdL(threadId()); |
2619 } |
2625 } |
2638 { |
2644 { |
2639 // this will generate an processing error event and callback |
2645 // this will generate an processing error event and callback |
2640 iAdapter->BufferErrorEvent(); |
2646 iAdapter->BufferErrorEvent(); |
2641 } |
2647 } |
2642 |
2648 |
2649 void CMMFDevSoundSession::FlushQueuedRequests() |
|
2650 { |
|
2651 for (TInt queueIndex = (iQueuedRequests.Count() - 1); queueIndex >= 0; --queueIndex) |
|
2652 { |
|
2653 if ((iQueuedRequests[queueIndex].Type() == TMMFDevSoundRequest::ESessionEvents) && |
|
2654 (iQueuedRequests[queueIndex].Function() == RMessage2::EDisConnect)) |
|
2655 { |
|
2656 continue; |
|
2657 } |
|
2658 iQueuedRequests.Remove(queueIndex); |
|
2659 } |
|
2660 } |
|
2661 |
|
2662 TInt CMMFDevSoundSession::MessageRead(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult) |
|
2663 { |
|
2664 if (!iDisconnecting) |
|
2665 { |
|
2666 return MmfMessageUtil::Read(aMessage, aParam, aResult); |
|
2667 } |
|
2668 return KErrBadHandle; |
|
2669 } |
|
2670 |
|
2671 TInt CMMFDevSoundSession::MessageRead(const RMmfIpcMessage& aMessage, TInt aParam, TDes16& aResult) |
|
2672 { |
|
2673 if (!iDisconnecting) |
|
2674 { |
|
2675 return aMessage.Read(aParam, aResult); |
|
2676 } |
|
2677 return KErrBadHandle; |
|
2678 } |
|
2679 |
|
2680 TInt CMMFDevSoundSession::MessageWrite(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue) |
|
2681 { |
|
2682 if (!iDisconnecting) |
|
2683 { |
|
2684 return MmfMessageUtil::Write(aMessage, aParam, aValue); |
|
2685 } |
|
2686 return KErrBadHandle; |
|
2687 } |
|
2688 |
|
2643 void CMMFDevSoundSession::ResetNotifiedError() |
2689 void CMMFDevSoundSession::ResetNotifiedError() |
2644 // called at beginning of commit cycle, so any error will be from callbacks |
2690 // called at beginning of commit cycle, so any error will be from callbacks |
2645 { |
2691 { |
2646 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::ResetNotifiedError")); |
2692 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::ResetNotifiedError")); |
2647 iNotifiedError = KErrNone; |
2693 iNotifiedError = KErrNone; |