equal
deleted
inserted
replaced
220 else if ( iOperationType == EDunOperationTypeWrite ) |
220 else if ( iOperationType == EDunOperationTypeWrite ) |
221 { |
221 { |
222 iPushData.iDataPusher->StopOneEvent( iBufferPtr ); |
222 iPushData.iDataPusher->StopOneEvent( iBufferPtr ); |
223 } |
223 } |
224 iTransferState = EDunStateIdle; |
224 iTransferState = EDunStateIdle; |
|
225 iOperationType = EDunOperationTypeUndefined; |
225 FTRACE(FPrint( _L("CDunDownstream::Stop() complete" ))); |
226 FTRACE(FPrint( _L("CDunDownstream::Stop() complete" ))); |
226 return KErrNone; |
227 return KErrNone; |
227 } |
228 } |
228 |
229 |
229 // --------------------------------------------------------------------------- |
230 // --------------------------------------------------------------------------- |
296 |
297 |
297 switch ( iDirection ) |
298 switch ( iDirection ) |
298 { |
299 { |
299 case EDunReaderDownstream: |
300 case EDunReaderDownstream: |
300 iStatus = KRequestPending; |
301 iStatus = KRequestPending; |
|
302 iTransferState = EDunStateTransferring; |
301 iNetwork->ReadOneOrMore( iStatus, *iBufferPtr ); |
303 iNetwork->ReadOneOrMore( iStatus, *iBufferPtr ); |
302 SetActive(); |
304 SetActive(); |
303 FTRACE(FPrint( _L("CDunDownstream::IssueRequest() RComm ReadOneOrMore() requested" ) )); |
305 FTRACE(FPrint( _L("CDunDownstream::IssueRequest() RComm ReadOneOrMore() requested" ) )); |
304 break; |
306 break; |
305 case EDunWriterDownstream: |
307 case EDunWriterDownstream: |
|
308 iTransferState = EDunStateTransferring; |
306 AddToQueueAndSend( iBufferPtr, this ); |
309 AddToQueueAndSend( iBufferPtr, this ); |
307 break; |
310 break; |
308 default: |
311 default: |
309 FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (ERROR) complete" ) )); |
312 FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (ERROR) complete" ) )); |
310 return KErrGeneral; |
313 return KErrGeneral; |
311 } |
314 } |
312 |
|
313 iTransferState = EDunStateTransferring; |
|
314 |
315 |
315 FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (Dir=%d) complete" ), iDirection)); |
316 FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (Dir=%d) complete" ), iDirection)); |
316 return KErrNone; |
317 return KErrNone; |
317 } |
318 } |
318 |
319 |
372 // Gets called on cancel |
373 // Gets called on cancel |
373 // --------------------------------------------------------------------------- |
374 // --------------------------------------------------------------------------- |
374 // |
375 // |
375 void CDunDownstream::DoCancel() |
376 void CDunDownstream::DoCancel() |
376 { |
377 { |
|
378 FTRACE(FPrint( _L("CDunDownstream::DoCancel()" ))); |
|
379 FTRACE(FPrint( _L("CDunDownstream::DoCancel() complete" ))); |
377 } |
380 } |
378 |
381 |
379 // --------------------------------------------------------------------------- |
382 // --------------------------------------------------------------------------- |
380 // From class MDunStreamManipulator. |
383 // From class MDunStreamManipulator. |
381 // Gets called when outside party wants to push data to the existing stream |
384 // Gets called when outside party wants to push data to the existing stream |
405 if ( !aAllPushed ) |
408 if ( !aAllPushed ) |
406 { |
409 { |
407 FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (continue) complete" ))); |
410 FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (continue) complete" ))); |
408 return; |
411 return; |
409 } |
412 } |
410 iTransferState = EDunStateIdle; |
|
411 iOperationType = EDunOperationTypeUndefined; |
|
412 if ( !iPushData.iDataPusher ) |
413 if ( !iPushData.iDataPusher ) |
413 { |
414 { |
414 FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (iPushData.iDataPusher not initialized!) complete" ))); |
415 FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (iPushData.iDataPusher not initialized!) complete" ))); |
415 return; |
416 return; |
416 } |
417 } |
421 TInt foundIndex = iPushData.iDataPusher->FindEventFromQueue( iBufferPtr ); |
422 TInt foundIndex = iPushData.iDataPusher->FindEventFromQueue( iBufferPtr ); |
422 iPushData.iDataPusher->SignalCompletionAndClearQueue(); |
423 iPushData.iDataPusher->SignalCompletionAndClearQueue(); |
423 FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (find event)" ))); |
424 FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (find event)" ))); |
424 if ( foundIndex >= 0 ) |
425 if ( foundIndex >= 0 ) |
425 { |
426 { |
426 // Restart the reading from Dataport only if in data mode |
427 iTransferState = EDunStateIdle; |
|
428 iOperationType = EDunOperationTypeUndefined; |
427 FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (issue request)" ))); |
429 FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (issue request)" ))); |
428 if ( iPushData.iDataMode ) |
430 if ( iPushData.iDataMode ) |
429 { |
431 { |
430 iOperationType = EDunOperationTypeRead; |
432 iOperationType = EDunOperationTypeRead; |
431 IssueRequest(); |
433 IssueRequest(); |
441 // |
443 // |
442 void CDunDownstream::NotifyCommandModeStart() |
444 void CDunDownstream::NotifyCommandModeStart() |
443 { |
445 { |
444 FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart()" ))); |
446 FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart()" ))); |
445 iPushData.iDataMode = EFalse; |
447 iPushData.iDataMode = EFalse; |
446 // Now the data mode has ended. |
448 // Now the data mode has ended. If read operation then cancel it. |
447 // If read operation then cancel it. |
449 // Check for iTransferState here to minimize logging |
448 if ( iOperationType == EDunOperationTypeRead ) |
450 if ( iTransferState==EDunStateTransferring && |
|
451 iOperationType==EDunOperationTypeRead ) |
449 { |
452 { |
450 Stop( EFalse ); |
453 Stop( EFalse ); |
451 } |
454 } |
452 FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart() complete" ))); |
455 FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart() complete" ))); |
453 } |
456 } |
459 // |
462 // |
460 void CDunDownstream::NotifyCommandModeEnd() |
463 void CDunDownstream::NotifyCommandModeEnd() |
461 { |
464 { |
462 FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd()" ))); |
465 FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd()" ))); |
463 iPushData.iDataMode = ETrue; |
466 iPushData.iDataMode = ETrue; |
464 // Command mode ends here so start reading from Dataport |
467 // Command mode ends here so start reading from Dataport only if generic |
465 iOperationType = EDunOperationTypeRead; |
468 // transferring state is EDunStateIdle. This is a reduced form of having |
466 IssueRequest(); |
469 // read pending -> reissue not needed OR write pending -> reissue not needed |
|
470 // (NotifyDataPushComplete() will reissue). |
|
471 if ( iTransferState == EDunStateIdle ) |
|
472 { |
|
473 iOperationType = EDunOperationTypeRead; // just in case |
|
474 IssueRequest(); |
|
475 } |
467 FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd() complete" ))); |
476 FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd() complete" ))); |
468 } |
477 } |