mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp
branchRCL_3
changeset 14 60a94a45d437
parent 12 8b094906a049
child 23 f5809cfbf6d5
equal deleted inserted replaced
12:8b094906a049 14:60a94a45d437
    82     iEnumeratingDps.Close();
    82     iEnumeratingDps.Close();
    83     iEnumeratingStorages.Close();
    83     iEnumeratingStorages.Close();
    84     iSingletons.Close();
    84     iSingletons.Close();
    85     CloseRegistrySessionAndEntryL();
    85     CloseRegistrySessionAndEntryL();
    86     delete iOpenSessionWaiter;
    86     delete iOpenSessionWaiter;
       
    87     delete iPendingRequestTimer;
    87     __FLOG(_L8("~CMTPDataProviderController - Exit"));
    88     __FLOG(_L8("~CMTPDataProviderController - Exit"));
    88     __FLOG_CLOSE;
    89     __FLOG_CLOSE;
    89     }
    90     }
    90     
    91     
    91 /**
    92 /**
   106     // Retrieve the data provider registration resource file list.
   107     // Retrieve the data provider registration resource file list.
   107     CDir* registrations;
   108     CDir* registrations;
   108     User::LeaveIfError(iSingletons.Fs().GetDir(KMTPDpResourceDirectory, KEntryAttNormal, ESortByName, registrations));
   109     User::LeaveIfError(iSingletons.Fs().GetDir(KMTPDpResourceDirectory, KEntryAttNormal, ESortByName, registrations));
   109     CleanupStack::PushL(registrations);
   110     CleanupStack::PushL(registrations);
   110 
   111 
       
   112     CreateRegistrySessionAndEntryL();
       
   113     
   111     // Load the registered data providers. 
   114     // Load the registered data providers. 
   112     const TUint KCount(registrations->Count());
   115     const TUint KCount(registrations->Count());
   113     TInt index = 0; 
   116     TInt index = 0; 
   114     for (TInt i = 0; i < KCount; ++i)
   117     for (TInt i = 0; i < KCount; ++i)
   115         {
   118         {
   178 	iDataProviders.Sort(TLinearOrder<CMTPDataProvider>(CMTPDataProvider::LinearOrderEnumerationPhase));
   181 	iDataProviders.Sort(TLinearOrder<CMTPDataProvider>(CMTPDataProvider::LinearOrderEnumerationPhase));
   179 	// Add the DP IDs into DP ID array, except for device DP, File DP and proxy DP
   182 	// Add the DP IDs into DP ID array, except for device DP, File DP and proxy DP
   180 	for (TUint index=0; index < iDataProviders.Count(); index++)
   183 	for (TUint index=0; index < iDataProviders.Count(); index++)
   181 	  {
   184 	  {
   182 	  if ((iDataProviders[index]->DataProviderId() != iDpIdDeviceDp)
   185 	  if ((iDataProviders[index]->DataProviderId() != iDpIdDeviceDp)
   183 	  	  && (iDataProviders[index]->DataProviderId() != iDpIdFileDp)
       
   184 	  	  && (iDataProviders[index]->DataProviderId() != iDpIdProxyDp))
   186 	  	  && (iDataProviders[index]->DataProviderId() != iDpIdProxyDp))
   185 	    {
   187 	    {
   186 	    iDataProviderIds.Append(iDataProviders[index]->DataProviderId());
   188 	    iDataProviderIds.Append(iDataProviders[index]->DataProviderId());
   187 	    }
   189 	    }
   188 	  }
   190 	  }
   411 @param aDp The notifying data provider.
   413 @param aDp The notifying data provider.
   412 */    
   414 */    
   413 void CMTPDataProviderController::EnumerationStateChangedL(const CMTPDataProvider& aDp)
   415 void CMTPDataProviderController::EnumerationStateChangedL(const CMTPDataProvider& aDp)
   414     {
   416     {
   415     __FLOG(_L8("EnumerationStateChangedL - Entry"));
   417     __FLOG(_L8("EnumerationStateChangedL - Entry"));
   416     __FLOG_VA((_L8("Entry iEnumerationState: 0x%x iNextDpId: %d"), iEnumerationState, iNextDpId));
   418     __FLOG_VA((_L8("Entry iEnumerationState: 0x%x DpId: %d"), iEnumerationState, aDp.DataProviderId()));
   417     switch (iEnumerationState)
   419     switch (iEnumerationState)
   418         {        
   420         {        
   419     case EEnumeratingFrameworkStorages:
   421     case EEnumeratingFrameworkStorages:
   420     	switch (aDp.ImplementationUid().iUid)
   422     	switch (aDp.ImplementationUid().iUid)
   421             {
   423             {
   454             iNextDpId = iDpIdProxyDp;
   456             iNextDpId = iDpIdProxyDp;
   455             Schedule();
   457             Schedule();
   456             break;
   458             break;
   457             
   459             
   458         case KMTPImplementationUidProxyDp:
   460         case KMTPImplementationUidProxyDp:
   459             //iNextDpId = iDpIdFileDp;
   461             iEnumerationState   = EEnumeratingDataProviderObjects;
   460             if ( iDataProviderIds.Count()>0 )
   462             iEnumerationPhase   = DataProviderL(iDataProviderIds[0]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase);
       
   463             iDpIdArrayIndex     = 0;                
       
   464             Schedule();
       
   465             break;
       
   466             }
       
   467         break;
       
   468         
       
   469     case EEnumeratingDataProviderObjects:
       
   470     case EEnumeratingSubDirFiles:
       
   471         if(KMTPImplementationUidFileDp == aDp.ImplementationUid().iUid && NeedEnumeratingPhase2())
       
   472             {
       
   473             __FLOG(_L8("File DP first level enum complete"));
       
   474             Cancel();
       
   475 
       
   476             //clean the root level snapshot
       
   477             iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(ETrue);
       
   478 
       
   479             //Schedule again to scan subdir
       
   480             iEnumerationState   = EEnumeratingSubDirFiles;
       
   481 
       
   482             }
       
   483         else
       
   484             {
       
   485             iEnumeratingDps.Remove(iEnumeratingDps.FindInOrderL(aDp.DataProviderId()));
       
   486             // Remove any non-persistent objects that are still marked.
       
   487             iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId());
       
   488     
       
   489             if ((iEnumeratingDps.Count() == 0) && iDpIdArrayIndex >= iDataProviderIds.Count())
   461                 {
   490                 {
   462                 iEnumerationState   = EEnumeratingDataProviderObjects;
   491                 Cancel();
   463                 iEnumerationPhase   = DataProviderL(iDataProviderIds[0]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase);
   492                 iEnumerationState   = EEnumeratingCleanDBSnapshot;
   464                 iDpIdArrayIndex     = 0;                
   493                 iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(EFalse);
       
   494             
       
   495 
   465                 }
   496                 }
   466             else
   497             else
   467                 {
   498                 {
   468                 iNextDpId = iDpIdFileDp;
   499                 if ((iEnumeratingDps.Count() == 0) && (iEnumerationPhase != DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase)))
       
   500                     {
       
   501                     // Enter next enumeration phase
       
   502                     iEnumerationPhase = DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase);
       
   503                     } 
       
   504                 Schedule();
   469                 }
   505                 }
   470             Schedule();
   506             }
   471             break;
   507        
   472             
   508         break;
   473         case KMTPImplementationUidFileDp:
       
   474 			// No other data providers
       
   475 			if(NeedEnumeratingPhase2())
       
   476 				{
       
   477 				iEnumerationState = EEnumeratingSubDirFiles;
       
   478 				if(iOpenSessionWaiter->IsStarted())
       
   479 					{
       
   480 					iOpenSessionWaiter->AsyncStop();
       
   481 					}
       
   482 				//Schedule FildDP to enumerate the files in sub-dir
       
   483 				iNextDpId           = iDpIdFileDp;
       
   484 				Schedule();
       
   485 				}
       
   486 			else
       
   487 				{
       
   488 				iNextDpId = 0;
       
   489 				iEnumeratingStorages.Remove(0);
       
   490 				if (iEnumeratingStorages.Count() == 0)
       
   491 					{
       
   492 					iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId());
       
   493 					iEnumerationState   = EEnumeratedFulllyCompleted;
       
   494 					iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL();
       
   495 						
       
   496 					Cancel();
       
   497 					if(iOpenSessionWaiter->IsStarted())
       
   498 						{
       
   499 						iOpenSessionWaiter->AsyncStop();
       
   500 						}
       
   501 					}
       
   502 				else
       
   503 					{
       
   504 					// Queued enumerations.
       
   505 					iNextDpId           = iDpIdDeviceDp;
       
   506 					Schedule();
       
   507 					}
       
   508 				}
       
   509         		
       
   510             }
       
   511         break;
       
   512         
       
   513     case EEnumeratingDataProviderObjects:
       
   514         // Enumerate non-framework data providers concurrently.
       
   515         iEnumeratingDps.Remove(iEnumeratingDps.FindInOrderL(aDp.DataProviderId()));
       
   516         // Remove any non-persistent objects that are still marked.
       
   517         iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId());
       
   518 
       
   519         if ((iEnumeratingDps.Count() == 0) && iDpIdArrayIndex >= iDataProviderIds.Count())
       
   520             {
       
   521             // Enumeration complete.
       
   522             iNextDpId           = iDpIdFileDp;
       
   523             iEnumerationState   = EEnumeratingFrameworkObjects;
       
   524             			
       
   525 			if ( ( iEnumeratingStorages.Count() > 1 ) &&(KErrNotFound != iEnumeratingStorages.Find(KMTPStorageAll)) )
       
   526 				{
       
   527 				const TUint storageid = iEnumeratingStorages[0];
       
   528 				iEnumeratingStorages.Remove(0);
       
   529 				if(KMTPStorageAll == storageid)
       
   530 					{
       
   531 					iEnumeratingStorages.Append(KMTPStorageAll);
       
   532 					}
       
   533 				
       
   534 				if(iEnumeratingStorages[0] != KMTPStorageAll)
       
   535 					{
       
   536 					iNextDpId = iDpIdDeviceDp;
       
   537 					}
       
   538 				}
       
   539             }
       
   540         else
       
   541             {
       
   542             if ((iEnumeratingDps.Count() == 0) && (iEnumerationPhase != DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase)))
       
   543                 {
       
   544                 // Enter next enumeration phase
       
   545                 iEnumerationPhase = DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase);
       
   546                 }
       
   547             }
       
   548         Schedule();        
       
   549         break;
       
   550         
       
   551     case EEnumeratingSubDirFiles:
       
   552     	{
       
   553     	if(aDp.ImplementationUid().iUid == KMTPImplementationUidFileDp)
       
   554     		{
       
   555 			iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId());
       
   556 			iNextDpId = 0;
       
   557 			iEnumeratingStorages.Remove(0);
       
   558 			if(iEnumeratingStorages.Count() == 0)
       
   559 				{
       
   560 				iSingletons.DpController().SetNeedEnumeratingPhase2(EFalse);
       
   561 				iEnumerationState   = EEnumeratedFulllyCompleted;
       
   562 				iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL();
       
   563 				}
       
   564 			else //removable card plug in
       
   565 				{
       
   566 				iNextDpId           = iDpIdDeviceDp;
       
   567 				iEnumerationState   = EEnumeratingFrameworkObjects;
       
   568 				Schedule();
       
   569 				}
       
   570     		}
       
   571     	}
       
   572     	break;
       
   573     	
       
   574     case EEnumeratedFulllyCompleted:
   509     case EEnumeratedFulllyCompleted:
   575     case EUnenumerated:
   510     case EUnenumerated:
   576     case EEnumerationStarting:
   511     case EEnumerationStarting:
   577     case EEnumeratingPhaseOneDone:
   512     case EEnumeratingPhaseOneDone:
   578     default:
   513     default:
   579         __DEBUG_ONLY(User::Invariant());
   514         __DEBUG_ONLY(User::Invariant());
   580         break;
   515         break;
   581         }
   516         }
   582     
   517     
   583     __FLOG_VA((_L8("Exit iEnumerationState: 0x%x, iNextDpId: %d, UID=0x%x"), iEnumerationState, iNextDpId, aDp.ImplementationUid().iUid));
   518     __FLOG_VA((_L8("Exit iEnumerationState: 0x%x, DpId: %d, UID=0x%x"), iEnumerationState,  aDp.DataProviderId(), aDp.ImplementationUid().iUid));
   584     __FLOG(_L8("EnumerationStateChangedL - Exit"));
   519     __FLOG(_L8("EnumerationStateChangedL - Exit"));
   585     }
   520     }
   586 
   521 
   587 void CMTPDataProviderController::DoCancel()
   522 void CMTPDataProviderController::DoCancel()
   588     {
   523     {
   589     __FLOG(_L8("DoCancel - Entry"));
   524     __FLOG(_L8("DoCancel - Entry"));
   590     __FLOG(_L8("DoCancel - Exit"));
   525     __FLOG(_L8("DoCancel - Exit"));
   591     }
   526     }
   592     
   527     
       
   528 
       
   529 
       
   530 /*
       
   531  *Buid Db SnapShot for storage
       
   532  */
       
   533 void CMTPDataProviderController::EstablishDBSnapshotL(TUint32 aStorageId)
       
   534     {
       
   535     if(KMTPStorageAll == aStorageId)
       
   536         {
       
   537         iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(aStorageId);
       
   538         }
       
   539     else 
       
   540         {
       
   541         const CMTPStorageMetaData& storage(iSingletons.StorageMgr().StorageL(aStorageId));
       
   542         if(storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem)
       
   543             {
       
   544             const RArray<TUint>& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds));
       
   545             const TUint KCountLogicalIds(logicalIds.Count());
       
   546             for (TUint i(0); (i < KCountLogicalIds); i++)
       
   547                 {
       
   548                 __FLOG_VA((_L8("Establish snapshot for storage: 0x%x"), logicalIds[i]));
       
   549                 iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(logicalIds[i]);
       
   550                 }   
       
   551             }
       
   552         }
       
   553     }
       
   554 
       
   555 
   593 void CMTPDataProviderController::RunL()
   556 void CMTPDataProviderController::RunL()
   594     {
   557     {
   595     __FLOG(_L8("RunL - Entry"));
   558     __FLOG(_L8("RunL - Entry"));
   596     __FLOG_VA((_L8("iEnumerationState: 0x%x iNextDpId: %d"), iEnumerationState, iNextDpId));
   559     __FLOG_VA((_L8("iEnumerationState: 0x%x iNextDpId: %d"), iEnumerationState, iNextDpId));
   597     switch (iEnumerationState)
   560     switch (iEnumerationState)
   642                 iNextDpId = iDpIdDeviceDp;
   605                 iNextDpId = iDpIdDeviceDp;
   643                 Schedule();
   606                 Schedule();
   644                 }
   607                 }
   645             }
   608             }
   646         else
   609         else
   647         	{
   610             {
   648             // Enumerate framework data providers sequentially.
   611             // Enumerate framework data providers sequentially.
   649             if(iNextDpId == iDpIdDeviceDp)
   612             if(iNextDpId == iDpIdDeviceDp)
   650                 {
   613                 {
   651                 if(KMTPStorageAll == storageId)
   614                 EstablishDBSnapshotL(storageId);
   652                     {
       
   653                     iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(storageId);
       
   654                     }
       
   655                 else 
       
   656                     {
       
   657 					const CMTPStorageMetaData& storage(iSingletons.StorageMgr().StorageL(storageId));
       
   658                 	if(storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem)
       
   659                 		{
       
   660 						const RArray<TUint>& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds));
       
   661 						const TUint KCountLogicalIds(logicalIds.Count());
       
   662 						for (TUint i(0); (i < KCountLogicalIds); i++)
       
   663 							{
       
   664 							__FLOG_VA((_L8("Establish snapshot for storage: 0x%x"), logicalIds[i]));
       
   665 							iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(logicalIds[i]);
       
   666 							}	
       
   667                 		}
       
   668                     }
       
   669                 }
   615                 }
   670             	
       
   671             EnumerateDataProviderObjectsL(iNextDpId);          
   616             EnumerateDataProviderObjectsL(iNextDpId);          
   672             }
   617             }
   673         	}
   618         }
   674         break;
   619         break;
   675         
   620         
   676     case EEnumeratingDataProviderObjects:
   621     case EEnumeratingDataProviderObjects:
   677         {
   622     case EEnumeratingSubDirFiles:
       
   623         {
       
   624         
       
   625         if(EEnumeratingSubDirFiles == iEnumerationState &&  NeedEnumeratingPhase2())
       
   626             {
       
   627             TUint32 storageId = iEnumeratingStorages[0];
       
   628             EnumerateDataProviderObjectsL(iDpIdFileDp);
       
   629             SetNeedEnumeratingPhase2(EFalse);
       
   630             
       
   631             if(iOpenSessionWaiter->IsStarted())
       
   632                 {
       
   633                 iOpenSessionWaiter->AsyncStop();
       
   634                 }            
       
   635             ExecutePendingRequestL(); 
       
   636             }
       
   637         
   678         TUint currentDp = 0;
   638         TUint currentDp = 0;
   679         
   639         
   680         // Enumerate non-framework data providers concurrently.
   640         // Enumerate non-framework data providers concurrently.
   681         const TUint KLoadedDps(iDataProviderIds.Count());
   641         const TUint KLoadedDps(iDataProviderIds.Count());
   682         while ((iEnumeratingDps.Count() < KMTPMaxEnumeratingDataProviders) && (iDpIdArrayIndex < KLoadedDps)
   642         while ((iEnumeratingDps.Count() < KMTPMaxEnumeratingDataProviders) && (iDpIdArrayIndex < KLoadedDps)
   683                && (iEnumerationPhase == DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase)))
   643                && (iEnumerationPhase == DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase)))
   684             {
   644             {
   685             currentDp = iDataProviderIds[iDpIdArrayIndex++];
   645             currentDp = iDataProviderIds[iDpIdArrayIndex++];
       
   646             __FLOG_VA((_L8("Enumerating dpid %d"), currentDp));
   686             iEnumeratingDps.InsertInOrderL(currentDp);
   647             iEnumeratingDps.InsertInOrderL(currentDp);
   687             EnumerateDataProviderObjectsL(currentDp);
   648             EnumerateDataProviderObjectsL(currentDp);
   688             }
   649             }
   689         
   650         
   690         __FLOG_VA((_L8("iDpIdArrayIndex = %d, KLoadedDps = %d"), iDpIdArrayIndex, KLoadedDps));
   651         __FLOG_VA((_L8("iDpIdArrayIndex = %d, KLoadedDps = %d"), iDpIdArrayIndex, KLoadedDps));
   691         }
   652         }
   692         break;
   653         break;
   693         
   654         
   694     case EEnumeratingSubDirFiles:
   655     case EEnumeratingCleanDBSnapshot:
   695     	{
   656         {
   696     	EnumerateDataProviderObjectsL(iNextDpId); 
   657         iEnumeratingStorages.Remove(0);        
   697     	}
   658         iSingletons.ObjectMgr().ObjectStore().ObjectsEnumComplete();
   698     	break;
   659         if(iOpenSessionWaiter->IsStarted())
       
   660             {
       
   661             iOpenSessionWaiter->AsyncStop();
       
   662             }
       
   663         ExecutePendingRequestL();   
       
   664         
       
   665         if (iEnumeratingStorages.Count() > 0)
       
   666             {
       
   667             iNextDpId           = iDpIdDeviceDp;
       
   668             iEnumerationState   = EEnumeratingFrameworkObjects;
       
   669             Schedule();
       
   670             }
       
   671         else
       
   672             {
       
   673             iEnumerationState   = EEnumeratedFulllyCompleted; //Really finished
       
   674             }
       
   675         }
       
   676         break;
       
   677         
   699     case EEnumeratedFulllyCompleted:
   678     case EEnumeratedFulllyCompleted:
   700     case EUnenumerated:
   679     case EUnenumerated:
   701     case EEnumeratingPhaseOneDone:
   680     case EEnumeratingPhaseOneDone:
   702     default:
   681     default:
   703         __DEBUG_ONLY(User::Invariant());
   682         __DEBUG_ONLY(User::Invariant());
   775 		{
   754 		{
   776 		if(tMTPMode != KMTPModeMTP && tMTPMode != KMTPModePTP && tMTPMode != KMTPModePictBridge)
   755 		if(tMTPMode != KMTPModeMTP && tMTPMode != KMTPModePTP && tMTPMode != KMTPModePictBridge)
   777 		tMTPMode = KMTPModeMTP;
   756 		tMTPMode = KMTPModeMTP;
   778 		}
   757 		}
   779 	iMode = (TMTPOperationalMode)tMTPMode;
   758 	iMode = (TMTPOperationalMode)tMTPMode;
   780 	CreateRegistrySessionAndEntryL();
   759 	//CreateRegistrySessionAndEntryL();
   781     
   760     
   782 	SetNeedEnumeratingPhase2(EFalse);
   761 	SetNeedEnumeratingPhase2(EFalse);
   783 	
   762 	
   784     iOpenSessionWaiter = new(ELeave) CActiveSchedulerWait();
   763     iOpenSessionWaiter = new(ELeave) CActiveSchedulerWait();
       
   764     
       
   765     iPendingRequestTimer = CMTPPendingReqestTimer::NewL(this);
       
   766     
   785     __FLOG(_L8("ConstructL - Exit"));
   767     __FLOG(_L8("ConstructL - Exit"));
   786     }
   768     }
   787     
   769     
   788 /**
   770 /**
   789 Creates a data provider configurability parameter data instance on the cleanup 
   771 Creates a data provider configurability parameter data instance on the cleanup 
  1194     return iEnumerationState;
  1176     return iEnumerationState;
  1195     } 
  1177     } 
  1196 
  1178 
  1197 void CMTPDataProviderController::CreateRegistrySessionAndEntryL()
  1179 void CMTPDataProviderController::CreateRegistrySessionAndEntryL()
  1198 	{
  1180 	{
       
  1181     if(iStubFound)
       
  1182         {
       
  1183         return;
       
  1184         }
       
  1185             
  1199 	User::LeaveIfError(iSisSession.Connect());
  1186 	User::LeaveIfError(iSisSession.Connect());
  1200     CleanupClosePushL(iSisSession);
  1187     CleanupClosePushL(iSisSession);
  1201     TInt err = KErrNone;
  1188     TInt err = KErrNone;
  1202     TUint stubuid;
  1189     TUint stubuid;
  1203     iSingletons.FrameworkConfig().GetValueL(CMTPFrameworkConfig::EPackageStubUID , stubuid);
  1190     iSingletons.FrameworkConfig().GetValueL(CMTPFrameworkConfig::EPackageStubUID , stubuid);
  1231 EXPORT_C TBool CMTPDataProviderController::NeedEnumeratingPhase2() const
  1218 EXPORT_C TBool CMTPDataProviderController::NeedEnumeratingPhase2() const
  1232 	{
  1219 	{
  1233 	return iNeedEnumeratingPhase2;
  1220 	return iNeedEnumeratingPhase2;
  1234 	}
  1221 	}
  1235 
  1222 
       
  1223 
       
  1224 EXPORT_C void CMTPDataProviderController::RegisterPendingRequestDP(TUint aDpUid, TUint aTimeOut)
       
  1225     {
       
  1226     __FLOG(_L8("CMTPDataProviderController::RegisterPendingRequestDP - Entry"));
       
  1227     
       
  1228     __ASSERT_DEBUG((iPendingRequestDpUid == 0), User::Invariant());
       
  1229     iPendingRequestDpUid = aDpUid;
       
  1230     if (aTimeOut > 0)
       
  1231         {
       
  1232         iPendingRequestTimer->Start(aTimeOut);
       
  1233         }
       
  1234     
       
  1235     __FLOG(_L8("CMTPDataProviderController::RegisterPendingRequestDP - Exit"));    
       
  1236     }
       
  1237 
       
  1238 
       
  1239 EXPORT_C void CMTPDataProviderController::ExecutePendingRequestL()
       
  1240     {
       
  1241     __FLOG(_L8("CMTPDataProviderController::ExecutePendingRequestL - Entry"));
       
  1242     
       
  1243     if (iPendingRequestDpUid == 0)
       
  1244         {
       
  1245         iPendingRequestTimer->Cancel();
       
  1246         return;
       
  1247         }
       
  1248     
       
  1249     int i = 0;
       
  1250     int count = iDataProviders.Count();
       
  1251     for (i = 0; i < count; ++i)
       
  1252         {
       
  1253         if (iDataProviders[i]->ImplementationUid().iUid == iPendingRequestDpUid)
       
  1254             {
       
  1255             iDataProviders[i]->ExecutePendingRequestL();
       
  1256             iPendingRequestDpUid = 0;
       
  1257             break;
       
  1258             }
       
  1259         }
       
  1260     
       
  1261     iPendingRequestTimer->Cancel();
       
  1262     __FLOG(_L8("CMTPDataProviderController::ExecutePendingRequestL - Exit"));    
       
  1263     }
       
  1264 
       
  1265 EXPORT_C TUint CMTPDataProviderController::StorageEnumerateState(TUint aStorageId)
       
  1266     {
       
  1267     if (iEnumeratingStorages.Count() == 0)
       
  1268         return EEnumeratedFulllyCompleted;
       
  1269     
       
  1270     TUint ret = EUnenumerated;
       
  1271     CMTPStorageMgr& storages = iSingletons.StorageMgr();
       
  1272     TInt idx = iEnumeratingStorages.Find(storages.PhysicalStorageId(aStorageId));
       
  1273     
       
  1274     if (idx == KErrNotFound)
       
  1275         {
       
  1276         if (iEnumeratingStorages[0] == KMTPStorageAll)
       
  1277             {
       
  1278             ret = EnumerateState();
       
  1279             }
       
  1280         else
       
  1281             {
       
  1282             ret = EEnumeratedFulllyCompleted;
       
  1283             }
       
  1284         }
       
  1285     else if (idx > 0)
       
  1286         {
       
  1287         ret = EUnenumerated;
       
  1288         }
       
  1289     else   //idx == 0
       
  1290         {
       
  1291         ret = EnumerateState();
       
  1292         }
       
  1293 
       
  1294     return ret;
       
  1295     }
       
  1296 
       
  1297 CMTPDataProviderController::CMTPPendingReqestTimer* CMTPDataProviderController::CMTPPendingReqestTimer::NewL(CMTPDataProviderController* aDPController)
       
  1298     {
       
  1299     CMTPPendingReqestTimer* self = new (ELeave) CMTPDataProviderController::CMTPPendingReqestTimer(aDPController);
       
  1300     CleanupStack::PushL(self);
       
  1301     self->ConstructL();
       
  1302     CleanupStack::Pop(self);
       
  1303     return self;
       
  1304     }
       
  1305 
       
  1306 CMTPDataProviderController::CMTPPendingReqestTimer::~CMTPPendingReqestTimer()
       
  1307     {
       
  1308     __FLOG(_L8("~CMTPPendingReqestTimer - Entry"));  
       
  1309     
       
  1310     Cancel();
       
  1311     
       
  1312     __FLOG(_L8("~CMTPPendingReqestTimer - Exit"));    
       
  1313     __FLOG_CLOSE;
       
  1314     
       
  1315     }
       
  1316           
       
  1317 void CMTPDataProviderController::CMTPPendingReqestTimer::Start(TUint aTimeOut)
       
  1318     {
       
  1319     __FLOG(_L8("CMTPPendingReqestTimer::Start - Entry"));
       
  1320     
       
  1321     if (aTimeOut > 0)
       
  1322         {
       
  1323         const TUint KMTPPendingRequestDelay = (1000000 * aTimeOut);
       
  1324         After(KMTPPendingRequestDelay);
       
  1325         }
       
  1326     
       
  1327     __FLOG(_L8("CMTPPendingReqestTimer::Start - Exit"));
       
  1328     }
       
  1329         
       
  1330 void CMTPDataProviderController::CMTPPendingReqestTimer::RunL()
       
  1331     {
       
  1332     __FLOG(_L8("CMTPPendingReqestTimer::RunL - Entry"));
       
  1333 
       
  1334     iDPController->ExecutePendingRequestL();
       
  1335     
       
  1336     __FLOG(_L8("CMTPPendingReqestTimer::RunL - Exit"));
       
  1337     }
       
  1338 
       
  1339 CMTPDataProviderController::CMTPPendingReqestTimer::CMTPPendingReqestTimer(CMTPDataProviderController* aDPController) :
       
  1340     CTimer(EPriorityNormal)
       
  1341     {
       
  1342     iDPController = aDPController;
       
  1343     }
       
  1344 
       
  1345 void CMTPDataProviderController::CMTPPendingReqestTimer::ConstructL()
       
  1346     {
       
  1347     __FLOG_OPEN(KMTPSubsystem, KComponent);
       
  1348     __FLOG(_L8("CMTPPendingReqestTimer::ConstructL - Entry"));
       
  1349 
       
  1350     CTimer::ConstructL();
       
  1351     CActiveScheduler::Add(this);
       
  1352     
       
  1353     __FLOG(_L8("CMTPPendingReqestTimer::ConstructL - Exit"));    
       
  1354     }
       
  1355