branch | RCL_3 |
changeset 65 | af86cc8a4692 |
parent 23 | 545d349d14da |
55:e51ae4fd18e6 | 65:af86cc8a4692 |
---|---|
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; |
716 |
720 |
717 if (err != KErrNone) |
721 if (err != KErrNone) |
718 { |
722 { |
719 aMessage.Complete(err); |
723 aMessage.Complete(err); |
720 iOperationCompletePending = EFalse; |
724 iOperationCompletePending = EFalse; |
721 return ETrue; |
|
722 } |
725 } |
723 else |
726 else |
724 { |
727 { |
725 iOperationCompletePending = ETrue; |
728 iOperationCompletePending = ETrue; |
726 } |
729 } |
753 TBool CMMFDevSoundSession::DoConfigL(const RMmfIpcMessage& aMessage) |
756 TBool CMMFDevSoundSession::DoConfigL(const RMmfIpcMessage& aMessage) |
754 { |
757 { |
755 TMMFDevSoundProxySettings devSoundSet; |
758 TMMFDevSoundProxySettings devSoundSet; |
756 devSoundSet.iConfig = iAdapter->Config(); |
759 devSoundSet.iConfig = iAdapter->Config(); |
757 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
760 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
758 aMessage.WriteL(TInt(2),pckg); |
761 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
759 return ETrue; |
762 return ETrue; |
760 } |
763 } |
761 |
764 |
762 // |
765 // |
763 // CMMFDevSoundSession::DoSetConfigL |
766 // CMMFDevSoundSession::DoSetConfigL |
764 // (other items were commented in a header). |
767 // (other items were commented in a header). |
765 // |
768 // |
766 TBool CMMFDevSoundSession::DoSetConfigL(const RMmfIpcMessage& aMessage) |
769 TBool CMMFDevSoundSession::DoSetConfigL(const RMmfIpcMessage& aMessage) |
767 { |
770 { |
768 TMMFDevSoundProxySettingsPckg devSoundBuf; |
771 TMMFDevSoundProxySettingsPckg devSoundBuf; |
769 aMessage.ReadL(TInt(1),devSoundBuf); |
772 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
770 TMMFCapabilities config = devSoundBuf().iConfig; |
773 TMMFCapabilities config = devSoundBuf().iConfig; |
771 iAdapter->SetConfigL(config); |
774 iAdapter->SetConfigL(config); |
772 iOperationCompletePending = ETrue; |
775 iOperationCompletePending = ETrue; |
773 return EFalse; |
776 return EFalse; |
774 } |
777 } |
780 TBool CMMFDevSoundSession::DoMaxVolumeL(const RMmfIpcMessage& aMessage) |
783 TBool CMMFDevSoundSession::DoMaxVolumeL(const RMmfIpcMessage& aMessage) |
781 { |
784 { |
782 TMMFDevSoundProxySettings devSoundSet; |
785 TMMFDevSoundProxySettings devSoundSet; |
783 devSoundSet.iMaxVolume = iAdapter->MaxVolume(); |
786 devSoundSet.iMaxVolume = iAdapter->MaxVolume(); |
784 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
787 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
785 aMessage.WriteL(TInt(2),pckg); |
788 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
786 return ETrue; |
789 return ETrue; |
787 } |
790 } |
788 |
791 |
789 // |
792 // |
790 // CMMFDevSoundSession::DoVolumeL |
793 // CMMFDevSoundSession::DoVolumeL |
793 TBool CMMFDevSoundSession::DoVolumeL(const RMmfIpcMessage& aMessage) |
796 TBool CMMFDevSoundSession::DoVolumeL(const RMmfIpcMessage& aMessage) |
794 { |
797 { |
795 TMMFDevSoundProxySettings devSoundSet; |
798 TMMFDevSoundProxySettings devSoundSet; |
796 devSoundSet.iVolume = iAdapter->Volume(); |
799 devSoundSet.iVolume = iAdapter->Volume(); |
797 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
800 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
798 aMessage.WriteL(TInt(2),pckg); |
801 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
799 return ETrue; |
802 return ETrue; |
800 } |
803 } |
801 |
804 |
802 // |
805 // |
803 // CMMFDevSoundSession::DoSetVolumeL |
806 // CMMFDevSoundSession::DoSetVolumeL |
804 // (other items were commented in a header). |
807 // (other items were commented in a header). |
805 // |
808 // |
806 TBool CMMFDevSoundSession::DoSetVolumeL(const RMmfIpcMessage& aMessage) |
809 TBool CMMFDevSoundSession::DoSetVolumeL(const RMmfIpcMessage& aMessage) |
807 { |
810 { |
808 TMMFDevSoundProxySettingsPckg devSoundBuf; |
811 TMMFDevSoundProxySettingsPckg devSoundBuf; |
809 aMessage.ReadL(TInt(1),devSoundBuf); |
812 User::LeaveIfError(MessageRead(aMessage, TInt(1),devSoundBuf)); |
810 TInt volume = devSoundBuf().iVolume; |
813 TInt volume = devSoundBuf().iVolume; |
811 TBool asyncOperation; |
814 TBool asyncOperation; |
812 User::LeaveIfError(iAdapter->SetVolume(volume, asyncOperation)); |
815 User::LeaveIfError(iAdapter->SetVolume(volume, asyncOperation)); |
813 iOperationCompletePending = asyncOperation; |
816 iOperationCompletePending = asyncOperation; |
814 return !asyncOperation; |
817 return !asyncOperation; |
821 TBool CMMFDevSoundSession::DoMaxGainL(const RMmfIpcMessage& aMessage) |
824 TBool CMMFDevSoundSession::DoMaxGainL(const RMmfIpcMessage& aMessage) |
822 { |
825 { |
823 TMMFDevSoundProxySettings devSoundSet; |
826 TMMFDevSoundProxySettings devSoundSet; |
824 devSoundSet.iMaxGain = iAdapter->MaxGain(); |
827 devSoundSet.iMaxGain = iAdapter->MaxGain(); |
825 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
828 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
826 aMessage.WriteL(TInt(2),pckg); |
829 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
827 return ETrue; |
830 return ETrue; |
828 } |
831 } |
829 |
832 |
830 // |
833 // |
831 // CMMFDevSoundSession::DoGainL |
834 // CMMFDevSoundSession::DoGainL |
834 TBool CMMFDevSoundSession::DoGainL(const RMmfIpcMessage& aMessage) |
837 TBool CMMFDevSoundSession::DoGainL(const RMmfIpcMessage& aMessage) |
835 { |
838 { |
836 TMMFDevSoundProxySettings devSoundSet; |
839 TMMFDevSoundProxySettings devSoundSet; |
837 devSoundSet.iGain = iAdapter->Gain(); |
840 devSoundSet.iGain = iAdapter->Gain(); |
838 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
841 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
839 aMessage.WriteL(TInt(2),pckg); |
842 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
840 return ETrue; |
843 return ETrue; |
841 } |
844 } |
842 |
845 |
843 // |
846 // |
844 // CMMFDevSoundSession::DoSetGainL |
847 // CMMFDevSoundSession::DoSetGainL |
845 // (other items were commented in a header). |
848 // (other items were commented in a header). |
846 // |
849 // |
847 TBool CMMFDevSoundSession::DoSetGainL(const RMmfIpcMessage& aMessage) |
850 TBool CMMFDevSoundSession::DoSetGainL(const RMmfIpcMessage& aMessage) |
848 { |
851 { |
849 TMMFDevSoundProxySettingsPckg devSoundBuf; |
852 TMMFDevSoundProxySettingsPckg devSoundBuf; |
850 aMessage.ReadL(TInt(1),devSoundBuf); |
853 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
851 TInt gain = devSoundBuf().iGain; |
854 TInt gain = devSoundBuf().iGain; |
852 TBool asyncOperation; |
855 TBool asyncOperation; |
853 User::LeaveIfError(iAdapter->SetGain(gain, asyncOperation)); |
856 User::LeaveIfError(iAdapter->SetGain(gain, asyncOperation)); |
854 iOperationCompletePending = asyncOperation; |
857 iOperationCompletePending = asyncOperation; |
855 return !asyncOperation; |
858 return !asyncOperation; |
862 TBool CMMFDevSoundSession::DoGetPlayBalanceL(const RMmfIpcMessage& aMessage) |
865 TBool CMMFDevSoundSession::DoGetPlayBalanceL(const RMmfIpcMessage& aMessage) |
863 { |
866 { |
864 TMMFDevSoundProxySettings devSoundSet; |
867 TMMFDevSoundProxySettings devSoundSet; |
865 iAdapter->GetPlayBalanceL(devSoundSet.iLeftPercentage, devSoundSet.iRightPercentage); |
868 iAdapter->GetPlayBalanceL(devSoundSet.iLeftPercentage, devSoundSet.iRightPercentage); |
866 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
869 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
867 aMessage.WriteL(TInt(2),pckg); |
870 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
868 return ETrue; |
871 return ETrue; |
869 } |
872 } |
870 |
873 |
871 // |
874 // |
872 // CMMFDevSoundSession::DoSetPlayBalanceL |
875 // CMMFDevSoundSession::DoSetPlayBalanceL |
873 // (other items were commented in a header). |
876 // (other items were commented in a header). |
874 // |
877 // |
875 TBool CMMFDevSoundSession::DoSetPlayBalanceL(const RMmfIpcMessage& aMessage) |
878 TBool CMMFDevSoundSession::DoSetPlayBalanceL(const RMmfIpcMessage& aMessage) |
876 { |
879 { |
877 TMMFDevSoundProxySettingsPckg devSoundBuf; |
880 TMMFDevSoundProxySettingsPckg devSoundBuf; |
878 aMessage.ReadL(TInt(1),devSoundBuf); |
881 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
879 TInt leftPercentage = devSoundBuf().iLeftPercentage; |
882 TInt leftPercentage = devSoundBuf().iLeftPercentage; |
880 TInt rightPercentage = devSoundBuf().iRightPercentage; |
883 TInt rightPercentage = devSoundBuf().iRightPercentage; |
881 TBool asyncOperation; |
884 TBool asyncOperation; |
882 iAdapter->SetPlayBalanceL(leftPercentage, rightPercentage, asyncOperation); |
885 iAdapter->SetPlayBalanceL(leftPercentage, rightPercentage, asyncOperation); |
883 iOperationCompletePending = asyncOperation; |
886 iOperationCompletePending = asyncOperation; |
891 TBool CMMFDevSoundSession::DoGetRecordBalanceL(const RMmfIpcMessage& aMessage) |
894 TBool CMMFDevSoundSession::DoGetRecordBalanceL(const RMmfIpcMessage& aMessage) |
892 { |
895 { |
893 TMMFDevSoundProxySettings devSoundSet; |
896 TMMFDevSoundProxySettings devSoundSet; |
894 iAdapter->GetRecordBalanceL(devSoundSet.iLeftPercentage, devSoundSet.iRightPercentage); |
897 iAdapter->GetRecordBalanceL(devSoundSet.iLeftPercentage, devSoundSet.iRightPercentage); |
895 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
898 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
896 aMessage.WriteL(TInt(2),pckg); |
899 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
897 return ETrue; |
900 return ETrue; |
898 } |
901 } |
899 |
902 |
900 // |
903 // |
901 // CMMFDevSoundSession::DoSetRecordBalanceL |
904 // CMMFDevSoundSession::DoSetRecordBalanceL |
902 // (other items were commented in a header). |
905 // (other items were commented in a header). |
903 // |
906 // |
904 TBool CMMFDevSoundSession::DoSetRecordBalanceL(const RMmfIpcMessage& aMessage) |
907 TBool CMMFDevSoundSession::DoSetRecordBalanceL(const RMmfIpcMessage& aMessage) |
905 { |
908 { |
906 TMMFDevSoundProxySettingsPckg devSoundBuf; |
909 TMMFDevSoundProxySettingsPckg devSoundBuf; |
907 aMessage.ReadL(TInt(1),devSoundBuf); |
910 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
908 TInt leftPercentage = devSoundBuf().iLeftPercentage; |
911 TInt leftPercentage = devSoundBuf().iLeftPercentage; |
909 TInt rightPercentage = devSoundBuf().iRightPercentage; |
912 TInt rightPercentage = devSoundBuf().iRightPercentage; |
910 TBool asyncOperation; |
913 TBool asyncOperation; |
911 iAdapter->SetRecordBalanceL(leftPercentage, rightPercentage, asyncOperation); |
914 iAdapter->SetRecordBalanceL(leftPercentage, rightPercentage, asyncOperation); |
912 iOperationCompletePending = asyncOperation; |
915 iOperationCompletePending = asyncOperation; |
968 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDataL - Ignore and Exit")); |
971 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDataL - Ignore and Exit")); |
969 return ETrue; |
972 return ETrue; |
970 } |
973 } |
971 |
974 |
972 TMMFDevSoundProxyHwBufPckg devSoundBuf; |
975 TMMFDevSoundProxyHwBufPckg devSoundBuf; |
973 aMessage.ReadL(TInt(1),devSoundBuf); |
976 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
974 iBufferPlay->SetLastBuffer(devSoundBuf().iLastBuffer); |
977 iBufferPlay->SetLastBuffer(devSoundBuf().iLastBuffer); |
975 |
978 |
976 TPtr8 dataPtr(iChunk.Base(), devSoundBuf().iBufferSize, devSoundBuf().iBufferSize); |
979 TPtr8 dataPtr(iChunk.Base(), devSoundBuf().iBufferSize, devSoundBuf().iBufferSize); |
977 // Copy data over from chunk |
980 // Copy data over from chunk |
978 iBufferPlay->Data().Copy(dataPtr); |
981 iBufferPlay->Data().Copy(dataPtr); |
1000 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoStopL - Enter")); |
1003 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoStopL - Enter")); |
1001 // Sometimes Stop is not involved on a commit cycle |
1004 // Sometimes Stop is not involved on a commit cycle |
1002 TBool completed = iAdapter->Stop(); |
1005 TBool completed = iAdapter->Stop(); |
1003 if (completed) |
1006 if (completed) |
1004 { |
1007 { |
1005 iQueuedRequests.Reset(); |
1008 FlushQueuedRequests(); |
1006 FlushEventQueue(); // completed returned here means we were idle to start with. TODO could possibly skip this flush |
1009 FlushEventQueue(); // completed returned here means we were idle to start with. TODO could possibly skip this flush |
1007 iChunk.Close(); |
1010 iChunk.Close(); |
1008 } |
1011 } |
1009 iOperationCompletePending = !completed; |
1012 iOperationCompletePending = !completed; |
1010 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoStopL - Exit. Return value is [%d]"), completed); |
1013 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoStopL - Exit. Return value is [%d]"), completed); |
1028 // |
1031 // |
1029 TBool CMMFDevSoundSession::DoPlayToneL(const RMmfIpcMessage& aMessage) |
1032 TBool CMMFDevSoundSession::DoPlayToneL(const RMmfIpcMessage& aMessage) |
1030 { |
1033 { |
1031 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayToneL - Enter")); |
1034 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayToneL - Enter")); |
1032 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1035 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1033 aMessage.ReadL(TInt(1),devSoundBuf); |
1036 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
1034 iCachedClientData = devSoundBuf; |
1037 iCachedClientData = devSoundBuf; |
1035 TInt frequency = devSoundBuf().iFrequencyOne; |
1038 TInt frequency = devSoundBuf().iFrequencyOne; |
1036 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
1039 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
1037 iAdapter->PlayToneL(frequency, duration); |
1040 iAdapter->PlayToneL(frequency, duration); |
1038 iOperationCompletePending = ETrue; |
1041 iOperationCompletePending = ETrue; |
1058 // |
1061 // |
1059 TBool CMMFDevSoundSession::DoPlayDualToneL(const RMmfIpcMessage& aMessage) |
1062 TBool CMMFDevSoundSession::DoPlayDualToneL(const RMmfIpcMessage& aMessage) |
1060 { |
1063 { |
1061 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDualToneL - Enter")); |
1064 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayDualToneL - Enter")); |
1062 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1065 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1063 aMessage.ReadL(TInt(1),devSoundBuf); |
1066 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
1064 iCachedClientData = devSoundBuf; |
1067 iCachedClientData = devSoundBuf; |
1065 TInt frequencyOne = devSoundBuf().iFrequencyOne; |
1068 TInt frequencyOne = devSoundBuf().iFrequencyOne; |
1066 TInt frequencyTwo = devSoundBuf().iFrequencyTwo; |
1069 TInt frequencyTwo = devSoundBuf().iFrequencyTwo; |
1067 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
1070 TTimeIntervalMicroSeconds duration(devSoundBuf().iDuration); |
1068 iAdapter->PlayDualToneL(frequencyOne, frequencyTwo, duration); |
1071 iAdapter->PlayDualToneL(frequencyOne, frequencyTwo, duration); |
1099 iDtmfString = NULL; |
1102 iDtmfString = NULL; |
1100 } |
1103 } |
1101 |
1104 |
1102 iDtmfString = HBufC::NewL(dtmfLength); |
1105 iDtmfString = HBufC::NewL(dtmfLength); |
1103 TPtr dtmfPtr = iDtmfString->Des(); |
1106 TPtr dtmfPtr = iDtmfString->Des(); |
1104 aMessage.ReadL(TInt(2), dtmfPtr); |
1107 User::LeaveIfError(MessageRead(aMessage, TInt(2), dtmfPtr)); |
1105 |
|
1106 iAdapter->PlayDTMFStringL(*iDtmfString); |
1108 iAdapter->PlayDTMFStringL(*iDtmfString); |
1107 iOperationCompletePending = ETrue; |
1109 iOperationCompletePending = ETrue; |
1108 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayDTMFStringL - Exit. Return value is [%d]"), ETrue); |
1110 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayDTMFStringL - Exit. Return value is [%d]"), ETrue); |
1109 return ETrue; |
1111 return ETrue; |
1110 } |
1112 } |
1134 iToneSeqBuf = NULL; |
1136 iToneSeqBuf = NULL; |
1135 } |
1137 } |
1136 |
1138 |
1137 iToneSeqBuf = HBufC8::NewL(toneLength); |
1139 iToneSeqBuf = HBufC8::NewL(toneLength); |
1138 TPtr8 toneSeqPtr = iToneSeqBuf->Des(); |
1140 TPtr8 toneSeqPtr = iToneSeqBuf->Des(); |
1139 aMessage.ReadL(TInt(1), toneSeqPtr); |
1141 User::LeaveIfError(MessageRead(aMessage,TInt(1), toneSeqPtr)); |
1140 |
1142 |
1141 iAdapter->PlayToneSequenceL(*iToneSeqBuf); |
1143 iAdapter->PlayToneSequenceL(*iToneSeqBuf); |
1142 iOperationCompletePending = ETrue; |
1144 iOperationCompletePending = ETrue; |
1143 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayToneSequenceL - Exit. Return value is [%d]"), ETrue); |
1145 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayToneSequenceL - Exit. Return value is [%d]"), ETrue); |
1144 return ETrue; |
1146 return ETrue; |
1160 // |
1162 // |
1161 TBool CMMFDevSoundSession::DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage) |
1163 TBool CMMFDevSoundSession::DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage) |
1162 { |
1164 { |
1163 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Enter")); |
1165 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Enter")); |
1164 TPckgBuf<TInt> buf; |
1166 TPckgBuf<TInt> buf; |
1165 aMessage.ReadL(TInt(1),buf); |
1167 User::LeaveIfError(MessageRead(aMessage,TInt(1),buf)); |
1166 TInt seqNum = buf(); |
1168 TInt seqNum = buf(); |
1167 iSeqNum = seqNum; |
1169 iSeqNum = seqNum; |
1168 iAdapter->PlayFixedSequenceL(seqNum); |
1170 iAdapter->PlayFixedSequenceL(seqNum); |
1169 iOperationCompletePending = ETrue; |
1171 iOperationCompletePending = ETrue; |
1170 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Exit. Return value is [%d]"), ETrue); |
1172 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoPlayFixedSequenceL - Exit. Return value is [%d]"), ETrue); |
1187 // |
1189 // |
1188 TBool CMMFDevSoundSession::DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage) |
1190 TBool CMMFDevSoundSession::DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage) |
1189 { |
1191 { |
1190 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetDTMFLengthsL - Enter")); |
1192 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetDTMFLengthsL - Enter")); |
1191 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1193 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1192 aMessage.ReadL(TInt(1),devSoundBuf); |
1194 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
1193 TTimeIntervalMicroSeconds32 toneOnLength = devSoundBuf().iToneOnLength; |
1195 TTimeIntervalMicroSeconds32 toneOnLength = devSoundBuf().iToneOnLength; |
1194 TTimeIntervalMicroSeconds32 toneOffLength = devSoundBuf().iToneOffLength; |
1196 TTimeIntervalMicroSeconds32 toneOffLength = devSoundBuf().iToneOffLength; |
1195 TTimeIntervalMicroSeconds32 pauseLength = devSoundBuf().iPauseLength; |
1197 TTimeIntervalMicroSeconds32 pauseLength = devSoundBuf().iPauseLength; |
1196 User::LeaveIfError(iAdapter->SetDTMFLengths(toneOnLength, toneOffLength, pauseLength)); |
1198 User::LeaveIfError(iAdapter->SetDTMFLengths(toneOnLength, toneOffLength, pauseLength)); |
1197 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetDTMFLengthsL - Exit. Return value is [%d]"), ETrue); |
1199 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetDTMFLengthsL - Exit. Return value is [%d]"), ETrue); |
1204 // |
1206 // |
1205 TBool CMMFDevSoundSession::DoSetVolumeRampL(const RMmfIpcMessage& aMessage) |
1207 TBool CMMFDevSoundSession::DoSetVolumeRampL(const RMmfIpcMessage& aMessage) |
1206 { |
1208 { |
1207 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Enter")); |
1209 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Enter")); |
1208 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1210 TMMFDevSoundProxySettingsPckg devSoundBuf; |
1209 aMessage.ReadL(TInt(1),devSoundBuf); |
1211 User::LeaveIfError(MessageRead(aMessage,TInt(1),devSoundBuf)); |
1210 TTimeIntervalMicroSeconds duration = devSoundBuf().iDuration; |
1212 TTimeIntervalMicroSeconds duration = devSoundBuf().iDuration; |
1211 User::LeaveIfError(iAdapter->SetVolumeRamp(duration)); |
1213 User::LeaveIfError(iAdapter->SetVolumeRamp(duration)); |
1212 iOperationCompletePending = EFalse; // Volume ramp doesn't result on commit |
1214 iOperationCompletePending = EFalse; // Volume ramp doesn't result on commit |
1213 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Exit. Return value is [%d]"), ETrue); |
1215 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetVolumeRampL - Exit. Return value is [%d]"), ETrue); |
1214 return ETrue; // operation complete |
1216 return ETrue; // operation complete |
1222 const RMmfIpcMessage& aMessage) |
1224 const RMmfIpcMessage& aMessage) |
1223 { |
1225 { |
1224 iArray.Reset(); |
1226 iArray.Reset(); |
1225 |
1227 |
1226 TMMFPrioritySettingsPckg prioritySetBuf; |
1228 TMMFPrioritySettingsPckg prioritySetBuf; |
1227 aMessage.ReadL(TInt(1),prioritySetBuf); |
1229 User::LeaveIfError(MessageRead(aMessage,TInt(1),prioritySetBuf)); |
1228 TMMFPrioritySettings prioritySet = prioritySetBuf(); |
1230 TMMFPrioritySettings prioritySet = prioritySetBuf(); |
1229 |
1231 |
1230 iAdapter->GetSupportedInputDataTypesL(iArray, prioritySet); |
1232 iAdapter->GetSupportedInputDataTypesL(iArray, prioritySet); |
1231 |
1233 |
1232 TPckgBuf<TInt> pckg; |
1234 TPckgBuf<TInt> pckg; |
1233 pckg() = iArray.Count(); |
1235 pckg() = iArray.Count(); |
1234 aMessage.WriteL(TInt(2),pckg); |
1236 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
1235 |
1237 |
1236 return ETrue; |
1238 return ETrue; |
1237 } |
1239 } |
1238 |
1240 |
1239 // |
1241 // |
1244 const RMmfIpcMessage& aMessage) |
1246 const RMmfIpcMessage& aMessage) |
1245 { |
1247 { |
1246 iArray.Reset(); |
1248 iArray.Reset(); |
1247 |
1249 |
1248 TMMFPrioritySettingsPckg prioritySetBuf; |
1250 TMMFPrioritySettingsPckg prioritySetBuf; |
1249 aMessage.ReadL(TInt(1),prioritySetBuf); |
1251 User::LeaveIfError(MessageRead(aMessage,TInt(1),prioritySetBuf)); |
1250 TMMFPrioritySettings prioritySet = prioritySetBuf(); |
1252 TMMFPrioritySettings prioritySet = prioritySetBuf(); |
1251 |
1253 |
1252 iAdapter->GetSupportedOutputDataTypesL(iArray, prioritySet); |
1254 iAdapter->GetSupportedOutputDataTypesL(iArray, prioritySet); |
1253 |
1255 |
1254 TPckgBuf<TInt> pckg; |
1256 TPckgBuf<TInt> pckg; |
1255 pckg() = iArray.Count(); |
1257 pckg() = iArray.Count(); |
1256 aMessage.WriteL(TInt(2),pckg); |
1258 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
1257 |
1259 |
1258 return ETrue; |
1260 return ETrue; |
1259 } |
1261 } |
1260 |
1262 |
1261 // |
1263 // |
1264 // |
1266 // |
1265 TBool CMMFDevSoundSession::DoSamplesRecordedL(const RMmfIpcMessage& aMessage) |
1267 TBool CMMFDevSoundSession::DoSamplesRecordedL(const RMmfIpcMessage& aMessage) |
1266 { |
1268 { |
1267 TPckgBuf<TInt> pckg; |
1269 TPckgBuf<TInt> pckg; |
1268 pckg() = iAdapter->SamplesRecorded(); |
1270 pckg() = iAdapter->SamplesRecorded(); |
1269 aMessage.WriteL(TInt(2),pckg); |
1271 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
1270 return ETrue; |
1272 return ETrue; |
1271 } |
1273 } |
1272 |
1274 |
1273 // |
1275 // |
1274 // CMMFDevSoundSession::DoSamplesPlayedL |
1276 // CMMFDevSoundSession::DoSamplesPlayedL |
1276 // |
1278 // |
1277 TBool CMMFDevSoundSession::DoSamplesPlayedL(const RMmfIpcMessage& aMessage) |
1279 TBool CMMFDevSoundSession::DoSamplesPlayedL(const RMmfIpcMessage& aMessage) |
1278 { |
1280 { |
1279 TPckgBuf<TInt> pckg; |
1281 TPckgBuf<TInt> pckg; |
1280 pckg() = iAdapter->SamplesPlayed(); |
1282 pckg() = iAdapter->SamplesPlayed(); |
1281 aMessage.WriteL(TInt(2),pckg); |
1283 User::LeaveIfError(MessageWrite(aMessage,TInt(2),pckg)); |
1282 return ETrue; |
1284 return ETrue; |
1283 } |
1285 } |
1284 |
1286 |
1285 // |
1287 // |
1286 // CMMFDevSoundSession::DoSetToneRepeatsL |
1288 // CMMFDevSoundSession::DoSetToneRepeatsL |
1288 // |
1290 // |
1289 TBool CMMFDevSoundSession::DoSetToneRepeatsL(const RMmfIpcMessage& aMessage) |
1291 TBool CMMFDevSoundSession::DoSetToneRepeatsL(const RMmfIpcMessage& aMessage) |
1290 { |
1292 { |
1291 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Enter")); |
1293 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Enter")); |
1292 TPckgBuf<TInt> countRepeat; |
1294 TPckgBuf<TInt> countRepeat; |
1293 aMessage.ReadL(TInt(1),countRepeat); |
1295 User::LeaveIfError(MessageRead(aMessage,TInt(1),countRepeat)); |
1294 |
1296 |
1295 TPckgBuf<TTimeIntervalMicroSeconds> repeatTS; |
1297 TPckgBuf<TTimeIntervalMicroSeconds> repeatTS; |
1296 aMessage.ReadL(TInt(2),repeatTS); |
1298 User::LeaveIfError(MessageRead(aMessage,TInt(2),repeatTS)); |
1297 User::LeaveIfError(iAdapter->SetToneRepeats(countRepeat(), repeatTS())); |
1299 User::LeaveIfError(iAdapter->SetToneRepeats(countRepeat(), repeatTS())); |
1298 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Exit. Return value is [%d]"), ETrue); |
1300 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoSetToneRepeatsL - Exit. Return value is [%d]"), ETrue); |
1299 return ETrue; |
1301 return ETrue; |
1300 } |
1302 } |
1301 |
1303 |
1305 // |
1307 // |
1306 TBool CMMFDevSoundSession::DoSetPrioritySettingsL( |
1308 TBool CMMFDevSoundSession::DoSetPrioritySettingsL( |
1307 const RMmfIpcMessage& aMessage) |
1309 const RMmfIpcMessage& aMessage) |
1308 { |
1310 { |
1309 TPckgBuf<TMMFPrioritySettings> prioritySet; |
1311 TPckgBuf<TMMFPrioritySettings> prioritySet; |
1310 aMessage.ReadL(TInt(1),prioritySet); |
1312 User::LeaveIfError(MessageRead(aMessage,TInt(1),prioritySet)); |
1311 |
1313 |
1312 User::LeaveIfError(iAdapter->SetPrioritySettings(prioritySet())); |
1314 User::LeaveIfError(iAdapter->SetPrioritySettings(prioritySet())); |
1313 iOperationCompletePending = EFalse; |
1315 iOperationCompletePending = EFalse; |
1314 return ETrue; |
1316 return ETrue; |
1315 } |
1317 } |
1324 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoFixedSequenceCountL - Enter")); |
1326 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::DoFixedSequenceCountL - Enter")); |
1325 TPckgBuf<TInt> fixSeqCountPckg; |
1327 TPckgBuf<TInt> fixSeqCountPckg; |
1326 TInt fixSeqCount = iAdapter->FixedSequenceCount(); |
1328 TInt fixSeqCount = iAdapter->FixedSequenceCount(); |
1327 fixSeqCountPckg = fixSeqCount; |
1329 fixSeqCountPckg = fixSeqCount; |
1328 |
1330 |
1329 aMessage.WriteL(TInt(2),fixSeqCountPckg); |
1331 User::LeaveIfError(MessageWrite(aMessage,TInt(2),fixSeqCountPckg)); |
1330 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoFixedSequenceCountL - Exit. Return value is [%d]"), ETrue); |
1332 SYMBIAN_DEBPRN1(_L("CMMFDevSoundSession[0x%x]::DoFixedSequenceCountL - Exit. Return value is [%d]"), ETrue); |
1331 return ETrue; |
1333 return ETrue; |
1332 } |
1334 } |
1333 |
1335 |
1334 |
1336 |
1352 while (i < count) |
1354 while (i < count) |
1353 { |
1355 { |
1354 stream.WriteInt32L(iArray[i].FourCC()); |
1356 stream.WriteInt32L(iArray[i].FourCC()); |
1355 i++; |
1357 i++; |
1356 } |
1358 } |
1357 aMessage.WriteL(TInt(2), dataCopyBuffer->Ptr(0)); |
1359 User::LeaveIfError(MessageWrite(aMessage, TInt(2), dataCopyBuffer->Ptr(0))); |
1358 stream.Close(); |
1360 stream.Close(); |
1359 CleanupStack::PopAndDestroy(&stream); |
1361 CleanupStack::PopAndDestroy(&stream); |
1360 CleanupStack::PopAndDestroy(dataCopyBuffer); |
1362 CleanupStack::PopAndDestroy(dataCopyBuffer); |
1361 return ETrue; |
1363 return ETrue; |
1362 } |
1364 } |
1375 { |
1377 { |
1376 aMessage.Complete(KErrBadHandle); |
1378 aMessage.Complete(KErrBadHandle); |
1377 return EFalse; |
1379 return EFalse; |
1378 } |
1380 } |
1379 TPckgBuf<TInt> requestChunkBuf; |
1381 TPckgBuf<TInt> requestChunkBuf; |
1380 MmfMessageUtil::Read(aMessage, TInt(1), requestChunkBuf); |
1382 User::LeaveIfError(MessageRead(aMessage, TInt(1), requestChunkBuf)); |
1381 TBool requestChunk = requestChunkBuf(); |
1383 TBool requestChunk = requestChunkBuf(); |
1382 if (requestChunk) |
1384 if (requestChunk) |
1383 { |
1385 { |
1384 // if the client requests, always do EOpen |
1386 // if the client requests, always do EOpen |
1385 iHwBufPckgFill().iChunkOp = EOpen; |
1387 iHwBufPckgFill().iChunkOp = EOpen; |
1386 } |
1388 } |
1387 TInt err = MmfMessageUtil::Write(aMessage, TInt(2), iHwBufPckgFill); |
1389 TInt err = MessageWrite(aMessage, TInt(2), iHwBufPckgFill); |
1388 if ( (err == KErrNone) && (iHwBufPckgFill().iChunkOp == EOpen) ) |
1390 if ( (err == KErrNone) && (iHwBufPckgFill().iChunkOp == EOpen) ) |
1389 { |
1391 { |
1390 aMessage.Complete(iChunk); |
1392 aMessage.Complete(iChunk); |
1391 } |
1393 } |
1392 else |
1394 else |
1408 { |
1410 { |
1409 aMessage.Complete(KErrBadHandle); |
1411 aMessage.Complete(KErrBadHandle); |
1410 return EFalse; |
1412 return EFalse; |
1411 } |
1413 } |
1412 |
1414 |
1413 TInt err = MmfMessageUtil::Write(aMessage, TInt(2), iHwBufPckgEmpty); |
1415 TInt err = MessageWrite(aMessage, TInt(2), iHwBufPckgEmpty); |
1414 if ( (err == KErrNone) && (iHwBufPckgEmpty().iChunkOp == EOpen) ) |
1416 if ( (err == KErrNone) && (iHwBufPckgEmpty().iChunkOp == EOpen) ) |
1415 { |
1417 { |
1416 aMessage.Complete(iChunk); |
1418 aMessage.Complete(iChunk); |
1417 } |
1419 } |
1418 else |
1420 else |
1454 if (err != KErrNone) |
1456 if (err != KErrNone) |
1455 { |
1457 { |
1456 aMessage.Complete(err); |
1458 aMessage.Complete(err); |
1457 return EFalse; |
1459 return EFalse; |
1458 } |
1460 } |
1459 aMessage.WriteL(TInt(2),timePckg); |
1461 User::LeaveIfError(MessageWrite(aMessage,TInt(2),timePckg)); |
1460 return ETrue; |
1462 return ETrue; |
1461 } |
1463 } |
1462 |
1464 |
1463 TBool CMMFDevSoundSession::DoQueryResumeSupportedL(const RMmfIpcMessage& aMessage) |
1465 TBool CMMFDevSoundSession::DoQueryResumeSupportedL(const RMmfIpcMessage& aMessage) |
1464 { |
1466 { |
1465 TBool isSupported = EFalse; |
1467 TBool isSupported = EFalse; |
1466 TPckgBuf<TBool> isSupportedPckg(isSupported); |
1468 TPckgBuf<TBool> isSupportedPckg(isSupported); |
1467 isSupportedPckg() = iAdapter->IsResumeSupported(); |
1469 isSupportedPckg() = iAdapter->IsResumeSupported(); |
1468 aMessage.WriteL(TInt(2),isSupportedPckg); |
1470 User::LeaveIfError(MessageWrite(aMessage,TInt(2),isSupportedPckg)); |
1469 return ETrue; |
1471 return ETrue; |
1470 } |
1472 } |
1471 |
1473 |
1472 TBool CMMFDevSoundSession::DoResumeL(const RMmfIpcMessage& /*aMessage*/) |
1474 TBool CMMFDevSoundSession::DoResumeL(const RMmfIpcMessage& /*aMessage*/) |
1473 { |
1475 { |
1520 // |
1522 // |
1521 // CMMFDevSoundSession::CMMFDevSoundSession |
1523 // CMMFDevSoundSession::CMMFDevSoundSession |
1522 // (other items were commented in a header). |
1524 // (other items were commented in a header). |
1523 // |
1525 // |
1524 CMMFDevSoundSession::CMMFDevSoundSession() : |
1526 CMMFDevSoundSession::CMMFDevSoundSession() : |
1525 iSetClientConfigApplied (EFalse) |
1527 iSetClientConfigApplied (EFalse), |
1528 iDisconnecting (EFalse) |
|
1526 { |
1529 { |
1527 } |
1530 } |
1528 |
1531 |
1529 // |
1532 // |
1530 // CMMFDevSoundSession::~CMMFDevSoundSession |
1533 // CMMFDevSoundSession::~CMMFDevSoundSession |
1638 // (other items were commented in a header). |
1641 // (other items were commented in a header). |
1639 // |
1642 // |
1640 void CMMFDevSoundSession::Disconnect(const RMessage2& aMessage) |
1643 void CMMFDevSoundSession::Disconnect(const RMessage2& aMessage) |
1641 { |
1644 { |
1642 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Enter")); |
1645 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Enter")); |
1646 iDisconnecting = ETrue; |
|
1647 |
|
1643 if (NeedToQueue()) |
1648 if (NeedToQueue()) |
1644 { |
1649 { |
1645 // if we are in the middle of something, enqueue and wait |
1650 // if we are in the middle of something, enqueue and wait |
1646 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Add to queue")); |
1651 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::Disconnect - Add to queue")); |
1647 EnqueueRequest(aMessage); |
1652 EnqueueRequest(aMessage); |
2104 if(iOperationCompletePending && aCanStartNewOperation) |
2109 if(iOperationCompletePending && aCanStartNewOperation) |
2105 { |
2110 { |
2106 if (iRequestBeingServiced.Function()==EMMFDevSoundProxyStop) |
2111 if (iRequestBeingServiced.Function()==EMMFDevSoundProxyStop) |
2107 { |
2112 { |
2108 // flush the queue - will have removed any stale items added between initial call and MMRC's reaction |
2113 // flush the queue - will have removed any stale items added between initial call and MMRC's reaction |
2109 iQueuedRequests.Reset(); |
2114 FlushQueuedRequests(); |
2110 FlushEventQueue(); |
2115 FlushEventQueue(); |
2111 iChunk.Close(); |
2116 iChunk.Close(); |
2112 } |
2117 } |
2113 |
2118 |
2114 if(iRequestBeingServiced.Function()==EMMFDevSoundProxyCapabilities) |
2119 if(iRequestBeingServiced.Function()==EMMFDevSoundProxyCapabilities) |
2115 { |
2120 { |
2116 TMMFDevSoundProxySettings devSoundSet; |
2121 TMMFDevSoundProxySettings devSoundSet; |
2117 devSoundSet.iCaps = iDevSoundCapabilities; |
2122 devSoundSet.iCaps = iDevSoundCapabilities; |
2118 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
2123 TMMFDevSoundProxySettingsPckg pckg(devSoundSet); |
2119 iRequestBeingServiced.Message().Write(TInt(2),pckg); |
2124 MessageWrite(iRequestBeingServiced.Message(),TInt(2),pckg); |
2120 } |
2125 } |
2121 |
2126 |
2122 if(iRequestBeingServiced.Function()==EMMFDevSoundProxyCancelInitialize) |
2127 if(iRequestBeingServiced.Function()==EMMFDevSoundProxyCancelInitialize) |
2123 { |
2128 { |
2124 FlushEventQueue(); |
2129 FlushEventQueue(); |
2539 |
2544 |
2540 |
2545 |
2541 TBool CMMFDevSoundSession::DoRegisterAsClientL(const RMmfIpcMessage& aMessage) |
2546 TBool CMMFDevSoundSession::DoRegisterAsClientL(const RMmfIpcMessage& aMessage) |
2542 { |
2547 { |
2543 TMMFDevSoundProxySettingsPckg buf; |
2548 TMMFDevSoundProxySettingsPckg buf; |
2544 aMessage.ReadL(0,buf); |
2549 User::LeaveIfError(MessageRead(aMessage,0,buf)); |
2545 HBufC8* notificationRegistrationData = NULL; |
2550 HBufC8* notificationRegistrationData = NULL; |
2546 notificationRegistrationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesLengthL(1))); |
2551 notificationRegistrationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesLengthL(1))); |
2547 TPtr8 dataPtr(notificationRegistrationData->Des()); |
2552 TPtr8 dataPtr(notificationRegistrationData->Des()); |
2548 aMessage.ReadL(1,dataPtr); |
2553 User::LeaveIfError(MessageRead(aMessage,1,dataPtr)); |
2549 DoSetClientConfigL();// added here instead of the CreateL() |
2554 DoSetClientConfigL();// added here instead of the CreateL() |
2550 TInt err = KErrNone; |
2555 TInt err = KErrNone; |
2551 err = iAdapter->RegisterAsClient(buf().iNotificationEventUid,dataPtr); |
2556 err = iAdapter->RegisterAsClient(buf().iNotificationEventUid,dataPtr); |
2552 CleanupStack::PopAndDestroy(1); // Notification Registeration data |
2557 CleanupStack::PopAndDestroy(1); // Notification Registeration data |
2553 if (err != KErrNone) |
2558 if (err != KErrNone) |
2559 } |
2564 } |
2560 |
2565 |
2561 TBool CMMFDevSoundSession::DoCancelRegisterAsClientL(const RMmfIpcMessage& aMessage) |
2566 TBool CMMFDevSoundSession::DoCancelRegisterAsClientL(const RMmfIpcMessage& aMessage) |
2562 { |
2567 { |
2563 TMMFDevSoundProxySettingsPckg buf; |
2568 TMMFDevSoundProxySettingsPckg buf; |
2564 aMessage.ReadL(0,buf); |
2569 User::LeaveIfError(MessageRead(aMessage,0,buf)); |
2565 TInt err = KErrNone; |
2570 TInt err = KErrNone; |
2566 err = iAdapter->CancelRegisterAsClient(buf().iNotificationEventUid); |
2571 err = iAdapter->CancelRegisterAsClient(buf().iNotificationEventUid); |
2567 if (err != KErrNone) |
2572 if (err != KErrNone) |
2568 { |
2573 { |
2569 aMessage.Complete(err); |
2574 aMessage.Complete(err); |
2573 } |
2578 } |
2574 |
2579 |
2575 TBool CMMFDevSoundSession::DoGetResourceNotificationDataL(const RMmfIpcMessage& aMessage) |
2580 TBool CMMFDevSoundSession::DoGetResourceNotificationDataL(const RMmfIpcMessage& aMessage) |
2576 { |
2581 { |
2577 TMMFDevSoundProxySettingsPckg buf; |
2582 TMMFDevSoundProxySettingsPckg buf; |
2578 aMessage.ReadL(0,buf); |
2583 User::LeaveIfError(MessageRead(aMessage,0,buf)); |
2579 HBufC8* notificationData = NULL; |
2584 HBufC8* notificationData = NULL; |
2580 notificationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesMaxLengthL(2))); |
2585 notificationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesMaxLengthL(2))); |
2581 TPtr8 dataPtr(notificationData->Des()); |
2586 TPtr8 dataPtr(notificationData->Des()); |
2582 aMessage.ReadL(2,dataPtr); |
2587 User::LeaveIfError(MessageRead(aMessage,2,dataPtr)); |
2583 TInt err = KErrNone; |
2588 TInt err = KErrNone; |
2584 err = iAdapter->GetResourceNotificationData(buf().iNotificationEventUid,dataPtr); |
2589 err = iAdapter->GetResourceNotificationData(buf().iNotificationEventUid,dataPtr); |
2585 aMessage.WriteL(2,*notificationData); |
2590 User::LeaveIfError(MessageWrite(aMessage,2,*notificationData)); |
2586 CleanupStack::PopAndDestroy(1); // Notification data |
2591 CleanupStack::PopAndDestroy(1); // Notification data |
2587 if (err != KErrNone) |
2592 if (err != KErrNone) |
2588 { |
2593 { |
2589 aMessage.Complete(err); |
2594 aMessage.Complete(err); |
2590 return EFalse; |
2595 return EFalse; |
2609 if(!iSetClientConfigApplied) |
2614 if(!iSetClientConfigApplied) |
2610 { |
2615 { |
2611 if (aMessage.HasCapability(ECapabilityMultimediaDD) && aMessage.HasCapability(ECapabilityUserEnvironment)) |
2616 if (aMessage.HasCapability(ECapabilityMultimediaDD) && aMessage.HasCapability(ECapabilityUserEnvironment)) |
2612 { |
2617 { |
2613 TPckgBuf<TThreadId> threadId; |
2618 TPckgBuf<TThreadId> threadId; |
2614 aMessage.ReadL(1, threadId); |
2619 User::LeaveIfError(MessageRead(aMessage, 1, threadId)); |
2615 |
2620 |
2616 CMMFDevSoundServer* server = |
2621 CMMFDevSoundServer* server = |
2617 const_cast<CMMFDevSoundServer*>(static_cast<const CMMFDevSoundServer*>(Server())); |
2622 const_cast<CMMFDevSoundServer*>(static_cast<const CMMFDevSoundServer*>(Server())); |
2618 server->SetClientProcessIdL(threadId()); |
2623 server->SetClientProcessIdL(threadId()); |
2619 } |
2624 } |
2638 { |
2643 { |
2639 // this will generate an processing error event and callback |
2644 // this will generate an processing error event and callback |
2640 iAdapter->BufferErrorEvent(); |
2645 iAdapter->BufferErrorEvent(); |
2641 } |
2646 } |
2642 |
2647 |
2648 void CMMFDevSoundSession::FlushQueuedRequests() |
|
2649 { |
|
2650 for (TInt queueIndex = (iQueuedRequests.Count() - 1); queueIndex >= 0; --queueIndex) |
|
2651 { |
|
2652 if ((iQueuedRequests[queueIndex].Type() == TMMFDevSoundRequest::ESessionEvents) && |
|
2653 (iQueuedRequests[queueIndex].Function() == RMessage2::EDisConnect)) |
|
2654 { |
|
2655 continue; |
|
2656 } |
|
2657 iQueuedRequests.Remove(queueIndex); |
|
2658 } |
|
2659 } |
|
2660 |
|
2661 TInt CMMFDevSoundSession::MessageRead(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult) |
|
2662 { |
|
2663 if (!iDisconnecting) |
|
2664 { |
|
2665 return MmfMessageUtil::Read(aMessage, aParam, aResult); |
|
2666 } |
|
2667 return KErrBadHandle; |
|
2668 } |
|
2669 |
|
2670 TInt CMMFDevSoundSession::MessageRead(const RMmfIpcMessage& aMessage, TInt aParam, TDes16& aResult) |
|
2671 { |
|
2672 if (!iDisconnecting) |
|
2673 { |
|
2674 return aMessage.Read(aParam, aResult); |
|
2675 } |
|
2676 return KErrBadHandle; |
|
2677 } |
|
2678 |
|
2679 TInt CMMFDevSoundSession::MessageWrite(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue) |
|
2680 { |
|
2681 if (!iDisconnecting) |
|
2682 { |
|
2683 return MmfMessageUtil::Write(aMessage, aParam, aValue); |
|
2684 } |
|
2685 return KErrBadHandle; |
|
2686 } |
|
2687 |
|
2643 void CMMFDevSoundSession::ResetNotifiedError() |
2688 void CMMFDevSoundSession::ResetNotifiedError() |
2644 // called at beginning of commit cycle, so any error will be from callbacks |
2689 // called at beginning of commit cycle, so any error will be from callbacks |
2645 { |
2690 { |
2646 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::ResetNotifiedError")); |
2691 SYMBIAN_DEBPRN0(_L("CMMFDevSoundSession[0x%x]::ResetNotifiedError")); |
2647 iNotifiedError = KErrNone; |
2692 iNotifiedError = KErrNone; |