286 // Returns either chunk handle or NULL |
286 // Returns either chunk handle or NULL |
287 // any error is assumed to be due to a pending PlayError(), so the error here is ignored - the PlayError() call will ensure the client remains lively |
287 // any error is assumed to be due to a pending PlayError(), so the error here is ignored - the PlayError() call will ensure the client remains lively |
288 // the chunk has been closed by the server. No action should be taken. |
288 // the chunk has been closed by the server. No action should be taken. |
289 TBool requestChunk = iDataBuffer==NULL; // if we have no buffer, tell server we need a chunk handle |
289 TBool requestChunk = iDataBuffer==NULL; // if we have no buffer, tell server we need a chunk handle |
290 TInt handle = iDevSoundProxy->BufferToBeFilledData(requestChunk, iSetPckg); |
290 TInt handle = iDevSoundProxy->BufferToBeFilledData(requestChunk, iSetPckg); |
291 if(handle >= KErrNone) |
291 User::LeaveIfError(handle); |
292 { |
292 |
293 if ( iSetPckg().iChunkOp == EOpen ) |
293 if ( iSetPckg().iChunkOp == EOpen ) |
294 { |
294 { |
295 AssignDataBufferToChunkL(handle); |
295 AssignDataBufferToChunkL(handle); |
296 } |
296 } |
297 else |
297 else |
298 { |
298 { |
299 UpdateDataBufferL(); |
299 UpdateDataBufferL(); |
300 } |
300 } |
301 iDataBuffer->SetStatus(EAvailable); |
301 iDataBuffer->SetStatus(EAvailable); |
302 |
302 |
303 // Let the MMF fill the buffer with data |
303 // Let the MMF fill the buffer with data |
304 |
304 iDevSoundObserver.BufferToBeFilled(iDataBuffer); |
305 iDevSoundObserver.BufferToBeFilled(iDataBuffer); |
|
306 } |
|
307 SYMBIAN_DEBPRN0(_L("CMsgQueueHandler[0x%x]::DoBTBFCompleteL - Exit")); |
305 SYMBIAN_DEBPRN0(_L("CMsgQueueHandler[0x%x]::DoBTBFCompleteL - Exit")); |
308 } |
306 } |
309 |
307 |
310 // ---------------------------------------------------------------------------- |
308 // ---------------------------------------------------------------------------- |
311 // CMsgQueueHandler::DoBTBECompleteL |
309 // CMsgQueueHandler::DoBTBECompleteL |
318 SYMBIAN_DEBPRN0(_L("CMsgQueueHandler[0x%x]::DoBTBECompleteL - Enter")); |
316 SYMBIAN_DEBPRN0(_L("CMsgQueueHandler[0x%x]::DoBTBECompleteL - Enter")); |
319 // Returns either chunk handle or NULL |
317 // Returns either chunk handle or NULL |
320 // any error is assumed to be due to a pending RecordError(), so the error here is ignored - the RecordError() call will ensure the client remains lively |
318 // any error is assumed to be due to a pending RecordError(), so the error here is ignored - the RecordError() call will ensure the client remains lively |
321 // the chunk has been closed by the server. No action should be taken. |
319 // the chunk has been closed by the server. No action should be taken. |
322 TInt handle = iDevSoundProxy->BufferToBeEmptiedData(iSetPckg); |
320 TInt handle = iDevSoundProxy->BufferToBeEmptiedData(iSetPckg); |
323 if(handle >= KErrNone) |
321 User::LeaveIfError(handle); |
324 { |
322 |
325 if ( iSetPckg().iChunkOp == EOpen ) |
323 if ( iSetPckg().iChunkOp == EOpen ) |
326 { |
324 { |
327 AssignDataBufferToChunkL(handle); |
325 AssignDataBufferToChunkL(handle); |
328 } |
326 } |
329 iDataBuffer->SetStatus(EFull); |
327 |
330 iDataBuffer->Data().SetLength(iSetPckg().iRequestSize); |
328 __ASSERT_ALWAYS(iDataBuffer, User::Leave(KErrGeneral)); //iDataBuffer should never be empty here |
331 iDevSoundObserver.BufferToBeEmptied(iDataBuffer); |
329 iDataBuffer->SetStatus(EFull); |
332 } |
330 iDataBuffer->Data().SetLength(iSetPckg().iRequestSize); |
|
331 iDevSoundObserver.BufferToBeEmptied(iDataBuffer); |
|
332 |
333 SYMBIAN_DEBPRN0(_L("CMsgQueueHandler[0x%x]::DoBTBECompleteL - Exit")); |
333 SYMBIAN_DEBPRN0(_L("CMsgQueueHandler[0x%x]::DoBTBECompleteL - Exit")); |
334 } |
334 } |
335 |
335 |
336 // ---------------------------------------------------------------------------- |
336 // ---------------------------------------------------------------------------- |
337 // CMsgQueueHandler::DoRecordErrorComplete |
337 // CMsgQueueHandler::DoRecordErrorComplete |
414 } |
414 } |
415 |
415 |
416 void CMsgQueueHandler::UpdateDataBufferL() |
416 void CMsgQueueHandler::UpdateDataBufferL() |
417 { |
417 { |
418 SYMBIAN_DEBPRN0(_L("CMsgQueueHandler[0x%x]::UpdateDataBufferL - Enter")); |
418 SYMBIAN_DEBPRN0(_L("CMsgQueueHandler[0x%x]::UpdateDataBufferL - Enter")); |
419 ASSERT(iDataBuffer); // to get here, we should have a data buffer |
419 __ASSERT_ALWAYS(iDataBuffer, User::Leave(KErrGeneral)); // to get here, we should have a data buffer |
420 iDataBuffer->SetPtr(iChunkDataPtr); |
420 iDataBuffer->SetPtr(iChunkDataPtr); |
421 iDataBuffer->SetRequestSizeL(iSetPckg().iRequestSize); |
421 iDataBuffer->SetRequestSizeL(iSetPckg().iRequestSize); |
422 iDataBuffer->SetLastBuffer(EFalse); |
422 iDataBuffer->SetLastBuffer(EFalse); |
423 SYMBIAN_DEBPRN0(_L("CMsgQueueHandler[0x%x]::UpdateDataBufferL - Exit")); |
423 SYMBIAN_DEBPRN0(_L("CMsgQueueHandler[0x%x]::UpdateDataBufferL - Exit")); |
424 } |
424 } |