mtpfws/mtpfw/src/cmtpdataprovider.cpp
changeset 17 aabe5387f5ce
parent 0 d0791faffa3f
child 18 1b39655331a3
equal deleted inserted replaced
0:d0791faffa3f 17:aabe5387f5ce
   479 MMTPDataCodeGenerator& CMTPDataProvider::DataCodeGenerator() const
   479 MMTPDataCodeGenerator& CMTPDataProvider::DataCodeGenerator() const
   480     {
   480     {
   481     return iSingletons.DataCodeGenerator();
   481     return iSingletons.DataCodeGenerator();
   482     }
   482     }
   483 
   483 
       
   484 void CMTPDataProvider::NotifyFrameworkL( TMTPNotificationToFramework aNotification, const TAny* aParams )
       
   485     {
       
   486     __FLOG(_L8("NotifyFrameworkL - Entry"));
       
   487     
       
   488     __ASSERT_DEBUG( aParams, User::Invariant());
       
   489     
       
   490     switch ( aNotification )
       
   491         {
       
   492     case EMTPAddFolder:
       
   493         {
       
   494         TUint deviceDpId = iSingletons.DpController().DeviceDpId();
       
   495         iSingletons.DpController().NotifyDataProvidersL( deviceDpId, EMTPObjectAdded, aParams );
       
   496         }
       
   497         break;
       
   498     default:
       
   499         __FLOG(_L8("Ignore other notification"));
       
   500         break;
       
   501         }
       
   502     
       
   503     __FLOG(_L8("NotifyFrameworkL - Exit"));
       
   504     }
       
   505 
   484 void CMTPDataProvider::DoCancel()
   506 void CMTPDataProvider::DoCancel()
   485     {
   507     {
   486     __FLOG_VA((_L8("DoCancel - Entry, data provider %d "), iId));
   508     __FLOG_VA((_L8("DoCancel - Entry, data provider %d "), iId));
   487     __FLOG_VA((_L8("DoCancel - Exit, data provider %d "), iId)); 
   509     __FLOG_VA((_L8("DoCancel - Exit, data provider %d "), iId)); 
   488 	
   510 	
   526         iErrorRecovery = iStatus.Int();
   548         iErrorRecovery = iStatus.Int();
   527 	    }
   549 	    }
   528     else if (status == KErrCancel)
   550     else if (status == KErrCancel)
   529         {
   551         {
   530         iImplementation->Cancel();
   552         iImplementation->Cancel();
       
   553         }
       
   554     else if (status == KErrAbort)
       
   555         {
       
   556         if (iCurrentRequest != NULL)
       
   557             {
       
   558             TMTPTypeEvent event;
       
   559             event.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeCancelTransaction);
       
   560             event.SetUint32(TMTPTypeEvent::EEventSessionID, iCurrentRequest->Uint32(TMTPTypeRequest::ERequestSessionID) );
       
   561             event.SetUint32(TMTPTypeEvent::EEventTransactionID, iCurrentRequest->Uint32(TMTPTypeRequest::ERequestTransactionID) );
       
   562             
       
   563             iImplementation->ProcessEventL(event ,*iCurrentConnection);
       
   564             }
   531         }
   565         }
   532 
   566 
   533     
   567     
   534     if (iErrorRecovery != KErrNone)
   568     if (iErrorRecovery != KErrNone)
   535         {
   569         {
   556         default:
   590         default:
   557             break;                
   591             break;                
   558             }
   592             }
   559         }
   593         }
   560     
   594     
   561 		else if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumerated)
   595 		else if (iSingletons.DpController().EnumerateState() < CMTPDataProviderController::EEnumeratingPhaseOneDone)
   562     	{
   596     	{
   563         __FLOG(_L8("DP Enumeration is not complete"));
   597         __FLOG(_L8("DP Enumeration is not complete"));
   564 
   598 
   565         TUint16 opCode = iCurrentRequest->Uint16(TMTPTypeRequest::ERequestOperationCode);
   599         TUint16 opCode = iCurrentRequest->Uint16(TMTPTypeRequest::ERequestOperationCode);
   566 
   600 
   601 		    // Won't send any device busy response.
   635 		    // Won't send any device busy response.
   602 		    // Windows wont repond if it gets device busy response after it has send Openseesion.
   636 		    // Windows wont repond if it gets device busy response after it has send Openseesion.
   603 			iTimer.After(iStatus, TTimeIntervalMicroSeconds32(KWaitForEnumeration));
   637 			iTimer.After(iStatus, TTimeIntervalMicroSeconds32(KWaitForEnumeration));
   604 			SetActive();
   638 			SetActive();
   605 			iTimerActive = ETrue;
   639 			iTimerActive = ETrue;
   606 			break;		   
   640 			break;
   607 	   	case ECompletingPhase:
   641 		case EResponsePhase:
   608 	   		TransactionCompleteL(*iCurrentRequest, *iCurrentConnection);   
   642 			iImplementation->ProcessRequestPhaseL(iCurrentTransactionPhase, *iCurrentRequest, *iCurrentConnection);
   609 		   	break;
   643 			break; 		   
   610 	   	default:
   644 	  case ECompletingPhase:
   611 		   	break;
   645 	   	TransactionCompleteL(*iCurrentRequest, *iCurrentConnection);   
       
   646 		  break;
       
   647 	  default:
       
   648 		  break;
   612 		    }
   649 		    }
   613 	    }
   650 	    }
   614 		}
   651 		}
   615     else
   652     else
   616         {
   653         {